add timeout to settings
This commit is contained in:
parent
aa331a7e98
commit
a4fd9bfb72
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
int Notification::m_defaultTimeout = 10;
|
|
||||||
|
|
||||||
Notification::Notification() :
|
Notification::Notification() :
|
||||||
d(NULL)
|
d(NULL)
|
||||||
|
@ -154,12 +153,12 @@ NotificationData *Notification::data()
|
||||||
}
|
}
|
||||||
int Notification::defaultTimeout()
|
int Notification::defaultTimeout()
|
||||||
{
|
{
|
||||||
return m_defaultTimeout;
|
return SnoreCore::instance().value("Timeout", LOCAL_SETTING).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notification::setDefaultTimeout(int defaultTimeout)
|
void Notification::setDefaultTimeout(int defaultTimeout)
|
||||||
{
|
{
|
||||||
m_defaultTimeout = defaultTimeout;
|
SnoreCore::instance().setValue("Timeout", defaultTimeout, LOCAL_SETTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<< (QDataStream &stream, const Notification ¬i)
|
QDataStream &operator<< (QDataStream &stream, const Notification ¬i)
|
||||||
|
|
|
@ -270,8 +270,6 @@ public:
|
||||||
private:
|
private:
|
||||||
QExplicitlySharedDataPointer<NotificationData> d;
|
QExplicitlySharedDataPointer<NotificationData> d;
|
||||||
|
|
||||||
static int m_defaultTimeout;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ void SettingsDialog::load()
|
||||||
QStringList list = SnoreCore::instance().pluginNames(SnorePlugin::BACKEND);
|
QStringList list = SnoreCore::instance().pluginNames(SnorePlugin::BACKEND);
|
||||||
ui->primaryBackendComboBox->addItems(list);
|
ui->primaryBackendComboBox->addItems(list);
|
||||||
ui->primaryBackendComboBox->setCurrentIndex(list.indexOf(SnoreCore::instance().value("PrimaryBackend", LOCAL_SETTING).toString()));
|
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) {
|
for (auto widget : m_tabs) {
|
||||||
widget->loadSettings();
|
widget->loadSettings();
|
||||||
}
|
}
|
||||||
|
@ -80,6 +81,7 @@ void SettingsDialog::save()
|
||||||
w->saveSettings();
|
w->saveSettings();
|
||||||
}
|
}
|
||||||
SnoreCore::instance().setValue("PrimaryBackend", ui->primaryBackendComboBox->currentText(), LOCAL_SETTING);
|
SnoreCore::instance().setValue("PrimaryBackend", ui->primaryBackendComboBox->currentText(), LOCAL_SETTING);
|
||||||
|
SnoreCore::instance().setValue("Timeout", ui->timeoutSpinBox->value(), LOCAL_SETTING);
|
||||||
SnoreCorePrivate::instance()->syncSettings();
|
SnoreCorePrivate::instance()->syncSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,27 @@
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="primaryBackendComboBox"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="primaryBackendLabel">
|
<widget class="QLabel" name="primaryBackendLabel">
|
||||||
<property name="text">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -38,6 +38,7 @@ SnoreCore::SnoreCore()
|
||||||
d_ptr = new SnoreCorePrivate();
|
d_ptr = new SnoreCorePrivate();
|
||||||
Q_D(SnoreCore);
|
Q_D(SnoreCore);
|
||||||
d->q_ptr = this;
|
d->q_ptr = this;
|
||||||
|
setDefaultValue("Timeout", 10, LOCAL_SETTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
SnoreCore &SnoreCore::instance()
|
SnoreCore &SnoreCore::instance()
|
||||||
|
|
|
@ -17,16 +17,16 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Application:</string>
|
<string>Application</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Reference in New Issue