From f5d4404b6707d6ed947122a96e78cb99e9d5b08b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 11 Apr 2011 16:56:33 +0000 Subject: [PATCH] Preferences code clean up --- src/preferences/options.ui | 232 +++++++++++++++++++++----------- src/preferences/options_imp.cpp | 53 +------- src/preferences/options_imp.h | 7 - 3 files changed, 157 insertions(+), 135 deletions(-) diff --git a/src/preferences/options.ui b/src/preferences/options.ui index c37baaf46..482875937 100644 --- a/src/preferences/options.ui +++ b/src/preferences/options.ui @@ -170,9 +170,9 @@ 0 - 0 - 499 - 506 + -115 + 503 + 519 @@ -378,74 +378,76 @@ - - - Show qBittorrent icon in notification area + + + Show qBittorrent in notification area - + true - - - - - - Minimize qBittorrent to notification area - - - false - - - - - - - Close qBittorrent to notification area - - - - - - - - - Tray icon style: - - - - - - + + + - Normal + Minimize qBittorrent to notification area - - - - Monochrome (Dark theme) + + false - - + + + + - Monochrome (Light theme) + Close qBittorrent to notification area - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + + + + + Tray icon style: + + + + + + + + Normal + + + + + Monochrome (Dark theme) + + + + + Monochrome (Light theme) + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + @@ -506,8 +508,8 @@ 0 - -387 - 499 + 0 + 503 849 @@ -977,7 +979,7 @@ QGroupBox { 0 0 - 392 + 503 426 @@ -1457,8 +1459,8 @@ QGroupBox { 0 0 - 328 - 306 + 518 + 384 @@ -1835,8 +1837,8 @@ QGroupBox { 0 - 0 - 486 + -24 + 503 408 @@ -2199,8 +2201,8 @@ QGroupBox { 0 0 - 316 - 236 + 518 + 384 @@ -2348,8 +2350,8 @@ QGroupBox { 0 0 - 86 - 16 + 518 + 384 @@ -2396,8 +2398,6 @@ QGroupBox { tabOption comboI18n - checkCloseToSystray - checkMinimizeToSysTray textSavePath browseSaveDirButton checkAdditionDialog @@ -2448,5 +2448,85 @@ QGroupBox { + + checkMaxConnecs + toggled(bool) + spinMaxConnec + setEnabled(bool) + + + 496 + 157 + + + 574 + 160 + + + + + checkMaxConnecsPerTorrent + toggled(bool) + spinMaxConnecPerTorrent + setEnabled(bool) + + + 494 + 188 + + + 611 + 190 + + + + + checkMaxUploadsPerTorrent + toggled(bool) + spinMaxUploadsPerTorrent + setEnabled(bool) + + + 510 + 214 + + + 616 + 217 + + + + + checkMaxRatio + toggled(bool) + spinMaxRatio + setEnabled(bool) + + + 440 + 364 + + + 563 + 374 + + + + + checkMaxRatio + toggled(bool) + comboRatioLimitAct + setEnabled(bool) + + + 418 + 371 + + + 707 + 376 + + + diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 3e7602132..791a8a4dc 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -111,13 +111,6 @@ options_imp::options_imp(QWidget *parent): comboTrayIcon->setVisible(false); #endif // Connect signals / slots - // General tab - connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool))); - // Bittorrent tab - connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimit(bool))); - connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimitPerTorrent(bool))); - connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool))); - connect(checkMaxRatio, SIGNAL(toggled(bool)), this, SLOT(enableMaxRatio(bool))); // Proxy tab connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int))); connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuth(bool))); @@ -475,10 +468,7 @@ void options_imp::loadOptions(){ checkAltRowColors->setChecked(pref.useAlternatingRowColors()); checkShowSystray->setChecked(pref.systrayIntegration()); checkShowSplash->setChecked(!pref.isSlashScreenDisabled()); - if(!checkShowSystray->isChecked()) { - disableSystrayOptions(); - } else { - enableSystrayOptions(); + if(checkShowSystray->isChecked()) { checkCloseToSystray->setChecked(pref.closeToTray()); checkMinimizeToSysTray->setChecked(pref.minimizeToTray()); checkStartMinimized->setChecked(pref.startMinimized()); @@ -845,51 +835,10 @@ bool options_imp::useAdditionDialog() const{ return checkAdditionDialog->isChecked(); } -void options_imp::enableMaxConnecsLimit(bool checked){ - spinMaxConnec->setEnabled(checked); -} - -void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){ - spinMaxConnecPerTorrent->setEnabled(checked); -} - -void options_imp::enableSystrayOptions() { - checkCloseToSystray->setEnabled(true); - checkMinimizeToSysTray->setEnabled(true); - comboTrayIcon->setEnabled(true); -} - -void options_imp::disableSystrayOptions() { - checkCloseToSystray->setEnabled(false); - checkMinimizeToSysTray->setEnabled(false); - comboTrayIcon->setEnabled(false); -} - -void options_imp::setSystrayOptionsState(bool checked) { - if(checked) { - enableSystrayOptions(); - } else { - disableSystrayOptions(); - } -} - -void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){ - if(checked){ - spinMaxUploadsPerTorrent->setEnabled(true); - }else{ - spinMaxUploadsPerTorrent->setEnabled(false); - } -} - void options_imp::enableApplyButton(){ applyButton->setEnabled(true); } -void options_imp::enableMaxRatio(bool checked){ - spinMaxRatio->setEnabled(checked); - comboRatioLimitAct->setEnabled(checked); -} - void options_imp::enableProxy(int index){ if(index){ //enable diff --git a/src/preferences/options_imp.h b/src/preferences/options_imp.h index d28c258e3..44fcd4027 100644 --- a/src/preferences/options_imp.h +++ b/src/preferences/options_imp.h @@ -57,10 +57,6 @@ public: protected slots: void enableProxy(int comboIndex); void enableProxyAuth(bool checked); - void enableMaxConnecsLimit(bool checked); - void enableMaxConnecsLimitPerTorrent(bool checked); - void enableMaxUploadsLimitPerTorrent(bool checked); - void enableMaxRatio(bool checked); void on_buttonBox_accepted(); void closeEvent(QCloseEvent *e); void on_buttonBox_rejected(); @@ -70,9 +66,6 @@ protected slots: void on_browseSaveDirButton_clicked(); void on_browseTempDirButton_clicked(); void enableApplyButton(); - void enableSystrayOptions(); - void disableSystrayOptions(); - void setSystrayOptionsState(bool checked); void changePage(QListWidgetItem*, QListWidgetItem*); void loadWindowState(); void saveWindowState() const;