Browse Source

Fix coding style for various things

adaptive-webui-19844
thalieht 6 years ago
parent
commit
d668a4fe6d
  1. 2
      src/app/main.cpp
  2. 2
      src/app/upgrade.h
  3. 34
      src/base/bittorrent/session.cpp
  4. 2
      src/base/bittorrent/session.h
  5. 8
      src/base/preferences.cpp
  6. 2
      src/base/preferences.h
  7. 18
      src/base/rss/private/rss_parser.cpp
  8. 2
      src/base/utils/foreignapps.cpp
  9. 6
      src/base/utils/fs.cpp
  10. 2
      src/base/utils/misc.cpp
  11. 2
      src/base/utils/misc.h
  12. 8
      src/gui/mainwindow.cpp
  13. 36
      src/gui/optionsdialog.cpp
  14. 9
      src/gui/optionsdialog.h
  15. 6
      src/gui/properties/peerlistwidget.cpp
  16. 24
      src/gui/transferlistwidget.cpp

2
src/app/main.cpp

@ -202,7 +202,7 @@ int main(int argc, char *argv[]) @@ -202,7 +202,7 @@ int main(int argc, char *argv[])
// this is the default in Qt6
app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
#endif
#endif
#endif // Q_OS_WIN
#if defined(Q_OS_MAC)
// Since Apple made difficult for users to set PATH, we set here for convenience.

2
src/app/upgrade.h

@ -83,7 +83,7 @@ bool userAcceptsUpgrade() @@ -83,7 +83,7 @@ bool userAcceptsUpgrade()
msgBox.move(Utils::Misc::screenCenter(&msgBox));
if (msgBox.exec() == QMessageBox::Ok)
return true;
#endif
#endif // DISABLE_GUI
return false;
}

34
src/base/bittorrent/session.cpp

