summaryrefslogtreecommitdiffhomepage
path: root/gui/main-window.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-16 22:29:33 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-16 22:29:33 +0200
commit5334c76b834cf7effa21849fff1b0c57cdedb62a (patch)
tree3075144929485759be92a1f65f56675bf4deeb86 /gui/main-window.cpp
parent7586930b5388d4debf9d2b463aa8275a56690afb (diff)
gui, logic: add separate option for starting in tray vs tray enabled
Suggested-by: @MathijsG, #454
Diffstat (limited to 'gui/main-window.cpp')
-rw-r--r--gui/main-window.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index 89235720..0f070cc4 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -687,13 +687,16 @@ void MainWindow::ensure_tray()
}
else
{
- if (isHidden())
+ const bool is_hidden = isHidden() || !isVisible();
+
+ if (is_hidden)
+ {
show();
- if (!isVisible())
setVisible(true);
- raise(); // for OSX
- activateWindow(); // for Windows
+ raise(); // for OSX
+ activateWindow(); // for Windows
+ }
if (tray)
tray->hide();
@@ -824,6 +827,11 @@ bool MainWindow::is_tray_enabled()
return s.tray_enabled && QSystemTrayIcon::isSystemTrayAvailable();
}
+bool MainWindow::start_in_tray()
+{
+ return s.tray_enabled && s.tray_start && QSystemTrayIcon::isSystemTrayAvailable();
+}
+
void MainWindow::set_profile_in_registry(const QString &profile)
{
QSettings settings(OPENTRACK_ORG);