Update macro properties dialog

* Visually group settings
 * Hide hotkey settings if no macro or a group is selected
This commit is contained in:
WarmUpTill 2023-01-07 01:13:43 +01:00 committed by WarmUpTill
parent 3e4293f9b0
commit c96c81cf1d
3 changed files with 37 additions and 29 deletions

View File

@ -89,11 +89,13 @@ AdvSceneSwitcher.macroTab.expandAll="Expand all"
AdvSceneSwitcher.macroTab.collapseAll="Collapse all"
AdvSceneSwitcher.macroTab.maximize="Maximize"
AdvSceneSwitcher.macroTab.minimize="Minimize"
AdvSceneSwitcher.macroTab.highlightSettings="Visual settings"
AdvSceneSwitcher.macroTab.hotkeySettings="Hotkey settings"
AdvSceneSwitcher.macroTab.highlightExecutedMacros="Highlight recently executed macros"
AdvSceneSwitcher.macroTab.highlightTrueConditions="Highlight conditions of currently selected macro that evaluated to true recently"
AdvSceneSwitcher.macroTab.highlightPerformedActions="Highlight recently performed actions of currently selected macro"
AdvSceneSwitcher.macroTab.newMacroRegisterHotkey="Register hotkeys to control pause state of new macros"
AdvSceneSwitcher.macroTab.currentDisableHotkeys="Register hotkeys to control pause state of selected macro"
AdvSceneSwitcher.macroTab.newMacroRegisterHotkey="Register hotkeys to control the pause state of new macros"
AdvSceneSwitcher.macroTab.currentDisableHotkeys="Register hotkeys to control the pause state of selected macro"
; Macro List
AdvSceneSwitcher.macroList.deleted="deleted"

View File

@ -1,6 +1,7 @@
#include "macro-properties.hpp"
#include <QVBoxLayout>
#include <QGroupBox>
#include <QDialogButtonBox>
#include <obs-module.h>
@ -45,40 +46,46 @@ MacroPropertiesDialog::MacroPropertiesDialog(QWidget *parent,
setModal(true);
setWindowModality(Qt::WindowModality::WindowModal);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setFixedWidth(555);
setMinimumHeight(100);
setMinimumWidth(500);
setMinimumHeight(300);
auto highlightOptions = new QGroupBox(
obs_module_text("AdvSceneSwitcher.macroTab.highlightSettings"));
QVBoxLayout *highlightLayout = new QVBoxLayout;
highlightLayout->addWidget(_executed);
highlightLayout->addWidget(_conditions);
highlightLayout->addWidget(_actions);
highlightOptions->setLayout(highlightLayout);
auto hotkeyOptions = new QGroupBox(
obs_module_text("AdvSceneSwitcher.macroTab.hotkeySettings"));
QVBoxLayout *hotkeyLayout = new QVBoxLayout;
hotkeyLayout->addWidget(_newMacroRegisterHotkeys);
hotkeyLayout->addWidget(_currentMacroRegisterHotkeys);
hotkeyOptions->setLayout(hotkeyLayout);
QDialogButtonBox *buttonbox = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
buttonbox->setCenterButtons(true);
connect(buttonbox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonbox, &QDialogButtonBox::rejected, this, &QDialog::reject);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(highlightOptions);
layout->addWidget(hotkeyOptions);
layout->addWidget(buttonbox);
setLayout(layout);
_executed->setChecked(prop._highlightExecuted);
_conditions->setChecked(prop._highlightConditions);
_actions->setChecked(prop._highlightActions);
_newMacroRegisterHotkeys->setChecked(prop._newMacroRegisterHotkeys);
if (macro) {
if (macro && !macro->IsGroup()) {
_currentMacroRegisterHotkeys->setChecked(
macro->PauseHotkeysEnabled());
} else {
_currentMacroRegisterHotkeys->hide();
hotkeyOptions->hide();
}
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(_executed);
layout->addWidget(_conditions);
layout->addWidget(_actions);
layout->addWidget(_newMacroRegisterHotkeys);
if (macro) {
QFrame *line = new QFrame();
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
layout->addWidget(line);
}
layout->addWidget(_currentMacroRegisterHotkeys);
setLayout(layout);
QDialogButtonBox *buttonbox = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
layout->addWidget(buttonbox);
buttonbox->setCenterButtons(true);
connect(buttonbox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonbox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
bool MacroPropertiesDialog::AskForSettings(QWidget *parent,

View File

@ -6,7 +6,6 @@
#include <QCheckBox>
#include <obs-data.h>
// Global macro properties
class MacroProperties {
public:
void Save(obs_data_t *obj) const;
@ -18,7 +17,7 @@ public:
bool _newMacroRegisterHotkeys = true;
};
// Dialog for configuring global and macro specific settings
// Dialog for configuring global and individual macro specific settings
class MacroPropertiesDialog : public QDialog {
Q_OBJECT