mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Migrate everything to use the new Preferences class and not access directly the qbittorrent.ini file.
This commit is contained in:
@@ -67,57 +67,57 @@ public:
|
||||
|
||||
public slots:
|
||||
void saveAdvancedSettings() {
|
||||
Preferences pref;
|
||||
Preferences* const pref = Preferences::instance();
|
||||
// Disk write cache
|
||||
pref.setDiskCacheSize(spin_cache.value());
|
||||
pref.setDiskCacheTTL(spin_cache_ttl.value());
|
||||
pref->setDiskCacheSize(spin_cache.value());
|
||||
pref->setDiskCacheTTL(spin_cache_ttl.value());
|
||||
// Outgoing ports
|
||||
pref.setOutgoingPortsMin(outgoing_ports_min.value());
|
||||
pref.setOutgoingPortsMax(outgoing_ports_max.value());
|
||||
pref->setOutgoingPortsMin(outgoing_ports_min.value());
|
||||
pref->setOutgoingPortsMax(outgoing_ports_max.value());
|
||||
// Ignore limits on LAN
|
||||
pref.ignoreLimitsOnLAN(cb_ignore_limits_lan.isChecked());
|
||||
pref->ignoreLimitsOnLAN(cb_ignore_limits_lan.isChecked());
|
||||
// Recheck torrents on completion
|
||||
pref.recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
|
||||
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
|
||||
// Transfer list refresh interval
|
||||
pref.setRefreshInterval(spin_list_refresh.value());
|
||||
pref->setRefreshInterval(spin_list_refresh.value());
|
||||
// Peer resolution
|
||||
pref.resolvePeerCountries(cb_resolve_countries.isChecked());
|
||||
pref.resolvePeerHostNames(cb_resolve_hosts.isChecked());
|
||||
pref->resolvePeerCountries(cb_resolve_countries.isChecked());
|
||||
pref->resolvePeerHostNames(cb_resolve_hosts.isChecked());
|
||||
// Max Half-Open connections
|
||||
pref.setMaxHalfOpenConnections(spin_maxhalfopen.value());
|
||||
pref->setMaxHalfOpenConnections(spin_maxhalfopen.value());
|
||||
// Super seeding
|
||||
pref.enableSuperSeeding(cb_super_seeding.isChecked());
|
||||
pref->enableSuperSeeding(cb_super_seeding.isChecked());
|
||||
// Network interface
|
||||
if (combo_iface.currentIndex() == 0) {
|
||||
// All interfaces (default)
|
||||
pref.setNetworkInterface(QString::null);
|
||||
pref.setNetworkInterfaceName(QString::null);
|
||||
pref->setNetworkInterface(QString::null);
|
||||
pref->setNetworkInterfaceName(QString::null);
|
||||
} else {
|
||||
pref.setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
|
||||
pref.setNetworkInterfaceName(combo_iface.currentText());
|
||||
pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
|
||||
pref->setNetworkInterfaceName(combo_iface.currentText());
|
||||
}
|
||||
// Network address
|
||||
QHostAddress addr(txt_network_address.text().trimmed());
|
||||
if (addr.isNull())
|
||||
pref.setNetworkAddress("");
|
||||
pref->setNetworkAddress("");
|
||||
else
|
||||
pref.setNetworkAddress(addr.toString());
|
||||
pref->setNetworkAddress(addr.toString());
|
||||
// Program notification
|
||||
pref.useProgramNotification(cb_program_notifications.isChecked());
|
||||
pref->useProgramNotification(cb_program_notifications.isChecked());
|
||||
// Tracker
|
||||
pref.setTrackerEnabled(cb_tracker_status.isChecked());
|
||||
pref.setTrackerPort(spin_tracker_port.value());
|
||||
pref->setTrackerEnabled(cb_tracker_status.isChecked());
|
||||
pref->setTrackerPort(spin_tracker_port.value());
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
pref.setUpdateCheckEnabled(cb_update_check.isChecked());
|
||||
pref->setUpdateCheckEnabled(cb_update_check.isChecked());
|
||||
#endif
|
||||
// Icon theme
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||
pref.useSystemIconTheme(cb_use_icon_theme.isChecked());
|
||||
pref->useSystemIconTheme(cb_use_icon_theme.isChecked());
|
||||
#endif
|
||||
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked());
|
||||
pref->setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked());
|
||||
// Tracker exchange
|
||||
pref.setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked());
|
||||
pref.setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked());
|
||||
pref->setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked());
|
||||
pref->setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked());
|
||||
}
|
||||
|
||||
signals:
|
||||
@@ -167,58 +167,58 @@ private slots:
|
||||
|
||||
void loadAdvancedSettings()
|
||||
{
|
||||
const Preferences pref;
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
// Disk write cache
|
||||
spin_cache.setMinimum(0);
|
||||
spin_cache.setMaximum(2048);
|
||||
spin_cache.setValue(pref.diskCacheSize());
|
||||
spin_cache.setValue(pref->diskCacheSize());
|
||||
updateCacheSpinSuffix(spin_cache.value());
|
||||
setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache);
|
||||
// Disk cache expiry
|
||||
spin_cache_ttl.setMinimum(15);
|
||||
spin_cache_ttl.setMaximum(600);
|
||||
spin_cache_ttl.setValue(pref.diskCacheTTL());
|
||||
spin_cache_ttl.setValue(pref->diskCacheTTL());
|
||||
spin_cache_ttl.setSuffix(tr(" s", " seconds"));
|
||||
setRow(DISK_CACHE_TTL, tr("Disk cache expiry interval"), &spin_cache_ttl);
|
||||
// Outgoing port Min
|
||||
outgoing_ports_min.setMinimum(0);
|
||||
outgoing_ports_min.setMaximum(65535);
|
||||
outgoing_ports_min.setValue(pref.outgoingPortsMin());
|
||||
outgoing_ports_min.setValue(pref->outgoingPortsMin());
|
||||
setRow(OUTGOING_PORT_MIN, tr("Outgoing ports (Min) [0: Disabled]"), &outgoing_ports_min);
|
||||
// Outgoing port Min
|
||||
outgoing_ports_max.setMinimum(0);
|
||||
outgoing_ports_max.setMaximum(65535);
|
||||
outgoing_ports_max.setValue(pref.outgoingPortsMax());
|
||||
outgoing_ports_max.setValue(pref->outgoingPortsMax());
|
||||
setRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max);
|
||||
// Ignore transfer limits on local network
|
||||
cb_ignore_limits_lan.setChecked(pref.ignoreLimitsOnLAN());
|
||||
cb_ignore_limits_lan.setChecked(pref->ignoreLimitsOnLAN());
|
||||
setRow(IGNORE_LIMIT_LAN, tr("Ignore transfer limits on local network"), &cb_ignore_limits_lan);
|
||||
// Recheck completed torrents
|
||||
cb_recheck_completed.setChecked(pref.recheckTorrentsOnCompletion());
|
||||
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion());
|
||||
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed);
|
||||
// Transfer list refresh interval
|
||||
spin_list_refresh.setMinimum(30);
|
||||
spin_list_refresh.setMaximum(99999);
|
||||
spin_list_refresh.setValue(pref.getRefreshInterval());
|
||||
spin_list_refresh.setValue(pref->getRefreshInterval());
|
||||
spin_list_refresh.setSuffix(tr(" ms", " milliseconds"));
|
||||
setRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spin_list_refresh);
|
||||
// Resolve Peer countries
|
||||
cb_resolve_countries.setChecked(pref.resolvePeerCountries());
|
||||
cb_resolve_countries.setChecked(pref->resolvePeerCountries());
|
||||
setRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &cb_resolve_countries);
|
||||
// Resolve peer hosts
|
||||
cb_resolve_hosts.setChecked(pref.resolvePeerHostNames());
|
||||
cb_resolve_hosts.setChecked(pref->resolvePeerHostNames());
|
||||
setRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &cb_resolve_hosts);
|
||||
// Max Half Open connections
|
||||
spin_maxhalfopen.setMinimum(0);
|
||||
spin_maxhalfopen.setMaximum(99999);
|
||||
spin_maxhalfopen.setValue(pref.getMaxHalfOpenConnections());
|
||||
spin_maxhalfopen.setValue(pref->getMaxHalfOpenConnections());
|
||||
setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen);
|
||||
// Super seeding
|
||||
cb_super_seeding.setChecked(pref.isSuperSeedingEnabled());
|
||||
cb_super_seeding.setChecked(pref->isSuperSeedingEnabled());
|
||||
setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding);
|
||||
// Network interface
|
||||
combo_iface.addItem(tr("Any interface", "i.e. Any network interface"));
|
||||
const QString current_iface = pref.getNetworkInterface();
|
||||
const QString current_iface = pref->getNetworkInterface();
|
||||
bool interface_exists = current_iface.isEmpty();
|
||||
int i = 1;
|
||||
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) {
|
||||
@@ -232,40 +232,40 @@ private slots:
|
||||
}
|
||||
// Saved interface does not exist, show it anyway
|
||||
if (!interface_exists) {
|
||||
combo_iface.addItem(pref.getNetworkInterfaceName(),current_iface);
|
||||
combo_iface.addItem(pref->getNetworkInterfaceName(),current_iface);
|
||||
combo_iface.setCurrentIndex(i);
|
||||
}
|
||||
setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface);
|
||||
// Network address
|
||||
txt_network_address.setText(pref.getNetworkAddress());
|
||||
txt_network_address.setText(pref->getNetworkAddress());
|
||||
setRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address);
|
||||
// Program notifications
|
||||
cb_program_notifications.setChecked(pref.useProgramNotification());
|
||||
cb_program_notifications.setChecked(pref->useProgramNotification());
|
||||
setRow(PROGRAM_NOTIFICATIONS, tr("Display program on-screen notifications"), &cb_program_notifications);
|
||||
// Tracker State
|
||||
cb_tracker_status.setChecked(pref.isTrackerEnabled());
|
||||
cb_tracker_status.setChecked(pref->isTrackerEnabled());
|
||||
setRow(TRACKER_STATUS, tr("Enable embedded tracker"), &cb_tracker_status);
|
||||
// Tracker port
|
||||
spin_tracker_port.setMinimum(1);
|
||||
spin_tracker_port.setMaximum(65535);
|
||||
spin_tracker_port.setValue(pref.getTrackerPort());
|
||||
spin_tracker_port.setValue(pref->getTrackerPort());
|
||||
setRow(TRACKER_PORT, tr("Embedded tracker port"), &spin_tracker_port);
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
cb_update_check.setChecked(pref.isUpdateCheckEnabled());
|
||||
cb_update_check.setChecked(pref->isUpdateCheckEnabled());
|
||||
setRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check);
|
||||
#endif
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||
cb_use_icon_theme.setChecked(pref.useSystemIconTheme());
|
||||
cb_use_icon_theme.setChecked(pref->useSystemIconTheme());
|
||||
setRow(USE_ICON_THEME, tr("Use system icon theme"), &cb_use_icon_theme);
|
||||
#endif
|
||||
// Torrent deletion confirmation
|
||||
cb_confirm_torrent_deletion.setChecked(pref.confirmTorrentDeletion());
|
||||
cb_confirm_torrent_deletion.setChecked(pref->confirmTorrentDeletion());
|
||||
setRow(CONFIRM_DELETE_TORRENT, tr("Confirm torrent deletion"), &cb_confirm_torrent_deletion);
|
||||
// Tracker exchange
|
||||
cb_enable_tracker_ext.setChecked(pref.trackerExchangeEnabled());
|
||||
cb_enable_tracker_ext.setChecked(pref->trackerExchangeEnabled());
|
||||
setRow(TRACKER_EXCHANGE, tr("Exchange trackers with other peers"), &cb_enable_tracker_ext);
|
||||
// Announce to all trackers
|
||||
cb_announce_all_trackers.setChecked(pref.announceToAllTrackers());
|
||||
cb_announce_all_trackers.setChecked(pref->announceToAllTrackers());
|
||||
setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QTranslator>
|
||||
#include <QDesktopServices>
|
||||
#include <QDebug>
|
||||
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
@@ -45,7 +46,6 @@
|
||||
#include "fs_utils.h"
|
||||
#include "advancedsettings.h"
|
||||
#include "scannedfoldersmodel.h"
|
||||
#include "qinisettings.h"
|
||||
#include "qbtsession.h"
|
||||
#include "iconprovider.h"
|
||||
#include "dnsupdater.h"
|
||||
@@ -289,14 +289,14 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
|
||||
}
|
||||
|
||||
void options_imp::loadWindowState() {
|
||||
QIniSettings settings;
|
||||
resize(settings.value(QString::fromUtf8("Preferences/State/size"), sizeFittingScreen()).toSize());
|
||||
QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint();
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
resize(pref->getPrefSize(sizeFittingScreen()));
|
||||
QPoint p = pref->getPrefPos();
|
||||
QRect scr_rect = qApp->desktop()->screenGeometry();
|
||||
if (!p.isNull() && scr_rect.contains(p))
|
||||
move(p);
|
||||
// Load slider size
|
||||
const QStringList sizes_str = settings.value("Preferences/State/hSplitterSizes", QStringList()).toStringList();
|
||||
const QStringList sizes_str = pref->getPrefHSplitterSizes();
|
||||
// Splitter size
|
||||
QList<int> sizes;
|
||||
if (sizes_str.size() == 2) {
|
||||
@@ -310,14 +310,14 @@ void options_imp::loadWindowState() {
|
||||
}
|
||||
|
||||
void options_imp::saveWindowState() const {
|
||||
QIniSettings settings;
|
||||
settings.setValue(QString::fromUtf8("Preferences/State/size"), size());
|
||||
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
|
||||
Preferences* const pref = Preferences::instance();
|
||||
pref->setPrefSize(size());
|
||||
pref->setPrefPos(pos());
|
||||
// Splitter size
|
||||
QStringList sizes_str;
|
||||
sizes_str << QString::number(hsplitter->sizes().first());
|
||||
sizes_str << QString::number(hsplitter->sizes().last());
|
||||
settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str);
|
||||
pref->setPrefHSplitterSizes(sizes_str);
|
||||
}
|
||||
|
||||
QSize options_imp::sizeFittingScreen() const {
|
||||
@@ -341,10 +341,10 @@ QSize options_imp::sizeFittingScreen() const {
|
||||
|
||||
void options_imp::saveOptions() {
|
||||
applyButton->setEnabled(false);
|
||||
Preferences pref;
|
||||
Preferences* const pref = Preferences::instance();
|
||||
// Load the translation
|
||||
QString locale = getLocale();
|
||||
if (pref.getLocale() != locale) {
|
||||
if (pref->getLocale() != locale) {
|
||||
QTranslator *translator = new QTranslator;
|
||||
if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) {
|
||||
qDebug("%s locale recognized, using translation.", qPrintable(locale));
|
||||
@@ -355,18 +355,18 @@ void options_imp::saveOptions() {
|
||||
}
|
||||
|
||||
// General preferences
|
||||
pref.setLocale(locale);
|
||||
pref.setAlternatingRowColors(checkAltRowColors->isChecked());
|
||||
pref.setSystrayIntegration(systrayIntegration());
|
||||
pref.setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex()));
|
||||
pref.setCloseToTray(closeToTray());
|
||||
pref.setMinimizeToTray(minimizeToTray());
|
||||
pref.setStartMinimized(startMinimized());
|
||||
pref.setSplashScreenDisabled(isSlashScreenDisabled());
|
||||
pref.setConfirmOnExit(checkProgramExitConfirm->isChecked());
|
||||
pref.setPreventFromSuspend(preventFromSuspend());
|
||||
pref->setLocale(locale);
|
||||
pref->setAlternatingRowColors(checkAltRowColors->isChecked());
|
||||
pref->setSystrayIntegration(systrayIntegration());
|
||||
pref->setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex()));
|
||||
pref->setCloseToTray(closeToTray());
|
||||
pref->setMinimizeToTray(minimizeToTray());
|
||||
pref->setStartMinimized(startMinimized());
|
||||
pref->setSplashScreenDisabled(isSlashScreenDisabled());
|
||||
pref->setConfirmOnExit(checkProgramExitConfirm->isChecked());
|
||||
pref->setPreventFromSuspend(preventFromSuspend());
|
||||
#ifdef Q_OS_WIN
|
||||
pref.setStartup(Startup());
|
||||
pref->setWinStartup(WinStartup());
|
||||
// Windows: file association settings
|
||||
Preferences::setTorrentFileAssoc(checkAssociateTorrents->isChecked());
|
||||
Preferences::setMagnetLinkAssoc(checkAssociateMagnetLinks->isChecked());
|
||||
@@ -374,108 +374,111 @@ void options_imp::saveOptions() {
|
||||
// End General preferences
|
||||
|
||||
// Downloads preferences
|
||||
pref.setSavePath(getSavePath());
|
||||
pref.setTempPathEnabled(isTempPathEnabled());
|
||||
pref.setTempPath(getTempPath());
|
||||
pref.setAppendTorrentLabel(checkAppendLabel->isChecked());
|
||||
pref.useIncompleteFilesExtension(checkAppendqB->isChecked());
|
||||
pref.preAllocateAllFiles(preAllocateAllFiles());
|
||||
pref.useAdditionDialog(useAdditionDialog());
|
||||
pref.AdditionDialogFront(checkAdditionDialogFront->isChecked());
|
||||
pref.addTorrentsInPause(addTorrentsInPause());
|
||||
pref->setSavePath(getSavePath());
|
||||
pref->setTempPathEnabled(isTempPathEnabled());
|
||||
pref->setTempPath(getTempPath());
|
||||
pref->setAppendTorrentLabel(checkAppendLabel->isChecked());
|
||||
pref->useIncompleteFilesExtension(checkAppendqB->isChecked());
|
||||
pref->preAllocateAllFiles(preAllocateAllFiles());
|
||||
pref->useAdditionDialog(useAdditionDialog());
|
||||
pref->additionDialogFront(checkAdditionDialogFront->isChecked());
|
||||
pref->addTorrentsInPause(addTorrentsInPause());
|
||||
ScanFoldersModel::instance()->makePersistent();
|
||||
addedScanDirs.clear();
|
||||
pref.setTorrentExportDir(getTorrentExportDir());
|
||||
pref.setFinishedTorrentExportDir(getFinishedTorrentExportDir());
|
||||
pref.setMailNotificationEnabled(groupMailNotification->isChecked());
|
||||
pref.setMailNotificationEmail(dest_email_txt->text());
|
||||
pref.setMailNotificationSMTP(smtp_server_txt->text());
|
||||
pref.setMailNotificationSMTPSSL(checkSmtpSSL->isChecked());
|
||||
pref.setMailNotificationSMTPAuth(groupMailNotifAuth->isChecked());
|
||||
pref.setMailNotificationSMTPUsername(mailNotifUsername->text());
|
||||
pref.setMailNotificationSMTPPassword(mailNotifPassword->text());
|
||||
pref.setAutoRunEnabled(autoRunBox->isChecked());
|
||||
pref.setAutoRunProgram(autoRun_txt->text());
|
||||
pref.setActionOnDblClOnTorrentDl(getActionOnDblClOnTorrentDl());
|
||||
pref.setActionOnDblClOnTorrentFn(getActionOnDblClOnTorrentFn());
|
||||
pref->setTorrentExportDir(getTorrentExportDir());
|
||||
pref->setFinishedTorrentExportDir(getFinishedTorrentExportDir());
|
||||
pref->setMailNotificationEnabled(groupMailNotification->isChecked());
|
||||
pref->setMailNotificationEmail(dest_email_txt->text());
|
||||
pref->setMailNotificationSMTP(smtp_server_txt->text());
|
||||
pref->setMailNotificationSMTPSSL(checkSmtpSSL->isChecked());
|
||||
pref->setMailNotificationSMTPAuth(groupMailNotifAuth->isChecked());
|
||||
pref->setMailNotificationSMTPUsername(mailNotifUsername->text());
|
||||
pref->setMailNotificationSMTPPassword(mailNotifPassword->text());
|
||||
pref->setAutoRunEnabled(autoRunBox->isChecked());
|
||||
pref->setAutoRunProgram(autoRun_txt->text());
|
||||
pref->setActionOnDblClOnTorrentDl(getActionOnDblClOnTorrentDl());
|
||||
pref->setActionOnDblClOnTorrentFn(getActionOnDblClOnTorrentFn());
|
||||
// End Downloads preferences
|
||||
// Connection preferences
|
||||
pref.setSessionPort(getPort());
|
||||
pref.setRandomPort(checkRandomPort->isChecked());
|
||||
pref.setUPnPEnabled(isUPnPEnabled());
|
||||
pref->setSessionPort(getPort());
|
||||
pref->setRandomPort(checkRandomPort->isChecked());
|
||||
pref->setUPnPEnabled(isUPnPEnabled());
|
||||
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits();
|
||||
pref.setGlobalDownloadLimit(down_up_limit.first);
|
||||
pref.setGlobalUploadLimit(down_up_limit.second);
|
||||
pref.setuTPEnabled(checkuTP->isChecked());
|
||||
pref.setuTPRateLimited(checkLimituTPConnections->isChecked());
|
||||
pref.includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
|
||||
pref.setAltGlobalDownloadLimit(spinDownloadLimitAlt->value());
|
||||
pref.setAltGlobalUploadLimit(spinUploadLimitAlt->value());
|
||||
pref.setSchedulerEnabled(check_schedule->isChecked());
|
||||
pref.setSchedulerStartTime(schedule_from->time());
|
||||
pref.setSchedulerEndTime(schedule_to->time());
|
||||
pref.setSchedulerDays((scheduler_days)schedule_days->currentIndex());
|
||||
pref.setProxyType(getProxyType());
|
||||
pref.setProxyIp(getProxyIp());
|
||||
pref.setProxyPort(getProxyPort());
|
||||
pref.setProxyPeerConnections(checkProxyPeerConnecs->isChecked());
|
||||
pref.setProxyAuthEnabled(isProxyAuthEnabled());
|
||||
pref.setProxyUsername(getProxyUsername());
|
||||
pref.setProxyPassword(getProxyPassword());
|
||||
pref->setGlobalDownloadLimit(down_up_limit.first);
|
||||
pref->setGlobalUploadLimit(down_up_limit.second);
|
||||
pref->setuTPEnabled(checkuTP->isChecked());
|
||||
pref->setuTPRateLimited(checkLimituTPConnections->isChecked());
|
||||
pref->includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
|
||||
pref->setAltGlobalDownloadLimit(spinDownloadLimitAlt->value());
|
||||
pref->setAltGlobalUploadLimit(spinUploadLimitAlt->value());
|
||||
pref->setSchedulerEnabled(check_schedule->isChecked());
|
||||
pref->setSchedulerStartTime(schedule_from->time());
|
||||
pref->setSchedulerEndTime(schedule_to->time());
|
||||
pref->setSchedulerDays((scheduler_days)schedule_days->currentIndex());
|
||||
pref->setProxyType(getProxyType());
|
||||
pref->setProxyIp(getProxyIp());
|
||||
pref->setProxyPort(getProxyPort());
|
||||
pref->setProxyPeerConnections(checkProxyPeerConnecs->isChecked());
|
||||
pref->setProxyAuthEnabled(isProxyAuthEnabled());
|
||||
pref->setProxyUsername(getProxyUsername());
|
||||
pref->setProxyPassword(getProxyPassword());
|
||||
// End Connection preferences
|
||||
// Bittorrent preferences
|
||||
pref.setMaxConnecs(getMaxConnecs());
|
||||
pref.setMaxConnecsPerTorrent(getMaxConnecsPerTorrent());
|
||||
pref.setMaxUploads(getMaxUploads());
|
||||
pref.setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
|
||||
pref.setDHTEnabled(isDHTEnabled());
|
||||
pref.setPeXEnabled(checkPeX->isChecked());
|
||||
pref.setLSDEnabled(isLSDEnabled());
|
||||
pref.setEncryptionSetting(getEncryptionSetting());
|
||||
pref.enableAnonymousMode(checkAnonymousMode->isChecked());
|
||||
pref.setGlobalMaxRatio(getMaxRatio());
|
||||
pref.setMaxRatioAction(comboRatioLimitAct->currentIndex());
|
||||
pref->setMaxConnecs(getMaxConnecs());
|
||||
pref->setMaxConnecsPerTorrent(getMaxConnecsPerTorrent());
|
||||
pref->setMaxUploads(getMaxUploads());
|
||||
pref->setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
|
||||
pref->setDHTEnabled(isDHTEnabled());
|
||||
pref->setPeXEnabled(checkPeX->isChecked());
|
||||
pref->setLSDEnabled(isLSDEnabled());
|
||||
pref->setEncryptionSetting(getEncryptionSetting());
|
||||
pref->enableAnonymousMode(checkAnonymousMode->isChecked());
|
||||
pref->setGlobalMaxRatio(getMaxRatio());
|
||||
pref->setMaxRatioAction(comboRatioLimitAct->currentIndex());
|
||||
// End Bittorrent preferences
|
||||
// Misc preferences
|
||||
// * IPFilter
|
||||
pref.setFilteringEnabled(isFilteringEnabled());
|
||||
pref->setFilteringEnabled(isFilteringEnabled());
|
||||
if (isFilteringEnabled())
|
||||
pref.setFilter(textFilterPath->text());
|
||||
pref->setFilter(textFilterPath->text());
|
||||
// End IPFilter preferences
|
||||
// Queueing system
|
||||
pref.setQueueingSystemEnabled(isQueueingSystemEnabled());
|
||||
pref.setMaxActiveDownloads(spinMaxActiveDownloads->value());
|
||||
pref.setMaxActiveUploads(spinMaxActiveUploads->value());
|
||||
pref.setMaxActiveTorrents(spinMaxActiveTorrents->value());
|
||||
pref.setIgnoreSlowTorrentsForQueueing(checkIgnoreSlowTorrentsForQueueing->isChecked());
|
||||
pref->setQueueingSystemEnabled(isQueueingSystemEnabled());
|
||||
pref->setMaxActiveDownloads(spinMaxActiveDownloads->value());
|
||||
pref->setMaxActiveUploads(spinMaxActiveUploads->value());
|
||||
pref->setMaxActiveTorrents(spinMaxActiveTorrents->value());
|
||||
pref->setIgnoreSlowTorrentsForQueueing(checkIgnoreSlowTorrentsForQueueing->isChecked());
|
||||
// End Queueing system preferences
|
||||
// Web UI
|
||||
pref.setWebUiEnabled(isWebUiEnabled());
|
||||
pref->setWebUiEnabled(isWebUiEnabled());
|
||||
if (isWebUiEnabled())
|
||||
{
|
||||
pref.setWebUiPort(webUiPort());
|
||||
pref.setUPnPForWebUIPort(checkWebUIUPnP->isChecked());
|
||||
pref.setWebUiHttpsEnabled(checkWebUiHttps->isChecked());
|
||||
pref->setWebUiPort(webUiPort());
|
||||
pref->setUPnPForWebUIPort(checkWebUIUPnP->isChecked());
|
||||
pref->setWebUiHttpsEnabled(checkWebUiHttps->isChecked());
|
||||
if (checkWebUiHttps->isChecked())
|
||||
{
|
||||
pref.setWebUiHttpsCertificate(m_sslCert);
|
||||
pref.setWebUiHttpsKey(m_sslKey);
|
||||
pref->setWebUiHttpsCertificate(m_sslCert);
|
||||
pref->setWebUiHttpsKey(m_sslKey);
|
||||
}
|
||||
pref.setWebUiUsername(webUiUsername());
|
||||
pref->setWebUiUsername(webUiUsername());
|
||||
// FIXME: Check that the password is valid (not empty at least)
|
||||
pref.setWebUiPassword(webUiPassword());
|
||||
pref.setWebUiLocalAuthEnabled(!checkBypassLocalAuth->isChecked());
|
||||
pref->setWebUiPassword(webUiPassword());
|
||||
pref->setWebUiLocalAuthEnabled(!checkBypassLocalAuth->isChecked());
|
||||
// DynDNS
|
||||
pref.setDynDNSEnabled(checkDynDNS->isChecked());
|
||||
pref.setDynDNSService(comboDNSService->currentIndex());
|
||||
pref.setDynDomainName(domainNameTxt->text());
|
||||
pref.setDynDNSUsername(DNSUsernameTxt->text());
|
||||
pref.setDynDNSPassword(DNSPasswordTxt->text());
|
||||
pref->setDynDNSEnabled(checkDynDNS->isChecked());
|
||||
pref->setDynDNSService(comboDNSService->currentIndex());
|
||||
pref->setDynDomainName(domainNameTxt->text());
|
||||
pref->setDynDNSUsername(DNSUsernameTxt->text());
|
||||
pref->setDynDNSPassword(DNSPasswordTxt->text());
|
||||
}
|
||||
// End Web UI
|
||||
// End preferences
|
||||
// Save advanced settings
|
||||
advancedSettings->saveAdvancedSettings();
|
||||
// Assume that user changed multiple settings
|
||||
// so it's best to save immediately
|
||||
pref->save();
|
||||
}
|
||||
|
||||
bool options_imp::isFilteringEnabled() const {
|
||||
@@ -507,43 +510,43 @@ void options_imp::loadOptions() {
|
||||
qreal floatValue;
|
||||
QString strValue;
|
||||
// General preferences
|
||||
const Preferences pref;
|
||||
setLocale(pref.getLocale());
|
||||
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
|
||||
checkShowSystray->setChecked(pref.systrayIntegration());
|
||||
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
setLocale(pref->getLocale());
|
||||
checkAltRowColors->setChecked(pref->useAlternatingRowColors());
|
||||
checkShowSystray->setChecked(pref->systrayIntegration());
|
||||
checkShowSplash->setChecked(!pref->isSlashScreenDisabled());
|
||||
if (checkShowSystray->isChecked()) {
|
||||
checkCloseToSystray->setChecked(pref.closeToTray());
|
||||
checkMinimizeToSysTray->setChecked(pref.minimizeToTray());
|
||||
checkStartMinimized->setChecked(pref.startMinimized());
|
||||
checkCloseToSystray->setChecked(pref->closeToTray());
|
||||
checkMinimizeToSysTray->setChecked(pref->minimizeToTray());
|
||||
checkStartMinimized->setChecked(pref->startMinimized());
|
||||
}
|
||||
comboTrayIcon->setCurrentIndex(pref.trayIconStyle());
|
||||
checkProgramExitConfirm->setChecked(pref.confirmOnExit());
|
||||
checkPreventFromSuspend->setChecked(pref.preventFromSuspend());
|
||||
comboTrayIcon->setCurrentIndex(pref->trayIconStyle());
|
||||
checkProgramExitConfirm->setChecked(pref->confirmOnExit());
|
||||
checkPreventFromSuspend->setChecked(pref->preventFromSuspend());
|
||||
#ifdef Q_OS_WIN
|
||||
checkStartup->setChecked(pref.Startup());
|
||||
checkStartup->setChecked(pref->WinStartup());
|
||||
// Windows: file association settings
|
||||
checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
||||
checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
|
||||
#endif
|
||||
// End General preferences
|
||||
// Downloads preferences
|
||||
textSavePath->setText(fsutils::toNativePath(pref.getSavePath()));
|
||||
if (pref.isTempPathEnabled()) {
|
||||
textSavePath->setText(fsutils::toNativePath(pref->getSavePath()));
|
||||
if (pref->isTempPathEnabled()) {
|
||||
// enable
|
||||
checkTempFolder->setChecked(true);
|
||||
} else {
|
||||
checkTempFolder->setChecked(false);
|
||||
}
|
||||
textTempPath->setText(fsutils::toNativePath(pref.getTempPath()));
|
||||
checkAppendLabel->setChecked(pref.appendTorrentLabel());
|
||||
checkAppendqB->setChecked(pref.useIncompleteFilesExtension());
|
||||
checkPreallocateAll->setChecked(pref.preAllocateAllFiles());
|
||||
checkAdditionDialog->setChecked(pref.useAdditionDialog());
|
||||
checkAdditionDialogFront->setChecked(pref.AdditionDialogFront());
|
||||
checkStartPaused->setChecked(pref.addTorrentsInPause());
|
||||
textTempPath->setText(fsutils::toNativePath(pref->getTempPath()));
|
||||
checkAppendLabel->setChecked(pref->appendTorrentLabel());
|
||||
checkAppendqB->setChecked(pref->useIncompleteFilesExtension());
|
||||
checkPreallocateAll->setChecked(pref->preAllocateAllFiles());
|
||||
checkAdditionDialog->setChecked(pref->useAdditionDialog());
|
||||
checkAdditionDialogFront->setChecked(pref->additionDialogFront());
|
||||
checkStartPaused->setChecked(pref->addTorrentsInPause());
|
||||
|
||||
strValue = fsutils::toNativePath(pref.getTorrentExportDir());
|
||||
strValue = fsutils::toNativePath(pref->getTorrentExportDir());
|
||||
if (strValue.isEmpty()) {
|
||||
// Disable
|
||||
checkExportDir->setChecked(false);
|
||||
@@ -552,7 +555,7 @@ void options_imp::loadOptions() {
|
||||
textExportDir->setText(strValue);
|
||||
}
|
||||
|
||||
strValue = fsutils::toNativePath(pref.getFinishedTorrentExportDir());
|
||||
strValue = fsutils::toNativePath(pref->getFinishedTorrentExportDir());
|
||||
if (strValue.isEmpty()) {
|
||||
// Disable
|
||||
checkExportDirFin->setChecked(false);
|
||||
@@ -561,30 +564,30 @@ void options_imp::loadOptions() {
|
||||
checkExportDirFin->setChecked(true);
|
||||
textExportDirFin->setText(strValue);
|
||||
}
|
||||
groupMailNotification->setChecked(pref.isMailNotificationEnabled());
|
||||
dest_email_txt->setText(pref.getMailNotificationEmail());
|
||||
smtp_server_txt->setText(pref.getMailNotificationSMTP());
|
||||
checkSmtpSSL->setChecked(pref.getMailNotificationSMTPSSL());
|
||||
groupMailNotifAuth->setChecked(pref.getMailNotificationSMTPAuth());
|
||||
mailNotifUsername->setText(pref.getMailNotificationSMTPUsername());
|
||||
mailNotifPassword->setText(pref.getMailNotificationSMTPPassword());
|
||||
autoRunBox->setChecked(pref.isAutoRunEnabled());
|
||||
autoRun_txt->setText(pref.getAutoRunProgram());
|
||||
intValue = pref.getActionOnDblClOnTorrentDl();
|
||||
groupMailNotification->setChecked(pref->isMailNotificationEnabled());
|
||||
dest_email_txt->setText(pref->getMailNotificationEmail());
|
||||
smtp_server_txt->setText(pref->getMailNotificationSMTP());
|
||||
checkSmtpSSL->setChecked(pref->getMailNotificationSMTPSSL());
|
||||
groupMailNotifAuth->setChecked(pref->getMailNotificationSMTPAuth());
|
||||
mailNotifUsername->setText(pref->getMailNotificationSMTPUsername());
|
||||
mailNotifPassword->setText(pref->getMailNotificationSMTPPassword());
|
||||
autoRunBox->setChecked(pref->isAutoRunEnabled());
|
||||
autoRun_txt->setText(pref->getAutoRunProgram());
|
||||
intValue = pref->getActionOnDblClOnTorrentDl();
|
||||
if (intValue >= actionTorrentDlOnDblClBox->count())
|
||||
intValue = 0;
|
||||
actionTorrentDlOnDblClBox->setCurrentIndex(intValue);
|
||||
intValue = pref.getActionOnDblClOnTorrentFn();
|
||||
intValue = pref->getActionOnDblClOnTorrentFn();
|
||||
if (intValue >= actionTorrentFnOnDblClBox->count())
|
||||
intValue = 1;
|
||||
actionTorrentFnOnDblClBox->setCurrentIndex(intValue);
|
||||
// End Downloads preferences
|
||||
// Connection preferences
|
||||
spinPort->setValue(pref.getSessionPort());
|
||||
checkUPnP->setChecked(pref.isUPnPEnabled());
|
||||
checkRandomPort->setChecked(pref.useRandomPort());
|
||||
spinPort->setValue(pref->getSessionPort());
|
||||
checkUPnP->setChecked(pref->isUPnPEnabled());
|
||||
checkRandomPort->setChecked(pref->useRandomPort());
|
||||
spinPort->setDisabled(checkRandomPort->isChecked());
|
||||
intValue = pref.getGlobalDownloadLimit();
|
||||
intValue = pref->getGlobalDownloadLimit();
|
||||
if (intValue > 0) {
|
||||
// Enabled
|
||||
checkDownloadLimit->setChecked(true);
|
||||
@@ -595,7 +598,7 @@ void options_imp::loadOptions() {
|
||||
checkDownloadLimit->setChecked(false);
|
||||
spinDownloadLimit->setEnabled(false);
|
||||
}
|
||||
intValue = pref.getGlobalUploadLimit();
|
||||
intValue = pref->getGlobalUploadLimit();
|
||||
if (intValue != -1) {
|
||||
// Enabled
|
||||
checkUploadLimit->setChecked(true);
|
||||
@@ -606,19 +609,19 @@ void options_imp::loadOptions() {
|
||||
checkUploadLimit->setChecked(false);
|
||||
spinUploadLimit->setEnabled(false);
|
||||
}
|
||||
spinUploadLimitAlt->setValue(pref.getAltGlobalUploadLimit());
|
||||
spinDownloadLimitAlt->setValue(pref.getAltGlobalDownloadLimit());
|
||||
spinUploadLimitAlt->setValue(pref->getAltGlobalUploadLimit());
|
||||
spinDownloadLimitAlt->setValue(pref->getAltGlobalDownloadLimit());
|
||||
// Options
|
||||
checkuTP->setChecked(pref.isuTPEnabled());
|
||||
checkLimituTPConnections->setChecked(pref.isuTPRateLimited());
|
||||
checkLimitTransportOverhead->setChecked(pref.includeOverheadInLimits());
|
||||
checkuTP->setChecked(pref->isuTPEnabled());
|
||||
checkLimituTPConnections->setChecked(pref->isuTPRateLimited());
|
||||
checkLimitTransportOverhead->setChecked(pref->includeOverheadInLimits());
|
||||
// Scheduler
|
||||
check_schedule->setChecked(pref.isSchedulerEnabled());
|
||||
schedule_from->setTime(pref.getSchedulerStartTime());
|
||||
schedule_to->setTime(pref.getSchedulerEndTime());
|
||||
schedule_days->setCurrentIndex((int)pref.getSchedulerDays());
|
||||
check_schedule->setChecked(pref->isSchedulerEnabled());
|
||||
schedule_from->setTime(pref->getSchedulerStartTime());
|
||||
schedule_to->setTime(pref->getSchedulerEndTime());
|
||||
schedule_days->setCurrentIndex((int)pref->getSchedulerDays());
|
||||
|
||||
intValue = pref.getProxyType();
|
||||
intValue = pref->getProxyType();
|
||||
switch(intValue) {
|
||||
case Proxy::SOCKS4:
|
||||
comboProxyType->setCurrentIndex(1);
|
||||
@@ -637,16 +640,16 @@ void options_imp::loadOptions() {
|
||||
enableProxy(comboProxyType->currentIndex());
|
||||
//if (isProxyEnabled()) {
|
||||
// Proxy is enabled, save settings
|
||||
textProxyIP->setText(pref.getProxyIp());
|
||||
spinProxyPort->setValue(pref.getProxyPort());
|
||||
checkProxyPeerConnecs->setChecked(pref.proxyPeerConnections());
|
||||
checkProxyAuth->setChecked(pref.isProxyAuthEnabled());
|
||||
textProxyUsername->setText(pref.getProxyUsername());
|
||||
textProxyPassword->setText(pref.getProxyPassword());
|
||||
textProxyIP->setText(pref->getProxyIp());
|
||||
spinProxyPort->setValue(pref->getProxyPort());
|
||||
checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
|
||||
checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
|
||||
textProxyUsername->setText(pref->getProxyUsername());
|
||||
textProxyPassword->setText(pref->getProxyPassword());
|
||||
//}
|
||||
// End Connection preferences
|
||||
// Bittorrent preferences
|
||||
intValue = pref.getMaxConnecs();
|
||||
intValue = pref->getMaxConnecs();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
checkMaxConnecs->setChecked(true);
|
||||
@@ -657,7 +660,7 @@ void options_imp::loadOptions() {
|
||||
checkMaxConnecs->setChecked(false);
|
||||
spinMaxConnec->setEnabled(false);
|
||||
}
|
||||
intValue = pref.getMaxConnecsPerTorrent();
|
||||
intValue = pref->getMaxConnecsPerTorrent();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
checkMaxConnecsPerTorrent->setChecked(true);
|
||||
@@ -668,7 +671,7 @@ void options_imp::loadOptions() {
|
||||
checkMaxConnecsPerTorrent->setChecked(false);
|
||||
spinMaxConnecPerTorrent->setEnabled(false);
|
||||
}
|
||||
intValue = pref.getMaxUploads();
|
||||
intValue = pref->getMaxUploads();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
checkMaxUploads->setChecked(true);
|
||||
@@ -679,7 +682,7 @@ void options_imp::loadOptions() {
|
||||
checkMaxUploads->setChecked(false);
|
||||
spinMaxUploads->setEnabled(false);
|
||||
}
|
||||
intValue = pref.getMaxUploadsPerTorrent();
|
||||
intValue = pref->getMaxUploadsPerTorrent();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
checkMaxUploadsPerTorrent->setChecked(true);
|
||||
@@ -690,15 +693,15 @@ void options_imp::loadOptions() {
|
||||
checkMaxUploadsPerTorrent->setChecked(false);
|
||||
spinMaxUploadsPerTorrent->setEnabled(false);
|
||||
}
|
||||
checkDHT->setChecked(pref.isDHTEnabled());
|
||||
checkPeX->setChecked(pref.isPeXEnabled());
|
||||
checkLSD->setChecked(pref.isLSDEnabled());
|
||||
comboEncryption->setCurrentIndex(pref.getEncryptionSetting());
|
||||
checkAnonymousMode->setChecked(pref.isAnonymousModeEnabled());
|
||||
checkDHT->setChecked(pref->isDHTEnabled());
|
||||
checkPeX->setChecked(pref->isPeXEnabled());
|
||||
checkLSD->setChecked(pref->isLSDEnabled());
|
||||
comboEncryption->setCurrentIndex(pref->getEncryptionSetting());
|
||||
checkAnonymousMode->setChecked(pref->isAnonymousModeEnabled());
|
||||
/* make sure ui matches options */
|
||||
toggleAnonymousMode(checkAnonymousMode->isChecked());
|
||||
// Ratio limit
|
||||
floatValue = pref.getGlobalMaxRatio();
|
||||
floatValue = pref->getGlobalMaxRatio();
|
||||
if (floatValue >= 0.) {
|
||||
// Enable
|
||||
checkMaxRatio->setChecked(true);
|
||||
@@ -711,36 +714,36 @@ void options_imp::loadOptions() {
|
||||
spinMaxRatio->setEnabled(false);
|
||||
comboRatioLimitAct->setEnabled(false);
|
||||
}
|
||||
comboRatioLimitAct->setCurrentIndex(pref.getMaxRatioAction());
|
||||
comboRatioLimitAct->setCurrentIndex(pref->getMaxRatioAction());
|
||||
// End Bittorrent preferences
|
||||
// Misc preferences
|
||||
// * IP Filter
|
||||
checkIPFilter->setChecked(pref.isFilteringEnabled());
|
||||
textFilterPath->setText(fsutils::toNativePath(pref.getFilter()));
|
||||
checkIPFilter->setChecked(pref->isFilteringEnabled());
|
||||
textFilterPath->setText(fsutils::toNativePath(pref->getFilter()));
|
||||
// End IP Filter
|
||||
// Queueing system preferences
|
||||
checkEnableQueueing->setChecked(pref.isQueueingSystemEnabled());
|
||||
spinMaxActiveDownloads->setValue(pref.getMaxActiveDownloads());
|
||||
spinMaxActiveUploads->setValue(pref.getMaxActiveUploads());
|
||||
spinMaxActiveTorrents->setValue(pref.getMaxActiveTorrents());
|
||||
checkIgnoreSlowTorrentsForQueueing->setChecked(pref.ignoreSlowTorrentsForQueueing());
|
||||
checkEnableQueueing->setChecked(pref->isQueueingSystemEnabled());
|
||||
spinMaxActiveDownloads->setValue(pref->getMaxActiveDownloads());
|
||||
spinMaxActiveUploads->setValue(pref->getMaxActiveUploads());
|
||||
spinMaxActiveTorrents->setValue(pref->getMaxActiveTorrents());
|
||||
checkIgnoreSlowTorrentsForQueueing->setChecked(pref->ignoreSlowTorrentsForQueueing());
|
||||
// End Queueing system preferences
|
||||
// Web UI
|
||||
checkWebUi->setChecked(pref.isWebUiEnabled());
|
||||
spinWebUiPort->setValue(pref.getWebUiPort());
|
||||
checkWebUIUPnP->setChecked(pref.useUPnPForWebUIPort());
|
||||
checkWebUiHttps->setChecked(pref.isWebUiHttpsEnabled());
|
||||
setSslCertificate(pref.getWebUiHttpsCertificate(), false);
|
||||
setSslKey(pref.getWebUiHttpsKey(), false);
|
||||
textWebUiUsername->setText(pref.getWebUiUsername());
|
||||
textWebUiPassword->setText(pref.getWebUiPassword());
|
||||
checkBypassLocalAuth->setChecked(!pref.isWebUiLocalAuthEnabled());
|
||||
checkWebUi->setChecked(pref->isWebUiEnabled());
|
||||
spinWebUiPort->setValue(pref->getWebUiPort());
|
||||
checkWebUIUPnP->setChecked(pref->useUPnPForWebUIPort());
|
||||
checkWebUiHttps->setChecked(pref->isWebUiHttpsEnabled());
|
||||
setSslCertificate(pref->getWebUiHttpsCertificate(), false);
|
||||
setSslKey(pref->getWebUiHttpsKey(), false);
|
||||
textWebUiUsername->setText(pref->getWebUiUsername());
|
||||
textWebUiPassword->setText(pref->getWebUiPassword());
|
||||
checkBypassLocalAuth->setChecked(!pref->isWebUiLocalAuthEnabled());
|
||||
// Dynamic DNS
|
||||
checkDynDNS->setChecked(pref.isDynDNSEnabled());
|
||||
comboDNSService->setCurrentIndex((int)pref.getDynDNSService());
|
||||
domainNameTxt->setText(pref.getDynDomainName());
|
||||
DNSUsernameTxt->setText(pref.getDynDNSUsername());
|
||||
DNSPasswordTxt->setText(pref.getDynDNSPassword());
|
||||
checkDynDNS->setChecked(pref->isDynDNSEnabled());
|
||||
comboDNSService->setCurrentIndex((int)pref->getDynDNSService());
|
||||
domainNameTxt->setText(pref->getDynDomainName());
|
||||
DNSUsernameTxt->setText(pref->getDynDNSUsername());
|
||||
DNSPasswordTxt->setText(pref->getDynDNSPassword());
|
||||
// End Web UI
|
||||
}
|
||||
|
||||
@@ -830,7 +833,7 @@ qreal options_imp::getMaxRatio() const {
|
||||
// Return Save Path
|
||||
QString options_imp::getSavePath() const {
|
||||
if (textSavePath->text().trimmed().isEmpty()) {
|
||||
QString save_path = Preferences().getSavePath();
|
||||
QString save_path = Preferences::instance()->getSavePath();
|
||||
textSavePath->setText(fsutils::toNativePath(save_path));
|
||||
}
|
||||
return fsutils::expandPathAbs(textSavePath->text());
|
||||
@@ -952,7 +955,7 @@ bool options_imp::isSlashScreenDisabled() const {
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool options_imp::Startup() const {
|
||||
bool options_imp::WinStartup() const {
|
||||
return checkStartup->isChecked();
|
||||
}
|
||||
#endif
|
||||
@@ -1042,9 +1045,9 @@ int options_imp::getActionOnDblClOnTorrentFn() const {
|
||||
}
|
||||
|
||||
void options_imp::on_addScanFolderButton_clicked() {
|
||||
Preferences pref;
|
||||
Preferences* const pref = Preferences::instance();
|
||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Add directory to scan"),
|
||||
fsutils::toNativePath(fsutils::folderName(pref.getScanDirsLastPath())));
|
||||
fsutils::toNativePath(fsutils::folderName(pref->getScanDirsLastPath())));
|
||||
if (!dir.isEmpty()) {
|
||||
const ScanFoldersModel::PathStatus status = ScanFoldersModel::instance()->addPath(dir, false);
|
||||
QString error;
|
||||
@@ -1059,7 +1062,7 @@ void options_imp::on_addScanFolderButton_clicked() {
|
||||
error = tr("Folder is not readable.");
|
||||
break;
|
||||
default:
|
||||
pref.setScanDirsLastPath(dir);
|
||||
pref->setScanDirsLastPath(dir);
|
||||
addedScanDirs << dir;
|
||||
scanFoldersView->resizeColumnsToContents();
|
||||
enableApplyButton();
|
||||
@@ -1210,9 +1213,9 @@ void options_imp::on_IpFilterRefreshBtn_clicked() {
|
||||
if (m_refreshingIpFilter) return;
|
||||
m_refreshingIpFilter = true;
|
||||
// Updating program preferences
|
||||
Preferences pref;
|
||||
pref.setFilteringEnabled(true);
|
||||
pref.setFilter(getFilter());
|
||||
Preferences* const pref = Preferences::instance();
|
||||
pref->setFilteringEnabled(true);
|
||||
pref->setFilter(getFilter());
|
||||
// Force refresh
|
||||
connect(QBtSession::instance(), SIGNAL(ipFilterParsed(bool, int)), SLOT(handleIPFilterParsed(bool, int)));
|
||||
setCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
@@ -102,7 +102,7 @@ private:
|
||||
bool isSlashScreenDisabled() const;
|
||||
bool preventFromSuspend() const;
|
||||
#ifdef Q_OS_WIN
|
||||
bool Startup() const;
|
||||
bool WinStartup() const;
|
||||
#endif
|
||||
// Downloads
|
||||
QString getSavePath() const;
|
||||
|
||||
Reference in New Issue
Block a user