From 17efa04257b0d3b2067d467ac6230c12cbd02737 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 21 Jun 2010 16:02:21 +0000 Subject: [PATCH] Further preferences simplifying --- src/GUI.cpp | 5 +---- src/options_imp.cpp | 19 ------------------- src/options_imp.h | 1 - src/preferences.h | 5 ----- src/ui/options.ui | 15 ++------------- 5 files changed, 3 insertions(+), 42 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index a2a676246..c31582ced 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -881,8 +881,6 @@ void GUI::updateGUI() { } void GUI::showNotificationBaloon(QString title, QString msg) const { - QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); - if(settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool()) { #ifdef WITH_LIBNOTIFY if (notify_init ("summary-body")) { NotifyNotification* notification; @@ -896,10 +894,9 @@ void GUI::showNotificationBaloon(QString title, QString msg) const { } #endif #ifndef Q_WS_MAC - if(systrayIcon) + if(systrayIcon && QSystemTrayIcon::supportsMessages()) systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON); #endif - } } /***************************************************** diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 9d8ddf9a9..de1f67cf0 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -199,7 +199,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); - connect(checkSystrayBalloons, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDisplayToolbar, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDeleteTorrentFiles, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -281,15 +280,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(textWebUiPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); // Disable apply Button applyButton->setEnabled(false); -#ifdef Q_WS_MAC - if(1) { -#else - if(!QSystemTrayIcon::supportsMessages()){ -#endif - // Mac OS X doesn't support it yet - checkSystrayBalloons->setChecked(false); - checkSystrayBalloons->setEnabled(false); - } // Tab selection mecanism connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*))); #if LIBTORRENT_VERSION_MINOR < 15 @@ -391,7 +381,6 @@ void options_imp::saveOptions(){ settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray()); settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray()); settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized()); - settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled()); settings.setValue(QString::fromUtf8("ToolbarDisplayed"), isToolbarDisplayed()); settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled()); Preferences::setDeleteTorrentFilesAsDefault(checkDeleteTorrentFiles->isChecked()); @@ -628,7 +617,6 @@ void options_imp::loadOptions(){ checkCloseToSystray->setChecked(Preferences::closeToTray()); checkMinimizeToSysTray->setChecked(Preferences::minimizeToTray()); checkStartMinimized->setChecked(Preferences::startMinimized()); - checkSystrayBalloons->setChecked(Preferences::OSDEnabled()); } // End General preferences // Downloads preferences @@ -1016,11 +1004,6 @@ QPair options_imp::getGlobalBandwidthLimits() const{ return qMakePair(DL, UP); } -bool options_imp::OSDEnabled() const { - if(checkNoSystray->isChecked()) return false; - return checkSystrayBalloons->isChecked(); -} - bool options_imp::startMinimized() const { if(checkStartMinimized->isChecked()) return true; return checkStartMinimized->isChecked(); @@ -1175,13 +1158,11 @@ void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){ void options_imp::enableSystrayOptions() { checkCloseToSystray->setEnabled(true); checkMinimizeToSysTray->setEnabled(true); - checkSystrayBalloons->setEnabled(true); } void options_imp::disableSystrayOptions() { checkCloseToSystray->setEnabled(false); checkMinimizeToSysTray->setEnabled(false); - checkSystrayBalloons->setEnabled(false); } void options_imp::setSystrayOptionsState(bool checked) { diff --git a/src/options_imp.h b/src/options_imp.h index ff633d656..235565788 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -73,7 +73,6 @@ protected: bool closeToTray() const; bool startMinimized() const; bool isSlashScreenDisabled() const; - bool OSDEnabled() const; bool isToolbarDisplayed() const; // Downloads QString getSavePath() const; diff --git a/src/preferences.h b/src/preferences.h index 4e30db55f..ec079a42d 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -142,11 +142,6 @@ public: return settings.value(QString::fromUtf8("Preferences/General/NoSplashScreen"), false).toBool(); } - static bool OSDEnabled() { - QSettings settings("qBittorrent", "qBittorrent"); - return settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool(); - } - // Downloads static QString getSavePath() { QSettings settings("qBittorrent", "qBittorrent"); diff --git a/src/ui/options.ui b/src/ui/options.ui index caa4bdcfe..af587ac6c 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -240,9 +240,9 @@ 0 - 0 + -109 506 - 543 + 515 @@ -526,16 +526,6 @@ QGroupBox { - - - - Show notification balloons in tray - - - true - - - @@ -3110,7 +3100,6 @@ QGroupBox { checkCloseToSystray checkMinimizeToSysTray checkStartMinimized - checkSystrayBalloons textSavePath browseSaveDirButton checkPreallocateAll