mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-23 10:39:46 -05:00
Add highlighting of onChagne if actions were prevented recently
This commit is contained in:
parent
428e114a0a
commit
d693dbc844
|
|
@ -160,6 +160,7 @@ public slots:
|
|||
void ResetOpacityConditionControls();
|
||||
void HighlightControls();
|
||||
void MacroDragDropReorder(QModelIndex, int, int, QModelIndex, int);
|
||||
void HighlightOnChange();
|
||||
|
||||
void on_screenRegionSwitches_currentRowChanged(int idx);
|
||||
void on_showFrame_clicked();
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ public:
|
|||
|
||||
// UI helpers for the macro tab
|
||||
bool WasExecutedRecently();
|
||||
bool OnChangePreventedActionsRecently();
|
||||
void ResetUIHelpers();
|
||||
|
||||
private:
|
||||
|
|
@ -119,6 +120,7 @@ private:
|
|||
void ResetTimers();
|
||||
void RunActions(bool &ret, bool ignorePause);
|
||||
void RunActions(bool ignorePause);
|
||||
void SetOnChangeHighlight();
|
||||
|
||||
std::string _name = "";
|
||||
std::deque<std::shared_ptr<MacroCondition>> _conditions;
|
||||
|
|
@ -133,7 +135,9 @@ private:
|
|||
obs_hotkey_id _unpauseHotkey = OBS_INVALID_HOTKEY_ID;
|
||||
obs_hotkey_id _togglePauseHotkey = OBS_INVALID_HOTKEY_ID;
|
||||
|
||||
// UI helpers for the macro tab
|
||||
bool _wasExecutedRecently = false;
|
||||
bool _onChangeTriggered = false;
|
||||
|
||||
bool _die = false;
|
||||
bool _stop = false;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <QPropertyAnimation>
|
||||
|
||||
static QMetaObject::Connection addPulse;
|
||||
static QTimer onChangeHighlightTimer;
|
||||
|
||||
bool macroNameExists(std::string name)
|
||||
{
|
||||
|
|
@ -408,6 +409,20 @@ void AdvSceneSwitcher::MacroDragDropReorder(QModelIndex, int from, int,
|
|||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::HighlightOnChange()
|
||||
{
|
||||
auto macro = getSelectedMacro();
|
||||
if (!macro) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (switcher->highlightExecutedMacros &&
|
||||
macro->OnChangePreventedActionsRecently()) {
|
||||
PulseWidget(ui->runMacroOnChange, Qt::yellow, Qt::transparent,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::setupMacroTab()
|
||||
{
|
||||
const QSignalBlocker signalBlocker(ui->macros);
|
||||
|
|
@ -461,6 +476,11 @@ void AdvSceneSwitcher::setupMacroTab()
|
|||
|
||||
ui->macroPriorityWarning->setVisible(
|
||||
switcher->functionNamesByPriority[0] != macro_func);
|
||||
|
||||
onChangeHighlightTimer.setInterval(1500);
|
||||
connect(&onChangeHighlightTimer, SIGNAL(timeout()), this,
|
||||
SLOT(HighlightOnChange()));
|
||||
onChangeHighlightTimer.start();
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::ShowMacroContextMenu(const QPoint &pos)
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ bool Macro::CeckMatch()
|
|||
vblog(LOG_INFO, "ignore match for Macro %s (on change)",
|
||||
_name.c_str());
|
||||
_matched = false;
|
||||
SetOnChangeHighlight();
|
||||
}
|
||||
_lastMatched = newLastMatched;
|
||||
|
||||
|
|
@ -185,6 +186,11 @@ void Macro::RunActions(bool ignorePause)
|
|||
RunActions(unused, ignorePause);
|
||||
}
|
||||
|
||||
void Macro::SetOnChangeHighlight()
|
||||
{
|
||||
_onChangeTriggered = true;
|
||||
}
|
||||
|
||||
void Macro::SetPaused(bool pause)
|
||||
{
|
||||
if (_paused && !pause) {
|
||||
|
|
@ -431,8 +437,18 @@ bool Macro::WasExecutedRecently()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Macro::OnChangePreventedActionsRecently()
|
||||
{
|
||||
if (_onChangeTriggered) {
|
||||
_onChangeTriggered = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Macro::ResetUIHelpers()
|
||||
{
|
||||
_onChangeTriggered = false;
|
||||
for (auto c : _conditions) {
|
||||
c->Highlight();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user