X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsystemtray.cpp;h=9c56d1f22aae5b1d365eef4228469e121ebfe9eb;hp=b7cac7414366da68244db8d95931b21f4181315a;hb=e38846f054ad1766f2e91992a57bbaffd33c7c06;hpb=2c8434f74c68194d56f2084f637419123e61d18b diff --git a/src/qtui/systemtray.cpp b/src/qtui/systemtray.cpp index b7cac741..9c56d1f2 100644 --- a/src/qtui/systemtray.cpp +++ b/src/qtui/systemtray.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This file is free software; you can redistribute it and/or modify * @@ -29,9 +29,9 @@ #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); @@ -39,7 +39,7 @@ SystemTray::SystemTray(QWidget *parent) NotificationSettings{}.initAndNotify("Systray/Animate", this, &SystemTray::enableBlinkChanged, false); UiStyleSettings{}.initAndNotify("Icons/InvertTray", this, &SystemTray::invertTrayIconChanged, false); - ActionCollection *coll = QtUi::actionCollection("General"); + ActionCollection* coll = QtUi::actionCollection("General"); _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, &SystemTray::minimizeRestore); _trayMenu = new QMenu(associatedWidget()); @@ -61,31 +61,26 @@ SystemTray::SystemTray(QWidget *parent) 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) { @@ -94,13 +89,11 @@ void SystemTray::setVisible(bool visible) } } - SystemTray::Mode SystemTray::mode() const { return _mode; } - void SystemTray::setMode(Mode mode) { if (mode != _mode) { @@ -109,13 +102,11 @@ void SystemTray::setMode(Mode mode) } } - SystemTray::State SystemTray::state() const { return _state; } - void SystemTray::setState(State state) { if (_state != state) { @@ -134,7 +125,6 @@ void SystemTray::setState(State state) } } - QString SystemTray::iconName(State state) const { QString name; @@ -157,7 +147,6 @@ QString SystemTray::iconName(State state) const return name; } - QString SystemTray::currentIconName() const { if (state() == State::NeedsAttention) { @@ -174,7 +163,6 @@ QString SystemTray::currentIconName() const } } - QString SystemTray::currentAttentionIconName() const { if (state() == State::NeedsAttention && _attentionBehavior == AttentionBehavior::Blink && !_blinkState) { @@ -183,13 +171,11 @@ QString SystemTray::currentAttentionIconName() const return iconName(State::NeedsAttention); } - bool SystemTray::isAlerted() const { return state() == State::NeedsAttention; } - void SystemTray::setAlert(bool alerted) { if (alerted) { @@ -200,20 +186,17 @@ void SystemTray::setAlert(bool alerted) } } - void SystemTray::onBlinkTimeout() { _blinkState = !_blinkState; emit currentIconNameChanged(); } - -QMenu *SystemTray::trayMenu() const +QMenu* SystemTray::trayMenu() const { return _trayMenu; } - void SystemTray::trayMenuAboutToShow() { if (GraphicalUi::isMainWidgetVisible()) @@ -222,8 +205,7 @@ void SystemTray::trayMenuAboutToShow() _minimizeRestoreAction->setText(tr("&Restore")); } - -void SystemTray::enableChangeColorChanged(const QVariant &v) +void SystemTray::enableChangeColorChanged(const QVariant& v) { if (v.toBool()) { _attentionBehavior = AttentionBehavior::ChangeColor; @@ -236,8 +218,7 @@ void SystemTray::enableChangeColorChanged(const QVariant &v) emit currentIconNameChanged(); } - -void SystemTray::enableBlinkChanged(const QVariant &v) +void SystemTray::enableBlinkChanged(const QVariant& v) { if (v.toBool()) { _attentionBehavior = AttentionBehavior::Blink; @@ -250,35 +231,30 @@ void SystemTray::enableBlinkChanged(const QVariant &v) 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) @@ -287,19 +263,16 @@ void SystemTray::showMessage(const QString &title, const QString &message, Messa 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();