diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 8ac6bc95..00519b2d 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -83,7 +83,8 @@ AdvSceneSwitcher.macroTab.minimize="Minimize" AdvSceneSwitcher.macroTab.highlightExecutedMacros="Highlight recently executed macros" AdvSceneSwitcher.macroTab.highlightTrueConditions="Highlight conditions of currently selected macro that evaluated to true recently" AdvSceneSwitcher.macroTab.highlightPerformedActions="Highlight recently performed actions of currently selected macro" -AdvSceneSwitcher.macroTab.disableHotkeys="Register hotkeys to control pause state of selected macro" +AdvSceneSwitcher.macroTab.newMacroRegisterHotkey="Register hotkeys to control pause state of new macros" +AdvSceneSwitcher.macroTab.currentDisableHotkeys="Register hotkeys to control pause state of selected macro" ; Macro List AdvSceneSwitcher.macroList.deleted="deleted" diff --git a/src/macro-core/macro-properties.cpp b/src/macro-core/macro-properties.cpp index 2c2cd812..94df805a 100644 --- a/src/macro-core/macro-properties.cpp +++ b/src/macro-core/macro-properties.cpp @@ -10,6 +10,8 @@ void MacroProperties::Save(obs_data_t *obj) obs_data_set_bool(data, "highlightExecuted", _highlightExecuted); obs_data_set_bool(data, "highlightConditions", _highlightConditions); obs_data_set_bool(data, "highlightActions", _highlightActions); + obs_data_set_bool(data, "newMacroRegisterHotkey", + _newMacroRegisterHotkeys); obs_data_set_obj(obj, "macroProperties", data); obs_data_release(data); } @@ -17,16 +19,11 @@ void MacroProperties::Save(obs_data_t *obj) void MacroProperties::Load(obs_data_t *obj) { auto data = obs_data_get_obj(obj, "macroProperties"); - // TODO: Remove in future version - if (obs_data_has_user_value(obj, "highlightExecutedMacros")) { - _highlightExecuted = - obs_data_get_bool(obj, "highlightExecutedMacros"); - } else { - _highlightExecuted = - obs_data_get_bool(data, "highlightExecuted"); - } + _highlightExecuted = obs_data_get_bool(data, "highlightExecuted"); _highlightConditions = obs_data_get_bool(data, "highlightConditions"); _highlightActions = obs_data_get_bool(data, "highlightActions"); + _newMacroRegisterHotkeys = + obs_data_get_bool(data, "newMacroRegisterHotkey"); obs_data_release(data); } @@ -40,8 +37,10 @@ MacroPropertiesDialog::MacroPropertiesDialog(QWidget *parent, "AdvSceneSwitcher.macroTab.highlightTrueConditions"))), _actions(new QCheckBox(obs_module_text( "AdvSceneSwitcher.macroTab.highlightPerformedActions"))), - _hotkeys(new QCheckBox( - obs_module_text("AdvSceneSwitcher.macroTab.disableHotkeys"))) + _newMacroRegisterHotkeys(new QCheckBox(obs_module_text( + "AdvSceneSwitcher.macroTab.newMacroRegisterHotkey"))), + _currentMacroRegisterHotkeys(new QCheckBox(obs_module_text( + "AdvSceneSwitcher.macroTab.currentDisableHotkeys"))) { setModal(true); setWindowModality(Qt::WindowModality::WindowModal); @@ -52,17 +51,26 @@ MacroPropertiesDialog::MacroPropertiesDialog(QWidget *parent, _executed->setChecked(prop._highlightExecuted); _conditions->setChecked(prop._highlightConditions); _actions->setChecked(prop._highlightActions); + _newMacroRegisterHotkeys->setChecked(prop._newMacroRegisterHotkeys); if (macro) { - _hotkeys->setChecked(macro->PauseHotkeysEnabled()); + _currentMacroRegisterHotkeys->setChecked( + macro->PauseHotkeysEnabled()); } else { - _hotkeys->hide(); + _currentMacroRegisterHotkeys->hide(); } QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(_executed); layout->addWidget(_conditions); layout->addWidget(_actions); - layout->addWidget(_hotkeys); + layout->addWidget(_newMacroRegisterHotkeys); + if (macro) { + QFrame *line = new QFrame(); + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + layout->addWidget(line); + } + layout->addWidget(_currentMacroRegisterHotkeys); setLayout(layout); QDialogButtonBox *buttonbox = new QDialogButtonBox( @@ -85,8 +93,11 @@ bool MacroPropertiesDialog::AskForSettings(QWidget *parent, userInput._highlightExecuted = dialog._executed->isChecked(); userInput._highlightConditions = dialog._conditions->isChecked(); userInput._highlightActions = dialog._actions->isChecked(); + userInput._newMacroRegisterHotkeys = + dialog._newMacroRegisterHotkeys->isChecked(); if (macro) { - macro->EnablePauseHotkeys(dialog._hotkeys->isChecked()); + macro->EnablePauseHotkeys( + dialog._currentMacroRegisterHotkeys->isChecked()); } return true; } diff --git a/src/macro-core/macro-properties.hpp b/src/macro-core/macro-properties.hpp index e1c86cca..2ef4f529 100644 --- a/src/macro-core/macro-properties.hpp +++ b/src/macro-core/macro-properties.hpp @@ -15,6 +15,7 @@ public: bool _highlightExecuted = false; bool _highlightConditions = false; bool _highlightActions = false; + bool _newMacroRegisterHotkeys = true; }; // Dialog for configuring global and macro specific settings @@ -31,5 +32,7 @@ private: QCheckBox *_executed; QCheckBox *_conditions; QCheckBox *_actions; - QCheckBox *_hotkeys; + QCheckBox *_newMacroRegisterHotkeys; + // Current macro specific settings + QCheckBox *_currentMacroRegisterHotkeys; }; diff --git a/src/macro-core/macro-tab.cpp b/src/macro-core/macro-tab.cpp index 7c95b522..2c5892c8 100644 --- a/src/macro-core/macro-tab.cpp +++ b/src/macro-core/macro-tab.cpp @@ -58,8 +58,9 @@ bool AdvSceneSwitcher::addNewMacro(std::string &name, std::string format) { std::lock_guard lock(switcher->m); - switcher->macros.emplace_back( - std::make_shared(name, true)); + switcher->macros.emplace_back(std::make_shared( + name, + switcher->macroProperties._newMacroRegisterHotkeys)); } return true; } diff --git a/src/macro-core/macro.cpp b/src/macro-core/macro.cpp index efe564fb..6332f6e2 100644 --- a/src/macro-core/macro.cpp +++ b/src/macro-core/macro.cpp @@ -17,6 +17,7 @@ Macro::Macro(const std::string &name, const bool addHotkey) if (addHotkey) { SetupHotkeys(); } + _registerHotkeys = addHotkey; } Macro::~Macro()