mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-28 04:06:27 -05:00
Display more information about macros in collapsed state
This commit is contained in:
@@ -15,6 +15,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -51,6 +52,8 @@ private slots:
|
||||
void SourceChanged(const QString &text);
|
||||
void ActionChanged(int value);
|
||||
void VolumeChanged(int value);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_audioSources;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QComboBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <deque>
|
||||
#include "macro.hpp"
|
||||
#include "section.hpp"
|
||||
@@ -44,10 +45,12 @@ public:
|
||||
|
||||
private slots:
|
||||
void ActionSelectionChanged(const QString &text);
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_actionSelection;
|
||||
Section *_section;
|
||||
QLabel *_headerInfo;
|
||||
|
||||
std::shared_ptr<MacroAction> *_entryData;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -53,6 +54,8 @@ private slots:
|
||||
void ActionChanged(int value);
|
||||
void GetSettingsClicked();
|
||||
void SettingsChanged();
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_sources;
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -48,6 +49,8 @@ private slots:
|
||||
void MacroChanged(const QString &text);
|
||||
void MacroRemove(const QString &name);
|
||||
void ActionChanged(int value);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
MacroSelection *_macros;
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -50,6 +51,8 @@ public:
|
||||
private slots:
|
||||
void SourceChanged(const QString &text);
|
||||
void ActionChanged(int value);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_mediaSources;
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -48,6 +49,8 @@ private slots:
|
||||
void RemoveArg();
|
||||
void ArgUp();
|
||||
void ArgDown();
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<MacroActionRun> _entryData;
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -54,6 +55,8 @@ private slots:
|
||||
void SourceChanged(const QString &text);
|
||||
void ActionChanged(int value);
|
||||
void PositionChanged(int value);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_scenes;
|
||||
|
||||
@@ -9,6 +9,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
@@ -42,6 +43,9 @@ public:
|
||||
|
||||
private slots:
|
||||
void DurationChanged(double seconds);
|
||||
void ChangeHeaderInfo(const QString &);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
DurationSelection *_duration;
|
||||
|
||||
@@ -9,6 +9,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -49,6 +50,8 @@ private slots:
|
||||
void SourceChanged(const QString &text);
|
||||
void GetSettingsClicked();
|
||||
void SettingsChanged();
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_scenes;
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -49,6 +50,8 @@ private slots:
|
||||
void SceneChanged(const QString &text);
|
||||
void SourceChanged(const QString &text);
|
||||
void ActionChanged(int value);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_scenes;
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
{
|
||||
@@ -54,6 +55,8 @@ private slots:
|
||||
void ActionChanged(int value);
|
||||
void GetSettingsClicked();
|
||||
void SettingsChanged();
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_sources;
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -60,6 +61,8 @@ private slots:
|
||||
void SourceChanged(const QString &text);
|
||||
void VolumeThresholdChanged(int vol);
|
||||
void ConditionChanged(int cond);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_audioSources;
|
||||
|
||||
@@ -51,11 +51,13 @@ private slots:
|
||||
void DurationChanged(double seconds);
|
||||
void DurationConditionChanged(DurationCondition cond);
|
||||
void DurationUnitChanged(DurationUnit unit);
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_logicSelection;
|
||||
QComboBox *_conditionSelection;
|
||||
Section *_section;
|
||||
QLabel *_headerInfo;
|
||||
DurationConstraintEdit *_dur;
|
||||
|
||||
std::shared_ptr<MacroCondition> *_entryData;
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -66,6 +67,8 @@ private slots:
|
||||
void UseRegexChanged(int state);
|
||||
void CheckModificationDateChanged(int state);
|
||||
void OnlyMatchIfChangedChanged(int state);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_fileType;
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -54,6 +55,8 @@ private slots:
|
||||
void GetSettingsClicked();
|
||||
void SettingsChanged();
|
||||
void RegexChanged(int);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_sources;
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -64,6 +65,8 @@ private slots:
|
||||
void ConditionChanged(int cond);
|
||||
void ResetClicked();
|
||||
void UpdateCount();
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
MacroSelection *_macros;
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -90,6 +91,8 @@ private slots:
|
||||
void TimeRestrictionChanged(int index);
|
||||
void TimeChanged(double seconds);
|
||||
void TimeUnitChanged(DurationUnit unit);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_mediaSources;
|
||||
|
||||
@@ -8,6 +8,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -41,6 +42,8 @@ public:
|
||||
private slots:
|
||||
void ProcessChanged(const QString &text);
|
||||
void FocusChanged(int state);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_processSelection;
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -54,6 +55,8 @@ private slots:
|
||||
void Source2Changed(const QString &text);
|
||||
void ConditionChanged(int cond);
|
||||
void PositionChanged(int cond);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_scenes;
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -46,6 +47,8 @@ public:
|
||||
private slots:
|
||||
void SceneChanged(const QString &text);
|
||||
void TypeChanged(int value);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_sceneSelection;
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -52,6 +53,8 @@ private slots:
|
||||
void GetSettingsClicked();
|
||||
void SettingsChanged();
|
||||
void RegexChanged(int);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_sources;
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
QImage GetMatchImage() { return _matchImage; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
@@ -65,6 +66,8 @@ private slots:
|
||||
void ConditionChanged(int cond);
|
||||
void FilePathChanged();
|
||||
void BrowseButtonClicked();
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_videoSelection;
|
||||
|
||||
@@ -8,6 +8,7 @@ public:
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
{
|
||||
@@ -53,6 +54,8 @@ private slots:
|
||||
void MaximizedChanged(int state);
|
||||
void FocusedChanged(int state);
|
||||
void WindowFocusChanged(int state);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
protected:
|
||||
QComboBox *_windowSelection;
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
virtual bool CheckCondition() = 0;
|
||||
virtual bool Save(obs_data_t *obj) = 0;
|
||||
virtual bool Load(obs_data_t *obj) = 0;
|
||||
virtual std::string GetShortDesc();
|
||||
virtual std::string GetId() = 0;
|
||||
|
||||
LogicType GetLogicType() { return _logic; }
|
||||
@@ -65,6 +66,7 @@ public:
|
||||
virtual bool PerformAction() = 0;
|
||||
virtual bool Save(obs_data_t *obj) = 0;
|
||||
virtual bool Load(obs_data_t *obj) = 0;
|
||||
virtual std::string GetShortDesc();
|
||||
virtual std::string GetId() = 0;
|
||||
virtual void LogAction();
|
||||
};
|
||||
|
||||
@@ -75,6 +75,14 @@ bool MacroActionAudio::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionAudio::GetShortDesc()
|
||||
{
|
||||
if (_audioSource) {
|
||||
return GetWeakSourceName(_audioSource);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : actionTypes) {
|
||||
@@ -167,6 +175,8 @@ void MacroActionAudioEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_audioSource = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionAudioEdit::ActionChanged(int value)
|
||||
|
||||
@@ -64,6 +64,7 @@ MacroActionEdit::MacroActionEdit(QWidget *parent,
|
||||
{
|
||||
_actionSelection = new QComboBox();
|
||||
_section = new Section(300);
|
||||
_headerInfo = new QLabel();
|
||||
|
||||
QWidget::connect(_actionSelection,
|
||||
SIGNAL(currentTextChanged(const QString &)), this,
|
||||
@@ -72,6 +73,7 @@ MacroActionEdit::MacroActionEdit(QWidget *parent,
|
||||
populateActionSelection(_actionSelection);
|
||||
|
||||
_section->AddHeaderWidget(_actionSelection);
|
||||
_section->AddHeaderWidget(_headerInfo);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(_section);
|
||||
@@ -90,12 +92,14 @@ void MacroActionEdit::ActionSelectionChanged(const QString &text)
|
||||
}
|
||||
|
||||
std::string id = MacroActionFactory::GetIdByName(text);
|
||||
HeaderInfoChanged("");
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->reset();
|
||||
*_entryData = MacroActionFactory::Create(id);
|
||||
auto widget =
|
||||
MacroActionFactory::CreateWidget(id, window(), *_entryData);
|
||||
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||
this, SLOT(HeaderInfoChanged(const QString &)));
|
||||
_section->SetContent(widget, false);
|
||||
}
|
||||
|
||||
@@ -103,11 +107,20 @@ void MacroActionEdit::UpdateEntryData(const std::string &id, bool collapse)
|
||||
{
|
||||
_actionSelection->setCurrentText(
|
||||
obs_module_text(MacroActionFactory::GetActionName(id).c_str()));
|
||||
auto widget =
|
||||
MacroActionFactory::CreateWidget(id, window(), *_entryData);
|
||||
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||
this, SLOT(HeaderInfoChanged(const QString &)));
|
||||
HeaderInfoChanged(
|
||||
QString::fromStdString((*_entryData)->GetShortDesc()));
|
||||
_section->SetContent(widget, collapse);
|
||||
}
|
||||
|
||||
void MacroActionEdit::HeaderInfoChanged(const QString &text)
|
||||
{
|
||||
_headerInfo->setVisible(!text.isEmpty());
|
||||
_headerInfo->setText(text);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_actionAdd_clicked()
|
||||
{
|
||||
auto macro = getSelectedMacro();
|
||||
|
||||
@@ -72,6 +72,15 @@ bool MacroActionFilter::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionFilter::GetShortDesc()
|
||||
{
|
||||
if (_filter && _source) {
|
||||
return GetWeakSourceName(_source) + " - " +
|
||||
GetWeakSourceName(_filter);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : actionTypes) {
|
||||
@@ -166,6 +175,8 @@ void MacroActionFilterEdit::FilterChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_filter = GetWeakFilterByQString(_entryData->_source, text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionFilterEdit::ActionChanged(int value)
|
||||
|
||||
@@ -77,6 +77,14 @@ bool MacroActionMacro::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionMacro::GetShortDesc()
|
||||
{
|
||||
if (_macro.get()) {
|
||||
return _macro->Name();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : actionTypes) {
|
||||
@@ -131,6 +139,8 @@ void MacroActionMacroEdit::MacroChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_macro.UpdateRef(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionMacroEdit::ActionChanged(int value)
|
||||
|
||||
@@ -84,6 +84,14 @@ bool MacroActionMedia::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionMedia::GetShortDesc()
|
||||
{
|
||||
if (_mediaSource) {
|
||||
return GetWeakSourceName(_mediaSource);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : actionTypes) {
|
||||
@@ -140,6 +148,8 @@ void MacroActionMediaEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_mediaSource = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionMediaEdit::ActionChanged(int value)
|
||||
|
||||
@@ -56,6 +56,11 @@ bool MacroActionRun::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionRun::GetShortDesc()
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
MacroActionRunEdit::MacroActionRunEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroActionRun> entryData)
|
||||
: QWidget(parent)
|
||||
@@ -143,6 +148,8 @@ void MacroActionRunEdit::FilePathChanged()
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_path = _filePath->text().toUtf8().constData();
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionRunEdit::BrowseButtonClicked()
|
||||
|
||||
@@ -93,6 +93,15 @@ bool MacroActionSceneOrder::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionSceneOrder::GetShortDesc()
|
||||
{
|
||||
if (_scene && _source) {
|
||||
return GetWeakSourceName(_scene) + " - " +
|
||||
GetWeakSourceName(_source);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : actionTypes) {
|
||||
@@ -175,6 +184,8 @@ void MacroActionSceneOrderEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_source = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionSceneOrderEdit::ActionChanged(int value)
|
||||
|
||||
@@ -39,6 +39,17 @@ bool MacroActionSwitchScene::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionSwitchScene::GetShortDesc()
|
||||
{
|
||||
if (targetType == SwitchTargetType::Scene && scene) {
|
||||
return GetWeakSourceName(scene);
|
||||
}
|
||||
if (targetType == SwitchTargetType::SceneGroup && group) {
|
||||
return group->name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroActionSwitchScene> entryData)
|
||||
: SwitchWidget(parent, entryData.get(), true, true)
|
||||
@@ -46,6 +57,8 @@ MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
||||
_duration = new DurationSelection(parent, false);
|
||||
QWidget::connect(_duration, SIGNAL(DurationChanged(double)), this,
|
||||
SLOT(DurationChanged(double)));
|
||||
QWidget::connect(scenes, SIGNAL(currentTextChanged(const QString &)),
|
||||
this, SLOT(ChangeHeaderInfo(const QString &)));
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
@@ -71,3 +84,9 @@ void MacroActionSwitchSceneEdit::DurationChanged(double seconds)
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_duration.seconds = seconds;
|
||||
}
|
||||
|
||||
void MacroActionSwitchSceneEdit::ChangeHeaderInfo(const QString &)
|
||||
{
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
@@ -118,6 +118,15 @@ bool MacroActionSceneTransform::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionSceneTransform::GetShortDesc()
|
||||
{
|
||||
if (_scene && _source) {
|
||||
return GetWeakSourceName(_scene) + " - " +
|
||||
GetWeakSourceName(_source);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string MacroActionSceneTransform::GetSettings()
|
||||
{
|
||||
auto data = obs_data_create();
|
||||
@@ -222,6 +231,8 @@ void MacroActionSceneTransformEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_source = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionSceneTransformEdit::GetSettingsClicked()
|
||||
|
||||
@@ -94,6 +94,15 @@ bool MacroActionSceneVisibility::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionSceneVisibility::GetShortDesc()
|
||||
{
|
||||
if (_scene && _source) {
|
||||
return GetWeakSourceName(_scene) + " - " +
|
||||
GetWeakSourceName(_source);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : actionTypes) {
|
||||
@@ -169,6 +178,8 @@ void MacroActionSceneVisibilityEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_source = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionSceneVisibilityEdit::ActionChanged(int value)
|
||||
|
||||
@@ -67,6 +67,14 @@ bool MacroActionSource::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroActionSource::GetShortDesc()
|
||||
{
|
||||
if (_source) {
|
||||
return GetWeakSourceName(_source);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateActionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : actionTypes) {
|
||||
@@ -143,6 +151,8 @@ void MacroActionSourceEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_source = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroActionSourceEdit::ActionChanged(int value)
|
||||
|
||||
@@ -77,6 +77,14 @@ bool MacroConditionAudio::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionAudio::GetShortDesc()
|
||||
{
|
||||
if (_audioSource) {
|
||||
return GetWeakSourceName(_audioSource);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void MacroConditionAudio::SetVolumeLevel(
|
||||
void *data, const float magnitude[MAX_AUDIO_CHANNELS],
|
||||
const float peak[MAX_AUDIO_CHANNELS],
|
||||
@@ -181,6 +189,8 @@ void MacroConditionAudioEdit::SourceChanged(const QString &text)
|
||||
_entryData->_audioSource = GetWeakSourceByQString(text);
|
||||
_entryData->ResetVolmeter();
|
||||
UpdateVolmeterSource();
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionAudioEdit::VolumeThresholdChanged(int vol)
|
||||
|
||||
@@ -93,6 +93,7 @@ MacroConditionEdit::MacroConditionEdit(
|
||||
_logicSelection = new QComboBox();
|
||||
_conditionSelection = new QComboBox();
|
||||
_section = new Section(300);
|
||||
_headerInfo = new QLabel();
|
||||
_dur = new DurationConstraintEdit();
|
||||
|
||||
QWidget::connect(_logicSelection, SIGNAL(currentIndexChanged(int)),
|
||||
@@ -113,6 +114,7 @@ MacroConditionEdit::MacroConditionEdit(
|
||||
|
||||
_section->AddHeaderWidget(_logicSelection);
|
||||
_section->AddHeaderWidget(_conditionSelection);
|
||||
_section->AddHeaderWidget(_headerInfo);
|
||||
_section->AddHeaderWidget(_dur);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
@@ -152,7 +154,11 @@ void MacroConditionEdit::UpdateEntryData(const std::string &id, bool collapse)
|
||||
_conditionSelection->setCurrentText(obs_module_text(
|
||||
MacroConditionFactory::GetConditionName(id).c_str()));
|
||||
auto widget =
|
||||
MacroConditionFactory::CreateWidget(id, window(), *_entryData);
|
||||
MacroConditionFactory::CreateWidget(id, this, *_entryData);
|
||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||
this, SLOT(HeaderInfoChanged(const QString &)));
|
||||
HeaderInfoChanged(
|
||||
QString::fromStdString((*_entryData)->GetShortDesc()));
|
||||
auto logic = (*_entryData)->GetLogicType();
|
||||
if (IsRootNode()) {
|
||||
_logicSelection->setCurrentIndex(static_cast<int>(logic));
|
||||
@@ -177,6 +183,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
||||
|
||||
auto temp = DurationConstraint();
|
||||
_dur->SetValue(temp);
|
||||
HeaderInfoChanged("");
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
auto logic = (*_entryData)->GetLogicType();
|
||||
@@ -184,7 +191,9 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
||||
*_entryData = MacroConditionFactory::Create(id);
|
||||
(*_entryData)->SetLogicType(logic);
|
||||
auto widget =
|
||||
MacroConditionFactory::CreateWidget(id, window(), *_entryData);
|
||||
MacroConditionFactory::CreateWidget(id, this, *_entryData);
|
||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||
this, SLOT(HeaderInfoChanged(const QString &)));
|
||||
_section->SetContent(widget, false);
|
||||
_dur->setVisible(MacroConditionFactory::UsesDurationConstraint(id));
|
||||
}
|
||||
@@ -219,6 +228,12 @@ void MacroConditionEdit::DurationUnitChanged(DurationUnit unit)
|
||||
(*_entryData)->SetDurationUnit(unit);
|
||||
}
|
||||
|
||||
void MacroConditionEdit::HeaderInfoChanged(const QString &text)
|
||||
{
|
||||
_headerInfo->setVisible(!text.isEmpty());
|
||||
_headerInfo->setText(text);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_conditionAdd_clicked()
|
||||
{
|
||||
auto macro = getSelectedMacro();
|
||||
|
||||
@@ -119,6 +119,11 @@ bool MacroConditionFile::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionFile::GetShortDesc()
|
||||
{
|
||||
return _file;
|
||||
}
|
||||
|
||||
MacroConditionFileEdit::MacroConditionFileEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroConditionFile> entryData)
|
||||
: QWidget(parent)
|
||||
@@ -231,6 +236,8 @@ void MacroConditionFileEdit::FilePathChanged()
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_file = _filePath->text().toUtf8().constData();
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionFileEdit::BrowseButtonClicked()
|
||||
|
||||
@@ -74,6 +74,15 @@ bool MacroConditionFilter::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionFilter::GetShortDesc()
|
||||
{
|
||||
if (_filter && _source) {
|
||||
return GetWeakSourceName(_source) + " - " +
|
||||
GetWeakSourceName(_filter);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateConditionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : filterConditionTypes) {
|
||||
@@ -160,6 +169,8 @@ void MacroConditionFilterEdit::FilterChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_filter = GetWeakFilterByQString(_entryData->_source, text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionFilterEdit::ConditionChanged(int index)
|
||||
|
||||
@@ -98,6 +98,14 @@ bool MacroConditionMacro::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionMacro::GetShortDesc()
|
||||
{
|
||||
if (_macro.get()) {
|
||||
return _macro->Name();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateTypeSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : macroConditionTypes) {
|
||||
@@ -247,6 +255,8 @@ void MacroConditionMacroEdit::MacroChanged(const QString &text)
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_macro.UpdateRef(text);
|
||||
ResetTimer();
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionMacroEdit::CountChanged(int value)
|
||||
|
||||
@@ -189,6 +189,14 @@ bool MacroConditionMedia::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionMedia::GetShortDesc()
|
||||
{
|
||||
if (_source) {
|
||||
return GetWeakSourceName(_source);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void MacroConditionMedia::ClearSignalHandler()
|
||||
{
|
||||
obs_source_t *mediasource = obs_weak_source_get_source(_source);
|
||||
@@ -286,6 +294,8 @@ void MacroConditionMediaEdit::SourceChanged(const QString &text)
|
||||
_entryData->ClearSignalHandler();
|
||||
_entryData->_source = GetWeakSourceByQString(text);
|
||||
_entryData->ResetSignalHandler();
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
MediaState getMediaStateFromIdx(int idx)
|
||||
|
||||
@@ -41,6 +41,11 @@ bool MacroConditionProcess::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionProcess::GetShortDesc()
|
||||
{
|
||||
return _process;
|
||||
}
|
||||
|
||||
MacroConditionProcessEdit::MacroConditionProcessEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroConditionProcess> entryData)
|
||||
: QWidget(parent)
|
||||
@@ -83,6 +88,8 @@ void MacroConditionProcessEdit::ProcessChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_process = text.toStdString();
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionProcessEdit::FocusChanged(int state)
|
||||
|
||||
@@ -133,6 +133,15 @@ bool MacroConditionSceneOrder::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionSceneOrder::GetShortDesc()
|
||||
{
|
||||
if (_scene && _source) {
|
||||
return GetWeakSourceName(_scene) + " - " +
|
||||
GetWeakSourceName(_source);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateConditionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : sceneOrderConditionTypes) {
|
||||
@@ -208,6 +217,8 @@ void MacroConditionSceneOrderEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_source = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionSceneOrderEdit::Source2Changed(const QString &text)
|
||||
|
||||
@@ -48,6 +48,14 @@ bool MacroConditionScene::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionScene::GetShortDesc()
|
||||
{
|
||||
if (_scene) {
|
||||
return GetWeakSourceName(_scene);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateTypeSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : sceneTypes) {
|
||||
@@ -93,6 +101,8 @@ void MacroConditionSceneEdit::SceneChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_scene = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionSceneEdit::TypeChanged(int value)
|
||||
|
||||
@@ -71,6 +71,14 @@ bool MacroConditionSource::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionSource::GetShortDesc()
|
||||
{
|
||||
if (_source) {
|
||||
return GetWeakSourceName(_source);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void populateConditionSelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : sourceConditionTypes) {
|
||||
@@ -140,6 +148,8 @@ void MacroConditionSourceEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_source = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionSourceEdit::ConditionChanged(int index)
|
||||
|
||||
@@ -76,6 +76,14 @@ bool MacroConditionVideo::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionVideo::GetShortDesc()
|
||||
{
|
||||
if (_videoSource) {
|
||||
return GetWeakSourceName(_videoSource);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void MacroConditionVideo::GetScreenshot()
|
||||
{
|
||||
auto source = obs_weak_source_get_source(_videoSource);
|
||||
@@ -204,6 +212,8 @@ void MacroConditionVideoEdit::SourceChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_videoSource = GetWeakSourceByQString(text);
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionVideoEdit::ConditionChanged(int cond)
|
||||
|
||||
@@ -94,6 +94,11 @@ bool MacroConditionWindow::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroConditionWindow::GetShortDesc()
|
||||
{
|
||||
return _window;
|
||||
}
|
||||
|
||||
MacroConditionWindowEdit::MacroConditionWindowEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroConditionWindow> entryData)
|
||||
: QWidget(parent)
|
||||
@@ -155,6 +160,8 @@ void MacroConditionWindowEdit::WindowChanged(const QString &text)
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_window = text.toStdString();
|
||||
emit HeaderInfoChanged(
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionWindowEdit::FullscreenChanged(int state)
|
||||
|
||||
@@ -365,6 +365,11 @@ bool MacroCondition::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroCondition::GetShortDesc()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void MacroCondition::SetDurationConstraint(const DurationConstraint &dur)
|
||||
{
|
||||
_duration = dur;
|
||||
@@ -397,6 +402,11 @@ bool MacroAction::Load(obs_data_t *obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroAction::GetShortDesc()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void MacroAction::LogAction()
|
||||
{
|
||||
vblog(LOG_INFO, "performed action %s", GetId().c_str());
|
||||
|
||||
Reference in New Issue
Block a user