Merge pull request #3339 from Programatic/tray_fix

UI: Fix tray icon appearing when disabled in settings
master
Jim 2020-08-26 00:07:56 -07:00 committed by GitHub
commit 466e5f6a6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -5555,7 +5555,7 @@ inline void OBSBasic::OnActivate()
App()->IncrementSleepInhibition();
UpdateProcessPriority();
if (trayIcon)
if (trayIcon && trayIcon->isVisible())
trayIcon->setIcon(QIcon::fromTheme(
"obs-tray-active",
QIcon(":/res/images/tray_active.png")));
@ -5573,10 +5573,10 @@ inline void OBSBasic::OnDeactivate()
App()->DecrementSleepInhibition();
ClearProcessPriority();
if (trayIcon)
if (trayIcon && trayIcon->isVisible())
trayIcon->setIcon(QIcon::fromTheme(
"obs-tray", QIcon(":/res/images/obs.png")));
} else if (trayIcon) {
} else if (trayIcon && trayIcon->isVisible()) {
if (os_atomic_load_bool(&recording_paused))
trayIcon->setIcon(QIcon(":/res/images/obs_paused.png"));
else
@ -7551,7 +7551,8 @@ void OBSBasic::IconActivated(QSystemTrayIcon::ActivationReason reason)
void OBSBasic::SysTrayNotify(const QString &text,
QSystemTrayIcon::MessageIcon n)
{
if (trayIcon && QSystemTrayIcon::supportsMessages()) {
if (trayIcon && trayIcon->isVisible() &&
QSystemTrayIcon::supportsMessages()) {
QSystemTrayIcon::MessageIcon icon =
QSystemTrayIcon::MessageIcon(n);
trayIcon->showMessage("OBS Studio", text, icon, 10000);
@ -8069,7 +8070,7 @@ void OBSBasic::PauseRecording()
ui->statusbar->RecordingPaused();
if (trayIcon)
if (trayIcon && trayIcon->isVisible())
trayIcon->setIcon(QIcon(":/res/images/obs_paused.png"));
os_atomic_set_bool(&recording_paused, true);
@ -8098,7 +8099,7 @@ void OBSBasic::UnpauseRecording()
ui->statusbar->RecordingUnpaused();
if (trayIcon)
if (trayIcon && trayIcon->isVisible())
trayIcon->setIcon(
QIcon(":/res/images/tray_active.png"));