mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-22 01:44:49 -05:00
Hide selected macro for run or stop action
Running a macro from within itself is not supported and stopping it from withint itself does not seem useful either.
This commit is contained in:
parent
e3a39a5df7
commit
caea16c6ad
|
|
@ -9,6 +9,8 @@ class MacroSelection : public QComboBox {
|
|||
public:
|
||||
MacroSelection(QWidget *parent);
|
||||
void SetCurrentMacro(Macro *);
|
||||
void HideSelectedMacro(); // Macro currently being edited
|
||||
void ShowAllMacros();
|
||||
|
||||
private slots:
|
||||
void MacroAdd(const QString &name);
|
||||
|
|
|
|||
|
|
@ -144,6 +144,10 @@ void MacroActionMacroEdit::UpdateEntryData()
|
|||
}
|
||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||
_macros->SetCurrentMacro(_entryData->_macro.get());
|
||||
if (_entryData->_action == PerformMacroAction::RUN ||
|
||||
_entryData->_action == PerformMacroAction::STOP) {
|
||||
_macros->HideSelectedMacro();
|
||||
}
|
||||
}
|
||||
|
||||
void MacroActionMacroEdit::MacroChanged(const QString &text)
|
||||
|
|
@ -166,6 +170,13 @@ void MacroActionMacroEdit::ActionChanged(int value)
|
|||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_action = static_cast<PerformMacroAction>(value);
|
||||
|
||||
if (_entryData->_action == PerformMacroAction::RUN ||
|
||||
_entryData->_action == PerformMacroAction::STOP) {
|
||||
_macros->HideSelectedMacro();
|
||||
} else {
|
||||
_macros->ShowAllMacros();
|
||||
}
|
||||
}
|
||||
|
||||
void MacroActionMacroEdit::MacroRemove(const QString &)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,28 @@ void MacroSelection::SetCurrentMacro(Macro *m)
|
|||
}
|
||||
}
|
||||
|
||||
void MacroSelection::HideSelectedMacro()
|
||||
{
|
||||
auto ssWindow = static_cast<AdvSceneSwitcher *>(window());
|
||||
if (!ssWindow) {
|
||||
return;
|
||||
}
|
||||
int idx = ssWindow->ui->macros->currentRow();
|
||||
if (idx == -1) {
|
||||
return;
|
||||
}
|
||||
// +1 for "select macro" entry
|
||||
qobject_cast<QListView *>(view())->setRowHidden(idx + 1, true);
|
||||
}
|
||||
|
||||
void MacroSelection::ShowAllMacros()
|
||||
{
|
||||
auto v = qobject_cast<QListView *>(view());
|
||||
for (int i = count(); i > 0; i--) {
|
||||
v->setRowHidden(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
void MacroSelection::MacroRemove(const QString &name)
|
||||
{
|
||||
int idx = findText(name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user