SceneSwitcher/src/headers/macro-action-scene-switch.hpp
2021-07-03 08:47:08 -07:00

56 lines
1.3 KiB
C++

#pragma once
#include "macro-action-edit.hpp"
#include "switch-generic.hpp"
#include "duration-control.hpp"
// TODO: Switch to using SceneSelection class and widget instead
class MacroActionSwitchScene : public MacroAction, public SceneSwitcherEntry {
public:
bool PerformAction();
void LogAction();
bool Save(obs_data_t *obj);
bool Load(obs_data_t *obj);
std::string GetShortDesc();
std::string GetId() { return id; };
static std::shared_ptr<MacroAction> Create()
{
return std::make_shared<MacroActionSwitchScene>();
}
Duration _duration;
private:
const char *getType() { return "MacroActionSwitchScene"; }
static bool _registered;
static const std::string id;
};
class MacroActionSwitchSceneEdit : public SwitchWidget {
Q_OBJECT
public:
MacroActionSwitchSceneEdit(
QWidget *parent,
std::shared_ptr<MacroActionSwitchScene> entryData = nullptr);
static QWidget *Create(QWidget *parent,
std::shared_ptr<MacroAction> action)
{
return new MacroActionSwitchSceneEdit(
parent,
std::dynamic_pointer_cast<MacroActionSwitchScene>(
action));
}
private slots:
void DurationChanged(double seconds);
void ChangeHeaderInfo(const QString &);
signals:
void HeaderInfoChanged(const QString &);
protected:
DurationSelection *_duration;
std::shared_ptr<MacroActionSwitchScene> _entryData;
};