mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 09:05:57 -05:00
Macro pause (#201)
* Add option to pause individual macros * Add macro action to pause and unpause macros
This commit is contained in:
@@ -107,6 +107,9 @@ public:
|
||||
bool listMoveDown(QListWidget *list);
|
||||
|
||||
signals:
|
||||
void MacroAdded(const QString &name);
|
||||
void MacroRemoved(const QString &name);
|
||||
void MacroRenamed(const QString &oldName, const QString newName);
|
||||
void SceneGroupAdded(const QString &name);
|
||||
void SceneGroupRemoved(const QString &name);
|
||||
void SceneGroupRenamed(const QString &oldName, const QString newName);
|
||||
@@ -137,6 +140,7 @@ public slots:
|
||||
void on_macroDown_clicked();
|
||||
void on_macroName_editingFinished();
|
||||
void on_macros_currentRowChanged(int idx);
|
||||
void on_macros_itemChanged(QListWidgetItem *);
|
||||
void on_conditionAdd_clicked();
|
||||
void on_conditionRemove_clicked();
|
||||
void on_actionAdd_clicked();
|
||||
|
||||
61
src/headers/macro-action-pause.hpp
Normal file
61
src/headers/macro-action-pause.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
#include <QDoubleSpinBox>
|
||||
#include "macro-action-edit.hpp"
|
||||
|
||||
enum class PauseAction {
|
||||
PAUSE,
|
||||
UNPAUSE,
|
||||
};
|
||||
|
||||
class MacroActionPause : public MacroAction {
|
||||
public:
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionPause>();
|
||||
}
|
||||
|
||||
PauseAction _action = PauseAction::PAUSE;
|
||||
Macro *_macro = nullptr;
|
||||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionPauseEdit : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroActionPauseEdit(
|
||||
QWidget *parent,
|
||||
std::shared_ptr<MacroActionPause> entryData = nullptr);
|
||||
void UpdateEntryData();
|
||||
static QWidget *Create(QWidget *parent,
|
||||
std::shared_ptr<MacroAction> action)
|
||||
{
|
||||
return new MacroActionPauseEdit(
|
||||
parent,
|
||||
std::dynamic_pointer_cast<MacroActionPause>(action));
|
||||
}
|
||||
|
||||
private slots:
|
||||
void MacroChanged(const QString &text);
|
||||
void ActionChanged(int value);
|
||||
void MacroAdd(const QString &name);
|
||||
void MacroRemove(const QString &name);
|
||||
void MacroRename(const QString &oldName, const QString &newName);
|
||||
|
||||
protected:
|
||||
QComboBox *_macros;
|
||||
QComboBox *_actions;
|
||||
std::shared_ptr<MacroActionPause> _entryData;
|
||||
|
||||
private:
|
||||
QHBoxLayout *_mainLayout;
|
||||
bool _loading = true;
|
||||
};
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <map>
|
||||
#include <obs.hpp>
|
||||
#include <obs-module.h>
|
||||
#include <QString>
|
||||
|
||||
constexpr auto macro_func = 10;
|
||||
constexpr auto default_priority_10 = macro_func;
|
||||
@@ -68,6 +69,8 @@ public:
|
||||
bool Matched() { return _matched; }
|
||||
std::string Name() { return _name; }
|
||||
void SetName(std::string name) { _name = name; }
|
||||
void SetPaused(bool pause = true) { _paused = pause; }
|
||||
bool Paused() { return _paused; }
|
||||
std::deque<std::shared_ptr<MacroCondition>> &Conditions()
|
||||
{
|
||||
return _conditions;
|
||||
@@ -85,4 +88,8 @@ private:
|
||||
std::deque<std::shared_ptr<MacroCondition>> _conditions;
|
||||
std::deque<std::shared_ptr<MacroAction>> _actions;
|
||||
bool _matched = false;
|
||||
bool _paused = false;
|
||||
};
|
||||
|
||||
Macro *GetMacroByName(const char *name);
|
||||
Macro *GetMacroByQString(const QString &name);
|
||||
|
||||
Reference in New Issue
Block a user