mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
Fix coding style for various things
This commit is contained in:
parent
c62127e9f1
commit
62e71a15a4
35 changed files with 120 additions and 121 deletions
|
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
|
||||||
// this is the default in Qt6
|
// this is the default in Qt6
|
||||||
app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
|
app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
// Since Apple made difficult for users to set PATH, we set here for convenience.
|
// Since Apple made difficult for users to set PATH, we set here for convenience.
|
||||||
|
|
|
@ -83,7 +83,7 @@ bool userAcceptsUpgrade()
|
||||||
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
msgBox.move(Utils::Misc::screenCenter(&msgBox));
|
||||||
if (msgBox.exec() == QMessageBox::Ok)
|
if (msgBox.exec() == QMessageBox::Ok)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif // DISABLE_GUI
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,7 +469,7 @@ Session::Session(QObject *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
configurePeerClasses();
|
configurePeerClasses();
|
||||||
#endif
|
#endif // LIBTORRENT_VERSION_NUM < 10100
|
||||||
|
|
||||||
// Enabling plugins
|
// Enabling plugins
|
||||||
//m_nativeSession->add_extension(&libt::create_metadata_plugin);
|
//m_nativeSession->add_extension(&libt::create_metadata_plugin);
|
||||||
|
@ -1253,7 +1253,7 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
settingsPack.set_str(libt::settings_pack::outgoing_interfaces, networkInterface().toStdString());
|
settingsPack.set_str(libt::settings_pack::outgoing_interfaces, networkInterface().toStdString());
|
||||||
#endif
|
#endif // Q_OS_WIN
|
||||||
m_listenInterfaceChanged = false;
|
m_listenInterfaceChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1462,7 +1462,7 @@ void Session::configurePeerClasses()
|
||||||
, 1 << libt::session::global_peer_class_id);
|
, 1 << libt::session::global_peer_class_id);
|
||||||
}
|
}
|
||||||
catch (std::exception &) {}
|
catch (std::exception &) {}
|
||||||
#endif
|
#endif // TORRENT_USE_IPV6
|
||||||
if (ignoreLimitsOnLAN()) {
|
if (ignoreLimitsOnLAN()) {
|
||||||
// local networks
|
// local networks
|
||||||
f.add_rule(libt::address_v4::from_string("10.0.0.0")
|
f.add_rule(libt::address_v4::from_string("10.0.0.0")
|
||||||
|
@ -1501,7 +1501,7 @@ void Session::configurePeerClasses()
|
||||||
, 1 << libt::session::local_peer_class_id);
|
, 1 << libt::session::local_peer_class_id);
|
||||||
}
|
}
|
||||||
catch (std::exception &) {}
|
catch (std::exception &) {}
|
||||||
#endif
|
#endif // TORRENT_USE_IPV6
|
||||||
}
|
}
|
||||||
m_nativeSession->set_peer_class_filter(f);
|
m_nativeSession->set_peer_class_filter(f);
|
||||||
|
|
||||||
|
@ -1518,7 +1518,7 @@ void Session::configurePeerClasses()
|
||||||
m_nativeSession->set_peer_class_type_filter(peerClassTypeFilter);
|
m_nativeSession->set_peer_class_type_filter(peerClassTypeFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else // LIBTORRENT_VERSION_NUM >= 10100
|
||||||
|
|
||||||
void Session::adjustLimits(libt::session_settings &sessionSettings)
|
void Session::adjustLimits(libt::session_settings &sessionSettings)
|
||||||
{
|
{
|
||||||
|
@ -1735,7 +1735,7 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // LIBTORRENT_VERSION_NUM >= 10100
|
||||||
|
|
||||||
void Session::enableTracker(bool enable)
|
void Session::enableTracker(bool enable)
|
||||||
{
|
{
|
||||||
|
@ -1983,8 +1983,8 @@ void Session::increaseTorrentsPriority(const QStringList &hashes)
|
||||||
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
|
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||||
|
|
||||||
// Sort torrents by priority
|
// Sort torrents by priority
|
||||||
foreach (const InfoHash &hash, hashes) {
|
foreach (const InfoHash &infoHash, hashes) {
|
||||||
TorrentHandle *const torrent = m_torrents.value(hash);
|
TorrentHandle *const torrent = m_torrents.value(infoHash);
|
||||||
if (torrent && !torrent->isSeed())
|
if (torrent && !torrent->isSeed())
|
||||||
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
||||||
}
|
}
|
||||||
|
@ -2006,8 +2006,8 @@ void Session::decreaseTorrentsPriority(const QStringList &hashes)
|
||||||
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
|
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||||
|
|
||||||
// Sort torrents by priority
|
// Sort torrents by priority
|
||||||
foreach (const InfoHash &hash, hashes) {
|
foreach (const InfoHash &infoHash, hashes) {
|
||||||
TorrentHandle *const torrent = m_torrents.value(hash);
|
TorrentHandle *const torrent = m_torrents.value(infoHash);
|
||||||
if (torrent && !torrent->isSeed())
|
if (torrent && !torrent->isSeed())
|
||||||
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
||||||
}
|
}
|
||||||
|
@ -2032,8 +2032,8 @@ void Session::topTorrentsPriority(const QStringList &hashes)
|
||||||
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
|
std::greater<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||||
|
|
||||||
// Sort torrents by priority
|
// Sort torrents by priority
|
||||||
foreach (const InfoHash &hash, hashes) {
|
foreach (const InfoHash &infoHash, hashes) {
|
||||||
TorrentHandle *const torrent = m_torrents.value(hash);
|
TorrentHandle *const torrent = m_torrents.value(infoHash);
|
||||||
if (torrent && !torrent->isSeed())
|
if (torrent && !torrent->isSeed())
|
||||||
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
||||||
}
|
}
|
||||||
|
@ -2055,8 +2055,8 @@ void Session::bottomTorrentsPriority(const QStringList &hashes)
|
||||||
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
|
std::less<QPair<int, TorrentHandle *>>> torrentQueue;
|
||||||
|
|
||||||
// Sort torrents by priority
|
// Sort torrents by priority
|
||||||
foreach (const InfoHash &hash, hashes) {
|
foreach (const InfoHash &infoHash, hashes) {
|
||||||
TorrentHandle *const torrent = m_torrents.value(hash);
|
TorrentHandle *const torrent = m_torrents.value(infoHash);
|
||||||
if (torrent && !torrent->isSeed())
|
if (torrent && !torrent->isSeed())
|
||||||
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
torrentQueue.push(qMakePair(torrent->queuePosition(), torrent));
|
||||||
}
|
}
|
||||||
|
@ -2598,7 +2598,7 @@ void Session::configureListeningInterface()
|
||||||
#else
|
#else
|
||||||
m_listenInterfaceChanged = true;
|
m_listenInterfaceChanged = true;
|
||||||
configureDeferred();
|
configureDeferred();
|
||||||
#endif
|
#endif // LIBTORRENT_VERSION_NUM < 10100
|
||||||
}
|
}
|
||||||
|
|
||||||
int Session::globalDownloadSpeedLimit() const
|
int Session::globalDownloadSpeedLimit() const
|
||||||
|
@ -4502,7 +4502,7 @@ void Session::handleSessionStatsAlert(libt::session_stats_alert *p)
|
||||||
|
|
||||||
emit statsUpdated();
|
emit statsUpdated();
|
||||||
}
|
}
|
||||||
#else
|
#else // LIBTORRENT_VERSION_NUM >= 10100
|
||||||
void Session::updateStats()
|
void Session::updateStats()
|
||||||
{
|
{
|
||||||
libt::session_status ss = m_nativeSession->status();
|
libt::session_status ss = m_nativeSession->status();
|
||||||
|
@ -4539,7 +4539,7 @@ void Session::updateStats()
|
||||||
|
|
||||||
emit statsUpdated();
|
emit statsUpdated();
|
||||||
}
|
}
|
||||||
#endif
|
#endif // LIBTORRENT_VERSION_NUM >= 10100
|
||||||
|
|
||||||
void Session::handleStateUpdateAlert(libt::state_update_alert *p)
|
void Session::handleStateUpdateAlert(libt::state_update_alert *p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -237,7 +237,7 @@ namespace BitTorrent
|
||||||
int diskJobTime = 0;
|
int diskJobTime = 0;
|
||||||
} disk;
|
} disk;
|
||||||
};
|
};
|
||||||
#endif
|
#endif // LIBTORRENT_VERSION_NUM >= 10100
|
||||||
|
|
||||||
class Session : public QObject
|
class Session : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,7 +212,7 @@ void Preferences::setCloseToTrayNotified(bool b)
|
||||||
{
|
{
|
||||||
setValue("Preferences/General/CloseToTrayNotified", b);
|
setValue("Preferences/General/CloseToTrayNotified", b);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
bool Preferences::isToolbarDisplayed() const
|
bool Preferences::isToolbarDisplayed() const
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ void Preferences::setWinStartup(bool b)
|
||||||
settings.remove("qBittorrent");
|
settings.remove("qBittorrent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
// Downloads
|
// Downloads
|
||||||
QString Preferences::lastLocationPath() const
|
QString Preferences::lastLocationPath() const
|
||||||
|
@ -967,7 +967,7 @@ void Preferences::setMagnetLinkAssoc(bool set)
|
||||||
|
|
||||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
|
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
namespace
|
namespace
|
||||||
|
@ -1023,7 +1023,7 @@ void Preferences::setMagnetLinkAssoc()
|
||||||
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||||
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
|
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
int Preferences::getTrackerPort() const
|
int Preferences::getTrackerPort() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -299,7 +299,7 @@ public:
|
||||||
void setCloseToTrayNotified(bool b);
|
void setCloseToTrayNotified(bool b);
|
||||||
TrayIcon::Style trayIconStyle() const;
|
TrayIcon::Style trayIconStyle() const;
|
||||||
void setTrayIconStyle(TrayIcon::Style style);
|
void setTrayIconStyle(TrayIcon::Style style);
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
// Stuff that don't appear in the Options GUI but are saved
|
// Stuff that don't appear in the Options GUI but are saved
|
||||||
// in the same file.
|
// in the same file.
|
||||||
|
|
|
@ -439,9 +439,9 @@ namespace
|
||||||
int dayOfWeek = -1;
|
int dayOfWeek = -1;
|
||||||
if (!parts[nwday].isEmpty()) {
|
if (!parts[nwday].isEmpty()) {
|
||||||
// Look up the weekday name
|
// Look up the weekday name
|
||||||
while (++dayOfWeek < 7 && (shortDay[dayOfWeek] != parts[nwday]));
|
while ((++dayOfWeek < 7) && (shortDay[dayOfWeek] != parts[nwday]));
|
||||||
if (dayOfWeek >= 7)
|
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
|
// if (month >= 12 || dayOfWeek >= 7
|
||||||
|
@ -450,7 +450,7 @@ namespace
|
||||||
int i = parts[nyear].size();
|
int i = parts[nyear].size();
|
||||||
if (i < 4) {
|
if (i < 4) {
|
||||||
// It's an obsolete year specification with less than 4 digits
|
// 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
|
// Parse the UTC offset part
|
||||||
|
@ -473,17 +473,17 @@ namespace
|
||||||
else {
|
else {
|
||||||
// Check for an obsolete time zone name
|
// Check for an obsolete time zone name
|
||||||
QByteArray zone = parts[10].toLatin1();
|
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'
|
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")
|
offset = (zone == "EDT")
|
||||||
? -4 * 3600
|
? -4 * 3600
|
||||||
: ((zone == "EST") || (zone == "CDT"))
|
: ((zone == "EST") || (zone == "CDT"))
|
||||||
? -5 * 3600
|
? -5 * 3600
|
||||||
: ((zone == "CST") || (zone == "MDT"))
|
: ((zone == "CST") || (zone == "MDT"))
|
||||||
? -6 * 3600
|
? -6 * 3600
|
||||||
: (zone == "MST" || zone == "PDT")
|
: ((zone == "MST") || (zone == "PDT"))
|
||||||
? -7 * 3600
|
? -7 * 3600
|
||||||
: (zone == "PST")
|
: (zone == "PST")
|
||||||
? -8 * 3600
|
? -8 * 3600
|
||||||
|
@ -502,12 +502,12 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QDate qdate(year, month + 1, day); // convert date, and check for out-of-range
|
QDate qDate(year, month + 1, day); // convert date, and check for out-of-range
|
||||||
if (!qdate.isValid())
|
if (!qDate.isValid())
|
||||||
return QDateTime::currentDateTime();
|
return QDateTime::currentDateTime();
|
||||||
|
|
||||||
QTime qTime(hour, minute, second);
|
QTime qTime(hour, minute, second);
|
||||||
QDateTime result(qdate, qTime, Qt::UTC);
|
QDateTime result(qDate, qTime, Qt::UTC);
|
||||||
if (offset)
|
if (offset)
|
||||||
result = result.addSecs(-offset);
|
result = result.addSecs(-offset);
|
||||||
if (!result.isValid())
|
if (!result.isValid())
|
||||||
|
|
|
@ -229,7 +229,7 @@ namespace
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_WIN
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::ForeignApps::PythonInfo::isValid() const
|
bool Utils::ForeignApps::PythonInfo::isValid() const
|
||||||
|
|
|
@ -329,7 +329,7 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
|
||||||
return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0)
|
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, "nfs", sizeof(buf.f_fstypename)) == 0)
|
||||||
|| (strncmp(buf.f_fstypename, "smbfs", sizeof(buf.f_fstypename)) == 0));
|
|| (strncmp(buf.f_fstypename, "smbfs", sizeof(buf.f_fstypename)) == 0));
|
||||||
#else
|
#else // Q_OS_WIN
|
||||||
QString file = path;
|
QString file = path;
|
||||||
if (!file.endsWith('/'))
|
if (!file.endsWith('/'))
|
||||||
file += '/';
|
file += '/';
|
||||||
|
@ -351,6 +351,6 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_WIN
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_HAIKU
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||||
#include "base/utils/version.h"
|
#include "base/utils/version.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif // DISABLE_GUI
|
||||||
|
|
||||||
#include "base/logger.h"
|
#include "base/logger.h"
|
||||||
#include "base/unicodestrings.h"
|
#include "base/unicodestrings.h"
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace Utils
|
||||||
return reinterpret_cast<T>(
|
return reinterpret_cast<T>(
|
||||||
::GetProcAddress(::LoadLibraryW(pathWchar.get()), funcName));
|
::GetProcAddress(::LoadLibraryW(pathWchar.get()), funcName));
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_WIN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
spacer->setMinimumWidth(8);
|
spacer->setMinimumWidth(8);
|
||||||
m_ui->toolBar->addWidget(spacer);
|
m_ui->toolBar->addWidget(spacer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
// Transfer list slots
|
// Transfer list slots
|
||||||
connect(m_ui->actionStart, &QAction::triggered, m_transferListWidget, &TransferListWidget::startSelectedTorrents);
|
connect(m_ui->actionStart, &QAction::triggered, m_transferListWidget, &TransferListWidget::startSelectedTorrents);
|
||||||
|
@ -1110,7 +1110,7 @@ void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
// Display About Dialog
|
// Display About Dialog
|
||||||
void MainWindow::on_actionAbout_triggered()
|
void MainWindow::on_actionAbout_triggered()
|
||||||
|
@ -1272,7 +1272,7 @@ bool MainWindow::event(QEvent *e)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
return QMainWindow::event(e);
|
return QMainWindow::event(e);
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1361,7 @@ void MainWindow::setupDockClickHandler()
|
||||||
MacUtils::overrideDockClickHandler(dockClickHandler);
|
MacUtils::overrideDockClickHandler(dockClickHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* *
|
* *
|
||||||
|
|
|
@ -163,7 +163,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||||
QList<QAbstractButton *> buttons = m_ui->buttonBox->buttons();
|
QList<QAbstractButton *> buttons = m_ui->buttonBox->buttons();
|
||||||
foreach (QAbstractButton *button, buttons) {
|
foreach (QAbstractButton *button, buttons) {
|
||||||
if (m_ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
|
if (m_ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
|
||||||
applyButton = button;
|
m_applyButton = button;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,13 +424,13 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||||
connect(m_ui->btnEditRules, &QPushButton::clicked, this, [this]() { AutomatedRssDownloader(this).exec(); });
|
connect(m_ui->btnEditRules, &QPushButton::clicked, this, [this]() { AutomatedRssDownloader(this).exec(); });
|
||||||
|
|
||||||
// Disable apply Button
|
// Disable apply Button
|
||||||
applyButton->setEnabled(false);
|
m_applyButton->setEnabled(false);
|
||||||
// Tab selection mechanism
|
// Tab selection mechanism
|
||||||
connect(m_ui->tabSelection, &QListWidget::currentItemChanged, this, &ThisType::changePage);
|
connect(m_ui->tabSelection, &QListWidget::currentItemChanged, this, &ThisType::changePage);
|
||||||
// Load Advanced settings
|
// Load Advanced settings
|
||||||
advancedSettings = new AdvancedSettings(m_ui->tabAdvancedPage);
|
m_advancedSettings = new AdvancedSettings(m_ui->tabAdvancedPage);
|
||||||
m_ui->advPageLayout->addWidget(advancedSettings);
|
m_ui->advPageLayout->addWidget(m_advancedSettings);
|
||||||
connect(advancedSettings, &AdvancedSettings::settingsChanged, this, &ThisType::enableApplyButton);
|
connect(m_advancedSettings, &AdvancedSettings::settingsChanged, this, &ThisType::enableApplyButton);
|
||||||
|
|
||||||
m_ui->textFileLogPath->setDialogCaption(tr("Choose a save directory"));
|
m_ui->textFileLogPath->setDialogCaption(tr("Choose a save directory"));
|
||||||
m_ui->textFileLogPath->setMode(FileSystemPathEdit::Mode::DirectorySave);
|
m_ui->textFileLogPath->setMode(FileSystemPathEdit::Mode::DirectorySave);
|
||||||
|
@ -493,7 +493,7 @@ OptionsDialog::~OptionsDialog()
|
||||||
|
|
||||||
saveWindowState();
|
saveWindowState();
|
||||||
|
|
||||||
foreach (const QString &path, addedScanDirs)
|
foreach (const QString &path, m_addedScanDirs)
|
||||||
ScanFoldersModel::instance()->removePath(path);
|
ScanFoldersModel::instance()->removePath(path);
|
||||||
ScanFoldersModel::instance()->configure(); // reloads "removed" paths
|
ScanFoldersModel::instance()->configure(); // reloads "removed" paths
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
|
@ -541,7 +541,7 @@ void OptionsDialog::saveWindowState() const
|
||||||
|
|
||||||
void OptionsDialog::saveOptions()
|
void OptionsDialog::saveOptions()
|
||||||
{
|
{
|
||||||
applyButton->setEnabled(false);
|
m_applyButton->setEnabled(false);
|
||||||
Preferences *const pref = Preferences::instance();
|
Preferences *const pref = Preferences::instance();
|
||||||
// Load the translation
|
// Load the translation
|
||||||
QString locale = getLocale();
|
QString locale = getLocale();
|
||||||
|
@ -625,11 +625,11 @@ void OptionsDialog::saveOptions()
|
||||||
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
|
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
|
||||||
session->setAddTorrentPaused(addTorrentsInPause());
|
session->setAddTorrentPaused(addTorrentsInPause());
|
||||||
session->setCreateTorrentSubfolder(m_ui->checkCreateSubfolder->isChecked());
|
session->setCreateTorrentSubfolder(m_ui->checkCreateSubfolder->isChecked());
|
||||||
ScanFoldersModel::instance()->removeFromFSWatcher(removedScanDirs);
|
ScanFoldersModel::instance()->removeFromFSWatcher(m_removedScanDirs);
|
||||||
ScanFoldersModel::instance()->addToFSWatcher(addedScanDirs);
|
ScanFoldersModel::instance()->addToFSWatcher(m_addedScanDirs);
|
||||||
ScanFoldersModel::instance()->makePersistent();
|
ScanFoldersModel::instance()->makePersistent();
|
||||||
removedScanDirs.clear();
|
m_removedScanDirs.clear();
|
||||||
addedScanDirs.clear();
|
m_addedScanDirs.clear();
|
||||||
session->setTorrentExportDirectory(getTorrentExportDir());
|
session->setTorrentExportDirectory(getTorrentExportDir());
|
||||||
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
|
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
|
||||||
pref->setMailNotificationEnabled(m_ui->groupMailNotification->isChecked());
|
pref->setMailNotificationEnabled(m_ui->groupMailNotification->isChecked());
|
||||||
|
@ -748,7 +748,7 @@ void OptionsDialog::saveOptions()
|
||||||
// End Web UI
|
// End Web UI
|
||||||
// End preferences
|
// End preferences
|
||||||
// Save advanced settings
|
// Save advanced settings
|
||||||
advancedSettings->saveAdvancedSettings();
|
m_advancedSettings->saveAdvancedSettings();
|
||||||
// Assume that user changed multiple settings
|
// Assume that user changed multiple settings
|
||||||
// so it's best to save immediately
|
// so it's best to save immediately
|
||||||
pref->apply();
|
pref->apply();
|
||||||
|
@ -1240,7 +1240,7 @@ int OptionsDialog::getMaxUploadsPerTorrent() const
|
||||||
|
|
||||||
void OptionsDialog::on_buttonBox_accepted()
|
void OptionsDialog::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
if (applyButton->isEnabled()) {
|
if (m_applyButton->isEnabled()) {
|
||||||
if (!schedTimesOk()) {
|
if (!schedTimesOk()) {
|
||||||
m_ui->tabSelection->setCurrentRow(TAB_SPEED);
|
m_ui->tabSelection->setCurrentRow(TAB_SPEED);
|
||||||
return;
|
return;
|
||||||
|
@ -1249,7 +1249,7 @@ void OptionsDialog::on_buttonBox_accepted()
|
||||||
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
applyButton->setEnabled(false);
|
m_applyButton->setEnabled(false);
|
||||||
this->hide();
|
this->hide();
|
||||||
saveOptions();
|
saveOptions();
|
||||||
}
|
}
|
||||||
|
@ -1259,7 +1259,7 @@ void OptionsDialog::on_buttonBox_accepted()
|
||||||
|
|
||||||
void OptionsDialog::applySettings(QAbstractButton *button)
|
void OptionsDialog::applySettings(QAbstractButton *button)
|
||||||
{
|
{
|
||||||
if (button == applyButton) {
|
if (button == m_applyButton) {
|
||||||
if (!schedTimesOk()) {
|
if (!schedTimesOk()) {
|
||||||
m_ui->tabSelection->setCurrentRow(TAB_SPEED);
|
m_ui->tabSelection->setCurrentRow(TAB_SPEED);
|
||||||
return;
|
return;
|
||||||
|
@ -1291,7 +1291,7 @@ bool OptionsDialog::useAdditionDialog() const
|
||||||
|
|
||||||
void OptionsDialog::enableApplyButton()
|
void OptionsDialog::enableApplyButton()
|
||||||
{
|
{
|
||||||
applyButton->setEnabled(true);
|
m_applyButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::toggleComboRatioLimitAct()
|
void OptionsDialog::toggleComboRatioLimitAct()
|
||||||
|
@ -1486,7 +1486,7 @@ void OptionsDialog::on_addScanFolderButton_clicked()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pref->setScanDirsLastPath(dir);
|
pref->setScanDirsLastPath(dir);
|
||||||
addedScanDirs << dir;
|
m_addedScanDirs << dir;
|
||||||
for (int i = 0; i < ScanFoldersModel::instance()->columnCount(); ++i)
|
for (int i = 0; i < ScanFoldersModel::instance()->columnCount(); ++i)
|
||||||
m_ui->scanFoldersView->resizeColumnToContents(i);
|
m_ui->scanFoldersView->resizeColumnToContents(i);
|
||||||
enableApplyButton();
|
enableApplyButton();
|
||||||
|
@ -1506,7 +1506,7 @@ void OptionsDialog::on_removeScanFolderButton_clicked()
|
||||||
Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount());
|
Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount());
|
||||||
foreach (const QModelIndex &index, selected) {
|
foreach (const QModelIndex &index, selected) {
|
||||||
if (index.column() == ScanFoldersModel::WATCH)
|
if (index.column() == ScanFoldersModel::WATCH)
|
||||||
removedScanDirs << index.data().toString();
|
m_removedScanDirs << index.data().toString();
|
||||||
}
|
}
|
||||||
ScanFoldersModel::instance()->removePath(selected.first().row(), false);
|
ScanFoldersModel::instance()->removePath(selected.first().row(), false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,11 +176,10 @@ private:
|
||||||
QByteArray m_sslCert, m_sslKey;
|
QByteArray m_sslCert, m_sslKey;
|
||||||
|
|
||||||
Ui::OptionsDialog *m_ui;
|
Ui::OptionsDialog *m_ui;
|
||||||
QButtonGroup choiceLanguage;
|
QAbstractButton *m_applyButton;
|
||||||
QAbstractButton *applyButton;
|
AdvancedSettings *m_advancedSettings;
|
||||||
AdvancedSettings *advancedSettings;
|
QList<QString> m_addedScanDirs;
|
||||||
QList<QString> addedScanDirs;
|
QList<QString> m_removedScanDirs;
|
||||||
QList<QString> removedScanDirs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OPTIONSDIALOG_H
|
#endif // OPTIONSDIALOG_H
|
||||||
|
|
|
@ -103,7 +103,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
|
||||||
hideColumn(PeerListDelegate::COUNTRY);
|
hideColumn(PeerListDelegate::COUNTRY);
|
||||||
// Ensure that at least one column is visible at all times
|
// Ensure that at least one column is visible at all times
|
||||||
bool atLeastOne = false;
|
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)) {
|
if (!isColumnHidden(i)) {
|
||||||
atLeastOne = true;
|
atLeastOne = true;
|
||||||
break;
|
break;
|
||||||
|
@ -114,7 +114,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
|
||||||
// To also mitigate the above issue, we have to resize each column when
|
// 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
|
// its size is 0, because explicitly 'showing' the column isn't enough
|
||||||
// in the above scenario.
|
// 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))
|
if ((columnWidth(i) <= 0) && !isColumnHidden(i))
|
||||||
resizeColumnToContents(i);
|
resizeColumnToContents(i);
|
||||||
// Context menu
|
// Context menu
|
||||||
|
@ -169,7 +169,7 @@ void PeerListWidget::displayToggleColumnsMenu(const QPoint &)
|
||||||
actions.append(myAct);
|
actions.append(myAct);
|
||||||
}
|
}
|
||||||
int visibleCols = 0;
|
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))
|
if (!isColumnHidden(i))
|
||||||
++visibleCols;
|
++visibleCols;
|
||||||
|
|
||||||
|
|
|
@ -582,7 +582,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const
|
||||||
}
|
}
|
||||||
pathsList.insert(path);
|
pathsList.insert(path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::previewSelectedTorrents()
|
void TransferListWidget::previewSelectedTorrents()
|
||||||
|
@ -595,16 +595,16 @@ void TransferListWidget::previewSelectedTorrents()
|
||||||
|
|
||||||
void TransferListWidget::setDlLimitSelectedTorrents()
|
void TransferListWidget::setDlLimitSelectedTorrents()
|
||||||
{
|
{
|
||||||
QList<BitTorrent::TorrentHandle *> TorrentsList;
|
QList<BitTorrent::TorrentHandle *> torrentsList;
|
||||||
foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) {
|
foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) {
|
||||||
if (torrent->isSeed())
|
if (torrent->isSeed())
|
||||||
continue;
|
continue;
|
||||||
TorrentsList += torrent;
|
torrentsList += torrent;
|
||||||
}
|
}
|
||||||
if (TorrentsList.empty()) return;
|
if (torrentsList.empty()) return;
|
||||||
|
|
||||||
int oldLimit = TorrentsList.first()->downloadLimit();
|
int oldLimit = torrentsList.first()->downloadLimit();
|
||||||
foreach (BitTorrent::TorrentHandle *const torrent, TorrentsList) {
|
foreach (BitTorrent::TorrentHandle *const torrent, torrentsList) {
|
||||||
if (torrent->downloadLimit() != oldLimit) {
|
if (torrent->downloadLimit() != oldLimit) {
|
||||||
oldLimit = -1;
|
oldLimit = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -617,7 +617,7 @@ void TransferListWidget::setDlLimitSelectedTorrents()
|
||||||
, BitTorrent::Session::instance()->globalDownloadSpeedLimit());
|
, BitTorrent::Session::instance()->globalDownloadSpeedLimit());
|
||||||
if (!ok) return;
|
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()));
|
qDebug("Applying download speed limit of %ld Kb/s to torrent %s", (newLimit / 1024l), qUtf8Printable(torrent->hash()));
|
||||||
torrent->setDownloadLimit(newLimit);
|
torrent->setDownloadLimit(newLimit);
|
||||||
}
|
}
|
||||||
|
@ -625,11 +625,11 @@ void TransferListWidget::setDlLimitSelectedTorrents()
|
||||||
|
|
||||||
void TransferListWidget::setUpLimitSelectedTorrents()
|
void TransferListWidget::setUpLimitSelectedTorrents()
|
||||||
{
|
{
|
||||||
QList<BitTorrent::TorrentHandle *> TorrentsList = getSelectedTorrents();
|
QList<BitTorrent::TorrentHandle *> torrentsList = getSelectedTorrents();
|
||||||
if (TorrentsList.empty()) return;
|
if (torrentsList.empty()) return;
|
||||||
|
|
||||||
int oldLimit = TorrentsList.first()->uploadLimit();
|
int oldLimit = torrentsList.first()->uploadLimit();
|
||||||
foreach (BitTorrent::TorrentHandle *const torrent, TorrentsList) {
|
foreach (BitTorrent::TorrentHandle *const torrent, torrentsList) {
|
||||||
if (torrent->uploadLimit() != oldLimit) {
|
if (torrent->uploadLimit() != oldLimit) {
|
||||||
oldLimit = -1;
|
oldLimit = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -642,7 +642,7 @@ void TransferListWidget::setUpLimitSelectedTorrents()
|
||||||
, BitTorrent::Session::instance()->globalUploadSpeedLimit());
|
, BitTorrent::Session::instance()->globalUploadSpeedLimit());
|
||||||
if (!ok) return;
|
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()));
|
qDebug("Applying upload speed limit of %ld Kb/s to torrent %s", (newLimit / 1024l), qUtf8Printable(torrent->hash()));
|
||||||
torrent->setUploadLimit(newLimit);
|
torrent->setUploadLimit(newLimit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue