mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 17:16:00 -05:00
Add sequence action (#395)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QListWidget>
|
||||
#include <QDialog>
|
||||
#include <unordered_map>
|
||||
|
||||
class MacroActionRandom : public MultiMacroRefAction {
|
||||
@@ -29,17 +28,6 @@ private:
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroDialog(QWidget *parent);
|
||||
static bool AskForMacro(QWidget *parent, std::string ¯oName);
|
||||
|
||||
private:
|
||||
MacroSelection *_macroSelection;
|
||||
};
|
||||
|
||||
class MacroActionRandomEdit : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
77
src/headers/macro-action-sequence.hpp
Normal file
77
src/headers/macro-action-sequence.hpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
#include "macro-action-edit.hpp"
|
||||
#include "macro-selection.hpp"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QListWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QTimer>
|
||||
|
||||
class MacroActionSequence : public MultiMacroRefAction {
|
||||
public:
|
||||
MacroActionSequence(Macro *m) : MultiMacroRefAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
MacroRef GetNextMacro(bool advance = true);
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSequence>(m);
|
||||
}
|
||||
|
||||
bool _restart = true;
|
||||
MacroRef _lastSequenceMacro;
|
||||
int _lastIdx = -1;
|
||||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionSequenceEdit : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroActionSequenceEdit(
|
||||
QWidget *parent,
|
||||
std::shared_ptr<MacroActionSequence> entryData = nullptr);
|
||||
void UpdateEntryData();
|
||||
static QWidget *Create(QWidget *parent,
|
||||
std::shared_ptr<MacroAction> action)
|
||||
{
|
||||
return new MacroActionSequenceEdit(
|
||||
parent,
|
||||
std::dynamic_pointer_cast<MacroActionSequence>(action));
|
||||
}
|
||||
|
||||
private slots:
|
||||
void MacroRemove(const QString &name);
|
||||
void MacroRename(const QString &oldName, const QString &newName);
|
||||
void Add();
|
||||
void Remove();
|
||||
void Up();
|
||||
void Down();
|
||||
void ContinueFromClicked();
|
||||
void RestartChanged(int state);
|
||||
void UpdateStatusLine();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<MacroActionSequence> _entryData;
|
||||
|
||||
private:
|
||||
int FindEntry(const std::string ¯o);
|
||||
void SetMacroListSize();
|
||||
|
||||
QListWidget *_macroList;
|
||||
QPushButton *_add;
|
||||
QPushButton *_remove;
|
||||
QPushButton *_up;
|
||||
QPushButton *_down;
|
||||
QPushButton *_continueFrom;
|
||||
QCheckBox *_restart;
|
||||
QLabel *_statusLine;
|
||||
QTimer _statusTimer;
|
||||
bool _loading = true;
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
|
||||
class Macro;
|
||||
|
||||
@@ -17,3 +18,14 @@ private slots:
|
||||
void MacroRemove(const QString &name);
|
||||
void MacroRename(const QString &oldName, const QString &newName);
|
||||
};
|
||||
|
||||
class MacroSelectionDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroSelectionDialog(QWidget *parent);
|
||||
static bool AskForMacro(QWidget *parent, std::string ¯oName);
|
||||
|
||||
private:
|
||||
MacroSelection *_macroSelection;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user