mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-27 12:25:23 -05:00
Update the UI's status element if the status changed externally (#126)
This commit is contained in:
parent
f4902933ab
commit
499ba7dd21
|
|
@ -129,6 +129,7 @@ void AdvSceneSwitcher::SetStarted()
|
|||
ui->pluginRunningText->setText(
|
||||
obs_module_text("AdvSceneSwitcher.status.active"));
|
||||
ui->pluginRunningText->disconnect(inactivePluse);
|
||||
currentStatusActive = true;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::SetStopped()
|
||||
|
|
@ -139,6 +140,7 @@ void AdvSceneSwitcher::SetStopped()
|
|||
obs_module_text("AdvSceneSwitcher.status.inactive"));
|
||||
inactivePluse = PulseWidget(ui->pluginRunningText, QColor(Qt::red),
|
||||
QColor(0, 0, 0, 0), "QLabel ");
|
||||
currentStatusActive = false;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_toggleStartButton_clicked()
|
||||
|
|
@ -681,6 +683,21 @@ void populateAutoStartEventSelection(QComboBox *cb)
|
|||
"AdvSceneSwitcher.generalTab.status.autoStart.recordingAndStreaming"));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::updateStatus()
|
||||
{
|
||||
if (switcher->th && switcher->th->isRunning()) {
|
||||
if (currentStatusActive) {
|
||||
return;
|
||||
}
|
||||
SetStarted();
|
||||
} else {
|
||||
if (!currentStatusActive) {
|
||||
return;
|
||||
}
|
||||
SetStopped();
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::setupGeneralTab()
|
||||
{
|
||||
populateSceneSelection(ui->noMatchSwitchScene, false);
|
||||
|
|
@ -780,4 +797,10 @@ void AdvSceneSwitcher::setupGeneralTab()
|
|||
} else {
|
||||
SetStopped();
|
||||
}
|
||||
|
||||
// Updates the UI status element if the status changed externally
|
||||
// (e.g. via hotkeys)
|
||||
QTimer *statusTimer = new QTimer(this);
|
||||
connect(statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
statusTimer->start(1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class AdvSceneSwitcher : public QDialog {
|
|||
public:
|
||||
std::unique_ptr<Ui_AdvSceneSwitcher> ui;
|
||||
bool loading = true;
|
||||
bool currentStatusActive = false;
|
||||
|
||||
AdvSceneSwitcher(QWidget *parent);
|
||||
|
||||
|
|
@ -219,6 +220,7 @@ public slots:
|
|||
void on_threadPriority_currentTextChanged(const QString &text);
|
||||
|
||||
void updateScreenRegionCursorPos();
|
||||
void updateStatus();
|
||||
|
||||
void on_close_clicked();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user