diff --git a/src/headers/macro-action-audio.hpp b/src/headers/macro-action-audio.hpp index 315be060..72fb28d0 100644 --- a/src/headers/macro-action-audio.hpp +++ b/src/headers/macro-action-audio.hpp @@ -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 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; diff --git a/src/headers/macro-action-edit.hpp b/src/headers/macro-action-edit.hpp index ee045053..830664cc 100644 --- a/src/headers/macro-action-edit.hpp +++ b/src/headers/macro-action-edit.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #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 *_entryData; diff --git a/src/headers/macro-action-filter.hpp b/src/headers/macro-action-filter.hpp index bd572baa..3ec576f7 100644 --- a/src/headers/macro-action-filter.hpp +++ b/src/headers/macro-action-filter.hpp @@ -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 Create() { @@ -53,6 +54,8 @@ private slots: void ActionChanged(int value); void GetSettingsClicked(); void SettingsChanged(); +signals: + void HeaderInfoChanged(const QString &); protected: QComboBox *_sources; diff --git a/src/headers/macro-action-macro.hpp b/src/headers/macro-action-macro.hpp index 75ae149b..4d13a10b 100644 --- a/src/headers/macro-action-macro.hpp +++ b/src/headers/macro-action-macro.hpp @@ -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 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; diff --git a/src/headers/macro-action-media.hpp b/src/headers/macro-action-media.hpp index 1ba797c1..a4f583a3 100644 --- a/src/headers/macro-action-media.hpp +++ b/src/headers/macro-action-media.hpp @@ -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 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; diff --git a/src/headers/macro-action-run.hpp b/src/headers/macro-action-run.hpp index 88045585..14d298da 100644 --- a/src/headers/macro-action-run.hpp +++ b/src/headers/macro-action-run.hpp @@ -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 Create() { @@ -48,6 +49,8 @@ private slots: void RemoveArg(); void ArgUp(); void ArgDown(); +signals: + void HeaderInfoChanged(const QString &); protected: std::shared_ptr _entryData; diff --git a/src/headers/macro-action-scene-order.hpp b/src/headers/macro-action-scene-order.hpp index 351f66ca..f3b23dd7 100644 --- a/src/headers/macro-action-scene-order.hpp +++ b/src/headers/macro-action-scene-order.hpp @@ -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 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; diff --git a/src/headers/macro-action-scene-switch.hpp b/src/headers/macro-action-scene-switch.hpp index 967e2bfc..f12e2894 100644 --- a/src/headers/macro-action-scene-switch.hpp +++ b/src/headers/macro-action-scene-switch.hpp @@ -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 Create() @@ -42,6 +43,9 @@ public: private slots: void DurationChanged(double seconds); + void ChangeHeaderInfo(const QString &); +signals: + void HeaderInfoChanged(const QString &); protected: DurationSelection *_duration; diff --git a/src/headers/macro-action-scene-transform.hpp b/src/headers/macro-action-scene-transform.hpp index 4c9c4cc8..7e30e6b5 100644 --- a/src/headers/macro-action-scene-transform.hpp +++ b/src/headers/macro-action-scene-transform.hpp @@ -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 Create() { @@ -49,6 +50,8 @@ private slots: void SourceChanged(const QString &text); void GetSettingsClicked(); void SettingsChanged(); +signals: + void HeaderInfoChanged(const QString &); protected: QComboBox *_scenes; diff --git a/src/headers/macro-action-scene-visibility.hpp b/src/headers/macro-action-scene-visibility.hpp index 223d5c1f..6cbe977a 100644 --- a/src/headers/macro-action-scene-visibility.hpp +++ b/src/headers/macro-action-scene-visibility.hpp @@ -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 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; diff --git a/src/headers/macro-action-source.hpp b/src/headers/macro-action-source.hpp index 79b64592..cc6d688a 100644 --- a/src/headers/macro-action-source.hpp +++ b/src/headers/macro-action-source.hpp @@ -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 Create() { @@ -54,6 +55,8 @@ private slots: void ActionChanged(int value); void GetSettingsClicked(); void SettingsChanged(); +signals: + void HeaderInfoChanged(const QString &); protected: QComboBox *_sources; diff --git a/src/headers/macro-condition-audio.hpp b/src/headers/macro-condition-audio.hpp index 4f9d5028..e3b27369 100644 --- a/src/headers/macro-condition-audio.hpp +++ b/src/headers/macro-condition-audio.hpp @@ -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 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; diff --git a/src/headers/macro-condition-edit.hpp b/src/headers/macro-condition-edit.hpp index 347b6666..cee5f079 100644 --- a/src/headers/macro-condition-edit.hpp +++ b/src/headers/macro-condition-edit.hpp @@ -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 *_entryData; diff --git a/src/headers/macro-condition-file.hpp b/src/headers/macro-condition-file.hpp index 5cbd8a39..55e5c8c0 100644 --- a/src/headers/macro-condition-file.hpp +++ b/src/headers/macro-condition-file.hpp @@ -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 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; diff --git a/src/headers/macro-condition-filter.hpp b/src/headers/macro-condition-filter.hpp index ae30b35a..85020da8 100644 --- a/src/headers/macro-condition-filter.hpp +++ b/src/headers/macro-condition-filter.hpp @@ -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 Create() { @@ -54,6 +55,8 @@ private slots: void GetSettingsClicked(); void SettingsChanged(); void RegexChanged(int); +signals: + void HeaderInfoChanged(const QString &); protected: QComboBox *_sources; diff --git a/src/headers/macro-condition-macro.hpp b/src/headers/macro-condition-macro.hpp index c9de17cd..96527784 100644 --- a/src/headers/macro-condition-macro.hpp +++ b/src/headers/macro-condition-macro.hpp @@ -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 Create() { @@ -64,6 +65,8 @@ private slots: void ConditionChanged(int cond); void ResetClicked(); void UpdateCount(); +signals: + void HeaderInfoChanged(const QString &); protected: MacroSelection *_macros; diff --git a/src/headers/macro-condition-media.hpp b/src/headers/macro-condition-media.hpp index 5c1735f8..9333ad01 100644 --- a/src/headers/macro-condition-media.hpp +++ b/src/headers/macro-condition-media.hpp @@ -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 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; diff --git a/src/headers/macro-condition-process.hpp b/src/headers/macro-condition-process.hpp index 3f4e3d58..55636d1a 100644 --- a/src/headers/macro-condition-process.hpp +++ b/src/headers/macro-condition-process.hpp @@ -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 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; diff --git a/src/headers/macro-condition-scene-order.hpp b/src/headers/macro-condition-scene-order.hpp index 83925b80..be71318a 100644 --- a/src/headers/macro-condition-scene-order.hpp +++ b/src/headers/macro-condition-scene-order.hpp @@ -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 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; diff --git a/src/headers/macro-condition-scene.hpp b/src/headers/macro-condition-scene.hpp index cfd0f624..b40d8ad9 100644 --- a/src/headers/macro-condition-scene.hpp +++ b/src/headers/macro-condition-scene.hpp @@ -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 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; diff --git a/src/headers/macro-condition-source.hpp b/src/headers/macro-condition-source.hpp index 60ff4107..09037ebb 100644 --- a/src/headers/macro-condition-source.hpp +++ b/src/headers/macro-condition-source.hpp @@ -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 Create() { @@ -52,6 +53,8 @@ private slots: void GetSettingsClicked(); void SettingsChanged(); void RegexChanged(int); +signals: + void HeaderInfoChanged(const QString &); protected: QComboBox *_sources; diff --git a/src/headers/macro-condition-video.hpp b/src/headers/macro-condition-video.hpp index 6fdc57bf..2bee9bcf 100644 --- a/src/headers/macro-condition-video.hpp +++ b/src/headers/macro-condition-video.hpp @@ -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 Create() @@ -65,6 +66,8 @@ private slots: void ConditionChanged(int cond); void FilePathChanged(); void BrowseButtonClicked(); +signals: + void HeaderInfoChanged(const QString &); protected: QComboBox *_videoSelection; diff --git a/src/headers/macro-condition-window.hpp b/src/headers/macro-condition-window.hpp index 66d8fcc2..57fc4e40 100644 --- a/src/headers/macro-condition-window.hpp +++ b/src/headers/macro-condition-window.hpp @@ -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 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; diff --git a/src/headers/macro.hpp b/src/headers/macro.hpp index ca8673df..3947f1c6 100644 --- a/src/headers/macro.hpp +++ b/src/headers/macro.hpp @@ -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(); }; diff --git a/src/macro-action-audio.cpp b/src/macro-action-audio.cpp index ca4bf929..aa4fceb3 100644 --- a/src/macro-action-audio.cpp +++ b/src/macro-action-audio.cpp @@ -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 lock(switcher->m); _entryData->_audioSource = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionAudioEdit::ActionChanged(int value) diff --git a/src/macro-action-edit.cpp b/src/macro-action-edit.cpp index 1624a4e2..76192fec 100644 --- a/src/macro-action-edit.cpp +++ b/src/macro-action-edit.cpp @@ -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 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(); diff --git a/src/macro-action-filter.cpp b/src/macro-action-filter.cpp index fcbe543f..e3a48bce 100644 --- a/src/macro-action-filter.cpp +++ b/src/macro-action-filter.cpp @@ -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 lock(switcher->m); _entryData->_filter = GetWeakFilterByQString(_entryData->_source, text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionFilterEdit::ActionChanged(int value) diff --git a/src/macro-action-macro.cpp b/src/macro-action-macro.cpp index a5bea1b2..5a7a155b 100644 --- a/src/macro-action-macro.cpp +++ b/src/macro-action-macro.cpp @@ -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 lock(switcher->m); _entryData->_macro.UpdateRef(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionMacroEdit::ActionChanged(int value) diff --git a/src/macro-action-media.cpp b/src/macro-action-media.cpp index 8e0e890d..eb072d18 100644 --- a/src/macro-action-media.cpp +++ b/src/macro-action-media.cpp @@ -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 lock(switcher->m); _entryData->_mediaSource = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionMediaEdit::ActionChanged(int value) diff --git a/src/macro-action-run.cpp b/src/macro-action-run.cpp index 0e3beeeb..9e0cab95 100644 --- a/src/macro-action-run.cpp +++ b/src/macro-action-run.cpp @@ -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 entryData) : QWidget(parent) @@ -143,6 +148,8 @@ void MacroActionRunEdit::FilePathChanged() std::lock_guard lock(switcher->m); _entryData->_path = _filePath->text().toUtf8().constData(); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionRunEdit::BrowseButtonClicked() diff --git a/src/macro-action-scene-order.cpp b/src/macro-action-scene-order.cpp index 9d394d1e..5d92f9c0 100644 --- a/src/macro-action-scene-order.cpp +++ b/src/macro-action-scene-order.cpp @@ -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 lock(switcher->m); _entryData->_source = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionSceneOrderEdit::ActionChanged(int value) diff --git a/src/macro-action-scene-switch.cpp b/src/macro-action-scene-switch.cpp index 8ab79ff7..bf3d9493 100644 --- a/src/macro-action-scene-switch.cpp +++ b/src/macro-action-scene-switch.cpp @@ -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 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 widgetPlaceholders = { @@ -71,3 +84,9 @@ void MacroActionSwitchSceneEdit::DurationChanged(double seconds) std::lock_guard lock(switcher->m); _entryData->_duration.seconds = seconds; } + +void MacroActionSwitchSceneEdit::ChangeHeaderInfo(const QString &) +{ + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); +} diff --git a/src/macro-action-scene-transform.cpp b/src/macro-action-scene-transform.cpp index 1308f6e4..0db1bcfe 100644 --- a/src/macro-action-scene-transform.cpp +++ b/src/macro-action-scene-transform.cpp @@ -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 lock(switcher->m); _entryData->_source = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionSceneTransformEdit::GetSettingsClicked() diff --git a/src/macro-action-scene-visibility.cpp b/src/macro-action-scene-visibility.cpp index 349a40ab..16356f45 100644 --- a/src/macro-action-scene-visibility.cpp +++ b/src/macro-action-scene-visibility.cpp @@ -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 lock(switcher->m); _entryData->_source = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionSceneVisibilityEdit::ActionChanged(int value) diff --git a/src/macro-action-source.cpp b/src/macro-action-source.cpp index 8aeb4405..77bda080 100644 --- a/src/macro-action-source.cpp +++ b/src/macro-action-source.cpp @@ -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 lock(switcher->m); _entryData->_source = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroActionSourceEdit::ActionChanged(int value) diff --git a/src/macro-condition-audio.cpp b/src/macro-condition-audio.cpp index 7fe0ce9f..bf4f3025 100644 --- a/src/macro-condition-audio.cpp +++ b/src/macro-condition-audio.cpp @@ -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) diff --git a/src/macro-condition-edit.cpp b/src/macro-condition-edit.cpp index b47e6b44..c2ac367b 100644 --- a/src/macro-condition-edit.cpp +++ b/src/macro-condition-edit.cpp @@ -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(logic)); @@ -177,6 +183,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text) auto temp = DurationConstraint(); _dur->SetValue(temp); + HeaderInfoChanged(""); std::lock_guard 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(); diff --git a/src/macro-condition-file.cpp b/src/macro-condition-file.cpp index c8dd5ef6..42b61396 100644 --- a/src/macro-condition-file.cpp +++ b/src/macro-condition-file.cpp @@ -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 entryData) : QWidget(parent) @@ -231,6 +236,8 @@ void MacroConditionFileEdit::FilePathChanged() std::lock_guard lock(switcher->m); _entryData->_file = _filePath->text().toUtf8().constData(); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionFileEdit::BrowseButtonClicked() diff --git a/src/macro-condition-filter.cpp b/src/macro-condition-filter.cpp index 868213bc..c524df75 100644 --- a/src/macro-condition-filter.cpp +++ b/src/macro-condition-filter.cpp @@ -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 lock(switcher->m); _entryData->_filter = GetWeakFilterByQString(_entryData->_source, text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionFilterEdit::ConditionChanged(int index) diff --git a/src/macro-condition-macro.cpp b/src/macro-condition-macro.cpp index c56b681b..3ff6185d 100644 --- a/src/macro-condition-macro.cpp +++ b/src/macro-condition-macro.cpp @@ -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 lock(switcher->m); _entryData->_macro.UpdateRef(text); ResetTimer(); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionMacroEdit::CountChanged(int value) diff --git a/src/macro-condition-media.cpp b/src/macro-condition-media.cpp index d05ce8fd..6089668d 100644 --- a/src/macro-condition-media.cpp +++ b/src/macro-condition-media.cpp @@ -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) diff --git a/src/macro-condition-process.cpp b/src/macro-condition-process.cpp index af0cb5fe..b2e796cd 100644 --- a/src/macro-condition-process.cpp +++ b/src/macro-condition-process.cpp @@ -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 entryData) : QWidget(parent) @@ -83,6 +88,8 @@ void MacroConditionProcessEdit::ProcessChanged(const QString &text) std::lock_guard lock(switcher->m); _entryData->_process = text.toStdString(); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionProcessEdit::FocusChanged(int state) diff --git a/src/macro-condition-scene-order.cpp b/src/macro-condition-scene-order.cpp index fae1a465..d8c43d50 100644 --- a/src/macro-condition-scene-order.cpp +++ b/src/macro-condition-scene-order.cpp @@ -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 lock(switcher->m); _entryData->_source = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionSceneOrderEdit::Source2Changed(const QString &text) diff --git a/src/macro-condition-scene.cpp b/src/macro-condition-scene.cpp index ba7b3395..93ba8421 100644 --- a/src/macro-condition-scene.cpp +++ b/src/macro-condition-scene.cpp @@ -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 lock(switcher->m); _entryData->_scene = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionSceneEdit::TypeChanged(int value) diff --git a/src/macro-condition-source.cpp b/src/macro-condition-source.cpp index f3070a8a..e23dde04 100644 --- a/src/macro-condition-source.cpp +++ b/src/macro-condition-source.cpp @@ -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 lock(switcher->m); _entryData->_source = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionSourceEdit::ConditionChanged(int index) diff --git a/src/macro-condition-video.cpp b/src/macro-condition-video.cpp index 2120a796..41812ecb 100644 --- a/src/macro-condition-video.cpp +++ b/src/macro-condition-video.cpp @@ -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 lock(switcher->m); _entryData->_videoSource = GetWeakSourceByQString(text); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionVideoEdit::ConditionChanged(int cond) diff --git a/src/macro-condition-window.cpp b/src/macro-condition-window.cpp index a1743842..e0a01186 100644 --- a/src/macro-condition-window.cpp +++ b/src/macro-condition-window.cpp @@ -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 entryData) : QWidget(parent) @@ -155,6 +160,8 @@ void MacroConditionWindowEdit::WindowChanged(const QString &text) std::lock_guard lock(switcher->m); _entryData->_window = text.toStdString(); + emit HeaderInfoChanged( + QString::fromStdString(_entryData->GetShortDesc())); } void MacroConditionWindowEdit::FullscreenChanged(int state) diff --git a/src/macro.cpp b/src/macro.cpp index a6d46b4c..9a71dee7 100644 --- a/src/macro.cpp +++ b/src/macro.cpp @@ -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());