mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-06-23 13:01:56 -05:00
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.
60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
#pragma once
|
|
#include "macro.hpp"
|
|
#include <QWidget>
|
|
#include <QComboBox>
|
|
#include "duration-control.hpp"
|
|
|
|
enum class StreamState {
|
|
STOP,
|
|
START,
|
|
};
|
|
|
|
class MacroConditionStream : public MacroCondition {
|
|
public:
|
|
bool CheckCondition();
|
|
bool Save(obs_data_t *obj);
|
|
bool Load(obs_data_t *obj);
|
|
std::string GetId() { return id; };
|
|
static std::shared_ptr<MacroCondition> Create()
|
|
{
|
|
return std::make_shared<MacroConditionStream>();
|
|
}
|
|
|
|
StreamState _streamState;
|
|
Duration _duration;
|
|
|
|
private:
|
|
static bool _registered;
|
|
static const std::string id;
|
|
};
|
|
|
|
class MacroConditionStreamEdit : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MacroConditionStreamEdit(
|
|
QWidget *parent,
|
|
std::shared_ptr<MacroConditionStream> cond = nullptr);
|
|
void UpdateEntryData();
|
|
static QWidget *Create(QWidget *parent,
|
|
std::shared_ptr<MacroCondition> cond)
|
|
{
|
|
return new MacroConditionStreamEdit(
|
|
parent,
|
|
std::dynamic_pointer_cast<MacroConditionStream>(cond));
|
|
}
|
|
|
|
private slots:
|
|
void StateChanged(int value);
|
|
void DurationChanged(double seconds);
|
|
void DurationUnitChanged(DurationUnit unit);
|
|
|
|
protected:
|
|
QComboBox *_streamState;
|
|
DurationSelection *_duration;
|
|
std::shared_ptr<MacroConditionStream> _entryData;
|
|
|
|
private:
|
|
bool _loading = true;
|
|
};
|