Rename MacroProperties to MacroSettings

This commit is contained in:
WarmUpTill 2024-06-02 17:04:17 +02:00 committed by WarmUpTill
parent be44577967
commit fc2451ae08
12 changed files with 70 additions and 66 deletions

View File

@ -124,8 +124,6 @@ target_sources(
lib/macro/macro-input.hpp
lib/macro/macro-list.cpp
lib/macro/macro-list.hpp
lib/macro/macro-properties.cpp
lib/macro/macro-properties.hpp
lib/macro/macro-ref.cpp
lib/macro/macro-ref.hpp
lib/macro/macro-run-button.cpp
@ -140,6 +138,8 @@ target_sources(
lib/macro/macro-segment.hpp
lib/macro/macro-selection.cpp
lib/macro/macro-selection.hpp
lib/macro/macro-settings.cpp
lib/macro/macro-settings.hpp
lib/macro/macro-tab.cpp
lib/macro/macro-tree.cpp
lib/macro/macro-tree.hpp

View File

@ -230,7 +230,7 @@ AdvSceneSwitcher.macroTab.tooltip.elseActionTopButton="Move selected action to t
AdvSceneSwitcher.macroTab.tooltip.elseActionUpButton="Move selected action up in the else section"
AdvSceneSwitcher.macroTab.tooltip.elseActionDownButton="Move selected action down in the else section"
AdvSceneSwitcher.macroTab.tooltip.elseActionBottomButton="Move selected action to the bottom in the else section"
AdvSceneSwitcher.macroTab.tooltip.openMacroPropertiesButton="Open macro properties"
AdvSceneSwitcher.macroTab.tooltip.openMacroSettingsButton="Open macro settings"
AdvSceneSwitcher.macroDock.pause="Pause"
AdvSceneSwitcher.macroDock.unpause="Unpause"

View File

@ -960,7 +960,7 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="macroProperties">
<widget class="QPushButton" name="macroSettings">
<property name="maximumSize">
<size>
<width>22</width>
@ -968,7 +968,7 @@
</size>
</property>
<property name="toolTip">
<string>AdvSceneSwitcher.macroTab.tooltip.openMacroPropertiesButton</string>
<string>AdvSceneSwitcher.macroTab.tooltip.openMacroSettingsButton</string>
</property>
<property name="text">
<string/>
@ -5033,7 +5033,7 @@
<tabstop>runMacro</tabstop>
<tabstop>runMacroInParallel</tabstop>
<tabstop>runMacroOnChange</tabstop>
<tabstop>macroProperties</tabstop>
<tabstop>macroSettings</tabstop>
<tabstop>conditionsList</tabstop>
<tabstop>conditionAdd</tabstop>
<tabstop>conditionRemove</tabstop>

View File

@ -767,7 +767,7 @@ void AdvSceneSwitcher::HighligthMacroSettingsButton(bool enable)
return;
}
highlight = HighlightWidget(ui->macroProperties, Qt::green);
highlight = HighlightWidget(ui->macroSettings, Qt::green);
}
void HighligthMacroSettingsButton(bool enable)

View File

@ -179,7 +179,7 @@ public slots:
void MoveMacroConditionDown(int idx);
void HighlightControls();
void HighlightOnChange();
void on_macroProperties_clicked();
void on_macroSettings_clicked();
void CopyMacroSegment();
void PasteMacroSegment();

View File

@ -431,7 +431,7 @@ void SwitcherData::LoadSettings(obs_data_t *obj)
}
LoadMacros(obj);
LoadGlobalMacroProperties(obj);
LoadGlobalMacroSettings(obj);
loadWindowTitleSwitches(obj);
loadScreenRegionSwitches(obj);
loadPauseSwitches(obj);
@ -466,7 +466,7 @@ void SwitcherData::SaveSettings(obs_data_t *obj)
saveSceneGroups(obj);
SaveMacros(obj);
SaveGlobalMacroProperties(obj);
SaveGlobalMacroSettings(obj);
SaveVariables(obj);
saveWindowTitleSwitches(obj);
saveScreenRegionSwitches(obj);

View File

