SceneSwitcher/plugins/base/macro-action-projector.hpp
WarmUpTill d77101b6aa Restore fullscreen projector display selection
Instead of discarding the monitor selection now only no longer perform
the action while the monitor setup is changed.
2024-06-18 21:24:28 +02:00

84 lines
1.8 KiB
C++

#pragma once
#include "macro-action-edit.hpp"
#include "scene-selection.hpp"
#include "source-selection.hpp"
namespace advss {
class MacroActionProjector : public MacroAction {
public:
MacroActionProjector(Macro *m) : MacroAction(m) {}
bool PerformAction();
void LogAction() const;
bool Save(obs_data_t *obj) const;
bool Load(obs_data_t *obj);
std::string GetId() const { return id; };
static std::shared_ptr<MacroAction> Create(Macro *m);
std::shared_ptr<MacroAction> Copy() const;
void ResolveVariablesToFixedValues();
void SetMonitor(int);
int GetMonitor() const;
enum class Type {
SOURCE,
SCENE,
PREVIEW,
PROGRAM,
MULTIVIEW,
};
Type _type = Type::SCENE;
SourceSelection _source;
SceneSelection _scene;
bool _fullscreen = true;
private:
bool MonitorSetupChanged() const;
int _monitor = -1;
// Only used to detect display setup changes
std::string _monitorName = "";
static bool _registered;
static const std::string id;
};
class MacroActionProjectorEdit : public QWidget {
Q_OBJECT
public:
MacroActionProjectorEdit(
QWidget *parent,
std::shared_ptr<MacroActionProjector> entryData = nullptr);
void UpdateEntryData();
static QWidget *Create(QWidget *parent,
std::shared_ptr<MacroAction> action)
{
return new MacroActionProjectorEdit(
parent, std::dynamic_pointer_cast<MacroActionProjector>(
action));
}
private slots:
void WindowTypeChanged(int value);
void TypeChanged(int value);
void SceneChanged(const SceneSelection &);
void SourceChanged(const SourceSelection &);
void MonitorChanged(int value);
private:
void SetWidgetVisibility();
QComboBox *_windowTypes;
QComboBox *_types;
SceneSelectionWidget *_scenes;
SourceSelectionWidget *_sources;
QHBoxLayout *_monitorSelection;
QComboBox *_monitors;
std::shared_ptr<MacroActionProjector> _entryData;
bool _loading = true;
};
} // namespace advss