From c75759cb75008788f211cb6db58a38e8366bf88b Mon Sep 17 00:00:00 2001 From: "William L. DeRieux IV" Date: Thu, 25 Jun 2020 08:51:26 -0400 Subject: [PATCH] Birdtray fails to start while waiting for the SystemTray to become available. Per the QT documentation for QT4 & 5: https://doc.qt.io/qt-5/qsystemtrayicon.html#isSystemTrayAvailable The system tray icon will be automatically added if the system tray is visible (even if it was not available at launch). Fixes issue #357 --- src/birdtrayapp.cpp | 16 ---------------- src/birdtrayapp.h | 4 ---- 2 files changed, 20 deletions(-) diff --git a/src/birdtrayapp.cpp b/src/birdtrayapp.cpp index 847b4d38..b446a96e 100644 --- a/src/birdtrayapp.cpp +++ b/src/birdtrayapp.cpp @@ -62,7 +62,6 @@ BirdtrayApp::BirdtrayApp(int &argc, char** argv) : QApplication(argc, argv) Log::debug( "Birdtray version %d.%d.%d started", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH ); - ensureSystemTrayAvailable(); // Load settings settings = new Settings(); if (commandLineParser.isSet("reset-settings")) { @@ -255,18 +254,3 @@ void BirdtrayApp::onSecondInstanceCommand(QLocalSocket* clientSocket) { trayIcon->showSettings(); } } - -void BirdtrayApp::ensureSystemTrayAvailable() { - int passed = 0; - while (!QSystemTrayIcon::isSystemTrayAvailable()) { - if (passed == 0) { - qDebug("Waiting for system tray to become available"); - } - passed++; - if (passed > 120) { - Log::fatal( QApplication::tr("Sorry, system tray cannot be controlled " - "through this add-on on your operating system.") ); - } - QThread::msleep(500); - } -} diff --git a/src/birdtrayapp.h b/src/birdtrayapp.h index c2279a22..92b15af4 100644 --- a/src/birdtrayapp.h +++ b/src/birdtrayapp.h @@ -154,10 +154,6 @@ protected Q_SLOTS: */ void onSecondInstanceCommand(QLocalSocket* clientSocket); - /** - * Wait for the system tray to become available and exit if it doesn't within 60 seconds. - */ - static void ensureSystemTrayAvailable(); };