mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 16:37:21 -06:00
Coding style clean up
This commit is contained in:
@@ -62,7 +62,7 @@ enum ArticleRoles {
|
||||
}
|
||||
|
||||
// display a right-click menu
|
||||
void RSSImp::displayRSSListMenu(const QPoint& pos){
|
||||
void RSSImp::displayRSSListMenu(const QPoint& pos) {
|
||||
if (!m_feedList->indexAt(pos).isValid()) {
|
||||
// No item under the mouse, clear selection
|
||||
m_feedList->clearSelection();
|
||||
@@ -99,7 +99,7 @@ void RSSImp::displayRSSListMenu(const QPoint& pos){
|
||||
myRSSListMenu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void RSSImp::displayItemsListMenu(const QPoint&){
|
||||
void RSSImp::displayItemsListMenu(const QPoint&) {
|
||||
QMenu myItemListMenu(this);
|
||||
QList<QListWidgetItem*> selectedItems = listArticles->selectedItems();
|
||||
if (selectedItems.size() > 0) {
|
||||
@@ -203,7 +203,7 @@ void RSSImp::on_newFeedButton_clicked() {
|
||||
QString newUrl = QInputDialog::getText(this, tr("Please type a rss stream url"), tr("Stream URL:"), QLineEdit::Normal, default_url, &ok);
|
||||
if (ok) {
|
||||
newUrl = newUrl.trimmed();
|
||||
if (!newUrl.isEmpty()){
|
||||
if (!newUrl.isEmpty()) {
|
||||
if (m_feedList->hasFeed(newUrl)) {
|
||||
QMessageBox::warning(this, tr("qBittorrent"),
|
||||
tr("This rss feed is already in the list."),
|
||||
@@ -242,8 +242,8 @@ void RSSImp::deleteSelectedItems() {
|
||||
tr("&Yes"), tr("&No"),
|
||||
QString(), 0, 1);
|
||||
if (!ret) {
|
||||
foreach (QTreeWidgetItem *item, selectedItems){
|
||||
if (m_feedList->currentFeed() == item){
|
||||
foreach (QTreeWidgetItem *item, selectedItems) {
|
||||
if (m_feedList->currentFeed() == item) {
|
||||
textBrowser->clear();
|
||||
m_currentArticle = 0;
|
||||
listArticles->clear();
|
||||
@@ -374,7 +374,7 @@ void RSSImp::renameFiles() {
|
||||
//right-click on stream : refresh it
|
||||
void RSSImp::refreshSelectedItems() {
|
||||
QList<QTreeWidgetItem*> selectedItems = m_feedList->selectedItems();
|
||||
foreach (QTreeWidgetItem* item, selectedItems){
|
||||
foreach (QTreeWidgetItem* item, selectedItems) {
|
||||
RssFilePtr file = m_feedList->getRSSItem(item);
|
||||
// Update icons
|
||||
if (item == m_feedList->stickyUnreadItem()) {
|
||||
@@ -402,7 +402,7 @@ void RSSImp::copySelectedFeedsURL() {
|
||||
QStringList URLs;
|
||||
QList<QTreeWidgetItem*> selectedItems = m_feedList->selectedItems();
|
||||
QTreeWidgetItem* item;
|
||||
foreach (item, selectedItems){
|
||||
foreach (item, selectedItems) {
|
||||
if (m_feedList->isFeed(item))
|
||||
URLs << m_feedList->getItemID(item);
|
||||
}
|
||||
@@ -412,7 +412,7 @@ void RSSImp::copySelectedFeedsURL() {
|
||||
void RSSImp::on_markReadButton_clicked() {
|
||||
QList<QTreeWidgetItem*> selectedItems = m_feedList->selectedItems();
|
||||
QTreeWidgetItem* item;
|
||||
foreach (item, selectedItems){
|
||||
foreach (item, selectedItems) {
|
||||
RssFilePtr rss_item = m_feedList->getRSSItem(item);
|
||||
rss_item->markAsRead();
|
||||
updateItemInfos(item);
|
||||
@@ -428,7 +428,7 @@ void RSSImp::fillFeedsList(QTreeWidgetItem *parent, const RssFolderPtr& rss_pare
|
||||
} else {
|
||||
children = m_rssManager->getContent();
|
||||
}
|
||||
foreach (const RssFilePtr& rss_child, children){
|
||||
foreach (const RssFilePtr& rss_child, children) {
|
||||
QTreeWidgetItem* item;
|
||||
if (!parent)
|
||||
item = new QTreeWidgetItem(m_feedList);
|
||||
@@ -471,12 +471,12 @@ void RSSImp::refreshArticleList(QTreeWidgetItem* item) {
|
||||
m_currentArticle = 0;
|
||||
listArticles->clear();
|
||||
qDebug("Got the list of news");
|
||||
foreach (const RssArticlePtr &article, news){
|
||||
foreach (const RssArticlePtr &article, news) {
|
||||
QListWidgetItem* it = new QListWidgetItem(listArticles);
|
||||
it->setData(Article::TitleRole, article->title());
|
||||
it->setData(Article::FeedUrlRole, article->parent()->url());
|
||||
it->setData(Article::IdRole, article->guid());
|
||||
if (article->isRead()){
|
||||
if (article->isRead()) {
|
||||
it->setData(Article::ColorRole, QVariant(QColor("grey")));
|
||||
it->setData(Article::IconRole, QVariant(QIcon(":/Icons/sphere.png")));
|
||||
}else{
|
||||
@@ -571,12 +571,12 @@ void RSSImp::updateItemInfos(QTreeWidgetItem *item) {
|
||||
updateItemInfos(item->parent());
|
||||
}
|
||||
|
||||
void RSSImp::updateFeedIcon(const QString &url, const QString &icon_path){
|
||||
void RSSImp::updateFeedIcon(const QString &url, const QString &icon_path) {
|
||||
QTreeWidgetItem *item = m_feedList->getTreeItemFromUrl(url);
|
||||
item->setData(0,Qt::DecorationRole, QVariant(QIcon(icon_path)));
|
||||
}
|
||||
|
||||
void RSSImp::updateFeedInfos(const QString &url, const QString &display_name, uint nbUnread){
|
||||
void RSSImp::updateFeedInfos(const QString &url, const QString &display_name, uint nbUnread) {
|
||||
qDebug() << Q_FUNC_INFO << display_name;
|
||||
QTreeWidgetItem *item = m_feedList->getTreeItemFromUrl(url);
|
||||
RssFeedPtr stream = qSharedPointerCast<RssFeed>(m_feedList->getRSSItem(item));
|
||||
@@ -589,7 +589,7 @@ void RSSImp::updateFeedInfos(const QString &url, const QString &display_name, ui
|
||||
// Update Unread item
|
||||
updateItemInfos(m_feedList->stickyUnreadItem());
|
||||
// If the feed is selected, update the displayed news
|
||||
if (m_feedList->currentItem() == item ){
|
||||
if (m_feedList->currentItem() == item ) {
|
||||
refreshArticleList(item);
|
||||
} else {
|
||||
// Update unread items
|
||||
@@ -670,7 +670,7 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent), m_rssManager(new RssManager)
|
||||
qDebug("RSSImp constructed");
|
||||
}
|
||||
|
||||
RSSImp::~RSSImp(){
|
||||
RSSImp::~RSSImp() {
|
||||
qDebug("Deleting RSSImp...");
|
||||
saveFoldersOpenState();
|
||||
delete m_feedList;
|
||||
|
||||
@@ -315,7 +315,7 @@ bool RssArticle::isRead() const{
|
||||
return m_read;
|
||||
}
|
||||
|
||||
void RssArticle::markAsRead(){
|
||||
void RssArticle::markAsRead() {
|
||||
m_read = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,8 @@
|
||||
#include <QList>
|
||||
#include <QHash>
|
||||
#include <QVariantHash>
|
||||
|
||||
#include "rssdownloadrule.h"
|
||||
|
||||
s
|
||||
// This class is not thread-safe (not required)
|
||||
class RssDownloadRuleList
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ RssFeed::RssFeed(RssManager* manager, RssFolder* parent, const QString &url):
|
||||
loadItemsFromDisk();
|
||||
}
|
||||
|
||||
RssFeed::~RssFeed(){
|
||||
RssFeed::~RssFeed() {
|
||||
if (!m_icon.startsWith(":/") && QFile::exists(m_icon))
|
||||
QFile::remove(m_icon);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ QString RssFeed::title() const{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void RssFeed::rename(const QString &new_name){
|
||||
void RssFeed::rename(const QString &new_name) {
|
||||
qDebug() << "Renaming stream to" << new_name;
|
||||
m_alias = new_name;
|
||||
}
|
||||
@@ -321,14 +321,14 @@ void RssFeed::resizeList() {
|
||||
RssArticleList listItems = m_articles.values();
|
||||
RssManager::sortNewsList(listItems);
|
||||
const int excess = nb_articles - max_articles;
|
||||
for (uint i=nb_articles-excess; i<nb_articles; ++i){
|
||||
for (uint i=nb_articles-excess; i<nb_articles; ++i) {
|
||||
m_articles.remove(listItems.at(i)->guid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// existing and opening test after download
|
||||
bool RssFeed::parseXmlFile(const QString &file_path){
|
||||
bool RssFeed::parseXmlFile(const QString &file_path) {
|
||||
qDebug("openRss() called");
|
||||
QFile fileRss(file_path);
|
||||
if (!fileRss.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
|
||||
@@ -41,7 +41,7 @@ class RssManager;
|
||||
|
||||
typedef QHash<QString, RssArticlePtr> RssArticleHash;
|
||||
typedef QSharedPointer<RssFeed> RssFeedPtr;
|
||||
typedef QList<RssFeedPtr> RssFeedList;
|
||||
typedef RssFeedList RssFeedList;
|
||||
|
||||
class RssFeed: public QObject, public RssFile {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -45,7 +45,7 @@ RssManager::RssManager():
|
||||
m_refreshTimer.start(m_refreshInterval*60000);
|
||||
}
|
||||
|
||||
RssManager::~RssManager(){
|
||||
RssManager::~RssManager() {
|
||||
qDebug("Deleting RSSManager...");
|
||||
delete m_rssDownloader;
|
||||
delete m_downloadRules;
|
||||
@@ -54,7 +54,7 @@ RssManager::~RssManager(){
|
||||
qDebug("RSSManager deleted");
|
||||
}
|
||||
|
||||
void RssManager::updateRefreshInterval(uint val){
|
||||
void RssManager::updateRefreshInterval(uint val) {
|
||||
if (m_refreshInterval != val) {
|
||||
m_refreshInterval = val;
|
||||
m_refreshTimer.start(m_refreshInterval*60000);
|
||||
@@ -66,13 +66,13 @@ void RssManager::loadStreamList() {
|
||||
RssSettings settings;
|
||||
const QStringList streamsUrl = settings.getRssFeedsUrls();
|
||||
const QStringList aliases = settings.getRssFeedsAliases();
|
||||
if (streamsUrl.size() != aliases.size()){
|
||||
if (streamsUrl.size() != aliases.size()) {
|
||||
std::cerr << "Corrupted Rss list, not loading it\n";
|
||||
return;
|
||||
}
|
||||
uint i = 0;
|
||||
qDebug() << Q_FUNC_INFO << streamsUrl;
|
||||
foreach (QString s, streamsUrl){
|
||||
foreach (QString s, streamsUrl) {
|
||||
QStringList path = s.split("\\", QString::SkipEmptyParts);
|
||||
if (path.empty()) continue;
|
||||
const QString feed_url = path.takeLast();
|
||||
|
||||
Reference in New Issue
Block a user