mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 09:05:57 -05:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf7fe71ae3 | ||
|
|
12a6b26d9a | ||
|
|
373e74c080 | ||
|
|
f3e7eaf212 | ||
|
|
b036736547 | ||
|
|
817de13e9d | ||
|
|
0b774c171d | ||
|
|
be8f7bd70f | ||
|
|
5f963b5b7d | ||
|
|
c6155c9fea | ||
|
|
be809dbfab | ||
|
|
7478c149b3 | ||
|
|
f4eaa9785d | ||
|
|
49c0de3f1b | ||
|
|
101ef4e973 | ||
|
|
82568b23e8 | ||
|
|
0cd7004f6a | ||
|
|
40c62ba700 | ||
|
|
f2c7b532d9 | ||
|
|
456a9c04c7 | ||
|
|
3e1fdbde45 | ||
|
|
874b9b86e2 | ||
|
|
98d1f83acc | ||
|
|
7e91f81957 |
5
.github/scripts/.Aptfile
vendored
5
.github/scripts/.Aptfile
vendored
@@ -12,4 +12,7 @@ package 'libtesseract-dev'
|
|||||||
package 'libproc2-dev'
|
package 'libproc2-dev'
|
||||||
package 'libusb-1.0-0-dev'
|
package 'libusb-1.0-0-dev'
|
||||||
package 'libpaho-mqttpp-dev'
|
package 'libpaho-mqttpp-dev'
|
||||||
package 'libpaho-mqtt-dev'
|
package 'libpaho-mqtt-dev'
|
||||||
|
package 'libpaho-mqtt-dev'
|
||||||
|
package 'libasound2-dev'
|
||||||
|
package 'libpipewire-0.3-dev'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.16...3.26)
|
cmake_minimum_required(VERSION 3.21...3.26)
|
||||||
|
|
||||||
project(advanced-scene-switcher VERSION 1.0.0)
|
project(advanced-scene-switcher VERSION 1.0.0)
|
||||||
|
|
||||||
@@ -123,6 +123,8 @@ target_sources(
|
|||||||
lib/macro/macro-condition.hpp
|
lib/macro/macro-condition.hpp
|
||||||
lib/macro/macro-dock.cpp
|
lib/macro/macro-dock.cpp
|
||||||
lib/macro/macro-dock.hpp
|
lib/macro/macro-dock.hpp
|
||||||
|
lib/macro/macro-edit.cpp
|
||||||
|
lib/macro/macro-edit.hpp
|
||||||
lib/macro/macro-export-import-dialog.cpp
|
lib/macro/macro-export-import-dialog.cpp
|
||||||
lib/macro/macro-export-import-dialog.hpp
|
lib/macro/macro-export-import-dialog.hpp
|
||||||
lib/macro/macro-helpers.cpp
|
lib/macro/macro-helpers.cpp
|
||||||
@@ -217,6 +219,8 @@ target_sources(
|
|||||||
lib/utils/priority-helper.hpp
|
lib/utils/priority-helper.hpp
|
||||||
lib/utils/regex-config.cpp
|
lib/utils/regex-config.cpp
|
||||||
lib/utils/regex-config.hpp
|
lib/utils/regex-config.hpp
|
||||||
|
lib/utils/resizable-widget.cpp
|
||||||
|
lib/utils/resizable-widget.hpp
|
||||||
lib/utils/resizing-text-edit.cpp
|
lib/utils/resizing-text-edit.cpp
|
||||||
lib/utils/resizing-text-edit.hpp
|
lib/utils/resizing-text-edit.hpp
|
||||||
lib/utils/resource-table.cpp
|
lib/utils/resource-table.cpp
|
||||||
@@ -415,6 +419,7 @@ else()
|
|||||||
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
|
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
|
||||||
set_target_properties(${LIB_NAME} PROPERTIES SOVERSION 1)
|
set_target_properties(${LIB_NAME} PROPERTIES SOVERSION 1)
|
||||||
|
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS DBus)
|
||||||
find_package(X11 REQUIRED COMPONENTS Xss)
|
find_package(X11 REQUIRED COMPONENTS Xss)
|
||||||
target_include_directories(${LIB_NAME} PRIVATE "${X11_INCLUDE_DIR}"
|
target_include_directories(${LIB_NAME} PRIVATE "${X11_INCLUDE_DIR}"
|
||||||
"${X11_Xss_INCLUDE_PATH}")
|
"${X11_Xss_INCLUDE_PATH}")
|
||||||
@@ -446,7 +451,8 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
target_include_directories(${LIB_NAME} PRIVATE "${PROC_INCLUDE_DIR}")
|
target_include_directories(${LIB_NAME} PRIVATE "${PROC_INCLUDE_DIR}")
|
||||||
target_sources(${LIB_NAME} PRIVATE lib/linux/advanced-scene-switcher-nix.cpp)
|
target_sources(${LIB_NAME} PRIVATE lib/linux/advanced-scene-switcher-nix.cpp
|
||||||
|
lib/linux/kwin-helpers.cpp)
|
||||||
|
|
||||||
# Don't include irrelevant folders into sources archive
|
# Don't include irrelevant folders into sources archive
|
||||||
list(APPEND CPACK_SOURCE_IGNORE_FILES "\\.deps/.*")
|
list(APPEND CPACK_SOURCE_IGNORE_FILES "\\.deps/.*")
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ function(set_target_properties_plugin target)
|
|||||||
|
|
||||||
configure_file(cmake/windows/resources/installer-Windows.iss.in
|
configure_file(cmake/windows/resources/installer-Windows.iss.in
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/installer-Windows.generated.iss")
|
"${CMAKE_CURRENT_BINARY_DIR}/installer-Windows.generated.iss")
|
||||||
|
configure_file(data/res/images/logo.ico
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/installer.ico" COPYONLY)
|
||||||
|
|
||||||
configure_file(cmake/windows/resources/resource.rc.in
|
configure_file(cmake/windows/resources/resource.rc.in
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
|
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Windows-Installer
|
|||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
DirExistsWarning=no
|
DirExistsWarning=no
|
||||||
|
SetupIconFile=installer.ico
|
||||||
|
UninstallDisplayIcon={app}\data\obs-plugins\advanced-scene-switcher\res\images\logo.ico
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ AdvSceneSwitcher.macroTab.title="Macro"
|
|||||||
AdvSceneSwitcher.macroTab.macros="Macros"
|
AdvSceneSwitcher.macroTab.macros="Macros"
|
||||||
AdvSceneSwitcher.macroTab.priorityWarning="Note: It is recommended to configure macros to be the highest priority functionality.\nThis setting can be changed on the General tab."
|
AdvSceneSwitcher.macroTab.priorityWarning="Note: It is recommended to configure macros to be the highest priority functionality.\nThis setting can be changed on the General tab."
|
||||||
AdvSceneSwitcher.macroTab.help="Macros allow you to execute a string of actions depending on multiple conditions.\n\nClick on the highlighted plus symbol to add a new Macro."
|
AdvSceneSwitcher.macroTab.help="Macros allow you to execute a string of actions depending on multiple conditions.\n\nClick on the highlighted plus symbol to add a new Macro."
|
||||||
AdvSceneSwitcher.macroTab.editConditionHelp="This section allows you to define Macro conditions.\n\nSelect an existing or add a new Macro on the left.\nThen click the plus button below to add a new condition."
|
AdvSceneSwitcher.macroTab.editConditionHelp="This section allows you to define macro conditions.\n\nSelect an existing or add a new macro on the left.\nThen click the plus button below to add a new condition."
|
||||||
AdvSceneSwitcher.macroTab.editActionHelp="This section allows you to define Macro actions.\n\nSelect an existing or add a new Macro on the left.\nThen click the plus button below to add a new action."
|
AdvSceneSwitcher.macroTab.editActionHelp="This section allows you to define macro actions.\nThe actions in this section will be performed when the conditions are met.\n\nSelect an existing or add a new macro on the left.\nThen click the plus button below to add a new action."
|
||||||
AdvSceneSwitcher.macroTab.editElseActionHelp="This section allows you to define Macro actions, which are executed if the conditions are *not* met.\n\nSelect an existing or add a new Macro on the left.\nThen click the plus button below to add a new action."
|
AdvSceneSwitcher.macroTab.editElseActionHelp="This section allows you to define macro actions.\nThe actions in this section will be performed when the conditions are *not* met.\n\nSelect an existing or add a new macro on the left.\nThen click the plus button below to add a new action."
|
||||||
AdvSceneSwitcher.macroTab.edit="Edit macro"
|
AdvSceneSwitcher.macroTab.edit="Edit macro"
|
||||||
AdvSceneSwitcher.macroTab.edit.logic="Logic type:"
|
AdvSceneSwitcher.macroTab.edit.logic="Logic type:"
|
||||||
AdvSceneSwitcher.macroTab.edit.condition="Condition type:"
|
AdvSceneSwitcher.macroTab.edit.condition="Condition type:"
|
||||||
@@ -177,6 +177,8 @@ AdvSceneSwitcher.macroTab.contextMenuAdd="Add"
|
|||||||
AdvSceneSwitcher.macroTab.copy="Duplicate Macro"
|
AdvSceneSwitcher.macroTab.copy="Duplicate Macro"
|
||||||
AdvSceneSwitcher.macroTab.group="Group Selected Macros"
|
AdvSceneSwitcher.macroTab.group="Group Selected Macros"
|
||||||
AdvSceneSwitcher.macroTab.ungroup="Ungroup Selected Groups"
|
AdvSceneSwitcher.macroTab.ungroup="Ungroup Selected Groups"
|
||||||
|
AdvSceneSwitcher.macroTab.expandAllGroups="Expand all Groups"
|
||||||
|
AdvSceneSwitcher.macroTab.collapseAllGroups="Collapse all Groups"
|
||||||
AdvSceneSwitcher.macroTab.rename="Rename"
|
AdvSceneSwitcher.macroTab.rename="Rename"
|
||||||
AdvSceneSwitcher.macroTab.remove="Remove"
|
AdvSceneSwitcher.macroTab.remove="Remove"
|
||||||
AdvSceneSwitcher.macroTab.export="Export"
|
AdvSceneSwitcher.macroTab.export="Export"
|
||||||
@@ -507,6 +509,7 @@ AdvSceneSwitcher.condition.source.type.showing="Is showing"
|
|||||||
AdvSceneSwitcher.condition.source.type.settingsMatch="Settings match"
|
AdvSceneSwitcher.condition.source.type.settingsMatch="Settings match"
|
||||||
AdvSceneSwitcher.condition.source.type.settingsChanged="Settings changed"
|
AdvSceneSwitcher.condition.source.type.settingsChanged="Settings changed"
|
||||||
AdvSceneSwitcher.condition.source.type.individualSettingMatches="Setting value matches"
|
AdvSceneSwitcher.condition.source.type.individualSettingMatches="Setting value matches"
|
||||||
|
AdvSceneSwitcher.condition.source.type.individualSettingListSelectionMatches="Settings value list selection matches"
|
||||||
AdvSceneSwitcher.condition.source.type.individualSettingChanged="Setting value changed"
|
AdvSceneSwitcher.condition.source.type.individualSettingChanged="Setting value changed"
|
||||||
AdvSceneSwitcher.condition.source.type.width="Width"
|
AdvSceneSwitcher.condition.source.type.width="Width"
|
||||||
AdvSceneSwitcher.condition.source.type.height="Height"
|
AdvSceneSwitcher.condition.source.type.height="Height"
|
||||||
@@ -515,6 +518,7 @@ AdvSceneSwitcher.condition.source.sizeCompare.equal="Equals"
|
|||||||
AdvSceneSwitcher.condition.source.sizeCompare.more="Bigger than"
|
AdvSceneSwitcher.condition.source.sizeCompare.more="Bigger than"
|
||||||
AdvSceneSwitcher.condition.source.refresh="Refresh"
|
AdvSceneSwitcher.condition.source.refresh="Refresh"
|
||||||
AdvSceneSwitcher.condition.source.refresh.tooltip="Repopulate the source settings selection with the settings of the source which's name matches the variable value."
|
AdvSceneSwitcher.condition.source.refresh.tooltip="Repopulate the source settings selection with the settings of the source which's name matches the variable value."
|
||||||
|
AdvSceneSwitcher.condition.source.includeDefaults="Include default settings values"
|
||||||
AdvSceneSwitcher.condition.source.sceneVisibilityHint="Scene specific visibility can be checked using the \"Scene item visibility\" condition"
|
AdvSceneSwitcher.condition.source.sceneVisibilityHint="Scene specific visibility can be checked using the \"Scene item visibility\" condition"
|
||||||
AdvSceneSwitcher.condition.source.getSettings="Get current settings"
|
AdvSceneSwitcher.condition.source.getSettings="Get current settings"
|
||||||
AdvSceneSwitcher.condition.source.entry.line1="{{sources}}{{conditions}}{{settingSelection}}{{refresh}}{{sizeCompareMethods}}{{size}}"
|
AdvSceneSwitcher.condition.source.entry.line1="{{sources}}{{conditions}}{{settingSelection}}{{refresh}}{{sizeCompareMethods}}{{size}}"
|
||||||
@@ -530,9 +534,11 @@ AdvSceneSwitcher.condition.filter.type.showing="Is disabled"
|
|||||||
AdvSceneSwitcher.condition.filter.type.settingsMatch="Settings match"
|
AdvSceneSwitcher.condition.filter.type.settingsMatch="Settings match"
|
||||||
AdvSceneSwitcher.condition.filter.type.settingsChanged="Settings changed"
|
AdvSceneSwitcher.condition.filter.type.settingsChanged="Settings changed"
|
||||||
AdvSceneSwitcher.condition.filter.type.individualSettingMatches="Settings value matches"
|
AdvSceneSwitcher.condition.filter.type.individualSettingMatches="Settings value matches"
|
||||||
|
AdvSceneSwitcher.condition.filter.type.individualSettingListSelectionMatches="Settings value list selection matches"
|
||||||
AdvSceneSwitcher.condition.filter.type.individualSettingChanged="Settings value changed"
|
AdvSceneSwitcher.condition.filter.type.individualSettingChanged="Settings value changed"
|
||||||
AdvSceneSwitcher.condition.filter.refresh="Refresh"
|
AdvSceneSwitcher.condition.filter.refresh="Refresh"
|
||||||
AdvSceneSwitcher.condition.filter.refresh.tooltip="Repopulate the filter settings selection with the settings of the filter which's name matches the variable value."
|
AdvSceneSwitcher.condition.filter.refresh.tooltip="Repopulate the filter settings selection with the settings of the filter which's name matches the variable value."
|
||||||
|
AdvSceneSwitcher.condition.filter.includeDefaults="Include default settings values"
|
||||||
AdvSceneSwitcher.condition.filter.getSettings="Get current settings"
|
AdvSceneSwitcher.condition.filter.getSettings="Get current settings"
|
||||||
AdvSceneSwitcher.condition.filter.entry.line1="On{{sources}}{{filters}}{{conditions}}{{settingSelection}}{{refresh}}"
|
AdvSceneSwitcher.condition.filter.entry.line1="On{{sources}}{{filters}}{{conditions}}{{settingSelection}}{{refresh}}"
|
||||||
AdvSceneSwitcher.condition.filter.entry.line2="{{settings}}"
|
AdvSceneSwitcher.condition.filter.entry.line2="{{settings}}"
|
||||||
@@ -822,6 +828,7 @@ AdvSceneSwitcher.action.wait.entry.random="Wait for{{waitType}}duration from{{du
|
|||||||
AdvSceneSwitcher.action.audio="Audio"
|
AdvSceneSwitcher.action.audio="Audio"
|
||||||
AdvSceneSwitcher.action.audio.type.mute="Mute"
|
AdvSceneSwitcher.action.audio.type.mute="Mute"
|
||||||
AdvSceneSwitcher.action.audio.type.unmute="Unmute"
|
AdvSceneSwitcher.action.audio.type.unmute="Unmute"
|
||||||
|
AdvSceneSwitcher.action.audio.type.toggleMute="Toggle mute"
|
||||||
AdvSceneSwitcher.action.audio.type.sourceVolume="Set source volume"
|
AdvSceneSwitcher.action.audio.type.sourceVolume="Set source volume"
|
||||||
AdvSceneSwitcher.action.audio.type.masterVolume="Set master volume"
|
AdvSceneSwitcher.action.audio.type.masterVolume="Set master volume"
|
||||||
AdvSceneSwitcher.action.audio.type.syncOffset="Set sync offset"
|
AdvSceneSwitcher.action.audio.type.syncOffset="Set sync offset"
|
||||||
@@ -887,6 +894,7 @@ AdvSceneSwitcher.action.filter.entry="On{{sources}}{{actions}}{{filters}}{{refre
|
|||||||
AdvSceneSwitcher.action.filter.entry.settings="{{settings}}{{settingsInputMethod}}{{settingValue}}{{tempVar}}"
|
AdvSceneSwitcher.action.filter.entry.settings="{{settings}}{{settingsInputMethod}}{{settingValue}}{{tempVar}}"
|
||||||
AdvSceneSwitcher.action.filter.getSettings="Get current settings"
|
AdvSceneSwitcher.action.filter.getSettings="Get current settings"
|
||||||
AdvSceneSwitcher.action.filter.inputMethod.individualManual="Set to fixed value"
|
AdvSceneSwitcher.action.filter.inputMethod.individualManual="Set to fixed value"
|
||||||
|
AdvSceneSwitcher.action.filter.inputMethod.individualListEntryManual="Set to list entry"
|
||||||
AdvSceneSwitcher.action.filter.inputMethod.individualTempvar="Set to macro property"
|
AdvSceneSwitcher.action.filter.inputMethod.individualTempvar="Set to macro property"
|
||||||
AdvSceneSwitcher.action.filter.inputMethod.json="Set setting JSON string"
|
AdvSceneSwitcher.action.filter.inputMethod.json="Set setting JSON string"
|
||||||
AdvSceneSwitcher.action.source="Source"
|
AdvSceneSwitcher.action.source="Source"
|
||||||
@@ -917,6 +925,7 @@ AdvSceneSwitcher.action.source.deinterlaceMode.yadif2x="Yadif 2x"
|
|||||||
AdvSceneSwitcher.action.source.deinterlaceOrder.topFieldFirst="Top Field First"
|
AdvSceneSwitcher.action.source.deinterlaceOrder.topFieldFirst="Top Field First"
|
||||||
AdvSceneSwitcher.action.source.deinterlaceOrder.bottomFieldFirst="Bottom Field First"
|
AdvSceneSwitcher.action.source.deinterlaceOrder.bottomFieldFirst="Bottom Field First"
|
||||||
AdvSceneSwitcher.action.source.inputMethod.individualManual="Set to fixed value"
|
AdvSceneSwitcher.action.source.inputMethod.individualManual="Set to fixed value"
|
||||||
|
AdvSceneSwitcher.action.source.inputMethod.individualListEntryManual="Set to list entry"
|
||||||
AdvSceneSwitcher.action.source.inputMethod.individualTempvar="Set to macro property"
|
AdvSceneSwitcher.action.source.inputMethod.individualTempvar="Set to macro property"
|
||||||
AdvSceneSwitcher.action.source.inputMethod.json="Set setting JSON string"
|
AdvSceneSwitcher.action.source.inputMethod.json="Set setting JSON string"
|
||||||
AdvSceneSwitcher.action.source.refresh="Refresh"
|
AdvSceneSwitcher.action.source.refresh="Refresh"
|
||||||
@@ -955,6 +964,10 @@ AdvSceneSwitcher.action.macro.type.stop="Stop actions"
|
|||||||
AdvSceneSwitcher.action.macro.type.disableAction="Disable action"
|
AdvSceneSwitcher.action.macro.type.disableAction="Disable action"
|
||||||
AdvSceneSwitcher.action.macro.type.enableAction="Enable action"
|
AdvSceneSwitcher.action.macro.type.enableAction="Enable action"
|
||||||
AdvSceneSwitcher.action.macro.type.toggleAction="Toggle action"
|
AdvSceneSwitcher.action.macro.type.toggleAction="Toggle action"
|
||||||
|
AdvSceneSwitcher.action.macro.type.nestedMacro="Nested macro"
|
||||||
|
AdvSceneSwitcher.action.macro.type.nestedMacro.conditionHelp="This section allows you to define macro conditions.\n\nClick the plus button below to add a new condition."
|
||||||
|
AdvSceneSwitcher.action.macro.type.nestedMacro.actionHelp="This section allows you to define macro actions.\nThe actions in this section will be performed when the conditions are met.\n\nClick the plus button below to add a new action."
|
||||||
|
AdvSceneSwitcher.action.macro.type.nestedMacro.elseActionHelp="This section allows you to define macro actions.\nThe actions in this section will be performed when the conditions are *not* met.\n\nClick the plus button below to add a new action."
|
||||||
AdvSceneSwitcher.action.macro.entry.run="{{actions}}{{actionTypes}}of{{macros}}"
|
AdvSceneSwitcher.action.macro.entry.run="{{actions}}{{actionTypes}}of{{macros}}"
|
||||||
AdvSceneSwitcher.action.macro.entry.run.condition="{{conditionBehaviors}}of{{conditionMacros}}"
|
AdvSceneSwitcher.action.macro.entry.run.condition="{{conditionBehaviors}}of{{conditionMacros}}"
|
||||||
AdvSceneSwitcher.action.macro.entry.other="{{actions}}{{actionIndex}}{{macros}}"
|
AdvSceneSwitcher.action.macro.entry.other="{{actions}}{{actionIndex}}{{macros}}"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
BIN
data/res/images/logo.ico
Normal file
BIN
data/res/images/logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
@@ -790,7 +790,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QGroupBox" name="macroEdit">
|
<widget class="QGroupBox" name="macroEditGroup">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>AdvSceneSwitcher.macroTab.edit</string>
|
<string>AdvSceneSwitcher.macroTab.edit</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -896,339 +896,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="macroActionConditionSplitter">
|
<widget class="advss::MacroEdit" name="macroEdit" native="true"/>
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="macroConditions" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="macroConditionsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="advss::MacroSegmentList" name="conditionsList">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>1</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="conditionControlsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="conditionAdd">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.conditionAddButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">addIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-plus</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="conditionRemove">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.conditionRemoveButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">removeIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-trash</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="conditionTop">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.conditionTopButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="conditionUp">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.conditionUpButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">upArrowIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-up</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="conditionDown">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.conditionDownButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">downArrowIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-down</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="conditionBottom">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.conditionBottomButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QSplitter" name="macroElseActionSplitter">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="macroActions" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="macroActionsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="advss::MacroSegmentList" name="actionsList">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>1</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="actionControlsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="actionAdd">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.actionAddButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">addIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-plus</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="actionRemove">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.actionRemoveButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">removeIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-trash</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="actionTop">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.actionTopButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="actionUp">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.actionUpButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">upArrowIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-up</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="actionDown">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.actionDownButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">downArrowIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-down</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="actionBottom">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.actionBottomButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_14">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="toggleElseActions">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.toggleShowElseSection</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="macroElseActions" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="macroElseActionsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="advss::MacroSegmentList" name="elseActionsList">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>1</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="elseActionControlsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="elseActionAdd">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionAddButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">addIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-plus</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="elseActionRemove">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionRemoveButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">removeIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-trash</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="elseActionTop">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionTopButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="elseActionUp">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionUpButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">upArrowIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-up</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="elseActionDown">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionDownButton</string>
|
|
||||||
</property>
|
|
||||||
<property name="themeID" stdset="0">
|
|
||||||
<string notr="true">downArrowIconSmall</string>
|
|
||||||
</property>
|
|
||||||
<property name="class" stdset="0">
|
|
||||||
<string notr="true">icon-down</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="elseActionBottom">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionBottomButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -4440,12 +4108,6 @@
|
|||||||
<extends>QListView</extends>
|
<extends>QListView</extends>
|
||||||
<header>macro-tree.hpp</header>
|
<header>macro-tree.hpp</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>advss::MacroSegmentList</class>
|
|
||||||
<extends>QScrollArea</extends>
|
|
||||||
<header>macro-segment-list.hpp</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>advss::MacroRunButton</class>
|
<class>advss::MacroRunButton</class>
|
||||||
<extends>QPushButton</extends>
|
<extends>QPushButton</extends>
|
||||||
@@ -4456,6 +4118,12 @@
|
|||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>duration-control.hpp</header>
|
<header>duration-control.hpp</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>advss::MacroEdit</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>macro-edit.hpp</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabWidget</tabstop>
|
<tabstop>tabWidget</tabstop>
|
||||||
@@ -4492,28 +4160,7 @@
|
|||||||
<tabstop>runMacroInParallel</tabstop>
|
<tabstop>runMacroInParallel</tabstop>
|
||||||
<tabstop>runMacroOnChange</tabstop>
|
<tabstop>runMacroOnChange</tabstop>
|
||||||
<tabstop>macroSettings</tabstop>
|
<tabstop>macroSettings</tabstop>
|
||||||
<tabstop>conditionsList</tabstop>
|
<tabstop>macroEdit</tabstop>
|
||||||
<tabstop>conditionAdd</tabstop>
|
|
||||||
<tabstop>conditionRemove</tabstop>
|
|
||||||
<tabstop>conditionTop</tabstop>
|
|
||||||
<tabstop>conditionUp</tabstop>
|
|
||||||
<tabstop>conditionDown</tabstop>
|
|
||||||
<tabstop>conditionBottom</tabstop>
|
|
||||||
<tabstop>actionsList</tabstop>
|
|
||||||
<tabstop>actionAdd</tabstop>
|
|
||||||
<tabstop>actionRemove</tabstop>
|
|
||||||
<tabstop>actionTop</tabstop>
|
|
||||||
<tabstop>actionUp</tabstop>
|
|
||||||
<tabstop>actionDown</tabstop>
|
|
||||||
<tabstop>actionBottom</tabstop>
|
|
||||||
<tabstop>toggleElseActions</tabstop>
|
|
||||||
<tabstop>elseActionsList</tabstop>
|
|
||||||
<tabstop>elseActionAdd</tabstop>
|
|
||||||
<tabstop>elseActionRemove</tabstop>
|
|
||||||
<tabstop>elseActionTop</tabstop>
|
|
||||||
<tabstop>elseActionUp</tabstop>
|
|
||||||
<tabstop>elseActionDown</tabstop>
|
|
||||||
<tabstop>elseActionBottom</tabstop>
|
|
||||||
<tabstop>sceneGroups</tabstop>
|
<tabstop>sceneGroups</tabstop>
|
||||||
<tabstop>sceneGroupAdd</tabstop>
|
<tabstop>sceneGroupAdd</tabstop>
|
||||||
<tabstop>sceneGroupRemove</tabstop>
|
<tabstop>sceneGroupRemove</tabstop>
|
||||||
|
|||||||
388
forms/macro-edit.ui
Normal file
388
forms/macro-edit.ui
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MacroEdit</class>
|
||||||
|
<widget class="QWidget" name="MacroEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QSplitter" name="macroActionConditionSplitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="macroConditions" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="macroConditionsLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="advss::MacroSegmentList" name="conditionsList">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="conditionControlsLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="conditionAdd">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.conditionAddButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">addIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-plus</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="conditionRemove">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.conditionRemoveButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">removeIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-trash</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="conditionTop">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.conditionTopButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="conditionUp">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.conditionUpButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">upArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="conditionDown">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.conditionDownButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">downArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-down</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="conditionBottom">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.conditionBottomButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSplitter" name="macroElseActionSplitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="macroActions" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="macroActionsLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="advss::MacroSegmentList" name="actionsList">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="actionControlsLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="actionAdd">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.actionAddButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">addIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-plus</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="actionRemove">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.actionRemoveButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">removeIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-trash</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="actionTop">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.actionTopButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="actionUp">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.actionUpButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">upArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="actionDown">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.actionDownButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">downArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-down</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="actionBottom">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.actionBottomButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_14">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toggleElseActions">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.toggleShowElseSection</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="macroElseActions" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="macroElseActionsLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="advss::MacroSegmentList" name="elseActionsList">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="elseActionControlsLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="elseActionAdd">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionAddButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">addIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-plus</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="elseActionRemove">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionRemoveButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">removeIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-trash</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="elseActionTop">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionTopButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="elseActionUp">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionUpButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">upArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="elseActionDown">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionDownButton</string>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">downArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
<property name="class" stdset="0">
|
||||||
|
<string notr="true">icon-down</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="elseActionBottom">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.tooltip.elseActionBottomButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>advss::MacroSegmentList</class>
|
||||||
|
<extends>QScrollArea</extends>
|
||||||
|
<header>macro-segment-list.hpp</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>conditionsList</tabstop>
|
||||||
|
<tabstop>conditionAdd</tabstop>
|
||||||
|
<tabstop>conditionRemove</tabstop>
|
||||||
|
<tabstop>conditionTop</tabstop>
|
||||||
|
<tabstop>conditionUp</tabstop>
|
||||||
|
<tabstop>conditionDown</tabstop>
|
||||||
|
<tabstop>conditionBottom</tabstop>
|
||||||
|
<tabstop>actionsList</tabstop>
|
||||||
|
<tabstop>actionAdd</tabstop>
|
||||||
|
<tabstop>actionRemove</tabstop>
|
||||||
|
<tabstop>actionTop</tabstop>
|
||||||
|
<tabstop>actionUp</tabstop>
|
||||||
|
<tabstop>actionDown</tabstop>
|
||||||
|
<tabstop>actionBottom</tabstop>
|
||||||
|
<tabstop>toggleElseActions</tabstop>
|
||||||
|
<tabstop>elseActionsList</tabstop>
|
||||||
|
<tabstop>elseActionAdd</tabstop>
|
||||||
|
<tabstop>elseActionRemove</tabstop>
|
||||||
|
<tabstop>elseActionTop</tabstop>
|
||||||
|
<tabstop>elseActionUp</tabstop>
|
||||||
|
<tabstop>elseActionDown</tabstop>
|
||||||
|
<tabstop>elseActionBottom</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -146,16 +146,7 @@ void AdvSceneSwitcher::LoadUI()
|
|||||||
bool AdvSceneSwitcher::eventFilter(QObject *obj, QEvent *event)
|
bool AdvSceneSwitcher::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
auto eventType = event->type();
|
auto eventType = event->type();
|
||||||
if (obj == ui->macroElseActions && eventType == QEvent::Resize) {
|
if (eventType == QEvent::KeyPress) {
|
||||||
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
|
||||||
|
|
||||||
if (resizeEvent->size().height() == 0) {
|
|
||||||
SetElseActionsStateToHidden();
|
|
||||||
return QDialog::eventFilter(obj, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetElseActionsStateToVisible();
|
|
||||||
} else if (eventType == QEvent::KeyPress) {
|
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
auto pressedKey = keyEvent->key();
|
auto pressedKey = keyEvent->key();
|
||||||
|
|
||||||
@@ -608,7 +599,7 @@ static void handleSceneCollectionChanging()
|
|||||||
AdvSceneSwitcher::window->close();
|
AdvSceneSwitcher::window->close();
|
||||||
}
|
}
|
||||||
if (!switcher->stop) {
|
if (!switcher->stop) {
|
||||||
switcher->sceneColletionStop = true;
|
switcher->sceneCollectionStop = true;
|
||||||
switcher->Stop();
|
switcher->Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -744,6 +735,21 @@ void AdvSceneSwitcher::HighlightMacroSettingsButton(bool enable)
|
|||||||
highlight = HighlightWidget(ui->macroSettings, Qt::green);
|
highlight = HighlightWidget(ui->macroSettings, Qt::green);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::HighlightAction(int idx, QColor color) const
|
||||||
|
{
|
||||||
|
ui->macroEdit->HighlightAction(idx, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::HighlightElseAction(int idx, QColor color) const
|
||||||
|
{
|
||||||
|
ui->macroEdit->HighlightElseAction(idx, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::HighlightCondition(int idx, QColor color) const
|
||||||
|
{
|
||||||
|
ui->macroEdit->HighlightCondition(idx, color);
|
||||||
|
}
|
||||||
|
|
||||||
void HighlightMacroSettingsButton(bool enable)
|
void HighlightMacroSettingsButton(bool enable)
|
||||||
{
|
{
|
||||||
auto window = GetSettingsWindow();
|
auto window = GetSettingsWindow();
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public slots:
|
|||||||
/* --- Begin of macro tab section --- */
|
/* --- Begin of macro tab section --- */
|
||||||
public:
|
public:
|
||||||
void SetupMacroTab();
|
void SetupMacroTab();
|
||||||
|
bool MacroTabIsInFocus();
|
||||||
bool AddNewMacro(std::shared_ptr<Macro> &res, std::string &name,
|
bool AddNewMacro(std::shared_ptr<Macro> &res, std::string &name,
|
||||||
std::string format = "");
|
std::string format = "");
|
||||||
void RemoveMacro(std::shared_ptr<Macro> &);
|
void RemoveMacro(std::shared_ptr<Macro> &);
|
||||||
@@ -86,7 +87,6 @@ public:
|
|||||||
void RenameMacro(std::shared_ptr<Macro> &, const QString &name);
|
void RenameMacro(std::shared_ptr<Macro> &, const QString &name);
|
||||||
std::shared_ptr<Macro> GetSelectedMacro() const;
|
std::shared_ptr<Macro> GetSelectedMacro() const;
|
||||||
std::vector<std::shared_ptr<Macro>> GetSelectedMacros() const;
|
std::vector<std::shared_ptr<Macro>> GetSelectedMacros() const;
|
||||||
void SetEditMacro(Macro &m);
|
|
||||||
void SetMacroEditAreaDisabled(bool) const;
|
void SetMacroEditAreaDisabled(bool) const;
|
||||||
void HighlightAction(int idx, QColor color = QColor(Qt::green)) const;
|
void HighlightAction(int idx, QColor color = QColor(Qt::green)) const;
|
||||||
void HighlightElseAction(int idx,
|
void HighlightElseAction(int idx,
|
||||||
@@ -111,82 +111,14 @@ public slots:
|
|||||||
void on_macroName_editingFinished();
|
void on_macroName_editingFinished();
|
||||||
void on_runMacroInParallel_stateChanged(int value) const;
|
void on_runMacroInParallel_stateChanged(int value) const;
|
||||||
void on_runMacroOnChange_stateChanged(int value) const;
|
void on_runMacroOnChange_stateChanged(int value) const;
|
||||||
void on_conditionAdd_clicked();
|
|
||||||
void on_conditionRemove_clicked();
|
|
||||||
void on_conditionTop_clicked();
|
|
||||||
void on_conditionUp_clicked();
|
|
||||||
void on_conditionDown_clicked();
|
|
||||||
void on_conditionBottom_clicked();
|
|
||||||
void on_actionAdd_clicked();
|
|
||||||
void on_actionRemove_clicked();
|
|
||||||
void on_actionTop_clicked();
|
|
||||||
void on_actionUp_clicked();
|
|
||||||
void on_actionDown_clicked();
|
|
||||||
void on_actionBottom_clicked();
|
|
||||||
void on_toggleElseActions_clicked() const;
|
|
||||||
void on_elseActionAdd_clicked();
|
|
||||||
void on_elseActionRemove_clicked();
|
|
||||||
void on_elseActionTop_clicked();
|
|
||||||
void on_elseActionUp_clicked();
|
|
||||||
void on_elseActionDown_clicked();
|
|
||||||
void on_elseActionBottom_clicked();
|
|
||||||
void MacroSelectionAboutToChange() const;
|
|
||||||
void MacroSelectionChanged();
|
void MacroSelectionChanged();
|
||||||
void UpMacroSegementHotkey();
|
|
||||||
void DownMacroSegementHotkey();
|
|
||||||
void DeleteMacroSegementHotkey();
|
|
||||||
void ShowMacroContextMenu(const QPoint &);
|
void ShowMacroContextMenu(const QPoint &);
|
||||||
void ShowMacroActionsContextMenu(const QPoint &);
|
|
||||||
void ShowMacroElseActionsContextMenu(const QPoint &);
|
|
||||||
void ShowMacroConditionsContextMenu(const QPoint &);
|
|
||||||
void CopyMacro();
|
void CopyMacro();
|
||||||
void RenameSelectedMacro();
|
void RenameSelectedMacro();
|
||||||
void ExportMacros() const;
|
void ExportMacros() const;
|
||||||
void ImportMacros();
|
void ImportMacros();
|
||||||
void ExpandAllActions() const;
|
|
||||||
void ExpandAllElseActions() const;
|
|
||||||
void ExpandAllConditions() const;
|
|
||||||
void CollapseAllActions() const;
|
|
||||||
void CollapseAllElseActions() const;
|
|
||||||
void CollapseAllConditions() const;
|
|
||||||
void MinimizeActions() const;
|
|
||||||
void MaximizeActions() const;
|
|
||||||
void MinimizeElseActions() const;
|
|
||||||
void MaximizeElseActions() const;
|
|
||||||
void MinimizeConditions() const;
|
|
||||||
void MaximizeConditions() const;
|
|
||||||
void SetElseActionsStateToHidden() const;
|
|
||||||
void SetElseActionsStateToVisible() const;
|
|
||||||
void MacroActionSelectionChanged(int idx);
|
|
||||||
void MacroActionReorder(int to, int target);
|
|
||||||
void AddMacroAction(Macro *macro, int idx, const std::string &id,
|
|
||||||
obs_data_t *data);
|
|
||||||
void AddMacroAction(int idx);
|
|
||||||
void RemoveMacroAction(int idx);
|
|
||||||
void MoveMacroActionUp(int idx);
|
|
||||||
void MoveMacroActionDown(int idx);
|
|
||||||
void MacroElseActionSelectionChanged(int idx);
|
|
||||||
void MacroElseActionReorder(int to, int target);
|
|
||||||
void AddMacroElseAction(Macro *macro, int idx, const std::string &id,
|
|
||||||
obs_data_t *data);
|
|
||||||
void AddMacroElseAction(int idx);
|
|
||||||
void RemoveMacroElseAction(int idx);
|
|
||||||
void SwapElseActions(Macro *m, int pos1, int pos2);
|
|
||||||
void MoveMacroElseActionUp(int idx);
|
|
||||||
void MoveMacroElseActionDown(int idx);
|
|
||||||
void MacroConditionSelectionChanged(int idx);
|
|
||||||
void MacroConditionReorder(int to, int target);
|
|
||||||
void AddMacroCondition(int idx);
|
|
||||||
void AddMacroCondition(Macro *macro, int idx, const std::string &id,
|
|
||||||
obs_data_t *data, Logic::Type logic);
|
|
||||||
void RemoveMacroCondition(int idx);
|
|
||||||
void MoveMacroConditionUp(int idx);
|
|
||||||
void MoveMacroConditionDown(int idx);
|
|
||||||
void HighlightControls() const;
|
|
||||||
void HighlightOnChange() const;
|
void HighlightOnChange() const;
|
||||||
void on_macroSettings_clicked();
|
void on_macroSettings_clicked();
|
||||||
void CopyMacroSegment();
|
|
||||||
void PasteMacroSegment();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void MacroAdded(const QString &name);
|
void MacroAdded(const QString &name);
|
||||||
@@ -201,16 +133,7 @@ signals:
|
|||||||
void ConnectionRemoved(const QString &);
|
void ConnectionRemoved(const QString &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class MacroSection { CONDITIONS, ACTIONS, ELSE_ACTIONS };
|
|
||||||
|
|
||||||
void SetupMacroSegmentSelection(MacroSection type, int idx);
|
|
||||||
bool ResolveMacroImportNameConflict(std::shared_ptr<Macro> &);
|
bool ResolveMacroImportNameConflict(std::shared_ptr<Macro> &);
|
||||||
bool MacroTabIsInFocus();
|
|
||||||
|
|
||||||
MacroSection lastInteracted = MacroSection::CONDITIONS;
|
|
||||||
int currentConditionIdx = -1;
|
|
||||||
int currentActionIdx = -1;
|
|
||||||
int currentElseActionIdx = -1;
|
|
||||||
|
|
||||||
/* --- End of macro tab section --- */
|
/* --- End of macro tab section --- */
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void AdvSceneSwitcher::closeEvent(QCloseEvent *)
|
|||||||
switcher->windowSize = this->size();
|
switcher->windowSize = this->size();
|
||||||
switcher->macroListMacroEditSplitterPosition =
|
switcher->macroListMacroEditSplitterPosition =
|
||||||
ui->macroListMacroEditSplitter->sizes();
|
ui->macroListMacroEditSplitter->sizes();
|
||||||
MacroSelectionAboutToChange(); // Trigger saving of splitter states
|
ui->macroEdit->SetMacro(nullptr); // Trigger saving of splitter states
|
||||||
|
|
||||||
obs_frontend_save();
|
obs_frontend_save();
|
||||||
}
|
}
|
||||||
@@ -535,8 +535,8 @@ void SwitcherData::SaveGeneralSettings(obs_data_t *obj)
|
|||||||
cooldown.Save(obj, "cooldown");
|
cooldown.Save(obj, "cooldown");
|
||||||
obs_data_set_bool(obj, "enableCooldown", enableCooldown);
|
obs_data_set_bool(obj, "enableCooldown", enableCooldown);
|
||||||
|
|
||||||
obs_data_set_bool(obj, "active", sceneColletionStop ? true : !stop);
|
obs_data_set_bool(obj, "active", sceneCollectionStop ? true : !stop);
|
||||||
sceneColletionStop = false;
|
sceneCollectionStop = false;
|
||||||
obs_data_set_int(obj, "startup_behavior",
|
obs_data_set_int(obj, "startup_behavior",
|
||||||
static_cast<int>(startupBehavior));
|
static_cast<int>(startupBehavior));
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include "kwin-helpers.h"
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
@@ -44,6 +45,10 @@ static XScreenSaverAllocInfoFunc allocSSFunc = nullptr;
|
|||||||
static XScreenSaverQueryInfoFunc querySSFunc = nullptr;
|
static XScreenSaverQueryInfoFunc querySSFunc = nullptr;
|
||||||
bool canGetIdleTime = false;
|
bool canGetIdleTime = false;
|
||||||
|
|
||||||
|
static bool KWin = false;
|
||||||
|
static FocusNotifier notifier;
|
||||||
|
static QString KWinScriptObjectPath;
|
||||||
|
|
||||||
static QLibrary *libprocps = nullptr;
|
static QLibrary *libprocps = nullptr;
|
||||||
#ifdef PROCPS_AVAILABLE
|
#ifdef PROCPS_AVAILABLE
|
||||||
typedef PROCTAB *(*openproc_func)(int flags);
|
typedef PROCTAB *(*openproc_func)(int flags);
|
||||||
@@ -275,6 +280,11 @@ int getActiveWindow(Window *&window)
|
|||||||
|
|
||||||
void GetCurrentWindowTitle(std::string &title)
|
void GetCurrentWindowTitle(std::string &title)
|
||||||
{
|
{
|
||||||
|
if (KWin) {
|
||||||
|
title = FocusNotifier::getActiveWindowTitle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Window *data = 0;
|
Window *data = 0;
|
||||||
if (getActiveWindow(data) != Success || !data) {
|
if (getActiveWindow(data) != Success || !data) {
|
||||||
return;
|
return;
|
||||||
@@ -286,6 +296,7 @@ void GetCurrentWindowTitle(std::string &title)
|
|||||||
|
|
||||||
auto name = getWindowName(data[0]);
|
auto name = getWindowName(data[0]);
|
||||||
XFree(data);
|
XFree(data);
|
||||||
|
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -412,6 +423,10 @@ void GetProcessList(QStringList &processes)
|
|||||||
|
|
||||||
long getForegroundProcessPid()
|
long getForegroundProcessPid()
|
||||||
{
|
{
|
||||||
|
if (KWin) {
|
||||||
|
return FocusNotifier::getActiveWindowPID();
|
||||||
|
}
|
||||||
|
|
||||||
Window *window;
|
Window *window;
|
||||||
if (getActiveWindow(window) != Success || !window || !*window) {
|
if (getActiveWindow(window) != Success || !window || !*window) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -437,6 +452,7 @@ long getForegroundProcessPid()
|
|||||||
|
|
||||||
pid = *((long *)prop);
|
pid = *((long *)prop);
|
||||||
XFree(prop);
|
XFree(prop);
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,6 +578,17 @@ void PlatformInit()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KWin = isKWinAvailable();
|
||||||
|
if (!(KWin && startKWinScript(KWinScriptObjectPath) &&
|
||||||
|
registerKWinDBusListener(¬ifier))) {
|
||||||
|
// something bad happened while trying to initialize
|
||||||
|
// the KWin script/dbus so disable it
|
||||||
|
KWin = false;
|
||||||
|
blog(LOG_INFO, "not using KWin compat");
|
||||||
|
} else {
|
||||||
|
blog(LOG_INFO, "using KWin compat");
|
||||||
|
}
|
||||||
|
|
||||||
initXss();
|
initXss();
|
||||||
initProcps();
|
initProcps();
|
||||||
initProc2();
|
initProc2();
|
||||||
@@ -583,6 +610,8 @@ void PlatformCleanup()
|
|||||||
cleanupHelper(libproc2);
|
cleanupHelper(libproc2);
|
||||||
cleanupDisplay();
|
cleanupDisplay();
|
||||||
XSetErrorHandler(NULL);
|
XSetErrorHandler(NULL);
|
||||||
|
if (KWin && !KWinScriptObjectPath.isEmpty())
|
||||||
|
stopKWinScript(KWinScriptObjectPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
166
lib/linux/kwin-helpers.cpp
Normal file
166
lib/linux/kwin-helpers.cpp
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
#include "kwin-helpers.h"
|
||||||
|
|
||||||
|
#include "log-helper.hpp"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileDevice>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QtDBus/QDBusConnectionInterface>
|
||||||
|
#include <QtDBus/QDBusInterface>
|
||||||
|
#include <QtDBus/QDBusReply>
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
int FocusNotifier::activePID = -1;
|
||||||
|
std::string FocusNotifier::activeTitle = {};
|
||||||
|
|
||||||
|
int FocusNotifier::getActiveWindowPID()
|
||||||
|
{
|
||||||
|
return activePID;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string FocusNotifier::getActiveWindowTitle()
|
||||||
|
{
|
||||||
|
return activeTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FocusNotifier::focusChanged(const int pid)
|
||||||
|
{
|
||||||
|
activePID = pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FocusNotifier::focusTitle(const QString &title)
|
||||||
|
{
|
||||||
|
activeTitle = title.toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isKWinAvailable()
|
||||||
|
{
|
||||||
|
const QDBusConnectionInterface *interface =
|
||||||
|
QDBusConnection::sessionBus().interface();
|
||||||
|
if (!interface)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const QStringList services =
|
||||||
|
interface->registeredServiceNames().value();
|
||||||
|
return services.contains("org.kde.KWin");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool startKWinScript(QString &scriptObjectPath)
|
||||||
|
{
|
||||||
|
const QString scriptPath =
|
||||||
|
"/tmp/AdvancedSceneSwitcher/KWinFocusNotifier.js";
|
||||||
|
|
||||||
|
const QString script =
|
||||||
|
R"(workspace.windowActivated.connect(function(client) {
|
||||||
|
if (!client) return;
|
||||||
|
if (!client.pid) return;
|
||||||
|
if (!client.caption) return;
|
||||||
|
|
||||||
|
callDBus(
|
||||||
|
"com.github.AdvancedSceneSwitcher",
|
||||||
|
"/com/github/AdvancedSceneSwitcher",
|
||||||
|
"com.github.AdvancedSceneSwitcher",
|
||||||
|
"focusChanged",
|
||||||
|
client.pid
|
||||||
|
);
|
||||||
|
callDBus(
|
||||||
|
"com.github.AdvancedSceneSwitcher",
|
||||||
|
"/com/github/AdvancedSceneSwitcher",
|
||||||
|
"com.github.AdvancedSceneSwitcher",
|
||||||
|
"focusTitle",
|
||||||
|
client.caption
|
||||||
|
);
|
||||||
|
}))";
|
||||||
|
|
||||||
|
if (const QDir dir; !dir.mkpath(QFileInfo(scriptPath).absolutePath())) {
|
||||||
|
blog(LOG_ERROR, "error creating /tmp/AdvancedSceneSwitcher");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile scriptFile(scriptPath);
|
||||||
|
if (!scriptFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
blog(LOG_ERROR,
|
||||||
|
"error opening KWinFocusNotifier.js for writing");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
scriptFile.setPermissions(QFileDevice::ReadOwner |
|
||||||
|
QFileDevice::WriteOwner);
|
||||||
|
QTextStream outputStream(&scriptFile);
|
||||||
|
outputStream << script;
|
||||||
|
scriptFile.close();
|
||||||
|
|
||||||
|
const QDBusConnection bus = QDBusConnection::sessionBus();
|
||||||
|
|
||||||
|
QDBusInterface scriptingIface("org.kde.KWin", "/Scripting",
|
||||||
|
"org.kde.kwin.Scripting", bus);
|
||||||
|
if (!scriptingIface.isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusReply<bool> scriptRunningReply =
|
||||||
|
scriptingIface.call("isScriptLoaded", scriptPath);
|
||||||
|
if (scriptRunningReply.isValid() && scriptRunningReply.value()) {
|
||||||
|
// script already registered and running, don't do it again
|
||||||
|
// this will leave the script running since we do not have
|
||||||
|
// a valid script id anymore, but at the very least this prevents
|
||||||
|
// it from running multiple times
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusReply<int> scriptIdReply =
|
||||||
|
scriptingIface.call("loadScript", scriptPath);
|
||||||
|
if (!scriptIdReply.isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int scriptId = scriptIdReply.value();
|
||||||
|
scriptObjectPath =
|
||||||
|
QString("/Scripting/Script%1").arg(QString::number(scriptId));
|
||||||
|
|
||||||
|
QDBusInterface scriptRunner("org.kde.KWin", scriptObjectPath,
|
||||||
|
"org.kde.kwin.Script", bus);
|
||||||
|
if (!scriptRunner.isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusReply<void> runReply = scriptRunner.call("run");
|
||||||
|
return runReply.isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool stopKWinScript(const QString &scriptObjectPath)
|
||||||
|
{
|
||||||
|
QDBusInterface scriptRunner("org.kde.KWin", scriptObjectPath,
|
||||||
|
"org.kde.kwin.Script",
|
||||||
|
QDBusConnection::sessionBus());
|
||||||
|
if (!scriptRunner.isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const QDBusReply<void> stopReply = scriptRunner.call("stop");
|
||||||
|
return stopReply.isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool registerKWinDBusListener(FocusNotifier *notifier)
|
||||||
|
{
|
||||||
|
static const QString serviceName = "com.github.AdvancedSceneSwitcher";
|
||||||
|
static const QString objectPath = "/com/github/AdvancedSceneSwitcher";
|
||||||
|
auto bus = QDBusConnection::sessionBus();
|
||||||
|
|
||||||
|
if (bus.objectRegisteredAt(objectPath)) {
|
||||||
|
// already registered?
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bus.registerService(serviceName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bus.registerObject(objectPath, notifier,
|
||||||
|
QDBusConnection::ExportAllSlots)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} // namespace advss
|
||||||
33
lib/linux/kwin-helpers.h
Normal file
33
lib/linux/kwin-helpers.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
class FocusNotifier final : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_CLASSINFO("D-Bus Interface", "com.github.AdvancedSceneSwitcher")
|
||||||
|
|
||||||
|
static int activePID;
|
||||||
|
static std::string activeTitle;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using QObject::QObject;
|
||||||
|
|
||||||
|
static int getActiveWindowPID();
|
||||||
|
static std::string getActiveWindowTitle();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void focusChanged(const int pid);
|
||||||
|
void focusTitle(const QString &title);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool isKWinAvailable();
|
||||||
|
bool startKWinScript(QString &scriptObjectPath);
|
||||||
|
bool stopKWinScript(const QString &scriptObjectPath);
|
||||||
|
bool registerKWinDBusListener(FocusNotifier *notifier);
|
||||||
|
void printDBusError();
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
@@ -158,473 +158,4 @@ std::shared_ptr<MacroSegment> MacroActionEdit::Data() const
|
|||||||
return *_entryData;
|
return *_entryData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::AddMacroAction(Macro *macro, int idx,
|
|
||||||
const std::string &id, obs_data_t *data)
|
|
||||||
{
|
|
||||||
if (idx < 0 || idx > (int)macro->Actions().size()) {
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
macro->Actions().emplace(macro->Actions().begin() + idx,
|
|
||||||
MacroActionFactory::Create(id, macro));
|
|
||||||
if (data) {
|
|
||||||
macro->Actions().at(idx)->Load(data);
|
|
||||||
}
|
|
||||||
macro->Actions().at(idx)->PostLoad();
|
|
||||||
RunPostLoadSteps();
|
|
||||||
macro->UpdateActionIndices();
|
|
||||||
ui->actionsList->Insert(
|
|
||||||
idx,
|
|
||||||
new MacroActionEdit(this, ¯o->Actions()[idx], id));
|
|
||||||
SetActionData(*macro);
|
|
||||||
}
|
|
||||||
HighlightAction(idx);
|
|
||||||
ui->actionsList->SetHelpMsgVisible(false);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::AddMacroAction(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx > (int)macro->Actions().size()) {
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string id;
|
|
||||||
if (idx - 1 >= 0) {
|
|
||||||
id = macro->Actions().at(idx - 1)->GetId();
|
|
||||||
} else {
|
|
||||||
id = MacroAction::GetDefaultID();
|
|
||||||
}
|
|
||||||
|
|
||||||
OBSDataAutoRelease data;
|
|
||||||
if (idx - 1 >= 0) {
|
|
||||||
data = obs_data_create();
|
|
||||||
macro->Actions().at(idx - 1)->Save(data);
|
|
||||||
}
|
|
||||||
AddMacroAction(macro.get(), idx, id, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionAdd_clicked()
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentActionIdx == -1) {
|
|
||||||
AddMacroAction((int)macro->Actions().size());
|
|
||||||
} else {
|
|
||||||
AddMacroAction(currentActionIdx + 1);
|
|
||||||
}
|
|
||||||
if (currentActionIdx != -1) {
|
|
||||||
MacroActionSelectionChanged(currentActionIdx + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::RemoveMacroAction(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx >= (int)macro->Actions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
ui->actionsList->Remove(idx);
|
|
||||||
macro->Actions().erase(macro->Actions().begin() + idx);
|
|
||||||
SetMacroAbortWait(true);
|
|
||||||
GetMacroWaitCV().notify_all();
|
|
||||||
macro->UpdateActionIndices();
|
|
||||||
SetActionData(*macro);
|
|
||||||
}
|
|
||||||
MacroActionSelectionChanged(-1);
|
|
||||||
lastInteracted = MacroSection::ACTIONS;
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionRemove_clicked()
|
|
||||||
{
|
|
||||||
if (currentActionIdx == -1) {
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RemoveMacroAction((int)macro->Actions().size() - 1);
|
|
||||||
} else {
|
|
||||||
RemoveMacroAction(currentActionIdx);
|
|
||||||
}
|
|
||||||
MacroActionSelectionChanged(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionTop_clicked()
|
|
||||||
{
|
|
||||||
if (currentActionIdx == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MacroActionReorder(0, currentActionIdx);
|
|
||||||
MacroActionSelectionChanged(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionUp_clicked()
|
|
||||||
{
|
|
||||||
if (currentActionIdx == -1 || currentActionIdx == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveMacroActionUp(currentActionIdx);
|
|
||||||
MacroActionSelectionChanged(currentActionIdx - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionDown_clicked()
|
|
||||||
{
|
|
||||||
if (currentActionIdx == -1 ||
|
|
||||||
currentActionIdx == ui->actionsList->ContentLayout()->count() - 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveMacroActionDown(currentActionIdx);
|
|
||||||
MacroActionSelectionChanged(currentActionIdx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionBottom_clicked()
|
|
||||||
{
|
|
||||||
if (currentActionIdx == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const int newIdx = ui->actionsList->ContentLayout()->count() - 1;
|
|
||||||
MacroActionReorder(newIdx, currentActionIdx);
|
|
||||||
MacroActionSelectionChanged(newIdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_elseActionAdd_clicked()
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentElseActionIdx == -1) {
|
|
||||||
AddMacroElseAction((int)macro->ElseActions().size());
|
|
||||||
} else {
|
|
||||||
AddMacroElseAction(currentElseActionIdx + 1);
|
|
||||||
}
|
|
||||||
if (currentElseActionIdx != -1) {
|
|
||||||
MacroElseActionSelectionChanged(currentElseActionIdx + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_elseActionRemove_clicked()
|
|
||||||
{
|
|
||||||
if (currentElseActionIdx == -1) {
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RemoveMacroElseAction((int)macro->ElseActions().size() - 1);
|
|
||||||
} else {
|
|
||||||
RemoveMacroElseAction(currentElseActionIdx);
|
|
||||||
}
|
|
||||||
MacroElseActionSelectionChanged(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_elseActionTop_clicked()
|
|
||||||
{
|
|
||||||
if (currentElseActionIdx == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MacroElseActionReorder(0, currentElseActionIdx);
|
|
||||||
MacroElseActionSelectionChanged(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_elseActionUp_clicked()
|
|
||||||
{
|
|
||||||
if (currentElseActionIdx == -1 || currentElseActionIdx == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveMacroElseActionUp(currentElseActionIdx);
|
|
||||||
MacroElseActionSelectionChanged(currentElseActionIdx - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_elseActionDown_clicked()
|
|
||||||
{
|
|
||||||
if (currentElseActionIdx == -1 ||
|
|
||||||
currentElseActionIdx ==
|
|
||||||
ui->elseActionsList->ContentLayout()->count() - 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveMacroElseActionDown(currentElseActionIdx);
|
|
||||||
MacroElseActionSelectionChanged(currentElseActionIdx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_elseActionBottom_clicked()
|
|
||||||
{
|
|
||||||
if (currentElseActionIdx == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const int newIdx = ui->elseActionsList->ContentLayout()->count() - 1;
|
|
||||||
MacroElseActionReorder(newIdx, currentElseActionIdx);
|
|
||||||
MacroElseActionSelectionChanged(newIdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::SwapActions(Macro *m, int pos1, int pos2)
|
|
||||||
{
|
|
||||||
if (pos1 == pos2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pos1 > pos2) {
|
|
||||||
std::swap(pos1, pos2);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
iter_swap(m->Actions().begin() + pos1, m->Actions().begin() + pos2);
|
|
||||||
m->UpdateActionIndices();
|
|
||||||
auto widget1 = static_cast<MacroActionEdit *>(
|
|
||||||
ui->actionsList->ContentLayout()->takeAt(pos1)->widget());
|
|
||||||
auto widget2 = static_cast<MacroActionEdit *>(
|
|
||||||
ui->actionsList->ContentLayout()->takeAt(pos2 - 1)->widget());
|
|
||||||
ui->actionsList->Insert(pos1, widget2);
|
|
||||||
ui->actionsList->Insert(pos2, widget1);
|
|
||||||
SetActionData(*m);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MoveMacroActionUp(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 1 || idx >= (int)macro->Actions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SwapActions(macro.get(), idx, idx - 1);
|
|
||||||
HighlightAction(idx - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MoveMacroActionDown(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx >= (int)macro->Actions().size() - 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SwapActions(macro.get(), idx, idx + 1);
|
|
||||||
HighlightAction(idx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroElseActionSelectionChanged(int idx)
|
|
||||||
{
|
|
||||||
SetupMacroSegmentSelection(MacroSection::ELSE_ACTIONS, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroElseActionReorder(int to, int from)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (to == from || from < 0 || from > (int)macro->ElseActions().size() ||
|
|
||||||
to < 0 || to > (int)macro->ElseActions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
auto action = macro->ElseActions().at(from);
|
|
||||||
macro->ElseActions().erase(macro->ElseActions().begin() + from);
|
|
||||||
macro->ElseActions().insert(macro->ElseActions().begin() + to,
|
|
||||||
action);
|
|
||||||
macro->UpdateElseActionIndices();
|
|
||||||
ui->elseActionsList->ContentLayout()->insertItem(
|
|
||||||
to, ui->elseActionsList->ContentLayout()->takeAt(from));
|
|
||||||
SetElseActionData(*macro);
|
|
||||||
}
|
|
||||||
HighlightElseAction(to);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::AddMacroElseAction(Macro *macro, int idx,
|
|
||||||
const std::string &id,
|
|
||||||
obs_data_t *data)
|
|
||||||
{
|
|
||||||
if (idx < 0 || idx > (int)macro->ElseActions().size()) {
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
macro->ElseActions().emplace(macro->ElseActions().begin() + idx,
|
|
||||||
MacroActionFactory::Create(id,
|
|
||||||
macro));
|
|
||||||
if (data) {
|
|
||||||
macro->ElseActions().at(idx)->Load(data);
|
|
||||||
}
|
|
||||||
macro->ElseActions().at(idx)->PostLoad();
|
|
||||||
RunPostLoadSteps();
|
|
||||||
macro->UpdateElseActionIndices();
|
|
||||||
ui->elseActionsList->Insert(
|
|
||||||
idx, new MacroActionEdit(
|
|
||||||
this, ¯o->ElseActions()[idx], id));
|
|
||||||
SetElseActionData(*macro);
|
|
||||||
}
|
|
||||||
HighlightElseAction(idx);
|
|
||||||
ui->elseActionsList->SetHelpMsgVisible(false);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::AddMacroElseAction(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx > (int)macro->ElseActions().size()) {
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string id;
|
|
||||||
if (idx - 1 >= 0) {
|
|
||||||
id = macro->ElseActions().at(idx - 1)->GetId();
|
|
||||||
} else {
|
|
||||||
id = MacroAction::GetDefaultID();
|
|
||||||
}
|
|
||||||
|
|
||||||
OBSDataAutoRelease data;
|
|
||||||
if (idx - 1 >= 0) {
|
|
||||||
data = obs_data_create();
|
|
||||||
macro->ElseActions().at(idx - 1)->Save(data);
|
|
||||||
}
|
|
||||||
AddMacroElseAction(macro.get(), idx, id, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::RemoveMacroElseAction(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx >= (int)macro->ElseActions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
ui->elseActionsList->Remove(idx);
|
|
||||||
macro->ElseActions().erase(macro->ElseActions().begin() + idx);
|
|
||||||
SetMacroAbortWait(true);
|
|
||||||
GetMacroWaitCV().notify_all();
|
|
||||||
macro->UpdateElseActionIndices();
|
|
||||||
SetElseActionData(*macro);
|
|
||||||
}
|
|
||||||
MacroElseActionSelectionChanged(-1);
|
|
||||||
lastInteracted = MacroSection::ELSE_ACTIONS;
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::SwapElseActions(Macro *m, int pos1, int pos2)
|
|
||||||
{
|
|
||||||
if (pos1 == pos2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pos1 > pos2) {
|
|
||||||
std::swap(pos1, pos2);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
iter_swap(m->ElseActions().begin() + pos1,
|
|
||||||
m->ElseActions().begin() + pos2);
|
|
||||||
m->UpdateElseActionIndices();
|
|
||||||
auto widget1 = static_cast<MacroActionEdit *>(
|
|
||||||
ui->elseActionsList->ContentLayout()->takeAt(pos1)->widget());
|
|
||||||
auto widget2 = static_cast<MacroActionEdit *>(
|
|
||||||
ui->elseActionsList->ContentLayout()
|
|
||||||
->takeAt(pos2 - 1)
|
|
||||||
->widget());
|
|
||||||
ui->elseActionsList->Insert(pos1, widget2);
|
|
||||||
ui->elseActionsList->Insert(pos2, widget1);
|
|
||||||
SetElseActionData(*m);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MoveMacroElseActionUp(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 1 || idx >= (int)macro->ElseActions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SwapElseActions(macro.get(), idx, idx - 1);
|
|
||||||
HighlightElseAction(idx - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MoveMacroElseActionDown(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx >= (int)macro->ElseActions().size() - 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SwapElseActions(macro.get(), idx, idx + 1);
|
|
||||||
HighlightElseAction(idx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroActionSelectionChanged(int idx)
|
|
||||||
{
|
|
||||||
SetupMacroSegmentSelection(MacroSection::ACTIONS, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroActionReorder(int to, int from)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (to == from || from < 0 || from > (int)macro->Actions().size() ||
|
|
||||||
to < 0 || to > (int)macro->Actions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
auto action = macro->Actions().at(from);
|
|
||||||
macro->Actions().erase(macro->Actions().begin() + from);
|
|
||||||
macro->Actions().insert(macro->Actions().begin() + to, action);
|
|
||||||
macro->UpdateActionIndices();
|
|
||||||
ui->actionsList->ContentLayout()->insertItem(
|
|
||||||
to, ui->actionsList->ContentLayout()->takeAt(from));
|
|
||||||
SetActionData(*macro);
|
|
||||||
}
|
|
||||||
HighlightAction(to);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ bool MacroActionMacro::_registered = MacroActionFactory::Register(
|
|||||||
|
|
||||||
bool MacroActionMacro::PerformAction()
|
bool MacroActionMacro::PerformAction()
|
||||||
{
|
{
|
||||||
|
if (_action == Action::NESTED_MACRO) {
|
||||||
|
const bool conditionsMatched = _nestedMacro->CheckConditions();
|
||||||
|
return _nestedMacro->PerformActions(conditionsMatched);
|
||||||
|
}
|
||||||
|
|
||||||
auto macro = _macro.GetMacro();
|
auto macro = _macro.GetMacro();
|
||||||
if (!macro) {
|
if (!macro) {
|
||||||
return true;
|
return true;
|
||||||
@@ -32,7 +37,7 @@ bool MacroActionMacro::PerformAction()
|
|||||||
case Action::RESET_COUNTER:
|
case Action::RESET_COUNTER:
|
||||||
macro->ResetRunCount();
|
macro->ResetRunCount();
|
||||||
break;
|
break;
|
||||||
case Action::RUN:
|
case Action::RUN_ACTIONS:
|
||||||
RunActions(macro.get());
|
RunActions(macro.get());
|
||||||
break;
|
break;
|
||||||
case Action::STOP:
|
case Action::STOP:
|
||||||
@@ -80,7 +85,7 @@ void MacroActionMacro::LogAction() const
|
|||||||
ablog(LOG_INFO, "reset counter for \"%s\"",
|
ablog(LOG_INFO, "reset counter for \"%s\"",
|
||||||
macro->Name().c_str());
|
macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
case Action::RUN:
|
case Action::RUN_ACTIONS:
|
||||||
ablog(LOG_INFO, "run nested macro \"%s\"",
|
ablog(LOG_INFO, "run nested macro \"%s\"",
|
||||||
macro->Name().c_str());
|
macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
@@ -99,6 +104,9 @@ void MacroActionMacro::LogAction() const
|
|||||||
ablog(LOG_INFO, "toggled action %d of macro \"%s\"",
|
ablog(LOG_INFO, "toggled action %d of macro \"%s\"",
|
||||||
_actionIndex.GetValue(), macro->Name().c_str());
|
_actionIndex.GetValue(), macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
|
case Action::NESTED_MACRO:
|
||||||
|
ablog(LOG_INFO, "run nested macro");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -111,6 +119,10 @@ bool MacroActionMacro::Save(obs_data_t *obj) const
|
|||||||
_actionIndex.Save(obj, "actionIndex");
|
_actionIndex.Save(obj, "actionIndex");
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
_runOptions.Save(obj);
|
_runOptions.Save(obj);
|
||||||
|
OBSDataAutoRelease nestedMacroData = obs_data_create();
|
||||||
|
_nestedMacro->Save(nestedMacroData);
|
||||||
|
obs_data_set_obj(obj, "nestedMacro", nestedMacroData);
|
||||||
|
obs_data_set_int(obj, "customWidgetHeight", _customWidgetHeight);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +134,16 @@ bool MacroActionMacro::Load(obs_data_t *obj)
|
|||||||
_action = static_cast<MacroActionMacro::Action>(
|
_action = static_cast<MacroActionMacro::Action>(
|
||||||
obs_data_get_int(obj, "action"));
|
obs_data_get_int(obj, "action"));
|
||||||
_runOptions.Load(obj);
|
_runOptions.Load(obj);
|
||||||
|
|
||||||
|
if (obs_data_has_user_value(obj, "nestedMacro")) {
|
||||||
|
OBSDataAutoRelease nestedMacroData =
|
||||||
|
obs_data_get_obj(obj, "nestedMacro");
|
||||||
|
_nestedMacro->Load(nestedMacroData);
|
||||||
|
_nestedMacro->PostLoad();
|
||||||
|
}
|
||||||
|
|
||||||
|
_customWidgetHeight = obs_data_get_int(obj, "customWidgetHeight");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +226,9 @@ static void populateActionSelection(QComboBox *list)
|
|||||||
"AdvSceneSwitcher.action.macro.type.togglePause"},
|
"AdvSceneSwitcher.action.macro.type.togglePause"},
|
||||||
{MacroActionMacro::Action::RESET_COUNTER,
|
{MacroActionMacro::Action::RESET_COUNTER,
|
||||||
"AdvSceneSwitcher.action.macro.type.resetCounter"},
|
"AdvSceneSwitcher.action.macro.type.resetCounter"},
|
||||||
{MacroActionMacro::Action::RUN,
|
{MacroActionMacro::Action::NESTED_MACRO,
|
||||||
|
"AdvSceneSwitcher.action.macro.type.nestedMacro"},
|
||||||
|
{MacroActionMacro::Action::RUN_ACTIONS,
|
||||||
"AdvSceneSwitcher.action.macro.type.run"},
|
"AdvSceneSwitcher.action.macro.type.run"},
|
||||||
{MacroActionMacro::Action::STOP,
|
{MacroActionMacro::Action::STOP,
|
||||||
"AdvSceneSwitcher.action.macro.type.stop"},
|
"AdvSceneSwitcher.action.macro.type.stop"},
|
||||||
@@ -242,7 +266,7 @@ static void populateActionTypeSelection(QComboBox *list)
|
|||||||
|
|
||||||
MacroActionMacroEdit::MacroActionMacroEdit(
|
MacroActionMacroEdit::MacroActionMacroEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionMacro> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionMacro> entryData)
|
||||||
: QWidget(parent),
|
: ResizableWidget(parent),
|
||||||
_macros(new MacroSelection(parent)),
|
_macros(new MacroSelection(parent)),
|
||||||
_actionIndex(new MacroSegmentSelection(
|
_actionIndex(new MacroSegmentSelection(
|
||||||
this, MacroSegmentSelection::Type::ACTION)),
|
this, MacroSegmentSelection::Type::ACTION)),
|
||||||
@@ -261,7 +285,13 @@ MacroActionMacroEdit::MacroActionMacroEdit(
|
|||||||
_entryLayout(new QHBoxLayout()),
|
_entryLayout(new QHBoxLayout()),
|
||||||
_conditionLayout(new QHBoxLayout()),
|
_conditionLayout(new QHBoxLayout()),
|
||||||
_reevaluateConditionStateLayout(new QHBoxLayout()),
|
_reevaluateConditionStateLayout(new QHBoxLayout()),
|
||||||
_setInputsLayout(new QHBoxLayout())
|
_setInputsLayout(new QHBoxLayout()),
|
||||||
|
_nestedMacro(new MacroEdit(
|
||||||
|
this,
|
||||||
|
QStringList()
|
||||||
|
<< "AdvSceneSwitcher.action.macro.type.nestedMacro.conditionHelp"
|
||||||
|
<< "AdvSceneSwitcher.action.macro.type.nestedMacro.actionHelp"
|
||||||
|
<< "AdvSceneSwitcher.action.macro.type.nestedMacro.elseActionHelp"))
|
||||||
{
|
{
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
populateConditionBehaviorSelection(_conditionBehaviors);
|
populateConditionBehaviorSelection(_conditionBehaviors);
|
||||||
@@ -310,6 +340,7 @@ MacroActionMacroEdit::MacroActionMacroEdit(
|
|||||||
layout->addLayout(_setInputsLayout);
|
layout->addLayout(_setInputsLayout);
|
||||||
layout->addWidget(_inputs);
|
layout->addWidget(_inputs);
|
||||||
layout->addWidget(_skipWhenPaused);
|
layout->addWidget(_skipWhenPaused);
|
||||||
|
layout->addWidget(_nestedMacro);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
UpdateEntryData();
|
UpdateEntryData();
|
||||||
@@ -321,6 +352,12 @@ void HighlightMacroSettingsButton(bool enable);
|
|||||||
MacroActionMacroEdit::~MacroActionMacroEdit()
|
MacroActionMacroEdit::~MacroActionMacroEdit()
|
||||||
{
|
{
|
||||||
HighlightMacroSettingsButton(false);
|
HighlightMacroSettingsButton(false);
|
||||||
|
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_entryData->_customWidgetHeight = GetCustomHeight();
|
||||||
|
_nestedMacro->SetMacro({}); // Save splitter states
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMacroEdit::UpdateEntryData()
|
void MacroActionMacroEdit::UpdateEntryData()
|
||||||
@@ -343,9 +380,20 @@ void MacroActionMacroEdit::UpdateEntryData()
|
|||||||
_skipWhenPaused->setChecked(_entryData->_runOptions.skipWhenPaused);
|
_skipWhenPaused->setChecked(_entryData->_runOptions.skipWhenPaused);
|
||||||
_setInputs->setChecked(_entryData->_runOptions.setInputs);
|
_setInputs->setChecked(_entryData->_runOptions.setInputs);
|
||||||
SetupMacroInput(_entryData->_macro.GetMacro().get());
|
SetupMacroInput(_entryData->_macro.GetMacro().get());
|
||||||
|
|
||||||
|
const auto ¯o = _entryData->_nestedMacro;
|
||||||
|
_nestedMacro->SetMacro(macro);
|
||||||
|
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *MacroActionMacroEdit::Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroAction> action)
|
||||||
|
{
|
||||||
|
return new MacroActionMacroEdit(
|
||||||
|
parent, std::dynamic_pointer_cast<MacroActionMacro>(action));
|
||||||
|
}
|
||||||
|
|
||||||
void MacroActionMacroEdit::MacroChanged(const QString &text)
|
void MacroActionMacroEdit::MacroChanged(const QString &text)
|
||||||
{
|
{
|
||||||
GUARD_LOADING_AND_LOCK();
|
GUARD_LOADING_AND_LOCK();
|
||||||
@@ -444,7 +492,8 @@ void MacroActionMacroEdit::SetWidgetVisibility()
|
|||||||
|
|
||||||
PlaceWidgets(
|
PlaceWidgets(
|
||||||
obs_module_text(
|
obs_module_text(
|
||||||
_entryData->_action == MacroActionMacro::Action::RUN
|
_entryData->_action ==
|
||||||
|
MacroActionMacro::Action::RUN_ACTIONS
|
||||||
? "AdvSceneSwitcher.action.macro.entry.run"
|
? "AdvSceneSwitcher.action.macro.entry.run"
|
||||||
: "AdvSceneSwitcher.action.macro.entry.other"),
|
: "AdvSceneSwitcher.action.macro.entry.other"),
|
||||||
_entryLayout, placeholders);
|
_entryLayout, placeholders);
|
||||||
@@ -460,7 +509,7 @@ void MacroActionMacroEdit::SetWidgetVisibility()
|
|||||||
_conditionLayout, placeholders);
|
_conditionLayout, placeholders);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entryData->_action == MacroActionMacro::Action::RUN ||
|
if (_entryData->_action == MacroActionMacro::Action::RUN_ACTIONS ||
|
||||||
_entryData->_action == MacroActionMacro::Action::STOP) {
|
_entryData->_action == MacroActionMacro::Action::STOP) {
|
||||||
_macros->HideSelectedMacro();
|
_macros->HideSelectedMacro();
|
||||||
} else {
|
} else {
|
||||||
@@ -476,27 +525,43 @@ void MacroActionMacroEdit::SetWidgetVisibility()
|
|||||||
_actionIndex->setVisible(isModifyingActionState);
|
_actionIndex->setVisible(isModifyingActionState);
|
||||||
|
|
||||||
SetLayoutVisible(_conditionLayout,
|
SetLayoutVisible(_conditionLayout,
|
||||||
_entryData->_action == MacroActionMacro::Action::RUN);
|
_entryData->_action ==
|
||||||
|
MacroActionMacro::Action::RUN_ACTIONS);
|
||||||
const bool needsAdditionalConditionWidgets =
|
const bool needsAdditionalConditionWidgets =
|
||||||
_entryData->_action == MacroActionMacro::Action::RUN &&
|
_entryData->_action == MacroActionMacro::Action::RUN_ACTIONS &&
|
||||||
_entryData->_runOptions.logic !=
|
_entryData->_runOptions.logic !=
|
||||||
MacroActionMacro::RunOptions::Logic::IGNORE_CONDITIONS;
|
MacroActionMacro::RunOptions::Logic::IGNORE_CONDITIONS;
|
||||||
_conditionMacros->setVisible(needsAdditionalConditionWidgets);
|
_conditionMacros->setVisible(needsAdditionalConditionWidgets);
|
||||||
SetLayoutVisible(_reevaluateConditionStateLayout,
|
SetLayoutVisible(_reevaluateConditionStateLayout,
|
||||||
needsAdditionalConditionWidgets);
|
needsAdditionalConditionWidgets);
|
||||||
SetLayoutVisible(_setInputsLayout,
|
SetLayoutVisible(_setInputsLayout,
|
||||||
_entryData->_action == MacroActionMacro::Action::RUN);
|
_entryData->_action ==
|
||||||
|
MacroActionMacro::Action::RUN_ACTIONS);
|
||||||
_inputs->setVisible(_entryData->_action ==
|
_inputs->setVisible(_entryData->_action ==
|
||||||
MacroActionMacro::Action::RUN &&
|
MacroActionMacro::Action::RUN_ACTIONS &&
|
||||||
_entryData->_runOptions.setInputs);
|
_entryData->_runOptions.setInputs);
|
||||||
HighlightMacroSettingsButton(_entryData->_action ==
|
HighlightMacroSettingsButton(
|
||||||
MacroActionMacro::Action::RUN &&
|
_entryData->_action == MacroActionMacro::Action::RUN_ACTIONS &&
|
||||||
_entryData->_runOptions.setInputs &&
|
_entryData->_runOptions.setInputs &&
|
||||||
!_inputs->HasInputsToSet());
|
!_inputs->HasInputsToSet());
|
||||||
_actionTypes->setVisible(_entryData->_action ==
|
_actionTypes->setVisible(_entryData->_action ==
|
||||||
MacroActionMacro::Action::RUN);
|
MacroActionMacro::Action::RUN_ACTIONS);
|
||||||
_skipWhenPaused->setVisible(_entryData->_action ==
|
_skipWhenPaused->setVisible(_entryData->_action ==
|
||||||
MacroActionMacro::Action::RUN);
|
MacroActionMacro::Action::RUN_ACTIONS);
|
||||||
|
|
||||||
|
_nestedMacro->setVisible(_entryData->_action ==
|
||||||
|
MacroActionMacro::Action::NESTED_MACRO);
|
||||||
|
_macros->setVisible(_entryData->_action !=
|
||||||
|
MacroActionMacro::Action::NESTED_MACRO);
|
||||||
|
SetResizingEnabled(_entryData->_action ==
|
||||||
|
MacroActionMacro::Action::NESTED_MACRO);
|
||||||
|
|
||||||
|
if (_nestedMacro->IsEmpty()) {
|
||||||
|
_nestedMacro->ShowAllMacroSections();
|
||||||
|
// TODO: find a better solution than setting a fixed height
|
||||||
|
_entryData->_customWidgetHeight = 600;
|
||||||
|
}
|
||||||
|
SetCustomHeight(_entryData->_customWidgetHeight);
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
|
#include "macro.hpp"
|
||||||
|
#include "macro-edit.hpp"
|
||||||
#include "macro-input.hpp"
|
#include "macro-input.hpp"
|
||||||
#include "macro-selection.hpp"
|
#include "macro-selection.hpp"
|
||||||
#include "macro-segment-selection.hpp"
|
#include "macro-segment-selection.hpp"
|
||||||
|
#include "resizable-widget.hpp"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -44,16 +47,19 @@ public:
|
|||||||
PAUSE,
|
PAUSE,
|
||||||
UNPAUSE,
|
UNPAUSE,
|
||||||
RESET_COUNTER,
|
RESET_COUNTER,
|
||||||
RUN,
|
RUN_ACTIONS,
|
||||||
STOP,
|
STOP,
|
||||||
DISABLE_ACTION,
|
DISABLE_ACTION,
|
||||||
ENABLE_ACTION,
|
ENABLE_ACTION,
|
||||||
TOGGLE_ACTION,
|
TOGGLE_ACTION,
|
||||||
TOGGLE_PAUSE,
|
TOGGLE_PAUSE,
|
||||||
|
NESTED_MACRO,
|
||||||
};
|
};
|
||||||
Action _action = Action::RUN;
|
Action _action = Action::NESTED_MACRO;
|
||||||
IntVariable _actionIndex = 1;
|
IntVariable _actionIndex = 1;
|
||||||
RunOptions _runOptions = {};
|
RunOptions _runOptions = {};
|
||||||
|
std::shared_ptr<Macro> _nestedMacro = std::make_shared<Macro>();
|
||||||
|
int _customWidgetHeight = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RunActions(Macro *actionMacro) const;
|
void RunActions(Macro *actionMacro) const;
|
||||||
@@ -62,7 +68,7 @@ private:
|
|||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroActionMacroEdit final : public QWidget {
|
class MacroActionMacroEdit final : public ResizableWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -71,13 +77,7 @@ public:
|
|||||||
std::shared_ptr<MacroActionMacro> entryData = nullptr);
|
std::shared_ptr<MacroActionMacro> entryData = nullptr);
|
||||||
~MacroActionMacroEdit();
|
~MacroActionMacroEdit();
|
||||||
void UpdateEntryData();
|
void UpdateEntryData();
|
||||||
static QWidget *Create(QWidget *parent,
|
static QWidget *Create(QWidget *, std::shared_ptr<MacroAction>);
|
||||||
std::shared_ptr<MacroAction> action)
|
|
||||||
{
|
|
||||||
return new MacroActionMacroEdit(
|
|
||||||
parent,
|
|
||||||
std::dynamic_pointer_cast<MacroActionMacro>(action));
|
|
||||||
}
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void MacroChanged(const QString &text);
|
void MacroChanged(const QString &text);
|
||||||
@@ -112,6 +112,7 @@ private:
|
|||||||
QHBoxLayout *_conditionLayout;
|
QHBoxLayout *_conditionLayout;
|
||||||
QHBoxLayout *_reevaluateConditionStateLayout;
|
QHBoxLayout *_reevaluateConditionStateLayout;
|
||||||
QHBoxLayout *_setInputsLayout;
|
QHBoxLayout *_setInputsLayout;
|
||||||
|
MacroEdit *_nestedMacro;
|
||||||
|
|
||||||
std::shared_ptr<MacroActionMacro> _entryData;
|
std::shared_ptr<MacroActionMacro> _entryData;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
|
|||||||
@@ -170,11 +170,7 @@ void MacroActionQueueEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionQueueEdit::MacroChanged(const QString &text)
|
void MacroActionQueueEdit::MacroChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macro = text;
|
_entryData->_macro = text;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -182,11 +178,7 @@ void MacroActionQueueEdit::MacroChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroActionQueueEdit::QueueChanged(const QString &text)
|
void MacroActionQueueEdit::QueueChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_queue = GetWeakActionQueueByQString(text);
|
_entryData->_queue = GetWeakActionQueueByQString(text);
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -194,11 +186,7 @@ void MacroActionQueueEdit::QueueChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroActionQueueEdit::ActionChanged(int value)
|
void MacroActionQueueEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionQueue::Action>(value);
|
_entryData->_action = static_cast<MacroActionQueue::Action>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
|
|||||||
@@ -884,7 +884,8 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
QWidget::connect(_segmentIdx,
|
QWidget::connect(_segmentIdx,
|
||||||
SIGNAL(SelectionChanged(const IntVariable &)), this,
|
SIGNAL(SelectionChanged(const IntVariable &)), this,
|
||||||
SLOT(SegmentIndexChanged(const IntVariable &)));
|
SLOT(SegmentIndexChanged(const IntVariable &)));
|
||||||
QWidget::connect(window(), SIGNAL(MacroSegmentOrderChanged()), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(MacroSegmentOrderChanged()), this,
|
||||||
SLOT(MacroSegmentOrderChanged()));
|
SLOT(MacroSegmentOrderChanged()));
|
||||||
QWidget::connect(
|
QWidget::connect(
|
||||||
_subStringStart,
|
_subStringStart,
|
||||||
|
|||||||
@@ -275,289 +275,4 @@ std::shared_ptr<MacroSegment> MacroConditionEdit::Data() const
|
|||||||
return *_entryData;
|
return *_entryData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::AddMacroCondition(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx > (int)macro->Conditions().size()) {
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string id;
|
|
||||||
Logic::Type logic;
|
|
||||||
if (idx >= 1) {
|
|
||||||
id = macro->Conditions().at(idx - 1)->GetId();
|
|
||||||
if (idx == 1) {
|
|
||||||
logic = Logic::Type::OR;
|
|
||||||
} else {
|
|
||||||
logic = macro->Conditions().at(idx - 1)->GetLogicType();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
id = MacroCondition::GetDefaultID();
|
|
||||||
logic = Logic::Type::ROOT_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
OBSDataAutoRelease data;
|
|
||||||
if (idx - 1 >= 0) {
|
|
||||||
data = obs_data_create();
|
|
||||||
macro->Conditions().at(idx - 1)->Save(data);
|
|
||||||
}
|
|
||||||
AddMacroCondition(macro.get(), idx, id, data.Get(), logic);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::AddMacroCondition(Macro *macro, int idx,
|
|
||||||
const std::string &id,
|
|
||||||
obs_data_t *data, Logic::Type logic)
|
|
||||||
{
|
|
||||||
if (idx < 0 || idx > (int)macro->Conditions().size()) {
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
auto cond = macro->Conditions().emplace(
|
|
||||||
macro->Conditions().begin() + idx,
|
|
||||||
MacroConditionFactory::Create(id, macro));
|
|
||||||
if (data) {
|
|
||||||
macro->Conditions().at(idx)->Load(data);
|
|
||||||
}
|
|
||||||
macro->Conditions().at(idx)->PostLoad();
|
|
||||||
RunPostLoadSteps();
|
|
||||||
(*cond)->SetLogicType(logic);
|
|
||||||
macro->UpdateConditionIndices();
|
|
||||||
ui->conditionsList->Insert(
|
|
||||||
idx,
|
|
||||||
new MacroConditionEdit(this, ¯o->Conditions()[idx],
|
|
||||||
id, idx == 0));
|
|
||||||
SetConditionData(*macro);
|
|
||||||
}
|
|
||||||
HighlightCondition(idx);
|
|
||||||
ui->conditionsList->SetHelpMsgVisible(false);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionAdd_clicked()
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentConditionIdx == -1) {
|
|
||||||
AddMacroCondition((int)macro->Conditions().size());
|
|
||||||
} else {
|
|
||||||
AddMacroCondition(currentConditionIdx + 1);
|
|
||||||
}
|
|
||||||
if (currentConditionIdx != -1) {
|
|
||||||
MacroConditionSelectionChanged(currentConditionIdx + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::RemoveMacroCondition(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx >= (int)macro->Conditions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
ui->conditionsList->Remove(idx);
|
|
||||||
macro->Conditions().erase(macro->Conditions().begin() + idx);
|
|
||||||
macro->UpdateConditionIndices();
|
|
||||||
if (idx == 0 && macro->Conditions().size() > 0) {
|
|
||||||
auto newRoot = macro->Conditions().at(0);
|
|
||||||
newRoot->SetLogicType(Logic::Type::ROOT_NONE);
|
|
||||||
static_cast<MacroConditionEdit *>(
|
|
||||||
ui->conditionsList->WidgetAt(0))
|
|
||||||
->SetRootNode(true);
|
|
||||||
}
|
|
||||||
SetConditionData(*macro);
|
|
||||||
}
|
|
||||||
MacroConditionSelectionChanged(-1);
|
|
||||||
lastInteracted = MacroSection::CONDITIONS;
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionRemove_clicked()
|
|
||||||
{
|
|
||||||
if (currentConditionIdx == -1) {
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RemoveMacroCondition((int)macro->Conditions().size() - 1);
|
|
||||||
} else {
|
|
||||||
RemoveMacroCondition(currentConditionIdx);
|
|
||||||
}
|
|
||||||
MacroConditionSelectionChanged(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionTop_clicked()
|
|
||||||
{
|
|
||||||
if (currentConditionIdx == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MacroConditionReorder(0, currentConditionIdx);
|
|
||||||
MacroConditionSelectionChanged(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionUp_clicked()
|
|
||||||
{
|
|
||||||
if (currentConditionIdx == -1 || currentConditionIdx == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveMacroConditionUp(currentConditionIdx);
|
|
||||||
MacroConditionSelectionChanged(currentConditionIdx - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionDown_clicked()
|
|
||||||
{
|
|
||||||
if (currentConditionIdx == -1 ||
|
|
||||||
currentConditionIdx ==
|
|
||||||
ui->conditionsList->ContentLayout()->count() - 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveMacroConditionDown(currentConditionIdx);
|
|
||||||
MacroConditionSelectionChanged(currentConditionIdx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionBottom_clicked()
|
|
||||||
{
|
|
||||||
if (currentConditionIdx == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const int newIdx = ui->conditionsList->ContentLayout()->count() - 1;
|
|
||||||
MacroConditionReorder(newIdx, currentConditionIdx);
|
|
||||||
MacroConditionSelectionChanged(newIdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::SwapConditions(Macro *m, int pos1, int pos2)
|
|
||||||
{
|
|
||||||
if (pos1 == pos2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pos1 > pos2) {
|
|
||||||
std::swap(pos1, pos2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool root = pos1 == 0;
|
|
||||||
auto lock = LockContext();
|
|
||||||
iter_swap(m->Conditions().begin() + pos1,
|
|
||||||
m->Conditions().begin() + pos2);
|
|
||||||
m->UpdateConditionIndices();
|
|
||||||
|
|
||||||
auto c1 = m->Conditions().begin() + pos1;
|
|
||||||
auto c2 = m->Conditions().begin() + pos2;
|
|
||||||
if (root) {
|
|
||||||
auto logic1 = (*c1)->GetLogicType();
|
|
||||||
auto logic2 = (*c2)->GetLogicType();
|
|
||||||
(*c1)->SetLogicType(logic2);
|
|
||||||
(*c2)->SetLogicType(logic1);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto widget1 = static_cast<MacroConditionEdit *>(
|
|
||||||
ui->conditionsList->ContentLayout()->takeAt(pos1)->widget());
|
|
||||||
auto widget2 = static_cast<MacroConditionEdit *>(
|
|
||||||
ui->conditionsList->ContentLayout()->takeAt(pos2 - 1)->widget());
|
|
||||||
ui->conditionsList->Insert(pos1, widget2);
|
|
||||||
ui->conditionsList->Insert(pos2, widget1);
|
|
||||||
SetConditionData(*m);
|
|
||||||
widget2->SetRootNode(root);
|
|
||||||
widget1->SetRootNode(false);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MoveMacroConditionUp(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 1 || idx >= (int)macro->Conditions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SwapConditions(macro.get(), idx, idx - 1);
|
|
||||||
HighlightCondition(idx - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MoveMacroConditionDown(int idx)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < 0 || idx >= (int)macro->Conditions().size() - 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SwapConditions(macro.get(), idx, idx + 1);
|
|
||||||
HighlightCondition(idx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroConditionSelectionChanged(int idx)
|
|
||||||
{
|
|
||||||
SetupMacroSegmentSelection(MacroSection::CONDITIONS, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroConditionReorder(int to, int from)
|
|
||||||
{
|
|
||||||
auto macro = GetSelectedMacro();
|
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (to == from || from < 0 || from > (int)macro->Conditions().size() ||
|
|
||||||
to < 0 || to > (int)macro->Conditions().size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
auto lock = LockContext();
|
|
||||||
auto condition = macro->Conditions().at(from);
|
|
||||||
if (to == 0) {
|
|
||||||
condition->SetLogicType(Logic::Type::ROOT_NONE);
|
|
||||||
static_cast<MacroConditionEdit *>(
|
|
||||||
ui->conditionsList->WidgetAt(from))
|
|
||||||
->SetRootNode(true);
|
|
||||||
macro->Conditions().at(0)->SetLogicType(
|
|
||||||
Logic::Type::AND);
|
|
||||||
static_cast<MacroConditionEdit *>(
|
|
||||||
ui->conditionsList->WidgetAt(0))
|
|
||||||
->SetRootNode(false);
|
|
||||||
}
|
|
||||||
if (from == 0) {
|
|
||||||
condition->SetLogicType(Logic::Type::AND);
|
|
||||||
static_cast<MacroConditionEdit *>(
|
|
||||||
ui->conditionsList->WidgetAt(from))
|
|
||||||
->SetRootNode(false);
|
|
||||||
macro->Conditions().at(1)->SetLogicType(
|
|
||||||
Logic::Type::ROOT_NONE);
|
|
||||||
static_cast<MacroConditionEdit *>(
|
|
||||||
ui->conditionsList->WidgetAt(1))
|
|
||||||
->SetRootNode(true);
|
|
||||||
}
|
|
||||||
macro->Conditions().erase(macro->Conditions().begin() + from);
|
|
||||||
macro->Conditions().insert(macro->Conditions().begin() + to,
|
|
||||||
condition);
|
|
||||||
macro->UpdateConditionIndices();
|
|
||||||
ui->conditionsList->ContentLayout()->insertItem(
|
|
||||||
to, ui->conditionsList->ContentLayout()->takeAt(from));
|
|
||||||
SetConditionData(*macro);
|
|
||||||
}
|
|
||||||
HighlightCondition(to);
|
|
||||||
emit(MacroSegmentOrderChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -538,11 +538,7 @@ void MacroConditionMacroEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroConditionMacroEdit::MacroChanged(const QString &text)
|
void MacroConditionMacroEdit::MacroChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macro = text;
|
_entryData->_macro = text;
|
||||||
_actionIndex->SetMacro(_entryData->_macro.GetMacro());
|
_actionIndex->SetMacro(_entryData->_macro.GetMacro());
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
@@ -551,21 +547,13 @@ void MacroConditionMacroEdit::MacroChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroConditionMacroEdit::CountChanged(const NumberVariable<int> &value)
|
void MacroConditionMacroEdit::CountChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_count = value;
|
_entryData->_count = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionMacroEdit::CountConditionChanged(int cond)
|
void MacroConditionMacroEdit::CountConditionChanged(int cond)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_counterCondition =
|
_entryData->_counterCondition =
|
||||||
static_cast<MacroConditionMacro::CounterCondition>(cond);
|
static_cast<MacroConditionMacro::CounterCondition>(cond);
|
||||||
}
|
}
|
||||||
@@ -590,11 +578,7 @@ void MacroConditionMacroEdit::MacroRemove(const QString &)
|
|||||||
|
|
||||||
void MacroConditionMacroEdit::TypeChanged(int type)
|
void MacroConditionMacroEdit::TypeChanged(int type)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetType(static_cast<MacroConditionMacro::Type>(type));
|
_entryData->SetType(static_cast<MacroConditionMacro::Type>(type));
|
||||||
SetupWidgets();
|
SetupWidgets();
|
||||||
}
|
}
|
||||||
@@ -640,11 +624,7 @@ void MacroConditionMacroEdit::UpdatePaused()
|
|||||||
|
|
||||||
void MacroConditionMacroEdit::MultiStateConditionChanged(int cond)
|
void MacroConditionMacroEdit::MultiStateConditionChanged(int cond)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_multiSateCondition =
|
_entryData->_multiSateCondition =
|
||||||
static_cast<MacroConditionMacro::MultiStateCondition>(cond);
|
static_cast<MacroConditionMacro::MultiStateCondition>(cond);
|
||||||
}
|
}
|
||||||
@@ -652,21 +632,13 @@ void MacroConditionMacroEdit::MultiStateConditionChanged(int cond)
|
|||||||
void MacroConditionMacroEdit::MultiStateCountChanged(
|
void MacroConditionMacroEdit::MultiStateCountChanged(
|
||||||
const NumberVariable<int> &value)
|
const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_multiSateCount = value;
|
_entryData->_multiSateCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionMacroEdit::Add(const std::string &name)
|
void MacroConditionMacroEdit::Add(const std::string &name)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
MacroRef macro(name);
|
MacroRef macro(name);
|
||||||
_entryData->_macros.push_back(macro);
|
_entryData->_macros.push_back(macro);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -675,11 +647,7 @@ void MacroConditionMacroEdit::Add(const std::string &name)
|
|||||||
|
|
||||||
void MacroConditionMacroEdit::Remove(int idx)
|
void MacroConditionMacroEdit::Remove(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macros.erase(std::next(_entryData->_macros.begin(), idx));
|
_entryData->_macros.erase(std::next(_entryData->_macros.begin(), idx));
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -687,12 +655,8 @@ void MacroConditionMacroEdit::Remove(int idx)
|
|||||||
|
|
||||||
void MacroConditionMacroEdit::Replace(int idx, const std::string &name)
|
void MacroConditionMacroEdit::Replace(int idx, const std::string &name)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MacroRef macro(name);
|
MacroRef macro(name);
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macros[idx] = macro;
|
_entryData->_macros[idx] = macro;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -700,11 +664,7 @@ void MacroConditionMacroEdit::Replace(int idx, const std::string &name)
|
|||||||
|
|
||||||
void MacroConditionMacroEdit::ActionIndexChanged(const IntVariable &value)
|
void MacroConditionMacroEdit::ActionIndexChanged(const IntVariable &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_actionIndex = value;
|
_entryData->_actionIndex = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,11 +115,7 @@ MacroConditionQueueEdit::MacroConditionQueueEdit(
|
|||||||
|
|
||||||
void MacroConditionQueueEdit::ConditionChanged(int condition)
|
void MacroConditionQueueEdit::ConditionChanged(int condition)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_condition =
|
_entryData->_condition =
|
||||||
static_cast<MacroConditionQueue::Condition>(condition);
|
static_cast<MacroConditionQueue::Condition>(condition);
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
@@ -129,11 +125,7 @@ void MacroConditionQueueEdit::ConditionChanged(int condition)
|
|||||||
|
|
||||||
void MacroConditionQueueEdit::QueueChanged(const QString &text)
|
void MacroConditionQueueEdit::QueueChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_queue = GetWeakActionQueueByQString(text);
|
_entryData->_queue = GetWeakActionQueueByQString(text);
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -141,11 +133,7 @@ void MacroConditionQueueEdit::QueueChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroConditionQueueEdit::SizeChanged(const NumberVariable<int> &value)
|
void MacroConditionQueueEdit::SizeChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_size = value;
|
_entryData->_size = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,32 +264,19 @@ void MacroConditionTempVarEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroConditionTempVarEdit::VariableChanged(const TempVariableRef &var)
|
void MacroConditionTempVarEdit::VariableChanged(const TempVariableRef &var)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_tempVar = var;
|
_entryData->_tempVar = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionTempVarEdit::Variable2Changed(const QString &text)
|
void MacroConditionTempVarEdit::Variable2Changed(const QString &text)
|
||||||
{
|
{
|
||||||
|
GUARD_LOADING_AND_LOCK();
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_variable2 = GetWeakVariableByQString(text);
|
_entryData->_variable2 = GetWeakVariableByQString(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionTempVarEdit::ConditionChanged(int value)
|
void MacroConditionTempVarEdit::ConditionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_type =
|
_entryData->_type =
|
||||||
static_cast<MacroConditionTempVar::Condition>(value);
|
static_cast<MacroConditionTempVar::Condition>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -297,11 +284,7 @@ void MacroConditionTempVarEdit::ConditionChanged(int value)
|
|||||||
|
|
||||||
void MacroConditionTempVarEdit::StrValueChanged()
|
void MacroConditionTempVarEdit::StrValueChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_strValue = _strValue->toPlainText().toStdString();
|
_entryData->_strValue = _strValue->toPlainText().toStdString();
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -309,21 +292,13 @@ void MacroConditionTempVarEdit::StrValueChanged()
|
|||||||
|
|
||||||
void MacroConditionTempVarEdit::NumValueChanged(double val)
|
void MacroConditionTempVarEdit::NumValueChanged(double val)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_numValue = val;
|
_entryData->_numValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionTempVarEdit::RegexChanged(const RegexConfig &conf)
|
void MacroConditionTempVarEdit::RegexChanged(const RegexConfig &conf)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_regex = conf;
|
_entryData->_regex = conf;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|||||||
@@ -236,11 +236,7 @@ void MacroConditionVariableEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroConditionVariableEdit::VariableChanged(const QString &text)
|
void MacroConditionVariableEdit::VariableChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_variable = GetWeakVariableByQString(text);
|
_entryData->_variable = GetWeakVariableByQString(text);
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -248,22 +244,13 @@ void MacroConditionVariableEdit::VariableChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroConditionVariableEdit::Variable2Changed(const QString &text)
|
void MacroConditionVariableEdit::Variable2Changed(const QString &text)
|
||||||
{
|
{
|
||||||
|
GUARD_LOADING_AND_LOCK();
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_variable2 = GetWeakVariableByQString(text);
|
_entryData->_variable2 = GetWeakVariableByQString(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionVariableEdit::ConditionChanged(int value)
|
void MacroConditionVariableEdit::ConditionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_type =
|
_entryData->_type =
|
||||||
static_cast<MacroConditionVariable::Condition>(value);
|
static_cast<MacroConditionVariable::Condition>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -271,11 +258,7 @@ void MacroConditionVariableEdit::ConditionChanged(int value)
|
|||||||
|
|
||||||
void MacroConditionVariableEdit::StrValueChanged()
|
void MacroConditionVariableEdit::StrValueChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_strValue = _strValue->toPlainText().toStdString();
|
_entryData->_strValue = _strValue->toPlainText().toStdString();
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -283,21 +266,13 @@ void MacroConditionVariableEdit::StrValueChanged()
|
|||||||
|
|
||||||
void MacroConditionVariableEdit::NumValueChanged(double val)
|
void MacroConditionVariableEdit::NumValueChanged(double val)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_numValue = val;
|
_entryData->_numValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionVariableEdit::RegexChanged(const RegexConfig &conf)
|
void MacroConditionVariableEdit::RegexChanged(const RegexConfig &conf)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_regex = conf;
|
_entryData->_regex = conf;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|||||||
1824
lib/macro/macro-edit.cpp
Normal file
1824
lib/macro/macro-edit.cpp
Normal file
File diff suppressed because it is too large
Load Diff
144
lib/macro/macro-edit.hpp
Normal file
144
lib/macro/macro-edit.hpp
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "condition-logic.hpp"
|
||||||
|
|
||||||
|
#include <ui_macro-edit.h>
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
class Macro;
|
||||||
|
class MacroSegment;
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Advanced Scene Switcher window
|
||||||
|
*******************************************************************************/
|
||||||
|
class MacroEdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroEdit(QWidget *parent, QStringList helpMsg = {});
|
||||||
|
void SetMacro(const std::shared_ptr<Macro> &);
|
||||||
|
void ClearSegmentWidgetCacheFor(Macro *) const;
|
||||||
|
void SetControlsDisabled(bool disable) const;
|
||||||
|
void HighlightAction(int idx, QColor color = QColor(Qt::green)) const;
|
||||||
|
void HighlightElseAction(int idx,
|
||||||
|
QColor color = QColor(Qt::green)) const;
|
||||||
|
void HighlightCondition(int idx,
|
||||||
|
QColor color = QColor(Qt::green)) const;
|
||||||
|
void ResetConditionHighlights();
|
||||||
|
void ResetActionHighlights();
|
||||||
|
void SetActionData(Macro &m) const;
|
||||||
|
void SetElseActionData(Macro &m) const;
|
||||||
|
void SetConditionData(Macro &m) const;
|
||||||
|
void SwapActions(Macro *m, int pos1, int pos2);
|
||||||
|
void SwapElseActions(Macro *m, int pos1, int pos2);
|
||||||
|
void SwapConditions(Macro *m, int pos1, int pos2);
|
||||||
|
void CopyMacroSegment();
|
||||||
|
void PasteMacroSegment();
|
||||||
|
bool IsEmpty() const;
|
||||||
|
void ShowAllMacroSections();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_conditionAdd_clicked();
|
||||||
|
void on_conditionRemove_clicked();
|
||||||
|
void on_conditionTop_clicked();
|
||||||
|
void on_conditionUp_clicked();
|
||||||
|
void on_conditionDown_clicked();
|
||||||
|
void on_conditionBottom_clicked();
|
||||||
|
void on_actionAdd_clicked();
|
||||||
|
void on_actionRemove_clicked();
|
||||||
|
void on_actionTop_clicked();
|
||||||
|
void on_actionUp_clicked();
|
||||||
|
void on_actionDown_clicked();
|
||||||
|
void on_actionBottom_clicked();
|
||||||
|
void on_toggleElseActions_clicked() const;
|
||||||
|
void on_elseActionAdd_clicked();
|
||||||
|
void on_elseActionRemove_clicked();
|
||||||
|
void on_elseActionTop_clicked();
|
||||||
|
void on_elseActionUp_clicked();
|
||||||
|
void on_elseActionDown_clicked();
|
||||||
|
void on_elseActionBottom_clicked();
|
||||||
|
void UpMacroSegmentHotkey();
|
||||||
|
void DownMacroSegmentHotkey();
|
||||||
|
void DeleteMacroSegmentHotkey();
|
||||||
|
void ShowMacroActionsContextMenu(const QPoint &);
|
||||||
|
void ShowMacroElseActionsContextMenu(const QPoint &);
|
||||||
|
void ShowMacroConditionsContextMenu(const QPoint &);
|
||||||
|
void ExpandAllActions() const;
|
||||||
|
void ExpandAllElseActions() const;
|
||||||
|
void ExpandAllConditions() const;
|
||||||
|
void CollapseAllActions() const;
|
||||||
|
void CollapseAllElseActions() const;
|
||||||
|
void CollapseAllConditions() const;
|
||||||
|
void MinimizeActions() const;
|
||||||
|
void MaximizeActions() const;
|
||||||
|
void MinimizeElseActions() const;
|
||||||
|
void MaximizeElseActions() const;
|
||||||
|
void MinimizeConditions() const;
|
||||||
|
void MaximizeConditions() const;
|
||||||
|
void SetElseActionsStateToHidden() const;
|
||||||
|
void SetElseActionsStateToVisible() const;
|
||||||
|
void MacroActionSelectionChanged(int idx);
|
||||||
|
void MacroActionReorder(int to, int target);
|
||||||
|
void AddMacroAction(Macro *macro, int idx, const std::string &id,
|
||||||
|
obs_data_t *data);
|
||||||
|
void AddMacroAction(int idx);
|
||||||
|
void RemoveMacroAction(int idx);
|
||||||
|
void MoveMacroActionUp(int idx);
|
||||||
|
void MoveMacroActionDown(int idx);
|
||||||
|
void MacroElseActionSelectionChanged(int idx);
|
||||||
|
void MacroElseActionReorder(int to, int target);
|
||||||
|
void AddMacroElseAction(Macro *macro, int idx, const std::string &id,
|
||||||
|
obs_data_t *data);
|
||||||
|
void AddMacroElseAction(int idx);
|
||||||
|
void RemoveMacroElseAction(int idx);
|
||||||
|
void MoveMacroElseActionUp(int idx);
|
||||||
|
void MoveMacroElseActionDown(int idx);
|
||||||
|
void MacroConditionSelectionChanged(int idx);
|
||||||
|
void MacroConditionReorder(int to, int target);
|
||||||
|
void AddMacroCondition(int idx);
|
||||||
|
void AddMacroCondition(Macro *macro, int idx, const std::string &id,
|
||||||
|
obs_data_t *data, Logic::Type logic);
|
||||||
|
void RemoveMacroCondition(int idx);
|
||||||
|
void MoveMacroConditionUp(int idx);
|
||||||
|
void MoveMacroConditionDown(int idx);
|
||||||
|
void HighlightControls() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void MacroAdded(const QString &name);
|
||||||
|
void MacroRemoved(const QString &name);
|
||||||
|
void MacroRenamed(const QString &oldName, const QString &newName);
|
||||||
|
void MacroSegmentOrderChanged();
|
||||||
|
void SegmentTempVarsChanged(MacroSegment *);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum class MacroSection { CONDITIONS, ACTIONS, ELSE_ACTIONS };
|
||||||
|
|
||||||
|
void PopulateMacroActions(Macro &m, uint32_t afterIdx = 0);
|
||||||
|
void PopulateMacroElseActions(Macro &m, uint32_t afterIdx = 0);
|
||||||
|
void PopulateMacroConditions(Macro &m, uint32_t afterIdx = 0);
|
||||||
|
void SetupMacroSegmentSelection(MacroSection type, int idx);
|
||||||
|
void
|
||||||
|
SetupContextMenu(const QPoint &pos,
|
||||||
|
const std::function<void(MacroEdit *, int)> &remove,
|
||||||
|
const std::function<void(MacroEdit *)> &expand,
|
||||||
|
const std::function<void(MacroEdit *)> &collapse,
|
||||||
|
const std::function<void(MacroEdit *)> &maximize,
|
||||||
|
const std::function<void(MacroEdit *)> &minimize,
|
||||||
|
MacroSegmentList *list);
|
||||||
|
void RunSegmentHighlightChecks();
|
||||||
|
bool ElseSectionIsVisible() const;
|
||||||
|
|
||||||
|
MacroSection lastInteracted = MacroSection::CONDITIONS;
|
||||||
|
int currentConditionIdx = -1;
|
||||||
|
int currentActionIdx = -1;
|
||||||
|
int currentElseActionIdx = -1;
|
||||||
|
|
||||||
|
std::shared_ptr<Macro> _currentMacro;
|
||||||
|
|
||||||
|
std::unique_ptr<Ui_MacroEdit> ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
@@ -10,11 +10,12 @@ MacroList::MacroList(QWidget *parent, bool allowDuplicates, bool reorder)
|
|||||||
: ListEditor(parent, reorder),
|
: ListEditor(parent, reorder),
|
||||||
_allowDuplicates(allowDuplicates)
|
_allowDuplicates(allowDuplicates)
|
||||||
{
|
{
|
||||||
QWidget::connect(window(),
|
QWidget::connect(GetSettingsWindow(),
|
||||||
SIGNAL(MacroRenamed(const QString &, const QString &)),
|
SIGNAL(MacroRenamed(const QString &, const QString &)),
|
||||||
this,
|
this,
|
||||||
SLOT(MacroRename(const QString &, const QString &)));
|
SLOT(MacroRename(const QString &, const QString &)));
|
||||||
QWidget::connect(window(), SIGNAL(MacroRemoved(const QString &)), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(MacroRemoved(const QString &)), this,
|
||||||
SLOT(MacroRemove(const QString &)));
|
SLOT(MacroRemove(const QString &)));
|
||||||
UpdateListSize();
|
UpdateListSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,14 @@ namespace advss {
|
|||||||
MacroRunButton::MacroRunButton(QWidget *parent) : QPushButton(parent)
|
MacroRunButton::MacroRunButton(QWidget *parent) : QPushButton(parent)
|
||||||
{
|
{
|
||||||
installEventFilter(this);
|
installEventFilter(this);
|
||||||
auto parentWindow = window();
|
|
||||||
if (parentWindow) {
|
// GetSettingsWindow() might still return null while this constructor is called
|
||||||
parentWindow->installEventFilter(this);
|
QTimer::singleShot(0, this, [this]() {
|
||||||
}
|
auto parentWindow = GetSettingsWindow();
|
||||||
|
if (parentWindow) {
|
||||||
|
parentWindow->installEventFilter(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setToolTip(obs_module_text("AdvSceneSwitcher.macroTab.run.tooltip"));
|
setToolTip(obs_module_text("AdvSceneSwitcher.macroTab.run.tooltip"));
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ struct MacroSegmentCopyInfo {
|
|||||||
};
|
};
|
||||||
static MacroSegmentCopyInfo copyInfo;
|
static MacroSegmentCopyInfo copyInfo;
|
||||||
|
|
||||||
void AdvSceneSwitcher::CopyMacroSegment()
|
void MacroEdit::CopyMacroSegment()
|
||||||
{
|
{
|
||||||
copyInfo.segment.reset();
|
copyInfo.segment.reset();
|
||||||
copyInfo.type = MacroSegmentCopyInfo::Type::NONE;
|
copyInfo.type = MacroSegmentCopyInfo::Type::NONE;
|
||||||
@@ -23,7 +23,7 @@ void AdvSceneSwitcher::CopyMacroSegment()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto macro = GetSelectedMacro();
|
auto macro = _currentMacro;
|
||||||
if (!macro) {
|
if (!macro) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -43,13 +43,13 @@ void AdvSceneSwitcher::CopyMacroSegment()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::PasteMacroSegment()
|
void MacroEdit::PasteMacroSegment()
|
||||||
{
|
{
|
||||||
if (copyInfo.type == MacroSegmentCopyInfo::Type::NONE) {
|
if (copyInfo.type == MacroSegmentCopyInfo::Type::NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto macro = GetSelectedMacro();
|
auto macro = _currentMacro;
|
||||||
if (!macro || !copyInfo.segment) {
|
if (!macro || !copyInfo.segment) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -113,14 +113,14 @@ void SetCopySegmentTargetActionType(bool setToElseAction)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupSegmentCopyPasteShortcutHandlers(AdvSceneSwitcher *window)
|
void SetupSegmentCopyPasteShortcutHandlers(MacroEdit *edit)
|
||||||
{
|
{
|
||||||
auto copyShortcut = new QShortcut(QKeySequence("Ctrl+C"), window);
|
auto copyShortcut = new QShortcut(QKeySequence("Ctrl+C"), edit);
|
||||||
QWidget::connect(copyShortcut, &QShortcut::activated, window,
|
QWidget::connect(copyShortcut, &QShortcut::activated, edit,
|
||||||
&AdvSceneSwitcher::CopyMacroSegment);
|
&MacroEdit::CopyMacroSegment);
|
||||||
auto pasteShortcut = new QShortcut(QKeySequence("Ctrl+V"), window);
|
auto pasteShortcut = new QShortcut(QKeySequence("Ctrl+V"), edit);
|
||||||
QWidget::connect(pasteShortcut, &QShortcut::activated, window,
|
QWidget::connect(pasteShortcut, &QShortcut::activated, edit,
|
||||||
&AdvSceneSwitcher::PasteMacroSegment);
|
&MacroEdit::PasteMacroSegment);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
class AdvSceneSwitcher;
|
class MacroEdit;
|
||||||
|
|
||||||
bool MacroSegmentIsInClipboard();
|
bool MacroSegmentIsInClipboard();
|
||||||
bool MacroActionIsInClipboard();
|
bool MacroActionIsInClipboard();
|
||||||
void SetCopySegmentTargetActionType(bool setToElseAction);
|
void SetCopySegmentTargetActionType(bool setToElseAction);
|
||||||
void SetupSegmentCopyPasteShortcutHandlers(AdvSceneSwitcher *window);
|
void SetupSegmentCopyPasteShortcutHandlers(MacroEdit *edit);
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -17,27 +17,39 @@ bool MacroSegmentList::_useCache = true;
|
|||||||
|
|
||||||
MacroSegmentList::MacroSegmentList(QWidget *parent)
|
MacroSegmentList::MacroSegmentList(QWidget *parent)
|
||||||
: QScrollArea(parent),
|
: QScrollArea(parent),
|
||||||
|
_stackedWidget(new QStackedWidget(this)),
|
||||||
_layout(new QVBoxLayout),
|
_layout(new QVBoxLayout),
|
||||||
_contentLayout(new QVBoxLayout),
|
_contentLayout(new QVBoxLayout),
|
||||||
_helpMsg(new QLabel)
|
_helpMsg(new QLabel(this))
|
||||||
{
|
{
|
||||||
_helpMsg->setWordWrap(true);
|
_helpMsg->setWordWrap(true);
|
||||||
_helpMsg->setAlignment(Qt::AlignCenter);
|
_helpMsg->setAlignment(Qt::AlignCenter);
|
||||||
|
auto helpWidget = new QWidget(this);
|
||||||
|
auto helpLayout = new QVBoxLayout(helpWidget);
|
||||||
|
helpLayout->addWidget(_helpMsg);
|
||||||
|
helpLayout->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
|
auto contentWidget = new QWidget(this);
|
||||||
|
contentWidget->setLayout(_contentLayout);
|
||||||
_contentLayout->setSpacing(0);
|
_contentLayout->setSpacing(0);
|
||||||
auto helperLayout = new QGridLayout();
|
|
||||||
helperLayout->addWidget(_helpMsg, 0, 0,
|
auto contentWrapper = new QWidget(this);
|
||||||
Qt::AlignHCenter | Qt::AlignVCenter);
|
auto wrapperLayout = new QVBoxLayout(contentWrapper);
|
||||||
helperLayout->addLayout(_contentLayout, 0, 0);
|
wrapperLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
helperLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
wrapperLayout->addWidget(contentWidget);
|
||||||
_layout->addLayout(helperLayout, 10);
|
// Move macro segments to the top of the list
|
||||||
_layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding,
|
wrapperLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding,
|
||||||
QSizePolicy::Expanding));
|
QSizePolicy::Expanding));
|
||||||
auto wrapper = new QWidget;
|
|
||||||
wrapper->setLayout(_layout);
|
_stackedWidget->addWidget(helpWidget);
|
||||||
setWidget(wrapper);
|
_stackedWidget->addWidget(contentWrapper);
|
||||||
|
|
||||||
|
setWidget(_stackedWidget);
|
||||||
setWidgetResizable(true);
|
setWidgetResizable(true);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
|
SetHelpMsgVisible(true);
|
||||||
|
|
||||||
connect(verticalScrollBar(), &QScrollBar::valueChanged, this,
|
connect(verticalScrollBar(), &QScrollBar::valueChanged, this,
|
||||||
[this]() { SetupVisibleMacroSegmentWidgets(); });
|
[this]() { SetupVisibleMacroSegmentWidgets(); });
|
||||||
}
|
}
|
||||||
@@ -107,9 +119,11 @@ void MacroSegmentList::SetHelpMsg(const QString &msg) const
|
|||||||
_helpMsg->setText(msg);
|
_helpMsg->setText(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroSegmentList::SetHelpMsgVisible(bool visible) const
|
void MacroSegmentList::SetHelpMsgVisible(bool visible)
|
||||||
{
|
{
|
||||||
_helpMsg->setVisible(visible);
|
_stackedWidget->setCurrentIndex(visible ? 0 : 1);
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroSegmentList::Insert(int idx, QWidget *widget)
|
void MacroSegmentList::Insert(int idx, QWidget *widget)
|
||||||
@@ -117,23 +131,33 @@ void MacroSegmentList::Insert(int idx, QWidget *widget)
|
|||||||
widget->installEventFilter(this);
|
widget->installEventFilter(this);
|
||||||
_contentLayout->insertWidget(idx, widget);
|
_contentLayout->insertWidget(idx, widget);
|
||||||
SetupVisibleMacroSegmentWidgets();
|
SetupVisibleMacroSegmentWidgets();
|
||||||
|
SetHelpMsgVisible(false);
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroSegmentList::Add(QWidget *widget)
|
void MacroSegmentList::Add(QWidget *widget)
|
||||||
{
|
{
|
||||||
widget->installEventFilter(this);
|
Insert(_contentLayout->count(), widget);
|
||||||
_contentLayout->addWidget(widget);
|
|
||||||
SetupVisibleMacroSegmentWidgets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroSegmentList::Remove(int idx) const
|
void MacroSegmentList::Remove(int idx)
|
||||||
{
|
{
|
||||||
DeleteLayoutItemWidget(_contentLayout->takeAt(idx));
|
DeleteLayoutItemWidget(_contentLayout->takeAt(idx));
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
if (IsEmpty()) {
|
||||||
|
SetHelpMsgVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroSegmentList::Clear(int idx) const
|
void MacroSegmentList::Clear(int idx)
|
||||||
{
|
{
|
||||||
ClearLayout(_contentLayout, idx);
|
ClearLayout(_contentLayout, idx);
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
|
||||||
|
SetHelpMsgVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroSegmentList::SetCachingEnabled(bool enable)
|
void MacroSegmentList::SetCachingEnabled(bool enable)
|
||||||
@@ -178,6 +202,8 @@ bool MacroSegmentList::PopulateWidgetsFromCache(const Macro *macro)
|
|||||||
widget->show();
|
widget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,6 +437,24 @@ void MacroSegmentList::SetVisibilityCheckEnable(bool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MacroSegmentList::IsEmpty() const
|
||||||
|
{
|
||||||
|
return _contentLayout->count() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize MacroSegmentList::minimumSizeHint() const
|
||||||
|
{
|
||||||
|
return _stackedWidget->currentWidget()->minimumSizeHint();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize MacroSegmentList::sizeHint() const
|
||||||
|
{
|
||||||
|
const auto contentSize = _stackedWidget->currentWidget()->sizeHint();
|
||||||
|
const auto hint =
|
||||||
|
QSize(width(), contentSize.height() + 2 * frameWidth());
|
||||||
|
return hint;
|
||||||
|
}
|
||||||
|
|
||||||
void MacroSegmentList::SetupVisibleMacroSegmentWidgets()
|
void MacroSegmentList::SetupVisibleMacroSegmentWidgets()
|
||||||
{
|
{
|
||||||
if (!_checkVisibility) {
|
if (!_checkVisibility) {
|
||||||
@@ -428,6 +472,7 @@ void MacroSegmentList::SetupVisibleMacroSegmentWidgets()
|
|||||||
|
|
||||||
segment->SetupWidgets();
|
segment->SetupWidgets();
|
||||||
}
|
}
|
||||||
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MacroSegmentList::GetSegmentIndexFromPos(const QPoint &pos) const
|
int MacroSegmentList::GetSegmentIndexFromPos(const QPoint &pos) const
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-segment.hpp"
|
#include "macro-segment.hpp"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QScrollArea>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
class Macro;
|
class Macro;
|
||||||
@@ -17,51 +19,63 @@ class MacroSegmentList : public QScrollArea {
|
|||||||
public:
|
public:
|
||||||
MacroSegmentList(QWidget *parent = nullptr);
|
MacroSegmentList(QWidget *parent = nullptr);
|
||||||
~MacroSegmentList();
|
~MacroSegmentList();
|
||||||
|
|
||||||
void SetHelpMsg(const QString &msg) const;
|
void SetHelpMsg(const QString &msg) const;
|
||||||
void SetHelpMsgVisible(bool visible) const;
|
void SetHelpMsgVisible(bool visible);
|
||||||
|
|
||||||
MacroSegmentEdit *WidgetAt(int idx) const;
|
MacroSegmentEdit *WidgetAt(int idx) const;
|
||||||
MacroSegmentEdit *WidgetAt(const QPoint &) const;
|
MacroSegmentEdit *WidgetAt(const QPoint &) const;
|
||||||
|
|
||||||
int IndexAt(const QPoint &) const;
|
int IndexAt(const QPoint &) const;
|
||||||
void Insert(int idx, QWidget *widget);
|
void Insert(int idx, QWidget *widget);
|
||||||
void Add(QWidget *widget);
|
void Add(QWidget *widget);
|
||||||
void Remove(int idx) const;
|
void Remove(int idx);
|
||||||
void Clear(int idx = 0) const; // Clear all elements >= idx
|
void Clear(int idx = 0); // Clear all elements >= idx
|
||||||
|
bool IsEmpty() const;
|
||||||
|
|
||||||
static void SetCachingEnabled(bool enable);
|
static void SetCachingEnabled(bool enable);
|
||||||
void CacheCurrentWidgetsFor(const Macro *);
|
void CacheCurrentWidgetsFor(const Macro *);
|
||||||
bool PopulateWidgetsFromCache(const Macro *);
|
bool PopulateWidgetsFromCache(const Macro *);
|
||||||
void ClearWidgetsFromCacheFor(const Macro *);
|
void ClearWidgetsFromCacheFor(const Macro *);
|
||||||
|
void SetVisibilityCheckEnable(bool enable);
|
||||||
|
|
||||||
void Highlight(int idx, QColor color = QColor(Qt::green));
|
void Highlight(int idx, QColor color = QColor(Qt::green));
|
||||||
|
|
||||||
void SetCollapsed(bool) const;
|
void SetCollapsed(bool) const;
|
||||||
void SetSelection(int idx) const;
|
void SetSelection(int idx) const;
|
||||||
QVBoxLayout *ContentLayout() const { return _contentLayout; }
|
QVBoxLayout *ContentLayout() const { return _contentLayout; }
|
||||||
void SetVisibilityCheckEnable(bool enable);
|
|
||||||
|
QSize minimumSizeHint() const override;
|
||||||
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void SelectionChanged(int idx);
|
void SelectionChanged(int idx);
|
||||||
void Reorder(int source, int target);
|
void Reorder(int source, int target);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *object, QEvent *event);
|
bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event);
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event);
|
void dropEvent(QDropEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupVisibleMacroSegmentWidgets();
|
void SetupVisibleMacroSegmentWidgets();
|
||||||
|
void ClearWidgetCache();
|
||||||
|
|
||||||
int GetSegmentIndexFromPos(const QPoint &) const;
|
int GetSegmentIndexFromPos(const QPoint &) const;
|
||||||
|
bool IsInListArea(const QPoint &) const;
|
||||||
|
QRect GetContentItemRectWithPadding(int idx) const;
|
||||||
|
|
||||||
int GetDragIndex(const QPoint &) const;
|
int GetDragIndex(const QPoint &) const;
|
||||||
int GetDropIndex(const QPoint &) const;
|
int GetDropIndex(const QPoint &) const;
|
||||||
void CheckScroll() const;
|
void CheckScroll() const;
|
||||||
void CheckDropLine(const QPoint &);
|
void CheckDropLine(const QPoint &);
|
||||||
bool IsInListArea(const QPoint &) const;
|
|
||||||
QRect GetContentItemRectWithPadding(int idx) const;
|
|
||||||
void HideLastDropLine();
|
void HideLastDropLine();
|
||||||
void ClearWidgetCache();
|
|
||||||
|
|
||||||
int _dragPosition = -1;
|
int _dragPosition = -1;
|
||||||
int _dropLineIdx = -1;
|
int _dropLineIdx = -1;
|
||||||
@@ -69,6 +83,7 @@ private:
|
|||||||
std::thread _autoScrollThread;
|
std::thread _autoScrollThread;
|
||||||
std::atomic_bool _autoScroll{false};
|
std::atomic_bool _autoScroll{false};
|
||||||
|
|
||||||
|
QStackedWidget *_stackedWidget;
|
||||||
QVBoxLayout *_layout;
|
QVBoxLayout *_layout;
|
||||||
QVBoxLayout *_contentLayout;
|
QVBoxLayout *_contentLayout;
|
||||||
QLabel *_helpMsg;
|
QLabel *_helpMsg;
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ MacroSegmentSelection::MacroSegmentSelection(QWidget *parent, Type type,
|
|||||||
_index,
|
_index,
|
||||||
SIGNAL(NumberVariableChanged(const NumberVariable<int> &)),
|
SIGNAL(NumberVariableChanged(const NumberVariable<int> &)),
|
||||||
this, SLOT(IndexChanged(const NumberVariable<int> &)));
|
this, SLOT(IndexChanged(const NumberVariable<int> &)));
|
||||||
QWidget::connect(window(), SIGNAL(MacroSegmentOrderChanged()), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(MacroSegmentOrderChanged()), this,
|
||||||
SLOT(MacroSegmentOrderChanged()));
|
SLOT(MacroSegmentOrderChanged()));
|
||||||
|
|
||||||
auto layout = new QHBoxLayout;
|
auto layout = new QHBoxLayout;
|
||||||
|
|||||||
@@ -257,20 +257,25 @@ MacroSegmentEdit::MacroSegmentEdit(QWidget *parent)
|
|||||||
QWidget::connect(_section, &Section::Collapsed, this,
|
QWidget::connect(_section, &Section::Collapsed, this,
|
||||||
&MacroSegmentEdit::Collapsed);
|
&MacroSegmentEdit::Collapsed);
|
||||||
// Macro signals
|
// Macro signals
|
||||||
QWidget::connect(parent, SIGNAL(MacroAdded(const QString &)), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(MacroAdded(const QString &)), this,
|
||||||
SIGNAL(MacroAdded(const QString &)));
|
SIGNAL(MacroAdded(const QString &)));
|
||||||
QWidget::connect(parent, SIGNAL(MacroRemoved(const QString &)), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(MacroRemoved(const QString &)), this,
|
||||||
SIGNAL(MacroRemoved(const QString &)));
|
SIGNAL(MacroRemoved(const QString &)));
|
||||||
QWidget::connect(
|
QWidget::connect(
|
||||||
parent, SIGNAL(MacroRenamed(const QString &, const QString &)),
|
GetSettingsWindow(),
|
||||||
this, SIGNAL(MacroRenamed(const QString &, const QString &)));
|
SIGNAL(MacroRenamed(const QString &, const QString &)), this,
|
||||||
|
SIGNAL(MacroRenamed(const QString &, const QString &)));
|
||||||
// Scene group signals
|
// Scene group signals
|
||||||
QWidget::connect(parent, SIGNAL(SceneGroupAdded(const QString &)), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(SceneGroupAdded(const QString &)), this,
|
||||||
SIGNAL(SceneGroupAdded(const QString &)));
|
SIGNAL(SceneGroupAdded(const QString &)));
|
||||||
QWidget::connect(parent, SIGNAL(SceneGroupRemoved(const QString &)),
|
QWidget::connect(GetSettingsWindow(),
|
||||||
this, SIGNAL(SceneGroupRemoved(const QString &)));
|
SIGNAL(SceneGroupRemoved(const QString &)), this,
|
||||||
|
SIGNAL(SceneGroupRemoved(const QString &)));
|
||||||
QWidget::connect(
|
QWidget::connect(
|
||||||
parent,
|
GetSettingsWindow(),
|
||||||
SIGNAL(SceneGroupRenamed(const QString &, const QString)), this,
|
SIGNAL(SceneGroupRenamed(const QString &, const QString)), this,
|
||||||
SIGNAL(SceneGroupRenamed(const QString &, const QString)));
|
SIGNAL(SceneGroupRenamed(const QString &, const QString)));
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace advss {
|
|||||||
|
|
||||||
class Macro;
|
class Macro;
|
||||||
|
|
||||||
class EXPORT MacroSegment {
|
class EXPORT MacroSegment : public Lockable {
|
||||||
public:
|
public:
|
||||||
MacroSegment(Macro *m, bool supportsVariableValue);
|
MacroSegment(Macro *m, bool supportsVariableValue);
|
||||||
virtual ~MacroSegment() = default;
|
virtual ~MacroSegment() = default;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void MacroSelection::SetCurrentMacro(const MacroRef ¯o)
|
|||||||
|
|
||||||
void MacroSelection::HideSelectedMacro()
|
void MacroSelection::HideSelectedMacro()
|
||||||
{
|
{
|
||||||
auto ssWindow = static_cast<AdvSceneSwitcher *>(window());
|
auto ssWindow = static_cast<AdvSceneSwitcher *>(GetSettingsWindow());
|
||||||
if (!ssWindow) {
|
if (!ssWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -478,7 +478,14 @@ bool MacroSettingsDialog::AskForSettings(QWidget *parent,
|
|||||||
macro->SetSkipExecOnStart(dialog._currentSkipOnStartup->isChecked());
|
macro->SetSkipExecOnStart(dialog._currentSkipOnStartup->isChecked());
|
||||||
macro->SetStopActionsIfNotDone(
|
macro->SetStopActionsIfNotDone(
|
||||||
dialog._currentStopActionsIfNotDone->isChecked());
|
dialog._currentStopActionsIfNotDone->isChecked());
|
||||||
macro->EnableDock(dialog._currentMacroRegisterDock->isChecked());
|
|
||||||
|
// Only apply "on change" to avoid recreation of the dock widget
|
||||||
|
const bool enableDock = dialog._currentMacroRegisterDock->isChecked();
|
||||||
|
if (macro->DockEnabled() != enableDock) {
|
||||||
|
macro->EnableDock(
|
||||||
|
dialog._currentMacroRegisterDock->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
macro->SetDockHasRunButton(
|
macro->SetDockHasRunButton(
|
||||||
dialog._currentMacroDockAddRunButton->isChecked());
|
dialog._currentMacroDockAddRunButton->isChecked());
|
||||||
macro->SetDockHasPauseButton(
|
macro->SetDockHasPauseButton(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -414,6 +414,20 @@ void MacroTreeModel::Add(std::shared_ptr<Macro> item)
|
|||||||
QItemSelectionModel::Select);
|
QItemSelectionModel::Select);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroTreeModel::MoveToBeginningOfGroup(std::shared_ptr<Macro> item,
|
||||||
|
std::shared_ptr<Macro> group)
|
||||||
|
{
|
||||||
|
auto it = std::find(_macros.begin(), _macros.end(), item);
|
||||||
|
assert(it != _macros.end());
|
||||||
|
std::shared_ptr<Macro> tmp = *it;
|
||||||
|
_macros.erase(it);
|
||||||
|
it = std::find(_macros.begin(), _macros.end(), group);
|
||||||
|
assert(it != _macros.end());
|
||||||
|
_macros.insert(std::next(it), tmp);
|
||||||
|
|
||||||
|
Reset(_macros);
|
||||||
|
}
|
||||||
|
|
||||||
void MacroTreeModel::Remove(std::shared_ptr<Macro> item)
|
void MacroTreeModel::Remove(std::shared_ptr<Macro> item)
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
@@ -789,6 +803,13 @@ void MacroTree::Add(std::shared_ptr<Macro> item,
|
|||||||
assert(GetModel()->IsInValidState());
|
assert(GetModel()->IsInValidState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroTree::AddToGroup(std::shared_ptr<Macro> item,
|
||||||
|
std::shared_ptr<Macro> group) const
|
||||||
|
{
|
||||||
|
GetModel()->Add(item);
|
||||||
|
GetModel()->MoveToBeginningOfGroup(item, group);
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<Macro> MacroTree::GetCurrentMacro() const
|
std::shared_ptr<Macro> MacroTree::GetCurrentMacro() const
|
||||||
{
|
{
|
||||||
return GetModel()->GetCurrentMacro();
|
return GetModel()->GetCurrentMacro();
|
||||||
@@ -1160,6 +1181,28 @@ bool MacroTree::SelectionEmpty() const
|
|||||||
return selectedIndexes().empty();
|
return selectedIndexes().empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MacroTree::GroupsExist() const
|
||||||
|
{
|
||||||
|
for (const auto ¯o : GetMacros()) {
|
||||||
|
if (macro->IsGroup()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroTree::ExpandGroup(std::shared_ptr<Macro> item) const
|
||||||
|
{
|
||||||
|
auto *mtm = GetModel();
|
||||||
|
mtm->ExpandGroup(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroTree::CollapseGroup(std::shared_ptr<Macro> item) const
|
||||||
|
{
|
||||||
|
auto *mtm = GetModel();
|
||||||
|
mtm->CollapseGroup(item);
|
||||||
|
}
|
||||||
|
|
||||||
void MacroTree::MoveItemBefore(const std::shared_ptr<Macro> &item,
|
void MacroTree::MoveItemBefore(const std::shared_ptr<Macro> &item,
|
||||||
const std::shared_ptr<Macro> &after) const
|
const std::shared_ptr<Macro> &after) const
|
||||||
{
|
{
|
||||||
@@ -1260,6 +1303,26 @@ void MacroTree::UngroupSelectedGroups()
|
|||||||
assert(GetModel()->IsInValidState());
|
assert(GetModel()->IsInValidState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroTree::ExpandAll()
|
||||||
|
{
|
||||||
|
for (const auto ¯o : GetMacros()) {
|
||||||
|
if (!macro->IsGroup()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ExpandGroup(macro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroTree::CollapseAll()
|
||||||
|
{
|
||||||
|
for (const auto ¯o : GetMacros()) {
|
||||||
|
if (!macro->IsGroup()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CollapseGroup(macro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MacroTree::SelectionChangedHelper(const QItemSelection &,
|
void MacroTree::SelectionChangedHelper(const QItemSelection &,
|
||||||
const QItemSelection &)
|
const QItemSelection &)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ private:
|
|||||||
void MoveItemAfter(const std::shared_ptr<Macro> &item,
|
void MoveItemAfter(const std::shared_ptr<Macro> &item,
|
||||||
const std::shared_ptr<Macro> &after);
|
const std::shared_ptr<Macro> &after);
|
||||||
void Add(std::shared_ptr<Macro> item);
|
void Add(std::shared_ptr<Macro> item);
|
||||||
|
void MoveToBeginningOfGroup(std::shared_ptr<Macro> item,
|
||||||
|
std::shared_ptr<Macro>);
|
||||||
void Remove(std::shared_ptr<Macro> item);
|
void Remove(std::shared_ptr<Macro> item);
|
||||||
std::shared_ptr<Macro> Neighbor(const std::shared_ptr<Macro> &m,
|
std::shared_ptr<Macro> Neighbor(const std::shared_ptr<Macro> &m,
|
||||||
bool above) const;
|
bool above) const;
|
||||||
@@ -126,6 +128,8 @@ public:
|
|||||||
void Reset(std::deque<std::shared_ptr<Macro>> &, bool highlight);
|
void Reset(std::deque<std::shared_ptr<Macro>> &, bool highlight);
|
||||||
void Add(std::shared_ptr<Macro> item,
|
void Add(std::shared_ptr<Macro> item,
|
||||||
std::shared_ptr<Macro> after = {}) const;
|
std::shared_ptr<Macro> after = {}) const;
|
||||||
|
void AddToGroup(std::shared_ptr<Macro> item,
|
||||||
|
std::shared_ptr<Macro> group) const;
|
||||||
void Remove(std::shared_ptr<Macro> item) const;
|
void Remove(std::shared_ptr<Macro> item) const;
|
||||||
void Up(std::shared_ptr<Macro> item) const;
|
void Up(std::shared_ptr<Macro> item) const;
|
||||||
void Down(std::shared_ptr<Macro> item) const;
|
void Down(std::shared_ptr<Macro> item) const;
|
||||||
@@ -135,10 +139,15 @@ public:
|
|||||||
bool GroupedItemsSelected() const;
|
bool GroupedItemsSelected() const;
|
||||||
bool SingleItemSelected() const;
|
bool SingleItemSelected() const;
|
||||||
bool SelectionEmpty() const;
|
bool SelectionEmpty() const;
|
||||||
|
bool GroupsExist() const;
|
||||||
|
void ExpandGroup(std::shared_ptr<Macro> item) const;
|
||||||
|
void CollapseGroup(std::shared_ptr<Macro> item) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void GroupSelectedItems();
|
void GroupSelectedItems();
|
||||||
void UngroupSelectedGroups();
|
void UngroupSelectedGroups();
|
||||||
|
void ExpandAll();
|
||||||
|
void CollapseAll();
|
||||||
void SelectionChangedHelper(const QItemSelection &,
|
void SelectionChangedHelper(const QItemSelection &,
|
||||||
const QItemSelection &);
|
const QItemSelection &);
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,10 @@ static bool checkCondition(const std::shared_ptr<MacroCondition> &condition)
|
|||||||
static constexpr auto perfLogThreshold = 300ms;
|
static constexpr auto perfLogThreshold = 300ms;
|
||||||
|
|
||||||
const auto startTime = std::chrono::high_resolution_clock::now();
|
const auto startTime = std::chrono::high_resolution_clock::now();
|
||||||
const bool conditionMatched = condition->CheckCondition();
|
bool conditionMatched = false;
|
||||||
|
condition->WithLock([&condition, &conditionMatched]() {
|
||||||
|
conditionMatched = condition->CheckCondition();
|
||||||
|
});
|
||||||
const auto endTime = std::chrono::high_resolution_clock::now();
|
const auto endTime = std::chrono::high_resolution_clock::now();
|
||||||
const auto timeSpent = endTime - startTime;
|
const auto timeSpent = endTime - startTime;
|
||||||
|
|
||||||
@@ -444,9 +447,12 @@ bool Macro::RunActionsHelper(
|
|||||||
}
|
}
|
||||||
if (action->Enabled()) {
|
if (action->Enabled()) {
|
||||||
action->LogAction();
|
action->LogAction();
|
||||||
|
bool actionResult = false;
|
||||||
|
action->WithLock([&action, &actionResult]() {
|
||||||
|
actionResult = action->PerformAction();
|
||||||
|
});
|
||||||
actionsExecutedSuccessfully =
|
actionsExecutedSuccessfully =
|
||||||
actionsExecutedSuccessfully &&
|
actionsExecutedSuccessfully && actionResult;
|
||||||
action->PerformAction();
|
|
||||||
} else {
|
} else {
|
||||||
vblog(LOG_INFO, "skipping disabled action %s",
|
vblog(LOG_INFO, "skipping disabled action %s",
|
||||||
action->GetId().c_str());
|
action->GetId().c_str());
|
||||||
@@ -933,9 +939,12 @@ bool Macro::Load(obs_data_t *obj)
|
|||||||
auto newEntry = MacroConditionFactory::Create(id, this);
|
auto newEntry = MacroConditionFactory::Create(id, this);
|
||||||
if (newEntry) {
|
if (newEntry) {
|
||||||
_conditions.emplace_back(newEntry);
|
_conditions.emplace_back(newEntry);
|
||||||
auto c = _conditions.back().get();
|
auto condition = _conditions.back().get();
|
||||||
c->Load(arrayObj);
|
condition->WithLock([&]() {
|
||||||
c->ValidateLogicSelection(root, Name().c_str());
|
condition->Load(arrayObj);
|
||||||
|
condition->ValidateLogicSelection(
|
||||||
|
root, Name().c_str());
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
blog(LOG_WARNING,
|
blog(LOG_WARNING,
|
||||||
"discarding condition entry with unknown id (%s) for macro %s",
|
"discarding condition entry with unknown id (%s) for macro %s",
|
||||||
@@ -948,12 +957,15 @@ bool Macro::Load(obs_data_t *obj)
|
|||||||
OBSDataArrayAutoRelease actions = obs_data_get_array(obj, "actions");
|
OBSDataArrayAutoRelease actions = obs_data_get_array(obj, "actions");
|
||||||
count = obs_data_array_count(actions);
|
count = obs_data_array_count(actions);
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
OBSDataAutoRelease array_obj = obs_data_array_item(actions, i);
|
OBSDataAutoRelease arrayObj = obs_data_array_item(actions, i);
|
||||||
std::string id = obs_data_get_string(array_obj, "id");
|
std::string id = obs_data_get_string(arrayObj, "id");
|
||||||
auto newEntry = MacroActionFactory::Create(id, this);
|
auto newEntry = MacroActionFactory::Create(id, this);
|
||||||
if (newEntry) {
|
if (newEntry) {
|
||||||
_actions.emplace_back(newEntry);
|
_actions.emplace_back(newEntry);
|
||||||
_actions.back()->Load(array_obj);
|
auto action = _actions.back().get();
|
||||||
|
action->WithLock([action, &arrayObj]() {
|
||||||
|
action->Load(arrayObj);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
blog(LOG_WARNING,
|
blog(LOG_WARNING,
|
||||||
"discarding action entry with unknown id (%s) for macro %s",
|
"discarding action entry with unknown id (%s) for macro %s",
|
||||||
@@ -966,13 +978,16 @@ bool Macro::Load(obs_data_t *obj)
|
|||||||
obs_data_get_array(obj, "elseActions");
|
obs_data_get_array(obj, "elseActions");
|
||||||
count = obs_data_array_count(elseActions);
|
count = obs_data_array_count(elseActions);
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
OBSDataAutoRelease array_obj =
|
OBSDataAutoRelease arrayObj =
|
||||||
obs_data_array_item(elseActions, i);
|
obs_data_array_item(elseActions, i);
|
||||||
std::string id = obs_data_get_string(array_obj, "id");
|
std::string id = obs_data_get_string(arrayObj, "id");
|
||||||
auto newEntry = MacroActionFactory::Create(id, this);
|
auto newEntry = MacroActionFactory::Create(id, this);
|
||||||
if (newEntry) {
|
if (newEntry) {
|
||||||
_elseActions.emplace_back(newEntry);
|
_elseActions.emplace_back(newEntry);
|
||||||
_elseActions.back()->Load(array_obj);
|
auto action = _elseActions.back().get();
|
||||||
|
action->WithLock([action, &arrayObj]() {
|
||||||
|
action->Load(arrayObj);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
blog(LOG_WARNING,
|
blog(LOG_WARNING,
|
||||||
"discarding elseAction entry with unknown id (%s) for macro %s",
|
"discarding elseAction entry with unknown id (%s) for macro %s",
|
||||||
@@ -989,13 +1004,13 @@ bool Macro::Load(obs_data_t *obj)
|
|||||||
bool Macro::PostLoad()
|
bool Macro::PostLoad()
|
||||||
{
|
{
|
||||||
for (auto &c : _conditions) {
|
for (auto &c : _conditions) {
|
||||||
c->PostLoad();
|
c->WithLock([c]() { c->PostLoad(); });
|
||||||
}
|
}
|
||||||
for (auto &a : _actions) {
|
for (auto &a : _actions) {
|
||||||
a->PostLoad();
|
a->WithLock([a]() { a->PostLoad(); });
|
||||||
}
|
}
|
||||||
for (auto &a : _elseActions) {
|
for (auto &a : _elseActions) {
|
||||||
a->PostLoad();
|
a->WithLock([a]() { a->PostLoad(); });
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
bool firstBoot = true;
|
bool firstBoot = true;
|
||||||
bool transitionActive = false;
|
bool transitionActive = false;
|
||||||
bool sceneColletionStop = false;
|
bool sceneCollectionStop = false;
|
||||||
bool obsIsShuttingDown = false;
|
bool obsIsShuttingDown = false;
|
||||||
bool firstInterval = true;
|
bool firstInterval = true;
|
||||||
bool firstIntervalAfterStop = true;
|
bool firstIntervalAfterStop = true;
|
||||||
|
|||||||
106
lib/utils/resizable-widget.cpp
Normal file
106
lib/utils/resizable-widget.cpp
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#include "resizable-widget.hpp"
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
ResizableWidget::ResizableWidget(QWidget *parent) : QWidget(parent) {}
|
||||||
|
|
||||||
|
void ResizableWidget::SetResizingEnabled(bool enable)
|
||||||
|
{
|
||||||
|
setMouseTracking(enable);
|
||||||
|
_customHeight = enable ? sizeHint().height() : 0;
|
||||||
|
auto pol = sizePolicy();
|
||||||
|
pol.setVerticalPolicy(enable ? QSizePolicy::Fixed
|
||||||
|
: QSizePolicy::Preferred);
|
||||||
|
_resizingEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResizableWidget::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (!_resizingEnabled) {
|
||||||
|
QWidget::mousePressEvent(event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsInResizeArea(event->pos())) {
|
||||||
|
_resizing = true;
|
||||||
|
_lastMousePos = event->globalPosition().toPoint();
|
||||||
|
event->accept();
|
||||||
|
} else {
|
||||||
|
QWidget::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResizableWidget::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (!_resizingEnabled) {
|
||||||
|
QWidget::mouseMoveEvent(event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_resizing) {
|
||||||
|
const int dy = event->globalPosition().toPoint().y() -
|
||||||
|
_lastMousePos.y();
|
||||||
|
const int baseHeight = _customHeight == 0 ? height()
|
||||||
|
: _customHeight;
|
||||||
|
const int newHeight = baseHeight + dy;
|
||||||
|
_customHeight =
|
||||||
|
std::clamp(newHeight, minimumHeight(), maximumHeight());
|
||||||
|
updateGeometry();
|
||||||
|
_lastMousePos = event->globalPosition().toPoint();
|
||||||
|
event->accept();
|
||||||
|
} else {
|
||||||
|
setCursor(IsInResizeArea(event->pos()) ? Qt::SizeVerCursor
|
||||||
|
: Qt::ArrowCursor);
|
||||||
|
QWidget::mouseMoveEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResizableWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (_resizing) {
|
||||||
|
event->accept();
|
||||||
|
_resizing = false;
|
||||||
|
} else {
|
||||||
|
QWidget::mouseReleaseEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResizableWidget::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
QWidget::paintEvent(event);
|
||||||
|
|
||||||
|
if (!_resizingEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a triangle in bottom-right as resize indicator
|
||||||
|
QPainter painter(this);
|
||||||
|
QPolygon triangle;
|
||||||
|
triangle << QPoint(width() - 1, height() - _gripSize)
|
||||||
|
<< QPoint(width() - _gripSize, height() - 1)
|
||||||
|
<< QPoint(width() - 1, height() - 1);
|
||||||
|
painter.setBrush(Qt::gray);
|
||||||
|
painter.drawPolygon(triangle);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize ResizableWidget::sizeHint() const
|
||||||
|
{
|
||||||
|
if (!_resizingEnabled) {
|
||||||
|
return QWidget::sizeHint();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_customHeight == 0) {
|
||||||
|
return QWidget::sizeHint();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QSize(width(), _customHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ResizableWidget::IsInResizeArea(const QPoint &pos) const
|
||||||
|
{
|
||||||
|
return QRect(width() - _gripSize, height() - _gripSize, _gripSize,
|
||||||
|
_gripSize)
|
||||||
|
.contains(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
34
lib/utils/resizable-widget.hpp
Normal file
34
lib/utils/resizable-widget.hpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
class ResizableWidget : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ResizableWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetResizingEnabled(bool enable);
|
||||||
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
QSize sizeHint() const override;
|
||||||
|
int GetCustomHeight() const { return _customHeight; }
|
||||||
|
void SetCustomHeight(int value) { _customHeight = value; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool IsInResizeArea(const QPoint &pos) const;
|
||||||
|
|
||||||
|
bool _resizingEnabled = false;
|
||||||
|
bool _resizing = false;
|
||||||
|
QPoint _lastMousePos;
|
||||||
|
int _customHeight = 0;
|
||||||
|
const int _gripSize = 15;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
@@ -314,12 +314,14 @@ SceneSelectionWidget::SceneSelectionWidget(QWidget *parent, bool variables,
|
|||||||
SLOT(SelectionChanged(int)));
|
SLOT(SelectionChanged(int)));
|
||||||
|
|
||||||
// Scene groups
|
// Scene groups
|
||||||
QWidget::connect(window(), SIGNAL(SceneGroupAdded(const QString &)),
|
QWidget::connect(GetSettingsWindow(),
|
||||||
this, SLOT(ItemAdd(const QString &)));
|
SIGNAL(SceneGroupAdded(const QString &)), this,
|
||||||
QWidget::connect(window(), SIGNAL(SceneGroupRemoved(const QString &)),
|
SLOT(ItemAdd(const QString &)));
|
||||||
this, SLOT(ItemRemove(const QString &)));
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(SceneGroupRemoved(const QString &)), this,
|
||||||
|
SLOT(ItemRemove(const QString &)));
|
||||||
QWidget::connect(
|
QWidget::connect(
|
||||||
window(),
|
GetSettingsWindow(),
|
||||||
SIGNAL(SceneGroupRenamed(const QString &, const QString &)),
|
SIGNAL(SceneGroupRenamed(const QString &, const QString &)),
|
||||||
this, SLOT(ItemRename(const QString &, const QString &)));
|
this, SLOT(ItemRename(const QString &, const QString &)));
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ Section::Section(const int animationDuration, QWidget *parent)
|
|||||||
|
|
||||||
void Section::Collapse(bool collapse)
|
void Section::Collapse(bool collapse)
|
||||||
{
|
{
|
||||||
|
if (_contentHeight != _content->sizeHint().height()) {
|
||||||
|
_contentHeight = _content->sizeHint().height();
|
||||||
|
}
|
||||||
|
SetupAnimations();
|
||||||
|
|
||||||
_toggleButton->setChecked(collapse);
|
_toggleButton->setChecked(collapse);
|
||||||
_toggleButton->setArrowType(collapse ? Qt::ArrowType::RightArrow
|
_toggleButton->setArrowType(collapse ? Qt::ArrowType::RightArrow
|
||||||
: Qt::ArrowType::DownArrow);
|
: Qt::ArrowType::DownArrow);
|
||||||
@@ -72,7 +77,7 @@ void Section::SetContent(QWidget *w, bool collapsed)
|
|||||||
delete _contentArea;
|
delete _contentArea;
|
||||||
|
|
||||||
// Setup contentArea
|
// Setup contentArea
|
||||||
_contentArea = new QScrollArea(this);
|
_contentArea = new QWidget(this);
|
||||||
_contentArea->setObjectName("macroSegmentContent");
|
_contentArea->setObjectName("macroSegmentContent");
|
||||||
_contentArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
_contentArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
_contentArea->setStyleSheet(
|
_contentArea->setStyleSheet(
|
||||||
@@ -93,12 +98,11 @@ void Section::SetContent(QWidget *w, bool collapsed)
|
|||||||
|
|
||||||
SetupAnimations();
|
SetupAnimations();
|
||||||
|
|
||||||
|
setMinimumHeight(_headerHeight);
|
||||||
if (collapsed) {
|
if (collapsed) {
|
||||||
this->setMinimumHeight(_headerHeight);
|
|
||||||
_contentArea->setMaximumHeight(0);
|
_contentArea->setMaximumHeight(0);
|
||||||
} else {
|
} else {
|
||||||
this->setMinimumHeight(_headerHeight + _contentHeight);
|
_contentArea->setMaximumHeight(QWIDGETSIZE_MAX);
|
||||||
_contentArea->setMaximumHeight(_contentHeight);
|
|
||||||
}
|
}
|
||||||
const QSignalBlocker b(_toggleButton);
|
const QSignalBlocker b(_toggleButton);
|
||||||
_toggleButton->setChecked(collapsed);
|
_toggleButton->setChecked(collapsed);
|
||||||
@@ -120,23 +124,6 @@ void Section::SetCollapsed(bool collapsed)
|
|||||||
Collapse(collapsed);
|
Collapse(collapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Section::eventFilter(QObject *obj, QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::Resize && !_transitioning && !_collapsed) {
|
|
||||||
if (_contentHeight != _content->sizeHint().height()) {
|
|
||||||
_contentHeight = _content->sizeHint().height();
|
|
||||||
setMaximumHeight(_headerHeight + _contentHeight);
|
|
||||||
setMinimumHeight(_headerHeight + _contentHeight);
|
|
||||||
_contentArea->setMaximumHeight(_contentHeight);
|
|
||||||
// Note: Calling this too frequently inside this event
|
|
||||||
// filter will cause a segfault for some reason
|
|
||||||
SetupAnimations();
|
|
||||||
}
|
|
||||||
setMinimumWidth(_content->sizeHint().width());
|
|
||||||
}
|
|
||||||
return QObject::eventFilter(obj, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Section::SetupAnimations()
|
void Section::SetupAnimations()
|
||||||
{
|
{
|
||||||
if (_toggleAnimation) {
|
if (_toggleAnimation) {
|
||||||
@@ -160,7 +147,7 @@ void Section::SetupAnimations()
|
|||||||
SectionAnimation->setEndValue(_headerHeight + _contentHeight);
|
SectionAnimation->setEndValue(_headerHeight + _contentHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPropertyAnimation *contentAnimation =
|
auto contentAnimation =
|
||||||
static_cast<QPropertyAnimation *>(_toggleAnimation->animationAt(
|
static_cast<QPropertyAnimation *>(_toggleAnimation->animationAt(
|
||||||
_toggleAnimation->animationCount() - 1));
|
_toggleAnimation->animationCount() - 1));
|
||||||
contentAnimation->setDuration(_animationDuration);
|
contentAnimation->setDuration(_animationDuration);
|
||||||
@@ -185,6 +172,14 @@ void Section::CleanUpPreviousContent()
|
|||||||
void Section::AnimationFinish()
|
void Section::AnimationFinish()
|
||||||
{
|
{
|
||||||
_transitioning = false;
|
_transitioning = false;
|
||||||
|
|
||||||
|
// Allow resizing if we are not currently transitioning or collapsed
|
||||||
|
if (!_collapsed) {
|
||||||
|
setMinimumHeight(0);
|
||||||
|
setMaximumHeight(QWIDGETSIZE_MAX);
|
||||||
|
_contentArea->setMaximumHeight(QWIDGETSIZE_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
emit AnimationFinished();
|
emit AnimationFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QParallelAnimationGroup>
|
#include <QParallelAnimationGroup>
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@@ -21,9 +20,6 @@ public:
|
|||||||
void AddHeaderWidget(QWidget *);
|
void AddHeaderWidget(QWidget *);
|
||||||
void SetCollapsed(bool);
|
void SetCollapsed(bool);
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void AnimationFinish();
|
void AnimationFinish();
|
||||||
void Collapse(bool collapse);
|
void Collapse(bool collapse);
|
||||||
@@ -41,7 +37,7 @@ private:
|
|||||||
QFrame *_headerLine;
|
QFrame *_headerLine;
|
||||||
QParallelAnimationGroup *_toggleAnimation = nullptr;
|
QParallelAnimationGroup *_toggleAnimation = nullptr;
|
||||||
QParallelAnimationGroup *_contentAnimation = nullptr;
|
QParallelAnimationGroup *_contentAnimation = nullptr;
|
||||||
QScrollArea *_contentArea = nullptr;
|
QWidget *_contentArea = nullptr;
|
||||||
QWidget *_content = nullptr;
|
QWidget *_content = nullptr;
|
||||||
int _animationDuration;
|
int _animationDuration;
|
||||||
std::atomic_bool _transitioning = {false};
|
std::atomic_bool _transitioning = {false};
|
||||||
|
|||||||
@@ -30,4 +30,36 @@ void LoadSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
|||||||
obs_data_array_release(array);
|
obs_data_array_release(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CenterSplitterPosition(QSplitter *splitter)
|
||||||
|
{
|
||||||
|
SetSplitterPositionByFraction(splitter, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetSplitterPositionByFraction(QSplitter *splitter, double fraction)
|
||||||
|
{
|
||||||
|
int value1 = (double)QWIDGETSIZE_MAX * fraction;
|
||||||
|
int value2 = (double)QWIDGETSIZE_MAX * (1.0 - fraction);
|
||||||
|
splitter->setSizes(QList<int>() << value1 << value2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaximizeFirstSplitterEntry(QSplitter *splitter)
|
||||||
|
{
|
||||||
|
QList<int> newSizes;
|
||||||
|
newSizes << QWIDGETSIZE_MAX;
|
||||||
|
for (int i = 0; i < splitter->sizes().size() - 1; i++) {
|
||||||
|
newSizes << 0;
|
||||||
|
}
|
||||||
|
splitter->setSizes(newSizes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReduceSizeOfSplitterIdx(QSplitter *splitter, int idx)
|
||||||
|
{
|
||||||
|
auto sizes = splitter->sizes();
|
||||||
|
int sum = sizes[0] + sizes[1];
|
||||||
|
int reducedSize = sum / 10;
|
||||||
|
sizes[idx] = reducedSize;
|
||||||
|
sizes[(idx + 1) % 2] = sum - reducedSize;
|
||||||
|
splitter->setSizes(sizes);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
#include "export-symbol-helper.hpp"
|
#include "export-symbol-helper.hpp"
|
||||||
|
|
||||||
#include <obs-data.h>
|
#include <obs-data.h>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QSplitter>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
@@ -12,4 +15,9 @@ void SaveSplitterPos(const QList<int> &sizes, obs_data_t *obj,
|
|||||||
void LoadSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
void LoadSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
||||||
const std::string &name);
|
const std::string &name);
|
||||||
|
|
||||||
|
void CenterSplitterPosition(QSplitter *splitter);
|
||||||
|
void SetSplitterPositionByFraction(QSplitter *splitter, double fraction);
|
||||||
|
void MaximizeFirstSplitterEntry(QSplitter *splitter);
|
||||||
|
void ReduceSizeOfSplitterIdx(QSplitter *splitter, int idx);
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -20,4 +20,36 @@ std::unique_lock<std::mutex> *GetLoopLock()
|
|||||||
return GetSwitcherLoopLock();
|
return GetSwitcherLoopLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PerInstanceMutex::PerInstanceMutex() {}
|
||||||
|
|
||||||
|
PerInstanceMutex::~PerInstanceMutex(){};
|
||||||
|
|
||||||
|
PerInstanceMutex::PerInstanceMutex(const PerInstanceMutex &) {}
|
||||||
|
|
||||||
|
PerInstanceMutex &PerInstanceMutex::operator=(const PerInstanceMutex &)
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
PerInstanceMutex::operator std::mutex &()
|
||||||
|
{
|
||||||
|
return _mtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
PerInstanceMutex::operator const std::mutex &() const
|
||||||
|
{
|
||||||
|
return _mtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> Lockable::Lock()
|
||||||
|
{
|
||||||
|
return std::lock_guard<std::mutex>(_mtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lockable::WithLock(const std::function<void()> &func)
|
||||||
|
{
|
||||||
|
const auto lock = Lock();
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "export-symbol-helper.hpp"
|
#include "export-symbol-helper.hpp"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
@@ -10,10 +12,46 @@ namespace advss {
|
|||||||
if (_loading || !_entryData) { \
|
if (_loading || !_entryData) { \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
auto lock = LockContext();
|
auto lock = _entryData->Lock();
|
||||||
|
|
||||||
[[nodiscard]] EXPORT std::mutex *GetMutex();
|
[[nodiscard]] EXPORT std::mutex *GetMutex();
|
||||||
[[nodiscard]] EXPORT std::lock_guard<std::mutex> LockContext();
|
[[nodiscard]] EXPORT std::lock_guard<std::mutex> LockContext();
|
||||||
[[nodiscard]] EXPORT std::unique_lock<std::mutex> *GetLoopLock();
|
[[nodiscard]] EXPORT std::unique_lock<std::mutex> *GetLoopLock();
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4251)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// std::mutex wrapper with no-op copy constructor and assignment operator
|
||||||
|
class EXPORT PerInstanceMutex {
|
||||||
|
public:
|
||||||
|
PerInstanceMutex();
|
||||||
|
~PerInstanceMutex();
|
||||||
|
PerInstanceMutex(const PerInstanceMutex &);
|
||||||
|
PerInstanceMutex &operator=(const PerInstanceMutex &);
|
||||||
|
|
||||||
|
operator std::mutex &();
|
||||||
|
operator const std::mutex &() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::mutex _mtx;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class EXPORT Lockable {
|
||||||
|
public:
|
||||||
|
Lockable() = default;
|
||||||
|
virtual ~Lockable() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] std::lock_guard<std::mutex> Lock();
|
||||||
|
void WithLock(const std::function<void()> &func);
|
||||||
|
|
||||||
|
private:
|
||||||
|
PerInstanceMutex _mtx;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ static std::vector<std::string> tabNames = {
|
|||||||
"videoTab", "sceneGroupTab", "transitionsTab", "pauseTab",
|
"videoTab", "sceneGroupTab", "transitionsTab", "pauseTab",
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<int> tabOrder = std::vector<int>(tabNames.size());
|
static std::vector<int> &getTabOrderVector()
|
||||||
|
{
|
||||||
|
static std::vector<int> tabOrder = std::vector<int>(tabNames.size());
|
||||||
|
return tabOrder;
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct TabCallbacks {
|
struct TabCallbacks {
|
||||||
@@ -65,19 +69,14 @@ void ResetLastOpenedTab()
|
|||||||
lastOpenedTab = -1;
|
lastOpenedTab = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveTabOrder(obs_data_t *obj)
|
|
||||||
{
|
|
||||||
OBSDataArrayAutoRelease tabWidgetOrder = obs_data_array_create();
|
|
||||||
for (size_t i = 0; i < tabNames.size(); i++) {
|
|
||||||
OBSDataAutoRelease entry = obs_data_create();
|
|
||||||
obs_data_set_int(entry, tabNames[i].c_str(), tabOrder[i]);
|
|
||||||
obs_data_array_push_back(tabWidgetOrder, entry);
|
|
||||||
}
|
|
||||||
obs_data_set_array(obj, "tabWidgetOrder", tabWidgetOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool tabWidgetOrderValid()
|
static bool tabWidgetOrderValid()
|
||||||
{
|
{
|
||||||
|
auto &tabOrder = getTabOrderVector();
|
||||||
|
|
||||||
|
if (tabNames.size() != tabOrder.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto tmp = std::vector<int>(tabNames.size());
|
auto tmp = std::vector<int>(tabNames.size());
|
||||||
std::iota(tmp.begin(), tmp.end(), 0);
|
std::iota(tmp.begin(), tmp.end(), 0);
|
||||||
|
|
||||||
@@ -92,10 +91,29 @@ static bool tabWidgetOrderValid()
|
|||||||
|
|
||||||
static void resetTabWidgetOrder()
|
static void resetTabWidgetOrder()
|
||||||
{
|
{
|
||||||
|
auto &tabOrder = getTabOrderVector();
|
||||||
tabOrder = std::vector<int>(tabNames.size());
|
tabOrder = std::vector<int>(tabNames.size());
|
||||||
std::iota(tabOrder.begin(), tabOrder.end(), 0);
|
std::iota(tabOrder.begin(), tabOrder.end(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveTabOrder(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
auto &tabOrder = getTabOrderVector();
|
||||||
|
|
||||||
|
// Can happen when corrupting settings files
|
||||||
|
if (!tabWidgetOrderValid()) {
|
||||||
|
resetTabWidgetOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
OBSDataArrayAutoRelease tabWidgetOrder = obs_data_array_create();
|
||||||
|
for (size_t i = 0; i < tabNames.size(); i++) {
|
||||||
|
OBSDataAutoRelease entry = obs_data_create();
|
||||||
|
obs_data_set_int(entry, tabNames[i].c_str(), tabOrder[i]);
|
||||||
|
obs_data_array_push_back(tabWidgetOrder, entry);
|
||||||
|
}
|
||||||
|
obs_data_set_array(obj, "tabWidgetOrder", tabWidgetOrder);
|
||||||
|
}
|
||||||
|
|
||||||
void LoadTabOrder(obs_data_t *obj)
|
void LoadTabOrder(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
OBSDataArrayAutoRelease defaultTabWidgetOrder = obs_data_array_create();
|
OBSDataArrayAutoRelease defaultTabWidgetOrder = obs_data_array_create();
|
||||||
@@ -107,6 +125,7 @@ void LoadTabOrder(obs_data_t *obj)
|
|||||||
obs_data_set_default_array(obj, "tabWidgetOrder",
|
obs_data_set_default_array(obj, "tabWidgetOrder",
|
||||||
defaultTabWidgetOrder);
|
defaultTabWidgetOrder);
|
||||||
|
|
||||||
|
auto &tabOrder = getTabOrderVector();
|
||||||
tabOrder.clear();
|
tabOrder.clear();
|
||||||
OBSDataArrayAutoRelease tabWidgetOrder =
|
OBSDataArrayAutoRelease tabWidgetOrder =
|
||||||
obs_data_get_array(obj, "tabWidgetOrder");
|
obs_data_get_array(obj, "tabWidgetOrder");
|
||||||
@@ -144,6 +163,8 @@ void SetTabOrder(QTabWidget *tabWidget)
|
|||||||
resetTabWidgetOrder();
|
resetTabWidgetOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto &tabOrder = getTabOrderVector();
|
||||||
|
|
||||||
auto bar = tabWidget->tabBar();
|
auto bar = tabWidget->tabBar();
|
||||||
for (int i = 0; i < bar->count(); ++i) {
|
for (int i = 0; i < bar->count(); ++i) {
|
||||||
int curPos = findTabIndex(tabWidget, tabOrder[i]);
|
int curPos = findTabIndex(tabWidget, tabOrder[i]);
|
||||||
@@ -153,9 +174,10 @@ void SetTabOrder(QTabWidget *tabWidget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget::connect(bar, &QTabBar::tabMoved, [](int from, int to) {
|
QWidget::connect(bar, &QTabBar::tabMoved,
|
||||||
std::swap(tabOrder[from], tabOrder[to]);
|
[&tabOrder](int from, int to) {
|
||||||
});
|
std::swap(tabOrder[from], tabOrder[to]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCurrentTab(QTabWidget *tabWidget)
|
void SetCurrentTab(QTabWidget *tabWidget)
|
||||||
|
|||||||
@@ -18,5 +18,6 @@ void SetCurrentTab(QTabWidget *tabWidget);
|
|||||||
void SetupOtherTabs(QTabWidget *tabWidget);
|
void SetupOtherTabs(QTabWidget *tabWidget);
|
||||||
void SaveTabOrder(obs_data_t *obj);
|
void SaveTabOrder(obs_data_t *obj);
|
||||||
void LoadTabOrder(obs_data_t *obj);
|
void LoadTabOrder(obs_data_t *obj);
|
||||||
|
bool MacroTabIsInFocus();
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -272,9 +272,10 @@ TempVariableSelection::TempVariableSelection(QWidget *parent)
|
|||||||
SLOT(SelectionIdxChanged(int)));
|
SLOT(SelectionIdxChanged(int)));
|
||||||
QWidget::connect(_selection, SIGNAL(highlighted(int)), this,
|
QWidget::connect(_selection, SIGNAL(highlighted(int)), this,
|
||||||
SLOT(HighlightChanged(int)));
|
SLOT(HighlightChanged(int)));
|
||||||
QWidget::connect(window(), SIGNAL(MacroSegmentOrderChanged()), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(MacroSegmentOrderChanged()), this,
|
||||||
SLOT(MacroSegmentsChanged()));
|
SLOT(MacroSegmentsChanged()));
|
||||||
QWidget::connect(window(),
|
QWidget::connect(GetSettingsWindow(),
|
||||||
SIGNAL(SegmentTempVarsChanged(MacroSegment *)), this,
|
SIGNAL(SegmentTempVarsChanged(MacroSegment *)), this,
|
||||||
SLOT(SegmentTempVarsChanged(MacroSegment *)));
|
SLOT(SegmentTempVarsChanged(MacroSegment *)));
|
||||||
|
|
||||||
@@ -334,7 +335,8 @@ void TempVariableSelection::HighlightChanged(int idx)
|
|||||||
|
|
||||||
void TempVariableSelection::PopulateSelection()
|
void TempVariableSelection::PopulateSelection()
|
||||||
{
|
{
|
||||||
auto advssWindow = qobject_cast<AdvSceneSwitcher *>(window());
|
auto advssWindow =
|
||||||
|
qobject_cast<AdvSceneSwitcher *>(GetSettingsWindow());
|
||||||
if (!advssWindow) {
|
if (!advssWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -367,7 +369,8 @@ void TempVariableSelection::PopulateSelection()
|
|||||||
|
|
||||||
void TempVariableSelection::HighlightSelection(const TempVariableRef &var)
|
void TempVariableSelection::HighlightSelection(const TempVariableRef &var)
|
||||||
{
|
{
|
||||||
auto advssWindow = qobject_cast<AdvSceneSwitcher *>(window());
|
auto advssWindow =
|
||||||
|
qobject_cast<AdvSceneSwitcher *>(GetSettingsWindow());
|
||||||
if (!advssWindow) {
|
if (!advssWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -394,7 +397,8 @@ QString TempVariableSelection::SetupInfoLabel()
|
|||||||
{
|
{
|
||||||
auto currentSelection = _selection->itemData(_selection->currentIndex())
|
auto currentSelection = _selection->itemData(_selection->currentIndex())
|
||||||
.value<TempVariableRef>();
|
.value<TempVariableRef>();
|
||||||
auto advssWindow = qobject_cast<AdvSceneSwitcher *>(window());
|
auto advssWindow =
|
||||||
|
qobject_cast<AdvSceneSwitcher *>(GetSettingsWindow());
|
||||||
if (!advssWindow) {
|
if (!advssWindow) {
|
||||||
_info->setToolTip("");
|
_info->setToolTip("");
|
||||||
_info->hide();
|
_info->hide();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <obs-frontend-api.h>
|
#include <obs-frontend-api.h>
|
||||||
#include <QGraphicsColorizeEffect>
|
#include <QGraphicsColorizeEffect>
|
||||||
|
#include <QListView>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
@@ -104,6 +105,19 @@ int FindIdxInRagne(QComboBox *list, int start, int stop,
|
|||||||
return foundIdx;
|
return foundIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetRowVisibleByValue(QComboBox *list, const QString &value, bool show)
|
||||||
|
{
|
||||||
|
int index = list->findText(value);
|
||||||
|
if (index == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto view = qobject_cast<QListView *>(list->view());
|
||||||
|
if (view) {
|
||||||
|
view->setRowHidden(index, !show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *GetSettingsWindow()
|
QWidget *GetSettingsWindow()
|
||||||
{
|
{
|
||||||
return SettingsWindowIsOpened() ? AdvSceneSwitcher::window : nullptr;
|
return SettingsWindowIsOpened() ? AdvSceneSwitcher::window : nullptr;
|
||||||
|
|||||||
@@ -20,9 +20,12 @@ EXPORT QObject *HighlightWidget(QWidget *widget, QColor startColor,
|
|||||||
|
|
||||||
EXPORT void SetHeightToContentHeight(QListWidget *list);
|
EXPORT void SetHeightToContentHeight(QListWidget *list);
|
||||||
EXPORT void SetButtonIcon(QAbstractButton *button, const char *path);
|
EXPORT void SetButtonIcon(QAbstractButton *button, const char *path);
|
||||||
|
|
||||||
EXPORT int
|
EXPORT int
|
||||||
FindIdxInRagne(QComboBox *list, int start, int stop, const std::string &value,
|
FindIdxInRagne(QComboBox *list, int start, int stop, const std::string &value,
|
||||||
Qt::MatchFlags = Qt::MatchExactly | Qt::MatchCaseSensitive);
|
Qt::MatchFlags = Qt::MatchExactly | Qt::MatchCaseSensitive);
|
||||||
|
EXPORT void SetRowVisibleByValue(QComboBox *list, const QString &value,
|
||||||
|
bool show);
|
||||||
|
|
||||||
EXPORT bool DisplayMessage(const QString &msg, bool question = false,
|
EXPORT bool DisplayMessage(const QString &msg, bool question = false,
|
||||||
bool modal = true);
|
bool modal = true);
|
||||||
|
|||||||
@@ -16,25 +16,28 @@ bool MacroActionAudio::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionAudio::Create, MacroActionAudioEdit::Create,
|
{MacroActionAudio::Create, MacroActionAudioEdit::Create,
|
||||||
"AdvSceneSwitcher.action.audio"});
|
"AdvSceneSwitcher.action.audio"});
|
||||||
|
|
||||||
static const std::map<MacroActionAudio::Action, std::string> actionTypes = {
|
static const std::vector<std::pair<MacroActionAudio::Action, std::string>>
|
||||||
{MacroActionAudio::Action::MUTE,
|
actionTypes = {
|
||||||
"AdvSceneSwitcher.action.audio.type.mute"},
|
{MacroActionAudio::Action::MUTE,
|
||||||
{MacroActionAudio::Action::UNMUTE,
|
"AdvSceneSwitcher.action.audio.type.mute"},
|
||||||
"AdvSceneSwitcher.action.audio.type.unmute"},
|
{MacroActionAudio::Action::UNMUTE,
|
||||||
{MacroActionAudio::Action::SOURCE_VOLUME,
|
"AdvSceneSwitcher.action.audio.type.unmute"},
|
||||||
"AdvSceneSwitcher.action.audio.type.sourceVolume"},
|
{MacroActionAudio::Action::TOGGLE_MUTE,
|
||||||
{MacroActionAudio::Action::MASTER_VOLUME,
|
"AdvSceneSwitcher.action.audio.type.toggleMute"},
|
||||||
"AdvSceneSwitcher.action.audio.type.masterVolume"},
|
{MacroActionAudio::Action::SOURCE_VOLUME,
|
||||||
{MacroActionAudio::Action::SYNC_OFFSET,
|
"AdvSceneSwitcher.action.audio.type.sourceVolume"},
|
||||||
"AdvSceneSwitcher.action.audio.type.syncOffset"},
|
{MacroActionAudio::Action::MASTER_VOLUME,
|
||||||
{MacroActionAudio::Action::MONITOR,
|
"AdvSceneSwitcher.action.audio.type.masterVolume"},
|
||||||
"AdvSceneSwitcher.action.audio.type.monitor"},
|
{MacroActionAudio::Action::SYNC_OFFSET,
|
||||||
{MacroActionAudio::Action::BALANCE,
|
"AdvSceneSwitcher.action.audio.type.syncOffset"},
|
||||||
"AdvSceneSwitcher.action.audio.type.balance"},
|
{MacroActionAudio::Action::MONITOR,
|
||||||
{MacroActionAudio::Action::ENABLE_ON_TRACK,
|
"AdvSceneSwitcher.action.audio.type.monitor"},
|
||||||
"AdvSceneSwitcher.action.audio.type.enableOnTrack"},
|
{MacroActionAudio::Action::BALANCE,
|
||||||
{MacroActionAudio::Action::DISABLE_ON_TRACK,
|
"AdvSceneSwitcher.action.audio.type.balance"},
|
||||||
"AdvSceneSwitcher.action.audio.type.disableOnTrack"},
|
{MacroActionAudio::Action::ENABLE_ON_TRACK,
|
||||||
|
"AdvSceneSwitcher.action.audio.type.enableOnTrack"},
|
||||||
|
{MacroActionAudio::Action::DISABLE_ON_TRACK,
|
||||||
|
"AdvSceneSwitcher.action.audio.type.disableOnTrack"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::map<MacroActionAudio::FadeType, std::string> fadeTypes = {
|
static const std::map<MacroActionAudio::FadeType, std::string> fadeTypes = {
|
||||||
@@ -255,6 +258,9 @@ bool MacroActionAudio::PerformAction()
|
|||||||
case Action::UNMUTE:
|
case Action::UNMUTE:
|
||||||
obs_source_set_muted(s, false);
|
obs_source_set_muted(s, false);
|
||||||
break;
|
break;
|
||||||
|
case Action::TOGGLE_MUTE:
|
||||||
|
obs_source_set_muted(s, !obs_source_muted(s));
|
||||||
|
break;
|
||||||
case Action::SOURCE_VOLUME:
|
case Action::SOURCE_VOLUME:
|
||||||
case Action::MASTER_VOLUME:
|
case Action::MASTER_VOLUME:
|
||||||
if (_fade) {
|
if (_fade) {
|
||||||
@@ -287,7 +293,10 @@ bool MacroActionAudio::PerformAction()
|
|||||||
|
|
||||||
void MacroActionAudio::LogAction() const
|
void MacroActionAudio::LogAction() const
|
||||||
{
|
{
|
||||||
auto it = actionTypes.find(_action);
|
auto it = std::find_if(
|
||||||
|
actionTypes.begin(), actionTypes.end(),
|
||||||
|
[this](const std::pair<MacroActionAudio::Action, std::string>
|
||||||
|
&item) { return item.first == _action; });
|
||||||
if (it != actionTypes.end()) {
|
if (it != actionTypes.end()) {
|
||||||
auto &[_, action] = *it;
|
auto &[_, action] = *it;
|
||||||
ablog(LOG_INFO,
|
ablog(LOG_INFO,
|
||||||
@@ -632,8 +641,7 @@ void MacroActionAudioEdit::SetWidgetVisibility()
|
|||||||
if (_entryData->_action != MacroActionAudio::Action::MASTER_VOLUME &&
|
if (_entryData->_action != MacroActionAudio::Action::MASTER_VOLUME &&
|
||||||
obs_get_version() >= MAKE_SEMANTIC_VERSION(29, 0, 0)) {
|
obs_get_version() >= MAKE_SEMANTIC_VERSION(29, 0, 0)) {
|
||||||
_actions->removeItem(_actions->findText(obs_module_text(
|
_actions->removeItem(_actions->findText(obs_module_text(
|
||||||
actionTypes.at(MacroActionAudio::Action::MASTER_VOLUME)
|
"AdvSceneSwitcher.action.audio.type.masterVolume")));
|
||||||
.c_str())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -666,11 +674,7 @@ void MacroActionAudioEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionAudioEdit::SourceChanged(const SourceSelection &source)
|
void MacroActionAudioEdit::SourceChanged(const SourceSelection &source)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_audioSource = source;
|
_entryData->_audioSource = source;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -678,11 +682,7 @@ void MacroActionAudioEdit::SourceChanged(const SourceSelection &source)
|
|||||||
|
|
||||||
void MacroActionAudioEdit::ActionChanged(int idx)
|
void MacroActionAudioEdit::ActionChanged(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionAudio::Action>(
|
_entryData->_action = static_cast<MacroActionAudio::Action>(
|
||||||
_actions->itemData(idx).toInt());
|
_actions->itemData(idx).toInt());
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -690,133 +690,81 @@ void MacroActionAudioEdit::ActionChanged(int idx)
|
|||||||
|
|
||||||
void MacroActionAudioEdit::SyncOffsetChanged(const NumberVariable<int> &value)
|
void MacroActionAudioEdit::SyncOffsetChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_syncOffset = value;
|
_entryData->_syncOffset = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::MonitorTypeChanged(int value)
|
void MacroActionAudioEdit::MonitorTypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_monitorType = static_cast<obs_monitoring_type>(value);
|
_entryData->_monitorType = static_cast<obs_monitoring_type>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::BalanceChanged(const NumberVariable<double> &value)
|
void MacroActionAudioEdit::BalanceChanged(const NumberVariable<double> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_balance = value;
|
_entryData->_balance = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::TrackChanged(const NumberVariable<int> &value)
|
void MacroActionAudioEdit::TrackChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_track = value;
|
_entryData->_track = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::VolumeDBChanged(const NumberVariable<double> &value)
|
void MacroActionAudioEdit::VolumeDBChanged(const NumberVariable<double> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_volumeDB = value;
|
_entryData->_volumeDB = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::PercentDBClicked()
|
void MacroActionAudioEdit::PercentDBClicked()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_useDb = !_entryData->_useDb;
|
_entryData->_useDb = !_entryData->_useDb;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::VolumeChanged(const NumberVariable<int> &value)
|
void MacroActionAudioEdit::VolumeChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_volume = value;
|
_entryData->_volume = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::FadeChanged(int value)
|
void MacroActionAudioEdit::FadeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_fade = value;
|
_entryData->_fade = value;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::DurationChanged(const Duration &dur)
|
void MacroActionAudioEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::RateChanged(const NumberVariable<double> &value)
|
void MacroActionAudioEdit::RateChanged(const NumberVariable<double> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_rate = value;
|
_entryData->_rate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::WaitChanged(int value)
|
void MacroActionAudioEdit::WaitChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_wait = value;
|
_entryData->_wait = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::AbortActiveFadeChanged(int value)
|
void MacroActionAudioEdit::AbortActiveFadeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_abortActiveFade = value;
|
_entryData->_abortActiveFade = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::FadeTypeChanged(int value)
|
void MacroActionAudioEdit::FadeTypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_fadeType = static_cast<MacroActionAudio::FadeType>(value);
|
_entryData->_fadeType = static_cast<MacroActionAudio::FadeType>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public:
|
|||||||
BALANCE,
|
BALANCE,
|
||||||
ENABLE_ON_TRACK,
|
ENABLE_ON_TRACK,
|
||||||
DISABLE_ON_TRACK,
|
DISABLE_ON_TRACK,
|
||||||
|
TOGGLE_MUTE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class FadeType {
|
enum class FadeType {
|
||||||
|
|||||||
@@ -214,11 +214,7 @@ MacroActionClipboardEdit::MacroActionClipboardEdit(
|
|||||||
|
|
||||||
void MacroActionClipboardEdit::ActionChanged(int index)
|
void MacroActionClipboardEdit::ActionChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionClipboard::Action>(
|
_entryData->_action = static_cast<MacroActionClipboard::Action>(
|
||||||
_actions->itemData(index).toInt());
|
_actions->itemData(index).toInt());
|
||||||
|
|
||||||
@@ -227,21 +223,13 @@ void MacroActionClipboardEdit::ActionChanged(int index)
|
|||||||
|
|
||||||
void MacroActionClipboardEdit::TextChanged()
|
void MacroActionClipboardEdit::TextChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_text = _text->text().toStdString();
|
_entryData->_text = _text->text().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionClipboardEdit::UrlChanged()
|
void MacroActionClipboardEdit::UrlChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_url = _url->text().toStdString();
|
_entryData->_url = _url->text().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,11 +153,7 @@ void MacroActionFileEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionFileEdit::PathChanged(const QString &text)
|
void MacroActionFileEdit::PathChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_file = text.toUtf8().constData();
|
_entryData->_file = text.toUtf8().constData();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -165,11 +161,7 @@ void MacroActionFileEdit::PathChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroActionFileEdit::TextChanged()
|
void MacroActionFileEdit::TextChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_text = _text->toPlainText().toStdString();
|
_entryData->_text = _text->toPlainText().toStdString();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -178,11 +170,7 @@ void MacroActionFileEdit::TextChanged()
|
|||||||
|
|
||||||
void MacroActionFileEdit::ActionChanged(int value)
|
void MacroActionFileEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionFile::Action>(value);
|
_entryData->_action = static_cast<MacroActionFile::Action>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "json-helpers.hpp"
|
#include "json-helpers.hpp"
|
||||||
#include "source-settings-helpers.hpp"
|
#include "source-settings-helpers.hpp"
|
||||||
#include "selection-helpers.hpp"
|
#include "selection-helpers.hpp"
|
||||||
|
#include "ui-helpers.hpp"
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
@@ -26,10 +27,13 @@ const static std::map<MacroActionFilter::Action, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.filter.type.pressSettingsButton"},
|
"AdvSceneSwitcher.action.filter.type.pressSettingsButton"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const static std::map<MacroActionFilter::SettingsInputMethod, std::string>
|
const static std::vector<
|
||||||
|
std::pair<MacroActionFilter::SettingsInputMethod, std::string>>
|
||||||
inputMethods = {
|
inputMethods = {
|
||||||
{MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL,
|
{MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL,
|
||||||
"AdvSceneSwitcher.action.filter.inputMethod.individualManual"},
|
"AdvSceneSwitcher.action.filter.inputMethod.individualManual"},
|
||||||
|
{MacroActionFilter::SettingsInputMethod::INDIVIDUAL_LIST_ENTRY,
|
||||||
|
"AdvSceneSwitcher.action.filter.inputMethod.individualListEntryManual"},
|
||||||
{MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR,
|
{MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR,
|
||||||
"AdvSceneSwitcher.action.filter.inputMethod.individualTempvar"},
|
"AdvSceneSwitcher.action.filter.inputMethod.individualTempvar"},
|
||||||
{MacroActionFilter::SettingsInputMethod::JSON_STRING,
|
{MacroActionFilter::SettingsInputMethod::JSON_STRING,
|
||||||
@@ -59,6 +63,10 @@ static void performActionHelper(
|
|||||||
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL:
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL:
|
||||||
SetSourceSetting(source, setting, manualSettingValue);
|
SetSourceSetting(source, setting, manualSettingValue);
|
||||||
break;
|
break;
|
||||||
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_LIST_ENTRY:
|
||||||
|
SetSourceSettingListEntryValueByName(
|
||||||
|
source, setting, manualSettingValue);
|
||||||
|
break;
|
||||||
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR: {
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR: {
|
||||||
auto var = tempVar.GetTempVariable(macro);
|
auto var = tempVar.GetTempVariable(macro);
|
||||||
if (!var) {
|
if (!var) {
|
||||||
@@ -373,14 +381,25 @@ void MacroActionFilterEdit::GetSettingsClicked()
|
|||||||
.value_or(""));
|
.value_or(""));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_LIST_ENTRY: {
|
||||||
|
const auto filters =
|
||||||
|
_entryData->_filter.GetFilters(_entryData->_source);
|
||||||
|
_manualSettingValue->setPlainText(
|
||||||
|
GetSourceSettingListEntryName(
|
||||||
|
filters.empty() ? nullptr : filters.at(0),
|
||||||
|
_entryData->_setting)
|
||||||
|
.value_or(""));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR:
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR:
|
||||||
break;
|
break;
|
||||||
case MacroActionFilter::SettingsInputMethod::JSON_STRING: {
|
case MacroActionFilter::SettingsInputMethod::JSON_STRING: {
|
||||||
const auto filters =
|
const auto filters =
|
||||||
_entryData->_filter.GetFilters(_entryData->_source);
|
_entryData->_filter.GetFilters(_entryData->_source);
|
||||||
|
const auto settings = GetSourceSettings(
|
||||||
|
filters.empty() ? nullptr : filters.at(0), true);
|
||||||
_settingsString->setPlainText(
|
_settingsString->setPlainText(
|
||||||
FormatJsonString(GetSourceSettings(
|
FormatJsonString(settings ? *settings : ""));
|
||||||
filters.empty() ? nullptr : filters.at(0))));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -415,6 +434,7 @@ void MacroActionFilterEdit::SelectionChanged(const SourceSetting &setting)
|
|||||||
{
|
{
|
||||||
GUARD_LOADING_AND_LOCK();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_setting = setting;
|
_entryData->_setting = setting;
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionFilterEdit::ManualSettingsValueChanged()
|
void MacroActionFilterEdit::ManualSettingsValueChanged()
|
||||||
@@ -440,6 +460,22 @@ void MacroActionFilterEdit::ButtonChanged(const SourceSettingButton &button)
|
|||||||
_entryData->_button = button;
|
_entryData->_button = button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString GetIndividualListEntryName()
|
||||||
|
{
|
||||||
|
static const auto matchesInput =
|
||||||
|
[](const std::pair<MacroActionFilter::SettingsInputMethod,
|
||||||
|
std::string> &p) {
|
||||||
|
return p.first ==
|
||||||
|
MacroActionFilter::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_LIST_ENTRY;
|
||||||
|
};
|
||||||
|
static const QString listValueText(
|
||||||
|
obs_module_text(std::find_if(inputMethods.begin(),
|
||||||
|
inputMethods.end(), matchesInput)
|
||||||
|
->second.c_str()));
|
||||||
|
return listValueText;
|
||||||
|
}
|
||||||
|
|
||||||
void MacroActionFilterEdit::SetWidgetVisibility()
|
void MacroActionFilterEdit::SetWidgetVisibility()
|
||||||
{
|
{
|
||||||
SetLayoutVisible(_settingsLayout,
|
SetLayoutVisible(_settingsLayout,
|
||||||
@@ -464,9 +500,16 @@ void MacroActionFilterEdit::SetWidgetVisibility()
|
|||||||
MacroActionFilter::SettingsInputMethod::
|
MacroActionFilter::SettingsInputMethod::
|
||||||
INDIVIDUAL_TEMPVAR);
|
INDIVIDUAL_TEMPVAR);
|
||||||
|
|
||||||
|
SetRowVisibleByValue(_settingsInputMethods,
|
||||||
|
GetIndividualListEntryName(),
|
||||||
|
_entryData->_setting.IsList());
|
||||||
|
|
||||||
if (_entryData->_action == MacroActionFilter::Action::SETTINGS &&
|
if (_entryData->_action == MacroActionFilter::Action::SETTINGS &&
|
||||||
_entryData->_settingsInputMethod ==
|
(_entryData->_settingsInputMethod ==
|
||||||
MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL) {
|
MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL ||
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionFilter::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_LIST_ENTRY)) {
|
||||||
RemoveStretchIfPresent(_settingsLayout);
|
RemoveStretchIfPresent(_settingsLayout);
|
||||||
_manualSettingValue->show();
|
_manualSettingValue->show();
|
||||||
} else {
|
} else {
|
||||||
@@ -475,8 +518,12 @@ void MacroActionFilterEdit::SetWidgetVisibility()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_refreshSettingSelection->setVisible(
|
_refreshSettingSelection->setVisible(
|
||||||
_entryData->_settingsInputMethod ==
|
(_entryData->_settingsInputMethod ==
|
||||||
MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL &&
|
MacroActionFilter::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_MANUAL ||
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionFilter::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_LIST_ENTRY) &&
|
||||||
(_entryData->_source.GetType() ==
|
(_entryData->_source.GetType() ==
|
||||||
SourceSelection::Type::VARIABLE ||
|
SourceSelection::Type::VARIABLE ||
|
||||||
_entryData->_filter.GetType() ==
|
_entryData->_filter.GetType() ==
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public:
|
|||||||
INDIVIDUAL_MANUAL,
|
INDIVIDUAL_MANUAL,
|
||||||
INDIVIDUAL_TEMPVAR,
|
INDIVIDUAL_TEMPVAR,
|
||||||
JSON_STRING,
|
JSON_STRING,
|
||||||
|
INDIVIDUAL_LIST_ENTRY,
|
||||||
};
|
};
|
||||||
SettingsInputMethod _settingsInputMethod =
|
SettingsInputMethod _settingsInputMethod =
|
||||||
SettingsInputMethod::INDIVIDUAL_MANUAL;
|
SettingsInputMethod::INDIVIDUAL_MANUAL;
|
||||||
|
|||||||
@@ -788,133 +788,82 @@ void MacroActionHotkeyEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionHotkeyEdit::LShiftChanged(int state)
|
void MacroActionHotkeyEdit::LShiftChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_leftShift = state;
|
_entryData->_leftShift = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::RShiftChanged(int state)
|
void MacroActionHotkeyEdit::RShiftChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_rightShift = state;
|
_entryData->_rightShift = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::LCtrlChanged(int state)
|
void MacroActionHotkeyEdit::LCtrlChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_leftCtrl = state;
|
_entryData->_leftCtrl = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::RCtrlChanged(int state)
|
void MacroActionHotkeyEdit::RCtrlChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_rightCtrl = state;
|
_entryData->_rightCtrl = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::LAltChanged(int state)
|
void MacroActionHotkeyEdit::LAltChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_leftAlt = state;
|
_entryData->_leftAlt = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::RAltChanged(int state)
|
void MacroActionHotkeyEdit::RAltChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_rightAlt = state;
|
_entryData->_rightAlt = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::LMetaChanged(int state)
|
void MacroActionHotkeyEdit::LMetaChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_leftMeta = state;
|
_entryData->_leftMeta = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::RMetaChanged(int state)
|
void MacroActionHotkeyEdit::RMetaChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_rightMeta = state;
|
_entryData->_rightMeta = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::DurationChanged(const Duration &dur)
|
void MacroActionHotkeyEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::OnlySendToOBSChanged(int state)
|
void MacroActionHotkeyEdit::OnlySendToOBSChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_onlySendToObs = state;
|
_entryData->_onlySendToObs = state;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::KeyChanged(int key)
|
void MacroActionHotkeyEdit::KeyChanged(int key)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_key = static_cast<HotkeyType>(key);
|
_entryData->_key = static_cast<HotkeyType>(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::ActionChanged(int value)
|
void MacroActionHotkeyEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionHotkey::Action>(value);
|
_entryData->_action = static_cast<MacroActionHotkey::Action>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::HotkeyTypeChanged(int value)
|
void MacroActionHotkeyEdit::HotkeyTypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_hotkeyType =
|
_entryData->_hotkeyType =
|
||||||
static_cast<obs_hotkey_registerer_type>(value);
|
static_cast<obs_hotkey_registerer_type>(value);
|
||||||
}
|
}
|
||||||
@@ -923,11 +872,7 @@ void MacroActionHotkeyEdit::HotkeyTypeChanged(int value)
|
|||||||
|
|
||||||
void MacroActionHotkeyEdit::OBSHotkeyChanged(int idx)
|
void MacroActionHotkeyEdit::OBSHotkeyChanged(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
_entryData->_hotkeyName = "";
|
_entryData->_hotkeyName = "";
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -238,54 +238,34 @@ void MacroActionHttpEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionHttpEdit::URLChanged()
|
void MacroActionHttpEdit::URLChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_url = _url->text().toStdString();
|
_entryData->_url = _url->text().toStdString();
|
||||||
emit(HeaderInfoChanged(_url->text()));
|
emit(HeaderInfoChanged(_url->text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHttpEdit::MethodChanged(int value)
|
void MacroActionHttpEdit::MethodChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_method = static_cast<MacroActionHttp::Method>(value);
|
_entryData->_method = static_cast<MacroActionHttp::Method>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHttpEdit::TimeoutChanged(const Duration &dur)
|
void MacroActionHttpEdit::TimeoutChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_timeout = dur;
|
_entryData->_timeout = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHttpEdit::SetHeadersChanged(int value)
|
void MacroActionHttpEdit::SetHeadersChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_setHeaders = value;
|
_entryData->_setHeaders = value;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHttpEdit::HeadersChanged(const StringList &headers)
|
void MacroActionHttpEdit::HeadersChanged(const StringList &headers)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_headers = headers;
|
_entryData->_headers = headers;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -302,11 +282,7 @@ void MacroActionHttpEdit::SetWidgetVisibility()
|
|||||||
|
|
||||||
void MacroActionHttpEdit::DataChanged()
|
void MacroActionHttpEdit::DataChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_data = _data->toPlainText().toUtf8().constData();
|
_entryData->_data = _data->toPlainText().toUtf8().constData();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|||||||
@@ -75,11 +75,7 @@ void MacroActionLogEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionLogEdit::LogMessageChanged()
|
void MacroActionLogEdit::LogMessageChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_logMessage = _logMessage->toPlainText().toStdString();
|
_entryData->_logMessage = _logMessage->toPlainText().toStdString();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|||||||
@@ -286,22 +286,14 @@ MacroActionMediaEdit::MacroActionMediaEdit(
|
|||||||
|
|
||||||
void MacroActionMediaEdit::ActionChanged(int value)
|
void MacroActionMediaEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionMedia::Action>(value);
|
_entryData->_action = static_cast<MacroActionMedia::Action>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMediaEdit::SelectionTypeChanged(int value)
|
void MacroActionMediaEdit::SelectionTypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_selection =
|
_entryData->_selection =
|
||||||
static_cast<MacroActionMedia::SelectionType>(value);
|
static_cast<MacroActionMedia::SelectionType>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -309,32 +301,20 @@ void MacroActionMediaEdit::SelectionTypeChanged(int value)
|
|||||||
|
|
||||||
void MacroActionMediaEdit::SeekDurationChanged(const Duration &seekDuration)
|
void MacroActionMediaEdit::SeekDurationChanged(const Duration &seekDuration)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_seekDuration = seekDuration;
|
_entryData->_seekDuration = seekDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMediaEdit::SeekPercentageChanged(
|
void MacroActionMediaEdit::SeekPercentageChanged(
|
||||||
const NumberVariable<double> &seekPercentage)
|
const NumberVariable<double> &seekPercentage)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_seekPercentage = seekPercentage;
|
_entryData->_seekPercentage = seekPercentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMediaEdit::SourceChanged(const SourceSelection &source)
|
void MacroActionMediaEdit::SourceChanged(const SourceSelection &source)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_mediaSource = source;
|
_entryData->_mediaSource = source;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -342,11 +322,7 @@ void MacroActionMediaEdit::SourceChanged(const SourceSelection &source)
|
|||||||
|
|
||||||
void MacroActionMediaEdit::SourceChanged(const SceneItemSelection &item)
|
void MacroActionMediaEdit::SourceChanged(const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_sceneItem = item;
|
_entryData->_sceneItem = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -356,11 +332,7 @@ void MacroActionMediaEdit::SourceChanged(const SceneItemSelection &item)
|
|||||||
|
|
||||||
void MacroActionMediaEdit::SceneChanged(const SceneSelection &scene)
|
void MacroActionMediaEdit::SceneChanged(const SceneSelection &scene)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_scene = scene;
|
_entryData->_scene = scene;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
|||||||
@@ -296,41 +296,25 @@ void MacroActionOSCEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionOSCEdit::IpChanged()
|
void MacroActionOSCEdit::IpChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetIP(_ip->text().toStdString());
|
_entryData->SetIP(_ip->text().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionOSCEdit::ProtocolChanged(int value)
|
void MacroActionOSCEdit::ProtocolChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetProtocol(static_cast<MacroActionOSC::Protocol>(value));
|
_entryData->SetProtocol(static_cast<MacroActionOSC::Protocol>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionOSCEdit::PortChanged(const NumberVariable<int> &value)
|
void MacroActionOSCEdit::PortChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetPortNr(value);
|
_entryData->SetPortNr(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionOSCEdit::MessageChanged(const OSCMessage &m)
|
void MacroActionOSCEdit::MessageChanged(const OSCMessage &m)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_message = m;
|
_entryData->_message = m;
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|||||||
@@ -300,12 +300,8 @@ void MacroActionPluginStateEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionPluginStateEdit::ActionChanged(int value)
|
void MacroActionPluginStateEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_action = static_cast<PluginStateAction>(value);
|
_entryData->_action = static_cast<PluginStateAction>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
@@ -316,32 +312,20 @@ void MacroActionPluginStateEdit::ActionChanged(int value)
|
|||||||
|
|
||||||
void MacroActionPluginStateEdit::ValueChanged(int value)
|
void MacroActionPluginStateEdit::ValueChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_value = value;
|
_entryData->_value = value;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionPluginStateEdit::SceneChanged(const QString &text)
|
void MacroActionPluginStateEdit::SceneChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_scene = GetWeakSourceByQString(text);
|
_entryData->_scene = GetWeakSourceByQString(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionPluginStateEdit::PathChanged(const QString &text)
|
void MacroActionPluginStateEdit::PathChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_settingsPath = text.toStdString();
|
_entryData->_settingsPath = text.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -242,9 +242,9 @@ MacroActionProjectorEdit::MacroActionProjectorEdit(
|
|||||||
_actions(new QComboBox()),
|
_actions(new QComboBox()),
|
||||||
_types(new QComboBox()),
|
_types(new QComboBox()),
|
||||||
_windowTypes(new QComboBox()),
|
_windowTypes(new QComboBox()),
|
||||||
_scenes(new SceneSelectionWidget(window(), true, false, true, true,
|
_scenes(new SceneSelectionWidget(this, true, false, true, true,
|
||||||
true)),
|
true)),
|
||||||
_sources(new SourceSelectionWidget(window(), getSourcesList, true)),
|
_sources(new SourceSelectionWidget(this, getSourcesList, true)),
|
||||||
_monitors(new MonitorSelectionWidget(this)),
|
_monitors(new MonitorSelectionWidget(this)),
|
||||||
_projectorWindowName(new VariableLineEdit(this)),
|
_projectorWindowName(new VariableLineEdit(this)),
|
||||||
_regex(new RegexConfigWidget(this)),
|
_regex(new RegexConfigWidget(this)),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "macro-action-random.hpp"
|
#include "macro-action-random.hpp"
|
||||||
#include "layout-helpers.hpp"
|
#include "layout-helpers.hpp"
|
||||||
#include "macro-helpers.hpp"
|
#include "macro-helpers.hpp"
|
||||||
|
#include "ui-helpers.hpp"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@@ -105,7 +106,8 @@ MacroActionRandomEdit::MacroActionRandomEdit(
|
|||||||
QWidget::connect(_list, SIGNAL(Removed(int)), this, SLOT(Remove(int)));
|
QWidget::connect(_list, SIGNAL(Removed(int)), this, SLOT(Remove(int)));
|
||||||
QWidget::connect(_list, SIGNAL(Replaced(int, const std::string &)),
|
QWidget::connect(_list, SIGNAL(Replaced(int, const std::string &)),
|
||||||
this, SLOT(Replace(int, const std::string &)));
|
this, SLOT(Replace(int, const std::string &)));
|
||||||
QWidget::connect(window(), SIGNAL(MacroRemoved(const QString &)), this,
|
QWidget::connect(GetSettingsWindow(),
|
||||||
|
SIGNAL(MacroRemoved(const QString &)), this,
|
||||||
SLOT(MacroRemove(const QString &)));
|
SLOT(MacroRemove(const QString &)));
|
||||||
QWidget::connect(_allowRepeat, SIGNAL(stateChanged(int)), this,
|
QWidget::connect(_allowRepeat, SIGNAL(stateChanged(int)), this,
|
||||||
SLOT(AllowRepeatChanged(int)));
|
SLOT(AllowRepeatChanged(int)));
|
||||||
@@ -157,11 +159,7 @@ void MacroActionRandomEdit::MacroRemove(const QString &)
|
|||||||
|
|
||||||
void MacroActionRandomEdit::Add(const std::string &name)
|
void MacroActionRandomEdit::Add(const std::string &name)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
MacroRef macro(name);
|
MacroRef macro(name);
|
||||||
_entryData->_macros.push_back(macro);
|
_entryData->_macros.push_back(macro);
|
||||||
_allowRepeat->setVisible(ShouldShowAllowRepeat());
|
_allowRepeat->setVisible(ShouldShowAllowRepeat());
|
||||||
@@ -170,11 +168,7 @@ void MacroActionRandomEdit::Add(const std::string &name)
|
|||||||
|
|
||||||
void MacroActionRandomEdit::Remove(int idx)
|
void MacroActionRandomEdit::Remove(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macros.erase(std::next(_entryData->_macros.begin(), idx));
|
_entryData->_macros.erase(std::next(_entryData->_macros.begin(), idx));
|
||||||
_allowRepeat->setVisible(ShouldShowAllowRepeat());
|
_allowRepeat->setVisible(ShouldShowAllowRepeat());
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -182,23 +176,15 @@ void MacroActionRandomEdit::Remove(int idx)
|
|||||||
|
|
||||||
void MacroActionRandomEdit::Replace(int idx, const std::string &name)
|
void MacroActionRandomEdit::Replace(int idx, const std::string &name)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MacroRef macro(name);
|
MacroRef macro(name);
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macros[idx] = macro;
|
_entryData->_macros[idx] = macro;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionRandomEdit::AllowRepeatChanged(int value)
|
void MacroActionRandomEdit::AllowRepeatChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_allowRepeat = value;
|
_entryData->_allowRepeat = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,21 +199,13 @@ static bool isPauseAction(MacroActionRecord::Action a)
|
|||||||
|
|
||||||
void MacroActionRecordEdit::FolderChanged(const QString &folder)
|
void MacroActionRecordEdit::FolderChanged(const QString &folder)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_folder = folder.toStdString();
|
_entryData->_folder = folder.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionRecordEdit::FormatStringChanged()
|
void MacroActionRecordEdit::FormatStringChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_fileFormat = _recordFileFormat->text().toStdString();
|
_entryData->_fileFormat = _recordFileFormat->text().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,11 +222,7 @@ void MacroActionRecordEdit::SetWidgetVisibility()
|
|||||||
|
|
||||||
void MacroActionRecordEdit::ActionChanged(int value)
|
void MacroActionRecordEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionRecord::Action>(value);
|
_entryData->_action = static_cast<MacroActionRecord::Action>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,11 +121,7 @@ void MacroActionSceneCollectionEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionSceneCollectionEdit::SceneCollectionChanged(const QString &text)
|
void MacroActionSceneCollectionEdit::SceneCollectionChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_sceneCollection = text.toStdString();
|
_entryData->_sceneCollection = text.toStdString();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ void MacroActionSceneLock::ResolveVariablesToFixedValues()
|
|||||||
MacroActionSceneLockEdit::MacroActionSceneLockEdit(
|
MacroActionSceneLockEdit::MacroActionSceneLockEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSceneLock> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSceneLock> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_scenes(new SceneSelectionWidget(window(), true, false, true, true)),
|
_scenes(new SceneSelectionWidget(this, true, false, true, true)),
|
||||||
_sources(new SceneItemSelectionWidget(parent)),
|
_sources(new SceneItemSelectionWidget(parent)),
|
||||||
_actions(new QComboBox())
|
_actions(new QComboBox())
|
||||||
{
|
{
|
||||||
@@ -156,21 +156,13 @@ void MacroActionSceneLockEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionSceneLockEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSceneLockEdit::SceneChanged(const SceneSelection &s)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneLockEdit::SourceChanged(const SceneItemSelection &item)
|
void MacroActionSceneLockEdit::SourceChanged(const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_source = item;
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -180,11 +172,7 @@ void MacroActionSceneLockEdit::SourceChanged(const SceneItemSelection &item)
|
|||||||
|
|
||||||
void MacroActionSceneLockEdit::ActionChanged(int value)
|
void MacroActionSceneLockEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionSceneLock::Action>(value);
|
_entryData->_action = static_cast<MacroActionSceneLock::Action>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ static inline void populateTypeSelection(QComboBox *list)
|
|||||||
MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSwitchScene> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSwitchScene> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_scenes(new SceneSelectionWidget(window(), true, true, true)),
|
_scenes(new SceneSelectionWidget(this, true, true, true)),
|
||||||
_transitions(new TransitionSelectionWidget(this)),
|
_transitions(new TransitionSelectionWidget(this)),
|
||||||
_duration(new DurationSelection(parent, false)),
|
_duration(new DurationSelection(parent, false)),
|
||||||
_blockUntilTransitionDone(new QCheckBox(obs_module_text(
|
_blockUntilTransitionDone(new QCheckBox(obs_module_text(
|
||||||
@@ -273,31 +273,19 @@ MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
|||||||
|
|
||||||
void MacroActionSwitchSceneEdit::DurationChanged(const Duration &dur)
|
void MacroActionSwitchSceneEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSwitchSceneEdit::BlockUntilTransitionDoneChanged(int state)
|
void MacroActionSwitchSceneEdit::BlockUntilTransitionDoneChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_blockUntilTransitionDone = state;
|
_entryData->_blockUntilTransitionDone = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSwitchSceneEdit::SceneTypeChanged(int value)
|
void MacroActionSwitchSceneEdit::SceneTypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_sceneType =
|
_entryData->_sceneType =
|
||||||
static_cast<MacroActionSwitchScene::SceneType>(value);
|
static_cast<MacroActionSwitchScene::SceneType>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -351,11 +339,7 @@ void MacroActionSwitchSceneEdit::SetWidgetVisibility()
|
|||||||
|
|
||||||
void MacroActionSwitchSceneEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSwitchSceneEdit::SceneChanged(const SceneSelection &s)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -363,11 +347,7 @@ void MacroActionSwitchSceneEdit::SceneChanged(const SceneSelection &s)
|
|||||||
|
|
||||||
void MacroActionSwitchSceneEdit::TransitionChanged(const TransitionSelection &t)
|
void MacroActionSwitchSceneEdit::TransitionChanged(const TransitionSelection &t)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_transition = t;
|
_entryData->_transition = t;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
MacroActionSceneTransformEdit::MacroActionSceneTransformEdit(
|
MacroActionSceneTransformEdit::MacroActionSceneTransformEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSceneTransform> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSceneTransform> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_scenes(new SceneSelectionWidget(window(), true, false, false, true)),
|
_scenes(new SceneSelectionWidget(this, true, false, false, true)),
|
||||||
_sources(new SceneItemSelectionWidget(parent)),
|
_sources(new SceneItemSelectionWidget(parent)),
|
||||||
_action(new QComboBox()),
|
_action(new QComboBox()),
|
||||||
_rotation(new VariableDoubleSpinBox()),
|
_rotation(new VariableDoubleSpinBox()),
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
MacroActionSceneVisibilityEdit::MacroActionSceneVisibilityEdit(
|
MacroActionSceneVisibilityEdit::MacroActionSceneVisibilityEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSceneVisibility> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSceneVisibility> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_scenes(new SceneSelectionWidget(window(), true, false, true, true)),
|
_scenes(new SceneSelectionWidget(this, true, false, true, true)),
|
||||||
_sources(new SceneItemSelectionWidget(parent)),
|
_sources(new SceneItemSelectionWidget(parent)),
|
||||||
_actions(new QComboBox())
|
_actions(new QComboBox())
|
||||||
{
|
{
|
||||||
@@ -170,22 +170,14 @@ void MacroActionSceneVisibilityEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SourceChanged(
|
void MacroActionSceneVisibilityEdit::SourceChanged(
|
||||||
const SceneItemSelection &item)
|
const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_source = item;
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -195,11 +187,7 @@ void MacroActionSceneVisibilityEdit::SourceChanged(
|
|||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::ActionChanged(int value)
|
void MacroActionSceneVisibilityEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action =
|
_entryData->_action =
|
||||||
static_cast<MacroActionSceneVisibility::Action>(value);
|
static_cast<MacroActionSceneVisibility::Action>(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ MacroActionSequenceEdit::MacroActionSequenceEdit(
|
|||||||
SLOT(ContinueFromClicked()));
|
SLOT(ContinueFromClicked()));
|
||||||
QWidget::connect(_restart, SIGNAL(stateChanged(int)), this,
|
QWidget::connect(_restart, SIGNAL(stateChanged(int)), this,
|
||||||
SLOT(RestartChanged(int)));
|
SLOT(RestartChanged(int)));
|
||||||
QWidget::connect(window(), SIGNAL(MacroRemoved(const QString &)), this,
|
QWidget::connect(this, SIGNAL(MacroRemoved(const QString &)), this,
|
||||||
SLOT(MacroRemove(const QString &)));
|
SLOT(MacroRemove(const QString &)));
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ActionChanged(int)));
|
SLOT(ActionChanged(int)));
|
||||||
@@ -279,11 +279,7 @@ void MacroActionSequenceEdit::MacroRemove(const QString &)
|
|||||||
|
|
||||||
void MacroActionSequenceEdit::Add(const std::string &name)
|
void MacroActionSequenceEdit::Add(const std::string &name)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
MacroRef macro(name);
|
MacroRef macro(name);
|
||||||
_entryData->_macros.push_back(macro);
|
_entryData->_macros.push_back(macro);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -291,39 +287,27 @@ void MacroActionSequenceEdit::Add(const std::string &name)
|
|||||||
|
|
||||||
void MacroActionSequenceEdit::Remove(int idx)
|
void MacroActionSequenceEdit::Remove(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macros.erase(std::next(_entryData->_macros.begin(), idx));
|
_entryData->_macros.erase(std::next(_entryData->_macros.begin(), idx));
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSequenceEdit::Up(int idx)
|
void MacroActionSequenceEdit::Up(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
std::swap(_entryData->_macros[idx], _entryData->_macros[idx - 1]);
|
std::swap(_entryData->_macros[idx], _entryData->_macros[idx - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSequenceEdit::Down(int idx)
|
void MacroActionSequenceEdit::Down(int idx)
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
std::swap(_entryData->_macros[idx], _entryData->_macros[idx + 1]);
|
std::swap(_entryData->_macros[idx], _entryData->_macros[idx + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSequenceEdit::Replace(int idx, const std::string &name)
|
void MacroActionSequenceEdit::Replace(int idx, const std::string &name)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MacroRef macro(name);
|
MacroRef macro(name);
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macros[idx] = macro;
|
_entryData->_macros[idx] = macro;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
@@ -344,11 +328,7 @@ void MacroActionSequenceEdit::ContinueFromClicked()
|
|||||||
|
|
||||||
void MacroActionSequenceEdit::RestartChanged(int state)
|
void MacroActionSequenceEdit::RestartChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_restart = state;
|
_entryData->_restart = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,32 +357,20 @@ void MacroActionSequenceEdit::UpdateStatusLine()
|
|||||||
|
|
||||||
void MacroActionSequenceEdit::ActionChanged(int value)
|
void MacroActionSequenceEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionSequence::Action>(value);
|
_entryData->_action = static_cast<MacroActionSequence::Action>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSequenceEdit::MacroChanged(const QString &text)
|
void MacroActionSequenceEdit::MacroChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macro = text;
|
_entryData->_macro = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSequenceEdit::ResetIndexChanged(const NumberVariable<int> &value)
|
void MacroActionSequenceEdit::ResetIndexChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_resetIndex = value;
|
_entryData->_resetIndex = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "json-helpers.hpp"
|
#include "json-helpers.hpp"
|
||||||
#include "selection-helpers.hpp"
|
#include "selection-helpers.hpp"
|
||||||
#include "source-settings-helpers.hpp"
|
#include "source-settings-helpers.hpp"
|
||||||
|
#include "ui-helpers.hpp"
|
||||||
|
|
||||||
#include <obs-frontend-api.h>
|
#include <obs-frontend-api.h>
|
||||||
|
|
||||||
@@ -67,10 +68,13 @@ const static std::map<obs_deinterlace_field_order, std::string>
|
|||||||
"AdvSceneSwitcher.action.source.deinterlaceOrder.bottomFieldFirst"},
|
"AdvSceneSwitcher.action.source.deinterlaceOrder.bottomFieldFirst"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const static std::map<MacroActionSource::SettingsInputMethod, std::string>
|
static const std::vector<
|
||||||
|
std::pair<MacroActionSource::SettingsInputMethod, std::string>>
|
||||||
inputMethods = {
|
inputMethods = {
|
||||||
{MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL,
|
{MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL,
|
||||||
"AdvSceneSwitcher.action.source.inputMethod.individualManual"},
|
"AdvSceneSwitcher.action.source.inputMethod.individualManual"},
|
||||||
|
{MacroActionSource::SettingsInputMethod::INDIVIDUAL_LIST_ENTRY,
|
||||||
|
"AdvSceneSwitcher.action.source.inputMethod.individualListEntryManual"},
|
||||||
{MacroActionSource::SettingsInputMethod::INDIVIDUAL_TEMPVAR,
|
{MacroActionSource::SettingsInputMethod::INDIVIDUAL_TEMPVAR,
|
||||||
"AdvSceneSwitcher.action.source.inputMethod.individualTempvar"},
|
"AdvSceneSwitcher.action.source.inputMethod.individualTempvar"},
|
||||||
{MacroActionSource::SettingsInputMethod::JSON_STRING,
|
{MacroActionSource::SettingsInputMethod::JSON_STRING,
|
||||||
@@ -119,6 +123,10 @@ bool MacroActionSource::PerformAction()
|
|||||||
case SettingsInputMethod::INDIVIDUAL_MANUAL:
|
case SettingsInputMethod::INDIVIDUAL_MANUAL:
|
||||||
SetSourceSetting(s, _setting, _manualSettingValue);
|
SetSourceSetting(s, _setting, _manualSettingValue);
|
||||||
break;
|
break;
|
||||||
|
case SettingsInputMethod::INDIVIDUAL_LIST_ENTRY:
|
||||||
|
SetSourceSettingListEntryValueByName(
|
||||||
|
s, _setting, _manualSettingValue);
|
||||||
|
break;
|
||||||
case SettingsInputMethod::INDIVIDUAL_TEMPVAR: {
|
case SettingsInputMethod::INDIVIDUAL_TEMPVAR: {
|
||||||
auto var = _tempVar.GetTempVariable(GetMacro());
|
auto var = _tempVar.GetTempVariable(GetMacro());
|
||||||
if (!var) {
|
if (!var) {
|
||||||
@@ -263,9 +271,8 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<typename T>
|
||||||
static inline void populateModeSelection(QComboBox *list,
|
static inline void populateModeSelection(QComboBox *list, const T &modes)
|
||||||
const std::map<T, std::string> &modes)
|
|
||||||
{
|
{
|
||||||
list->clear();
|
list->clear();
|
||||||
for (const auto &[value, name] : modes) {
|
for (const auto &[value, name] : modes) {
|
||||||
@@ -343,7 +350,7 @@ MacroActionSourceEdit::MacroActionSourceEdit(
|
|||||||
|
|
||||||
auto entryLayout = new QHBoxLayout;
|
auto entryLayout = new QHBoxLayout;
|
||||||
entryLayout->setContentsMargins(0, 0, 0, 0);
|
entryLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
const std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{sources}}", _sources},
|
{"{{sources}}", _sources},
|
||||||
{"{{actions}}", _actions},
|
{"{{actions}}", _actions},
|
||||||
{"{{settings}}", _sourceSettings},
|
{"{{settings}}", _sourceSettings},
|
||||||
@@ -405,12 +412,8 @@ void MacroActionSourceEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionSourceEdit::SourceChanged(const SourceSelection &source)
|
void MacroActionSourceEdit::SourceChanged(const SourceSelection &source)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_source = source;
|
_entryData->_source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,11 +451,20 @@ void MacroActionSourceEdit::GetSettingsClicked()
|
|||||||
_entryData->_setting)
|
_entryData->_setting)
|
||||||
.value_or(""));
|
.value_or(""));
|
||||||
break;
|
break;
|
||||||
|
case MacroActionSource::SettingsInputMethod::INDIVIDUAL_LIST_ENTRY:
|
||||||
|
_manualSettingValue->setPlainText(
|
||||||
|
GetSourceSettingListEntryName(
|
||||||
|
_entryData->_source.GetSource(),
|
||||||
|
_entryData->_setting)
|
||||||
|
.value_or(""));
|
||||||
|
break;
|
||||||
case MacroActionSource::SettingsInputMethod::INDIVIDUAL_TEMPVAR:
|
case MacroActionSource::SettingsInputMethod::INDIVIDUAL_TEMPVAR:
|
||||||
break;
|
break;
|
||||||
case MacroActionSource::SettingsInputMethod::JSON_STRING:
|
case MacroActionSource::SettingsInputMethod::JSON_STRING:
|
||||||
_settingsString->setPlainText(FormatJsonString(
|
const auto settings = GetSourceSettings(
|
||||||
GetSourceSettings(_entryData->_source.GetSource())));
|
_entryData->_source.GetSource(), true);
|
||||||
|
_settingsString->setPlainText(
|
||||||
|
FormatJsonString(settings ? *settings : ""));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -501,6 +513,7 @@ void MacroActionSourceEdit::SelectionChanged(const SourceSetting &setting)
|
|||||||
{
|
{
|
||||||
GUARD_LOADING_AND_LOCK();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_setting = setting;
|
_entryData->_setting = setting;
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSourceEdit::ManualSettingsValueChanged()
|
void MacroActionSourceEdit::ManualSettingsValueChanged()
|
||||||
@@ -518,6 +531,22 @@ void MacroActionSourceEdit::RefreshVariableSourceSelectionValue()
|
|||||||
_sourceSettings->SetSource(_entryData->_source.GetSource());
|
_sourceSettings->SetSource(_entryData->_source.GetSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString GetIndividualListEntryName()
|
||||||
|
{
|
||||||
|
static const auto matchesInput =
|
||||||
|
[](const std::pair<MacroActionSource::SettingsInputMethod,
|
||||||
|
std::string> &p) {
|
||||||
|
return p.first ==
|
||||||
|
MacroActionSource::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_LIST_ENTRY;
|
||||||
|
};
|
||||||
|
static const QString listValueText(
|
||||||
|
obs_module_text(std::find_if(inputMethods.begin(),
|
||||||
|
inputMethods.end(), matchesInput)
|
||||||
|
->second.c_str()));
|
||||||
|
return listValueText;
|
||||||
|
}
|
||||||
|
|
||||||
void MacroActionSourceEdit::SetWidgetVisibility()
|
void MacroActionSourceEdit::SetWidgetVisibility()
|
||||||
{
|
{
|
||||||
SetLayoutVisible(_settingsLayout,
|
SetLayoutVisible(_settingsLayout,
|
||||||
@@ -536,6 +565,11 @@ void MacroActionSourceEdit::SetWidgetVisibility()
|
|||||||
_entryData->_settingsInputMethod !=
|
_entryData->_settingsInputMethod !=
|
||||||
MacroActionSource::SettingsInputMethod::
|
MacroActionSource::SettingsInputMethod::
|
||||||
INDIVIDUAL_TEMPVAR);
|
INDIVIDUAL_TEMPVAR);
|
||||||
|
|
||||||
|
SetRowVisibleByValue(_settingsInputMethods,
|
||||||
|
GetIndividualListEntryName(),
|
||||||
|
_entryData->_setting.IsList());
|
||||||
|
|
||||||
_tempVars->setVisible(_entryData->_action ==
|
_tempVars->setVisible(_entryData->_action ==
|
||||||
MacroActionSource::Action::SETTINGS &&
|
MacroActionSource::Action::SETTINGS &&
|
||||||
_entryData->_settingsInputMethod ==
|
_entryData->_settingsInputMethod ==
|
||||||
@@ -543,8 +577,11 @@ void MacroActionSourceEdit::SetWidgetVisibility()
|
|||||||
INDIVIDUAL_TEMPVAR);
|
INDIVIDUAL_TEMPVAR);
|
||||||
|
|
||||||
if (_entryData->_action == MacroActionSource::Action::SETTINGS &&
|
if (_entryData->_action == MacroActionSource::Action::SETTINGS &&
|
||||||
_entryData->_settingsInputMethod ==
|
(_entryData->_settingsInputMethod ==
|
||||||
MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL) {
|
MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL ||
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionSource::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_LIST_ENTRY)) {
|
||||||
RemoveStretchIfPresent(_settingsLayout);
|
RemoveStretchIfPresent(_settingsLayout);
|
||||||
_manualSettingValue->show();
|
_manualSettingValue->show();
|
||||||
} else {
|
} else {
|
||||||
@@ -567,8 +604,12 @@ void MacroActionSourceEdit::SetWidgetVisibility()
|
|||||||
MacroActionSource::Action::DEINTERLACE_FIELD_ORDER);
|
MacroActionSource::Action::DEINTERLACE_FIELD_ORDER);
|
||||||
|
|
||||||
_refreshSettingSelection->setVisible(
|
_refreshSettingSelection->setVisible(
|
||||||
_entryData->_settingsInputMethod ==
|
(_entryData->_settingsInputMethod ==
|
||||||
MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL &&
|
MacroActionSource::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_MANUAL ||
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionSource::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_LIST_ENTRY) &&
|
||||||
_entryData->_source.GetType() ==
|
_entryData->_source.GetType() ==
|
||||||
SourceSelection::Type::VARIABLE);
|
SourceSelection::Type::VARIABLE);
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
INDIVIDUAL_MANUAL,
|
INDIVIDUAL_MANUAL,
|
||||||
INDIVIDUAL_TEMPVAR,
|
INDIVIDUAL_TEMPVAR,
|
||||||
JSON_STRING,
|
JSON_STRING,
|
||||||
|
INDIVIDUAL_LIST_ENTRY,
|
||||||
};
|
};
|
||||||
SettingsInputMethod _settingsInputMethod =
|
SettingsInputMethod _settingsInputMethod =
|
||||||
SettingsInputMethod::INDIVIDUAL_MANUAL;
|
SettingsInputMethod::INDIVIDUAL_MANUAL;
|
||||||
|
|||||||
@@ -236,21 +236,13 @@ void MacroActionStreamEdit::UpdateEntryData()
|
|||||||
void MacroActionStreamEdit::KeyFrameIntervalChanged(
|
void MacroActionStreamEdit::KeyFrameIntervalChanged(
|
||||||
const NumberVariable<int> &value)
|
const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_keyFrameInterval = value;
|
_entryData->_keyFrameInterval = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionStreamEdit::StringValueChanged()
|
void MacroActionStreamEdit::StringValueChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_stringValue = _stringValue->text().toStdString();
|
_entryData->_stringValue = _stringValue->text().toStdString();
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
@@ -303,11 +295,8 @@ void MacroActionStreamEdit::SetWidgetVisibility()
|
|||||||
|
|
||||||
void MacroActionStreamEdit::ActionChanged(int value)
|
void MacroActionStreamEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_action =
|
_entryData->_action =
|
||||||
static_cast<MacroActionStream::Action>(value);
|
static_cast<MacroActionStream::Action>(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const std::string MacroActionSudioMode::id = "studio_mode";
|
|||||||
|
|
||||||
bool MacroActionSudioMode::_registered = MacroActionFactory::Register(
|
bool MacroActionSudioMode::_registered = MacroActionFactory::Register(
|
||||||
MacroActionSudioMode::id,
|
MacroActionSudioMode::id,
|
||||||
{MacroActionSudioMode::Create, MacroActionSudioModeEdit::Create,
|
{MacroActionSudioMode::Create, MacroActionStudioModeEdit::Create,
|
||||||
"AdvSceneSwitcher.action.studioMode"});
|
"AdvSceneSwitcher.action.studioMode"});
|
||||||
|
|
||||||
const static std::map<MacroActionSudioMode::Action, std::string> actionTypes = {
|
const static std::map<MacroActionSudioMode::Action, std::string> actionTypes = {
|
||||||
@@ -124,11 +124,11 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroActionSudioModeEdit::MacroActionSudioModeEdit(
|
MacroActionStudioModeEdit::MacroActionStudioModeEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSudioMode> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSudioMode> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_actions(new QComboBox()),
|
_actions(new QComboBox()),
|
||||||
_scenes(new SceneSelectionWidget(window(), true, true, true, true))
|
_scenes(new SceneSelectionWidget(this, true, true, true, true))
|
||||||
{
|
{
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@@ -151,7 +151,7 @@ MacroActionSudioModeEdit::MacroActionSudioModeEdit(
|
|||||||
_loading = false;
|
_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSudioModeEdit::UpdateEntryData()
|
void MacroActionStudioModeEdit::UpdateEntryData()
|
||||||
{
|
{
|
||||||
if (!_entryData) {
|
if (!_entryData) {
|
||||||
return;
|
return;
|
||||||
@@ -162,19 +162,15 @@ void MacroActionSudioModeEdit::UpdateEntryData()
|
|||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSudioModeEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionStudioModeEdit::SceneChanged(const SceneSelection &s)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSudioModeEdit::SetWidgetVisibility()
|
void MacroActionStudioModeEdit::SetWidgetVisibility()
|
||||||
{
|
{
|
||||||
_scenes->setVisible(_entryData->_action ==
|
_scenes->setVisible(_entryData->_action ==
|
||||||
MacroActionSudioMode::Action::SET_SCENE);
|
MacroActionSudioMode::Action::SET_SCENE);
|
||||||
@@ -185,13 +181,9 @@ void MacroActionSudioModeEdit::SetWidgetVisibility()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSudioModeEdit::ActionChanged(int index)
|
void MacroActionStudioModeEdit::ActionChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionSudioMode::Action>(
|
_entryData->_action = static_cast<MacroActionSudioMode::Action>(
|
||||||
_actions->itemData(index).toInt());
|
_actions->itemData(index).toInt());
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
|
|||||||
@@ -32,18 +32,18 @@ private:
|
|||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroActionSudioModeEdit : public QWidget {
|
class MacroActionStudioModeEdit : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MacroActionSudioModeEdit(
|
MacroActionStudioModeEdit(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
std::shared_ptr<MacroActionSudioMode> entryData = nullptr);
|
std::shared_ptr<MacroActionSudioMode> entryData = nullptr);
|
||||||
void UpdateEntryData();
|
void UpdateEntryData();
|
||||||
static QWidget *Create(QWidget *parent,
|
static QWidget *Create(QWidget *parent,
|
||||||
std::shared_ptr<MacroAction> action)
|
std::shared_ptr<MacroAction> action)
|
||||||
{
|
{
|
||||||
return new MacroActionSudioModeEdit(
|
return new MacroActionStudioModeEdit(
|
||||||
parent, std::dynamic_pointer_cast<MacroActionSudioMode>(
|
parent, std::dynamic_pointer_cast<MacroActionSudioMode>(
|
||||||
action));
|
action));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ MacroActionSystrayEdit::MacroActionSystrayEdit(
|
|||||||
_message(new VariableLineEdit(this)),
|
_message(new VariableLineEdit(this)),
|
||||||
_title(new VariableLineEdit(this)),
|
_title(new VariableLineEdit(this)),
|
||||||
_iconPath(new FileSelection()),
|
_iconPath(new FileSelection()),
|
||||||
_trayDisableWarning(
|
_trayDisableWarning(new QLabel(
|
||||||
new QLabel("AdvSceneSwitcher.action.systray.disabled"))
|
obs_module_text("AdvSceneSwitcher.action.systray.disabled")))
|
||||||
{
|
{
|
||||||
_iconPath->setToolTip(
|
_iconPath->setToolTip(
|
||||||
obs_module_text("AdvSceneSwitcher.action.systray.iconHint"));
|
obs_module_text("AdvSceneSwitcher.action.systray.iconHint"));
|
||||||
@@ -152,11 +152,7 @@ void MacroActionSystrayEdit::CheckIfTrayIsDisabled()
|
|||||||
|
|
||||||
void MacroActionSystrayEdit::MessageChanged()
|
void MacroActionSystrayEdit::MessageChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_message = _message->text().toStdString();
|
_entryData->_message = _message->text().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,11 +185,7 @@ void MacroActionTimerEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionTimerEdit::ActionTypeChanged(int value)
|
void MacroActionTimerEdit::ActionTypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_actionType = static_cast<MacroActionTimer::Action>(value);
|
_entryData->_actionType = static_cast<MacroActionTimer::Action>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
@@ -206,21 +202,13 @@ void MacroActionTimerEdit::SetWidgetVisibility()
|
|||||||
|
|
||||||
void MacroActionTimerEdit::DurationChanged(const Duration &dur)
|
void MacroActionTimerEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionTimerEdit::MacroChanged(const QString &text)
|
void MacroActionTimerEdit::MacroChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_macro = text;
|
_entryData->_macro = text;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
|||||||
@@ -318,11 +318,7 @@ void MacroActionTransitionEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionTransitionEdit::SourceChanged(const SceneItemSelection &item)
|
void MacroActionTransitionEdit::SourceChanged(const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_source = item;
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -332,11 +328,7 @@ void MacroActionTransitionEdit::SourceChanged(const SceneItemSelection &item)
|
|||||||
|
|
||||||
void MacroActionTransitionEdit::ActionChanged(int value)
|
void MacroActionTransitionEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_type = static_cast<MacroActionTransition::Type>(value);
|
_entryData->_type = static_cast<MacroActionTransition::Type>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
@@ -345,11 +337,7 @@ void MacroActionTransitionEdit::ActionChanged(int value)
|
|||||||
|
|
||||||
void MacroActionTransitionEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionTransitionEdit::SceneChanged(const SceneSelection &s)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -357,11 +345,7 @@ void MacroActionTransitionEdit::SceneChanged(const SceneSelection &s)
|
|||||||
|
|
||||||
void MacroActionTransitionEdit::TransitionChanged(const TransitionSelection &t)
|
void MacroActionTransitionEdit::TransitionChanged(const TransitionSelection &t)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_transition = t;
|
_entryData->_transition = t;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -369,11 +353,7 @@ void MacroActionTransitionEdit::TransitionChanged(const TransitionSelection &t)
|
|||||||
|
|
||||||
void MacroActionTransitionEdit::DurationChanged(const Duration &dur)
|
void MacroActionTransitionEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,11 +369,7 @@ void MacroActionTransitionEdit::SetWidgetVisibility()
|
|||||||
|
|
||||||
void MacroActionTransitionEdit::SetTransitionChanged(int state)
|
void MacroActionTransitionEdit::SetTransitionChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_setTransitionType = state;
|
_entryData->_setTransitionType = state;
|
||||||
_transitions->setEnabled(state);
|
_transitions->setEnabled(state);
|
||||||
if (state) {
|
if (state) {
|
||||||
@@ -406,11 +382,7 @@ void MacroActionTransitionEdit::SetTransitionChanged(int state)
|
|||||||
|
|
||||||
void MacroActionTransitionEdit::SetDurationChanged(int state)
|
void MacroActionTransitionEdit::SetDurationChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_setDuration = state;
|
_entryData->_setDuration = state;
|
||||||
_duration->setEnabled(state);
|
_duration->setEnabled(state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,11 +117,7 @@ void MacroActionVCamEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionVCamEdit::ActionChanged(int value)
|
void MacroActionVCamEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MacroActionVCam::Action>(value);
|
_entryData->_action = static_cast<MacroActionVCam::Action>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,11 +196,7 @@ void MacroActionWaitEdit::SetupRandomDurationEdit()
|
|||||||
|
|
||||||
void MacroActionWaitEdit::TypeChanged(int value)
|
void MacroActionWaitEdit::TypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
auto type = static_cast<MacroActionWait::Type>(value);
|
auto type = static_cast<MacroActionWait::Type>(value);
|
||||||
|
|
||||||
if (type == MacroActionWait::Type::FIXED) {
|
if (type == MacroActionWait::Type::FIXED) {
|
||||||
@@ -216,11 +212,7 @@ void MacroActionWaitEdit::TypeChanged(int value)
|
|||||||
|
|
||||||
void MacroActionWaitEdit::DurationChanged(const Duration &dur)
|
void MacroActionWaitEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -228,11 +220,7 @@ void MacroActionWaitEdit::DurationChanged(const Duration &dur)
|
|||||||
|
|
||||||
void MacroActionWaitEdit::Duration2Changed(const Duration &dur)
|
void MacroActionWaitEdit::Duration2Changed(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration2 = dur;
|
_entryData->_duration2 = dur;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
|||||||
@@ -303,12 +303,8 @@ void MacroActionWebsocketEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroActionWebsocketEdit::APITypeChanged(int index)
|
void MacroActionWebsocketEdit::APITypeChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_api =
|
_entryData->_api =
|
||||||
static_cast<MacroActionWebsocket::API>(index);
|
static_cast<MacroActionWebsocket::API>(index);
|
||||||
}
|
}
|
||||||
@@ -339,11 +335,7 @@ void MacroActionWebsocketEdit::APITypeChanged(int index)
|
|||||||
|
|
||||||
void MacroActionWebsocketEdit::MessageTypeChanged(int index)
|
void MacroActionWebsocketEdit::MessageTypeChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_type =
|
_entryData->_type =
|
||||||
static_cast<MacroActionWebsocket::MessageType>(index);
|
static_cast<MacroActionWebsocket::MessageType>(index);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -353,11 +345,7 @@ void MacroActionWebsocketEdit::MessageTypeChanged(int index)
|
|||||||
|
|
||||||
void MacroActionWebsocketEdit::MessageChanged()
|
void MacroActionWebsocketEdit::MessageChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_message = _message->toPlainText().toUtf8().constData();
|
_entryData->_message = _message->toPlainText().toUtf8().constData();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -367,11 +355,7 @@ void MacroActionWebsocketEdit::MessageChanged()
|
|||||||
void MacroActionWebsocketEdit::ConnectionSelectionChanged(
|
void MacroActionWebsocketEdit::ConnectionSelectionChanged(
|
||||||
const QString &connection)
|
const QString &connection)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_connection = GetWeakConnectionByQString(connection);
|
_entryData->_connection = GetWeakConnectionByQString(connection);
|
||||||
CheckForSettingsConflict();
|
CheckForSettingsConflict();
|
||||||
emit(HeaderInfoChanged(connection));
|
emit(HeaderInfoChanged(connection));
|
||||||
|
|||||||
@@ -568,12 +568,8 @@ void MacroConditionAudioEdit::UpdateVolmeterSource()
|
|||||||
|
|
||||||
void MacroConditionAudioEdit::SourceChanged(const SourceSelection &source)
|
void MacroConditionAudioEdit::SourceChanged(const SourceSelection &source)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_audioSource = source;
|
_entryData->_audioSource = source;
|
||||||
_entryData->ResetVolmeter();
|
_entryData->ResetVolmeter();
|
||||||
}
|
}
|
||||||
@@ -586,11 +582,8 @@ void MacroConditionAudioEdit::SourceChanged(const SourceSelection &source)
|
|||||||
void MacroConditionAudioEdit::VolumePercentChanged(
|
void MacroConditionAudioEdit::VolumePercentChanged(
|
||||||
const NumberVariable<double> &vol)
|
const NumberVariable<double> &vol)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_volumePercent = vol;
|
_entryData->_volumePercent = vol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,42 +592,27 @@ void MacroConditionAudioEdit::VolumePercentChanged(
|
|||||||
|
|
||||||
void MacroConditionAudioEdit::SyncOffsetChanged(const NumberVariable<int> &value)
|
void MacroConditionAudioEdit::SyncOffsetChanged(const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_syncOffset = value;
|
_entryData->_syncOffset = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionAudioEdit::MonitorTypeChanged(int value)
|
void MacroConditionAudioEdit::MonitorTypeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_monitorType = static_cast<obs_monitoring_type>(value);
|
_entryData->_monitorType = static_cast<obs_monitoring_type>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionAudioEdit::BalanceChanged(const NumberVariable<double> &value)
|
void MacroConditionAudioEdit::BalanceChanged(const NumberVariable<double> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_balance = value;
|
_entryData->_balance = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionAudioEdit::VolumeDBChanged(
|
void MacroConditionAudioEdit::VolumeDBChanged(
|
||||||
const NumberVariable<double> &value)
|
const NumberVariable<double> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_volumeDB = value;
|
_entryData->_volumeDB = value;
|
||||||
}
|
}
|
||||||
SyncSliderAndValueSelection(false);
|
SyncSliderAndValueSelection(false);
|
||||||
@@ -642,11 +620,7 @@ void MacroConditionAudioEdit::VolumeDBChanged(
|
|||||||
|
|
||||||
void MacroConditionAudioEdit::PercentDBClicked()
|
void MacroConditionAudioEdit::PercentDBClicked()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_useDb = !_entryData->_useDb;
|
_entryData->_useDb = !_entryData->_useDb;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
@@ -706,11 +680,7 @@ void MacroConditionAudioEdit::ConditionChanged(int cond)
|
|||||||
|
|
||||||
void MacroConditionAudioEdit::CheckTypeChanged(int idx)
|
void MacroConditionAudioEdit::CheckTypeChanged(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetType(static_cast<MacroConditionAudio::Type>(
|
_entryData->SetType(static_cast<MacroConditionAudio::Type>(
|
||||||
_checkTypes->itemData(idx).toInt()));
|
_checkTypes->itemData(idx).toInt()));
|
||||||
|
|
||||||
|
|||||||
@@ -240,11 +240,7 @@ MacroConditionClipboardEdit::Create(QWidget *parent,
|
|||||||
|
|
||||||
void MacroConditionClipboardEdit::ConditionChanged(int value)
|
void MacroConditionClipboardEdit::ConditionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetCondition(
|
_entryData->SetCondition(
|
||||||
static_cast<MacroConditionClipboard::Condition>(value));
|
static_cast<MacroConditionClipboard::Condition>(value));
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -252,11 +248,7 @@ void MacroConditionClipboardEdit::ConditionChanged(int value)
|
|||||||
|
|
||||||
void MacroConditionClipboardEdit::TextChanged()
|
void MacroConditionClipboardEdit::TextChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_text = _text->toPlainText().toStdString();
|
_entryData->_text = _text->toPlainText().toStdString();
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -264,11 +256,7 @@ void MacroConditionClipboardEdit::TextChanged()
|
|||||||
|
|
||||||
void MacroConditionClipboardEdit::RegexChanged(const RegexConfig &conf)
|
void MacroConditionClipboardEdit::RegexChanged(const RegexConfig &conf)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_regex = conf;
|
_entryData->_regex = conf;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|||||||
@@ -225,11 +225,7 @@ MacroConditionCursorEdit::MacroConditionCursorEdit(
|
|||||||
|
|
||||||
void MacroConditionCursorEdit::ConditionChanged(int index)
|
void MacroConditionCursorEdit::ConditionChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_condition = static_cast<MacroConditionCursor::Condition>(
|
_entryData->_condition = static_cast<MacroConditionCursor::Condition>(
|
||||||
_conditions->itemData(index).toInt());
|
_conditions->itemData(index).toInt());
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -237,55 +233,35 @@ void MacroConditionCursorEdit::ConditionChanged(int index)
|
|||||||
|
|
||||||
void MacroConditionCursorEdit::ButtonChanged(int index)
|
void MacroConditionCursorEdit::ButtonChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_button = static_cast<MacroConditionCursor::Button>(
|
_entryData->_button = static_cast<MacroConditionCursor::Button>(
|
||||||
_buttons->itemData(index).toInt());
|
_buttons->itemData(index).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionCursorEdit::MinXChanged(const NumberVariable<int> &pos)
|
void MacroConditionCursorEdit::MinXChanged(const NumberVariable<int> &pos)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_minX = pos;
|
_entryData->_minX = pos;
|
||||||
SetupFrame();
|
SetupFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionCursorEdit::MinYChanged(const NumberVariable<int> &pos)
|
void MacroConditionCursorEdit::MinYChanged(const NumberVariable<int> &pos)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_minY = pos;
|
_entryData->_minY = pos;
|
||||||
SetupFrame();
|
SetupFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionCursorEdit::MaxXChanged(const NumberVariable<int> &pos)
|
void MacroConditionCursorEdit::MaxXChanged(const NumberVariable<int> &pos)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_maxX = pos;
|
_entryData->_maxX = pos;
|
||||||
SetupFrame();
|
SetupFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionCursorEdit::MaxYChanged(const NumberVariable<int> &pos)
|
void MacroConditionCursorEdit::MaxYChanged(const NumberVariable<int> &pos)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_maxY = pos;
|
_entryData->_maxY = pos;
|
||||||
SetupFrame();
|
SetupFrame();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -517,11 +517,7 @@ MacroConditionDateEdit::MacroConditionDateEdit(
|
|||||||
|
|
||||||
void MacroConditionDateEdit::DayOfWeekChanged(int day)
|
void MacroConditionDateEdit::DayOfWeekChanged(int day)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_dayOfWeek = static_cast<MacroConditionDate::Day>(day);
|
_entryData->_dayOfWeek = static_cast<MacroConditionDate::Day>(day);
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -529,11 +525,7 @@ void MacroConditionDateEdit::DayOfWeekChanged(int day)
|
|||||||
|
|
||||||
void MacroConditionDateEdit::ConditionChanged(int cond)
|
void MacroConditionDateEdit::ConditionChanged(int cond)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_condition =
|
_entryData->_condition =
|
||||||
static_cast<MacroConditionDate::Condition>(cond);
|
static_cast<MacroConditionDate::Condition>(cond);
|
||||||
SetWidgetStatus();
|
SetWidgetStatus();
|
||||||
@@ -543,11 +535,7 @@ void MacroConditionDateEdit::ConditionChanged(int cond)
|
|||||||
|
|
||||||
void MacroConditionDateEdit::DateChanged(const QDate &date)
|
void MacroConditionDateEdit::DateChanged(const QDate &date)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetDate1(date);
|
_entryData->SetDate1(date);
|
||||||
|
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
@@ -556,11 +544,7 @@ void MacroConditionDateEdit::DateChanged(const QDate &date)
|
|||||||
|
|
||||||
void MacroConditionDateEdit::TimeChanged(const QTime &time)
|
void MacroConditionDateEdit::TimeChanged(const QTime &time)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetTime1(time);
|
_entryData->SetTime1(time);
|
||||||
|
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
@@ -569,53 +553,33 @@ void MacroConditionDateEdit::TimeChanged(const QTime &time)
|
|||||||
|
|
||||||
void MacroConditionDateEdit::Date2Changed(const QDate &date)
|
void MacroConditionDateEdit::Date2Changed(const QDate &date)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetDate2(date);
|
_entryData->SetDate2(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDateEdit::Time2Changed(const QTime &time)
|
void MacroConditionDateEdit::Time2Changed(const QTime &time)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetTime2(time);
|
_entryData->SetTime2(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDateEdit::IgnoreDateChanged(int state)
|
void MacroConditionDateEdit::IgnoreDateChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_ignoreDate = !state;
|
_entryData->_ignoreDate = !state;
|
||||||
SetWidgetStatus();
|
SetWidgetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDateEdit::IgnoreTimeChanged(int state)
|
void MacroConditionDateEdit::IgnoreTimeChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_ignoreTime = !state;
|
_entryData->_ignoreTime = !state;
|
||||||
SetWidgetStatus();
|
SetWidgetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDateEdit::RepeatChanged(int state)
|
void MacroConditionDateEdit::RepeatChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_repeat = state;
|
_entryData->_repeat = state;
|
||||||
_duration->setDisabled(!state);
|
_duration->setDisabled(!state);
|
||||||
SetWidgetStatus();
|
SetWidgetStatus();
|
||||||
@@ -623,31 +587,20 @@ void MacroConditionDateEdit::RepeatChanged(int state)
|
|||||||
|
|
||||||
void MacroConditionDateEdit::UpdateOnRepeatChanged(int state)
|
void MacroConditionDateEdit::UpdateOnRepeatChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_updateOnRepeat = state;
|
_entryData->_updateOnRepeat = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDateEdit::DurationChanged(const Duration &dur)
|
void MacroConditionDateEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDateEdit::AdvancedSettingsToggleClicked()
|
void MacroConditionDateEdit::AdvancedSettingsToggleClicked()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_dayOfWeekCheck = !_entryData->_dayOfWeekCheck;
|
_entryData->_dayOfWeekCheck = !_entryData->_dayOfWeekCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -313,11 +313,7 @@ MacroConditionDisplayEdit::MacroConditionDisplayEdit(
|
|||||||
|
|
||||||
void MacroConditionDisplayEdit::ConditionChanged(int value)
|
void MacroConditionDisplayEdit::ConditionChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetCondition(
|
_entryData->SetCondition(
|
||||||
static_cast<MacroConditionDisplay::Condition>(value));
|
static_cast<MacroConditionDisplay::Condition>(value));
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -325,32 +321,20 @@ void MacroConditionDisplayEdit::ConditionChanged(int value)
|
|||||||
|
|
||||||
void MacroConditionDisplayEdit::CompareModeChanged(int value)
|
void MacroConditionDisplayEdit::CompareModeChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_compare =
|
_entryData->_compare =
|
||||||
static_cast<MacroConditionDisplay::CompareMode>(value);
|
static_cast<MacroConditionDisplay::CompareMode>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDisplayEdit::DisplayNameChanged(const QString &display)
|
void MacroConditionDisplayEdit::DisplayNameChanged(const QString &display)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_displayName = display.toStdString();
|
_entryData->_displayName = display.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDisplayEdit::RegexChanged(const RegexConfig &conf)
|
void MacroConditionDisplayEdit::RegexChanged(const RegexConfig &conf)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_regexConf = conf;
|
_entryData->_regexConf = conf;
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -360,43 +344,27 @@ void MacroConditionDisplayEdit::RegexChanged(const RegexConfig &conf)
|
|||||||
void MacroConditionDisplayEdit::DisplayCountChanged(
|
void MacroConditionDisplayEdit::DisplayCountChanged(
|
||||||
const NumberVariable<int> &value)
|
const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_displayCount = value;
|
_entryData->_displayCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDisplayEdit::DisplayWidthChanged(
|
void MacroConditionDisplayEdit::DisplayWidthChanged(
|
||||||
const NumberVariable<int> &value)
|
const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_displayWidth = value;
|
_entryData->_displayWidth = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDisplayEdit::DisplayHeightChanged(
|
void MacroConditionDisplayEdit::DisplayHeightChanged(
|
||||||
const NumberVariable<int> &value)
|
const NumberVariable<int> &value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_displayHeight = value;
|
_entryData->_displayHeight = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionDisplayEdit::UseDevicePixelRatioChanged(int state)
|
void MacroConditionDisplayEdit::UseDevicePixelRatioChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_useDevicePixelRatio = state;
|
_entryData->_useDevicePixelRatio = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -357,11 +357,7 @@ void MacroConditionFileEdit::FileTypeChanged(int index)
|
|||||||
|
|
||||||
void MacroConditionFileEdit::ConditionChanged(int index)
|
void MacroConditionFileEdit::ConditionChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetCondition(
|
_entryData->SetCondition(
|
||||||
static_cast<MacroConditionFile::Condition>(index));
|
static_cast<MacroConditionFile::Condition>(index));
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -369,11 +365,7 @@ void MacroConditionFileEdit::ConditionChanged(int index)
|
|||||||
|
|
||||||
void MacroConditionFileEdit::PathChanged(const QString &text)
|
void MacroConditionFileEdit::PathChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_file = text.toUtf8().constData();
|
_entryData->_file = text.toUtf8().constData();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -381,11 +373,7 @@ void MacroConditionFileEdit::PathChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroConditionFileEdit::MatchTextChanged()
|
void MacroConditionFileEdit::MatchTextChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_text = _matchText->toPlainText().toUtf8().constData();
|
_entryData->_text = _matchText->toPlainText().toUtf8().constData();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -394,11 +382,7 @@ void MacroConditionFileEdit::MatchTextChanged()
|
|||||||
|
|
||||||
void MacroConditionFileEdit::RegexChanged(const RegexConfig &conf)
|
void MacroConditionFileEdit::RegexChanged(const RegexConfig &conf)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_regex = conf;
|
_entryData->_regex = conf;
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -406,21 +390,13 @@ void MacroConditionFileEdit::RegexChanged(const RegexConfig &conf)
|
|||||||
|
|
||||||
void MacroConditionFileEdit::CheckModificationDateChanged(int state)
|
void MacroConditionFileEdit::CheckModificationDateChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_useTime = state;
|
_entryData->_useTime = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFileEdit::OnlyMatchIfChangedChanged(int state)
|
void MacroConditionFileEdit::OnlyMatchIfChangedChanged(int state)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_onlyMatchIfChanged = state;
|
_entryData->_onlyMatchIfChanged = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "text-helpers.hpp"
|
#include "text-helpers.hpp"
|
||||||
#include "source-settings-helpers.hpp"
|
#include "source-settings-helpers.hpp"
|
||||||
#include "selection-helpers.hpp"
|
#include "selection-helpers.hpp"
|
||||||
|
#include "ui-helpers.hpp"
|
||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ bool MacroConditionFilter::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionFilter::Create, MacroConditionFilterEdit::Create,
|
{MacroConditionFilter::Create, MacroConditionFilterEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.filter"});
|
"AdvSceneSwitcher.condition.filter"});
|
||||||
|
|
||||||
const static std::map<MacroConditionFilter::Condition, std::string>
|
static const std::vector<std::pair<MacroConditionFilter::Condition, std::string>>
|
||||||
filterConditionTypes = {
|
filterConditionTypes = {
|
||||||
{MacroConditionFilter::Condition::ENABLED,
|
{MacroConditionFilter::Condition::ENABLED,
|
||||||
"AdvSceneSwitcher.condition.filter.type.active"},
|
"AdvSceneSwitcher.condition.filter.type.active"},
|
||||||
@@ -30,6 +31,9 @@ const static std::map<MacroConditionFilter::Condition, std::string>
|
|||||||
"AdvSceneSwitcher.condition.filter.type.individualSettingMatches"},
|
"AdvSceneSwitcher.condition.filter.type.individualSettingMatches"},
|
||||||
{MacroConditionFilter::Condition::INDIVIDUAL_SETTING_CHANGED,
|
{MacroConditionFilter::Condition::INDIVIDUAL_SETTING_CHANGED,
|
||||||
"AdvSceneSwitcher.condition.filter.type.individualSettingChanged"},
|
"AdvSceneSwitcher.condition.filter.type.individualSettingChanged"},
|
||||||
|
{MacroConditionFilter::Condition::
|
||||||
|
INDIVIDUAL_SETTING_LIST_ENTRY_MATCH,
|
||||||
|
"AdvSceneSwitcher.condition.filter.type.individualSettingListSelectionMatches"},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MacroConditionFilter::CheckConditionHelper(const OBSWeakSource &filter)
|
bool MacroConditionFilter::CheckConditionHelper(const OBSWeakSource &filter)
|
||||||
@@ -48,18 +52,28 @@ bool MacroConditionFilter::CheckConditionHelper(const OBSWeakSource &filter)
|
|||||||
ret = !obs_source_enabled(filterSource);
|
ret = !obs_source_enabled(filterSource);
|
||||||
break;
|
break;
|
||||||
case Condition::SETTINGS_MATCH: {
|
case Condition::SETTINGS_MATCH: {
|
||||||
ret = CompareSourceSettings(filter, _settings, _regex);
|
const auto settings =
|
||||||
const auto settings = GetSourceSettings(filter);
|
GetSourceSettings(filter, _includeDefaults);
|
||||||
SetVariableValue(settings);
|
if (!settings) {
|
||||||
SetTempVarValue("settings", settings);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CompareSourceSettings(*settings, _settings, _regex);
|
||||||
|
SetVariableValue(*settings);
|
||||||
|
SetTempVarValue("settings", *settings);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Condition::SETTINGS_CHANGED: {
|
case Condition::SETTINGS_CHANGED: {
|
||||||
const auto settings = GetSourceSettings(filter);
|
const auto settings =
|
||||||
ret = !_currentSettings.empty() && settings != _currentSettings;
|
GetSourceSettings(filter, _includeDefaults);
|
||||||
|
ret = _currentSettings.has_value() &&
|
||||||
|
settings != _currentSettings;
|
||||||
_currentSettings = settings;
|
_currentSettings = settings;
|
||||||
SetVariableValue(settings);
|
if (!settings) {
|
||||||
SetTempVarValue("settings", settings);
|
break;
|
||||||
|
}
|
||||||
|
SetVariableValue(*settings);
|
||||||
|
SetTempVarValue("settings", *settings);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Condition::INDIVIDUAL_SETTING_MATCH: {
|
case Condition::INDIVIDUAL_SETTING_MATCH: {
|
||||||
@@ -73,6 +87,18 @@ bool MacroConditionFilter::CheckConditionHelper(const OBSWeakSource &filter)
|
|||||||
SetTempVarValue("setting", *value);
|
SetTempVarValue("setting", *value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case Condition::INDIVIDUAL_SETTING_LIST_ENTRY_MATCH: {
|
||||||
|
const auto entryName =
|
||||||
|
GetSourceSettingListEntryName(filter, _setting);
|
||||||
|
if (!entryName) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ret = _regex.Enabled() ? _regex.Matches(*entryName, _settings)
|
||||||
|
: entryName == std::string(_settings);
|
||||||
|
SetVariableValue(*entryName);
|
||||||
|
SetTempVarValue("setting", *entryName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case Condition::INDIVIDUAL_SETTING_CHANGED: {
|
case Condition::INDIVIDUAL_SETTING_CHANGED: {
|
||||||
auto value = GetSourceSettingValue(filter, _setting);
|
auto value = GetSourceSettingValue(filter, _setting);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
@@ -118,6 +144,7 @@ bool MacroConditionFilter::Save(obs_data_t *obj) const
|
|||||||
_settings.Save(obj, "settings");
|
_settings.Save(obj, "settings");
|
||||||
_regex.Save(obj);
|
_regex.Save(obj);
|
||||||
_setting.Save(obj);
|
_setting.Save(obj);
|
||||||
|
obs_data_set_bool(obj, "includeDefaults", _includeDefaults);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,6 +163,7 @@ bool MacroConditionFilter::Load(obs_data_t *obj)
|
|||||||
obs_data_get_bool(obj, "regex"));
|
obs_data_get_bool(obj, "regex"));
|
||||||
}
|
}
|
||||||
_setting.Load(obj);
|
_setting.Load(obj);
|
||||||
|
_includeDefaults = obs_data_get_bool(obj, "includeDefaults");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +196,7 @@ void MacroConditionFilter::SetupTempVars()
|
|||||||
"AdvSceneSwitcher.tempVar.filter.settings"));
|
"AdvSceneSwitcher.tempVar.filter.settings"));
|
||||||
break;
|
break;
|
||||||
case Condition::INDIVIDUAL_SETTING_MATCH:
|
case Condition::INDIVIDUAL_SETTING_MATCH:
|
||||||
|
case Condition::INDIVIDUAL_SETTING_LIST_ENTRY_MATCH:
|
||||||
case Condition::INDIVIDUAL_SETTING_CHANGED:
|
case Condition::INDIVIDUAL_SETTING_CHANGED:
|
||||||
AddTempvar("setting",
|
AddTempvar("setting",
|
||||||
obs_module_text(
|
obs_module_text(
|
||||||
@@ -180,8 +209,9 @@ void MacroConditionFilter::SetupTempVars()
|
|||||||
|
|
||||||
static inline void populateConditionSelection(QComboBox *list)
|
static inline void populateConditionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (const auto &[_, name] : filterConditionTypes) {
|
for (const auto &[value, name] : filterConditionTypes) {
|
||||||
list->addItem(obs_module_text(name.c_str()));
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,8 +233,12 @@ MacroConditionFilterEdit::MacroConditionFilterEdit(
|
|||||||
_settings(new VariableTextEdit(this)),
|
_settings(new VariableTextEdit(this)),
|
||||||
_regex(new RegexConfigWidget(parent)),
|
_regex(new RegexConfigWidget(parent)),
|
||||||
_settingSelection(new SourceSettingSelection()),
|
_settingSelection(new SourceSettingSelection()),
|
||||||
_refreshSettingSelection(new QPushButton(
|
_refreshSettingSelection(new QPushButton(obs_module_text(
|
||||||
obs_module_text("AdvSceneSwitcher.condition.filter.refresh")))
|
"AdvSceneSwitcher.condition.filter.refresh"))),
|
||||||
|
_includeDefaults(new QCheckBox(
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.filter.includeDefaults"),
|
||||||
|
this))
|
||||||
{
|
{
|
||||||
populateConditionSelection(_conditions);
|
populateConditionSelection(_conditions);
|
||||||
|
|
||||||
@@ -231,8 +265,10 @@ MacroConditionFilterEdit::MacroConditionFilterEdit(
|
|||||||
SLOT(SettingSelectionChanged(const SourceSetting &)));
|
SLOT(SettingSelectionChanged(const SourceSetting &)));
|
||||||
QWidget::connect(_refreshSettingSelection, SIGNAL(clicked()), this,
|
QWidget::connect(_refreshSettingSelection, SIGNAL(clicked()), this,
|
||||||
SLOT(RefreshVariableSourceSelectionValue()));
|
SLOT(RefreshVariableSourceSelectionValue()));
|
||||||
|
QWidget::connect(_includeDefaults, SIGNAL(stateChanged(int)), this,
|
||||||
|
SLOT(IncludeDefaultsChanged(int)));
|
||||||
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
const std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{sources}}", _sources},
|
{"{{sources}}", _sources},
|
||||||
{"{{filters}}", _filters},
|
{"{{filters}}", _filters},
|
||||||
{"{{conditions}}", _conditions},
|
{"{{conditions}}", _conditions},
|
||||||
@@ -262,6 +298,7 @@ MacroConditionFilterEdit::MacroConditionFilterEdit(
|
|||||||
mainLayout->addLayout(line1Layout);
|
mainLayout->addLayout(line1Layout);
|
||||||
mainLayout->addLayout(line2Layout);
|
mainLayout->addLayout(line2Layout);
|
||||||
mainLayout->addLayout(line3Layout);
|
mainLayout->addLayout(line3Layout);
|
||||||
|
mainLayout->addWidget(_includeDefaults);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
@@ -271,22 +308,14 @@ MacroConditionFilterEdit::MacroConditionFilterEdit(
|
|||||||
|
|
||||||
void MacroConditionFilterEdit::SourceChanged(const SourceSelection &source)
|
void MacroConditionFilterEdit::SourceChanged(const SourceSelection &source)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_source = source;
|
_entryData->_source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFilterEdit::FilterChanged(const FilterSelection &filter)
|
void MacroConditionFilterEdit::FilterChanged(const FilterSelection &filter)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
GUARD_LOADING_AND_LOCK();
|
||||||
_entryData->_filter = filter;
|
_entryData->_filter = filter;
|
||||||
}
|
}
|
||||||
const auto filters =
|
const auto filters =
|
||||||
@@ -299,13 +328,9 @@ void MacroConditionFilterEdit::FilterChanged(const FilterSelection &filter)
|
|||||||
|
|
||||||
void MacroConditionFilterEdit::ConditionChanged(int index)
|
void MacroConditionFilterEdit::ConditionChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
_entryData->SetCondition(static_cast<MacroConditionFilter::Condition>(
|
||||||
}
|
_conditions->itemData(index).toInt()));
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetCondition(
|
|
||||||
static_cast<MacroConditionFilter::Condition>(index));
|
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +351,19 @@ void MacroConditionFilterEdit::GetSettingsClicked()
|
|||||||
QString value;
|
QString value;
|
||||||
if (_entryData->GetCondition() ==
|
if (_entryData->GetCondition() ==
|
||||||
MacroConditionFilter::Condition::SETTINGS_MATCH) {
|
MacroConditionFilter::Condition::SETTINGS_MATCH) {
|
||||||
value = FormatJsonString(GetSourceSettings(filters.at(0)));
|
const auto settings = GetSourceSettings(
|
||||||
|
filters.at(0), _entryData->_includeDefaults);
|
||||||
|
if (settings) {
|
||||||
|
value = FormatJsonString(*settings);
|
||||||
|
}
|
||||||
|
} else if (_entryData->GetCondition() ==
|
||||||
|
MacroConditionFilter::Condition::
|
||||||
|
INDIVIDUAL_SETTING_LIST_ENTRY_MATCH) {
|
||||||
|
value = QString::fromStdString(
|
||||||
|
GetSourceSettingListEntryName(
|
||||||
|
filters.empty() ? nullptr : filters.at(0),
|
||||||
|
_entryData->_setting)
|
||||||
|
.value_or(""));
|
||||||
} else {
|
} else {
|
||||||
value = QString::fromStdString(
|
value = QString::fromStdString(
|
||||||
GetSourceSettingValue(filters.at(0),
|
GetSourceSettingValue(filters.at(0),
|
||||||
@@ -342,11 +379,7 @@ void MacroConditionFilterEdit::GetSettingsClicked()
|
|||||||
|
|
||||||
void MacroConditionFilterEdit::SettingsChanged()
|
void MacroConditionFilterEdit::SettingsChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_settings = _settings->toPlainText().toStdString();
|
_entryData->_settings = _settings->toPlainText().toStdString();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -355,11 +388,7 @@ void MacroConditionFilterEdit::SettingsChanged()
|
|||||||
|
|
||||||
void MacroConditionFilterEdit::RegexChanged(const RegexConfig &conf)
|
void MacroConditionFilterEdit::RegexChanged(const RegexConfig &conf)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_regex = conf;
|
_entryData->_regex = conf;
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -369,12 +398,9 @@ void MacroConditionFilterEdit::RegexChanged(const RegexConfig &conf)
|
|||||||
void MacroConditionFilterEdit::SettingSelectionChanged(
|
void MacroConditionFilterEdit::SettingSelectionChanged(
|
||||||
const SourceSetting &setting)
|
const SourceSetting &setting)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_setting = setting;
|
_entryData->_setting = setting;
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFilterEdit::RefreshVariableSourceSelectionValue()
|
void MacroConditionFilterEdit::RefreshVariableSourceSelectionValue()
|
||||||
@@ -384,29 +410,69 @@ void MacroConditionFilterEdit::RefreshVariableSourceSelectionValue()
|
|||||||
_settingSelection->SetSource(filters.empty() ? nullptr : filters.at(0));
|
_settingSelection->SetSource(filters.empty() ? nullptr : filters.at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroConditionFilterEdit::IncludeDefaultsChanged(int state)
|
||||||
|
{
|
||||||
|
GUARD_LOADING_AND_LOCK();
|
||||||
|
_entryData->_includeDefaults = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString GetIndividualListEntryName()
|
||||||
|
{
|
||||||
|
static const auto matchesInput =
|
||||||
|
[](const std::pair<MacroConditionFilter::Condition, std::string>
|
||||||
|
&p) {
|
||||||
|
return p.first ==
|
||||||
|
MacroConditionFilter::Condition::
|
||||||
|
INDIVIDUAL_SETTING_LIST_ENTRY_MATCH;
|
||||||
|
};
|
||||||
|
static const QString listValueText(obs_module_text(
|
||||||
|
std::find_if(filterConditionTypes.begin(),
|
||||||
|
filterConditionTypes.end(), matchesInput)
|
||||||
|
->second.c_str()));
|
||||||
|
return listValueText;
|
||||||
|
}
|
||||||
|
|
||||||
void MacroConditionFilterEdit::SetWidgetVisibility()
|
void MacroConditionFilterEdit::SetWidgetVisibility()
|
||||||
{
|
{
|
||||||
const bool showSettingsControls =
|
const bool showSettingsControls =
|
||||||
_entryData->GetCondition() ==
|
_entryData->GetCondition() ==
|
||||||
MacroConditionFilter::Condition::SETTINGS_MATCH ||
|
MacroConditionFilter::Condition::SETTINGS_MATCH ||
|
||||||
_entryData->GetCondition() ==
|
_entryData->GetCondition() ==
|
||||||
MacroConditionFilter::Condition::INDIVIDUAL_SETTING_MATCH;
|
MacroConditionFilter::Condition::INDIVIDUAL_SETTING_MATCH ||
|
||||||
|
_entryData->GetCondition() ==
|
||||||
|
MacroConditionFilter::Condition::
|
||||||
|
INDIVIDUAL_SETTING_LIST_ENTRY_MATCH;
|
||||||
_settings->setVisible(showSettingsControls);
|
_settings->setVisible(showSettingsControls);
|
||||||
_getSettings->setVisible(showSettingsControls);
|
_getSettings->setVisible(showSettingsControls);
|
||||||
_regex->setVisible(showSettingsControls);
|
_regex->setVisible(showSettingsControls);
|
||||||
_settingSelection->setVisible(
|
_settingSelection->setVisible(
|
||||||
_entryData->GetCondition() ==
|
_entryData->GetCondition() ==
|
||||||
MacroConditionFilter::Condition::INDIVIDUAL_SETTING_MATCH ||
|
MacroConditionFilter::Condition::INDIVIDUAL_SETTING_MATCH ||
|
||||||
|
_entryData->GetCondition() ==
|
||||||
|
MacroConditionFilter::Condition::
|
||||||
|
INDIVIDUAL_SETTING_LIST_ENTRY_MATCH ||
|
||||||
_entryData->GetCondition() ==
|
_entryData->GetCondition() ==
|
||||||
MacroConditionFilter::Condition::
|
MacroConditionFilter::Condition::
|
||||||
INDIVIDUAL_SETTING_CHANGED);
|
INDIVIDUAL_SETTING_CHANGED);
|
||||||
_refreshSettingSelection->setVisible(
|
_refreshSettingSelection->setVisible(
|
||||||
_entryData->GetCondition() ==
|
(_entryData->GetCondition() ==
|
||||||
MacroConditionFilter::Condition::INDIVIDUAL_SETTING_MATCH &&
|
MacroConditionFilter::Condition::
|
||||||
|
INDIVIDUAL_SETTING_MATCH ||
|
||||||
|
_entryData->GetCondition() ==
|
||||||
|
MacroConditionFilter::Condition::
|
||||||
|
INDIVIDUAL_SETTING_LIST_ENTRY_MATCH) &&
|
||||||
(_entryData->_source.GetType() ==
|
(_entryData->_source.GetType() ==
|
||||||
SourceSelection::Type::VARIABLE ||
|
SourceSelection::Type::VARIABLE ||
|
||||||
_entryData->_filter.GetType() ==
|
_entryData->_filter.GetType() ==
|
||||||
FilterSelection::Type::VARIABLE));
|
FilterSelection::Type::VARIABLE));
|
||||||
|
|
||||||
|
SetRowVisibleByValue(_conditions, GetIndividualListEntryName(),
|
||||||
|
_entryData->_setting.IsList());
|
||||||
|
|
||||||
|
_includeDefaults->setVisible(
|
||||||
|
_entryData->GetCondition() ==
|
||||||
|
MacroConditionFilter::Condition::SETTINGS_MATCH);
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
@@ -419,8 +485,8 @@ void MacroConditionFilterEdit::UpdateEntryData()
|
|||||||
|
|
||||||
_sources->SetSource(_entryData->_source);
|
_sources->SetSource(_entryData->_source);
|
||||||
_filters->SetFilter(_entryData->_source, _entryData->_filter);
|
_filters->SetFilter(_entryData->_source, _entryData->_filter);
|
||||||
_conditions->setCurrentIndex(
|
_conditions->setCurrentIndex(_conditions->findData(
|
||||||
static_cast<int>(_entryData->GetCondition()));
|
static_cast<int>(_entryData->GetCondition())));
|
||||||
_settings->setPlainText(_entryData->_settings);
|
_settings->setPlainText(_entryData->_settings);
|
||||||
_regex->SetRegexConfig(_entryData->_regex);
|
_regex->SetRegexConfig(_entryData->_regex);
|
||||||
const auto filters =
|
const auto filters =
|
||||||
@@ -428,6 +494,7 @@ void MacroConditionFilterEdit::UpdateEntryData()
|
|||||||
_settingSelection->SetSelection(filters.empty() ? nullptr
|
_settingSelection->SetSelection(filters.empty() ? nullptr
|
||||||
: filters.at(0),
|
: filters.at(0),
|
||||||
_entryData->_setting);
|
_entryData->_setting);
|
||||||
|
_includeDefaults->setChecked(_entryData->_includeDefaults);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public:
|
|||||||
SETTINGS_CHANGED,
|
SETTINGS_CHANGED,
|
||||||
INDIVIDUAL_SETTING_MATCH,
|
INDIVIDUAL_SETTING_MATCH,
|
||||||
INDIVIDUAL_SETTING_CHANGED,
|
INDIVIDUAL_SETTING_CHANGED,
|
||||||
|
INDIVIDUAL_SETTING_LIST_ENTRY_MATCH,
|
||||||
};
|
};
|
||||||
void SetCondition(Condition);
|
void SetCondition(Condition);
|
||||||
Condition GetCondition() const { return _condition; }
|
Condition GetCondition() const { return _condition; }
|
||||||
@@ -41,13 +42,14 @@ public:
|
|||||||
StringVariable _settings = "";
|
StringVariable _settings = "";
|
||||||
RegexConfig _regex;
|
RegexConfig _regex;
|
||||||
SourceSetting _setting;
|
SourceSetting _setting;
|
||||||
|
bool _includeDefaults = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupTempVars();
|
void SetupTempVars();
|
||||||
bool CheckConditionHelper(const OBSWeakSource &);
|
bool CheckConditionHelper(const OBSWeakSource &);
|
||||||
|
|
||||||
Condition _condition = Condition::ENABLED;
|
Condition _condition = Condition::ENABLED;
|
||||||
std::string _currentSettings;
|
std::optional<std::string> _currentSettings;
|
||||||
std::string _currentSettingsValue;
|
std::string _currentSettingsValue;
|
||||||
|
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
@@ -79,6 +81,7 @@ private slots:
|
|||||||
void RegexChanged(const RegexConfig &);
|
void RegexChanged(const RegexConfig &);
|
||||||
void SettingSelectionChanged(const SourceSetting &);
|
void SettingSelectionChanged(const SourceSetting &);
|
||||||
void RefreshVariableSourceSelectionValue();
|
void RefreshVariableSourceSelectionValue();
|
||||||
|
void IncludeDefaultsChanged(int);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
@@ -93,6 +96,7 @@ private:
|
|||||||
RegexConfigWidget *_regex;
|
RegexConfigWidget *_regex;
|
||||||
SourceSettingSelection *_settingSelection;
|
SourceSettingSelection *_settingSelection;
|
||||||
QPushButton *_refreshSettingSelection;
|
QPushButton *_refreshSettingSelection;
|
||||||
|
QCheckBox *_includeDefaults;
|
||||||
|
|
||||||
std::shared_ptr<MacroConditionFilter> _entryData;
|
std::shared_ptr<MacroConditionFilter> _entryData;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
|
|||||||
@@ -343,22 +343,14 @@ void MacroConditionFolderEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroConditionFolderEdit::ConditionChanged(int index)
|
void MacroConditionFolderEdit::ConditionChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_condition = static_cast<MacroConditionFolder::Condition>(
|
_entryData->_condition = static_cast<MacroConditionFolder::Condition>(
|
||||||
_conditions->itemData(index).toInt());
|
_conditions->itemData(index).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFolderEdit::PathChanged(const QString &text)
|
void MacroConditionFolderEdit::PathChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->SetFolder(text.toStdString());
|
_entryData->SetFolder(text.toStdString());
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -366,32 +358,20 @@ void MacroConditionFolderEdit::PathChanged(const QString &text)
|
|||||||
|
|
||||||
void MacroConditionFolderEdit::RegexChanged(const RegexConfig ®ex)
|
void MacroConditionFolderEdit::RegexChanged(const RegexConfig ®ex)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_regex = regex;
|
_entryData->_regex = regex;
|
||||||
_entryData->_regex.SetEnabled(true);
|
_entryData->_regex.SetEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFolderEdit::FilterChanged()
|
void MacroConditionFolderEdit::FilterChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_filter = _filter->text().toStdString();
|
_entryData->_filter = _filter->text().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFolderEdit::EnableFilterChanged(int value)
|
void MacroConditionFolderEdit::EnableFilterChanged(int value)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_enableFilter = value;
|
_entryData->_enableFilter = value;
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,11 +107,7 @@ MacroConditionHotkeyEdit::MacroConditionHotkeyEdit(
|
|||||||
|
|
||||||
void MacroConditionHotkeyEdit::NameChanged()
|
void MacroConditionHotkeyEdit::NameChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
const auto name = _name->text().toStdString();
|
const auto name = _name->text().toStdString();
|
||||||
// In case a hotkey is used by multiple conditions create a new hotkey
|
// In case a hotkey is used by multiple conditions create a new hotkey
|
||||||
// with the new description or get an existing hotkey matching this
|
// with the new description or get an existing hotkey matching this
|
||||||
@@ -139,11 +135,7 @@ void MacroConditionHotkeyEdit::UpdateEntryData()
|
|||||||
|
|
||||||
void MacroConditionHotkeyEdit::KeyStateChanged(int index)
|
void MacroConditionHotkeyEdit::KeyStateChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_checkPressed = index == 0;
|
_entryData->_checkPressed = index == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,11 +56,7 @@ MacroConditionIdleEdit::MacroConditionIdleEdit(
|
|||||||
|
|
||||||
void MacroConditionIdleEdit::DurationChanged(const Duration &dur)
|
void MacroConditionIdleEdit::DurationChanged(const Duration &dur)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_duration = dur;
|
_entryData->_duration = dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user