From: romibi Date: Mon, 5 Feb 2018 17:51:54 +0000 (+0100) Subject: Move systray animation settings to notification settings page X-Git-Tag: travis-deploy-test~59 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=408250f819b35ecf43271a9bbe4455b891e302c8 Move systray animation settings to notification settings page --- diff --git a/src/qtui/settingspages/appearancesettingspage.ui b/src/qtui/settingspages/appearancesettingspage.ui index 5d8fa77c..abf67d5a 100644 --- a/src/qtui/settingspages/appearancesettingspage.ui +++ b/src/qtui/settingspages/appearancesettingspage.ui @@ -210,38 +210,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - Enable animations - - - /Notification/Systray/Animate - - - true - - - 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 diff --git a/src/qtui/systrayanimationnotificationbackend.h b/src/qtui/systrayanimationnotificationbackend.h index 6a720012..cbe934d5 100644 --- a/src/qtui/systrayanimationnotificationbackend.h +++ b/src/qtui/systrayanimationnotificationbackend.h @@ -41,5 +41,26 @@ private slots: void animateChanged(const QVariant &); private: + class ConfigWidget; + bool _animate; +}; + + +class SystrayAnimationNotificationBackend::ConfigWidget : public SettingsPage +{ + Q_OBJECT + +public: + ConfigWidget(QWidget *parent = 0); + void save(); + void load(); + bool hasDefaults() const; + void defaults(); + +private slots: + void widgetChanged(); + +private: + QCheckBox *_animateBox; bool _animate; }; \ No newline at end of file