mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-11-15 03:36:53 -06:00
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
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:
@@ -338,6 +338,12 @@ bool HighlightUIElementsEnabled()
|
||||
return GetSwitcher() && !GetSwitcher()->disableHints;
|
||||
}
|
||||
|
||||
bool InactiveStatusBlinkEnabled()
|
||||
{
|
||||
return HighlightUIElementsEnabled() &&
|
||||
!GetSwitcher()->disableInactiveStatusBlink;
|
||||
}
|
||||
|
||||
bool OBSIsShuttingDown()
|
||||
{
|
||||
return !GetSwitcher() || GetSwitcher()->obsIsShuttingDown;
|
||||
|
||||
@@ -49,6 +49,7 @@ EXPORT std::string PreviousForegroundWindowTitle();
|
||||
|
||||
EXPORT bool SettingsWindowIsOpened();
|
||||
EXPORT bool HighlightUIElementsEnabled();
|
||||
EXPORT bool InactiveStatusBlinkEnabled();
|
||||
|
||||
EXPORT bool OBSIsShuttingDown();
|
||||
EXPORT bool InitialLoadIsComplete();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -25,6 +25,7 @@ private:
|
||||
void SetStopped();
|
||||
void SetStarted();
|
||||
void SetStatusStyleSheet(bool stopped) const;
|
||||
void UpdateStatusHighlight();
|
||||
|
||||
QPushButton *_button;
|
||||
QHBoxLayout *_buttonLayout;
|
||||
|
||||
Reference in New Issue
Block a user