mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Add const to almost all remaining vars and arguments that qualify
This commit is contained in:
parent
bb041c0eca
commit
70f1537d9f
35 changed files with 261 additions and 261 deletions
|
@ -104,7 +104,7 @@ bool Preferences::deleteTorrentFilesAsDefault() const
|
|||
return value("Preferences/General/DeleteTorrentsFilesAsDefault", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setDeleteTorrentFilesAsDefault(bool del)
|
||||
void Preferences::setDeleteTorrentFilesAsDefault(const bool del)
|
||||
{
|
||||
setValue("Preferences/General/DeleteTorrentsFilesAsDefault", del);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ bool Preferences::confirmOnExit() const
|
|||
return value("Preferences/General/ExitConfirm", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setConfirmOnExit(bool confirm)
|
||||
void Preferences::setConfirmOnExit(const bool confirm)
|
||||
{
|
||||
setValue("Preferences/General/ExitConfirm", confirm);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ bool Preferences::speedInTitleBar() const
|
|||
return value("Preferences/General/SpeedInTitleBar", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::showSpeedInTitleBar(bool show)
|
||||
void Preferences::showSpeedInTitleBar(const bool show)
|
||||
{
|
||||
setValue("Preferences/General/SpeedInTitleBar", show);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ bool Preferences::useAlternatingRowColors() const
|
|||
return value("Preferences/General/AlternatingRowColors", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setAlternatingRowColors(bool b)
|
||||
void Preferences::setAlternatingRowColors(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/AlternatingRowColors", b);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ bool Preferences::getHideZeroValues() const
|
|||
return value("Preferences/General/HideZeroValues", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setHideZeroValues(bool b)
|
||||
void Preferences::setHideZeroValues(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/HideZeroValues", b);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ int Preferences::getHideZeroComboValues() const
|
|||
return value("Preferences/General/HideZeroComboValues", 0).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setHideZeroComboValues(int n)
|
||||
void Preferences::setHideZeroComboValues(const int n)
|
||||
{
|
||||
setValue("Preferences/General/HideZeroComboValues", n);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ bool Preferences::systrayIntegration() const
|
|||
return value("Preferences/General/SystrayEnabled", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setSystrayIntegration(bool enabled)
|
||||
void Preferences::setSystrayIntegration(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/General/SystrayEnabled", enabled);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ bool Preferences::minimizeToTray() const
|
|||
return value("Preferences/General/MinimizeToTray", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setMinimizeToTray(bool b)
|
||||
void Preferences::setMinimizeToTray(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/MinimizeToTray", b);
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ bool Preferences::minimizeToTrayNotified() const
|
|||
return value("Preferences/General/MinimizeToTrayNotified", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setMinimizeToTrayNotified(bool b)
|
||||
void Preferences::setMinimizeToTrayNotified(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/MinimizeToTrayNotified", b);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ bool Preferences::closeToTray() const
|
|||
return value("Preferences/General/CloseToTray", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setCloseToTray(bool b)
|
||||
void Preferences::setCloseToTray(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/CloseToTray", b);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ bool Preferences::closeToTrayNotified() const
|
|||
return value("Preferences/General/CloseToTrayNotified", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setCloseToTrayNotified(bool b)
|
||||
void Preferences::setCloseToTrayNotified(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/CloseToTrayNotified", b);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ bool Preferences::isToolbarDisplayed() const
|
|||
return value("Preferences/General/ToolbarDisplayed", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setToolbarDisplayed(bool displayed)
|
||||
void Preferences::setToolbarDisplayed(const bool displayed)
|
||||
{
|
||||
setValue("Preferences/General/ToolbarDisplayed", displayed);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ bool Preferences::isStatusbarDisplayed() const
|
|||
return value("Preferences/General/StatusbarDisplayed", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setStatusbarDisplayed(bool displayed)
|
||||
void Preferences::setStatusbarDisplayed(const bool displayed)
|
||||
{
|
||||
setValue("Preferences/General/StatusbarDisplayed", displayed);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ bool Preferences::startMinimized() const
|
|||
return value("Preferences/General/StartMinimized", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setStartMinimized(bool b)
|
||||
void Preferences::setStartMinimized(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/StartMinimized", b);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ bool Preferences::isSplashScreenDisabled() const
|
|||
return value("Preferences/General/NoSplashScreen", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setSplashScreenDisabled(bool b)
|
||||
void Preferences::setSplashScreenDisabled(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/NoSplashScreen", b);
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ bool Preferences::preventFromSuspendWhenDownloading() const
|
|||
return value("Preferences/General/PreventFromSuspendWhenDownloading", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setPreventFromSuspendWhenDownloading(bool b)
|
||||
void Preferences::setPreventFromSuspendWhenDownloading(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/PreventFromSuspendWhenDownloading", b);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ bool Preferences::preventFromSuspendWhenSeeding() const
|
|||
return value("Preferences/General/PreventFromSuspendWhenSeeding", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setPreventFromSuspendWhenSeeding(bool b)
|
||||
void Preferences::setPreventFromSuspendWhenSeeding(const bool b)
|
||||
{
|
||||
setValue("Preferences/General/PreventFromSuspendWhenSeeding", b);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ bool Preferences::WinStartup() const
|
|||
return settings.contains("qBittorrent");
|
||||
}
|
||||
|
||||
void Preferences::setWinStartup(bool b)
|
||||
void Preferences::setWinStartup(const bool b)
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||
if (b) {
|
||||
|
@ -331,7 +331,7 @@ bool Preferences::isMailNotificationEnabled() const
|
|||
return value("Preferences/MailNotification/enabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setMailNotificationEnabled(bool enabled)
|
||||
void Preferences::setMailNotificationEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/MailNotification/enabled", enabled);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ bool Preferences::getMailNotificationSMTPSSL() const
|
|||
return value("Preferences/MailNotification/req_ssl", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setMailNotificationSMTPSSL(bool use)
|
||||
void Preferences::setMailNotificationSMTPSSL(const bool use)
|
||||
{
|
||||
setValue("Preferences/MailNotification/req_ssl", use);
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ bool Preferences::getMailNotificationSMTPAuth() const
|
|||
return value("Preferences/MailNotification/req_auth", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setMailNotificationSMTPAuth(bool use)
|
||||
void Preferences::setMailNotificationSMTPAuth(const bool use)
|
||||
{
|
||||
setValue("Preferences/MailNotification/req_auth", use);
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ int Preferences::getActionOnDblClOnTorrentDl() const
|
|||
return value("Preferences/Downloads/DblClOnTorDl", 0).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setActionOnDblClOnTorrentDl(int act)
|
||||
void Preferences::setActionOnDblClOnTorrentDl(const int act)
|
||||
{
|
||||
setValue("Preferences/Downloads/DblClOnTorDl", act);
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ int Preferences::getActionOnDblClOnTorrentFn() const
|
|||
return value("Preferences/Downloads/DblClOnTorFn", 1).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setActionOnDblClOnTorrentFn(int act)
|
||||
void Preferences::setActionOnDblClOnTorrentFn(const int act)
|
||||
{
|
||||
setValue("Preferences/Downloads/DblClOnTorFn", act);
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ SchedulerDays Preferences::getSchedulerDays() const
|
|||
return static_cast<SchedulerDays>(value("Preferences/Scheduler/days", EVERY_DAY).toInt());
|
||||
}
|
||||
|
||||
void Preferences::setSchedulerDays(SchedulerDays days)
|
||||
void Preferences::setSchedulerDays(const SchedulerDays days)
|
||||
{
|
||||
setValue("Preferences/Scheduler/days", static_cast<int>(days));
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ bool Preferences::isSearchEnabled() const
|
|||
return value("Preferences/Search/SearchEnabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setSearchEnabled(bool enabled)
|
||||
void Preferences::setSearchEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/Search/SearchEnabled", enabled);
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ bool Preferences::isWebUiEnabled() const
|
|||
#endif
|
||||
}
|
||||
|
||||
void Preferences::setWebUiEnabled(bool enabled)
|
||||
void Preferences::setWebUiEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/Enabled", enabled);
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ bool Preferences::isWebUiLocalAuthEnabled() const
|
|||
return value("Preferences/WebUI/LocalHostAuth", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setWebUiLocalAuthEnabled(bool enabled)
|
||||
void Preferences::setWebUiLocalAuthEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/LocalHostAuth", enabled);
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ bool Preferences::isWebUiAuthSubnetWhitelistEnabled() const
|
|||
return value("Preferences/WebUI/AuthSubnetWhitelistEnabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setWebUiAuthSubnetWhitelistEnabled(bool enabled)
|
||||
void Preferences::setWebUiAuthSubnetWhitelistEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/AuthSubnetWhitelistEnabled", enabled);
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ quint16 Preferences::getWebUiPort() const
|
|||
return value("Preferences/WebUI/Port", 8080).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setWebUiPort(quint16 port)
|
||||
void Preferences::setWebUiPort(const quint16 port)
|
||||
{
|
||||
setValue("Preferences/WebUI/Port", port);
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ bool Preferences::useUPnPForWebUIPort() const
|
|||
#endif
|
||||
}
|
||||
|
||||
void Preferences::setUPnPForWebUIPort(bool enabled)
|
||||
void Preferences::setUPnPForWebUIPort(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/UseUPnP", enabled);
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ bool Preferences::isWebUiClickjackingProtectionEnabled() const
|
|||
return value("Preferences/WebUI/ClickjackingProtection", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setWebUiClickjackingProtectionEnabled(bool enabled)
|
||||
void Preferences::setWebUiClickjackingProtectionEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/ClickjackingProtection", enabled);
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ bool Preferences::isWebUiCSRFProtectionEnabled() const
|
|||
return value("Preferences/WebUI/CSRFProtection", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setWebUiCSRFProtectionEnabled(bool enabled)
|
||||
void Preferences::setWebUiCSRFProtectionEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/CSRFProtection", enabled);
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ bool Preferences::isWebUiHttpsEnabled() const
|
|||
return value("Preferences/WebUI/HTTPS/Enabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setWebUiHttpsEnabled(bool enabled)
|
||||
void Preferences::setWebUiHttpsEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/HTTPS/Enabled", enabled);
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ bool Preferences::isAltWebUiEnabled() const
|
|||
return value("Preferences/WebUI/AlternativeUIEnabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setAltWebUiEnabled(bool enabled)
|
||||
void Preferences::setAltWebUiEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/WebUI/AlternativeUIEnabled", enabled);
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ bool Preferences::isDynDNSEnabled() const
|
|||
return value("Preferences/DynDNS/Enabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setDynDNSEnabled(bool enabled)
|
||||
void Preferences::setDynDNSEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/DynDNS/Enabled", enabled);
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ DNS::Service Preferences::getDynDNSService() const
|
|||
return DNS::Service(value("Preferences/DynDNS/Service", DNS::DYNDNS).toInt());
|
||||
}
|
||||
|
||||
void Preferences::setDynDNSService(int service)
|
||||
void Preferences::setDynDNSService(const int service)
|
||||
{
|
||||
setValue("Preferences/DynDNS/Service", service);
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ bool Preferences::isUILocked() const
|
|||
return value("Locking/locked", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setUILocked(bool locked)
|
||||
void Preferences::setUILocked(const bool locked)
|
||||
{
|
||||
return setValue("Locking/locked", locked);
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ bool Preferences::isAutoRunEnabled() const
|
|||
return value("AutoRun/enabled", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setAutoRunEnabled(bool enabled)
|
||||
void Preferences::setAutoRunEnabled(const bool enabled)
|
||||
{
|
||||
return setValue("AutoRun/enabled", enabled);
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ bool Preferences::shutdownWhenDownloadsComplete() const
|
|||
return value("Preferences/Downloads/AutoShutDownOnCompletion", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setShutdownWhenDownloadsComplete(bool shutdown)
|
||||
void Preferences::setShutdownWhenDownloadsComplete(const bool shutdown)
|
||||
{
|
||||
setValue("Preferences/Downloads/AutoShutDownOnCompletion", shutdown);
|
||||
}
|
||||
|
@ -779,7 +779,7 @@ bool Preferences::suspendWhenDownloadsComplete() const
|
|||
return value("Preferences/Downloads/AutoSuspendOnCompletion", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setSuspendWhenDownloadsComplete(bool suspend)
|
||||
void Preferences::setSuspendWhenDownloadsComplete(const bool suspend)
|
||||
{
|
||||
setValue("Preferences/Downloads/AutoSuspendOnCompletion", suspend);
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ bool Preferences::hibernateWhenDownloadsComplete() const
|
|||
return value("Preferences/Downloads/AutoHibernateOnCompletion", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setHibernateWhenDownloadsComplete(bool hibernate)
|
||||
void Preferences::setHibernateWhenDownloadsComplete(const bool hibernate)
|
||||
{
|
||||
setValue("Preferences/Downloads/AutoHibernateOnCompletion", hibernate);
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ bool Preferences::shutdownqBTWhenDownloadsComplete() const
|
|||
return value("Preferences/Downloads/AutoShutDownqBTOnCompletion", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setShutdownqBTWhenDownloadsComplete(bool shutdown)
|
||||
void Preferences::setShutdownqBTWhenDownloadsComplete(const bool shutdown)
|
||||
{
|
||||
setValue("Preferences/Downloads/AutoShutDownqBTOnCompletion", shutdown);
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ bool Preferences::dontConfirmAutoExit() const
|
|||
return value("ShutdownConfirmDlg/DontConfirmAutoExit", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setDontConfirmAutoExit(bool dontConfirmAutoExit)
|
||||
void Preferences::setDontConfirmAutoExit(const bool dontConfirmAutoExit)
|
||||
{
|
||||
setValue("ShutdownConfirmDlg/DontConfirmAutoExit", dontConfirmAutoExit);
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ bool Preferences::recheckTorrentsOnCompletion() const
|
|||
return value("Preferences/Advanced/RecheckOnCompletion", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::recheckTorrentsOnCompletion(bool recheck)
|
||||
void Preferences::recheckTorrentsOnCompletion(const bool recheck)
|
||||
{
|
||||
setValue("Preferences/Advanced/RecheckOnCompletion", recheck);
|
||||
}
|
||||
|
@ -829,7 +829,7 @@ bool Preferences::resolvePeerCountries() const
|
|||
return value("Preferences/Connection/ResolvePeerCountries", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::resolvePeerCountries(bool resolve)
|
||||
void Preferences::resolvePeerCountries(const bool resolve)
|
||||
{
|
||||
setValue("Preferences/Connection/ResolvePeerCountries", resolve);
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ bool Preferences::resolvePeerHostNames() const
|
|||
return value("Preferences/Connection/ResolvePeerHostNames", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::resolvePeerHostNames(bool resolve)
|
||||
void Preferences::resolvePeerHostNames(const bool resolve)
|
||||
{
|
||||
setValue("Preferences/Connection/ResolvePeerHostNames", resolve);
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ bool Preferences::useSystemIconTheme() const
|
|||
return value("Preferences/Advanced/useSystemIconTheme", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::useSystemIconTheme(bool enabled)
|
||||
void Preferences::useSystemIconTheme(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/useSystemIconTheme", enabled);
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ bool Preferences::recursiveDownloadDisabled() const
|
|||
return value("Preferences/Advanced/DisableRecursiveDownload", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::disableRecursiveDownload(bool disable)
|
||||
void Preferences::disableRecursiveDownload(const bool disable)
|
||||
{
|
||||
setValue("Preferences/Advanced/DisableRecursiveDownload", disable);
|
||||
}
|
||||
|
@ -872,14 +872,14 @@ bool Preferences::neverCheckFileAssoc() const
|
|||
return value("Preferences/Win32/NeverCheckFileAssocation", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setNeverCheckFileAssoc(bool check)
|
||||
void Preferences::setNeverCheckFileAssoc(const bool check)
|
||||
{
|
||||
setValue("Preferences/Win32/NeverCheckFileAssocation", check);
|
||||
}
|
||||
|
||||
bool Preferences::isTorrentFileAssocSet()
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
||||
const QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
||||
if (settings.value(".torrent/Default").toString() != "qBittorrent") {
|
||||
qDebug(".torrent != qBittorrent");
|
||||
return false;
|
||||
|
@ -890,7 +890,7 @@ bool Preferences::isTorrentFileAssocSet()
|
|||
|
||||
bool Preferences::isMagnetLinkAssocSet()
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
||||
const QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
||||
|
||||
// Check magnet link assoc
|
||||
const QString shellCommand = Utils::Fs::toNativePath(settings.value("magnet/shell/open/command/Default", "").toString());
|
||||
|
@ -906,13 +906,13 @@ bool Preferences::isMagnetLinkAssocSet()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Preferences::setTorrentFileAssoc(bool set)
|
||||
void Preferences::setTorrentFileAssoc(const bool set)
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
||||
|
||||
// .Torrent association
|
||||
if (set) {
|
||||
QString oldProgId = settings.value(".torrent/Default").toString();
|
||||
const QString oldProgId = settings.value(".torrent/Default").toString();
|
||||
if (!oldProgId.isEmpty() && (oldProgId != "qBittorrent"))
|
||||
settings.setValue(".torrent/OpenWithProgids/" + oldProgId, "");
|
||||
settings.setValue(".torrent/Default", "qBittorrent");
|
||||
|
@ -924,7 +924,7 @@ void Preferences::setTorrentFileAssoc(bool set)
|
|||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
|
||||
}
|
||||
|
||||
void Preferences::setMagnetLinkAssoc(bool set)
|
||||
void Preferences::setMagnetLinkAssoc(const bool set)
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
||||
|
||||
|
@ -951,18 +951,18 @@ void Preferences::setMagnetLinkAssoc(bool set)
|
|||
#ifdef Q_OS_MAC
|
||||
namespace
|
||||
{
|
||||
CFStringRef torrentExtension = CFSTR("torrent");
|
||||
CFStringRef magnetUrlScheme = CFSTR("magnet");
|
||||
const CFStringRef torrentExtension = CFSTR("torrent");
|
||||
const CFStringRef magnetUrlScheme = CFSTR("magnet");
|
||||
}
|
||||
|
||||
bool Preferences::isTorrentFileAssocSet()
|
||||
{
|
||||
bool isSet = false;
|
||||
CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL);
|
||||
const CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL);
|
||||
if (torrentId != NULL) {
|
||||
CFStringRef defaultHandlerId = LSCopyDefaultRoleHandlerForContentType(torrentId, kLSRolesViewer);
|
||||
const CFStringRef defaultHandlerId = LSCopyDefaultRoleHandlerForContentType(torrentId, kLSRolesViewer);
|
||||
if (defaultHandlerId != NULL) {
|
||||
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo;
|
||||
CFRelease(defaultHandlerId);
|
||||
}
|
||||
|
@ -974,9 +974,9 @@ bool Preferences::isTorrentFileAssocSet()
|
|||
bool Preferences::isMagnetLinkAssocSet()
|
||||
{
|
||||
bool isSet = false;
|
||||
CFStringRef defaultHandlerId = LSCopyDefaultHandlerForURLScheme(magnetUrlScheme);
|
||||
const CFStringRef defaultHandlerId = LSCopyDefaultHandlerForURLScheme(magnetUrlScheme);
|
||||
if (defaultHandlerId != NULL) {
|
||||
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo;
|
||||
CFRelease(defaultHandlerId);
|
||||
}
|
||||
|
@ -987,9 +987,9 @@ void Preferences::setTorrentFileAssoc()
|
|||
{
|
||||
if (isTorrentFileAssocSet())
|
||||
return;
|
||||
CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL);
|
||||
const CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL);
|
||||
if (torrentId != NULL) {
|
||||
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
LSSetDefaultRoleHandlerForContentType(torrentId, kLSRolesViewer, myBundleId);
|
||||
CFRelease(torrentId);
|
||||
}
|
||||
|
@ -999,7 +999,7 @@ void Preferences::setMagnetLinkAssoc()
|
|||
{
|
||||
if (isMagnetLinkAssocSet())
|
||||
return;
|
||||
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
|
@ -1009,7 +1009,7 @@ int Preferences::getTrackerPort() const
|
|||
return value("Preferences/Advanced/trackerPort", 9000).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setTrackerPort(int port)
|
||||
void Preferences::setTrackerPort(const int port)
|
||||
{
|
||||
setValue("Preferences/Advanced/trackerPort", port);
|
||||
}
|
||||
|
@ -1020,7 +1020,7 @@ bool Preferences::isUpdateCheckEnabled() const
|
|||
return value("Preferences/Advanced/updateCheck", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setUpdateCheckEnabled(bool enabled)
|
||||
void Preferences::setUpdateCheckEnabled(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/updateCheck", enabled);
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@ bool Preferences::confirmTorrentDeletion() const
|
|||
return value("Preferences/Advanced/confirmTorrentDeletion", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setConfirmTorrentDeletion(bool enabled)
|
||||
void Preferences::setConfirmTorrentDeletion(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/confirmTorrentDeletion", enabled);
|
||||
}
|
||||
|
@ -1041,7 +1041,7 @@ bool Preferences::confirmTorrentRecheck() const
|
|||
return value("Preferences/Advanced/confirmTorrentRecheck", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setConfirmTorrentRecheck(bool enabled)
|
||||
void Preferences::setConfirmTorrentRecheck(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/confirmTorrentRecheck", enabled);
|
||||
}
|
||||
|
@ -1051,7 +1051,7 @@ bool Preferences::confirmRemoveAllTags() const
|
|||
return value("Preferences/Advanced/confirmRemoveAllTags", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setConfirmRemoveAllTags(bool enabled)
|
||||
void Preferences::setConfirmRemoveAllTags(const bool enabled)
|
||||
{
|
||||
setValue("Preferences/Advanced/confirmRemoveAllTags", enabled);
|
||||
}
|
||||
|
@ -1062,7 +1062,7 @@ TrayIcon::Style Preferences::trayIconStyle() const
|
|||
return TrayIcon::Style(value("Preferences/Advanced/TrayIconStyle", TrayIcon::NORMAL).toInt());
|
||||
}
|
||||
|
||||
void Preferences::setTrayIconStyle(TrayIcon::Style style)
|
||||
void Preferences::setTrayIconStyle(const TrayIcon::Style style)
|
||||
{
|
||||
setValue("Preferences/Advanced/TrayIconStyle", style);
|
||||
}
|
||||
|
@ -1426,7 +1426,7 @@ bool Preferences::isSpeedWidgetEnabled() const
|
|||
return value("SpeedWidget/Enabled", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setSpeedWidgetEnabled(bool enabled)
|
||||
void Preferences::setSpeedWidgetEnabled(const bool enabled)
|
||||
{
|
||||
setValue("SpeedWidget/Enabled", enabled);
|
||||
}
|
||||
|
@ -1441,13 +1441,13 @@ void Preferences::setSpeedWidgetPeriod(const int period)
|
|||
setValue("SpeedWidget/period", period);
|
||||
}
|
||||
|
||||
bool Preferences::getSpeedWidgetGraphEnable(int id) const
|
||||
bool Preferences::getSpeedWidgetGraphEnable(const int id) const
|
||||
{
|
||||
// UP and DOWN graphs enabled by default
|
||||
return value("SpeedWidget/graph_enable_" + QString::number(id), (id == 0 || id == 1)).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setSpeedWidgetGraphEnable(int id, const bool enable)
|
||||
void Preferences::setSpeedWidgetGraphEnable(const int id, const bool enable)
|
||||
{
|
||||
setValue("SpeedWidget/graph_enable_" + QString::number(id), enable);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue