mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Add else actions toggle button
This commit is contained in:
parent
cde111ddeb
commit
1f31b81f0d
|
|
@ -126,6 +126,8 @@ AdvSceneSwitcher.macroTab.currentDockButtonText.unpause="Unpause button text:"
|
|||
AdvSceneSwitcher.macroTab.currentDockStatusText.true="Conditions true text:"
|
||||
AdvSceneSwitcher.macroTab.currentDockStatusText.false="Conditions false text:"
|
||||
AdvSceneSwitcher.macroTab.currentDockHighlightIfExecuted="Highlight dock if macro actions were recently executed"
|
||||
AdvSceneSwitcher.macroTab.toggleElseActions.hide.tooltip="Hide else actions"
|
||||
AdvSceneSwitcher.macroTab.toggleElseActions.show.tooltip="Show else actions"
|
||||
|
||||
AdvSceneSwitcher.macroDock.pause="Pause"
|
||||
AdvSceneSwitcher.macroDock.unpause="Unpause"
|
||||
|
|
|
|||
11
data/res/images/DarkNotEqual.svg
Normal file
11
data/res/images/DarkNotEqual.svg
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" version="1.1">
|
||||
<!-- Created with SVG-edit - https://github.com/SVG-Edit/svgedit-->
|
||||
|
||||
<g class="layer">
|
||||
<title>Layer 1</title>
|
||||
<rect fill="#fefefe" height="2.25" id="svg_1" stroke="#fefefe" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="4"/>
|
||||
<rect fill="#fefefe" height="2.25" id="svg_2" stroke="#fefefe" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="10"/>
|
||||
<rect fill="#fefefe" height="1" id="svg_4" stroke="#fefefe" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(0.341951, -0.926734, 0.939718, 0.337226, -1.948, 13.2448)" width="14" x="1" y="7"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 931 B |
11
data/res/images/LightNotEqual.svg
Normal file
11
data/res/images/LightNotEqual.svg
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" version="1.1">
|
||||
<!-- Created with SVG-edit - https://github.com/SVG-Edit/svgedit-->
|
||||
|
||||
<g class="layer">
|
||||
<title>Layer 1</title>
|
||||
<rect fill="#202020" height="2.25" id="svg_1" stroke="#202020" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="4"/>
|
||||
<rect fill="#202020" height="2.25" id="svg_2" stroke="#202020" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="10"/>
|
||||
<rect fill="#202020" height="1" id="svg_4" stroke="#202020" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(0.341951, -0.926734, 0.939718, 0.337226, -1.948, 13.2448)" width="14" x="1" y="7"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 931 B |
|
|
@ -1275,6 +1275,22 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toggleElseActions">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
|||
|
|
@ -115,6 +115,23 @@ void AdvSceneSwitcher::LoadUI()
|
|||
loading = false;
|
||||
}
|
||||
|
||||
bool AdvSceneSwitcher::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
auto eventType = event->type();
|
||||
if (obj == ui->macroElseActions && eventType == QEvent::Resize) {
|
||||
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
||||
|
||||
if (resizeEvent->size().height() == 0) {
|
||||
SetElseActionsStateToHidden();
|
||||
return QDialog::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
SetElseActionsStateToVisible();
|
||||
}
|
||||
|
||||
return QDialog::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Saving and loading
|
||||
******************************************************************************/
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ public:
|
|||
void RestoreWindowGeo();
|
||||
void CheckFirstTimeSetup();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
/* --- Begin of general tab section --- */
|
||||
public:
|
||||
void SetupGeneralTab();
|
||||
|
|
@ -115,6 +118,7 @@ public slots:
|
|||
void on_actionUp_clicked();
|
||||
void on_actionDown_clicked();
|
||||
void on_actionBottom_clicked();
|
||||
void on_toggleElseActions_clicked();
|
||||
void on_elseActionAdd_clicked();
|
||||
void on_elseActionRemove_clicked();
|
||||
void on_elseActionTop_clicked();
|
||||
|
|
@ -146,6 +150,8 @@ public slots:
|
|||
void MaximizeElseActions();
|
||||
void MinimizeConditions();
|
||||
void MaximizeConditions();
|
||||
void SetElseActionsStateToHidden();
|
||||
void SetElseActionsStateToVisible();
|
||||
void MacroActionSelectionChanged(int idx);
|
||||
void MacroActionReorder(int to, int target);
|
||||
void AddMacroAction(int idx);
|
||||
|
|
@ -334,7 +340,7 @@ public slots:
|
|||
void on_timeUp_clicked();
|
||||
void on_timeDown_clicked();
|
||||
|
||||
// Video tab
|
||||
// Audio tab
|
||||
public:
|
||||
void SetupAudioTab();
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -700,8 +700,7 @@ void AdvSceneSwitcher::MacroSelectionAboutToChange()
|
|||
// actions nor elseActions being visible when the condition <-> action
|
||||
// splitter is moved
|
||||
if (elsePos[0] == 0 && elsePos[1] == 0) {
|
||||
macro->SetElseActionSplitterPosition(QList<int>()
|
||||
<< 999999 << 0);
|
||||
maximizeFirstSplitterEntry(ui->macroElseActionSplitter);
|
||||
return;
|
||||
}
|
||||
macro->SetElseActionSplitterPosition(
|
||||
|
|
@ -790,6 +789,8 @@ bool shouldRestoreSplitter(const QList<int> &pos)
|
|||
|
||||
void AdvSceneSwitcher::SetupMacroTab()
|
||||
{
|
||||
ui->macroElseActions->installEventFilter(this);
|
||||
|
||||
if (switcher->macros.size() == 0 && !switcher->disableHints) {
|
||||
addPulse = PulseWidget(ui->macroAdd, QColor(Qt::green));
|
||||
}
|
||||
|
|
@ -862,6 +863,8 @@ void AdvSceneSwitcher::SetupMacroTab()
|
|||
SetButtonIcon(ui->conditionTop, (pathPrefix + "DoubleUp.svg").c_str());
|
||||
SetButtonIcon(ui->conditionBottom,
|
||||
(pathPrefix + "DoubleDown.svg").c_str());
|
||||
SetButtonIcon(ui->toggleElseActions,
|
||||
(pathPrefix + "NotEqual.svg").c_str());
|
||||
|
||||
// Reserve more space for macro edit area than for the macro list
|
||||
ui->macroListMacroEditSplitter->setStretchFactor(0, 1);
|
||||
|
|
@ -1100,6 +1103,31 @@ void AdvSceneSwitcher::MaximizeConditions()
|
|||
MinimizeActions();
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_toggleElseActions_clicked()
|
||||
{
|
||||
auto elsePosition = ui->macroElseActionSplitter->sizes();
|
||||
if (elsePosition[1] == 0) {
|
||||
centerSplitterPosition(ui->macroElseActionSplitter);
|
||||
return;
|
||||
}
|
||||
|
||||
maximizeFirstSplitterEntry(ui->macroElseActionSplitter);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::SetElseActionsStateToHidden()
|
||||
{
|
||||
ui->toggleElseActions->setToolTip(obs_module_text(
|
||||
"AdvSceneSwitcher.macroTab.toggleElseActions.show.tooltip"));
|
||||
ui->toggleElseActions->setChecked(false);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::SetElseActionsStateToVisible()
|
||||
{
|
||||
ui->toggleElseActions->setToolTip(obs_module_text(
|
||||
"AdvSceneSwitcher.macroTab.toggleElseActions.hide.tooltip"));
|
||||
ui->toggleElseActions->setChecked(true);
|
||||
}
|
||||
|
||||
bool AdvSceneSwitcher::MacroTabIsInFocus()
|
||||
{
|
||||
return isActiveWindow() && isAncestorOf(focusWidget()) &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user