mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-06-23 04:51:54 -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.
53 lines
1.1 KiB
C++
53 lines
1.1 KiB
C++
#pragma once
|
|
#include "macro.hpp"
|
|
#include <QWidget>
|
|
#include <QComboBox>
|
|
|
|
class MacroConditionProcess : 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<MacroConditionProcess>();
|
|
}
|
|
|
|
std::string _process;
|
|
bool _focus = true;
|
|
|
|
private:
|
|
static bool _registered;
|
|
static const std::string id;
|
|
};
|
|
|
|
class MacroConditionProcessEdit : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MacroConditionProcessEdit(
|
|
QWidget *parent,
|
|
std::shared_ptr<MacroConditionProcess> cond = nullptr);
|
|
void UpdateEntryData();
|
|
static QWidget *Create(QWidget *parent,
|
|
std::shared_ptr<MacroCondition> cond)
|
|
{
|
|
return new MacroConditionProcessEdit(
|
|
parent,
|
|
std::dynamic_pointer_cast<MacroConditionProcess>(cond));
|
|
}
|
|
|
|
private slots:
|
|
void ProcessChanged(const QString &text);
|
|
void FocusChanged(int state);
|
|
|
|
protected:
|
|
QComboBox *_processSelection;
|
|
QCheckBox *_focused;
|
|
std::shared_ptr<MacroConditionProcess> _entryData;
|
|
|
|
private:
|
|
bool _loading = true;
|
|
};
|