Add an option to disable inactive status blinking
Some checks failed
debian-build / build (push) Has been cancelled
Check locale / ubuntu64 (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled

This commit is contained in:
nanopink
2026-10-25 00:44:06 -04:00
committed by WarmUpTill
parent a5c663230b
commit 00ddbe2646
9 changed files with 56 additions and 16 deletions

View File

@@ -338,6 +338,12 @@ bool HighlightUIElementsEnabled()
return GetSwitcher() && !GetSwitcher()->disableHints;
}
bool InactiveStatusBlinkEnabled()
{
return HighlightUIElementsEnabled() &&
!GetSwitcher()->disableInactiveStatusBlink;
}
bool OBSIsShuttingDown()
{
return !GetSwitcher() || GetSwitcher()->obsIsShuttingDown;

View File

@@ -49,6 +49,7 @@ EXPORT std::string PreviousForegroundWindowTitle();
EXPORT bool SettingsWindowIsOpened();
EXPORT bool HighlightUIElementsEnabled();
EXPORT bool InactiveStatusBlinkEnabled();
EXPORT bool OBSIsShuttingDown();
EXPORT bool InitialLoadIsComplete();

View File

@@ -134,17 +134,13 @@ void StatusControl::ButtonClicked()
void StatusControl::UpdateStatus()
{
if (PluginIsRunning()) {
if (!_setToStopped) {
return;
}
const bool running = PluginIsRunning();
if (running && _setToStopped) {
SetStarted();
} else {
if (_setToStopped) {
return;
}
} else if (!running && !_setToStopped) {
SetStopped();
}
UpdateStatusHighlight();
}
void StatusControl::SetStarted()
@@ -152,12 +148,9 @@ void StatusControl::SetStarted()
_button->setText(
obs_module_text("AdvSceneSwitcher.generalTab.status.stop"));
_status->setText(obs_module_text("AdvSceneSwitcher.status.active"));
if (_pulse) {
_pulse->deleteLater();
_pulse = nullptr;
}
SetStatusStyleSheet(false);
_setToStopped = false;
UpdateStatusHighlight();
}
void StatusControl::SetStopped()
@@ -166,11 +159,21 @@ void StatusControl::SetStopped()
obs_module_text("AdvSceneSwitcher.generalTab.status.start"));
_status->setText(obs_module_text("AdvSceneSwitcher.status.inactive"));
SetStatusStyleSheet(true);
if (HighlightUIElementsEnabled()) {
_pulse = HighlightWidget(_status, QColor(Qt::red),
QColor(0, 0, 0, 0));
}
_setToStopped = true;
UpdateStatusHighlight();
}
void StatusControl::UpdateStatusHighlight()
{
if (_setToStopped && InactiveStatusBlinkEnabled()) {
if (!_pulse) {
_pulse = HighlightWidget(_status, QColor(Qt::red),
QColor(0, 0, 0, 0));
}
} else if (_pulse) {
delete _pulse;
_pulse = nullptr;
}
}
void StatusControl::SetStatusStyleSheet(bool stopped) const

View File

@@ -25,6 +25,7 @@ private:
void SetStopped();
void SetStarted();
void SetStatusStyleSheet(bool stopped) const;
void UpdateStatusHighlight();
QPushButton *_button;
QHBoxLayout *_buttonLayout;