@ -469,7 +469,7 @@ Session::Session(QObject *parent) @@ -469,7 +469,7 @@ Session::Session(QObject *parent)
});
configurePeerClasses();
#endif
#endif // LIBTORRENT_VERSION_NUM < 10100
// Enabling plugins
//m_nativeSession->add_extension(&libt::create_metadata_plugin);
@ -1253,7 +1253,7 @@ void Session::configure(libtorrent::settings_pack &settingsPack) @@ -1253,7 +1253,7 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
}
#else
settingsPack.set_str(libt::settings_pack::outgoing_interfaces, networkInterface().toStdString());
#endif
#endif // Q_OS_WIN
m_listenInterfaceChanged = false;
}
@ -1462,7 +1462,7 @@ void Session::configurePeerClasses() @@ -1462,7 +1462,7 @@ void Session::configurePeerClasses()
, 1 << libt::session::global_peer_class_id);
}
catch (std::exception &) {}
#endif
#endif // TORRENT_USE_IPV6
if (ignoreLimitsOnLAN()) {
// local networks
f.add_rule(libt::address_v4::from_string("10.0.0.0")
@ -1501,7 +1501,7 @@ void Session::configurePeerClasses() @@ -1501,7 +1501,7 @@ void Session::configurePeerClasses()
, 1 << libt::session::local_peer_class_id);
}
catch (std::exception &) {}
#endif
#endif // TORRENT_USE_IPV6
}
m_nativeSession->set_peer_class_filter(f);
@ -1518,7 +1518,7 @@ void Session::configurePeerClasses() @@ -1518,7 +1518,7 @@ void Session::configurePeerClasses()
m_nativeSession->set_peer_class_type_filter(peerClassTypeFilter);
}
#else
#else // LIBTORRENT_VERSION_NUM >= 10100
void Session::adjustLimits(libt::session_settings &sessionSettings)
{
@ -1735,7 +1735,7 @@ void Session::configure(libtorrent::session_settings &sessionSettings) @@ -1735,7 +1735,7 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
break;
}
}
#endif
#endif // LIBTORRENT_VERSION_NUM >= 10100
void Session::enableTracker(bool enable)
{
@ -1983,8 +1983,8 @@ void Session::increaseTorrentsPriority(const QStringList &hashes) @@ -1983,8 +1983,8 @@ void Session::increaseTorrentsPriority(const QStringList &hashes)
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
// Sort torrents by priority
foreach (const InfoHash &hash, hashes) {
TorrentHandle *const torrent = m_torrents.value(hash);
foreach (const InfoHash &infoHash, hashes) {
TorrentHandle *const torrent = m_torrents.value(infoHash);
if (torrent && !torrent->isSeed())
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
}
@ -2006,8 +2006,8 @@ void Session::decreaseTorrentsPriority(const QStringList &hashes) @@ -2006,8 +2006,8 @@ void Session::decreaseTorrentsPriority(const QStringList &hashes)
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
// Sort torrents by priority
foreach (const InfoHash &hash, hashes) {
TorrentHandle *const torrent = m_torrents.value(hash);
foreach (const InfoHash &infoHash, hashes) {
TorrentHandle *const torrent = m_torrents.value(infoHash);
if (torrent && !torrent->isSeed())
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
}
@ -2032,8 +2032,8 @@ void Session::topTorrentsPriority(const QStringList &hashes) @@ -2032,8 +2032,8 @@ void Session::topTorrentsPriority(const QStringList &hashes)
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
// Sort torrents by priority
foreach (const InfoHash &hash, hashes) {
TorrentHandle *const torrent = m_torrents.value(hash);
foreach (const InfoHash &infoHash, hashes) {
TorrentHandle *const torrent = m_torrents.value(infoHash);
if (torrent && !torrent->isSeed())
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
}
@ -2055,8 +2055,8 @@ void Session::bottomTorrentsPriority(const QStringList &hashes) @@ -2055,8 +2055,8 @@ void Session::bottomTorrentsPriority(const QStringList &hashes)
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
// Sort torrents by priority
foreach (const InfoHash &hash, hashes) {
TorrentHandle *const torrent = m_torrents.value(hash);
foreach (const InfoHash &infoHash, hashes) {
TorrentHandle *const torrent = m_torrents.value(infoHash);
if (torrent && !torrent->isSeed())
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
}
@ -2598,7 +2598,7 @@ void Session::configureListeningInterface() @@ -2598,7 +2598,7 @@ void Session::configureListeningInterface()
#else
m_listenInterfaceChanged = true;
configureDeferred();
#endif
#endif // LIBTORRENT_VERSION_NUM < 10100
}
int Session::globalDownloadSpeedLimit() const
@ -4502,7 +4502,7 @@ void Session::handleSessionStatsAlert(libt::session_stats_alert *p) @@ -4502,7 +4502,7 @@ void Session::handleSessionStatsAlert(libt::session_stats_alert *p)
emit statsUpdated();
}
#else
#else // LIBTORRENT_VERSION_NUM >= 10100
void Session::updateStats()
{
libt::session_status ss = m_nativeSession->status();
@ -4539,7 +4539,7 @@ void Session::updateStats() @@ -4539,7 +4539,7 @@ void Session::updateStats()
emit statsUpdated();
}
#endif
#endif // LIBTORRENT_VERSION_NUM >= 10100
void Session::handleStateUpdateAlert(libt::state_update_alert *p)
{

2
src/base/bittorrent/session.h

@ -237,7 +237,7 @@ namespace BitTorrent @@ -237,7 +237,7 @@ namespace BitTorrent
int diskJobTime = 0;
} disk;
};
#endif
#endif // LIBTORRENT_VERSION_NUM >= 10100
class Session : public QObject
{

8
src/base/preferences.cpp

@ -212,7 +212,7 @@ void Preferences::setCloseToTrayNotified(bool b) @@ -212,7 +212,7 @@ void Preferences::setCloseToTrayNotified(bool b)
{
setValue("Preferences/General/CloseToTrayNotified", b);
}
#endif
#endif // Q_OS_MAC
bool Preferences::isToolbarDisplayed() const
{
@ -293,7 +293,7 @@ void Preferences::setWinStartup(bool b) @@ -293,7 +293,7 @@ void Preferences::setWinStartup(bool b)
settings.remove("qBittorrent");
}
}
#endif
#endif // Q_OS_WIN
// Downloads
QString Preferences::lastLocationPath() const
@ -967,7 +967,7 @@ void Preferences::setMagnetLinkAssoc(bool set) @@ -967,7 +967,7 @@ void Preferences::setMagnetLinkAssoc(bool set)
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
}
#endif
#endif // Q_OS_WIN
#ifdef Q_OS_MAC
namespace
@ -1023,7 +1023,7 @@ void Preferences::setMagnetLinkAssoc() @@ -1023,7 +1023,7 @@ void Preferences::setMagnetLinkAssoc()
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
}
#endif
#endif // Q_OS_MAC
int Preferences::getTrackerPort() const
{

2
src/base/preferences.h

@ -299,7 +299,7 @@ public: @@ -299,7 +299,7 @@ public:
void setCloseToTrayNotified(bool b);
TrayIcon::Style trayIconStyle() const;
void setTrayIconStyle(TrayIcon::Style style);
#endif
#endif // Q_OS_MAC
// Stuff that don't appear in the Options GUI but are saved
// in the same file.

18
src/base/rss/private/rss_parser.cpp

@ -439,9 +439,9 @@ namespace @@ -439,9 +439,9 @@ namespace
int dayOfWeek = -1;
if (!parts[nwday].isEmpty()) {
// Look up the weekday name
while (++dayOfWeek < 7 && (shortDay[dayOfWeek] != parts[nwday]));
while ((++dayOfWeek < 7) && (shortDay[dayOfWeek] != parts[nwday]));
if (dayOfWeek >= 7)
for (dayOfWeek = 0; dayOfWeek < 7 && (longDay[dayOfWeek] != parts[nwday]); ++dayOfWeek);
for (dayOfWeek = 0; (dayOfWeek < 7) && (longDay[dayOfWeek] != parts[nwday]); ++dayOfWeek);
}
// if (month >= 12 || dayOfWeek >= 7
@ -450,7 +450,7 @@ namespace @@ -450,7 +450,7 @@ namespace
int i = parts[nyear].size();
if (i < 4) {
// It's an obsolete year specification with less than 4 digits
year += (i == 2 && year < 50) ? 2000 : 1900;
year += ((i == 2) && (year < 50)) ? 2000 : 1900;
}
// Parse the UTC offset part
@ -473,17 +473,17 @@ namespace @@ -473,17 +473,17 @@ namespace
else {
// Check for an obsolete time zone name
QByteArray zone = parts[10].toLatin1();
if (zone.length() == 1 && isalpha(zone[0]) && toupper(zone[0]) != 'J') {
if ((zone.length() == 1) && (isalpha(zone[0])) && (toupper(zone[0]) != 'J')) {
negOffset = true; // military zone: RFC 2822 treats as '-0000'
}
else if (zone != "UT" && zone != "GMT") { // treated as '+0000'
else if ((zone != "UT") && (zone != "GMT")) { // treated as '+0000'
offset = (zone == "EDT")
? -4 * 3600
: ((zone == "EST") || (zone == "CDT"))
? -5 * 3600
: ((zone == "CST") || (zone == "MDT"))
? -6 * 3600
: (zone == "MST" || zone == "PDT")
: ((zone == "MST") || (zone == "PDT"))
? -7 * 3600
: (zone == "PST")
? -8 * 3600
@ -502,12 +502,12 @@ namespace @@ -502,12 +502,12 @@ namespace
}
}
QDate qdate(year, month + 1, day); // convert date, and check for out-of-range
if (!qdate.isValid())
QDate qDate(year, month + 1, day); // convert date, and check for out-of-range
if (!qDate.isValid())
return QDateTime::currentDateTime();
QTime qTime(hour, minute, second);
QDateTime result(qdate, qTime, Qt::UTC);
QDateTime result(qDate, qTime, Qt::UTC);
if (offset)
result = result.addSecs(-offset);
if (!result.isValid())

2
src/base/utils/foreignapps.cpp

@ -229,7 +229,7 @@ namespace @@ -229,7 +229,7 @@ namespace
return QString();
}
#endif
#endif // Q_OS_WIN
}
bool Utils::ForeignApps::PythonInfo::isValid() const

6
src/base/utils/fs.cpp

@ -329,7 +329,7 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path) @@ -329,7 +329,7 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0)
|| (strncmp(buf.f_fstypename, "nfs", sizeof(buf.f_fstypename)) == 0)
|| (strncmp(buf.f_fstypename, "smbfs", sizeof(buf.f_fstypename)) == 0));
#else
#else // Q_OS_WIN
QString file = path;
if (!file.endsWith('/'))
file += '/';
@ -351,6 +351,6 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path) @@ -351,6 +351,6 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
default:
return false;
}
#endif
#endif // Q_OS_WIN
}
#endif
#endif // Q_OS_HAIKU

