2014-06-28 17:50:56 +04:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt4 and libtorrent.
|
|
|
|
* Copyright (C) 2006 Christophe Dumez
|
|
|
|
* Copyright (C) 2014 sledgehammer999
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
|
|
|
*
|
|
|
|
* Contact : chris@qbittorrent.org
|
|
|
|
* Contact : hammered999@gmail.com
|
|
|
|
*/
|
|
|
|
|
2017-09-27 20:55:20 +03:00
|
|
|
#include "preferences.h"
|
|
|
|
|
2014-06-28 17:50:56 +04:00
|
|
|
#include <QCryptographicHash>
|
|
|
|
#include <QDir>
|
2016-12-18 09:33:59 +03:00
|
|
|
#include <QLocale>
|
2017-12-07 04:32:50 +03:00
|
|
|
#include <QMutableListIterator>
|
2016-12-18 09:33:59 +03:00
|
|
|
#include <QPair>
|
2016-02-09 11:56:48 +03:00
|
|
|
#include <QSettings>
|
2014-06-28 17:50:56 +04:00
|
|
|
|
|
|
|
#ifndef DISABLE_GUI
|
|
|
|
#include <QApplication>
|
|
|
|
#else
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
2016-01-05 23:29:26 +03:00
|
|
|
#include <shlobj.h>
|
2014-09-14 22:07:20 +04:00
|
|
|
#include <winreg.h>
|
2014-06-28 17:50:56 +04:00
|
|
|
#endif
|
|
|
|
|
2015-12-27 07:02:31 +03:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
#include <CoreServices/CoreServices.h>
|
|
|
|
#endif
|
|
|
|
|
2017-09-27 20:55:20 +03:00
|
|
|
#include "logger.h"
|
|
|
|
#include "settingsstorage.h"
|
2016-02-09 11:55:02 +03:00
|
|
|
#include "utils/fs.h"
|
|
|
|
#include "utils/misc.h"
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2017-09-11 21:09:58 +03:00
|
|
|
Preferences *Preferences::m_instance = 0;
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2017-02-12 04:14:01 +03:00
|
|
|
Preferences::Preferences() = default;
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
Preferences *Preferences::instance()
|
|
|
|
{
|
|
|
|
return m_instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::initInstance()
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
|
|
|
if (!m_instance)
|
|
|
|
m_instance = new Preferences;
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
void Preferences::freeInstance()
|
2014-06-28 17:50:56 +04:00
|
|
|
{
|
2015-02-23 20:44:29 +03:00
|
|
|
if (m_instance) {
|
|
|
|
delete m_instance;
|
|
|
|
m_instance = 0;
|
|
|
|
}
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
const QVariant Preferences::value(const QString &key, const QVariant &defaultValue) const
|
|
|
|
{
|
2016-02-09 11:55:02 +03:00
|
|
|
return SettingsStorage::instance()->loadValue(key, defaultValue);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setValue(const QString &key, const QVariant &value)
|
|
|
|
{
|
2016-02-09 11:55:02 +03:00
|
|
|
SettingsStorage::instance()->storeValue(key, value);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// General options
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getLocale() const
|
|
|
|
{
|
2016-12-18 09:33:59 +03:00
|
|
|
return value("Preferences/General/Locale", QLocale::system().name()).toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setLocale(const QString &locale)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/Locale", locale);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::deleteTorrentFilesAsDefault() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/DeleteTorrentsFilesAsDefault", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDeleteTorrentFilesAsDefault(bool del)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/DeleteTorrentsFilesAsDefault", del);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::confirmOnExit() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/ExitConfirm", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setConfirmOnExit(bool confirm)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/ExitConfirm", confirm);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::speedInTitleBar() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/SpeedInTitleBar", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::showSpeedInTitleBar(bool show)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/SpeedInTitleBar", show);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::useAlternatingRowColors() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/AlternatingRowColors", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setAlternatingRowColors(bool b)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/AlternatingRowColors", b);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2016-01-24 11:01:33 +03:00
|
|
|
bool Preferences::getHideZeroValues() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/HideZeroValues", false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setHideZeroValues(bool b)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/HideZeroValues", b);
|
|
|
|
}
|
|
|
|
|
2016-02-01 15:19:28 +03:00
|
|
|
int Preferences::getHideZeroComboValues() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/HideZeroComboValues", 0).toInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setHideZeroComboValues(int n)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/HideZeroComboValues", n);
|
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
// In Mac OS X the dock is sufficient for our needs so we disable the sys tray functionality.
|
|
|
|
// See extensive discussion in https://github.com/qbittorrent/qBittorrent/pull/3018
|
|
|
|
#ifndef Q_OS_MAC
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::systrayIntegration() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/SystrayEnabled", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSystrayIntegration(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/SystrayEnabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
bool Preferences::minimizeToTray() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
return value("Preferences/General/MinimizeToTray", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
void Preferences::setMinimizeToTray(bool b)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
setValue("Preferences/General/MinimizeToTray", b);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
bool Preferences::closeToTray() const
|
2015-10-30 16:03:44 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
return value("Preferences/General/CloseToTray", true).toBool();
|
2015-10-30 16:03:44 +03:00
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
void Preferences::setCloseToTray(bool b)
|
2015-10-30 16:03:44 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
setValue("Preferences/General/CloseToTray", b);
|
2015-10-30 16:03:44 +03:00
|
|
|
}
|
2017-06-12 22:47:28 +03:00
|
|
|
#endif
|
2015-10-30 16:03:44 +03:00
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
bool Preferences::isToolbarDisplayed() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
return value("Preferences/General/ToolbarDisplayed", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
void Preferences::setToolbarDisplayed(bool displayed)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
setValue("Preferences/General/ToolbarDisplayed", displayed);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
bool Preferences::isStatusbarDisplayed() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
return value("Preferences/General/StatusbarDisplayed", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
void Preferences::setStatusbarDisplayed(bool displayed)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-06-12 22:47:28 +03:00
|
|
|
setValue("Preferences/General/StatusbarDisplayed", displayed);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::startMinimized() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/StartMinimized", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setStartMinimized(bool b)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/StartMinimized", b);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isSplashScreenDisabled() const
|
|
|
|
{
|
2016-02-07 05:48:51 +03:00
|
|
|
return value("Preferences/General/NoSplashScreen", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSplashScreenDisabled(bool b)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/NoSplashScreen", b);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Preventing from system suspend while active torrents are presented.
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::preventFromSuspend() const
|
|
|
|
{
|
|
|
|
return value("Preferences/General/PreventFromSuspend", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPreventFromSuspend(bool b)
|
|
|
|
{
|
|
|
|
setValue("Preferences/General/PreventFromSuspend", b);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::WinStartup() const
|
|
|
|
{
|
|
|
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
|
|
|
return settings.contains("qBittorrent");
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWinStartup(bool b)
|
|
|
|
{
|
|
|
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
|
|
|
if (b) {
|
2015-05-06 14:53:27 +03:00
|
|
|
const QString bin_path = "\"" + Utils::Fs::toNativePath(qApp->applicationFilePath()) + "\"";
|
2015-02-23 20:44:29 +03:00
|
|
|
settings.setValue("qBittorrent", bin_path);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
settings.remove("qBittorrent");
|
|
|
|
}
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Downloads
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::lastLocationPath() const
|
|
|
|
{
|
2015-05-06 14:53:27 +03:00
|
|
|
return Utils::Fs::fromNativePath(value("Preferences/Downloads/LastLocationPath").toString());
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setLastLocationPath(const QString &path)
|
|
|
|
{
|
2015-05-06 14:53:27 +03:00
|
|
|
setValue("Preferences/Downloads/LastLocationPath", Utils::Fs::fromNativePath(path));
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-12-12 23:26:17 +03:00
|
|
|
QVariantHash Preferences::getScanDirs() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2015-12-12 23:26:17 +03:00
|
|
|
return value("Preferences/Downloads/ScanDirsV2").toHash();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// This must be called somewhere with data from the model
|
2015-12-12 23:26:17 +03:00
|
|
|
void Preferences::setScanDirs(const QVariantHash &dirs)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2015-12-12 23:26:17 +03:00
|
|
|
setValue("Preferences/Downloads/ScanDirsV2", dirs);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getScanDirsLastPath() const
|
|
|
|
{
|
2015-05-06 14:53:27 +03:00
|
|
|
return Utils::Fs::fromNativePath(value("Preferences/Downloads/ScanDirsLastPath").toString());
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setScanDirsLastPath(const QString &path)
|
|
|
|
{
|
2015-05-06 14:53:27 +03:00
|
|
|
setValue("Preferences/Downloads/ScanDirsLastPath", Utils::Fs::fromNativePath(path));
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isMailNotificationEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/enabled", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMailNotificationEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/enabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-10-25 15:58:01 +03:00
|
|
|
QString Preferences::getMailNotificationSender() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/sender", "qBittorrent_notification@example.com").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setMailNotificationSender(const QString &mail)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/sender", mail);
|
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getMailNotificationEmail() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/email").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMailNotificationEmail(const QString &mail)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/email", mail);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getMailNotificationSMTP() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/smtp_server", "smtp.changeme.com").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMailNotificationSMTP(const QString &smtp_server)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/smtp_server", smtp_server);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::getMailNotificationSMTPSSL() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/req_ssl", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMailNotificationSMTPSSL(bool use)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/req_ssl", use);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::getMailNotificationSMTPAuth() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/req_auth", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMailNotificationSMTPAuth(bool use)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/req_auth", use);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getMailNotificationSMTPUsername() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/username").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMailNotificationSMTPUsername(const QString &username)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/username", username);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getMailNotificationSMTPPassword() const
|
|
|
|
{
|
|
|
|
return value("Preferences/MailNotification/password").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMailNotificationSMTPPassword(const QString &password)
|
|
|
|
{
|
|
|
|
setValue("Preferences/MailNotification/password", password);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
int Preferences::getActionOnDblClOnTorrentDl() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Downloads/DblClOnTorDl", 0).toInt();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setActionOnDblClOnTorrentDl(int act)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Downloads/DblClOnTorDl", act);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
int Preferences::getActionOnDblClOnTorrentFn() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Downloads/DblClOnTorFn", 1).toInt();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setActionOnDblClOnTorrentFn(int act)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Downloads/DblClOnTorFn", act);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QTime Preferences::getSchedulerStartTime() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Scheduler/start_time", QTime(8,0)).toTime();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSchedulerStartTime(const QTime &time)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Scheduler/start_time", time);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QTime Preferences::getSchedulerEndTime() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Scheduler/end_time", QTime(20,0)).toTime();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSchedulerEndTime(const QTime &time)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Scheduler/end_time", time);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
scheduler_days Preferences::getSchedulerDays() const
|
|
|
|
{
|
2017-05-29 15:10:31 +03:00
|
|
|
return static_cast<scheduler_days>(value("Preferences/Scheduler/days", EVERY_DAY).toInt());
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSchedulerDays(scheduler_days days)
|
|
|
|
{
|
2017-05-29 15:10:31 +03:00
|
|
|
setValue("Preferences/Scheduler/days", static_cast<int>(days));
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Search
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isSearchEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Search/SearchEnabled", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSearchEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Search/SearchEnabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isWebUiEnabled() const
|
|
|
|
{
|
2015-04-27 21:44:12 +03:00
|
|
|
#ifdef DISABLE_GUI
|
|
|
|
return true;
|
|
|
|
#else
|
2015-02-23 20:44:29 +03:00
|
|
|
return value("Preferences/WebUI/Enabled", false).toBool();
|
2015-04-27 21:44:12 +03:00
|
|
|
#endif
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/Enabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isWebUiLocalAuthEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/LocalHostAuth", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiLocalAuthEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/LocalHostAuth", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-09-27 20:55:20 +03:00
|
|
|
bool Preferences::isWebUiAuthSubnetWhitelistEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/AuthSubnetWhitelistEnabled", false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setWebUiAuthSubnetWhitelistEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/AuthSubnetWhitelistEnabled", enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<Utils::Net::Subnet> Preferences::getWebUiAuthSubnetWhitelist() const
|
|
|
|
{
|
|
|
|
QList<Utils::Net::Subnet> subnets;
|
|
|
|
foreach (const QString &rawSubnet, value("Preferences/WebUI/AuthSubnetWhitelist").toStringList()) {
|
|
|
|
bool ok = false;
|
|
|
|
const Utils::Net::Subnet subnet = Utils::Net::parseSubnet(rawSubnet.trimmed(), &ok);
|
|
|
|
if (ok)
|
|
|
|
subnets.append(subnet);
|
|
|
|
}
|
|
|
|
|
|
|
|
return subnets;
|
|
|
|
}
|
|
|
|
|
2017-12-07 04:32:50 +03:00
|
|
|
void Preferences::setWebUiAuthSubnetWhitelist(QStringList subnets)
|
2017-09-27 20:55:20 +03:00
|
|
|
{
|
2017-12-07 04:32:50 +03:00
|
|
|
QMutableListIterator<QString> i(subnets);
|
|
|
|
while (i.hasNext()) {
|
2017-12-06 10:02:54 +03:00
|
|
|
bool ok = false;
|
2017-12-07 04:32:50 +03:00
|
|
|
const Utils::Net::Subnet subnet = Utils::Net::parseSubnet(i.next().trimmed(), &ok);
|
|
|
|
if (!ok)
|
|
|
|
i.remove();
|
2017-12-06 10:02:54 +03:00
|
|
|
}
|
2017-09-27 20:55:20 +03:00
|
|
|
|
2017-12-07 04:32:50 +03:00
|
|
|
setValue("Preferences/WebUI/AuthSubnetWhitelist", subnets);
|
2017-09-27 20:55:20 +03:00
|
|
|
}
|
|
|
|
|
2017-07-02 13:23:10 +03:00
|
|
|
QString Preferences::getServerDomains() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/ServerDomains", "*").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setServerDomains(const QString &str)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/ServerDomains", str);
|
|
|
|
}
|
|
|
|
|
2017-10-12 05:28:31 +03:00
|
|
|
QString Preferences::getWebUiAddress() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/Address", "*").toString().trimmed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setWebUiAddress(const QString &addr)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/Address", addr.trimmed());
|
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
quint16 Preferences::getWebUiPort() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/Port", 8080).toInt();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiPort(quint16 port)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/Port", port);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::useUPnPForWebUIPort() const
|
|
|
|
{
|
2017-02-10 10:42:33 +03:00
|
|
|
#ifdef DISABLE_GUI
|
2015-02-23 20:44:29 +03:00
|
|
|
return value("Preferences/WebUI/UseUPnP", true).toBool();
|
2017-02-10 10:42:33 +03:00
|
|
|
#else
|
|
|
|
return value("Preferences/WebUI/UseUPnP", false).toBool();
|
|
|
|
#endif
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setUPnPForWebUIPort(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/UseUPnP", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getWebUiUsername() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/Username", "admin").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiUsername(const QString &username)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/Username", username);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getWebUiPassword() const
|
|
|
|
{
|
|
|
|
QString pass_ha1 = value("Preferences/WebUI/Password_ha1").toString();
|
|
|
|
if (pass_ha1.isEmpty()) {
|
|
|
|
QCryptographicHash md5(QCryptographicHash::Md5);
|
|
|
|
md5.addData("adminadmin");
|
|
|
|
pass_ha1 = md5.result().toHex();
|
|
|
|
}
|
|
|
|
return pass_ha1;
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiPassword(const QString &new_password)
|
|
|
|
{
|
|
|
|
// Do not overwrite current password with its hash
|
|
|
|
if (new_password == getWebUiPassword())
|
|
|
|
return;
|
2014-12-04 20:47:45 +03:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
// Encode to md5 and save
|
|
|
|
QCryptographicHash md5(QCryptographicHash::Md5);
|
|
|
|
md5.addData(new_password.toLocal8Bit());
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
setValue("Preferences/WebUI/Password_ha1", md5.result().toHex());
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isWebUiHttpsEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/HTTPS/Enabled", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiHttpsEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/HTTPS/Enabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getWebUiHttpsCertificate() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/HTTPS/Certificate").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiHttpsCertificate(const QByteArray &data)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/HTTPS/Certificate", data);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getWebUiHttpsKey() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/HTTPS/Key").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setWebUiHttpsKey(const QByteArray &data)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/HTTPS/Key", data);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-10-14 16:27:21 +03:00
|
|
|
bool Preferences::isAltWebUiEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/AlternativeUIEnabled", false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setAltWebUiEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/AlternativeUIEnabled", enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Preferences::getWebUiRootFolder() const
|
|
|
|
{
|
|
|
|
return value("Preferences/WebUI/RootFolder").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setWebUiRootFolder(const QString &path)
|
|
|
|
{
|
|
|
|
setValue("Preferences/WebUI/RootFolder", path);
|
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isDynDNSEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/DynDNS/Enabled", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDynDNSEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/DynDNS/Enabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
DNS::Service Preferences::getDynDNSService() const
|
|
|
|
{
|
|
|
|
return DNS::Service(value("Preferences/DynDNS/Service", DNS::DYNDNS).toInt());
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDynDNSService(int service)
|
|
|
|
{
|
|
|
|
setValue("Preferences/DynDNS/Service", service);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getDynDomainName() const
|
|
|
|
{
|
|
|
|
return value("Preferences/DynDNS/DomainName", "changeme.dyndns.org").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDynDomainName(const QString &name)
|
|
|
|
{
|
|
|
|
setValue("Preferences/DynDNS/DomainName", name);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getDynDNSUsername() const
|
|
|
|
{
|
|
|
|
return value("Preferences/DynDNS/Username").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDynDNSUsername(const QString &username)
|
|
|
|
{
|
|
|
|
setValue("Preferences/DynDNS/Username", username);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getDynDNSPassword() const
|
|
|
|
{
|
|
|
|
return value("Preferences/DynDNS/Password").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDynDNSPassword(const QString &password)
|
|
|
|
{
|
|
|
|
setValue("Preferences/DynDNS/Password", password);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Advanced settings
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::clearUILockPassword()
|
|
|
|
{
|
|
|
|
setValue("Locking/password", QString());
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getUILockPasswordMD5() const
|
|
|
|
{
|
|
|
|
return value("Locking/password").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setUILockPassword(const QString &clear_password)
|
|
|
|
{
|
|
|
|
QCryptographicHash md5(QCryptographicHash::Md5);
|
|
|
|
md5.addData(clear_password.toLocal8Bit());
|
|
|
|
QString md5_password = md5.result().toHex();
|
|
|
|
setValue("Locking/password", md5_password);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isUILocked() const
|
|
|
|
{
|
|
|
|
return value("Locking/locked", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setUILocked(bool locked)
|
|
|
|
{
|
|
|
|
return setValue("Locking/locked", locked);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isAutoRunEnabled() const
|
|
|
|
{
|
|
|
|
return value("AutoRun/enabled", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setAutoRunEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
return setValue("AutoRun/enabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getAutoRunProgram() const
|
|
|
|
{
|
2016-02-23 12:10:43 +03:00
|
|
|
return value("AutoRun/program").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setAutoRunProgram(const QString &program)
|
|
|
|
{
|
2016-02-23 12:10:43 +03:00
|
|
|
setValue("AutoRun/program", program);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::shutdownWhenDownloadsComplete() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Downloads/AutoShutDownOnCompletion", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setShutdownWhenDownloadsComplete(bool shutdown)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Downloads/AutoShutDownOnCompletion", shutdown);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::suspendWhenDownloadsComplete() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Downloads/AutoSuspendOnCompletion", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSuspendWhenDownloadsComplete(bool suspend)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Downloads/AutoSuspendOnCompletion", suspend);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::hibernateWhenDownloadsComplete() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Downloads/AutoHibernateOnCompletion", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setHibernateWhenDownloadsComplete(bool hibernate)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Downloads/AutoHibernateOnCompletion", hibernate);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::shutdownqBTWhenDownloadsComplete() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Downloads/AutoShutDownqBTOnCompletion", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setShutdownqBTWhenDownloadsComplete(bool shutdown)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Downloads/AutoShutDownqBTOnCompletion", shutdown);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-12-09 11:01:48 +03:00
|
|
|
bool Preferences::dontConfirmAutoExit() const
|
|
|
|
{
|
2016-03-21 00:54:07 +03:00
|
|
|
return value("ShutdownConfirmDlg/DontConfirmAutoExit", false).toBool();
|
2015-12-09 11:01:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setDontConfirmAutoExit(bool dontConfirmAutoExit)
|
|
|
|
{
|
2016-03-21 00:54:07 +03:00
|
|
|
setValue("ShutdownConfirmDlg/DontConfirmAutoExit", dontConfirmAutoExit);
|
2015-12-09 11:01:48 +03:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::recheckTorrentsOnCompletion() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/RecheckOnCompletion", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::recheckTorrentsOnCompletion(bool recheck)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/RecheckOnCompletion", recheck);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::resolvePeerCountries() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Connection/ResolvePeerCountries", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::resolvePeerCountries(bool resolve)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Connection/ResolvePeerCountries", resolve);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::resolvePeerHostNames() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Connection/ResolvePeerHostNames", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::resolvePeerHostNames(bool resolve)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Connection/ResolvePeerHostNames", resolve);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::useSystemIconTheme() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/useSystemIconTheme", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::useSystemIconTheme(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/useSystemIconTheme", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::recursiveDownloadDisabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/DisableRecursiveDownload", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::disableRecursiveDownload(bool disable)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/DisableRecursiveDownload", disable);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
2017-09-11 21:09:58 +03:00
|
|
|
namespace
|
|
|
|
{
|
2015-02-23 20:44:29 +03:00
|
|
|
enum REG_SEARCH_TYPE
|
|
|
|
{
|
|
|
|
USER,
|
|
|
|
SYSTEM_32BIT,
|
|
|
|
SYSTEM_64BIT
|
|
|
|
};
|
|
|
|
|
|
|
|
QStringList getRegSubkeys(HKEY handle)
|
|
|
|
{
|
|
|
|
QStringList keys;
|
|
|
|
|
|
|
|
DWORD cSubKeys = 0;
|
|
|
|
DWORD cMaxSubKeyLen = 0;
|
|
|
|
LONG res = ::RegQueryInfoKeyW(handle, NULL, NULL, NULL, &cSubKeys, &cMaxSubKeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
if (res == ERROR_SUCCESS) {
|
|
|
|
cMaxSubKeyLen++; // For null character
|
|
|
|
LPWSTR lpName = new WCHAR[cMaxSubKeyLen];
|
|
|
|
DWORD cName;
|
|
|
|
|
|
|
|
for (DWORD i = 0; i < cSubKeys; ++i) {
|
|
|
|
cName = cMaxSubKeyLen;
|
2015-06-11 23:45:18 +03:00
|
|
|
res = ::RegEnumKeyExW(handle, i, lpName, &cName, NULL, NULL, NULL, NULL);
|
2015-02-23 20:44:29 +03:00
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
keys.push_back(QString::fromWCharArray(lpName));
|
|
|
|
}
|
2015-01-08 21:58:35 +03:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
delete[] lpName;
|
2015-01-08 21:58:35 +03:00
|
|
|
}
|
2014-09-14 22:07:20 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
return keys;
|
2015-01-08 21:58:35 +03:00
|
|
|
}
|
2014-09-14 22:07:20 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString getRegValue(HKEY handle, const QString &name = QString())
|
|
|
|
{
|
|
|
|
QString result;
|
|
|
|
|
|
|
|
DWORD type = 0;
|
|
|
|
DWORD cbData = 0;
|
|
|
|
LPWSTR lpValueName = NULL;
|
|
|
|
if (!name.isEmpty()) {
|
|
|
|
lpValueName = new WCHAR[name.size() + 1];
|
|
|
|
name.toWCharArray(lpValueName);
|
|
|
|
lpValueName[name.size()] = 0;
|
|
|
|
}
|
2014-09-14 22:07:20 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
// Discover the size of the value
|
|
|
|
::RegQueryValueExW(handle, lpValueName, NULL, &type, NULL, &cbData);
|
|
|
|
DWORD cBuffer = (cbData / sizeof(WCHAR)) + 1;
|
|
|
|
LPWSTR lpData = new WCHAR[cBuffer];
|
|
|
|
LONG res = ::RegQueryValueExW(handle, lpValueName, NULL, &type, (LPBYTE)lpData, &cbData);
|
|
|
|
if (lpValueName)
|
|
|
|
delete[] lpValueName;
|
|
|
|
|
|
|
|
if (res == ERROR_SUCCESS) {
|
|
|
|
lpData[cBuffer - 1] = 0;
|
|
|
|
result = QString::fromWCharArray(lpData);
|
|
|
|
}
|
|
|
|
delete[] lpData;
|
2015-01-08 21:58:35 +03:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
return result;
|
2015-01-08 21:58:35 +03:00
|
|
|
}
|
2014-09-14 22:07:20 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString pythonSearchReg(const REG_SEARCH_TYPE type)
|
|
|
|
{
|
|
|
|
HKEY hkRoot;
|
|
|
|
if (type == USER)
|
|
|
|
hkRoot = HKEY_CURRENT_USER;
|
|
|
|
else
|
|
|
|
hkRoot = HKEY_LOCAL_MACHINE;
|
|
|
|
|
|
|
|
REGSAM samDesired = KEY_READ;
|
|
|
|
if (type == SYSTEM_32BIT)
|
|
|
|
samDesired |= KEY_WOW64_32KEY;
|
|
|
|
else if (type == SYSTEM_64BIT)
|
|
|
|
samDesired |= KEY_WOW64_64KEY;
|
|
|
|
|
|
|
|
QString path;
|
|
|
|
LONG res = 0;
|
|
|
|
HKEY hkPythonCore;
|
|
|
|
res = ::RegOpenKeyExW(hkRoot, L"SOFTWARE\\Python\\PythonCore", 0, samDesired, &hkPythonCore);
|
|
|
|
|
|
|
|
if (res == ERROR_SUCCESS) {
|
|
|
|
QStringList versions = getRegSubkeys(hkPythonCore);
|
|
|
|
qDebug("Python versions nb: %d", versions.size());
|
|
|
|
versions.sort();
|
|
|
|
|
|
|
|
bool found = false;
|
2017-09-11 21:09:58 +03:00
|
|
|
while (!found && !versions.empty()) {
|
2015-02-23 20:44:29 +03:00
|
|
|
const QString version = versions.takeLast() + "\\InstallPath";
|
|
|
|
LPWSTR lpSubkey = new WCHAR[version.size() + 1];
|
|
|
|
version.toWCharArray(lpSubkey);
|
|
|
|
lpSubkey[version.size()] = 0;
|
|
|
|
|
|
|
|
HKEY hkInstallPath;
|
|
|
|
res = ::RegOpenKeyExW(hkPythonCore, lpSubkey, 0, samDesired, &hkInstallPath);
|
|
|
|
delete[] lpSubkey;
|
|
|
|
|
|
|
|
if (res == ERROR_SUCCESS) {
|
2017-08-13 13:56:03 +03:00
|
|
|
qDebug("Detected possible Python v%s location", qUtf8Printable(version));
|
2015-02-23 20:44:29 +03:00
|
|
|
path = getRegValue(hkInstallPath);
|
|
|
|
::RegCloseKey(hkInstallPath);
|
|
|
|
|
|
|
|
if (!path.isEmpty() && QDir(path).exists("python.exe")) {
|
2017-08-13 13:56:03 +03:00
|
|
|
qDebug("Found python.exe at %s", qUtf8Printable(path));
|
2015-02-23 20:44:29 +03:00
|
|
|
found = true;
|
|
|
|
}
|
2015-01-08 21:58:35 +03:00
|
|
|
}
|
|
|
|
}
|
2014-09-14 22:49:52 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
if (!found)
|
|
|
|
path = QString();
|
2014-09-14 22:49:52 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
::RegCloseKey(hkPythonCore);
|
|
|
|
}
|
2015-01-08 21:58:35 +03:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
return path;
|
|
|
|
}
|
2014-09-14 22:49:52 +04:00
|
|
|
}
|
|
|
|
|
2015-01-08 21:58:35 +03:00
|
|
|
QString Preferences::getPythonPath()
|
|
|
|
{
|
|
|
|
QString path = pythonSearchReg(USER);
|
|
|
|
if (!path.isEmpty())
|
|
|
|
return path;
|
|
|
|
|
2014-09-14 22:49:52 +04:00
|
|
|
path = pythonSearchReg(SYSTEM_32BIT);
|
2015-01-08 21:58:35 +03:00
|
|
|
if (!path.isEmpty())
|
|
|
|
return path;
|
2014-09-14 22:49:52 +04:00
|
|
|
|
|
|
|
path = pythonSearchReg(SYSTEM_64BIT);
|
2015-01-08 21:58:35 +03:00
|
|
|
if (!path.isEmpty())
|
|
|
|
return path;
|
|
|
|
|
|
|
|
// Fallback: Detect python from default locations
|
2015-03-01 23:00:00 +03:00
|
|
|
const QStringList dirs = QDir("C:/").entryList(QStringList("Python*"), QDir::Dirs, QDir::Name | QDir::Reversed);
|
|
|
|
foreach (const QString &dir, dirs) {
|
2015-07-20 23:18:20 +03:00
|
|
|
const QString path("C:/" + dir + "/");
|
|
|
|
if (QFile::exists(path + "python.exe"))
|
2015-03-01 23:00:00 +03:00
|
|
|
return path;
|
|
|
|
}
|
2014-09-14 22:07:20 +04:00
|
|
|
|
2015-01-08 21:58:35 +03:00
|
|
|
return QString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::neverCheckFileAssoc() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Win32/NeverCheckFileAssocation", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setNeverCheckFileAssoc(bool check)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Win32/NeverCheckFileAssocation", check);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isTorrentFileAssocSet()
|
|
|
|
{
|
|
|
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
|
|
|
if (settings.value(".torrent/Default").toString() != "qBittorrent") {
|
|
|
|
qDebug(".torrent != qBittorrent");
|
|
|
|
return false;
|
|
|
|
}
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
return true;
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isMagnetLinkAssocSet()
|
|
|
|
{
|
|
|
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
// Check magnet link assoc
|
|
|
|
QRegExp exe_reg("\"([^\"]+)\".*");
|
2015-05-06 14:53:27 +03:00
|
|
|
QString shell_command = Utils::Fs::toNativePath(settings.value("magnet/shell/open/command/Default", "").toString());
|
2015-02-23 20:44:29 +03:00
|
|
|
if (exe_reg.indexIn(shell_command) < 0)
|
|
|
|
return false;
|
|
|
|
QString assoc_exe = exe_reg.cap(1);
|
2017-08-13 13:56:03 +03:00
|
|
|
qDebug("exe: %s", qUtf8Printable(assoc_exe));
|
2015-05-06 14:53:27 +03:00
|
|
|
if (assoc_exe.compare(Utils::Fs::toNativePath(qApp->applicationFilePath()), Qt::CaseInsensitive) != 0)
|
2015-02-23 20:44:29 +03:00
|
|
|
return false;
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
return true;
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setTorrentFileAssoc(bool set)
|
|
|
|
{
|
|
|
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
|
|
|
|
|
|
|
// .Torrent association
|
|
|
|
if (set) {
|
|
|
|
QString old_progid = settings.value(".torrent/Default").toString();
|
|
|
|
if (!old_progid.isEmpty() && (old_progid != "qBittorrent"))
|
|
|
|
settings.setValue(".torrent/OpenWithProgids/" + old_progid, "");
|
|
|
|
settings.setValue(".torrent/Default", "qBittorrent");
|
|
|
|
}
|
|
|
|
else if (isTorrentFileAssocSet()) {
|
|
|
|
settings.setValue(".torrent/Default", "");
|
|
|
|
}
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMagnetLinkAssoc(bool set)
|
|
|
|
{
|
|
|
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);
|
|
|
|
|
|
|
|
// Magnet association
|
|
|
|
if (set) {
|
|
|
|
const QString command_str = "\"" + qApp->applicationFilePath() + "\" \"%1\"";
|
|
|
|
const QString icon_str = "\"" + qApp->applicationFilePath() + "\",1";
|
|
|
|
|
|
|
|
settings.setValue("magnet/Default", "URL:Magnet link");
|
|
|
|
settings.setValue("magnet/Content Type", "application/x-magnet");
|
|
|
|
settings.setValue("magnet/URL Protocol", "");
|
2015-05-06 14:53:27 +03:00
|
|
|
settings.setValue("magnet/DefaultIcon/Default", Utils::Fs::toNativePath(icon_str));
|
2015-02-23 20:44:29 +03:00
|
|
|
settings.setValue("magnet/shell/Default", "open");
|
2015-05-06 14:53:27 +03:00
|
|
|
settings.setValue("magnet/shell/open/command/Default", Utils::Fs::toNativePath(command_str));
|
2015-02-23 20:44:29 +03:00
|
|
|
}
|
|
|
|
else if (isMagnetLinkAssocSet()) {
|
|
|
|
settings.remove("magnet");
|
|
|
|
}
|
2014-06-28 17:50:56 +04:00
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-12-27 07:02:31 +03:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
CFStringRef torrentExtension = CFSTR("torrent");
|
|
|
|
CFStringRef magnetUrlScheme = CFSTR("magnet");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Preferences::isTorrentFileAssocSet()
|
|
|
|
{
|
|
|
|
bool isSet = false;
|
|
|
|
CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL);
|
|
|
|
if (torrentId != NULL) {
|
|
|
|
CFStringRef defaultHandlerId = LSCopyDefaultRoleHandlerForContentType(torrentId, kLSRolesViewer);
|
|
|
|
if (defaultHandlerId != NULL) {
|
|
|
|
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
|
|
|
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo;
|
|
|
|
CFRelease(defaultHandlerId);
|
2016-01-24 11:01:33 +03:00
|
|
|
}
|
2015-12-27 07:02:31 +03:00
|
|
|
CFRelease(torrentId);
|
|
|
|
}
|
|
|
|
return isSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Preferences::isMagnetLinkAssocSet()
|
|
|
|
{
|
|
|
|
bool isSet = false;
|
|
|
|
CFStringRef defaultHandlerId = LSCopyDefaultHandlerForURLScheme(magnetUrlScheme);
|
|
|
|
if (defaultHandlerId != NULL) {
|
|
|
|
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
|
|
|
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo;
|
|
|
|
CFRelease(defaultHandlerId);
|
|
|
|
}
|
|
|
|
return isSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setTorrentFileAssoc()
|
|
|
|
{
|
|
|
|
if (isTorrentFileAssocSet())
|
|
|
|
return;
|
|
|
|
CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL);
|
|
|
|
if (torrentId != NULL) {
|
|
|
|
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
|
|
|
LSSetDefaultRoleHandlerForContentType(torrentId, kLSRolesViewer, myBundleId);
|
|
|
|
CFRelease(torrentId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setMagnetLinkAssoc()
|
|
|
|
{
|
|
|
|
if (isMagnetLinkAssocSet())
|
|
|
|
return;
|
|
|
|
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
|
|
|
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
int Preferences::getTrackerPort() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/trackerPort", 9000).toInt();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setTrackerPort(int port)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/trackerPort", port);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::isUpdateCheckEnabled() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/updateCheck", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setUpdateCheckEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/updateCheck", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::confirmTorrentDeletion() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/confirmTorrentDeletion", true).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setConfirmTorrentDeletion(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/confirmTorrentDeletion", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-07-08 23:29:31 +03:00
|
|
|
bool Preferences::confirmTorrentRecheck() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/confirmTorrentRecheck", true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setConfirmTorrentRecheck(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/confirmTorrentRecheck", enabled);
|
|
|
|
}
|
|
|
|
|
2017-06-05 03:22:17 +03:00
|
|
|
bool Preferences::confirmRemoveAllTags() const
|
|
|
|
{
|
|
|
|
return value("Preferences/Advanced/confirmRemoveAllTags", true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setConfirmRemoveAllTags(bool enabled)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/confirmRemoveAllTags", enabled);
|
|
|
|
}
|
|
|
|
|
2017-06-12 22:47:28 +03:00
|
|
|
#ifndef Q_OS_MAC
|
2015-02-23 20:44:29 +03:00
|
|
|
TrayIcon::Style Preferences::trayIconStyle() const
|
|
|
|
{
|
|
|
|
return TrayIcon::Style(value("Preferences/Advanced/TrayIconStyle", TrayIcon::NORMAL).toInt());
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setTrayIconStyle(TrayIcon::Style style)
|
|
|
|
{
|
|
|
|
setValue("Preferences/Advanced/TrayIconStyle", style);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
2017-06-12 22:47:28 +03:00
|
|
|
#endif
|
2014-06-28 17:50:56 +04:00
|
|
|
|
|
|
|
// Stuff that don't appear in the Options GUI but are saved
|
|
|
|
// in the same file.
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QDateTime Preferences::getDNSLastUpd() const
|
|
|
|
{
|
|
|
|
return value("DNSUpdater/lastUpdateTime").toDateTime();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDNSLastUpd(const QDateTime &date)
|
|
|
|
{
|
|
|
|
setValue("DNSUpdater/lastUpdateTime", date);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getDNSLastIP() const
|
|
|
|
{
|
|
|
|
return value("DNSUpdater/lastIP").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setDNSLastIP(const QString &ip)
|
|
|
|
{
|
|
|
|
setValue("DNSUpdater/lastIP", ip);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::getAcceptedLegal() const
|
|
|
|
{
|
|
|
|
return value("LegalNotice/Accepted", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setAcceptedLegal(const bool accepted)
|
|
|
|
{
|
|
|
|
setValue("LegalNotice/Accepted", accepted);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getMainGeometry() const
|
|
|
|
{
|
|
|
|
return value("MainWindow/geometry").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMainGeometry(const QByteArray &geometry)
|
|
|
|
{
|
|
|
|
setValue("MainWindow/geometry", geometry);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getMainVSplitterState() const
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
return value("MainWindow/qt5/vsplitterState").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMainVSplitterState(const QByteArray &state)
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
setValue("MainWindow/qt5/vsplitterState", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getMainLastDir() const
|
|
|
|
{
|
|
|
|
return value("MainWindowLastDir", QDir::homePath()).toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setMainLastDir(const QString &path)
|
|
|
|
{
|
|
|
|
setValue("MainWindowLastDir", path);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-12-03 10:32:58 +03:00
|
|
|
QSize Preferences::getPrefSize() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-12-03 10:32:58 +03:00
|
|
|
return value("Preferences/State/size").toSize();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPrefSize(const QSize &size)
|
|
|
|
{
|
|
|
|
setValue("Preferences/State/size", size);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QStringList Preferences::getPrefHSplitterSizes() const
|
|
|
|
{
|
|
|
|
return value("Preferences/State/hSplitterSizes").toStringList();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPrefHSplitterSizes(const QStringList &sizes)
|
|
|
|
{
|
|
|
|
setValue("Preferences/State/hSplitterSizes", sizes);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getPeerListState() const
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPeerListState(const QByteArray &state)
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
setValue("TorrentProperties/Peers/qt5/PeerListState", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getPropSplitterSizes() const
|
|
|
|
{
|
|
|
|
return value("TorrentProperties/SplitterSizes").toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPropSplitterSizes(const QString &sizes)
|
|
|
|
{
|
|
|
|
setValue("TorrentProperties/SplitterSizes", sizes);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getPropFileListState() const
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
return value("TorrentProperties/qt5/FilesListState").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPropFileListState(const QByteArray &state)
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
setValue("TorrentProperties/qt5/FilesListState", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
int Preferences::getPropCurTab() const
|
|
|
|
{
|
|
|
|
return value("TorrentProperties/CurrentTab", -1).toInt();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPropCurTab(const int &tab)
|
|
|
|
{
|
|
|
|
setValue("TorrentProperties/CurrentTab", tab);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
bool Preferences::getPropVisible() const
|
|
|
|
{
|
|
|
|
return value("TorrentProperties/Visible", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPropVisible(const bool visible)
|
|
|
|
{
|
|
|
|
setValue("TorrentProperties/Visible", visible);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getPropTrackerListState() const
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setPropTrackerListState(const QByteArray &state)
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-12-03 10:32:58 +03:00
|
|
|
QSize Preferences::getRssGeometrySize() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-12-03 10:32:58 +03:00
|
|
|
return value("RssFeedDownloader/geometrySize").toSize();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-10-27 11:45:11 +03:00
|
|
|
void Preferences::setRssGeometrySize(const QSize &geometry)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2015-10-27 11:45:11 +03:00
|
|
|
setValue("RssFeedDownloader/geometrySize", geometry);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getRssHSplitterSizes() const
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QStringList Preferences::getRssOpenFolders() const
|
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
return value("GUI/RSSWidget/OpenedFolders").toStringList();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setRssOpenFolders(const QStringList &folders)
|
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
setValue("GUI/RSSWidget/OpenedFolders", folders);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2016-11-17 06:11:48 +03:00
|
|
|
QByteArray Preferences::getRssSideSplitterState() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
return value("GUI/RSSWidget/qt5/splitter_h").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2016-11-17 06:11:48 +03:00
|
|
|
void Preferences::setRssSideSplitterState(const QByteArray &state)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
setValue("GUI/RSSWidget/qt5/splitter_h", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2016-11-17 06:11:48 +03:00
|
|
|
QByteArray Preferences::getRssMainSplitterState() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
return value("GUI/RSSWidget/qt5/splitterMain").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2016-11-17 06:11:48 +03:00
|
|
|
void Preferences::setRssMainSplitterState(const QByteArray &state)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
setValue("GUI/RSSWidget/qt5/splitterMain", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2016-06-22 16:34:53 +03:00
|
|
|
QByteArray Preferences::getSearchTabHeaderState() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-01-21 03:48:51 +03:00
|
|
|
return value("SearchTab/qt5/HeaderState").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2016-06-22 16:34:53 +03:00
|
|
|
void Preferences::setSearchTabHeaderState(const QByteArray &state)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-01-21 03:48:51 +03:00
|
|
|
setValue("SearchTab/qt5/HeaderState", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QStringList Preferences::getSearchEngDisabled() const
|
|
|
|
{
|
|
|
|
return value("SearchEngines/disabledEngines").toStringList();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setSearchEngDisabled(const QStringList &engines)
|
|
|
|
{
|
|
|
|
setValue("SearchEngines/disabledEngines", engines);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QString Preferences::getTorImportLastContentDir() const
|
|
|
|
{
|
|
|
|
return value("TorrentImport/LastContentDir", QDir::homePath()).toString();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setTorImportLastContentDir(const QString &path)
|
|
|
|
{
|
|
|
|
setValue("TorrentImport/LastContentDir", path);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getTorImportGeometry() const
|
|
|
|
{
|
|
|
|
return value("TorrentImportDlg/dimensions").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setTorImportGeometry(const QByteArray &geometry)
|
|
|
|
{
|
|
|
|
setValue("TorrentImportDlg/dimensions", geometry);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-03-28 02:59:20 +03:00
|
|
|
bool Preferences::getStatusFilterState() const
|
|
|
|
{
|
|
|
|
return value("TransferListFilters/statusFilterState", true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setStatusFilterState(const bool checked)
|
|
|
|
{
|
|
|
|
setValue("TransferListFilters/statusFilterState", checked);
|
|
|
|
}
|
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
bool Preferences::getCategoryFilterState() const
|
2015-03-28 02:59:20 +03:00
|
|
|
{
|
2016-02-09 11:56:48 +03:00
|
|
|
return value("TransferListFilters/CategoryFilterState", true).toBool();
|
2015-03-28 02:59:20 +03:00
|
|
|
}
|
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
void Preferences::setCategoryFilterState(const bool checked)
|
2015-03-28 02:59:20 +03:00
|
|
|
{
|
2016-02-09 11:56:48 +03:00
|
|
|
setValue("TransferListFilters/CategoryFilterState", checked);
|
2017-06-05 03:22:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Preferences::getTagFilterState() const
|
|
|
|
{
|
|
|
|
return value("TransferListFilters/TagFilterState", true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setTagFilterState(const bool checked)
|
|
|
|
{
|
|
|
|
setValue("TransferListFilters/TagFilterState", checked);
|
2015-03-28 02:59:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Preferences::getTrackerFilterState() const
|
|
|
|
{
|
|
|
|
return value("TransferListFilters/trackerFilterState", true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Preferences::setTrackerFilterState(const bool checked)
|
|
|
|
{
|
|
|
|
setValue("TransferListFilters/trackerFilterState", checked);
|
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
int Preferences::getTransSelFilter() const
|
|
|
|
{
|
|
|
|
return value("TransferListFilters/selectedFilterIndex", 0).toInt();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setTransSelFilter(const int &index)
|
|
|
|
{
|
|
|
|
setValue("TransferListFilters/selectedFilterIndex", index);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
QByteArray Preferences::getTransHeaderState() const
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
return value("TransferList/qt5/HeaderState").toByteArray();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setTransHeaderState(const QByteArray &state)
|
|
|
|
{
|
2015-04-05 20:49:26 +03:00
|
|
|
setValue("TransferList/qt5/HeaderState", state);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-09-11 21:09:58 +03:00
|
|
|
// From old RssSettings class
|
2017-03-07 16:10:42 +03:00
|
|
|
bool Preferences::isRSSWidgetEnabled() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
return value("GUI/RSSWidget/Enabled", false).toBool();
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2017-03-07 16:10:42 +03:00
|
|
|
void Preferences::setRSSWidgetVisible(const bool enabled)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2017-03-07 16:10:42 +03:00
|
|
|
setValue("GUI/RSSWidget/Enabled", enabled);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
int Preferences::getToolbarTextPosition() const
|
|
|
|
{
|
|
|
|
return value("Toolbar/textPosition", -1).toInt();
|
2014-10-18 18:18:58 +04:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
void Preferences::setToolbarTextPosition(const int position)
|
|
|
|
{
|
|
|
|
setValue("Toolbar/textPosition", position);
|
2014-10-18 18:18:58 +04:00
|
|
|
}
|
|
|
|
|
2015-12-18 14:30:31 +03:00
|
|
|
QList<QNetworkCookie> Preferences::getNetworkCookies() const
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
|
|
|
QList<QNetworkCookie> cookies;
|
2015-12-18 14:30:31 +03:00
|
|
|
QStringList rawCookies = value("Network/Cookies").toStringList();
|
|
|
|
foreach (const QString &rawCookie, rawCookies)
|
|
|
|
cookies << QNetworkCookie::parseCookies(rawCookie.toUtf8());
|
|
|
|
|
2015-02-23 20:44:29 +03:00
|
|
|
return cookies;
|
|
|
|
}
|
|
|
|
|
2015-12-18 14:30:31 +03:00
|
|
|
void Preferences::setNetworkCookies(const QList<QNetworkCookie> &cookies)
|
2015-02-23 20:44:29 +03:00
|
|
|
{
|
2015-12-18 14:30:31 +03:00
|
|
|
QStringList rawCookies;
|
|
|
|
foreach (const QNetworkCookie &cookie, cookies)
|
|
|
|
rawCookies << cookie.toRawForm();
|
|
|
|
|
|
|
|
setValue("Network/Cookies", rawCookies);
|
2014-06-28 17:50:56 +04:00
|
|
|
}
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2015-12-18 14:30:31 +03:00
|
|
|
int Preferences::getSpeedWidgetPeriod() const
|
|
|
|
{
|
2014-08-25 15:58:48 +04:00
|
|
|
return value("SpeedWidget/period", 1).toInt();
|
|
|
|
}
|
|
|
|
|
2015-12-18 14:30:31 +03:00
|
|
|
void Preferences::setSpeedWidgetPeriod(const int period)
|
|
|
|
{
|
2014-08-25 15:58:48 +04:00
|
|
|
setValue("SpeedWidget/period", period);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Preferences::getSpeedWidgetGraphEnable(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)
|
|
|
|
{
|
|
|
|
setValue("SpeedWidget/graph_enable_" + QString::number(id), enable);
|
|
|
|
}
|
|
|
|
|
2016-02-09 11:55:02 +03:00
|
|
|
void Preferences::upgrade()
|
|
|
|
{
|
2016-02-09 11:56:48 +03:00
|
|
|
QStringList labels = value("TransferListFilters/customLabels").toStringList();
|
|
|
|
if (!labels.isEmpty()) {
|
|
|
|
QVariantMap categories = value("BitTorrent/Session/Categories").toMap();
|
2017-09-11 21:32:11 +03:00
|
|
|
foreach (const QString &label, labels) {
|
2016-02-09 11:56:48 +03:00
|
|
|
if (!categories.contains(label))
|
|
|
|
categories[label] = "";
|
2017-09-11 21:32:11 +03:00
|
|
|
}
|
2016-02-09 11:56:48 +03:00
|
|
|
setValue("BitTorrent/Session/Categories", categories);
|
|
|
|
SettingsStorage::instance()->removeValue("TransferListFilters/customLabels");
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsStorage::instance()->removeValue("Preferences/Downloads/AppendLabel");
|
2016-02-09 11:55:02 +03:00
|
|
|
}
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
void Preferences::apply()
|
|
|
|
{
|
2016-02-09 11:55:02 +03:00
|
|
|
if (SettingsStorage::instance()->save())
|
2015-04-19 18:17:47 +03:00
|
|
|
emit changed();
|
|
|
|
}
|