Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jan 7, 2025
1 parent 56269d2 commit 9b2baca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
18 changes: 7 additions & 11 deletions src/mumble/widgets/TrayIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <QApplication>

TrayIcon::TrayIcon() : QSystemTrayIcon(Global::get().mw), m_statusIcon(Global::get().mw->qiIcon) {
applyIcon(m_statusIcon);
setIcon(m_statusIcon);

setToolTip("Mumble");

Expand Down Expand Up @@ -96,7 +96,7 @@ void TrayIcon::on_icon_update() {

if (&newIcon.get() != &m_statusIcon.get()) {
m_statusIcon = newIcon;
applyIcon(m_statusIcon);
setIcon(m_statusIcon);
}
}

Expand Down Expand Up @@ -137,11 +137,6 @@ void TrayIcon::updateContextMenu() {
m_contextMenu->addAction(Global::get().mw->qaQuit);
}

void TrayIcon::applyIcon(QIcon &icon) {
setIcon(icon);
m_currentIcon = &icon;
}

void TrayIcon::on_toggleShowHide() {
if (Global::get().mw->isVisible() && !Global::get().mw->isMinimized()) {
on_hideAction_triggered();
Expand Down Expand Up @@ -195,7 +190,7 @@ void TrayIcon::on_tray_unhighlight() {
}

m_highlightTimer->stop();
applyIcon(m_statusIcon);
setIcon(m_statusIcon);
}

void TrayIcon::on_timer_triggered() {
Expand All @@ -208,11 +203,12 @@ void TrayIcon::on_timer_triggered() {
// by blinking the application in the task bar - is invisible
// if the application is hidden to tray.

if (m_currentIcon == &m_statusIcon.get()) {
applyIcon(Global::get().mw->m_iconInformation);
if (!m_blinkingIcon) {
setIcon(Global::get().mw->m_iconInformation);
m_highlightTimer->start(500);
} else {
applyIcon(m_statusIcon);
setIcon(m_statusIcon);
m_highlightTimer->start(2000);
}
m_blinkingIcon = !m_blinkingIcon;
}
3 changes: 1 addition & 2 deletions src/mumble/widgets/TrayIcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ public slots:

private:
std::reference_wrapper< QIcon > m_statusIcon;
QIcon *m_currentIcon = nullptr;
bool m_blinkingIcon = false;
QMenu *m_contextMenu = nullptr;
QAction *m_showAction = nullptr;
QAction *m_hideAction = nullptr;
QTimer *m_highlightTimer = nullptr;

void updateContextMenu();
void applyIcon(QIcon &icon);

private slots:
void on_icon_clicked(QSystemTrayIcon::ActivationReason reason);
Expand Down

0 comments on commit 9b2baca

Please sign in to comment.