UI: Clarify system tray code

If the tray is disabled in settings, we no longer allow the command line
parameter to override it and create a tray icon regardless. This matches
the behavior in the UI, where "minimize to tray on startup" becomes
unavailable if the "tray enabled" setting is unselected.
This commit is contained in:
Richard Stanway 2020-09-27 19:19:15 +02:00
parent e8c3ad1482
commit 76fcfa9ed3

View file

@ -7592,12 +7592,11 @@ void OBSBasic::SystemTray(bool firstStarted)
if (firstStarted)
SystemTrayInit();
if (!sysTrayWhenStarted && !sysTrayEnabled) {
if (!sysTrayEnabled) {
trayIcon->hide();
} else if ((sysTrayWhenStarted && sysTrayEnabled) ||
opt_minimize_tray) {
} else {
trayIcon->show();
if (firstStarted) {
if (firstStarted && (sysTrayWhenStarted || opt_minimize_tray)) {
QTimer::singleShot(50, this, SLOT(hide()));
EnablePreviewDisplay(false);
setVisible(false);
@ -7606,12 +7605,6 @@ void OBSBasic::SystemTray(bool firstStarted)
#endif
opt_minimize_tray = false;
}
} else if (sysTrayEnabled) {
trayIcon->show();
} else if (!sysTrayEnabled) {
trayIcon->hide();
} else if (!sysTrayWhenStarted && sysTrayEnabled) {
trayIcon->hide();
}
if (isVisible())