/***************************************************************************
- * Copyright (C) 2005-2018 by the Quassel Project *
+ * Copyright (C) 2005-2019 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "mainwin.h"
#include "qtui.h"
-TaskbarNotificationBackend::TaskbarNotificationBackend(QObject *parent)
+TaskbarNotificationBackend::TaskbarNotificationBackend(QObject* parent)
: AbstractNotificationBackend(parent)
{
NotificationSettings notificationSettings;
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
connect(timeoutBox, selectOverload<int>(&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);
widgetChanged();
}
-
void TaskbarNotificationBackend::ConfigWidget::load()
{
NotificationSettings s;
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;