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:
parent
ea90b93c33
commit
c565bcaf54
@ -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)
|
||||
{
|
||||
|
@ -482,7 +482,7 @@ private:
|
||||
|
||||
int disableOutputsRef = 0;
|
||||
|
||||
inline void OnActivate();
|
||||
inline void OnActivate(bool force = false);
|
||||
inline void OnDeactivate();
|
||||
|
||||
void AddDropSource(const char *file, DropType image);
|
||||
@ -1107,6 +1107,7 @@ public slots:
|
||||
bool StreamingActive();
|
||||
bool RecordingActive();
|
||||
bool ReplayBufferActive();
|
||||
bool VirtualCamActive();
|
||||
|
||||
void ClearContextBar();
|
||||
void UpdateContextBar(bool force = false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user