mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-16 12:37:15 -04:00
UI: Set correct text in system tray on startup
The system tray assumed all outputs are inactive when it's initiated, however outputs can be active if started via command line options. This caused the wrong (only) text to be set if the output was in fact active.
This commit is contained in:
@@ -6478,9 +6478,9 @@ static inline void ClearProcessPriority()
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
inline void OBSBasic::OnActivate()
|
||||
inline void OBSBasic::OnActivate(bool force)
|
||||
{
|
||||
if (ui->profileMenu->isEnabled()) {
|
||||
if (ui->profileMenu->isEnabled() || force) {
|
||||
ui->profileMenu->setEnabled(false);
|
||||
ui->autoConfigure->setEnabled(false);
|
||||
App()->IncrementSleepInhibition();
|
||||
@@ -8862,14 +8862,22 @@ void OBSBasic::SystemTrayInit()
|
||||
trayIcon->setToolTip("OBS Studio");
|
||||
|
||||
showHide = new QAction(QTStr("Basic.SystemTray.Show"), trayIcon.data());
|
||||
sysTrayStream = new QAction(QTStr("Basic.Main.StartStreaming"),
|
||||
trayIcon.data());
|
||||
sysTrayRecord = new QAction(QTStr("Basic.Main.StartRecording"),
|
||||
trayIcon.data());
|
||||
sysTrayReplayBuffer = new QAction(QTStr("Basic.Main.StartReplayBuffer"),
|
||||
trayIcon.data());
|
||||
sysTrayVirtualCam = new QAction(QTStr("Basic.Main.StartVirtualCam"),
|
||||
trayIcon.data());
|
||||
sysTrayStream = new QAction(
|
||||
StreamingActive() ? QTStr("Basic.Main.StopStreaming")
|
||||
: QTStr("Basic.Main.StartStreaming"),
|
||||
trayIcon.data());
|
||||
sysTrayRecord = new QAction(
|
||||
RecordingActive() ? QTStr("Basic.Main.StopRecording")
|
||||
: QTStr("Basic.Main.StartRecording"),
|
||||
trayIcon.data());
|
||||
sysTrayReplayBuffer = new QAction(
|
||||
ReplayBufferActive() ? QTStr("Basic.Main.StopReplayBuffer")
|
||||
: QTStr("Basic.Main.StartReplayBuffer"),
|
||||
trayIcon.data());
|
||||
sysTrayVirtualCam = new QAction(
|
||||
VirtualCamActive() ? QTStr("Basic.Main.StopVirtualCam")
|
||||
: QTStr("Basic.Main.StartVirtualCam"),
|
||||
trayIcon.data());
|
||||
exit = new QAction(QTStr("Exit"), trayIcon.data());
|
||||
|
||||
trayMenu = new QMenu;
|
||||
@@ -8895,6 +8903,9 @@ void OBSBasic::SystemTrayInit()
|
||||
|
||||
sysTrayVirtualCam->setEnabled(vcamEnabled);
|
||||
|
||||
if (Active())
|
||||
OnActivate(true);
|
||||
|
||||
connect(trayIcon.data(),
|
||||
SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
|
||||
SLOT(IconActivated(QSystemTrayIcon::ActivationReason)));
|
||||
@@ -9500,6 +9511,13 @@ bool OBSBasic::ReplayBufferActive()
|
||||
return outputHandler->ReplayBufferActive();
|
||||
}
|
||||
|
||||
bool OBSBasic::VirtualCamActive()
|
||||
{
|
||||
if (!outputHandler)
|
||||
return false;
|
||||
return outputHandler->VirtualCamActive();
|
||||
}
|
||||
|
||||
SceneRenameDelegate::SceneRenameDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user