Skip to content

Commit

Permalink
Do not send tray notification if user exit program from tray on first…
Browse files Browse the repository at this point in the history
… launch
  • Loading branch information
Odizinne committed Sep 15, 2024
1 parent 6b595ed commit f36e1e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/HeadsetControlQt/headsetcontrolqt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ HeadsetControlQt::HeadsetControlQt(QWidget *parent)
, notificationSent(false)
, soundNotificationSent(false)
, firstRun(false)
, closing(false)
, worker(new Worker())
{
ui->setupUi(this);
Expand Down Expand Up @@ -529,13 +530,18 @@ void HeadsetControlQt::trayIconActivated(QSystemTrayIcon::ActivationReason reaso

void HeadsetControlQt::closeEvent(QCloseEvent *event)
{
closing = true;
event->accept();
trayIcon->contextMenu()->actions().first()->setText(tr("Show"));
sendFirstMinimizeNotification();
}

void HeadsetControlQt::sendFirstMinimizeNotification()
{
if (closing) {
return;
}

if (firstRun) {
sendNotification(tr("HeadsetControl-Qt"), QString(tr("The application is still running in the background.")), QIcon(":/icons/icon.png"), 5000);
firstRun = false;
Expand Down
1 change: 1 addition & 0 deletions src/HeadsetControlQt/headsetcontrolqt.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private slots:
bool notificationSent;
bool soundNotificationSent;
bool firstRun;
bool closing;

QThread workerThread;
Worker *worker;
Expand Down

0 comments on commit f36e1e6

Please sign in to comment.