2
src/base/utils/misc.cpp

@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include "base/utils/version.h"
#endif
#endif
#endif // DISABLE_GUI
#include "base/logger.h"
#include "base/unicodestrings.h"

2
src/base/utils/misc.h

@ -124,7 +124,7 @@ namespace Utils @@ -124,7 +124,7 @@ namespace Utils
return reinterpret_cast<T>(
::GetProcAddress(::LoadLibraryW(pathWchar.get()), funcName));
}
#endif
#endif // Q_OS_WIN
}
}

8
src/gui/mainwindow.cpp

@ -305,7 +305,7 @@ MainWindow::MainWindow(QWidget *parent) @@ -305,7 +305,7 @@ MainWindow::MainWindow(QWidget *parent)
spacer->setMinimumWidth(8);
m_ui->toolBar->addWidget(spacer);
}
#endif
#endif // Q_OS_MAC
// Transfer list slots
connect(m_ui->actionStart, &QAction::triggered, m_transferListWidget, &TransferListWidget::startSelectedTorrents);
@ -1110,7 +1110,7 @@ void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason @@ -1110,7 +1110,7 @@ void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason
break;
}
}
#endif
#endif // Q_OS_MAC
// Display About Dialog
void MainWindow::on_actionAbout_triggered()
@ -1272,7 +1272,7 @@ bool MainWindow::event(QEvent *e) @@ -1272,7 +1272,7 @@ bool MainWindow::event(QEvent *e)
default:
break;
}
#endif
#endif // Q_OS_MAC
return QMainWindow::event(e);
}
@ -1361,7 +1361,7 @@ void MainWindow::setupDockClickHandler() @@ -1361,7 +1361,7 @@ void MainWindow::setupDockClickHandler()
MacUtils::overrideDockClickHandler(dockClickHandler);
}
#endif
#endif // Q_OS_MAC
/*****************************************************
* *

36
src/gui/optionsdialog.cpp

@ -148,7 +148,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -148,7 +148,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
QList<QAbstractButton *> buttons = m_ui->buttonBox->buttons();
foreach (QAbstractButton *button, buttons) {
if (m_ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
applyButton = button;
m_applyButton = button;
break;
}
}
@ -410,13 +410,13 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -410,13 +410,13 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->btnEditRules, &QPushButton::clicked, this, [this]() { AutomatedRssDownloader(this).exec(); });
// Disable apply Button
applyButton->setEnabled(false);
m_applyButton->setEnabled(false);
// Tab selection mechanism
connect(m_ui->tabSelection, &QListWidget::currentItemChanged, this, &ThisType::changePage);
// Load Advanced settings
advancedSettings = new AdvancedSettings(m_ui->tabAdvancedPage);
m_ui->advPageLayout->addWidget(advancedSettings);
connect(advancedSettings, &AdvancedSettings::settingsChanged, this, &ThisType::enableApplyButton);
m_advancedSettings = new AdvancedSettings(m_ui->tabAdvancedPage);
m_ui->advPageLayout->addWidget(m_advancedSettings);
connect(m_advancedSettings, &AdvancedSettings::settingsChanged, this, &ThisType::enableApplyButton);
m_ui->textFileLogPath->setDialogCaption(tr("Choose a save directory"));
m_ui->textFileLogPath->setMode(FileSystemPathEdit::Mode::DirectorySave);
@ -479,7 +479,7 @@ OptionsDialog::~OptionsDialog() @@ -479,7 +479,7 @@ OptionsDialog::~OptionsDialog()
saveWindowState();
foreach (const QString &path, addedScanDirs)
foreach (const QString &path, m_addedScanDirs)
ScanFoldersModel::instance()->removePath(path);
ScanFoldersModel::instance()->configure(); // reloads "removed" paths
delete m_ui;
@ -527,7 +527,7 @@ void OptionsDialog::saveWindowState() const @@ -527,7 +527,7 @@ void OptionsDialog::saveWindowState() const
void OptionsDialog::saveOptions()
{
applyButton->setEnabled(false);
m_applyButton->setEnabled(false);
Preferences *const pref = Preferences::instance();
// Load the translation
QString locale = getLocale();
@ -611,11 +611,11 @@ void OptionsDialog::saveOptions() @@ -611,11 +611,11 @@ void OptionsDialog::saveOptions()
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
session->setAddTorrentPaused(addTorrentsInPause());
session->setCreateTorrentSubfolder(m_ui->checkCreateSubfolder->isChecked());
ScanFoldersModel::instance()->removeFromFSWatcher(removedScanDirs);
ScanFoldersModel::instance()->addToFSWatcher(addedScanDirs);
ScanFoldersModel::instance()->removeFromFSWatcher(m_removedScanDirs);
ScanFoldersModel::instance()->addToFSWatcher(m_addedScanDirs);
ScanFoldersModel::instance()->makePersistent();
removedScanDirs.clear();
addedScanDirs.clear();
m_removedScanDirs.clear();
m_addedScanDirs.clear();
session->setTorrentExportDirectory(getTorrentExportDir());
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
pref->setMailNotificationEnabled(m_ui->groupMailNotification->isChecked());
@ -734,7 +734,7 @@ void OptionsDialog::saveOptions() @@ -734,7 +734,7 @@ void OptionsDialog::saveOptions()
// End Web UI
// End preferences
// Save advanced settings
advancedSettings->saveAdvancedSettings();
m_advancedSettings->saveAdvancedSettings();
// Assume that user changed multiple settings
// so it's best to save immediately
pref->apply();
@ -1226,7 +1226,7 @@ int OptionsDialog::getMaxUploadsPerTorrent() const @@ -1226,7 +1226,7 @@ int OptionsDialog::getMaxUploadsPerTorrent() const
void OptionsDialog::on_buttonBox_accepted()
{
if (applyButton->isEnabled()) {
if (m_applyButton->isEnabled()) {
if (!schedTimesOk()) {
m_ui->tabSelection->setCurrentRow(TAB_SPEED);
return;
@ -1235,7 +1235,7 @@ void OptionsDialog::on_buttonBox_accepted() @@ -1235,7 +1235,7 @@ void OptionsDialog::on_buttonBox_accepted()
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
return;
}
applyButton->setEnabled(false);
m_applyButton->setEnabled(false);
this->hide();
saveOptions();
}
@ -1245,7 +1245,7 @@ void OptionsDialog::on_buttonBox_accepted() @@ -1245,7 +1245,7 @@ void OptionsDialog::on_buttonBox_accepted()
void OptionsDialog::applySettings(QAbstractButton *button)
{
if (button == applyButton) {
if (button == m_applyButton) {
if (!schedTimesOk()) {
m_ui->tabSelection->setCurrentRow(TAB_SPEED);
return;
@ -1277,7 +1277,7 @@ bool OptionsDialog::useAdditionDialog() const @@ -1277,7 +1277,7 @@ bool OptionsDialog::useAdditionDialog() const
void OptionsDialog::enableApplyButton()
{
applyButton->setEnabled(true);
m_applyButton->setEnabled(true);
}
void OptionsDialog::toggleComboRatioLimitAct()
@ -1472,7 +1472,7 @@ void OptionsDialog::on_addScanFolderButton_clicked() @@ -1472,7 +1472,7 @@ void OptionsDialog::on_addScanFolderButton_clicked()
break;
default:
pref->setScanDirsLastPath(dir);
addedScanDirs << dir;
m_addedScanDirs << dir;
for (int i = 0; i < ScanFoldersModel::instance()->columnCount(); ++i)
m_ui->scanFoldersView->resizeColumnToContents(i);
enableApplyButton();
@ -1492,7 +1492,7 @@ void OptionsDialog::on_removeScanFolderButton_clicked() @@ -1492,7 +1492,7 @@ void OptionsDialog::on_removeScanFolderButton_clicked()
Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount());
foreach (const QModelIndex &index, selected) {
if (index.column() == ScanFoldersModel::WATCH)
removedScanDirs << index.data().toString();
m_removedScanDirs << index.data().toString();
}
ScanFoldersModel::instance()->removePath(selected.first().row(), false);
}

9
src/gui/optionsdialog.h

@ -176,11 +176,10 @@ private: @@ -176,11 +176,10 @@ private:
QByteArray m_sslCert, m_sslKey;
Ui::OptionsDialog *m_ui;
QButtonGroup choiceLanguage;
QAbstractButton *applyButton;
AdvancedSettings *advancedSettings;
QList<QString> addedScanDirs;
QList<QString> removedScanDirs;
QAbstractButton *m_applyButton;
AdvancedSettings *m_advancedSettings;
QList<QString> m_addedScanDirs;
QList<QString> m_removedScanDirs;
};
#endif // OPTIONSDIALOG_H

6
src/gui/properties/peerlistwidget.cpp

@ -103,7 +103,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent) @@ -103,7 +103,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
hideColumn(PeerListDelegate::COUNTRY);
// Ensure that at least one column is visible at all times
bool atLeastOne = false;
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i) {
for (int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i) {
if (!isColumnHidden(i)) {
atLeastOne = true;
break;
@ -114,7 +114,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent) @@ -114,7 +114,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
// To also mitigate the above issue, we have to resize each column when
// its size is 0, because explicitly 'showing' the column isn't enough
// in the above scenario.
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i)
for (int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i)
if ((columnWidth(i) <= 0) && !isColumnHidden(i))
resizeColumnToContents(i);
// Context menu
@ -169,7 +169,7 @@ void PeerListWidget::displayToggleColumnsMenu(const QPoint &) @@ -169,7 +169,7 @@ void PeerListWidget::displayToggleColumnsMenu(const QPoint &)
actions.append(myAct);
}
int visibleCols = 0;
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i) {
for (int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i) {
if (!isColumnHidden(i))
++visibleCols;

24
src/gui/transferlistwidget.cpp

@ -582,7 +582,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const @@ -582,7 +582,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const
}
pathsList.insert(path);
}
#endif
#endif // Q_OS_MAC
}
void TransferListWidget::previewSelectedTorrents()
@ -595,16 +595,16 @@ void TransferListWidget::previewSelectedTorrents() @@ -595,16 +595,16 @@ void TransferListWidget::previewSelectedTorrents()
void TransferListWidget::setDlLimitSelectedTorrents()
{
QList<BitTorrent::TorrentHandle *> TorrentsList;
QList<BitTorrent::TorrentHandle *> torrentsList;
foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) {
if (torrent->isSeed())
continue;
TorrentsList += torrent;
torrentsList += torrent;
}
if (TorrentsList.empty()) return;
if (torrentsList.empty()) return;
int oldLimit = TorrentsList.first()->downloadLimit();
foreach (BitTorrent::TorrentHandle *const torrent, TorrentsList) {
int oldLimit = torrentsList.first()->downloadLimit();
foreach (BitTorrent::TorrentHandle *const torrent, torrentsList) {
if (torrent->downloadLimit() != oldLimit) {
oldLimit = -1;
break;
@ -617,7 +617,7 @@ void TransferListWidget::setDlLimitSelectedTorrents() @@ -617,7 +617,7 @@ void TransferListWidget::setDlLimitSelectedTorrents()
, BitTorrent::Session::instance()->globalDownloadSpeedLimit());
if (!ok) return;
foreach (BitTorrent::TorrentHandle *const torrent, TorrentsList) {
foreach (BitTorrent::TorrentHandle *const torrent, torrentsList) {
qDebug("Applying download speed limit of %ld Kb/s to torrent %s", (newLimit / 1024l), qUtf8Printable(torrent->hash()));
torrent->setDownloadLimit(newLimit);
}
@ -625,11 +625,11 @@ void TransferListWidget::setDlLimitSelectedTorrents() @@ -625,11 +625,11 @@ void TransferListWidget::setDlLimitSelectedTorrents()
void TransferListWidget::setUpLimitSelectedTorrents()
{
QList<BitTorrent::TorrentHandle *> TorrentsList = getSelectedTorrents();
if (TorrentsList.empty()) return;
QList<BitTorrent::TorrentHandle *> torrentsList = getSelectedTorrents();
if (torrentsList.empty()) return;
int oldLimit = TorrentsList.first()->uploadLimit();
foreach (BitTorrent::TorrentHandle *const torrent, TorrentsList) {
int oldLimit = torrentsList.first()->uploadLimit();
foreach (BitTorrent::TorrentHandle *const torrent, torrentsList) {
if (torrent->uploadLimit() != oldLimit) {
oldLimit = -1;
break;
@ -642,7 +642,7 @@ void TransferListWidget::setUpLimitSelectedTorrents() @@ -642,7 +642,7 @@ void TransferListWidget::setUpLimitSelectedTorrents()
, BitTorrent::Session::instance()->globalUploadSpeedLimit());
if (!ok) return;
foreach (BitTorrent::TorrentHandle *const torrent, TorrentsList) {
foreach (BitTorrent::TorrentHandle *const torrent, torrentsList) {
qDebug("Applying upload speed limit of %ld Kb/s to torrent %s", (newLimit / 1024l), qUtf8Printable(torrent->hash()));
torrent->setUploadLimit(newLimit);
}

Loading…
Cancel
Save