mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-04 19:48:56 -05:00
Add un-/pause option to macro tab context menu
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:
parent
bf682136c3
commit
c9eed5d997
|
|
@ -206,6 +206,8 @@ AdvSceneSwitcher.macroTab.expandAllGroups="Expand all Groups"
|
|||
AdvSceneSwitcher.macroTab.collapseAllGroups="Collapse all Groups"
|
||||
AdvSceneSwitcher.macroTab.rename="Rename"
|
||||
AdvSceneSwitcher.macroTab.remove="Remove"
|
||||
AdvSceneSwitcher.macroTab.pause="Pause"
|
||||
AdvSceneSwitcher.macroTab.unpause="Unpause"
|
||||
AdvSceneSwitcher.macroTab.export="Export"
|
||||
AdvSceneSwitcher.macroTab.export.info="Paste the string below into the import dialog to import the selected macros:"
|
||||
AdvSceneSwitcher.macroTab.export.usePlainText="Use plain text"
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ public slots:
|
|||
void RenameSelectedMacro();
|
||||
void ExportMacros() const;
|
||||
void ImportMacros();
|
||||
void PauseSelectedMacros();
|
||||
void UnpauseSelectedMacros();
|
||||
void HighlightOnChange() const;
|
||||
void on_macroSettings_clicked();
|
||||
|
||||
|
|
|
|||
|
|
@ -745,6 +745,17 @@ void AdvSceneSwitcher::ShowMacroContextMenu(const QPoint &pos)
|
|||
remove->setDisabled(ui->macros->SelectionEmpty());
|
||||
menu.addSeparator();
|
||||
|
||||
auto pause = menu.addAction(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.pause"), this,
|
||||
&AdvSceneSwitcher::PauseSelectedMacros);
|
||||
pause->setDisabled(ui->macros->SelectionEmpty());
|
||||
|
||||
auto unpause = menu.addAction(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.unpause"), this,
|
||||
&AdvSceneSwitcher::UnpauseSelectedMacros);
|
||||
unpause->setDisabled(ui->macros->SelectionEmpty());
|
||||
menu.addSeparator();
|
||||
|
||||
auto group = menu.addAction(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.group"), ui->macros,
|
||||
&MacroTree::GroupSelectedItems);
|
||||
|
|
@ -805,6 +816,48 @@ void AdvSceneSwitcher::CopyMacro()
|
|||
MacroSignalManager::Instance()->Add(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::PauseSelectedMacros()
|
||||
{
|
||||
auto selectedMacros = GetSelectedMacros();
|
||||
if (selectedMacros.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto lock = LockContext();
|
||||
for (const auto ¯o : selectedMacros) {
|
||||
if (macro->IsGroup()) {
|
||||
for (const auto &subitem :
|
||||
GetGroupMacroEntries(macro.get())) {
|
||||
subitem->SetPaused(true);
|
||||
}
|
||||
} else {
|
||||
macro->SetPaused(true);
|
||||
}
|
||||
}
|
||||
ui->macros->UpdateRunningStates();
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::UnpauseSelectedMacros()
|
||||
{
|
||||
auto selectedMacros = GetSelectedMacros();
|
||||
if (selectedMacros.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto lock = LockContext();
|
||||
for (const auto ¯o : selectedMacros) {
|
||||
if (macro->IsGroup()) {
|
||||
for (const auto &subitem :
|
||||
GetGroupMacroEntries(macro.get())) {
|
||||
subitem->SetPaused(false);
|
||||
}
|
||||
} else {
|
||||
macro->SetPaused(false);
|
||||
}
|
||||
}
|
||||
ui->macros->UpdateRunningStates();
|
||||
}
|
||||
|
||||
bool MacroTabIsInFocus()
|
||||
{
|
||||
return AdvSceneSwitcher::window &&
|
||||
|
|
|
|||
|
|
@ -981,6 +981,17 @@ void MacroTree::UpdateWidgets(bool force)
|
|||
}
|
||||
}
|
||||
|
||||
void MacroTree::UpdateRunningStates()
|
||||
{
|
||||
MacroTreeModel *mtm = GetModel();
|
||||
for (int i = 0; i < (int)mtm->_macros.size(); i++) {
|
||||
auto widget = GetItemWidget(i);
|
||||
if (widget) {
|
||||
widget->UpdateRunning();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void MoveItem(std::deque<std::shared_ptr<Macro>> &items,
|
||||
std::shared_ptr<Macro> &item, int to)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ public:
|
|||
void ExpandGroup(std::shared_ptr<Macro> item) const;
|
||||
void CollapseGroup(std::shared_ptr<Macro> item) const;
|
||||
void RefreshFilter();
|
||||
void UpdateRunningStates();
|
||||
|
||||
public slots:
|
||||
void GroupSelectedItems();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user