@ -1,7 +1,7 @@
#include "macro-action-edit.hpp"
#include "advanced-scene-switcher.hpp"
#include "macro-helpers.hpp"
#include "macro-properties.hpp"
#include "macro-settings.hpp"
#include "macro.hpp"
#include "plugin-state-helpers.hpp"
#include "section.hpp"

View File

@ -1,6 +1,6 @@
#include "macro-condition-edit.hpp"
#include "advanced-scene-switcher.hpp"
#include "macro-properties.hpp"
#include "macro-settings.hpp"
#include "macro.hpp"
#include "path-helpers.hpp"
#include "plugin-state-helpers.hpp"

View File

@ -1,4 +1,4 @@
#include "macro-properties.hpp"
#include "macro-settings.hpp"
#include "layout-helpers.hpp"
#include "obs-module-helper.hpp"
#include "macro.hpp"
@ -10,9 +10,9 @@
namespace advss {
static MacroProperties macroProperties;
static GlobalMacroSettings macroSettings;
void MacroProperties::Save(obs_data_t *obj) const
void GlobalMacroSettings::Save(obs_data_t *obj) const
{
auto data = obs_data_create();
obs_data_set_bool(data, "highlightExecuted", _highlightExecuted);
@ -20,13 +20,16 @@ void MacroProperties::Save(obs_data_t *obj) const
obs_data_set_bool(data, "highlightActions", _highlightActions);
obs_data_set_bool(data, "newMacroRegisterHotkey",
_newMacroRegisterHotkeys);
obs_data_set_obj(obj, "macroProperties", data);
obs_data_set_obj(obj, "macroSettings", data);
obs_data_release(data);
}
void MacroProperties::Load(obs_data_t *obj)
void GlobalMacroSettings::Load(obs_data_t *obj)
{
auto data = obs_data_get_obj(obj, "macroProperties");
auto data = obs_data_get_obj(
obj, obs_data_has_user_value(obj, "macroProperties")
? "macroProperties"
: "macroSettings");
obs_data_set_default_bool(data, "highlightExecuted", true);
obs_data_set_default_bool(data, "highlightConditions", true);
obs_data_set_default_bool(data, "highlightActions", true);
@ -38,9 +41,9 @@ void MacroProperties::Load(obs_data_t *obj)
obs_data_release(data);
}
MacroPropertiesDialog::MacroPropertiesDialog(QWidget *parent,
const MacroProperties &prop,
Macro *macro)
MacroSettingsDialog::MacroSettingsDialog(QWidget *parent,
const GlobalMacroSettings &settings,
Macro *macro)
: QDialog(parent),
_executed(new QCheckBox(obs_module_text(
"AdvSceneSwitcher.macroTab.highlightExecutedMacros"))),
@ -168,13 +171,13 @@ MacroPropertiesDialog::MacroPropertiesDialog(QWidget *parent,
connect(buttonbox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(_currentMacroRegisterDock, &QCheckBox::stateChanged, this,
&MacroPropertiesDialog::DockEnableChanged);
&MacroSettingsDialog::DockEnableChanged);
connect(_currentMacroDockAddRunButton, &QCheckBox::stateChanged, this,
&MacroPropertiesDialog::RunButtonEnableChanged);
&MacroSettingsDialog::RunButtonEnableChanged);
connect(_currentMacroDockAddPauseButton, &QCheckBox::stateChanged, this,
&MacroPropertiesDialog::PauseButtonEnableChanged);
&MacroSettingsDialog::PauseButtonEnableChanged);
connect(_currentMacroDockAddStatusLabel, &QCheckBox::stateChanged, this,
&MacroPropertiesDialog::StatusLabelEnableChanged);
&MacroSettingsDialog::StatusLabelEnableChanged);
auto scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
@ -195,10 +198,10 @@ MacroPropertiesDialog::MacroPropertiesDialog(QWidget *parent,
dialogLayout->addWidget(buttonbox);
setLayout(dialogLayout);
_executed->setChecked(prop._highlightExecuted);
_conditions->setChecked(prop._highlightConditions);
_actions->setChecked(prop._highlightActions);
_newMacroRegisterHotkeys->setChecked(prop._newMacroRegisterHotkeys);
_executed->setChecked(settings._highlightExecuted);
_conditions->setChecked(settings._highlightConditions);
_actions->setChecked(settings._highlightActions);
_newMacroRegisterHotkeys->setChecked(settings._newMacroRegisterHotkeys);
if (!macro || macro->IsGroup()) {
hotkeyOptions->hide();
@ -259,7 +262,7 @@ MacroPropertiesDialog::MacroPropertiesDialog(QWidget *parent,
20);
}
void MacroPropertiesDialog::DockEnableChanged(int enabled)
void MacroSettingsDialog::DockEnableChanged(int enabled)
{
_currentMacroDockAddRunButton->setVisible(enabled);
_currentMacroDockAddPauseButton->setVisible(enabled);
@ -284,37 +287,37 @@ void MacroPropertiesDialog::DockEnableChanged(int enabled)
Resize();
}
void MacroPropertiesDialog::RunButtonEnableChanged(int enabled)
void MacroSettingsDialog::RunButtonEnableChanged(int enabled)
{
SetGridLayoutRowVisible(_dockLayout, _runButtonTextRow, enabled);
Resize();
}
void MacroPropertiesDialog::PauseButtonEnableChanged(int enabled)
void MacroSettingsDialog::PauseButtonEnableChanged(int enabled)
{
SetGridLayoutRowVisible(_dockLayout, _pauseButtonTextRow, enabled);
SetGridLayoutRowVisible(_dockLayout, _unpauseButtonTextRow, enabled);
Resize();
}
void MacroPropertiesDialog::StatusLabelEnableChanged(int enabled)
void MacroSettingsDialog::StatusLabelEnableChanged(int enabled)
{
SetGridLayoutRowVisible(_dockLayout, _conditionsTrueTextRow, enabled);
SetGridLayoutRowVisible(_dockLayout, _conditionsFalseTextRow, enabled);
Resize();
}
void MacroPropertiesDialog::Resize()
void MacroSettingsDialog::Resize()
{
_dockOptions->adjustSize();
_dockOptions->updateGeometry();
}
bool MacroPropertiesDialog::AskForSettings(QWidget *parent,
MacroProperties &userInput,
Macro *macro)
bool MacroSettingsDialog::AskForSettings(QWidget *parent,
GlobalMacroSettings &userInput,
Macro *macro)
{
MacroPropertiesDialog dialog(parent, userInput, macro);
MacroSettingsDialog dialog(parent, userInput, macro);
dialog.setWindowTitle(obs_module_text("AdvSceneSwitcher.windowTitle"));
if (dialog.exec() != DialogCode::Accepted) {
return false;
@ -355,19 +358,19 @@ bool MacroPropertiesDialog::AskForSettings(QWidget *parent,
return true;
}
MacroProperties &GetGlobalMacroProperties()
GlobalMacroSettings &GetGlobalMacroSettings()
{
return macroProperties;
return macroSettings;
}
void SaveGlobalMacroProperties(obs_data_t *obj)
void SaveGlobalMacroSettings(obs_data_t *obj)
{
macroProperties.Save(obj);
macroSettings.Save(obj);
}
void LoadGlobalMacroProperties(obs_data_t *obj)
void LoadGlobalMacroSettings(obs_data_t *obj)
{
macroProperties.Load(obj);
macroSettings.Load(obj);
}
} // namespace advss

View File

@ -14,7 +14,7 @@ namespace advss {
class Macro;
class MacroProperties {
class GlobalMacroSettings {
public:
void Save(obs_data_t *obj) const;
void Load(obs_data_t *obj);
@ -26,13 +26,14 @@ public:
};
// Dialog for configuring global and individual macro specific settings
class MacroPropertiesDialog : public QDialog {
class MacroSettingsDialog : public QDialog {
Q_OBJECT
public:
MacroPropertiesDialog(QWidget *parent, const MacroProperties &,
Macro *macro);
static bool AskForSettings(QWidget *parent, MacroProperties &userInput,
MacroSettingsDialog(QWidget *parent, const GlobalMacroSettings &,
Macro *macro);
static bool AskForSettings(QWidget *parent,
GlobalMacroSettings &userInput,
Macro *macro);
private slots:
void DockEnableChanged(int);
@ -72,8 +73,8 @@ private:
int _conditionsFalseTextRow = -1;
};
MacroProperties &GetGlobalMacroProperties();
void SaveGlobalMacroProperties(obs_data_t *obj);
void LoadGlobalMacroProperties(obs_data_t *obj);
GlobalMacroSettings &GetGlobalMacroSettings();
void SaveGlobalMacroSettings(obs_data_t *obj);
void LoadGlobalMacroSettings(obs_data_t *obj);
} // namespace advss

View File

@ -3,7 +3,7 @@
#include "macro-action-edit.hpp"
#include "macro-condition-edit.hpp"
#include "macro-export-import-dialog.hpp"
#include "macro-properties.hpp"
#include "macro-settings.hpp"
#include "macro-segment-copy-paste.hpp"
#include "macro-tree.hpp"
#include "macro.hpp"
@ -86,7 +86,7 @@ bool AdvSceneSwitcher::AddNewMacro(std::shared_ptr<Macro> &res,
}
res = std::make_shared<Macro>(
name, GetGlobalMacroProperties()._newMacroRegisterHotkeys);
name, GetGlobalMacroSettings()._newMacroRegisterHotkeys);
return true;
}
@ -463,7 +463,7 @@ void AdvSceneSwitcher::ImportMacros()
RunPostLoadSteps();
ui->macros->Reset(GetMacros(),
GetGlobalMacroProperties()._highlightExecuted);
GetGlobalMacroSettings()._highlightExecuted);
}
void AdvSceneSwitcher::on_macroName_editingFinished()
@ -743,8 +743,8 @@ void AdvSceneSwitcher::MacroSelectionChanged()
void AdvSceneSwitcher::HighlightOnChange()
{
if (!GetGlobalMacroProperties()._highlightActions &&
!GetGlobalMacroProperties()._highlightExecuted) {
if (!GetGlobalMacroSettings()._highlightActions &&
!GetGlobalMacroSettings()._highlightExecuted) {
return;
}
@ -759,15 +759,15 @@ void AdvSceneSwitcher::HighlightOnChange()
}
}
void AdvSceneSwitcher::on_macroProperties_clicked()
void AdvSceneSwitcher::on_macroSettings_clicked()
{
MacroProperties prop = GetGlobalMacroProperties();
bool accepted = MacroPropertiesDialog::AskForSettings(
GlobalMacroSettings prop = GetGlobalMacroSettings();
bool accepted = MacroSettingsDialog::AskForSettings(
this, prop, GetSelectedMacro().get());
if (!accepted) {
return;
}
GetGlobalMacroProperties() = prop;
GetGlobalMacroSettings() = prop;
emit HighlightMacrosChanged(prop._highlightExecuted);
}
@ -817,11 +817,11 @@ static void runSegmentHighligtChecks(AdvSceneSwitcher *ss)
return;
}
const auto &properties = GetGlobalMacroProperties();
if (properties._highlightConditions) {
const auto &settings = GetGlobalMacroSettings();
if (settings._highlightConditions) {
runSegmentHighligtChecksHelper(ss->ui->conditionsList);
}
if (properties._highlightActions) {
if (settings._highlightActions) {
runSegmentHighligtChecksHelper(ss->ui->actionsList);
runSegmentHighligtChecksHelper(ss->ui->elseActionsList);
}
@ -836,7 +836,7 @@ void AdvSceneSwitcher::SetupMacroTab()
addPulse = HighlightWidget(ui->macroAdd, QColor(Qt::green));
}
ui->macros->Reset(GetMacros(),
GetGlobalMacroProperties()._highlightExecuted);
GetGlobalMacroSettings()._highlightExecuted);
connect(ui->macros, SIGNAL(MacroSelectionAboutToChange()), this,
SLOT(MacroSelectionAboutToChange()));
connect(ui->macros, SIGNAL(MacroSelectionChanged()), this,

View File

@ -16,7 +16,7 @@
#include "switch-video.hpp"
#include "switch-network.hpp"
#include "macro-properties.hpp"
#include "macro-settings.hpp"
#include "duration-control.hpp"
#include "priority-helper.hpp"
#include "plugin-state-helpers.hpp"