mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Fix coding style for various things
This commit is contained in:
parent
5efdd211cc
commit
d668a4fe6d
@ -486,7 +486,7 @@ CommandLineParameterError::CommandLineParameterError(const QString &messageForUs
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString& CommandLineParameterError::messageForUser() const
|
const QString &CommandLineParameterError::messageForUser() const
|
||||||
{
|
{
|
||||||
return m_messageForUser;
|
return m_messageForUser;
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
@ -2397,7 +2397,7 @@ void Session::saveResumeData()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto a: alerts) {
|
for (const auto a : alerts) {
|
||||||
switch (a->type()) {
|
switch (a->type()) {
|
||||||
case libt::save_resume_data_failed_alert::alert_type:
|
case libt::save_resume_data_failed_alert::alert_type:
|
||||||
case libt::save_resume_data_alert::alert_type:
|
case libt::save_resume_data_alert::alert_type:
|
||||||
@ -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
|
||||||
@ -3011,7 +3011,7 @@ void Session::setMaxConnectionsPerTorrent(int max)
|
|||||||
m_maxConnectionsPerTorrent = max;
|
m_maxConnectionsPerTorrent = max;
|
||||||
|
|
||||||
// Apply this to all session torrents
|
// Apply this to all session torrents
|
||||||
for (const auto &handle: m_nativeSession->get_torrents()) {
|
for (const auto &handle : m_nativeSession->get_torrents()) {
|
||||||
if (!handle.is_valid()) continue;
|
if (!handle.is_valid()) continue;
|
||||||
try {
|
try {
|
||||||
handle.set_max_connections(max);
|
handle.set_max_connections(max);
|
||||||
@ -3033,7 +3033,7 @@ void Session::setMaxUploadsPerTorrent(int max)
|
|||||||
m_maxUploadsPerTorrent = max;
|
m_maxUploadsPerTorrent = max;
|
||||||
|
|
||||||
// Apply this to all session torrents
|
// Apply this to all session torrents
|
||||||
for (const auto &handle: m_nativeSession->get_torrents()) {
|
for (const auto &handle : m_nativeSession->get_torrents()) {
|
||||||
if (!handle.is_valid()) continue;
|
if (!handle.is_valid()) continue;
|
||||||
try {
|
try {
|
||||||
handle.set_max_uploads(max);
|
handle.set_max_uploads(max);
|
||||||
@ -4095,7 +4095,7 @@ void Session::readAlerts()
|
|||||||
std::vector<libt::alert *> alerts;
|
std::vector<libt::alert *> alerts;
|
||||||
getPendingAlerts(alerts);
|
getPendingAlerts(alerts);
|
||||||
|
|
||||||
for (const auto a: alerts) {
|
for (const auto a : alerts) {
|
||||||
handleAlert(a);
|
handleAlert(a);
|
||||||
#if LIBTORRENT_VERSION_NUM < 10100
|
#if LIBTORRENT_VERSION_NUM < 10100
|
||||||
delete a;
|
delete a;
|
||||||
@ -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)
|
||||||
{
|
{
|
||||||
@ -4590,7 +4590,7 @@ namespace
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loadTorrentResumeData(const QByteArray &data, CreateTorrentParams &torrentParams, int &prio, MagnetUri &magnetUri)
|
bool loadTorrentResumeData(const QByteArray &data, CreateTorrentParams &torrentParams, int &prio, MagnetUri &magnetUri)
|
||||||
{
|
{
|
||||||
torrentParams = CreateTorrentParams();
|
torrentParams = CreateTorrentParams();
|
||||||
torrentParams.restored = true;
|
torrentParams.restored = true;
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -158,14 +158,14 @@ namespace
|
|||||||
{
|
{
|
||||||
// new constructor is available
|
// new constructor is available
|
||||||
template<typename T, typename std::enable_if<std::is_constructible<T, libt::torrent_info, bool>::value, int>::type = 0>
|
template<typename T, typename std::enable_if<std::is_constructible<T, libt::torrent_info, bool>::value, int>::type = 0>
|
||||||
T makeTorrentCreator(const libtorrent::torrent_info & ti)
|
T makeTorrentCreator(const libtorrent::torrent_info &ti)
|
||||||
{
|
{
|
||||||
return T(ti, true);
|
return T(ti, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// new constructor isn't available
|
// new constructor isn't available
|
||||||
template<typename T, typename std::enable_if<!std::is_constructible<T, libt::torrent_info, bool>::value, int>::type = 0>
|
template<typename T, typename std::enable_if<!std::is_constructible<T, libt::torrent_info, bool>::value, int>::type = 0>
|
||||||
T makeTorrentCreator(const libtorrent::torrent_info & ti)
|
T makeTorrentCreator(const libtorrent::torrent_info &ti)
|
||||||
{
|
{
|
||||||
return T(ti);
|
return T(ti);
|
||||||
}
|
}
|
||||||
@ -623,7 +623,7 @@ QString TorrentHandle::filePath(int index) const
|
|||||||
|
|
||||||
QString TorrentHandle::fileName(int index) const
|
QString TorrentHandle::fileName(int index) const
|
||||||
{
|
{
|
||||||
if (!hasMetadata()) return QString();
|
if (!hasMetadata()) return QString();
|
||||||
return Utils::Fs::fileName(filePath(index));
|
return Utils::Fs::fileName(filePath(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ qlonglong TorrentHandle::fileSize(int index) const
|
|||||||
// to all files in a torrent
|
// to all files in a torrent
|
||||||
QStringList TorrentHandle::absoluteFilePaths() const
|
QStringList TorrentHandle::absoluteFilePaths() const
|
||||||
{
|
{
|
||||||
if (!hasMetadata()) return QStringList();
|
if (!hasMetadata()) return QStringList();
|
||||||
|
|
||||||
QDir saveDir(savePath(true));
|
QDir saveDir(savePath(true));
|
||||||
QStringList res;
|
QStringList res;
|
||||||
@ -647,7 +647,7 @@ QStringList TorrentHandle::absoluteFilePaths() const
|
|||||||
|
|
||||||
QStringList TorrentHandle::absoluteFilePathsUnwanted() const
|
QStringList TorrentHandle::absoluteFilePathsUnwanted() const
|
||||||
{
|
{
|
||||||
if (!hasMetadata()) return QStringList();
|
if (!hasMetadata()) return QStringList();
|
||||||
|
|
||||||
QDir saveDir(savePath(true));
|
QDir saveDir(savePath(true));
|
||||||
QStringList res;
|
QStringList res;
|
||||||
@ -2063,7 +2063,7 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
|
|||||||
if (created) {
|
if (created) {
|
||||||
// Hide the folder on Windows
|
// Hide the folder on Windows
|
||||||
qDebug() << "Hiding folder (Windows)";
|
qDebug() << "Hiding folder (Windows)";
|
||||||
std::wstring winPath = Utils::Fs::toNativePath(unwantedAbsPath).toStdWString();
|
std::wstring winPath = Utils::Fs::toNativePath(unwantedAbsPath).toStdWString();
|
||||||
DWORD dwAttrs = ::GetFileAttributesW(winPath.c_str());
|
DWORD dwAttrs = ::GetFileAttributesW(winPath.c_str());
|
||||||
bool ret = ::SetFileAttributesW(winPath.c_str(), dwAttrs | FILE_ATTRIBUTE_HIDDEN);
|
bool ret = ::SetFileAttributesW(winPath.c_str(), dwAttrs | FILE_ATTRIBUTE_HIDDEN);
|
||||||
Q_ASSERT(ret != 0); Q_UNUSED(ret);
|
Q_ASSERT(ret != 0); Q_UNUSED(ret);
|
||||||
|
@ -350,7 +350,7 @@ void TorrentInfo::renameFile(const int index, const QString &newPath)
|
|||||||
nativeInfo()->rename_file(index, Utils::Fs::toNativePath(newPath).toStdString());
|
nativeInfo()->rename_file(index, Utils::Fs::toNativePath(newPath).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
int BitTorrent::TorrentInfo::fileIndex(const QString& fileName) const
|
int BitTorrent::TorrentInfo::fileIndex(const QString &fileName) const
|
||||||
{
|
{
|
||||||
// the check whether the object is valid is not needed here
|
// the check whether the object is valid is not needed here
|
||||||
// because if filesCount() returns -1 the loop exits immediately
|
// because if filesCount() returns -1 the loop exits immediately
|
||||||
|
@ -107,7 +107,7 @@ namespace Http
|
|||||||
uint code;
|
uint code;
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
ResponseStatus(uint code = 200, const QString& text = "OK"): code(code), text(text) {}
|
ResponseStatus(uint code = 200, const QString &text = "OK"): code(code), text(text) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Response
|
struct Response
|
||||||
@ -116,7 +116,7 @@ namespace Http
|
|||||||
QStringMap headers;
|
QStringMap headers;
|
||||||
QByteArray content;
|
QByteArray content;
|
||||||
|
|
||||||
Response(uint code = 200, const QString& text = "OK"): status(code, text) {}
|
Response(uint code = 200, const QString &text = "OK"): status(code, text) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ const QString KEY_PASSWORD = SETTINGS_KEY("Password");
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
|
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
|
||||||
|
|
||||||
inline bool isSameConfig(const Net::ProxyConfiguration &conf1, const Net::ProxyConfiguration &conf2)
|
inline bool isSameConfig(const Net::ProxyConfiguration &conf1, const Net::ProxyConfiguration &conf2)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ QByteArray Smtp::encodeMimeHeader(const QString &key, const QString &value, QTex
|
|||||||
if (!prefix.isEmpty()) line += prefix;
|
if (!prefix.isEmpty()) line += prefix;
|
||||||
if (!value.contains("=?") && latin1->canEncode(value)) {
|
if (!value.contains("=?") && latin1->canEncode(value)) {
|
||||||
bool firstWord = true;
|
bool firstWord = true;
|
||||||
foreach (const QByteArray& word, value.toLatin1().split(' ')) {
|
foreach (const QByteArray &word, value.toLatin1().split(' ')) {
|
||||||
if (line.size() > 78) {
|
if (line.size() > 78) {
|
||||||
rv = rv + line + "\r\n";
|
rv = rv + line + "\r\n";
|
||||||
line.clear();
|
line.clear();
|
||||||
|
@ -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.
|
||||||
|
@ -435,13 +435,13 @@ namespace
|
|||||||
if (leapSecond)
|
if (leapSecond)
|
||||||
second = 59; // apparently a leap second - validate below, once time zone is known
|
second = 59; // apparently a leap second - validate below, once time zone is known
|
||||||
int month = 0;
|
int month = 0;
|
||||||
for ( ; (month < 12) && (parts[nmonth] != shortMonth[month]); ++month);
|
for ( ; (month < 12) && (parts[nmonth] != shortMonth[month]); ++month);
|
||||||
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())
|
||||||
|
@ -373,7 +373,7 @@ void AutoDownloader::addJobForArticle(Article *article)
|
|||||||
|
|
||||||
void AutoDownloader::processJob(const QSharedPointer<ProcessingJob> &job)
|
void AutoDownloader::processJob(const QSharedPointer<ProcessingJob> &job)
|
||||||
{
|
{
|
||||||
for (AutoDownloadRule &rule: m_rules) {
|
for (AutoDownloadRule &rule : m_rules) {
|
||||||
if (!rule.isEnabled()) continue;
|
if (!rule.isEnabled()) continue;
|
||||||
if (!rule.feedURLs().contains(job->feedURL)) continue;
|
if (!rule.feedURLs().contains(job->feedURL)) continue;
|
||||||
if (!rule.accepts(job->articleData)) continue;
|
if (!rule.accepts(job->articleData)) continue;
|
||||||
|
@ -246,7 +246,7 @@ bool AutoDownloadRule::matchesMustContainExpression(const QString &articleTitle)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoDownloadRule::matchesMustNotContainExpression(const QString& articleTitle) const
|
bool AutoDownloadRule::matchesMustNotContainExpression(const QString &articleTitle) const
|
||||||
{
|
{
|
||||||
if (m_dataPtr->mustNotContain.empty())
|
if (m_dataPtr->mustNotContain.empty())
|
||||||
return true;
|
return true;
|
||||||
@ -262,7 +262,7 @@ bool AutoDownloadRule::matchesMustNotContainExpression(const QString& articleTit
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString& articleTitle) const
|
bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitle) const
|
||||||
{
|
{
|
||||||
// Reset the lastComputedEpisode, we don't want to leak it between matches
|
// Reset the lastComputedEpisode, we don't want to leak it between matches
|
||||||
m_dataPtr->lastComputedEpisode.clear();
|
m_dataPtr->lastComputedEpisode.clear();
|
||||||
@ -332,7 +332,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString& articleTitl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString& articleTitle) const
|
bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) const
|
||||||
{
|
{
|
||||||
if (!useSmartFilter())
|
if (!useSmartFilter())
|
||||||
return true;
|
return true;
|
||||||
|
@ -123,7 +123,7 @@ void Folder::addItem(Item *item)
|
|||||||
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved);
|
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved);
|
||||||
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged);
|
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged);
|
||||||
|
|
||||||
for (auto article: copyAsConst(item->articles()))
|
for (auto article : copyAsConst(item->articles()))
|
||||||
emit newArticle(article);
|
emit newArticle(article);
|
||||||
|
|
||||||
if (item->unreadCount() > 0)
|
if (item->unreadCount() > 0)
|
||||||
@ -134,7 +134,7 @@ void Folder::removeItem(Item *item)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(m_items.contains(item));
|
Q_ASSERT(m_items.contains(item));
|
||||||
|
|
||||||
for (auto article: copyAsConst(item->articles()))
|
for (auto article : copyAsConst(item->articles()))
|
||||||
emit articleAboutToBeRemoved(article);
|
emit articleAboutToBeRemoved(article);
|
||||||
|
|
||||||
item->disconnect(this);
|
item->disconnect(this);
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
const QString currentInterface = session->networkInterface();
|
const QString currentInterface = session->networkInterface();
|
||||||
bool interfaceExists = currentInterface.isEmpty();
|
bool interfaceExists = currentInterface.isEmpty();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) {
|
foreach (const QNetworkInterface &iface, QNetworkInterface::allInterfaces()) {
|
||||||
// This line fixes a Qt bug => https://bugreports.qt.io/browse/QTBUG-52633
|
// This line fixes a Qt bug => https://bugreports.qt.io/browse/QTBUG-52633
|
||||||
// Tested in Qt 5.6.0. For more info see:
|
// Tested in Qt 5.6.0. For more info see:
|
||||||
// https://github.com/qbittorrent/qBittorrent/issues/5131
|
// https://github.com/qbittorrent/qBittorrent/issues/5131
|
||||||
|
@ -350,7 +350,7 @@ void FileSystemPathComboEdit::addItem(const QString &text)
|
|||||||
editWidget<WidgetType>()->addItem(Utils::Fs::toNativePath(text));
|
editWidget<WidgetType>()->addItem(Utils::Fs::toNativePath(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemPathComboEdit::insertItem(int index, const QString& text)
|
void FileSystemPathComboEdit::insertItem(int index, const QString &text)
|
||||||
{
|
{
|
||||||
editWidget<WidgetType>()->insertItem(index, Utils::Fs::toNativePath(text));
|
editWidget<WidgetType>()->insertItem(index, Utils::Fs::toNativePath(text));
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* *
|
* *
|
||||||
|
@ -148,7 +148,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,13 +410,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);
|
||||||
@ -479,7 +479,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;
|
||||||
@ -527,7 +527,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();
|
||||||
@ -611,11 +611,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());
|
||||||
@ -734,7 +734,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();
|
||||||
@ -1226,7 +1226,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;
|
||||||
@ -1235,7 +1235,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();
|
||||||
}
|
}
|
||||||
@ -1245,7 +1245,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;
|
||||||
@ -1277,7 +1277,7 @@ bool OptionsDialog::useAdditionDialog() const
|
|||||||
|
|
||||||
void OptionsDialog::enableApplyButton()
|
void OptionsDialog::enableApplyButton()
|
||||||
{
|
{
|
||||||
applyButton->setEnabled(true);
|
m_applyButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::toggleComboRatioLimitAct()
|
void OptionsDialog::toggleComboRatioLimitAct()
|
||||||
@ -1472,7 +1472,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();
|
||||||
@ -1492,7 +1492,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
|
||||||
|
@ -141,7 +141,7 @@ bool ProgramUpdater::isVersionMoreRecent(const QString &remoteVersion) const
|
|||||||
qDebug() << Q_FUNC_INFO << "local version:" << localVersion << "/" << QBT_VERSION;
|
qDebug() << Q_FUNC_INFO << "local version:" << localVersion << "/" << QBT_VERSION;
|
||||||
QStringList remoteParts = remoteVersion.split('.');
|
QStringList remoteParts = remoteVersion.split('.');
|
||||||
QStringList localParts = localVersion.split('.');
|
QStringList localParts = localVersion.split('.');
|
||||||
for (int i = 0; i<qMin(remoteParts.size(), localParts.size()); ++i) {
|
for (int i = 0; i < qMin(remoteParts.size(), localParts.size()); ++i) {
|
||||||
if (remoteParts[i].toInt() > localParts[i].toInt())
|
if (remoteParts[i].toInt() > localParts[i].toInt())
|
||||||
return true;
|
return true;
|
||||||
if (remoteParts[i].toInt() < localParts[i].toInt())
|
if (remoteParts[i].toInt() < localParts[i].toInt())
|
||||||
|
@ -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;
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ void PeerListWidget::clear()
|
|||||||
int nbrows = m_listModel->rowCount();
|
int nbrows = m_listModel->rowCount();
|
||||||
if (nbrows > 0) {
|
if (nbrows > 0) {
|
||||||
qDebug("Cleared %d peers", nbrows);
|
qDebug("Cleared %d peers", nbrows);
|
||||||
m_listModel->removeRows(0, nbrows);
|
m_listModel->removeRows(0, nbrows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void PiecesBar::showToolTip(const QHelpEvent *e)
|
|||||||
DetailedTooltipRenderer renderer(stream, tooltipTitle);
|
DetailedTooltipRenderer renderer(stream, tooltipTitle);
|
||||||
|
|
||||||
const bool isFileNameCorrectionNeeded = this->isFileNameCorrectionNeeded();
|
const bool isFileNameCorrectionNeeded = this->isFileNameCorrectionNeeded();
|
||||||
for (int f: files) {
|
for (int f : files) {
|
||||||
QString filePath {m_torrent->info().filePath(f)};
|
QString filePath {m_torrent->info().filePath(f)};
|
||||||
if (isFileNameCorrectionNeeded)
|
if (isFileNameCorrectionNeeded)
|
||||||
filePath.replace(QLatin1String("/.unwanted"), QString());
|
filePath.replace(QLatin1String("/.unwanted"), QString());
|
||||||
|
@ -126,7 +126,7 @@ bool SearchSortModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceP
|
|||||||
const QAbstractItemModel *const sourceModel = this->sourceModel();
|
const QAbstractItemModel *const sourceModel = this->sourceModel();
|
||||||
if (m_isNameFilterEnabled && !m_searchTerm.isEmpty()) {
|
if (m_isNameFilterEnabled && !m_searchTerm.isEmpty()) {
|
||||||
QString name = sourceModel->data(sourceModel->index(sourceRow, NAME, sourceParent)).toString();
|
QString name = sourceModel->data(sourceModel->index(sourceRow, NAME, sourceParent)).toString();
|
||||||
for (const QString &word: m_searchTermWords) {
|
for (const QString &word : m_searchTermWords) {
|
||||||
int i = name.indexOf(word, 0, Qt::CaseInsensitive);
|
int i = name.indexOf(word, 0, Qt::CaseInsensitive);
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -146,7 +146,7 @@ namespace
|
|||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
// There is a similar bug on macOS, to be reported to Qt
|
// There is a similar bug on macOS, to be reported to Qt
|
||||||
// https://github.com/qbittorrent/qBittorrent/pull/6156#issuecomment-316302615
|
// https://github.com/qbittorrent/qBittorrent/pull/6156#issuecomment-316302615
|
||||||
class MacFileIconProvider final: public CachingFileIconProvider
|
class MacFileIconProvider final : public CachingFileIconProvider
|
||||||
{
|
{
|
||||||
QPixmap pixmapForExtension(const QString &ext) const override
|
QPixmap pixmapForExtension(const QString &ext) const override
|
||||||
{
|
{
|
||||||
@ -346,7 +346,7 @@ int TorrentContentModel::getFileIndex(const QModelIndex &index)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant TorrentContentModel::data(const QModelIndex& index, int role) const
|
QVariant TorrentContentModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@ -54,13 +54,13 @@ public:
|
|||||||
QVector<int> getFilePriorities() const;
|
QVector<int> getFilePriorities() const;
|
||||||
bool allFiltered() const;
|
bool allFiltered() const;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant& value, int role = Qt::EditRole) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const;
|
TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const;
|
||||||
int getFileIndex(const QModelIndex &index);
|
int getFileIndex(const QModelIndex &index);
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||||
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
|
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QModelIndex parent(const QModelIndex &index) const override;
|
QModelIndex parent(const QModelIndex &index) const override;
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -404,7 +404,7 @@ void TrackerFiltersList::trackerWarning(const QString &hash, const QString &trac
|
|||||||
applyFilter(3);
|
applyFilter(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerFiltersList::downloadFavicon(const QString& url)
|
void TrackerFiltersList::downloadFavicon(const QString &url)
|
||||||
{
|
{
|
||||||
if (!m_downloadTrackerFavicon) return;
|
if (!m_downloadTrackerFavicon) return;
|
||||||
Net::DownloadHandler *h = Net::DownloadManager::instance()->download(
|
Net::DownloadHandler *h = Net::DownloadManager::instance()->download(
|
||||||
@ -416,7 +416,7 @@ void TrackerFiltersList::downloadFavicon(const QString& url)
|
|||||||
, &TrackerFiltersList::handleFavicoFailure);
|
, &TrackerFiltersList::handleFavicoFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerFiltersList::handleFavicoDownload(const QString& url, const QString& filePath)
|
void TrackerFiltersList::handleFavicoDownload(const QString &url, const QString &filePath)
|
||||||
{
|
{
|
||||||
QString host = url.startsWith(GOOGLE_FAVICON_URL)
|
QString host = url.startsWith(GOOGLE_FAVICON_URL)
|
||||||
? url.mid(GOOGLE_FAVICON_URL.size())
|
? url.mid(GOOGLE_FAVICON_URL.size())
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
explicit TransferListModel(QObject *parent = nullptr);
|
explicit TransferListModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
int rowCount(const QModelIndex& index = QModelIndex()) const override;
|
int rowCount(const QModelIndex &index = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex &parent=QModelIndex()) const override;
|
int columnCount(const QModelIndex &parent=QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
@ -1144,7 +1144,7 @@ void TransferListWidget::displayListMenu(const QPoint&)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::currentChanged(const QModelIndex& current, const QModelIndex&)
|
void TransferListWidget::currentChanged(const QModelIndex ¤t, const QModelIndex&)
|
||||||
{
|
{
|
||||||
qDebug("CURRENT CHANGED");
|
qDebug("CURRENT CHANGED");
|
||||||
BitTorrent::TorrentHandle *torrent = nullptr;
|
BitTorrent::TorrentHandle *torrent = nullptr;
|
||||||
|
@ -106,7 +106,7 @@ protected:
|
|||||||
protected slots:
|
protected slots:
|
||||||
void torrentDoubleClicked();
|
void torrentDoubleClicked();
|
||||||
void displayListMenu(const QPoint&);
|
void displayListMenu(const QPoint&);
|
||||||
void currentChanged(const QModelIndex& current, const QModelIndex&) override;
|
void currentChanged(const QModelIndex ¤t, const QModelIndex&) override;
|
||||||
void toggleSelectedTorrentsSuperSeeding() const;
|
void toggleSelectedTorrentsSuperSeeding() const;
|
||||||
void toggleSelectedTorrentsSequentialDownload() const;
|
void toggleSelectedTorrentsSequentialDownload() const;
|
||||||
void toggleSelectedFirstLastPiecePrio() const;
|
void toggleSelectedFirstLastPiecePrio() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user