From a4fd9bfb72a9013ffccba48b942d53c010c15e83 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Mon, 2 Mar 2015 11:11:23 +0100 Subject: [PATCH] add timeout to settings --- src/core/notification/notification.cpp | 5 ++--- src/core/notification/notification.h | 2 -- src/core/settingsdialog.cpp | 2 ++ src/core/settingsdialog.ui | 22 ++++++++++++++++++---- src/core/snore.cpp | 1 + src/settings/settingswindow.ui | 8 ++++---- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/core/notification/notification.cpp b/src/core/notification/notification.cpp index 9b9a0a6..0ed793e 100644 --- a/src/core/notification/notification.cpp +++ b/src/core/notification/notification.cpp @@ -25,7 +25,6 @@ using namespace Snore; -int Notification::m_defaultTimeout = 10; Notification::Notification() : d(NULL) @@ -154,12 +153,12 @@ NotificationData *Notification::data() } int Notification::defaultTimeout() { - return m_defaultTimeout; + return SnoreCore::instance().value("Timeout", LOCAL_SETTING).toInt(); } void Notification::setDefaultTimeout(int defaultTimeout) { - m_defaultTimeout = defaultTimeout; + SnoreCore::instance().setValue("Timeout", defaultTimeout, LOCAL_SETTING); } QDataStream &operator<< (QDataStream &stream, const Notification ¬i) diff --git a/src/core/notification/notification.h b/src/core/notification/notification.h index 194f0f1..5c92a75 100644 --- a/src/core/notification/notification.h +++ b/src/core/notification/notification.h @@ -270,8 +270,6 @@ public: private: QExplicitlySharedDataPointer d; - static int m_defaultTimeout; - }; } diff --git a/src/core/settingsdialog.cpp b/src/core/settingsdialog.cpp index 1c2d4b7..dd5ea6e 100644 --- a/src/core/settingsdialog.cpp +++ b/src/core/settingsdialog.cpp @@ -68,6 +68,7 @@ void SettingsDialog::load() QStringList list = SnoreCore::instance().pluginNames(SnorePlugin::BACKEND); ui->primaryBackendComboBox->addItems(list); ui->primaryBackendComboBox->setCurrentIndex(list.indexOf(SnoreCore::instance().value("PrimaryBackend", LOCAL_SETTING).toString())); + ui->timeoutSpinBox->setValue(SnoreCore::instance().value("Timeout", LOCAL_SETTING).toInt()); for (auto widget : m_tabs) { widget->loadSettings(); } @@ -80,6 +81,7 @@ void SettingsDialog::save() w->saveSettings(); } SnoreCore::instance().setValue("PrimaryBackend", ui->primaryBackendComboBox->currentText(), LOCAL_SETTING); + SnoreCore::instance().setValue("Timeout", ui->timeoutSpinBox->value(), LOCAL_SETTING); SnoreCorePrivate::instance()->syncSettings(); } diff --git a/src/core/settingsdialog.ui b/src/core/settingsdialog.ui index ba844b4..4c789ef 100644 --- a/src/core/settingsdialog.ui +++ b/src/core/settingsdialog.ui @@ -39,13 +39,27 @@ QFormLayout::AllNonFixedFieldsGrow - - - - Primary Backend: + Primary Backend + + + + + + + + + + Timeout + + + + + + + s diff --git a/src/core/snore.cpp b/src/core/snore.cpp index ebf99e9..fad2fcb 100644 --- a/src/core/snore.cpp +++ b/src/core/snore.cpp @@ -38,6 +38,7 @@ SnoreCore::SnoreCore() d_ptr = new SnoreCorePrivate(); Q_D(SnoreCore); d->q_ptr = this; + setDefaultValue("Timeout", 10, LOCAL_SETTING); } SnoreCore &SnoreCore::instance() diff --git a/src/settings/settingswindow.ui b/src/settings/settingswindow.ui index ffe4690..4abb24d 100644 --- a/src/settings/settingswindow.ui +++ b/src/settings/settingswindow.ui @@ -17,16 +17,16 @@ - - - - Application: + Application + + +