mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-04 16:25:39 -05:00
The "core" macro conditions and actions have been extracted out to the "base" plugin. The library now mostly contains functionality which is required across all plugins and (e.g. definitions for macro segments). The goal is to reduce the complexity and cross-dependencies and group the source files in a better way. This should relsove the "library limit of 65535 objects exceeded" build issue occuring in some Windows build environments.
105 lines
2.4 KiB
C++
105 lines
2.4 KiB
C++
#pragma once
|
|
#include "macro-action-edit.hpp"
|
|
#include "variable-text-edit.hpp"
|
|
#include "source-selection.hpp"
|
|
#include "filter-selection.hpp"
|
|
#include "source-setting.hpp"
|
|
|
|
#include <QComboBox>
|
|
#include <QSpinBox>
|
|
#include <QPushButton>
|
|
|
|
namespace advss {
|
|
|
|
class MacroActionFilter : public MacroAction {
|
|
public:
|
|
MacroActionFilter(Macro *m) : MacroAction(m) {}
|
|
bool PerformAction();
|
|
void LogAction() const;
|
|
bool Save(obs_data_t *obj) const;
|
|
bool Load(obs_data_t *obj);
|
|
std::string GetShortDesc() const;
|
|
std::string GetId() const { return id; };
|
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
|
{
|
|
return std::make_shared<MacroActionFilter>(m);
|
|
}
|
|
|
|
enum class Action {
|
|
ENABLE,
|
|
DISABLE,
|
|
TOGGLE,
|
|
SETTINGS,
|
|
};
|
|
|
|
enum class SettingsInputMethod {
|
|
INDIVIDUAL_MANUAL,
|
|
INDIVIDUAL_TEMPVAR,
|
|
JSON_STRING,
|
|
};
|
|
SettingsInputMethod _settingsInputMethod =
|
|
SettingsInputMethod::INDIVIDUAL_MANUAL;
|
|
|
|
SourceSelection _source;
|
|
FilterSelection _filter;
|
|
Action _action = Action::ENABLE;
|
|
StringVariable _settingsString = "";
|
|
TempVariableRef _tempVar;
|
|
StringVariable _manualSettingValue = "";
|
|
SourceSetting _setting;
|
|
|
|
private:
|
|
static bool _registered;
|
|
static const std::string id;
|
|
};
|
|
|
|
class MacroActionFilterEdit : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MacroActionFilterEdit(
|
|
QWidget *parent,
|
|
std::shared_ptr<MacroActionFilter> entryData = nullptr);
|
|
void UpdateEntryData();
|
|
static QWidget *Create(QWidget *parent,
|
|
std::shared_ptr<MacroAction> action)
|
|
{
|
|
return new MacroActionFilterEdit(
|
|
parent,
|
|
std::dynamic_pointer_cast<MacroActionFilter>(action));
|
|
}
|
|
|
|
private slots:
|
|
void SourceChanged(const SourceSelection &);
|
|
void FilterChanged(const FilterSelection &);
|
|
void ActionChanged(int value);
|
|
void GetSettingsClicked();
|
|
void SettingsStringChanged();
|
|
void SettingsInputMethodChanged(int);
|
|
void SelectionChanged(const TempVariableRef &);
|
|
void SelectionChanged(const SourceSetting &);
|
|
void ManualSettingsValueChanged();
|
|
signals:
|
|
void HeaderInfoChanged(const QString &);
|
|
|
|
protected:
|
|
SourceSelectionWidget *_sources;
|
|
FilterSelectionWidget *_filters;
|
|
QComboBox *_actions;
|
|
QPushButton *_getSettings;
|
|
QHBoxLayout *_settingsLayout;
|
|
QComboBox *_settingsInputMethods;
|
|
VariableTextEdit *_manualSettingValue;
|
|
TempVariableSelection *_tempVars;
|
|
SourceSettingSelection *_filterSettings;
|
|
VariableTextEdit *_settingsString;
|
|
|
|
std::shared_ptr<MacroActionFilter> _entryData;
|
|
|
|
private:
|
|
void SetWidgetVisibility();
|
|
bool _loading = true;
|
|
};
|
|
|
|
} // namespace advss
|