Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jun 26, 2024
1 parent 1e634f2 commit 6d88c2b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/mumble/widgets/TrayIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "../Global.h"

#include <QApplication>
#include <QDebug>

TrayIcon::TrayIcon()
: QSystemTrayIcon(Global::get().mw), m_statusIcon(Global::get().mw->qiIcon), m_currentIcon(nullptr) {
Expand Down Expand Up @@ -46,7 +47,7 @@ TrayIcon::TrayIcon()
}

void TrayIcon::updateIcon() {
QIcon newIcon;
QIcon &newIcon = Global::get().mw->qiIcon;

ClientUser *p = ClientUser::get(Global::get().uiSession);

Expand Down Expand Up @@ -79,11 +80,11 @@ void TrayIcon::updateIcon() {
newIcon = Global::get().mw->qiTalkingOff;
break;
}
} else {
newIcon = Global::get().mw->qiIcon;
}

if (&newIcon != &m_statusIcon.get()) {
qDebug() << "new icon: " << &newIcon << " status icon: " << &m_statusIcon.get();

if (&newIcon.get() != &m_statusIcon.get()) {
m_statusIcon = newIcon;
applyIcon(m_statusIcon);
}
Expand Down Expand Up @@ -129,6 +130,7 @@ void TrayIcon::updateContextMenu() {
void TrayIcon::applyIcon(QIcon &icon) {
setIcon(icon);
m_currentIcon = &icon;
qDebug() << "current icon set to " << m_currentIcon;
}

void TrayIcon::toggleShowHide() {
Expand Down Expand Up @@ -184,10 +186,14 @@ void TrayIcon::unhighlight() {
}

void TrayIcon::on_timer_triggered() {
qDebug() << "current icon: " << m_currentIcon << " status icon: " << &m_statusIcon.get();

if (m_currentIcon == &m_statusIcon.get()) {
qDebug() << "Switch to I";
applyIcon(Global::get().mw->m_iconInformation);
m_highlightTimer->start(500);
} else {
qDebug() << "Switch to status";
applyIcon(m_statusIcon);
m_highlightTimer->start(2000);
}
Expand Down

0 comments on commit 6d88c2b

Please sign in to comment.