diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 624e8bf7f..82a844390 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -602,7 +602,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h } } -void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const{ +void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const { // Display a message box showNotificationBaloon(tr("Url download error"), tr("Couldn't download file at url: %1, reason: %2.").arg(url).arg(reason)); } diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 0ca397727..65623ae20 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -498,11 +498,11 @@ void options_imp::saveOptions() { advancedSettings->saveAdvancedSettings(); } -bool options_imp::isFilteringEnabled() const{ +bool options_imp::isFilteringEnabled() const { return checkIPFilter->isChecked(); } -int options_imp::getProxyType() const{ +int options_imp::getProxyType() const { switch(comboProxyType->currentIndex()) { case 1: return Proxy::SOCKS4; @@ -757,7 +757,7 @@ void options_imp::loadOptions() { // return min & max ports // [min, max] -int options_imp::getPort() const{ +int options_imp::getPort() const { return spinPort->value(); } @@ -766,7 +766,7 @@ void options_imp::on_randomButton_clicked() { spinPort->setValue(rand() % 64512 + 1024); } -int options_imp::getEncryptionSetting() const{ +int options_imp::getEncryptionSetting() const { return comboEncryption->currentIndex(); } @@ -782,12 +782,12 @@ int options_imp::getMaxActiveTorrents() const { return spinMaxActiveTorrents->value(); } -bool options_imp::minimizeToTray() const{ +bool options_imp::minimizeToTray() const { if (!checkShowSystray->isChecked()) return false; return checkMinimizeToSysTray->isChecked(); } -bool options_imp::closeToTray() const{ +bool options_imp::closeToTray() const { if (!checkShowSystray->isChecked()) return false; return checkCloseToSystray->isChecked(); } @@ -796,21 +796,21 @@ bool options_imp::isQueueingSystemEnabled() const { return checkEnableQueueing->isChecked(); } -bool options_imp::isDHTEnabled() const{ +bool options_imp::isDHTEnabled() const { return checkDHT->isChecked(); } -bool options_imp::isLSDEnabled() const{ +bool options_imp::isLSDEnabled() const { return checkLSD->isChecked(); } -bool options_imp::isUPnPEnabled() const{ +bool options_imp::isUPnPEnabled() const { return checkUPnP->isChecked(); } // Return Download & Upload limits in kbps // [download,upload] -QPair options_imp::getGlobalBandwidthLimits() const{ +QPair options_imp::getGlobalBandwidthLimits() const { int DL = -1, UP = -1; if (checkDownloadLimit->isChecked()) { DL = spinDownloadLimit->value(); @@ -826,7 +826,7 @@ bool options_imp::startMinimized() const { return checkStartMinimized->isChecked(); } -bool options_imp::systrayIntegration() const{ +bool options_imp::systrayIntegration() const { if (!QSystemTrayIcon::isSystemTrayAvailable()) return false; return checkShowSystray->isChecked(); } @@ -836,7 +836,7 @@ int options_imp::getDHTPort() const { } // Return Share ratio -qreal options_imp::getMaxRatio() const{ +qreal options_imp::getMaxRatio() const { if (checkMaxRatio->isChecked()) { return spinMaxRatio->value(); } @@ -844,7 +844,7 @@ qreal options_imp::getMaxRatio() const{ } // Return Save Path -QString options_imp::getSavePath() const{ +QString options_imp::getSavePath() const { if (textSavePath->text().trimmed().isEmpty()) { QString save_path = Preferences().getSavePath(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) @@ -864,7 +864,7 @@ bool options_imp::isTempPathEnabled() const { } // Return max connections number -int options_imp::getMaxConnecs() const{ +int options_imp::getMaxConnecs() const { if (!checkMaxConnecs->isChecked()) { return -1; }else{ @@ -872,7 +872,7 @@ int options_imp::getMaxConnecs() const{ } } -int options_imp::getMaxConnecsPerTorrent() const{ +int options_imp::getMaxConnecsPerTorrent() const { if (!checkMaxConnecsPerTorrent->isChecked()) { return -1; }else{ @@ -880,7 +880,7 @@ int options_imp::getMaxConnecsPerTorrent() const{ } } -int options_imp::getMaxUploadsPerTorrent() const{ +int options_imp::getMaxUploadsPerTorrent() const { if (!checkMaxUploadsPerTorrent->isChecked()) { return -1; }else{ @@ -916,7 +916,7 @@ void options_imp::on_buttonBox_rejected() { reject(); } -bool options_imp::useAdditionDialog() const{ +bool options_imp::useAdditionDialog() const { return checkAdditionDialog->isChecked(); } @@ -971,36 +971,36 @@ bool options_imp::isDHTPortSameAsBT() const { } // Proxy settings -bool options_imp::isProxyEnabled() const{ +bool options_imp::isProxyEnabled() const { return comboProxyType->currentIndex(); } -bool options_imp::isProxyAuthEnabled() const{ +bool options_imp::isProxyAuthEnabled() const { return checkProxyAuth->isChecked(); } -QString options_imp::getProxyIp() const{ +QString options_imp::getProxyIp() const { return textProxyIP->text().trimmed(); } -unsigned short options_imp::getProxyPort() const{ +unsigned short options_imp::getProxyPort() const { return spinProxyPort->value(); } -QString options_imp::getProxyUsername() const{ +QString options_imp::getProxyUsername() const { QString username = textProxyUsername->text(); username = username.trimmed(); return username; } -QString options_imp::getProxyPassword() const{ +QString options_imp::getProxyPassword() const { QString password = textProxyPassword->text(); password = password.trimmed(); return password; } // Locale Settings -QString options_imp::getLocale() const{ +QString options_imp::getLocale() const { return comboI18n->itemData(comboI18n->currentIndex(), Qt::UserRole).toString(); } @@ -1145,7 +1145,7 @@ void options_imp::on_browseTempDirButton_clicked() { } // Return Filter object to apply to BT session -QString options_imp::getFilter() const{ +QString options_imp::getFilter() const { return textFilterPath->text(); } diff --git a/src/previewlistdelegate.h b/src/previewlistdelegate.h index 7f2f24632..6315bf8c1 100644 --- a/src/previewlistdelegate.h +++ b/src/previewlistdelegate.h @@ -49,7 +49,7 @@ class PreviewListDelegate: public QItemDelegate { ~PreviewListDelegate() {} - void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ + void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); diff --git a/src/properties/peerlistdelegate.h b/src/properties/peerlistdelegate.h index 3312e0f59..548416ec8 100644 --- a/src/properties/peerlistdelegate.h +++ b/src/properties/peerlistdelegate.h @@ -47,7 +47,7 @@ public: ~PeerListDelegate() {} - void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ + void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); switch(index.column()) { diff --git a/src/properties/proplistdelegate.h b/src/properties/proplistdelegate.h index 7530f682e..0d5d2bd30 100644 --- a/src/properties/proplistdelegate.h +++ b/src/properties/proplistdelegate.h @@ -65,7 +65,7 @@ public: ~PropListDelegate() {} - void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ + void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); switch(index.column()) { @@ -131,7 +131,7 @@ public: painter->restore(); } - QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const{ + QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const { QVariant value = index.data(Qt::FontRole); QFont fnt = value.isValid() ? qvariant_cast(value) : option.font; QFontMetrics fontMetrics(fnt); diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 02de601c2..032bff139 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -709,7 +709,7 @@ void QBtSession::useAlternativeSpeedsLimit(bool alternative) { } // Return the torrent handle, given its hash -QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const{ +QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const { return QTorrentHandle(s->find_torrent(QStringToSha1(hash))); } @@ -1545,7 +1545,7 @@ bool QBtSession::enableDHT(bool b) { return true; } -qreal QBtSession::getRealRatio(const QString &hash) const{ +qreal QBtSession::getRealRatio(const QString &hash) const { QTorrentHandle h = getTorrentHandle(hash); if (!h.is_valid()) { return 0.; @@ -1690,7 +1690,7 @@ void QBtSession::addPeerBanMessage(QString ip, bool from_ipfilter) { emit newBanMessage(msg); } -bool QBtSession::isFilePreviewPossible(const QString &hash) const{ +bool QBtSession::isFilePreviewPossible(const QString &hash) const { // See if there are supported files in the torrent const QTorrentHandle h = getTorrentHandle(hash); if (!h.is_valid() || !h.has_metadata()) { @@ -2550,16 +2550,16 @@ void QBtSession::recheckTorrent(const QString &hash) { } } -QHash QBtSession::getTrackersInfo(const QString &hash) const{ +QHash QBtSession::getTrackersInfo(const QString &hash) const { return trackersInfos.value(hash, QHash()); } -int QBtSession::getListenPort() const{ +int QBtSession::getListenPort() const { qDebug() << Q_FUNC_INFO << s->listen_port(); return s->listen_port(); } -session_status QBtSession::getSessionStatus() const{ +session_status QBtSession::getSessionStatus() const { return s->status(); } @@ -2674,14 +2674,14 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) { // Return current download rate for the BT // session. Payload means that it only take into // account "useful" part of the rate -qreal QBtSession::getPayloadDownloadRate() const{ +qreal QBtSession::getPayloadDownloadRate() const { return s->status().payload_download_rate; } // Return current upload rate for the BT // session. Payload means that it only take into // account "useful" part of the rate -qreal QBtSession::getPayloadUploadRate() const{ +qreal QBtSession::getPayloadUploadRate() const { return s->status().payload_upload_rate; } diff --git a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp index 6619d2161..357111045 100644 --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -807,7 +807,7 @@ void QTorrentHandle::rename_file(int index, QString name) const { // Operators // -bool QTorrentHandle::operator ==(const QTorrentHandle& new_h) const{ +bool QTorrentHandle::operator ==(const QTorrentHandle& new_h) const { const QString hash = misc::toQString(torrent_handle::info_hash()); return (hash == new_h.hash()); } diff --git a/src/rss/feedlistwidget.cpp b/src/rss/feedlistwidget.cpp index 8dc641c6c..17f7e86a5 100644 --- a/src/rss/feedlistwidget.cpp +++ b/src/rss/feedlistwidget.cpp @@ -149,7 +149,7 @@ QString FeedListWidget::getItemID(QTreeWidgetItem *item) const { return m_rssMapping.value(item)->id(); } -QTreeWidgetItem* FeedListWidget::getTreeItemFromUrl(const QString &url) const{ +QTreeWidgetItem* FeedListWidget::getTreeItemFromUrl(const QString &url) const { return m_feedsItems.value(url, 0); } diff --git a/src/rss/rssfeed.cpp b/src/rss/rssfeed.cpp index 4745cb031..f40ca6a46 100644 --- a/src/rss/rssfeed.cpp +++ b/src/rss/rssfeed.cpp @@ -132,7 +132,7 @@ bool RssFeed::isLoading() const { return m_loading; } -QString RssFeed::title() const{ +QString RssFeed::title() const { return m_title; } @@ -143,29 +143,24 @@ void RssFeed::rename(const QString &new_name) { // Return the alias if the stream has one, the url if it has no alias QString RssFeed::displayName() const { - if (!m_alias.isEmpty()) { - //qDebug("getName() returned alias: %s", (const char*)alias.toLocal8Bit()); + if (!m_alias.isEmpty()) return m_alias; - } - if (!m_title.isEmpty()) { - //qDebug("getName() returned title: %s", (const char*)title.toLocal8Bit()); + if (!m_title.isEmpty()) return m_title; - } - //qDebug("getName() returned url: %s", (const char*)url.toLocal8Bit()); return m_url; } -QString RssFeed::url() const{ +QString RssFeed::url() const { return m_url; } -QString RssFeed::icon() const{ +QString RssFeed::icon() const { if (m_downloadFailure) return ":/Icons/oxygen/unavailable.png"; return m_icon; } -bool RssFeed::hasCustomIcon() const{ +bool RssFeed::hasCustomIcon() const { return !m_icon.startsWith(":/"); } @@ -178,7 +173,7 @@ RssArticlePtr RssFeed::getItem(const QString &guid) const { return m_articles.value(guid); } -uint RssFeed::count() const{ +uint RssFeed::count() const { return m_articles.size(); } @@ -189,7 +184,7 @@ void RssFeed::markAsRead() { m_manager->forwardFeedInfosChanged(m_url, displayName(), 0); } -uint RssFeed::unreadCount() const{ +uint RssFeed::unreadCount() const { uint nbUnread = 0; for (RssArticleHash::ConstIterator it=m_articles.begin(); it != m_articles.end(); it++) { if (!it.value()->isRead()) @@ -198,7 +193,7 @@ uint RssFeed::unreadCount() const{ return nbUnread; } -RssArticleList RssFeed::articleList() const{ +RssArticleList RssFeed::articleList() const { return m_articles.values(); } @@ -213,9 +208,8 @@ RssArticleList RssFeed::unreadArticleList() const { // download the icon from the adress QString RssFeed::iconUrl() const { - const QUrl siteUrl(m_url); // XXX: This works for most sites but it is not perfect - return QString("http://")+siteUrl.host()+QString("/favicon.ico"); + return QString("http://")+QUrl(m_url).host()+QString("/favicon.ico"); } void RssFeed::parseRSSChannel(QXmlStreamReader& xml) diff --git a/src/searchengine/searchlistdelegate.h b/src/searchengine/searchlistdelegate.h index 5b7e956ae..da63da57a 100644 --- a/src/searchengine/searchlistdelegate.h +++ b/src/searchengine/searchlistdelegate.h @@ -48,7 +48,7 @@ class SearchListDelegate: public QItemDelegate { ~SearchListDelegate() {} - void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ + void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { painter->save(); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); switch(index.column()) { diff --git a/src/transferlistdelegate.h b/src/transferlistdelegate.h index b5720c165..9926fa0c4 100644 --- a/src/transferlistdelegate.h +++ b/src/transferlistdelegate.h @@ -57,7 +57,7 @@ public: ~TransferListDelegate() {} - void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ + void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); painter->save(); switch(index.column()) { diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 4b6cb1591..90cae38d5 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -155,7 +155,7 @@ void TransferListWidget::setRefreshInterval(int t) { listModel->setRefreshInterval(t); } -int TransferListWidget::getRowFromHash(QString hash) const{ +int TransferListWidget::getRowFromHash(QString hash) const { return listModel->torrentRow(hash); }