From eb508d67efed0828978eb77c988c5c02813ad776 Mon Sep 17 00:00:00 2001 From: thalieht Date: Thu, 14 Jun 2018 14:46:50 +0300 Subject: [PATCH] Fix coding style --- src/base/bittorrent/infohash.cpp | 3 +- src/base/bittorrent/infohash.h | 2 +- .../bittorrent/private/filterparserthread.cpp | 12 +-- src/base/bittorrent/private/statistics.h | 1 - src/base/bittorrent/trackerentry.cpp | 3 +- src/base/iconprovider.cpp | 3 +- src/base/preferences.cpp | 32 +++---- src/base/preferences.h | 2 +- src/base/private/profile_p.cpp | 1 - src/base/profile.h | 1 - src/base/scanfoldersmodel.h | 1 - src/base/torrentfilter.cpp | 3 +- src/base/utils/bytearray.cpp | 1 + src/base/utils/fs.cpp | 2 +- src/base/utils/misc.cpp | 93 +++++++++---------- src/gui/advancedsettings.cpp | 14 +-- src/gui/advancedsettings.h | 2 +- src/gui/deletionconfirmationdialog.h | 2 +- src/gui/guiiconprovider.cpp | 3 +- src/gui/mainwindow.h | 18 ++-- src/gui/optionsdialog.cpp | 21 +++-- src/gui/properties/propertieswidget.cpp | 12 +-- src/gui/properties/propertieswidget.h | 8 +- src/gui/search/pluginselectdialog.cpp | 6 +- src/gui/search/pluginselectdialog.h | 4 +- src/gui/search/searchlistdelegate.cpp | 7 +- src/gui/torrentcontentmodel.cpp | 3 +- src/gui/trackerlogindialog.cpp | 40 ++++---- src/gui/trackerlogindialog.h | 14 +-- src/gui/transferlistfilterswidget.h | 1 - src/gui/transferlistwidget.cpp | 12 +-- 31 files changed, 162 insertions(+), 165 deletions(-) diff --git a/src/base/bittorrent/infohash.cpp b/src/base/bittorrent/infohash.cpp index 0080bf9b5..c29c8cd85 100644 --- a/src/base/bittorrent/infohash.cpp +++ b/src/base/bittorrent/infohash.cpp @@ -26,9 +26,10 @@ * exception statement from your version. */ -#include #include "infohash.h" +#include + using namespace BitTorrent; InfoHash::InfoHash() diff --git a/src/base/bittorrent/infohash.h b/src/base/bittorrent/infohash.h index ce8eaebcf..dfa766ea0 100644 --- a/src/base/bittorrent/infohash.h +++ b/src/base/bittorrent/infohash.h @@ -29,8 +29,8 @@ #ifndef BITTORRENT_INFOHASH_H #define BITTORRENT_INFOHASH_H -#include #include +#include namespace BitTorrent { diff --git a/src/base/bittorrent/private/filterparserthread.cpp b/src/base/bittorrent/private/filterparserthread.cpp index eeb3b5fc9..417d55c8d 100644 --- a/src/base/bittorrent/private/filterparserthread.cpp +++ b/src/base/bittorrent/private/filterparserthread.cpp @@ -407,24 +407,24 @@ int FilterParserThread::parseP2PFilterFile() int FilterParserThread::getlineInStream(QDataStream &stream, std::string &name, char delim) { char c; - int total_read = 0; + int totalRead = 0; int read; do { read = stream.readRawData(&c, 1); - total_read += read; + totalRead += read; if (read > 0) { if (c != delim) { name += c; } else { // Delim found - return total_read; + return totalRead; } } } - while(read > 0); + while (read > 0); - return total_read; + return totalRead; } // Parser for PeerGuardian ip filter in p2p format @@ -455,7 +455,7 @@ int FilterParserThread::parseP2BFilterFile() unsigned int start, end; std::string name; - while(getlineInStream(stream, name, '\0') && !m_abort) { + while (getlineInStream(stream, name, '\0') && !m_abort) { if (!stream.readRawData(reinterpret_cast(&start), sizeof(start)) || !stream.readRawData(reinterpret_cast(&end), sizeof(end))) { LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); diff --git a/src/base/bittorrent/private/statistics.h b/src/base/bittorrent/private/statistics.h index b88a8dabb..017f32197 100644 --- a/src/base/bittorrent/private/statistics.h +++ b/src/base/bittorrent/private/statistics.h @@ -28,7 +28,6 @@ private: void save() const; void load(); -private: BitTorrent::Session *m_session; // Will overflow at 15.9 EiB quint64 m_alltimeUL; diff --git a/src/base/bittorrent/trackerentry.cpp b/src/base/bittorrent/trackerentry.cpp index 824f8f1ba..a757709bb 100644 --- a/src/base/bittorrent/trackerentry.cpp +++ b/src/base/bittorrent/trackerentry.cpp @@ -26,11 +26,12 @@ * exception statement from your version. */ +#include "trackerentry.h" + #include #include "base/utils/misc.h" #include "base/utils/string.h" -#include "trackerentry.h" using namespace BitTorrent; diff --git a/src/base/iconprovider.cpp b/src/base/iconprovider.cpp index 316ec67cf..2d6004311 100644 --- a/src/base/iconprovider.cpp +++ b/src/base/iconprovider.cpp @@ -27,9 +27,10 @@ * exception statement from your version. */ -#include #include "iconprovider.h" +#include + IconProvider::IconProvider(QObject *parent) : QObject(parent) { diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index 9b2a143ef..a800223c6 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -257,8 +257,8 @@ void Preferences::setWinStartup(bool b) { QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); if (b) { - const QString bin_path = "\"" + Utils::Fs::toNativePath(qApp->applicationFilePath()) + "\""; - settings.setValue("qBittorrent", bin_path); + const QString binPath = "\"" + Utils::Fs::toNativePath(qApp->applicationFilePath()) + "\""; + settings.setValue("qBittorrent", binPath); } else { settings.remove("qBittorrent"); @@ -555,24 +555,24 @@ void Preferences::setWebUiUsername(const QString &username) QString Preferences::getWebUiPassword() const { - QString pass_ha1 = value("Preferences/WebUI/Password_ha1").toString(); - if (pass_ha1.isEmpty()) { + QString passHa1 = value("Preferences/WebUI/Password_ha1").toString(); + if (passHa1.isEmpty()) { QCryptographicHash md5(QCryptographicHash::Md5); md5.addData("adminadmin"); - pass_ha1 = md5.result().toHex(); + passHa1 = md5.result().toHex(); } - return pass_ha1; + return passHa1; } -void Preferences::setWebUiPassword(const QString &new_password) +void Preferences::setWebUiPassword(const QString &newPassword) { // Do not overwrite current password with its hash - if (new_password == getWebUiPassword()) + if (newPassword == getWebUiPassword()) return; // Encode to md5 and save QCryptographicHash md5(QCryptographicHash::Md5); - md5.addData(new_password.toLocal8Bit()); + md5.addData(newPassword.toLocal8Bit()); setValue("Preferences/WebUI/Password_ha1", md5.result().toHex()); } @@ -1041,9 +1041,9 @@ void Preferences::setTorrentFileAssoc(bool set) // .Torrent association if (set) { - QString old_progid = settings.value(".torrent/Default").toString(); - if (!old_progid.isEmpty() && (old_progid != "qBittorrent")) - settings.setValue(".torrent/OpenWithProgids/" + old_progid, ""); + QString oldProgId = settings.value(".torrent/Default").toString(); + if (!oldProgId.isEmpty() && (oldProgId != "qBittorrent")) + settings.setValue(".torrent/OpenWithProgids/" + oldProgId, ""); settings.setValue(".torrent/Default", "qBittorrent"); } else if (isTorrentFileAssocSet()) { @@ -1059,15 +1059,15 @@ void Preferences::setMagnetLinkAssoc(bool set) // Magnet association if (set) { - const QString command_str = "\"" + qApp->applicationFilePath() + "\" \"%1\""; - const QString icon_str = "\"" + qApp->applicationFilePath() + "\",1"; + const QString commandStr = "\"" + qApp->applicationFilePath() + "\" \"%1\""; + const QString iconStr = "\"" + qApp->applicationFilePath() + "\",1"; settings.setValue("magnet/Default", "URL:Magnet link"); settings.setValue("magnet/Content Type", "application/x-magnet"); settings.setValue("magnet/URL Protocol", ""); - settings.setValue("magnet/DefaultIcon/Default", Utils::Fs::toNativePath(icon_str)); + settings.setValue("magnet/DefaultIcon/Default", Utils::Fs::toNativePath(iconStr)); settings.setValue("magnet/shell/Default", "open"); - settings.setValue("magnet/shell/open/command/Default", Utils::Fs::toNativePath(command_str)); + settings.setValue("magnet/shell/open/command/Default", Utils::Fs::toNativePath(commandStr)); } else if (isMagnetLinkAssocSet()) { settings.remove("magnet"); diff --git a/src/base/preferences.h b/src/base/preferences.h index a3b5a2ae7..4b83b27ad 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -192,7 +192,7 @@ public: QString getWebUiUsername() const; void setWebUiUsername(const QString &username); QString getWebUiPassword() const; - void setWebUiPassword(const QString &new_password); + void setWebUiPassword(const QString &newPassword); // WebUI security bool isWebUiClickjackingProtectionEnabled() const; diff --git a/src/base/private/profile_p.cpp b/src/base/private/profile_p.cpp index 156ac1148..0addacddc 100644 --- a/src/base/private/profile_p.cpp +++ b/src/base/private/profile_p.cpp @@ -25,7 +25,6 @@ * modify file(s), you may extend this exception to your version of the file(s), * but you are not obligated to do so. If you do not wish to do so, delete this * exception statement from your version. - * */ #include "profile_p.h" diff --git a/src/base/profile.h b/src/base/profile.h index e8fe2fc5d..599a20427 100644 --- a/src/base/profile.h +++ b/src/base/profile.h @@ -25,7 +25,6 @@ * modify file(s), you may extend this exception to your version of the file(s), * but you are not obligated to do so. If you do not wish to do so, delete this * exception statement from your version. - * */ #ifndef QBT_PROFILE_H diff --git a/src/base/scanfoldersmodel.h b/src/base/scanfoldersmodel.h index 0ba4a8e17..9b77d9e37 100644 --- a/src/base/scanfoldersmodel.h +++ b/src/base/scanfoldersmodel.h @@ -104,7 +104,6 @@ private: QString downloadPathTorrentFolder(const QString &filePath) const; int findPathData(const QString &path) const; -private: static ScanFoldersModel *m_instance; struct PathData; diff --git a/src/base/torrentfilter.cpp b/src/base/torrentfilter.cpp index 716f93041..b0617ebdc 100644 --- a/src/base/torrentfilter.cpp +++ b/src/base/torrentfilter.cpp @@ -26,9 +26,10 @@ * exception statement from your version. */ -#include "bittorrent/torrenthandle.h" #include "torrentfilter.h" +#include "bittorrent/torrenthandle.h" + const QString TorrentFilter::AnyCategory; const QStringSet TorrentFilter::AnyHash = (QStringSet() << QString()); const QString TorrentFilter::AnyTag; diff --git a/src/base/utils/bytearray.cpp b/src/base/utils/bytearray.cpp index 25603646f..9ef543e25 100644 --- a/src/base/utils/bytearray.cpp +++ b/src/base/utils/bytearray.cpp @@ -27,6 +27,7 @@ */ #include "bytearray.h" + #include QList Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior) diff --git a/src/base/utils/fs.cpp b/src/base/utils/fs.cpp index 73bfd8781..39f99a222 100644 --- a/src/base/utils/fs.cpp +++ b/src/base/utils/fs.cpp @@ -210,7 +210,7 @@ bool Utils::Fs::sameFiles(const QString &path1, const QString &path2) if (!f2.open(QIODevice::ReadOnly)) return false; const int readSize = 1024 * 1024; // 1 MiB - while(!f1.atEnd() && !f2.atEnd()) { + while (!f1.atEnd() && !f2.atEnd()) { if (f1.read(readSize) != f2.read(readSize)) return false; } diff --git a/src/base/utils/misc.cpp b/src/base/utils/misc.cpp index aa9159bd4..dcdcca560 100644 --- a/src/base/utils/misc.cpp +++ b/src/base/utils/misc.cpp @@ -299,55 +299,50 @@ qlonglong Utils::Misc::sizeInBytes(qreal size, Utils::Misc::SizeUnit unit) bool Utils::Misc::isPreviewable(const QString &extension) { - static QSet multimedia_extensions; - if (multimedia_extensions.empty()) { - multimedia_extensions.insert("3GP"); - multimedia_extensions.insert("AAC"); - multimedia_extensions.insert("AC3"); - multimedia_extensions.insert("AIF"); - multimedia_extensions.insert("AIFC"); - multimedia_extensions.insert("AIFF"); - multimedia_extensions.insert("ASF"); - multimedia_extensions.insert("AU"); - multimedia_extensions.insert("AVI"); - multimedia_extensions.insert("FLAC"); - multimedia_extensions.insert("FLV"); - multimedia_extensions.insert("M3U"); - multimedia_extensions.insert("M4A"); - multimedia_extensions.insert("M4P"); - multimedia_extensions.insert("M4V"); - multimedia_extensions.insert("MID"); - multimedia_extensions.insert("MKV"); - multimedia_extensions.insert("MOV"); - multimedia_extensions.insert("MP2"); - multimedia_extensions.insert("MP3"); - multimedia_extensions.insert("MP4"); - multimedia_extensions.insert("MPC"); - multimedia_extensions.insert("MPE"); - multimedia_extensions.insert("MPEG"); - multimedia_extensions.insert("MPG"); - multimedia_extensions.insert("MPP"); - multimedia_extensions.insert("OGG"); - multimedia_extensions.insert("OGM"); - multimedia_extensions.insert("OGV"); - multimedia_extensions.insert("QT"); - multimedia_extensions.insert("RA"); - multimedia_extensions.insert("RAM"); - multimedia_extensions.insert("RM"); - multimedia_extensions.insert("RMV"); - multimedia_extensions.insert("RMVB"); - multimedia_extensions.insert("SWA"); - multimedia_extensions.insert("SWF"); - multimedia_extensions.insert("VOB"); - multimedia_extensions.insert("WAV"); - multimedia_extensions.insert("WMA"); - multimedia_extensions.insert("WMV"); - } - - if (extension.isEmpty()) - return false; - - return multimedia_extensions.contains(extension.toUpper()); + static const QSet multimediaExtensions = { + "3GP", + "AAC", + "AC3", + "AIF", + "AIFC", + "AIFF", + "ASF", + "AU", + "AVI", + "FLAC", + "FLV", + "M3U", + "M4A", + "M4P", + "M4V", + "MID", + "MKV", + "MOV", + "MP2", + "MP3", + "MP4", + "MPC", + "MPE", + "MPEG", + "MPG", + "MPP", + "OGG", + "OGM", + "OGV", + "QT", + "RA", + "RAM", + "RM", + "RMV", + "RMVB", + "SWA", + "SWF", + "VOB", + "WAV", + "WMA", + "WMV" + }; + return multimediaExtensions.contains(extension.toUpper()); } // Take a number of seconds and return an user-friendly diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index 6a59b4508..5674043c5 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -393,8 +393,8 @@ void AdvancedSettings::loadAdvancedSettings() addRow(SUPER_SEEDING, tr("Strict super seeding"), &checkBoxSuperSeeding); // Network interface comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface")); - const QString current_iface = session->networkInterface(); - bool interface_exists = current_iface.isEmpty(); + const QString currentInterface = session->networkInterface(); + bool interfaceExists = currentInterface.isEmpty(); int i = 1; foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) { // This line fixes a Qt bug => https://bugreports.qt.io/browse/QTBUG-52633 @@ -404,15 +404,15 @@ void AdvancedSettings::loadAdvancedSettings() if (iface.addressEntries().isEmpty()) continue; comboBoxInterface.addItem(iface.humanReadableName(), iface.name()); - if (!current_iface.isEmpty() && (iface.name() == current_iface)) { + if (!currentInterface.isEmpty() && (iface.name() == currentInterface)) { comboBoxInterface.setCurrentIndex(i); - interface_exists = true; + interfaceExists = true; } ++i; } // Saved interface does not exist, show it anyway - if (!interface_exists) { - comboBoxInterface.addItem(session->networkInterfaceName(), current_iface); + if (!interfaceExists) { + comboBoxInterface.addItem(session->networkInterfaceName(), currentInterface); comboBoxInterface.setCurrentIndex(i); } addRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &comboBoxInterface); @@ -427,7 +427,7 @@ void AdvancedSettings::loadAdvancedSettings() addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &lineEditAnnounceIP); // Program notifications - const MainWindow * const mainWindow = static_cast(QCoreApplication::instance())->mainWindow(); + const MainWindow *const mainWindow = static_cast(QCoreApplication::instance())->mainWindow(); checkBoxProgramNotifications.setChecked(mainWindow->isNotificationsEnabled()); addRow(PROGRAM_NOTIFICATIONS, tr("Display notifications"), &checkBoxProgramNotifications); // Torrent added notifications diff --git a/src/gui/advancedsettings.h b/src/gui/advancedsettings.h index c5d65cd1e..f784d0016 100644 --- a/src/gui/advancedsettings.h +++ b/src/gui/advancedsettings.h @@ -55,7 +55,7 @@ private slots: private: void loadAdvancedSettings(); - template void addRow(int row, const QString &rowText, T* widget); + template void addRow(int row, const QString &rowText, T *widget); QLabel labelQbtLink, labelLibtorrentLink; QSpinBox spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh, spinBoxMaxHalfOpen, diff --git a/src/gui/deletionconfirmationdialog.h b/src/gui/deletionconfirmationdialog.h index c4822c229..6e929c76b 100644 --- a/src/gui/deletionconfirmationdialog.h +++ b/src/gui/deletionconfirmationdialog.h @@ -1,5 +1,5 @@ /* - * Bittorrent Client using Qt4 and libtorrent. + * Bittorrent Client using Qt and libtorrent. * Copyright (C) 2006 Christophe Dumez * * This program is free software; you can redistribute it and/or diff --git a/src/gui/guiiconprovider.cpp b/src/gui/guiiconprovider.cpp index 82c92bc60..bfe4a2ee6 100644 --- a/src/gui/guiiconprovider.cpp +++ b/src/gui/guiiconprovider.cpp @@ -28,7 +28,6 @@ */ #include "guiiconprovider.h" -#include "base/preferences.h" #include #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) @@ -36,6 +35,8 @@ #include #endif +#include "base/preferences.h" + GuiIconProvider::GuiIconProvider(QObject *parent) : IconProvider(parent) { diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 4fa69889e..9487b60c9 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -43,20 +43,20 @@ class QSplitter; class QTabWidget; class QTimer; -class DownloadFromURLDialog; -class SearchWidget; -class RSSWidget; class AboutDialog; +class DownloadFromURLDialog; +class ExecutionLogWidget; +class LineEdit; class OptionsDialog; -class TransferListWidget; -class TransferListFiltersWidget; +class PowerManagement; class PropertiesWidget; +class RSSWidget; +class SearchWidget; +class StatsDialog; class StatusBar; class TorrentCreatorDialog; -class LineEdit; -class ExecutionLogWidget; -class PowerManagement; -class StatsDialog; +class TransferListFiltersWidget; +class TransferListWidget; namespace BitTorrent { diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 8d3929690..e64c97ab0 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -518,10 +518,11 @@ void OptionsDialog::saveWindowState() const pref->setPrefSize(size()); // Splitter size - QStringList sizes_str; - sizes_str << QString::number(m_ui->hsplitter->sizes().first()); - sizes_str << QString::number(m_ui->hsplitter->sizes().last()); - pref->setPrefHSplitterSizes(sizes_str); + const QStringList sizesStr = { + QString::number(m_ui->hsplitter->sizes().first()), + QString::number(m_ui->hsplitter->sizes().last()) + }; + pref->setPrefHSplitterSizes(sizesStr); } void OptionsDialog::saveOptions() @@ -637,15 +638,15 @@ void OptionsDialog::saveOptions() session->setPort(getPort()); session->setUseRandomPort(m_ui->checkRandomPort->isChecked()); Net::PortForwarder::instance()->setEnabled(isUPnPEnabled()); - const QPair down_up_limit = getGlobalBandwidthLimits(); - session->setGlobalDownloadSpeedLimit(down_up_limit.first); - session->setGlobalUploadSpeedLimit(down_up_limit.second); + const QPair downUpLimit = getGlobalBandwidthLimits(); + session->setGlobalDownloadSpeedLimit(downUpLimit.first); + session->setGlobalUploadSpeedLimit(downUpLimit.second); session->setUTPRateLimited(m_ui->checkLimituTPConnections->isChecked()); session->setIncludeOverheadInLimits(m_ui->checkLimitTransportOverhead->isChecked()); session->setIgnoreLimitsOnLAN(!m_ui->checkLimitLocalPeerRate->isChecked()); - const QPair alt_down_up_limit = getAltGlobalBandwidthLimits(); - session->setAltGlobalDownloadSpeedLimit(alt_down_up_limit.first); - session->setAltGlobalUploadSpeedLimit(alt_down_up_limit.second); + const QPair altDownUpLimit = getAltGlobalBandwidthLimits(); + session->setAltGlobalDownloadSpeedLimit(altDownUpLimit.first); + session->setAltGlobalUploadSpeedLimit(altDownUpLimit.second); pref->setSchedulerStartTime(m_ui->timeEditScheduleFrom->time()); pref->setSchedulerEndTime(m_ui->timeEditScheduleTo->time()); pref->setSchedulerDays(static_cast(m_ui->comboBoxScheduleDays->currentIndex())); diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index 628128bf9..4662b5ce4 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -364,10 +364,10 @@ void PropertiesWidget::readSettings() QSplitter *hSplitter = static_cast(parentWidget()); hSplitter->setSizes(m_slideSizes); } - const int current_tab = pref->getPropCurTab(); + const int currentTab = pref->getPropCurTab(); const bool visible = pref->getPropVisible(); m_ui->filesList->header()->restoreState(pref->getPropFileListState()); - m_tabBar->setCurrentIndex(current_tab); + m_tabBar->setCurrentIndex(currentTab); if (!visible) setVisibility(false); } @@ -807,19 +807,19 @@ void PropertiesWidget::askWebSeed() { bool ok; // Ask user for a new url seed - const QString url_seed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"), + const QString urlSeed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"), tr("New URL seed:"), QLineEdit::Normal, QLatin1String("http://www."), &ok); if (!ok) return; - qDebug("Adding %s web seed", qUtf8Printable(url_seed)); - if (!m_ui->listWebSeeds->findItems(url_seed, Qt::MatchFixedString).empty()) { + qDebug("Adding %s web seed", qUtf8Printable(urlSeed)); + if (!m_ui->listWebSeeds->findItems(urlSeed, Qt::MatchFixedString).empty()) { QMessageBox::warning(this, "qBittorrent", tr("This URL seed is already in the list."), QMessageBox::Ok); return; } if (m_torrent) - m_torrent->addUrlSeeds(QList() << url_seed); + m_torrent->addUrlSeeds(QList() << urlSeed); // Refresh the seeds list loadUrlSeeds(); } diff --git a/src/gui/properties/propertieswidget.h b/src/gui/properties/propertieswidget.h index d0ce56141..fc7ef72ac 100644 --- a/src/gui/properties/propertieswidget.h +++ b/src/gui/properties/propertieswidget.h @@ -107,6 +107,10 @@ protected slots: void renameSelectedFile(); void openSelectedFile(); +private slots: + void filterText(const QString &filter); + void updateSavePath(BitTorrent::TorrentHandle *const torrent); + private: void openFile(const QModelIndex &index); void openFolder(const QModelIndex &index, bool containingFolder); @@ -131,10 +135,6 @@ private: QShortcut *m_editHotkeyWeb; QShortcut *m_deleteHotkeyWeb; QShortcut *m_openHotkeyFile; - -private slots: - void filterText(const QString &filter); - void updateSavePath(BitTorrent::TorrentHandle *const torrent); }; #endif // PROPERTIESWIDGET_H diff --git a/src/gui/search/pluginselectdialog.cpp b/src/gui/search/pluginselectdialog.cpp index e19c17ea9..6f6a26b9c 100644 --- a/src/gui/search/pluginselectdialog.cpp +++ b/src/gui/search/pluginselectdialog.cpp @@ -172,8 +172,8 @@ void PluginSelectDialog::displayContextMenu(const QPoint&) QList items = m_ui->pluginsTree->selectedItems(); if (items.isEmpty()) return; - QString first_id = items.first()->text(PLUGIN_ID); - m_ui->actionEnable->setChecked(m_pluginManager->pluginInfo(first_id)->enabled); + QString firstID = items.first()->text(PLUGIN_ID); + m_ui->actionEnable->setChecked(m_pluginManager->pluginInfo(firstID)->enabled); myContextMenu.addAction(m_ui->actionEnable); myContextMenu.addSeparator(); myContextMenu.addAction(m_ui->actionUninstall); @@ -318,7 +318,7 @@ void PluginSelectDialog::finishAsyncOp() void PluginSelectDialog::finishPluginUpdate() { --m_pendingUpdates; - if (m_pendingUpdates == 0 && !m_updatedPlugins.isEmpty()) { + if ((m_pendingUpdates == 0) && !m_updatedPlugins.isEmpty()) { m_updatedPlugins.sort(Qt::CaseInsensitive); QMessageBox::information(this, tr("Search plugin update"), tr("Plugins installed or updated: %1").arg(m_updatedPlugins.join(", "))); m_updatedPlugins.clear(); diff --git a/src/gui/search/pluginselectdialog.h b/src/gui/search/pluginselectdialog.h index b32de49c1..7eadfda5e 100644 --- a/src/gui/search/pluginselectdialog.h +++ b/src/gui/search/pluginselectdialog.h @@ -55,8 +55,8 @@ public: QTreeWidgetItem *findItemWithID(QString id); protected: - void dropEvent(QDropEvent *event); - void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event) override; + void dragEnterEvent(QDragEnterEvent *event) override; private slots: void on_actionUninstall_triggered(); diff --git a/src/gui/search/searchlistdelegate.cpp b/src/gui/search/searchlistdelegate.cpp index df61e89e3..6d9175516 100644 --- a/src/gui/search/searchlistdelegate.cpp +++ b/src/gui/search/searchlistdelegate.cpp @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2006 Christophe Dumez + * Copyright (C) 2006 Christophe Dumez * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,10 +24,10 @@ * modify file(s), you may extend this exception to your version of the file(s), * but you are not obligated to do so. If you do not wish to do so, delete this * exception statement from your version. - * - * Contact : chris@qbittorrent.org */ +#include "searchlistdelegate.h" + #include #include #include @@ -35,7 +35,6 @@ #include #include "base/utils/misc.h" -#include "searchlistdelegate.h" #include "searchsortmodel.h" namespace diff --git a/src/gui/torrentcontentmodel.cpp b/src/gui/torrentcontentmodel.cpp index bdf253918..c6c4ce69b 100644 --- a/src/gui/torrentcontentmodel.cpp +++ b/src/gui/torrentcontentmodel.cpp @@ -26,6 +26,8 @@ * exception statement from your version. */ +#include "torrentcontentmodel.h" + #include #include #include @@ -49,7 +51,6 @@ #include "base/utils/misc.h" #include "base/utils/fs.h" #include "guiiconprovider.h" -#include "torrentcontentmodel.h" #include "torrentcontentmodelfile.h" #include "torrentcontentmodelfolder.h" #include "torrentcontentmodelitem.h" diff --git a/src/gui/trackerlogindialog.cpp b/src/gui/trackerlogindialog.cpp index d9f382bc9..37f780b99 100644 --- a/src/gui/trackerlogindialog.cpp +++ b/src/gui/trackerlogindialog.cpp @@ -36,42 +36,42 @@ #include "utils.h" TrackerLoginDialog::TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent) - : QDialog(parent) - , m_torrent(torrent) + : QDialog(parent) + , m_torrent(torrent) { - setupUi(this); - setAttribute(Qt::WA_DeleteOnClose); + setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); - buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Log in")); + buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Log in")); - labelLoginLogo->setPixmap(QPixmap(QLatin1String(":/icons/qbt-theme/encrypted.png"))); + labelLoginLogo->setPixmap(QPixmap(QLatin1String(":/icons/qbt-theme/encrypted.png"))); - labelTrackerURL->setText(torrent->currentTracker()); + labelTrackerURL->setText(torrent->currentTracker()); - connect(buttonBox, &QDialogButtonBox::accepted, this, &TrackerLoginDialog::loginButtonClicked); - connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackerLoginDialog::cancelButtonClicked); - connect(linePasswd, &QLineEdit::returnPressed, this, &TrackerLoginDialog::loginButtonClicked); - connect(this, SIGNAL(trackerLoginCancelled(QPair)), // TODO: use Qt5 connect syntax - parent, SLOT(addUnauthenticatedTracker(QPair))); + connect(buttonBox, &QDialogButtonBox::accepted, this, &TrackerLoginDialog::loginButtonClicked); + connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackerLoginDialog::cancelButtonClicked); + connect(linePasswd, &QLineEdit::returnPressed, this, &TrackerLoginDialog::loginButtonClicked); + connect(this, SIGNAL(trackerLoginCancelled(QPair)), // TODO: use Qt5 connect syntax + parent, SLOT(addUnauthenticatedTracker(QPair))); - Utils::Gui::resize(this); - show(); + Utils::Gui::resize(this); + show(); } TrackerLoginDialog::~TrackerLoginDialog() {} void TrackerLoginDialog::loginButtonClicked() { - // login + // login #if LIBTORRENT_VERSION_NUM < 10100 - m_torrent->setTrackerLogin(lineUsername->text(), linePasswd->text()); + m_torrent->setTrackerLogin(lineUsername->text(), linePasswd->text()); #endif - accept(); + accept(); } void TrackerLoginDialog::cancelButtonClicked() { - // Emit a signal to GUI to stop asking for authentication - emit trackerLoginCancelled(qMakePair(m_torrent, m_torrent->currentTracker())); - reject(); + // Emit a signal to GUI to stop asking for authentication + emit trackerLoginCancelled(qMakePair(m_torrent, m_torrent->currentTracker())); + reject(); } diff --git a/src/gui/trackerlogindialog.h b/src/gui/trackerlogindialog.h index 43189976a..36d5e4525 100644 --- a/src/gui/trackerlogindialog.h +++ b/src/gui/trackerlogindialog.h @@ -40,21 +40,21 @@ namespace BitTorrent class TrackerLoginDialog : public QDialog, private Ui::TrackerLoginDialog { - Q_OBJECT + Q_OBJECT - private: - BitTorrent::TorrentHandle *const m_torrent; - - public: +public: TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent); ~TrackerLoginDialog(); - signals: +signals: void trackerLoginCancelled(QPair tracker); - private slots: +private slots: void loginButtonClicked(); void cancelButtonClicked(); + +private: + BitTorrent::TorrentHandle *const m_torrent; }; #endif // TRACKERLOGINDIALOG_H diff --git a/src/gui/transferlistfilterswidget.h b/src/gui/transferlistfilterswidget.h index 3cd7a69da..2aa102371 100644 --- a/src/gui/transferlistfilterswidget.h +++ b/src/gui/transferlistfilterswidget.h @@ -121,7 +121,6 @@ private: QStringList getHashes(int row); void downloadFavicon(const QString &url); -private: QHash m_trackers; QHash m_errors; QHash m_warnings; diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index cbe4a9c30..a4f10d515 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -527,20 +527,20 @@ void TransferListWidget::bottomPrioSelectedTorrents() void TransferListWidget::copySelectedMagnetURIs() const { - QStringList magnet_uris; + QStringList magnetUris; foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) - magnet_uris << torrent->toMagnetUri(); + magnetUris << torrent->toMagnetUri(); - qApp->clipboard()->setText(magnet_uris.join('\n')); + qApp->clipboard()->setText(magnetUris.join('\n')); } void TransferListWidget::copySelectedNames() const { - QStringList torrent_names; + QStringList torrentNames; foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) - torrent_names << torrent->name(); + torrentNames << torrent->name(); - qApp->clipboard()->setText(torrent_names.join('\n')); + qApp->clipboard()->setText(torrentNames.join('\n')); } void TransferListWidget::copySelectedHashes() const