From 39d86c5f61803d4f830a2ebe3d60feecbf91bfd9 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 22 Jul 2010 09:39:51 +0000 Subject: [PATCH] Made it possible to disable notification balloons again --- src/GUI.cpp | 1 + src/advancedsettings.h | 15 ++++++++++++--- src/preferences.h | 10 ++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 9f8c9f829..5be6a4fe3 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -910,6 +910,7 @@ void GUI::updateGUI() { } void GUI::showNotificationBaloon(QString title, QString msg) const { + if(!Preferences::useProgramNotification()) return; #ifdef WITH_LIBNOTIFY if (notify_init ("summary-body")) { NotifyNotification* notification; diff --git a/src/advancedsettings.h b/src/advancedsettings.h index b5318ec60..002db8463 100644 --- a/src/advancedsettings.h +++ b/src/advancedsettings.h @@ -11,15 +11,15 @@ #include "preferences.h" enum AdvSettingsCols {PROPERTY, VALUE}; -enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE }; -#define ROW_COUNT 12 +enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, PROGRAM_NOTIFICATIONS }; +#define ROW_COUNT 13 class AdvancedSettings: public QTableWidget { Q_OBJECT private: QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh, *spin_maxhalfopen; - QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts, *cb_super_seeding; + QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts, *cb_super_seeding, *cb_program_notifications; QComboBox *combo_iface; public: @@ -52,6 +52,7 @@ public: delete spin_maxhalfopen; delete cb_super_seeding; delete combo_iface; + delete cb_program_notifications; } public slots: @@ -85,6 +86,8 @@ public slots: } else { Preferences::setNetworkInterface(combo_iface->currentText()); } + // Program notification + Preferences::useProgramNotification(cb_program_notifications->isChecked()); } protected slots: @@ -186,6 +189,12 @@ protected slots: } connect(combo_iface, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSettingsChanged())); setCellWidget(NETWORK_IFACE, VALUE, combo_iface); + // Program notifications + setItem(PROGRAM_NOTIFICATIONS, PROPERTY, new QTableWidgetItem(tr("Display program notification baloons"))); + cb_program_notifications = new QCheckBox(); + connect(cb_program_notifications, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); + cb_program_notifications->setChecked(Preferences::useProgramNotification()); + setCellWidget(PROGRAM_NOTIFICATIONS, VALUE, cb_program_notifications); } void emitSettingsChanged() { diff --git a/src/preferences.h b/src/preferences.h index 474259cfc..744470c34 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -78,6 +78,16 @@ public: settings.setValue(QString::fromUtf8("Preferences/General/Style"), style); } + static bool useProgramNotification() { + QIniSettings settings("qBittorrent", "qBittorrent"); + return settings.value(QString::fromUtf8("Preferences/General/ProgramNotification"), true).toBool(); + } + + static void useProgramNotification(bool use) { + QIniSettings settings("qBittorrent", "qBittorrent"); + settings.setValue(QString::fromUtf8("Preferences/General/ProgramNotification"), use); + } + static bool deleteTorrentFilesAsDefault() { QIniSettings settings("qBittorrent", "qBittorrent"); return settings.value(QString::fromUtf8("Preferences/General/DeleteTorrentsFilesAsDefault"), false).toBool();