X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Ftaskbarnotificationbackend.cpp;h=27368836ef3d15bc013c875a37ec5bbb66a0f464;hb=03ee70025a98912c163155955fe3cc3045f629b9;hp=456d1672fe639b5472913f8fe5ae26ab72ee1e03;hpb=2c8434f74c68194d56f2084f637419123e61d18b;p=quassel.git diff --git a/src/qtui/taskbarnotificationbackend.cpp b/src/qtui/taskbarnotificationbackend.cpp index 456d1672..27368836 100644 --- a/src/qtui/taskbarnotificationbackend.cpp +++ b/src/qtui/taskbarnotificationbackend.cpp @@ -30,7 +30,7 @@ #include "mainwin.h" #include "qtui.h" -TaskbarNotificationBackend::TaskbarNotificationBackend(QObject *parent) +TaskbarNotificationBackend::TaskbarNotificationBackend(QObject* parent) : AbstractNotificationBackend(parent) { NotificationSettings notificationSettings; @@ -41,44 +41,39 @@ TaskbarNotificationBackend::TaskbarNotificationBackend(QObject *parent) notificationSettings.notify("Taskbar/Timeout", this, &TaskbarNotificationBackend::timeoutChanged); } - -void TaskbarNotificationBackend::notify(const Notification ¬ification) +void TaskbarNotificationBackend::notify(const Notification& notification) { if (_enabled && (notification.type == Highlight || notification.type == PrivMsg)) { QApplication::alert(QtUi::mainWindow(), _timeout); } } - void TaskbarNotificationBackend::close(uint notificationId) { Q_UNUSED(notificationId); } - -void TaskbarNotificationBackend::enabledChanged(const QVariant &v) +void TaskbarNotificationBackend::enabledChanged(const QVariant& v) { _enabled = v.toBool(); } - -void TaskbarNotificationBackend::timeoutChanged(const QVariant &v) +void TaskbarNotificationBackend::timeoutChanged(const QVariant& v) { _timeout = v.toInt(); } - -SettingsPage *TaskbarNotificationBackend::createConfigWidget() const +SettingsPage* TaskbarNotificationBackend::createConfigWidget() const { return new ConfigWidget(); } - /***************************************************************************/ -TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "TaskbarNotification", parent) +TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget* parent) + : SettingsPage("Internal", "TaskbarNotification", parent) { - auto *layout = new QHBoxLayout(this); + auto* layout = new QHBoxLayout(this); #ifdef Q_OS_MAC layout->addWidget(enabledBox = new QCheckBox(tr("Activate dock entry, timeout:"), this)); #else @@ -100,20 +95,18 @@ TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : Settin connect(timeoutBox, selectOverload(&QSpinBox::valueChanged), this, &ConfigWidget::widgetChanged); } - void TaskbarNotificationBackend::ConfigWidget::widgetChanged() { - bool changed = (enabled != enabledBox->isChecked() || timeout/1000 != timeoutBox->value()); - if (changed != hasChanged()) setChangedState(changed); + bool changed = (enabled != enabledBox->isChecked() || timeout / 1000 != timeoutBox->value()); + if (changed != hasChanged()) + setChangedState(changed); } - bool TaskbarNotificationBackend::ConfigWidget::hasDefaults() const { return true; } - void TaskbarNotificationBackend::ConfigWidget::defaults() { enabledBox->setChecked(true); @@ -121,7 +114,6 @@ void TaskbarNotificationBackend::ConfigWidget::defaults() widgetChanged(); } - void TaskbarNotificationBackend::ConfigWidget::load() { NotificationSettings s; @@ -129,12 +121,11 @@ void TaskbarNotificationBackend::ConfigWidget::load() timeout = s.value("Taskbar/Timeout", 0).toInt(); enabledBox->setChecked(enabled); - timeoutBox->setValue(timeout/1000); + timeoutBox->setValue(timeout / 1000); setChangedState(false); } - void TaskbarNotificationBackend::ConfigWidget::save() { NotificationSettings s;