UI: Update tray icons to use masks on macOS
parent
3e7e99e0f3
commit
35e6f5e17a
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
|
@ -11,8 +11,11 @@
|
||||||
<file>images/down.svg</file>
|
<file>images/down.svg</file>
|
||||||
<file>images/up.svg</file>
|
<file>images/up.svg</file>
|
||||||
<file>images/obs.png</file>
|
<file>images/obs.png</file>
|
||||||
|
<file>images/obs_macos.png</file>
|
||||||
<file>images/obs_paused.png</file>
|
<file>images/obs_paused.png</file>
|
||||||
|
<file>images/obs_paused_macos.png</file>
|
||||||
<file>images/tray_active.png</file>
|
<file>images/tray_active.png</file>
|
||||||
|
<file>images/tray_active_macos.png</file>
|
||||||
<file>images/expand.svg</file>
|
<file>images/expand.svg</file>
|
||||||
<file>images/unlocked.svg</file>
|
<file>images/unlocked.svg</file>
|
||||||
<file>images/locked.svg</file>
|
<file>images/locked.svg</file>
|
||||||
|
|
|
@ -5619,10 +5619,19 @@ inline void OBSBasic::OnActivate()
|
||||||
App()->IncrementSleepInhibition();
|
App()->IncrementSleepInhibition();
|
||||||
UpdateProcessPriority();
|
UpdateProcessPriority();
|
||||||
|
|
||||||
if (trayIcon && trayIcon->isVisible())
|
if (trayIcon && trayIcon->isVisible()) {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
QIcon trayMask =
|
||||||
|
QIcon(":/res/images/tray_active_macos.png");
|
||||||
|
trayMask.setIsMask(true);
|
||||||
|
trayIcon->setIcon(
|
||||||
|
QIcon::fromTheme("obs-tray", trayMask));
|
||||||
|
#else
|
||||||
trayIcon->setIcon(QIcon::fromTheme(
|
trayIcon->setIcon(QIcon::fromTheme(
|
||||||
"obs-tray-active",
|
"obs-tray-active",
|
||||||
QIcon(":/res/images/tray_active.png")));
|
QIcon(":/res/images/tray_active.png")));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5637,19 +5646,42 @@ inline void OBSBasic::OnDeactivate()
|
||||||
App()->DecrementSleepInhibition();
|
App()->DecrementSleepInhibition();
|
||||||
ClearProcessPriority();
|
ClearProcessPriority();
|
||||||
|
|
||||||
if (trayIcon && trayIcon->isVisible())
|
if (trayIcon && trayIcon->isVisible()) {
|
||||||
trayIcon->setIcon(QIcon::fromTheme(
|
#ifdef __APPLE__
|
||||||
"obs-tray", QIcon(":/res/images/obs.png")));
|
QIcon trayIconFile =
|
||||||
|
QIcon(":/res/images/obs_macos.png");
|
||||||
|
trayIconFile.setIsMask(true);
|
||||||
|
#else
|
||||||
|
QIcon trayIconFile = QIcon(":/res/images/obs.png");
|
||||||
|
#endif
|
||||||
|
trayIcon->setIcon(
|
||||||
|
QIcon::fromTheme("obs-tray", trayIconFile));
|
||||||
|
}
|
||||||
} else if (outputHandler->Active() && trayIcon &&
|
} else if (outputHandler->Active() && trayIcon &&
|
||||||
trayIcon->isVisible()) {
|
trayIcon->isVisible()) {
|
||||||
if (os_atomic_load_bool(&recording_paused))
|
if (os_atomic_load_bool(&recording_paused)) {
|
||||||
trayIcon->setIcon(QIcon::fromTheme(
|
#ifdef __APPLE__
|
||||||
"obs-tray-paused",
|
QIcon trayIconFile =
|
||||||
QIcon(":/res/images/obs_paused.png")));
|
QIcon(":/res/images/obs_paused_macos.png");
|
||||||
else
|
trayIconFile.setIsMask(true);
|
||||||
trayIcon->setIcon(QIcon::fromTheme(
|
#else
|
||||||
"obs-tray-active",
|
QIcon trayIconFile =
|
||||||
QIcon(":/res/images/tray_active.png")));
|
QIcon(":/res/images/obs_paused.png");
|
||||||
|
#endif
|
||||||
|
trayIcon->setIcon(QIcon::fromTheme("obs-tray-paused",
|
||||||
|
trayIconFile));
|
||||||
|
} else {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
QIcon trayIconFile =
|
||||||
|
QIcon(":/res/images/tray_active_macos.png");
|
||||||
|
trayIconFile.setIsMask(true);
|
||||||
|
#else
|
||||||
|
QIcon trayIconFile =
|
||||||
|
QIcon(":/res/images/tray_active.png");
|
||||||
|
#endif
|
||||||
|
trayIcon->setIcon(QIcon::fromTheme("obs-tray-active",
|
||||||
|
trayIconFile));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7536,9 +7568,14 @@ void OBSBasic::ToggleShowHide()
|
||||||
|
|
||||||
void OBSBasic::SystemTrayInit()
|
void OBSBasic::SystemTrayInit()
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
QIcon trayIconFile = QIcon(":/res/images/obs_macos.png");
|
||||||
|
trayIconFile.setIsMask(true);
|
||||||
|
#else
|
||||||
|
QIcon trayIconFile = QIcon(":/res/images/obs.png");
|
||||||
|
#endif
|
||||||
trayIcon.reset(new QSystemTrayIcon(
|
trayIcon.reset(new QSystemTrayIcon(
|
||||||
QIcon::fromTheme("obs-tray", QIcon(":/res/images/obs.png")),
|
QIcon::fromTheme("obs-tray", trayIconFile), this));
|
||||||
this));
|
|
||||||
trayIcon->setToolTip("OBS Studio");
|
trayIcon->setToolTip("OBS Studio");
|
||||||
|
|
||||||
showHide = new QAction(QTStr("Basic.SystemTray.Show"), trayIcon.data());
|
showHide = new QAction(QTStr("Basic.SystemTray.Show"), trayIcon.data());
|
||||||
|
@ -8114,10 +8151,18 @@ void OBSBasic::PauseRecording()
|
||||||
|
|
||||||
ui->statusbar->RecordingPaused();
|
ui->statusbar->RecordingPaused();
|
||||||
|
|
||||||
if (trayIcon && trayIcon->isVisible())
|
if (trayIcon && trayIcon->isVisible()) {
|
||||||
trayIcon->setIcon(QIcon::fromTheme(
|
#ifdef __APPLE__
|
||||||
"obs-tray-paused",
|
QIcon trayIconFile =
|
||||||
QIcon(":/res/images/obs_paused.png")));
|
QIcon(":/res/images/obs_paused_macos.png");
|
||||||
|
trayIconFile.setIsMask(true);
|
||||||
|
#else
|
||||||
|
QIcon trayIconFile =
|
||||||
|
QIcon(":/res/images/obs_paused.png");
|
||||||
|
#endif
|
||||||
|
trayIcon->setIcon(QIcon::fromTheme("obs-tray-paused",
|
||||||
|
trayIconFile));
|
||||||
|
}
|
||||||
|
|
||||||
os_atomic_set_bool(&recording_paused, true);
|
os_atomic_set_bool(&recording_paused, true);
|
||||||
|
|
||||||
|
@ -8145,10 +8190,18 @@ void OBSBasic::UnpauseRecording()
|
||||||
|
|
||||||
ui->statusbar->RecordingUnpaused();
|
ui->statusbar->RecordingUnpaused();
|
||||||
|
|
||||||
if (trayIcon && trayIcon->isVisible())
|
if (trayIcon && trayIcon->isVisible()) {
|
||||||
trayIcon->setIcon(QIcon::fromTheme(
|
#ifdef __APPLE__
|
||||||
"obs-tray-active",
|
QIcon trayIconFile =
|
||||||
QIcon(":/res/images/tray_active.png")));
|
QIcon(":/res/images/tray_active_macos.png");
|
||||||
|
trayIconFile.setIsMask(true);
|
||||||
|
#else
|
||||||
|
QIcon trayIconFile =
|
||||||
|
QIcon(":/res/images/tray_active.png");
|
||||||
|
#endif
|
||||||
|
trayIcon->setIcon(QIcon::fromTheme("obs-tray-active",
|
||||||
|
trayIconFile));
|
||||||
|
}
|
||||||
|
|
||||||
os_atomic_set_bool(&recording_paused, false);
|
os_atomic_set_bool(&recording_paused, false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue