mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-24 23:08:07 -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.
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#pragma once
|
|
#include "macro.hpp"
|
|
#include <QWidget>
|
|
#include <QComboBox>
|
|
|
|
class MacroConditionRegion : 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<MacroConditionRegion>();
|
|
}
|
|
|
|
int _minX = 0, _minY = 0, _maxX = 0, _maxY = 0;
|
|
|
|
private:
|
|
static bool _registered;
|
|
static const std::string id;
|
|
};
|
|
|
|
class MacroConditionRegionEdit : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MacroConditionRegionEdit(
|
|
QWidget *parent,
|
|
std::shared_ptr<MacroConditionRegion> cond = nullptr);
|
|
void UpdateEntryData();
|
|
static QWidget *Create(QWidget *parent,
|
|
std::shared_ptr<MacroCondition> cond)
|
|
{
|
|
return new MacroConditionRegionEdit(
|
|
parent,
|
|
std::dynamic_pointer_cast<MacroConditionRegion>(cond));
|
|
}
|
|
|
|
private slots:
|
|
void MinXChanged(int pos);
|
|
void MinYChanged(int pos);
|
|
void MaxXChanged(int pos);
|
|
void MaxYChanged(int pos);
|
|
|
|
protected:
|
|
QSpinBox *_minX;
|
|
QSpinBox *_minY;
|
|
QSpinBox *_maxX;
|
|
QSpinBox *_maxY;
|
|
std::shared_ptr<MacroConditionRegion> _entryData;
|
|
|
|
private:
|
|
bool _loading = true;
|
|
};
|