From 1a4f638ff65893495342afeb90129132fea813a9 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 31 Jan 2010 16:25:04 +0000 Subject: [PATCH] - Moved "Transfer list refresh interval" to advanced settings --- src/advancedsettings.h | 17 ++++++++++++--- src/options_imp.cpp | 7 ------- src/options_imp.h | 1 - src/preferences.h | 15 +++++++++----- src/ui/options.ui | 47 +----------------------------------------- 5 files changed, 25 insertions(+), 62 deletions(-) diff --git a/src/advancedsettings.h b/src/advancedsettings.h index 2cfb47d6d..feb620716 100644 --- a/src/advancedsettings.h +++ b/src/advancedsettings.h @@ -8,14 +8,14 @@ #include "preferences.h" enum AdvSettingsCols {PROPERTY, VALUE}; -enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED }; -#define ROW_COUNT 6 +enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH }; +#define ROW_COUNT 7 class AdvancedSettings: public QTableWidget { Q_OBJECT private: - QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max; + QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh; QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed; public: @@ -40,6 +40,7 @@ public: delete cb_ignore_limits_lan; delete cb_count_overhead; delete cb_recheck_completed; + delete spin_list_refresh; } public slots: @@ -55,6 +56,8 @@ public slots: Preferences::includeOverheadInLimits(cb_count_overhead->isChecked()); // Recheck torrents on completion Preferences::recheckTorrentsOnCompletion(cb_recheck_completed->isChecked()); + // Transfer list refresh interval + Preferences::setRefreshInterval(spin_list_refresh->value()); } protected slots: @@ -101,6 +104,14 @@ protected slots: connect(cb_recheck_completed, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); cb_recheck_completed->setChecked(Preferences::recheckTorrentsOnCompletion()); setCellWidget(RECHECK_COMPLETED, VALUE, cb_recheck_completed); + // Transfer list refresh interval + setItem(LIST_REFRESH, PROPERTY, new QTableWidgetItem(tr("Transfer list refresh interval (ms)"))); + spin_list_refresh = new QSpinBox(); + connect(spin_list_refresh, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); + spin_list_refresh->setMinimum(30); + spin_list_refresh->setMaximum(99999); + spin_list_refresh->setValue(Preferences::getRefreshInterval()); + setCellWidget(LIST_REFRESH, VALUE, spin_list_refresh); } void emitSettingsChanged() { diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 4c9c345e7..66825df2f 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -186,7 +186,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(checkConfirmExit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkSpeedInTitle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); - connect(spinRefreshInterval, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -380,7 +379,6 @@ void options_imp::saveOptions(){ settings.setValue(QString::fromUtf8("Style"), getStyle()); settings.setValue(QString::fromUtf8("ExitConfirm"), confirmOnExit()); settings.setValue(QString::fromUtf8("SpeedInTitleBar"), speedInTitleBar()); - settings.setValue(QString::fromUtf8("RefreshInterval"), getRefreshInterval()); settings.setValue(QString::fromUtf8("AlternatingRowColors"), checkAltRowColors->isChecked()); settings.setValue(QString::fromUtf8("SystrayEnabled"), systrayIntegration()); settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray()); @@ -596,7 +594,6 @@ void options_imp::loadOptions(){ setStyle(Preferences::getStyle()); checkConfirmExit->setChecked(Preferences::confirmOnExit()); checkSpeedInTitle->setChecked(Preferences::speedInTitleBar()); - spinRefreshInterval->setValue(Preferences::getRefreshInterval()); checkAltRowColors->setChecked(Preferences::useAlternatingRowColors()); checkNoSystray->setChecked(!Preferences::systrayIntegration()); checkDisplayToolbar->setChecked(Preferences::isToolbarDisplayed()); @@ -962,10 +959,6 @@ bool options_imp::closeToTray() const{ return checkCloseToSystray->isChecked(); } -unsigned int options_imp::getRefreshInterval() const { - return spinRefreshInterval->value(); -} - bool options_imp::confirmOnExit() const{ return checkConfirmExit->isChecked(); } diff --git a/src/options_imp.h b/src/options_imp.h index e9cedc91e..a187e72ba 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -68,7 +68,6 @@ protected: int getStyle() const; bool confirmOnExit() const; bool speedInTitleBar() const; - unsigned int getRefreshInterval() const; bool systrayIntegration() const; bool minimizeToTray() const; bool closeToTray() const; diff --git a/src/preferences.h b/src/preferences.h index 9c0ff7e64..c4eec6be9 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -68,11 +68,6 @@ public: return settings.value(QString::fromUtf8("Preferences/General/SpeedInTitleBar"), false).toBool(); } - static unsigned int getRefreshInterval() { - QSettings settings("qBittorrent", "qBittorrent"); - return settings.value(QString::fromUtf8("Preferences/General/RefreshInterval"), 1500).toUInt(); - } - static bool useAlternatingRowColors() { QSettings settings("qBittorrent", "qBittorrent"); return settings.value(QString::fromUtf8("Preferences/General/AlternatingRowColors"), true).toBool(); @@ -888,6 +883,16 @@ public: settings.setValue(QString::fromUtf8("Preferences/Advanced/RecheckOnCompletion"), recheck); } + static unsigned int getRefreshInterval() { + QSettings settings("qBittorrent", "qBittorrent"); + return settings.value(QString::fromUtf8("Preferences/General/RefreshInterval"), 1500).toUInt(); + } + + static void setRefreshInterval(uint interval) { + QSettings settings("qBittorrent", "qBittorrent"); + settings.setValue(QString::fromUtf8("Preferences/General/RefreshInterval"), interval); + } + }; #endif // PREFERENCES_H diff --git a/src/ui/options.ui b/src/ui/options.ui index f63567a83..9bc5358a5 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -254,7 +254,7 @@ 0 0 602 - 590 + 555 @@ -413,50 +413,6 @@ Transfer list - - - - - - Refresh interval: - - - - - - - 30 - - - 99999 - - - 1500 - - - - - - - ms - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -3169,7 +3125,6 @@ QGroupBox { comboStyle checkConfirmExit checkSpeedInTitle - spinRefreshInterval checkNoSystray checkCloseToSystray checkMinimizeToSysTray