Browse Source

Made it possible to disable notification balloons again

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
39d86c5f61
  1. 1
      src/GUI.cpp
  2. 15
      src/advancedsettings.h
  3. 10
      src/preferences.h

1
src/GUI.cpp

@ -910,6 +910,7 @@ void GUI::updateGUI() {
} }
void GUI::showNotificationBaloon(QString title, QString msg) const { void GUI::showNotificationBaloon(QString title, QString msg) const {
if(!Preferences::useProgramNotification()) return;
#ifdef WITH_LIBNOTIFY #ifdef WITH_LIBNOTIFY
if (notify_init ("summary-body")) { if (notify_init ("summary-body")) {
NotifyNotification* notification; NotifyNotification* notification;

15
src/advancedsettings.h

@ -11,15 +11,15 @@
#include "preferences.h" #include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE}; 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 }; 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 12 #define ROW_COUNT 13
class AdvancedSettings: public QTableWidget { class AdvancedSettings: public QTableWidget {
Q_OBJECT Q_OBJECT
private: private:
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh, *spin_maxhalfopen; 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; QComboBox *combo_iface;
public: public:
@ -52,6 +52,7 @@ public:
delete spin_maxhalfopen; delete spin_maxhalfopen;
delete cb_super_seeding; delete cb_super_seeding;
delete combo_iface; delete combo_iface;
delete cb_program_notifications;
} }
public slots: public slots:
@ -85,6 +86,8 @@ public slots:
} else { } else {
Preferences::setNetworkInterface(combo_iface->currentText()); Preferences::setNetworkInterface(combo_iface->currentText());
} }
// Program notification
Preferences::useProgramNotification(cb_program_notifications->isChecked());
} }
protected slots: protected slots:
@ -186,6 +189,12 @@ protected slots:
} }
connect(combo_iface, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSettingsChanged())); connect(combo_iface, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSettingsChanged()));
setCellWidget(NETWORK_IFACE, VALUE, combo_iface); 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() { void emitSettingsChanged() {

10
src/preferences.h

@ -78,6 +78,16 @@ public:
settings.setValue(QString::fromUtf8("Preferences/General/Style"), style); 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() { static bool deleteTorrentFilesAsDefault() {
QIniSettings settings("qBittorrent", "qBittorrent"); QIniSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/DeleteTorrentsFilesAsDefault"), false).toBool(); return settings.value(QString::fromUtf8("Preferences/General/DeleteTorrentsFilesAsDefault"), false).toBool();

Loading…
Cancel
Save