From 6c542acc091a1580c935acd6a00217c880b0453e Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 10 Nov 2023 12:13:12 +0200 Subject: [PATCH] Allow running on systems without systray support Signed-off-by: falkTX --- systray/main.cpp | 5 ----- systray/mod-app.hpp | 10 +++++++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/systray/main.cpp b/systray/main.cpp index 18b4e92..ecdb0ec 100644 --- a/systray/main.cpp +++ b/systray/main.cpp @@ -93,11 +93,6 @@ int main(int argc, char* argv[]) app.setOrganizationName("MOD Audio"); app.setWindowIcon(QIcon(":/mod-logo.svg")); - if (! QSystemTrayIcon::isSystemTrayAvailable()) - { - return 1; - } - #ifdef _WIN32 SetEnvironmentVariableW(L"LANG", L"en_US.UTF-8"); diff --git a/systray/mod-app.hpp b/systray/mod-app.hpp index 036b57e..17b76e1 100644 --- a/systray/mod-app.hpp +++ b/systray/mod-app.hpp @@ -549,7 +549,15 @@ class AppWindow : public QMainWindow QTimer::singleShot(100, this, &AppWindow::start); } - QTimer::singleShot(1, systray, &QSystemTrayIcon::show); + if (QSystemTrayIcon::isSystemTrayAvailable()) + { + QTimer::singleShot(1, systray, &QSystemTrayIcon::show); + } + else + { + ui.cb_systray->setChecked(false); + ui.cb_systray->hide(); + } } void setStarting()