X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsystrayanimationnotificationbackend.cpp;h=65cc38b543182a402fa2066a21362c9082e73f8e;hb=afa02bdf0056f9e876b906b3597bd9c83e1368bb;hp=2cb05507d77c260375a8d531dd3b4ec10097c641;hpb=ba8a7d67ff9815f480531acab4a16cfa133929a5;p=quassel.git diff --git a/src/qtui/systrayanimationnotificationbackend.cpp b/src/qtui/systrayanimationnotificationbackend.cpp index 2cb05507..65cc38b5 100644 --- a/src/qtui/systrayanimationnotificationbackend.cpp +++ b/src/qtui/systrayanimationnotificationbackend.cpp @@ -65,5 +65,55 @@ void SystrayAnimationNotificationBackend::animateChanged(const QVariant &v) SettingsPage *SystrayAnimationNotificationBackend::createConfigWidget() const { - return nullptr; + return new ConfigWidget(); +} + + +/***************************************************************************/ + +SystrayAnimationNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "SystrayNotification", parent) +{ + _animateBox = new QCheckBox(tr("Animate system tray icon")); + _animateBox->setIcon(QIcon::fromTheme("dialog-information")); + connect(_animateBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged())); + QHBoxLayout *layout = new QHBoxLayout(this); + layout->addWidget(_animateBox); +} + + +void SystrayAnimationNotificationBackend::ConfigWidget::widgetChanged() +{ + bool changed = (_animate != _animateBox->isChecked()); + if (changed != hasChanged()) + setChangedState(changed); +} + + +bool SystrayAnimationNotificationBackend::ConfigWidget::hasDefaults() const +{ + return true; +} + + +void SystrayAnimationNotificationBackend::ConfigWidget::defaults() +{ + _animateBox->setChecked(false); + widgetChanged(); +} + + +void SystrayAnimationNotificationBackend::ConfigWidget::load() +{ + NotificationSettings s; + _animate = s.value("Systray/Animate", true).toBool(); + _animateBox->setChecked(_animate); + setChangedState(false); +} + + +void SystrayAnimationNotificationBackend::ConfigWidget::save() +{ + NotificationSettings s; + s.setValue("Systray/Animate", _animateBox->isChecked()); + load(); } \ No newline at end of file