add timeout to settings
This commit is contained in:
parent
aa331a7e98
commit
a4fd9bfb72
|
@ -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)
|
||||
|
|
|
@ -270,8 +270,6 @@ public:
|
|||
private:
|
||||
QExplicitlySharedDataPointer<NotificationData> d;
|
||||
|
||||
static int m_defaultTimeout;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,13 +39,27 @@
|
|||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="primaryBackendComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="primaryBackendLabel">
|
||||
<property name="text">
|
||||
<string>Primary Backend:</string>
|
||||
<string>Primary Backend</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="primaryBackendComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="timeoutLabel">
|
||||
<property name="text">
|
||||
<string>Timeout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="timeoutSpinBox">
|
||||
<property name="suffix">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -17,16 +17,16 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Application:</string>
|
||||
<string>Application</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in New Issue