mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-07-18 17:04:28 -05:00
Remove old macro segment controls
This commit is contained in:
parent
955f308c59
commit
45e8378021
|
|
@ -245,7 +245,6 @@ set(advanced-scene-switcher_HEADERS
|
|||
src/headers/macro-condition-virtual-cam.hpp
|
||||
src/headers/macro-condition-window.hpp
|
||||
src/headers/macro.hpp
|
||||
src/headers/macro-controls.hpp
|
||||
src/headers/macro-list-entry-widget.hpp
|
||||
src/headers/macro-segment.hpp
|
||||
src/headers/macro-selection.hpp
|
||||
|
|
@ -346,7 +345,6 @@ set(advanced-scene-switcher_SOURCES
|
|||
src/macro-condition-virtual-cam.cpp
|
||||
src/macro-condition-window.cpp
|
||||
src/macro.cpp
|
||||
src/macro-controls.cpp
|
||||
src/macro-list-entry-widget.cpp
|
||||
src/macro-segment.cpp
|
||||
src/macro-selection.cpp
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ AdvSceneSwitcher.generalTab.generalBehavior.verboseLogging="Enable verbose loggi
|
|||
AdvSceneSwitcher.generalTab.generalBehavior.saveWindowGeo="Save window position and size"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.showTrayNotifications="Show system tray notifications"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints="Disable UI hints"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.verticalMacroControls="Use permanent vertical controls on Macro tab"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.hideLegacyTabs="Hide tabs which can be represented via macros"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.highlightExecutedMacros="Highlight recently executed macros"
|
||||
AdvSceneSwitcher.generalTab.priority="Priority"
|
||||
|
|
|
|||
|
|
@ -325,30 +325,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useVerticalMacroControls">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.verticalMacroControls</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_26">
|
||||
<item>
|
||||
|
|
|
|||
|
|
@ -192,16 +192,6 @@ void AdvSceneSwitcher::on_uiHintsDisable_stateChanged(int state)
|
|||
switcher->disableHints = state;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_useVerticalMacroControls_stateChanged(int state)
|
||||
{
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
switcher->useVerticalMacroControls = state;
|
||||
setupMacroTab();
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_highlightExecutedMacros_stateChanged(int state)
|
||||
{
|
||||
if (loading) {
|
||||
|
|
@ -582,8 +572,6 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
|
|||
obs_data_set_bool(obj, "showSystemTrayNotifications",
|
||||
showSystemTrayNotifications);
|
||||
obs_data_set_bool(obj, "disableHints", disableHints);
|
||||
obs_data_set_bool(obj, "useVerticalMacroControls",
|
||||
useVerticalMacroControls);
|
||||
obs_data_set_bool(obj, "highlightExecutedMacros",
|
||||
highlightExecutedMacros);
|
||||
obs_data_set_bool(obj, "hideLegacyTabs", hideLegacyTabs);
|
||||
|
|
@ -660,8 +648,6 @@ void SwitcherData::loadGeneralSettings(obs_data_t *obj)
|
|||
showSystemTrayNotifications =
|
||||
obs_data_get_bool(obj, "showSystemTrayNotifications");
|
||||
disableHints = obs_data_get_bool(obj, "disableHints");
|
||||
useVerticalMacroControls =
|
||||
obs_data_get_bool(obj, "useVerticalMacroControls");
|
||||
highlightExecutedMacros =
|
||||
obs_data_get_bool(obj, "highlightExecutedMacros");
|
||||
hideLegacyTabs = obs_data_get_bool(obj, "hideLegacyTabs");
|
||||
|
|
@ -878,8 +864,6 @@ void AdvSceneSwitcher::setupGeneralTab()
|
|||
ui->showTrayNotifications->setChecked(
|
||||
switcher->showSystemTrayNotifications);
|
||||
ui->uiHintsDisable->setChecked(switcher->disableHints);
|
||||
ui->useVerticalMacroControls->setChecked(
|
||||
switcher->useVerticalMacroControls);
|
||||
ui->highlightExecutedMacros->setChecked(
|
||||
switcher->highlightExecutedMacros);
|
||||
ui->hideLegacyTabs->setChecked(switcher->hideLegacyTabs);
|
||||
|
|
|
|||
|
|
@ -177,7 +177,6 @@ public slots:
|
|||
void on_saveWindowGeo_stateChanged(int state);
|
||||
void on_showTrayNotifications_stateChanged(int state);
|
||||
void on_uiHintsDisable_stateChanged(int state);
|
||||
void on_useVerticalMacroControls_stateChanged(int state);
|
||||
void on_highlightExecutedMacros_stateChanged(int state);
|
||||
void on_hideLegacyTabs_stateChanged(int state);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QScrollArea>
|
||||
#include <QPushButton>
|
||||
#include <QLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class MacroEntryControls : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MacroEntryControls(bool vertical = false,
|
||||
const int animationDuration = 300,
|
||||
QWidget *parent = 0);
|
||||
void Show(bool visible = true);
|
||||
|
||||
signals:
|
||||
void Add();
|
||||
void Remove();
|
||||
void Up();
|
||||
void Down();
|
||||
|
||||
private:
|
||||
bool _vertical = false;
|
||||
bool _visible = false;
|
||||
QPushButton *_add;
|
||||
QPushButton *_remove;
|
||||
QPushButton *_up;
|
||||
QPushButton *_down;
|
||||
QPropertyAnimation *_animation = nullptr;
|
||||
};
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QFrame>
|
||||
#include <QVBoxLayout>
|
||||
#include <obs.hpp>
|
||||
|
|
@ -30,14 +29,12 @@ private:
|
|||
|
||||
class Section;
|
||||
class QLabel;
|
||||
class MacroEntryControls;
|
||||
|
||||
class MacroSegmentEdit : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroSegmentEdit(bool verticalControls = true,
|
||||
QWidget *parent = nullptr);
|
||||
MacroSegmentEdit(QWidget *parent = nullptr);
|
||||
// Use this function to avoid accidental edits when scrolling through
|
||||
// list of actions and conditions
|
||||
void SetFocusPolicyOfWidgets();
|
||||
|
|
@ -46,13 +43,7 @@ public:
|
|||
|
||||
protected slots:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
void Add();
|
||||
void Remove();
|
||||
void Up();
|
||||
void Down();
|
||||
void Collapsed(bool);
|
||||
void ShowControls();
|
||||
void HideControls();
|
||||
signals:
|
||||
void MacroAdded(const QString &name);
|
||||
void MacroRemoved(const QString &name);
|
||||
|
|
@ -60,26 +51,17 @@ signals:
|
|||
void SceneGroupAdded(const QString &name);
|
||||
void SceneGroupRemoved(const QString &name);
|
||||
void SceneGroupRenamed(const QString &oldName, const QString newName);
|
||||
void AddAt(int idx);
|
||||
void RemoveAt(int idx);
|
||||
void UpAt(int idx);
|
||||
void DownAt(int idx);
|
||||
void SelectionChagned(int idx);
|
||||
|
||||
protected:
|
||||
void enterEvent(QEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
Section *_section;
|
||||
QLabel *_headerInfo;
|
||||
MacroEntryControls *_controls;
|
||||
QFrame *_frame;
|
||||
QVBoxLayout *_highLightFrameLayout;
|
||||
|
||||
private:
|
||||
QTimer _enterTimer;
|
||||
QTimer _leaveTimer;
|
||||
virtual MacroSegment *Data() = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ struct SwitcherData {
|
|||
bool stop = false;
|
||||
bool verbose = false;
|
||||
bool disableHints = false;
|
||||
bool useVerticalMacroControls = false;
|
||||
bool hideLegacyTabs = false;
|
||||
bool highlightExecutedMacros = false;
|
||||
bool showSystemTrayNotifications = false;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "headers/macro-action-edit.hpp"
|
||||
#include "headers/macro-action-scene-switch.hpp"
|
||||
#include "headers/section.hpp"
|
||||
#include "headers/macro-controls.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
std::map<std::string, MacroActionInfo> MacroActionFactory::_methods;
|
||||
|
|
@ -64,8 +63,7 @@ static inline void populateActionSelection(QComboBox *list)
|
|||
MacroActionEdit::MacroActionEdit(QWidget *parent,
|
||||
std::shared_ptr<MacroAction> *entryData,
|
||||
const std::string &id)
|
||||
: MacroSegmentEdit(switcher->useVerticalMacroControls, parent),
|
||||
_entryData(entryData)
|
||||
: MacroSegmentEdit(parent), _entryData(entryData)
|
||||
{
|
||||
_actionSelection = new QComboBox();
|
||||
|
||||
|
|
@ -86,12 +84,6 @@ MacroActionEdit::MacroActionEdit(QWidget *parent,
|
|||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
if (switcher->useVerticalMacroControls) {
|
||||
|
||||
_controls->hide();
|
||||
} else {
|
||||
actionLayout->addWidget(_controls);
|
||||
}
|
||||
mainLayout->addLayout(actionLayout);
|
||||
setLayout(mainLayout);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "headers/macro-condition-edit.hpp"
|
||||
#include "headers/macro-condition-scene.hpp"
|
||||
#include "headers/section.hpp"
|
||||
#include "headers/macro-controls.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
std::map<std::string, MacroConditionInfo> MacroConditionFactory::_methods;
|
||||
|
|
@ -93,9 +92,7 @@ static inline void populateConditionSelection(QComboBox *list)
|
|||
MacroConditionEdit::MacroConditionEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroCondition> *entryData,
|
||||
const std::string &id, bool root)
|
||||
: MacroSegmentEdit(switcher->useVerticalMacroControls, parent),
|
||||
_entryData(entryData),
|
||||
_isRoot(root)
|
||||
: MacroSegmentEdit(parent), _entryData(entryData), _isRoot(root)
|
||||
{
|
||||
_logicSelection = new QComboBox();
|
||||
_conditionSelection = new QComboBox();
|
||||
|
|
@ -130,11 +127,6 @@ MacroConditionEdit::MacroConditionEdit(
|
|||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
if (switcher->useVerticalMacroControls) {
|
||||
_controls->hide();
|
||||
} else {
|
||||
conditionLayout->addWidget(_controls);
|
||||
}
|
||||
mainLayout->addLayout(conditionLayout);
|
||||
setLayout(mainLayout);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,90 +0,0 @@
|
|||
#include "headers/macro-controls.hpp"
|
||||
|
||||
MacroEntryControls::MacroEntryControls(bool vertical,
|
||||
const int animationDuration,
|
||||
QWidget *parent)
|
||||
: QWidget(parent), _vertical(vertical)
|
||||
{
|
||||
_add = new QPushButton(this);
|
||||
_add->setMaximumSize(QSize(22, 22));
|
||||
_add->setProperty("themeID",
|
||||
QVariant(QString::fromUtf8("addIconSmall")));
|
||||
_add->setFlat(true);
|
||||
_remove = new QPushButton(this);
|
||||
_remove->setMaximumSize(QSize(22, 22));
|
||||
_remove->setProperty("themeID",
|
||||
QVariant(QString::fromUtf8("removeIconSmall")));
|
||||
_remove->setFlat(true);
|
||||
_up = new QPushButton(this);
|
||||
_up->setMaximumSize(QSize(22, 22));
|
||||
_up->setProperty("themeID",
|
||||
QVariant(QString::fromUtf8("upArrowIconSmall")));
|
||||
_up->setFlat(true);
|
||||
_down = new QPushButton(this);
|
||||
_down->setMaximumSize(QSize(22, 22));
|
||||
_down->setProperty("themeID",
|
||||
QVariant(QString::fromUtf8("downArrowIconSmall")));
|
||||
_down->setFlat(true);
|
||||
|
||||
if (vertical) {
|
||||
auto mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->addWidget(_up);
|
||||
mainLayout->addWidget(_add);
|
||||
mainLayout->addWidget(_remove);
|
||||
mainLayout->addWidget(_down);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout->setSpacing(0);
|
||||
setLayout(mainLayout);
|
||||
|
||||
} else {
|
||||
auto line = new QFrame(this);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
line->setSizePolicy(QSizePolicy::Expanding,
|
||||
QSizePolicy::Maximum);
|
||||
|
||||
auto mainLayout = new QHBoxLayout(this);
|
||||
|
||||
mainLayout->addWidget(_add);
|
||||
mainLayout->addWidget(_remove);
|
||||
|
||||
auto *separator = new QFrame(this);
|
||||
separator->setFrameShape(QFrame::VLine);
|
||||
separator->setFrameShadow(QFrame::Sunken);
|
||||
mainLayout->addWidget(separator);
|
||||
|
||||
mainLayout->addWidget(_up);
|
||||
mainLayout->addWidget(_down);
|
||||
mainLayout->addWidget(line);
|
||||
|
||||
// Save as much space as possible but leave a bit of distance
|
||||
// to the widget being controlled
|
||||
mainLayout->setContentsMargins(0, 3, 0, 0);
|
||||
setLayout(mainLayout);
|
||||
|
||||
_animation = new QPropertyAnimation(this, "maximumHeight");
|
||||
|
||||
_animation->setDuration(animationDuration);
|
||||
_animation->setStartValue(0);
|
||||
_animation->setEndValue(mainLayout->sizeHint().height());
|
||||
|
||||
setMaximumHeight(0);
|
||||
}
|
||||
|
||||
connect(_add, &QPushButton::clicked, this, &MacroEntryControls::Add);
|
||||
connect(_remove, &QPushButton::clicked, this,
|
||||
&MacroEntryControls::Remove);
|
||||
connect(_up, &QPushButton::clicked, this, &MacroEntryControls::Up);
|
||||
connect(_down, &QPushButton::clicked, this, &MacroEntryControls::Down);
|
||||
}
|
||||
|
||||
void MacroEntryControls::Show(bool visible)
|
||||
{
|
||||
if (_vertical || _visible == visible) {
|
||||
return;
|
||||
}
|
||||
_animation->setDirection(visible ? QAbstractAnimation::Forward
|
||||
: QAbstractAnimation::Backward);
|
||||
_animation->start();
|
||||
_visible = visible;
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
#include "headers/macro-segment.hpp"
|
||||
#include "headers/macro-controls.hpp"
|
||||
#include "headers/section.hpp"
|
||||
|
||||
#include <obs.hpp>
|
||||
|
|
@ -41,17 +40,10 @@ bool MouseWheelWidgetAdjustmentGuard::eventFilter(QObject *o, QEvent *e)
|
|||
return QObject::eventFilter(o, e);
|
||||
}
|
||||
|
||||
MacroSegmentEdit::MacroSegmentEdit(bool verticalControls, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
MacroSegmentEdit::MacroSegmentEdit(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
_section = new Section(300);
|
||||
_headerInfo = new QLabel();
|
||||
_controls = new MacroEntryControls(verticalControls);
|
||||
|
||||
_enterTimer.setSingleShot(true);
|
||||
_enterTimer.setInterval(1000);
|
||||
_leaveTimer.setSingleShot(true);
|
||||
_leaveTimer.setInterval(1000);
|
||||
|
||||
_frame = new QFrame;
|
||||
_frame->setObjectName("segmentFrame");
|
||||
|
|
@ -90,20 +82,6 @@ MacroSegmentEdit::MacroSegmentEdit(bool verticalControls, QWidget *parent)
|
|||
parent,
|
||||
SIGNAL(SceneGroupRenamed(const QString &, const QString)), this,
|
||||
SIGNAL(SceneGroupRenamed(const QString &, const QString)));
|
||||
|
||||
// Control signals
|
||||
QWidget::connect(_controls, &MacroEntryControls::Add, this,
|
||||
&MacroSegmentEdit::Add);
|
||||
QWidget::connect(_controls, &MacroEntryControls::Remove, this,
|
||||
&MacroSegmentEdit::Remove);
|
||||
QWidget::connect(_controls, &MacroEntryControls::Up, this,
|
||||
&MacroSegmentEdit::Up);
|
||||
QWidget::connect(_controls, &MacroEntryControls::Down, this,
|
||||
&MacroSegmentEdit::Down);
|
||||
QWidget::connect(&_enterTimer, &QTimer::timeout, this,
|
||||
&MacroSegmentEdit::ShowControls);
|
||||
QWidget::connect(&_leaveTimer, &QTimer::timeout, this,
|
||||
&MacroSegmentEdit::HideControls);
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::HeaderInfoChanged(const QString &text)
|
||||
|
|
@ -112,35 +90,6 @@ void MacroSegmentEdit::HeaderInfoChanged(const QString &text)
|
|||
_headerInfo->setText(text);
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::Add()
|
||||
{
|
||||
if (Data()) {
|
||||
// Insert after current entry
|
||||
emit AddAt(Data()->GetIndex() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::Remove()
|
||||
{
|
||||
if (Data()) {
|
||||
emit RemoveAt(Data()->GetIndex());
|
||||
}
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::Up()
|
||||
{
|
||||
if (Data()) {
|
||||
emit UpAt(Data()->GetIndex());
|
||||
}
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::Down()
|
||||
{
|
||||
if (Data()) {
|
||||
emit DownAt(Data()->GetIndex());
|
||||
}
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::Collapsed(bool collapsed)
|
||||
{
|
||||
if (Data()) {
|
||||
|
|
@ -148,28 +97,6 @@ void MacroSegmentEdit::Collapsed(bool collapsed)
|
|||
}
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::ShowControls()
|
||||
{
|
||||
_controls->Show(true);
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::HideControls()
|
||||
{
|
||||
_controls->Show(false);
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::enterEvent(QEvent *)
|
||||
{
|
||||
_enterTimer.start();
|
||||
_leaveTimer.stop();
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::leaveEvent(QEvent *)
|
||||
{
|
||||
_enterTimer.stop();
|
||||
_leaveTimer.start();
|
||||
}
|
||||
|
||||
void MacroSegmentEdit::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && Data()) {
|
||||
|
|
|
|||
|
|
@ -305,28 +305,12 @@ void AdvSceneSwitcher::HighlightCondition(int idx)
|
|||
|
||||
void AdvSceneSwitcher::ConnectControlSignals(MacroActionEdit *a)
|
||||
{
|
||||
connect(a, &MacroActionEdit::AddAt, this,
|
||||
&AdvSceneSwitcher::AddMacroAction);
|
||||
connect(a, &MacroActionEdit::RemoveAt, this,
|
||||
&AdvSceneSwitcher::RemoveMacroAction);
|
||||
connect(a, &MacroActionEdit::UpAt, this,
|
||||
&AdvSceneSwitcher::MoveMacroActionUp);
|
||||
connect(a, &MacroActionEdit::DownAt, this,
|
||||
&AdvSceneSwitcher::MoveMacroActionDown);
|
||||
connect(a, &MacroActionEdit::SelectionChagned, this,
|
||||
&AdvSceneSwitcher::MacroActionSelectionChanged);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::ConnectControlSignals(MacroConditionEdit *c)
|
||||
{
|
||||
connect(c, &MacroConditionEdit::AddAt, this,
|
||||
&AdvSceneSwitcher::AddMacroCondition);
|
||||
connect(c, &MacroConditionEdit::RemoveAt, this,
|
||||
&AdvSceneSwitcher::RemoveMacroCondition);
|
||||
connect(c, &MacroConditionEdit::UpAt, this,
|
||||
&AdvSceneSwitcher::MoveMacroConditionUp);
|
||||
connect(c, &MacroConditionEdit::DownAt, this,
|
||||
&AdvSceneSwitcher::MoveMacroConditionDown);
|
||||
connect(c, &MacroActionEdit::SelectionChagned, this,
|
||||
&AdvSceneSwitcher::MacroConditionSelectionChanged);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user