/***************************************************************************
- * Copyright (C) 2005-2018 by the Quassel Project *
+ * Copyright (C) 2005-2020 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This file is free software; you can redistribute it and/or modify *
#include "icon.h"
#include "qtui.h"
-SystemTray::SystemTray(QWidget *parent)
- : QObject(parent),
- _associatedWidget(parent)
+SystemTray::SystemTray(QWidget* parent)
+ : QObject(parent)
+ , _associatedWidget(parent)
{
Q_ASSERT(parent);
- NotificationSettings{}.initAndNotify("Systray/ChangeColor", this, SLOT(enableChangeColorChanged(QVariant)), true);
- NotificationSettings{}.initAndNotify("Systray/Animate", this, SLOT(enableBlinkChanged(QVariant)), false);
- UiStyleSettings{}.initAndNotify("Icons/InvertTray", this, SLOT(invertTrayIconChanged(QVariant)), false);
+ NotificationSettings{}.initAndNotify("Systray/ChangeColor", this, &SystemTray::enableChangeColorChanged, true);
+ NotificationSettings{}.initAndNotify("Systray/Animate", this, &SystemTray::enableBlinkChanged, false);
+ UiStyleSettings{}.initAndNotify("Icons/InvertTray", this, &SystemTray::invertTrayIconChanged, false);
- ActionCollection *coll = QtUi::actionCollection("General");
- _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, SLOT(minimizeRestore()));
+ ActionCollection* coll = QtUi::actionCollection("General");
+ _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, &SystemTray::minimizeRestore);
_trayMenu = new QMenu(associatedWidget());
_trayMenu->setTitle("Quassel IRC");
connect(&_blinkTimer, &QTimer::timeout, this, &SystemTray::onBlinkTimeout);
}
-
SystemTray::~SystemTray()
{
_trayMenu->deleteLater();
}
-
-QWidget *SystemTray::associatedWidget() const
+QWidget* SystemTray::associatedWidget() const
{
return _associatedWidget;
}
-
bool SystemTray::isSystemTrayAvailable() const
{
return false;
}
-
bool SystemTray::isVisible() const
{
return _isVisible;
}
-
void SystemTray::setVisible(bool visible)
{
if (visible != _isVisible) {
}
}
-
SystemTray::Mode SystemTray::mode() const
{
return _mode;
}
-
void SystemTray::setMode(Mode mode)
{
if (mode != _mode) {
}
}
-
SystemTray::State SystemTray::state() const
{
return _state;
}
-
void SystemTray::setState(State state)
{
if (_state != state) {
}
}
-
QString SystemTray::iconName(State state) const
{
QString name;
return name;
}
-
QString SystemTray::currentIconName() const
{
if (state() == State::NeedsAttention) {
}
}
-
QString SystemTray::currentAttentionIconName() const
{
if (state() == State::NeedsAttention && _attentionBehavior == AttentionBehavior::Blink && !_blinkState) {
return iconName(State::NeedsAttention);
}
-
bool SystemTray::isAlerted() const
{
return state() == State::NeedsAttention;
}
-
void SystemTray::setAlert(bool alerted)
{
if (alerted) {
}
}
-
void SystemTray::onBlinkTimeout()
{
_blinkState = !_blinkState;
emit currentIconNameChanged();
}
-
-QMenu *SystemTray::trayMenu() const
+QMenu* SystemTray::trayMenu() const
{
return _trayMenu;
}
-
void SystemTray::trayMenuAboutToShow()
{
if (GraphicalUi::isMainWidgetVisible())
_minimizeRestoreAction->setText(tr("&Restore"));
}
-
-void SystemTray::enableChangeColorChanged(const QVariant &v)
+void SystemTray::enableChangeColorChanged(const QVariant& v)
{
if (v.toBool()) {
_attentionBehavior = AttentionBehavior::ChangeColor;
emit currentIconNameChanged();
}
-
-void SystemTray::enableBlinkChanged(const QVariant &v)
+void SystemTray::enableBlinkChanged(const QVariant& v)
{
if (v.toBool()) {
_attentionBehavior = AttentionBehavior::Blink;
emit currentIconNameChanged();
}
-
-void SystemTray::invertTrayIconChanged(const QVariant &v)
+void SystemTray::invertTrayIconChanged(const QVariant& v)
{
_trayIconInverted = v.toBool();
emit iconsChanged();
}
-
QString SystemTray::toolTipTitle() const
{
return _toolTipTitle;
}
-
QString SystemTray::toolTipSubTitle() const
{
return _toolTipSubTitle;
}
-
-void SystemTray::setToolTip(const QString &title, const QString &subtitle)
+void SystemTray::setToolTip(const QString& title, const QString& subtitle)
{
_toolTipTitle = title;
_toolTipSubTitle = subtitle;
emit toolTipChanged(title, subtitle);
}
-
-void SystemTray::showMessage(const QString &title, const QString &message, MessageIcon icon, int millisecondsTimeoutHint, uint id)
+void SystemTray::showMessage(const QString& title, const QString& message, MessageIcon icon, int millisecondsTimeoutHint, uint id)
{
Q_UNUSED(title)
Q_UNUSED(message)
Q_UNUSED(id)
}
-
void SystemTray::closeMessage(uint notificationId)
{
Q_UNUSED(notificationId)
}
-
void SystemTray::activate(SystemTray::ActivationReason reason)
{
emit activated(reason);
}
-
void SystemTray::minimizeRestore()
{
GraphicalUi::toggleMainWidget();