SceneSwitcher/lib/legacy/scene-group.hpp
WarmUpTill 7d0332dd0e Restructure library and plugins
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.
2024-01-27 14:10:34 +01:00

93 lines
1.9 KiB
C++

#pragma once
#include <deque>
#include <vector>
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QCheckBox>
#include <obs.hpp>
namespace advss {
auto constexpr invalid_scene_group_name = "invalid-scene-group";
enum class AdvanceCondition {
Count,
Time,
Random,
};
struct SceneGroup {
OBSWeakSource getCurrentScene();
OBSWeakSource getNextScene();
OBSWeakSource getNextSceneCount();
OBSWeakSource getNextSceneTime();
OBSWeakSource getNextSceneRandom();
void advanceIdx();
std::string name = invalid_scene_group_name;
AdvanceCondition type = AdvanceCondition::Count;
std::vector<OBSWeakSource> scenes = {};
int count = 1;
double time = 0;
bool repeat = false;
size_t currentIdx = 0;
int currentCount = -1;
std::chrono::high_resolution_clock::time_point lastAdvTime;
int lastRandomScene = -1;
inline SceneGroup(){};
inline SceneGroup(const std::string &name_) : name(name_){};
inline SceneGroup(const std::string &name_, AdvanceCondition type_,
const std::vector<OBSWeakSource> &scenes_, int count_,
double time_, bool repeat_)
: name(name_),
type(type_),
scenes(scenes_),
count(count_),
time(time_),
repeat(repeat_)
{
}
};
class SceneGroupEditWidget : public QWidget {
Q_OBJECT
public:
SceneGroupEditWidget();
void SetEditSceneGroup(SceneGroup *sg);
void ShowCurrentTypeEdit();
private slots:
void TypeChanged(int type);
void CountChanged(int count);
void TimeChanged(double time);
void RepeatChanged(int state);
private:
QComboBox *type;
QWidget *timeEdit;
QWidget *countEdit;
QSpinBox *count;
QDoubleSpinBox *time;
QLabel *random;
QCheckBox *repeat;
SceneGroup *sceneGroup = nullptr;
};
SceneGroup *GetSceneGroupByName(const char *name);
SceneGroup *GetSceneGroupByQString(const QString &name);
std::deque<SceneGroup> &GetSceneGroups();
} // namespace advss