mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Switch to using string as ids for actions and conditions
Using int is an id was getting messy with more and more conditions and actions beeing added. It also made the order of conditions and actions in the respective comboboxes unchangable as there was a 1 to 1 relation of index and id.
This commit is contained in:
parent
ae71b24c60
commit
572b974b82
|
|
@ -15,7 +15,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionAudio>();
|
||||
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionAudioEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -20,15 +20,16 @@ struct MacroActionInfo {
|
|||
class MacroActionFactory {
|
||||
public:
|
||||
MacroActionFactory() = delete;
|
||||
static bool Register(int id, MacroActionInfo);
|
||||
static std::shared_ptr<MacroAction> Create(const int id);
|
||||
static QWidget *CreateWidget(const int id, QWidget *parent,
|
||||
static bool Register(std::string id, MacroActionInfo);
|
||||
static std::shared_ptr<MacroAction> Create(const std::string id);
|
||||
static QWidget *CreateWidget(const std::string id, QWidget *parent,
|
||||
std::shared_ptr<MacroAction> action);
|
||||
static auto GetActionTypes() { return _methods; }
|
||||
static std::string GetActionName(int id);
|
||||
static std::string GetActionName(const std::string id);
|
||||
static std::string GetIdByName(const QString &name);
|
||||
|
||||
private:
|
||||
static std::map<int, MacroActionInfo> _methods;
|
||||
static std::map<std::string, MacroActionInfo> _methods;
|
||||
};
|
||||
|
||||
class MacroActionEdit : public QWidget {
|
||||
|
|
@ -36,13 +37,14 @@ class MacroActionEdit : public QWidget {
|
|||
|
||||
public:
|
||||
MacroActionEdit(QWidget *parent = nullptr,
|
||||
std::shared_ptr<MacroAction> * = nullptr, int type = 0,
|
||||
std::shared_ptr<MacroAction> * = nullptr,
|
||||
std::string id = "scene_switch",
|
||||
bool startCollapsed = false);
|
||||
void UpdateEntryData(int type);
|
||||
void UpdateEntryData(std::string id);
|
||||
void Collapse(bool collapsed);
|
||||
|
||||
private slots:
|
||||
void ActionSelectionChanged(int idx);
|
||||
void ActionSelectionChanged(const QString &text);
|
||||
|
||||
protected:
|
||||
QComboBox *_actionSelection;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionFilter>();
|
||||
|
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionFilterEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionRecord>();
|
||||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionRecordEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionReplayBuffer>();
|
||||
|
|
@ -33,7 +33,7 @@ private:
|
|||
Duration _duration;
|
||||
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionReplayBufferEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionRun>();
|
||||
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionRunEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
|
|
@ -21,7 +21,7 @@ private:
|
|||
const char *getType() { return "MacroActionSwitchScene"; }
|
||||
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionSwitchSceneEdit : public SwitchWidget {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionSceneVisibility>();
|
||||
|
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionSceneVisibilityEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionSource>();
|
||||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionSourceEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public:
|
|||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionStream>();
|
||||
|
|
@ -28,7 +28,7 @@ private:
|
|||
Duration _retryCooldown;
|
||||
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionStreamEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
bool PerformAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
return std::make_shared<MacroActionWait>();
|
||||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroActionWaitEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionAudio>();
|
||||
|
|
@ -39,7 +39,7 @@ public:
|
|||
private:
|
||||
float _peak = -std::numeric_limits<float>::infinity();
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionAudioEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -20,15 +20,16 @@ struct MacroConditionInfo {
|
|||
class MacroConditionFactory {
|
||||
public:
|
||||
MacroConditionFactory() = delete;
|
||||
static bool Register(int id, MacroConditionInfo);
|
||||
static std::shared_ptr<MacroCondition> Create(const int id);
|
||||
static QWidget *CreateWidget(const int id, QWidget *parent,
|
||||
static bool Register(const std::string &, MacroConditionInfo);
|
||||
static std::shared_ptr<MacroCondition> Create(const std::string);
|
||||
static QWidget *CreateWidget(const std::string &id, QWidget *parent,
|
||||
std::shared_ptr<MacroCondition>);
|
||||
static auto GetConditionTypes() { return _methods; }
|
||||
static std::string GetConditionName(int id);
|
||||
static std::string GetConditionName(const std::string &);
|
||||
static std::string GetIdByName(const QString& name);
|
||||
|
||||
private:
|
||||
static std::map<int, MacroConditionInfo> _methods;
|
||||
static std::map<std::string, MacroConditionInfo> _methods;
|
||||
};
|
||||
|
||||
class MacroConditionEdit : public QWidget {
|
||||
|
|
@ -37,15 +38,15 @@ class MacroConditionEdit : public QWidget {
|
|||
public:
|
||||
MacroConditionEdit(QWidget *parent = nullptr,
|
||||
std::shared_ptr<MacroCondition> * = nullptr,
|
||||
int type = 0, bool root = true,
|
||||
const std::string &id = "scene", bool root = true,
|
||||
bool startCollapsed = false);
|
||||
bool IsRootNode();
|
||||
void UpdateEntryData(int type);
|
||||
void UpdateEntryData(const std::string &id);
|
||||
void Collapse(bool collapsed);
|
||||
|
||||
private slots:
|
||||
void LogicSelectionChanged(int idx);
|
||||
void ConditionSelectionChanged(int idx);
|
||||
void ConditionSelectionChanged(const QString &text);
|
||||
|
||||
protected:
|
||||
QComboBox *_logicSelection;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionFile>();
|
||||
|
|
@ -39,7 +39,7 @@ private:
|
|||
QDateTime _lastMod;
|
||||
size_t _lastHash = 0;
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionFileEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionIdle>();
|
||||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionIdleEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionInterval>();
|
||||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionIntervalEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionMedia>();
|
||||
|
|
@ -65,7 +65,7 @@ private:
|
|||
bool _playedToEnd = false;
|
||||
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionMediaEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionPluginState>();
|
||||
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionPluginStateEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionProcess>();
|
||||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionProcessEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionRecord>();
|
||||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionRecordEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionRegion>();
|
||||
|
|
@ -18,7 +18,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionRegionEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionScene>();
|
||||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionSceneEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionStream>();
|
||||
|
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionStreamEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
QImage GetMatchImage() { return _matchImage; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
|
|
@ -39,7 +39,7 @@ private:
|
|||
std::unique_ptr<AdvSSScreenshotObj> _screenshotData = nullptr;
|
||||
QImage _matchImage;
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionVideoEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public:
|
|||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
int GetId() { return id; };
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
return std::make_shared<MacroConditionWindow>();
|
||||
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool _registered;
|
||||
static const int id;
|
||||
static const std::string id;
|
||||
};
|
||||
|
||||
class MacroConditionWindowEdit : public QWidget {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public:
|
|||
virtual bool CheckCondition() = 0;
|
||||
virtual bool Save(obs_data_t *obj) = 0;
|
||||
virtual bool Load(obs_data_t *obj) = 0;
|
||||
virtual int GetId() = 0;
|
||||
virtual std::string GetId() = 0;
|
||||
LogicType GetLogicType() { return _logic; }
|
||||
void SetLogicType(LogicType logic) { _logic = logic; }
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public:
|
|||
virtual bool PerformAction() = 0;
|
||||
virtual bool Save(obs_data_t *obj) = 0;
|
||||
virtual bool Load(obs_data_t *obj) = 0;
|
||||
virtual int GetId() = 0;
|
||||
virtual std::string GetId() = 0;
|
||||
virtual void LogAction();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionAudio::id = 2;
|
||||
const std::string MacroActionAudio::id = "audio";
|
||||
|
||||
bool MacroActionAudio::_registered = MacroActionFactory::Register(
|
||||
MacroActionAudio::id,
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
std::map<int, MacroActionInfo> MacroActionFactory::_methods;
|
||||
std::map<std::string, MacroActionInfo> MacroActionFactory::_methods;
|
||||
|
||||
bool MacroActionFactory::Register(int id, MacroActionInfo info)
|
||||
bool MacroActionFactory::Register(std::string id, MacroActionInfo info)
|
||||
{
|
||||
if (auto it = _methods.find(id); it == _methods.end()) {
|
||||
_methods[id] = info;
|
||||
|
|
@ -14,7 +14,7 @@ bool MacroActionFactory::Register(int id, MacroActionInfo info)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<MacroAction> MacroActionFactory::Create(const int id)
|
||||
std::shared_ptr<MacroAction> MacroActionFactory::Create(const std::string id)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end())
|
||||
return it->second._createFunc();
|
||||
|
|
@ -22,7 +22,7 @@ std::shared_ptr<MacroAction> MacroActionFactory::Create(const int id)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QWidget *MacroActionFactory::CreateWidget(const int id, QWidget *parent,
|
||||
QWidget *MacroActionFactory::CreateWidget(const std::string id, QWidget *parent,
|
||||
std::shared_ptr<MacroAction> action)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end())
|
||||
|
|
@ -31,7 +31,7 @@ QWidget *MacroActionFactory::CreateWidget(const int id, QWidget *parent,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::string MacroActionFactory::GetActionName(int id)
|
||||
std::string MacroActionFactory::GetActionName(const std::string id)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end()) {
|
||||
return it->second._name;
|
||||
|
|
@ -39,6 +39,16 @@ std::string MacroActionFactory::GetActionName(int id)
|
|||
return "unknown action";
|
||||
}
|
||||
|
||||
std::string MacroActionFactory::GetIdByName(const QString &name)
|
||||
{
|
||||
for (auto it : _methods) {
|
||||
if (name == obs_module_text(it.second._name.c_str())) {
|
||||
return it.first;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : MacroActionFactory::GetActionTypes()) {
|
||||
|
|
@ -48,14 +58,15 @@ static inline void populateActionSelection(QComboBox *list)
|
|||
|
||||
MacroActionEdit::MacroActionEdit(QWidget *parent,
|
||||
std::shared_ptr<MacroAction> *entryData,
|
||||
int type, bool startCollapsed)
|
||||
std::string id, bool startCollapsed)
|
||||
: QWidget(parent)
|
||||
{
|
||||
_actionSelection = new QComboBox();
|
||||
_section = new Section(300);
|
||||
|
||||
QWidget::connect(_actionSelection, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(ActionSelectionChanged(int)));
|
||||
QWidget::connect(_actionSelection,
|
||||
SIGNAL(currentTextChanged(const QString &)), this,
|
||||
SLOT(ActionSelectionChanged(const QString &)));
|
||||
|
||||
populateActionSelection(_actionSelection);
|
||||
|
||||
|
|
@ -66,32 +77,35 @@ MacroActionEdit::MacroActionEdit(QWidget *parent,
|
|||
setLayout(mainLayout);
|
||||
|
||||
_entryData = entryData;
|
||||
UpdateEntryData(type);
|
||||
UpdateEntryData(id);
|
||||
|
||||
_loading = false;
|
||||
_section->Collapse(startCollapsed);
|
||||
}
|
||||
|
||||
void MacroActionEdit::ActionSelectionChanged(int idx)
|
||||
void MacroActionEdit::ActionSelectionChanged(const QString &text)
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string id = MacroActionFactory::GetIdByName(text);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->reset();
|
||||
*_entryData = MacroActionFactory::Create(idx);
|
||||
*_entryData = MacroActionFactory::Create(id);
|
||||
auto widget =
|
||||
MacroActionFactory::CreateWidget(idx, window(), *_entryData);
|
||||
MacroActionFactory::CreateWidget(id, window(), *_entryData);
|
||||
_section->SetContent(widget);
|
||||
_section->Collapse(false);
|
||||
}
|
||||
|
||||
void MacroActionEdit::UpdateEntryData(int type)
|
||||
void MacroActionEdit::UpdateEntryData(std::string id)
|
||||
{
|
||||
_actionSelection->setCurrentIndex(type);
|
||||
_actionSelection->setCurrentText(
|
||||
obs_module_text(MacroActionFactory::GetActionName(id).c_str()));
|
||||
auto widget =
|
||||
MacroActionFactory::CreateWidget(type, window(), *_entryData);
|
||||
MacroActionFactory::CreateWidget(id, window(), *_entryData);
|
||||
_section->SetContent(widget);
|
||||
}
|
||||
|
||||
|
|
@ -106,9 +120,13 @@ void AdvSceneSwitcher::on_actionAdd_clicked()
|
|||
if (!macro) {
|
||||
return;
|
||||
}
|
||||
|
||||
MacroActionSwitchScene temp;
|
||||
std::string id = temp.GetId();
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
macro->Actions().emplace_back(MacroActionFactory::Create(0));
|
||||
auto newEntry = new MacroActionEdit(this, ¯o->Actions().back(), 0);
|
||||
macro->Actions().emplace_back(MacroActionFactory::Create(id));
|
||||
auto newEntry = new MacroActionEdit(this, ¯o->Actions().back(), id);
|
||||
ui->macroEditActionLayout->addWidget(newEntry);
|
||||
ui->macroEditActionHelp->setVisible(false);
|
||||
newEntry->Collapse(false);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionFilter::id = 8;
|
||||
const std::string MacroActionFilter::id = "filter";
|
||||
|
||||
bool MacroActionFilter::_registered = MacroActionFactory::Register(
|
||||
MacroActionFilter::id,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionRecord::id = 4;
|
||||
const std::string MacroActionRecord::id = "recording";
|
||||
|
||||
bool MacroActionRecord::_registered = MacroActionFactory::Register(
|
||||
MacroActionRecord::id,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionReplayBuffer::id = 5;
|
||||
const std::string MacroActionReplayBuffer::id = "replay_buffer";
|
||||
|
||||
bool MacroActionReplayBuffer::_registered = MacroActionFactory::Register(
|
||||
MacroActionReplayBuffer::id,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <QProcess>
|
||||
#include <QFileDialog>
|
||||
|
||||
const int MacroActionRun::id = 6;
|
||||
const std::string MacroActionRun::id = "run";
|
||||
|
||||
bool MacroActionRun::_registered = MacroActionFactory::Register(
|
||||
MacroActionRun::id, {MacroActionRun::Create, MacroActionRunEdit::Create,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionSwitchScene::id = 0;
|
||||
const std::string MacroActionSwitchScene::id = "scene_switch";
|
||||
|
||||
bool MacroActionSwitchScene::_registered = MacroActionFactory::Register(
|
||||
MacroActionSwitchScene::id,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionSceneVisibility::id = 7;
|
||||
const std::string MacroActionSceneVisibility::id = "scene_visibility";
|
||||
|
||||
bool MacroActionSceneVisibility::_registered = MacroActionFactory::Register(
|
||||
MacroActionSceneVisibility::id,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionSource::id = 9;
|
||||
const std::string MacroActionSource::id = "source";
|
||||
|
||||
bool MacroActionSource::_registered = MacroActionFactory::Register(
|
||||
MacroActionSource::id,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
const int MacroActionStream::id = 3;
|
||||
const std::string MacroActionStream::id = "streaming";
|
||||
|
||||
bool MacroActionStream::_registered = MacroActionFactory::Register(
|
||||
MacroActionStream::id,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <random>
|
||||
|
||||
const int MacroActionWait::id = 1;
|
||||
const std::string MacroActionWait::id = "wait";
|
||||
|
||||
bool MacroActionWait::_registered = MacroActionFactory::Register(
|
||||
MacroActionWait::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionAudio::id = 3;
|
||||
const std::string MacroConditionAudio::id = "audio";
|
||||
|
||||
bool MacroConditionAudio::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionAudio::id,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#include "headers/macro-condition-edit.hpp"
|
||||
#include "headers/macro-condition-scene.hpp"
|
||||
|
||||
std::map<int, MacroConditionInfo> MacroConditionFactory::_methods;
|
||||
std::map<std::string, MacroConditionInfo> MacroConditionFactory::_methods;
|
||||
|
||||
bool MacroConditionFactory::Register(int id, MacroConditionInfo info)
|
||||
bool MacroConditionFactory::Register(const std::string &id,
|
||||
MacroConditionInfo info)
|
||||
{
|
||||
if (auto it = _methods.find(id); it == _methods.end()) {
|
||||
_methods[id] = info;
|
||||
|
|
@ -11,7 +13,8 @@ bool MacroConditionFactory::Register(int id, MacroConditionInfo info)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<MacroCondition> MacroConditionFactory::Create(const int id)
|
||||
std::shared_ptr<MacroCondition>
|
||||
MacroConditionFactory::Create(const std::string id)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end())
|
||||
return it->second._createFunc();
|
||||
|
|
@ -20,7 +23,7 @@ std::shared_ptr<MacroCondition> MacroConditionFactory::Create(const int id)
|
|||
}
|
||||
|
||||
QWidget *
|
||||
MacroConditionFactory::CreateWidget(const int id, QWidget *parent,
|
||||
MacroConditionFactory::CreateWidget(const std::string &id, QWidget *parent,
|
||||
std::shared_ptr<MacroCondition> cond)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end())
|
||||
|
|
@ -29,7 +32,7 @@ MacroConditionFactory::CreateWidget(const int id, QWidget *parent,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::string MacroConditionFactory::GetConditionName(int id)
|
||||
std::string MacroConditionFactory::GetConditionName(const std::string &id)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end()) {
|
||||
return it->second._name;
|
||||
|
|
@ -37,6 +40,16 @@ std::string MacroConditionFactory::GetConditionName(int id)
|
|||
return "unknown condition";
|
||||
}
|
||||
|
||||
std::string MacroConditionFactory::GetIdByName(const QString &name)
|
||||
{
|
||||
for (auto it : _methods) {
|
||||
if (name == obs_module_text(it.second._name.c_str())) {
|
||||
return it.first;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateLogicSelection(QComboBox *list, bool root = false)
|
||||
{
|
||||
if (root) {
|
||||
|
|
@ -65,8 +78,8 @@ static inline void populateConditionSelection(QComboBox *list)
|
|||
}
|
||||
|
||||
MacroConditionEdit::MacroConditionEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroCondition> *entryData, int type,
|
||||
bool root, bool startCollapsed)
|
||||
QWidget *parent, std::shared_ptr<MacroCondition> *entryData,
|
||||
const std::string &id, bool root, bool startCollapsed)
|
||||
: QWidget(parent)
|
||||
{
|
||||
_logicSelection = new QComboBox();
|
||||
|
|
@ -75,8 +88,9 @@ MacroConditionEdit::MacroConditionEdit(
|
|||
|
||||
QWidget::connect(_logicSelection, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(LogicSelectionChanged(int)));
|
||||
QWidget::connect(_conditionSelection, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(ConditionSelectionChanged(int)));
|
||||
QWidget::connect(_conditionSelection,
|
||||
SIGNAL(currentTextChanged(const QString &)), this,
|
||||
SLOT(ConditionSelectionChanged(const QString &)));
|
||||
|
||||
populateLogicSelection(_logicSelection, root);
|
||||
populateConditionSelection(_conditionSelection);
|
||||
|
|
@ -90,7 +104,7 @@ MacroConditionEdit::MacroConditionEdit(
|
|||
|
||||
_entryData = entryData;
|
||||
_isRoot = root;
|
||||
UpdateEntryData(type);
|
||||
UpdateEntryData(id);
|
||||
_loading = false;
|
||||
_section->Collapse(startCollapsed);
|
||||
}
|
||||
|
|
@ -117,11 +131,12 @@ bool MacroConditionEdit::IsRootNode()
|
|||
return _isRoot;
|
||||
}
|
||||
|
||||
void MacroConditionEdit::UpdateEntryData(int type)
|
||||
void MacroConditionEdit::UpdateEntryData(const std::string &id)
|
||||
{
|
||||
_conditionSelection->setCurrentIndex(type);
|
||||
auto widget = MacroConditionFactory::CreateWidget(type, window(),
|
||||
*_entryData);
|
||||
_conditionSelection->setCurrentText(obs_module_text(
|
||||
MacroConditionFactory::GetConditionName(id).c_str()));
|
||||
auto widget =
|
||||
MacroConditionFactory::CreateWidget(id, window(), *_entryData);
|
||||
auto logic = (*_entryData)->GetLogicType();
|
||||
if (IsRootNode()) {
|
||||
_logicSelection->setCurrentIndex(static_cast<int>(logic));
|
||||
|
|
@ -137,19 +152,21 @@ void MacroConditionEdit::Collapse(bool collapsed)
|
|||
_section->Collapse(collapsed);
|
||||
}
|
||||
|
||||
void MacroConditionEdit::ConditionSelectionChanged(int idx)
|
||||
void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string id = MacroConditionFactory::GetIdByName(text);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
auto logic = (*_entryData)->GetLogicType();
|
||||
_entryData->reset();
|
||||
*_entryData = MacroConditionFactory::Create(idx);
|
||||
*_entryData = MacroConditionFactory::Create(id);
|
||||
(*_entryData)->SetLogicType(logic);
|
||||
auto widget =
|
||||
MacroConditionFactory::CreateWidget(idx, window(), *_entryData);
|
||||
MacroConditionFactory::CreateWidget(id, window(), *_entryData);
|
||||
_section->SetContent(widget);
|
||||
_section->Collapse(false);
|
||||
}
|
||||
|
|
@ -160,14 +177,16 @@ void AdvSceneSwitcher::on_conditionAdd_clicked()
|
|||
if (!macro) {
|
||||
return;
|
||||
}
|
||||
MacroConditionScene temp;
|
||||
std::string id = temp.GetId();
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
bool root = macro->Conditions().size() == 0;
|
||||
macro->Conditions().emplace_back(MacroConditionFactory::Create(0));
|
||||
macro->Conditions().emplace_back(MacroConditionFactory::Create(id));
|
||||
auto logic = root ? LogicType::ROOT_NONE : LogicType::NONE;
|
||||
macro->Conditions().back()->SetLogicType(logic);
|
||||
auto newEntry = new MacroConditionEdit(
|
||||
this, ¯o->Conditions().back(), 0, root);
|
||||
this, ¯o->Conditions().back(), id, root);
|
||||
ui->macroEditConditionLayout->addWidget(newEntry);
|
||||
ui->macroEditConditionHelp->setVisible(false);
|
||||
newEntry->Collapse(false);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <QTextStream>
|
||||
#include <QFileDialog>
|
||||
|
||||
const int MacroConditionFile::id = 4;
|
||||
const std::string MacroConditionFile::id = "file";
|
||||
|
||||
bool MacroConditionFile::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionFile::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionIdle::id = 10;
|
||||
const std::string MacroConditionIdle::id = "idle";
|
||||
|
||||
bool MacroConditionIdle::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionIdle::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionInterval::id = 12;
|
||||
const std::string MacroConditionInterval::id = "interval";
|
||||
|
||||
bool MacroConditionInterval::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionInterval::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionMedia::id = 5;
|
||||
const std::string MacroConditionMedia::id = "media";
|
||||
|
||||
bool MacroConditionMedia::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionMedia::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionPluginState::id = 11;
|
||||
const std::string MacroConditionPluginState::id = "plugin_state";
|
||||
|
||||
bool MacroConditionPluginState::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionPluginState::id,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <regex>
|
||||
|
||||
const int MacroConditionProcess::id = 9;
|
||||
const std::string MacroConditionProcess::id = "process";
|
||||
|
||||
bool MacroConditionProcess::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionProcess::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionRecord::id = 8;
|
||||
const std::string MacroConditionRecord::id = "recording";
|
||||
|
||||
bool MacroConditionRecord::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionRecord::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionRegion::id = 2;
|
||||
const std::string MacroConditionRegion::id = "region";
|
||||
|
||||
bool MacroConditionRegion::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionRegion::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionScene::id = 0;
|
||||
const std::string MacroConditionScene::id = "scene";
|
||||
|
||||
bool MacroConditionScene::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionScene::id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "headers/utility.hpp"
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
const int MacroConditionStream::id = 7;
|
||||
const std::string MacroConditionStream::id = "streaming";
|
||||
|
||||
bool MacroConditionStream::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionStream::id,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <QToolTip>
|
||||
#include <QMessageBox>
|
||||
|
||||
const int MacroConditionVideo::id = 6;
|
||||
const std::string MacroConditionVideo::id = "video";
|
||||
|
||||
bool MacroConditionVideo::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionVideo::id,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <regex>
|
||||
|
||||
const int MacroConditionWindow::id = 1;
|
||||
const std::string MacroConditionWindow::id = "window";
|
||||
|
||||
bool MacroConditionWindow::_registered = MacroConditionFactory::Register(
|
||||
MacroConditionWindow::id,
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ bool Macro::Load(obs_data_t *obj)
|
|||
for (size_t i = 0; i < count; i++) {
|
||||
obs_data_t *array_obj = obs_data_array_item(conditions, i);
|
||||
|
||||
int id = obs_data_get_int(array_obj, "id");
|
||||
std::string id = obs_data_get_string(array_obj, "id");
|
||||
|
||||
auto newEntry = MacroConditionFactory::Create(id);
|
||||
if (newEntry) {
|
||||
|
|
@ -165,8 +165,8 @@ bool Macro::Load(obs_data_t *obj)
|
|||
setValidLogic(c, root, _name);
|
||||
} else {
|
||||
blog(LOG_WARNING,
|
||||
"discarding condition entry with unkown id (%d) for macro %s",
|
||||
id, _name.c_str());
|
||||
"discarding condition entry with unkown id (%s) for macro %s",
|
||||
id.c_str(), _name.c_str());
|
||||
}
|
||||
|
||||
obs_data_release(array_obj);
|
||||
|
|
@ -180,7 +180,7 @@ bool Macro::Load(obs_data_t *obj)
|
|||
for (size_t i = 0; i < count; i++) {
|
||||
obs_data_t *array_obj = obs_data_array_item(actions, i);
|
||||
|
||||
int id = obs_data_get_int(array_obj, "id");
|
||||
std::string id = obs_data_get_string(array_obj, "id");
|
||||
|
||||
auto newEntry = MacroActionFactory::Create(id);
|
||||
if (newEntry) {
|
||||
|
|
@ -188,8 +188,8 @@ bool Macro::Load(obs_data_t *obj)
|
|||
_actions.back()->Load(array_obj);
|
||||
} else {
|
||||
blog(LOG_WARNING,
|
||||
"discarding action entry with unkown id (%d) for macro %s",
|
||||
id, _name.c_str());
|
||||
"discarding action entry with unkown id (%s) for macro %s",
|
||||
id.c_str(), _name.c_str());
|
||||
}
|
||||
|
||||
obs_data_release(array_obj);
|
||||
|
|
@ -202,8 +202,9 @@ bool Macro::Load(obs_data_t *obj)
|
|||
bool Macro::SwitchesScene()
|
||||
{
|
||||
MacroActionSwitchScene temp;
|
||||
auto sceneSwitchId = temp.GetId();
|
||||
for (auto &a : _actions) {
|
||||
if (a->GetId() == temp.GetId()) {
|
||||
if (a->GetId() == sceneSwitchId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -212,7 +213,7 @@ bool Macro::SwitchesScene()
|
|||
|
||||
bool MacroCondition::Save(obs_data_t *obj)
|
||||
{
|
||||
obs_data_set_int(obj, "id", GetId());
|
||||
obs_data_set_string(obj, "id", GetId().c_str());
|
||||
obs_data_set_int(obj, "logic", static_cast<int>(_logic));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -225,7 +226,7 @@ bool MacroCondition::Load(obs_data_t *obj)
|
|||
|
||||
bool MacroAction::Save(obs_data_t *obj)
|
||||
{
|
||||
obs_data_set_int(obj, "id", GetId());
|
||||
obs_data_set_string(obj, "id", GetId().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user