mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-29 04:36:21 -05:00
Compare commits
15 Commits
1.32.3
...
record-pat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a69e774c2 | ||
|
|
2389f37ed6 | ||
|
|
de20c93b14 | ||
|
|
b0d877db8c | ||
|
|
caf9e59475 | ||
|
|
5f6982b5bb | ||
|
|
ce399cc647 | ||
|
|
03f67534c7 | ||
|
|
246667e65e | ||
|
|
68fe7716e7 | ||
|
|
98cc710b4a | ||
|
|
c602c30c54 | ||
|
|
cc1b89fe1d | ||
|
|
1de4ef7ec2 | ||
|
|
e29060fdea |
@@ -146,6 +146,8 @@ target_sources(
|
||||
lib/macro/macro-ref.hpp
|
||||
lib/macro/macro-run-button.cpp
|
||||
lib/macro/macro-run-button.hpp
|
||||
lib/macro/macro-search.cpp
|
||||
lib/macro/macro-search.hpp
|
||||
lib/macro/macro-segment-copy-paste.cpp
|
||||
lib/macro/macro-segment-copy-paste.hpp
|
||||
lib/macro/macro-segment-list.cpp
|
||||
|
||||
@@ -180,24 +180,46 @@ function(_check_dependencies)
|
||||
set(url ${url}/${version}/${file})
|
||||
endif()
|
||||
|
||||
set(MAX_DOWNLOAD_RETRIES 3)
|
||||
set(RETRY_DELAY 60) # seconds
|
||||
|
||||
if(NOT EXISTS "${dependencies_dir}/${file}")
|
||||
message(STATUS "Downloading ${url}")
|
||||
file(
|
||||
DOWNLOAD "${url}" "${dependencies_dir}/${file}"
|
||||
STATUS download_status
|
||||
EXPECTED_HASH SHA256=${hash})
|
||||
|
||||
list(GET download_status 0 error_code)
|
||||
list(GET download_status 1 error_message)
|
||||
if(error_code GREATER 0)
|
||||
message(STATUS "Downloading ${url} - Failure")
|
||||
set(download_success FALSE)
|
||||
|
||||
foreach(i RANGE 1 ${MAX_DOWNLOAD_RETRIES})
|
||||
message(STATUS "Attempt ${i}/${MAX_DOWNLOAD_RETRIES} for ${url}")
|
||||
|
||||
file(
|
||||
DOWNLOAD "${url}" "${dependencies_dir}/${file}"
|
||||
STATUS download_status
|
||||
EXPECTED_HASH SHA256=${hash})
|
||||
|
||||
list(GET download_status 0 error_code)
|
||||
list(GET download_status 1 error_message)
|
||||
|
||||
if(error_code EQUAL 0)
|
||||
message(STATUS "Downloading ${url} - success on attempt ${i}")
|
||||
set(download_success TRUE)
|
||||
break()
|
||||
else()
|
||||
message(WARNING "Download failed (attempt ${i}): ${error_message}")
|
||||
file(REMOVE "${dependencies_dir}/${file}")
|
||||
|
||||
if(NOT i EQUAL MAX_DOWNLOAD_RETRIES)
|
||||
message(STATUS "Retrying in ${RETRY_DELAY} seconds...")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${RETRY_DELAY})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT download_success)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unable to download ${url}, failed with error: ${error_message}")
|
||||
file(REMOVE "${dependencies_dir}/${file}")
|
||||
else()
|
||||
message(STATUS "Downloading ${url} - done")
|
||||
"Unable to download ${url} after ${MAX_DOWNLOAD_RETRIES} attempts")
|
||||
endif()
|
||||
message(STATUS "Downloading ${url} - done")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${dependencies_dir}/${destination}")
|
||||
|
||||
@@ -43,7 +43,7 @@ AdvSceneSwitcher.generalTab.generalBehavior.warnPluginLoadFailure="Display warni
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.warnPluginLoadFailureMessage="<html><body>Loading of the following plugin libraries was unsuccessful, which could result in some Advanced Scene Switcher functions not being available:%1Check the OBS logs for details.<br>This message can be disabled on the General tab.</body></html>"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.warnCorruptedInstallMessage="The plugin installation seems to be corrupted and might crash!\nPlease make sure the plugin was installed correctly!"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.hideLegacyTabs="Hide tabs which can be represented via macros"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableMacroWidgetCache="Disable macro widget caching"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.alwaysShowMacroSearch="Always show macro search"
|
||||
AdvSceneSwitcher.generalTab.matchBehavior="Match behavior"
|
||||
AdvSceneSwitcher.generalTab.priority="Priority"
|
||||
AdvSceneSwitcher.generalTab.priority.description="Switching methods priority (Highest priority is at the top)"
|
||||
@@ -74,6 +74,7 @@ AdvSceneSwitcher.generalTab.setTransitionBy="When changing transitions:"
|
||||
AdvSceneSwitcher.generalTab.transitionOverride="Set transition overrides"
|
||||
AdvSceneSwitcher.generalTab.adjustActiveTransitionType="Change active transition type"
|
||||
AdvSceneSwitcher.generalTab.transitionBehaviorSelectionError="At least one option must be enabled:\n\n - Use transition overrides\n\n - Change active transition type"
|
||||
AdvSceneSwitcher.generalTab.uiBehavior="UI settings"
|
||||
|
||||
# Variables Tab
|
||||
AdvSceneSwitcher.variableTab.title="Variables"
|
||||
@@ -276,6 +277,13 @@ AdvSceneSwitcher.macroTab.tooltip.elseActionUpButton="Move selected action up in
|
||||
AdvSceneSwitcher.macroTab.tooltip.elseActionDownButton="Move selected action down in the else section"
|
||||
AdvSceneSwitcher.macroTab.tooltip.elseActionBottomButton="Move selected action to the bottom in the else section"
|
||||
AdvSceneSwitcher.macroTab.tooltip.openMacroSettingsButton="Open macro settings"
|
||||
AdvSceneSwitcher.macroTab.search.placeholder="Search ..."
|
||||
AdvSceneSwitcher.macroTab.search.showSettings="Show search settings"
|
||||
AdvSceneSwitcher.macroTab.search.name="Name"
|
||||
AdvSceneSwitcher.macroTab.search.allSegments="Segment type"
|
||||
AdvSceneSwitcher.macroTab.search.conditions="Condition type"
|
||||
AdvSceneSwitcher.macroTab.search.actions="Action type"
|
||||
AdvSceneSwitcher.macroTab.search.label="Segment label"
|
||||
|
||||
AdvSceneSwitcher.macroDock.pause="Pause"
|
||||
AdvSceneSwitcher.macroDock.unpause="Unpause"
|
||||
@@ -1607,7 +1615,11 @@ AdvSceneSwitcher.twitchToken.moderator.chat.settings.manage="Manage channel's ch
|
||||
AdvSceneSwitcher.twitchToken.user.whispers.manage="Manage user's whispers."
|
||||
AdvSceneSwitcher.twitchToken.chat.read="View live stream chat messages."
|
||||
AdvSceneSwitcher.twitchToken.chat.edit="Send live stream chat messages."
|
||||
AdvSceneSwitcher.twitchToken.validateTimestamps="Validate timestamps of received Twitch event messages. (Recommended)"
|
||||
AdvSceneSwitcher.twitchToken.validateTimestamps="Validate timestamps of received Twitch event messages."
|
||||
AdvSceneSwitcher.twitchToken.validateTimestamps.tooltip="Verifies that incoming Twitch messages have valid timestamps to prevent replayed or spoofed messages.\nDisabling this won’t affect normal functionality, and you can try turning it off if you experience issues with the Twitch connection."
|
||||
AdvSceneSwitcher.twitchToken.warnIfInvalid="Display warning if the token expired or is invalid."
|
||||
AdvSceneSwitcher.twitchToken.warnIfInvalid.doNotShowAgain="Don't show again for this connection"
|
||||
AdvSceneSwitcher.twitchToken.warnIfInvalid.message="The Twitch connection \"%1\" is invalid.\nOpen connection settings or ignore?"
|
||||
|
||||
AdvSceneSwitcher.twitch.selection.channel.open="Open channel"
|
||||
AdvSceneSwitcher.twitch.selection.channel.open.tooltip.details="Open channel in external application handling the HTTPS protocol."
|
||||
@@ -2174,6 +2186,8 @@ AdvSceneSwitcher.tempVar.run.process.none.description="When not waiting for the
|
||||
|
||||
AdvSceneSwitcher.tempVar.recording.durationSeconds="Recording duration"
|
||||
AdvSceneSwitcher.tempVar.recording.durationSeconds.description="Recording duration in seconds.\nThis value does not change while the recording is paused and will be reset to zero if the recording is stopped."
|
||||
AdvSceneSwitcher.tempVar.recording.lastSavePath="Last save path"
|
||||
AdvSceneSwitcher.tempVar.recording.lastSavePath.description="The file path of the last saved recording."
|
||||
|
||||
AdvSceneSwitcher.tempVar.video.patternCount="Pattern count"
|
||||
AdvSceneSwitcher.tempVar.video.patternCount.description="The number of times the given pattern has been found in a given video input frame."
|
||||
|
||||
@@ -42,7 +42,6 @@ AdvSceneSwitcher.generalTab.generalBehavior.warnPluginLoadFailure="プラグイ
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.warnPluginLoadFailureMessage="<html><body>次のプラグイン ライブラリの読み込みに失敗したため、一部の高機能シーンスイッチャーが利用できなくなる可能性があります:%1詳細については、OBS ログを確認してください。<br>このメッセージは、[全般] タブで無効にすることができます。 </body></html>"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.warnCorruptedInstallMessage="プラグインが正しくインストールできておらずクラッシュする可能性があります!\nプラグインが正しくインストールされているか確認してください!"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.hideLegacyTabs="旧来型マクロ設定のタブを非表示にする(廃止予定タブ)"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableMacroWidgetCache="マクロウィジェットのキャッシングを無効にする"
|
||||
AdvSceneSwitcher.generalTab.matchBehavior="マッチした場合の動作(廃止予定の設定項目)"
|
||||
AdvSceneSwitcher.generalTab.priority="優先順位"
|
||||
AdvSceneSwitcher.generalTab.priority.description="切り替え方法の優先順位(優先順位が高いものが上)"
|
||||
|
||||
@@ -68,365 +68,162 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>962</width>
|
||||
<height>1057</height>
|
||||
<height>1132</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_31">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="statusBox">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.status</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="statusLayout">
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="autoStartEvent"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.autoStart.startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.checkInterval</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="checkIntervalTooLowWarning">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="startupBehavior"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="placeholder3" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="placeholder" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_64">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.onStartup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="placeholder2" native="true"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.hotkeytips</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="checkInterval">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>300</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="autoStartSceneEnable">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.autoStart.scene</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="autoStartSceneLayout">
|
||||
<item>
|
||||
<widget class="advss::SceneSelectionWidget" name="autoStartScene" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::VariableLineEdit" name="autoStartSceneName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::RegexConfigWidget" name="autoStartSceneNameRegex" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QGroupBox" name="statusBox">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.status</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="statusLayout">
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="autoStartEvent"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.autoStart.startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.checkInterval</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="checkIntervalTooLowWarning">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="generalSettingsBox">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_32">
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="startupBehavior"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="placeholder3" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="placeholder" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_64">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.onStartup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="placeholder2" native="true"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.hotkeytips</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="checkInterval">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>300</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="autoStartSceneEnable">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.status.autoStart.scene</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="autoStartSceneLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_52">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.logLevel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="logLevel"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_49">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="advss::SceneSelectionWidget" name="autoStartScene" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_50">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="saveWindowGeo">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.saveWindowGeo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_55">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="advss::VariableLineEdit" name="autoStartSceneName"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showTrayNotifications">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.showTrayNotifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_48">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiHintsDisable">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_52">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="disableComboBoxFilter">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.comboBoxFilterDisable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="disableMacroWidgetCache">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.disableMacroWidgetCache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_26">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="warnPluginLoadFailure">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.warnPluginLoadFailure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_19">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_24">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideLegacyTabs">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.hideLegacyTabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="advss::RegexConfigWidget" name="autoStartSceneNameRegex" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="saveLoadBox">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.saveOrLoadsettings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
<item>
|
||||
<widget class="QPushButton" name="exportSettings">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.saveOrLoadsettings.export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="importSettings">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.saveOrLoadsettings.import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<widget class="QGroupBox" name="saveLoadBox">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.matchBehavior</string>
|
||||
<string>AdvSceneSwitcher.generalTab.saveOrLoadsettings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_37">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="cooldownLayout">
|
||||
<widget class="QPushButton" name="exportSettings">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.saveOrLoadsettings.export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="importSettings">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.saveOrLoadsettings.import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="generalSettingsBox">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_32">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_52">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableCooldown">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.cooldown</string>
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.logLevel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::DurationSelection" name="cooldownTime" native="true"/>
|
||||
<widget class="QComboBox" name="logLevel"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_21">
|
||||
<spacer name="horizontalSpacer_49">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -441,80 +238,62 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_43">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="noMatchDontSwitch">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch.dontSwitch</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_45">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="noMatchRandomSwitch">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch.switchToRandom</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QRadioButton" name="noMatchSwitch">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch.switchTo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::SceneSelectionWidget" name="noMatchSwitchScene">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="noMatchLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QCheckBox" name="showTrayNotifications">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.showTrayNotifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="warnPluginLoadFailure">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.warnPluginLoadFailure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.uiBehavior</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="saveWindowGeo">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.saveWindowGeo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiHintsDisable">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="disableComboBoxFilter">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.comboBoxFilterDisable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="alwaysShowMacroSearch">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.alwaysShowMacroSearch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideLegacyTabs">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.hideLegacyTabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -562,6 +341,109 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="matchBehaviorBox">
|
||||
<property name="title">
|
||||
<string>AdvSceneSwitcher.generalTab.matchBehavior</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_37">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="cooldownLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableCooldown">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.cooldown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::DurationSelection" name="cooldownTime" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_21">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="noMatchDontSwitch">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch.dontSwitch</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="noMatchRandomSwitch">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch.switchToRandom</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QRadioButton" name="noMatchSwitch">
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch.switchTo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::SceneSelectionWidget" name="noMatchSwitchScene" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="noMatchLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AdvSceneSwitcher.generalTab.generalBehavior.onNoMatch</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="priorityBox">
|
||||
<property name="title">
|
||||
@@ -576,15 +458,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_41">
|
||||
<item>
|
||||
<widget class="QListWidget" name="priorityList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QListWidget" name="priorityList"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_32">
|
||||
@@ -721,6 +595,55 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="macroSearchLayout">
|
||||
<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="QLineEdit" name="macroSearchText">
|
||||
<property name="placeholderText">
|
||||
<string>AdvSceneSwitcher.macroTab.search.placeholder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="macroSearchClear">
|
||||
<property name="toolTip">
|
||||
<string>AdvSceneSwitcher.variableTab.clear</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="macroSearchType"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::RegexConfigWidget" name="macroSearchRegex" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="macroSearchShowSettings">
|
||||
<property name="toolTip">
|
||||
<string>AdvSceneSwitcher.macroTab.search.showSettings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="advss::MacroTree" name="macros">
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
@@ -4164,12 +4087,7 @@
|
||||
<tabstop>autoStartSceneName</tabstop>
|
||||
<tabstop>autoStartSceneNameRegex</tabstop>
|
||||
<tabstop>logLevel</tabstop>
|
||||
<tabstop>saveWindowGeo</tabstop>
|
||||
<tabstop>showTrayNotifications</tabstop>
|
||||
<tabstop>uiHintsDisable</tabstop>
|
||||
<tabstop>disableComboBoxFilter</tabstop>
|
||||
<tabstop>warnPluginLoadFailure</tabstop>
|
||||
<tabstop>hideLegacyTabs</tabstop>
|
||||
<tabstop>exportSettings</tabstop>
|
||||
<tabstop>importSettings</tabstop>
|
||||
<tabstop>noMatchDontSwitch</tabstop>
|
||||
|
||||
@@ -65,7 +65,6 @@ public slots:
|
||||
void on_showTrayNotifications_stateChanged(int state);
|
||||
void on_uiHintsDisable_stateChanged(int state);
|
||||
void on_disableComboBoxFilter_stateChanged(int state);
|
||||
void on_disableMacroWidgetCache_stateChanged(int state);
|
||||
void on_warnPluginLoadFailure_stateChanged(int state);
|
||||
void on_hideLegacyTabs_stateChanged(int state);
|
||||
void on_priorityUp_clicked();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "filter-combo-box.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "macro-search.hpp"
|
||||
#include "macro-settings.hpp"
|
||||
#include "path-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
@@ -185,16 +186,6 @@ void AdvSceneSwitcher::on_disableComboBoxFilter_stateChanged(int state)
|
||||
FilterComboBox::SetFilterBehaviourEnabled(!state);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_disableMacroWidgetCache_stateChanged(int state)
|
||||
{
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
switcher->disableMacroWidgetCache = state;
|
||||
MacroSegmentList::SetCachingEnabled(!state);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_warnPluginLoadFailure_stateChanged(int state)
|
||||
{
|
||||
if (loading) {
|
||||
@@ -531,8 +522,6 @@ void SwitcherData::SaveGeneralSettings(obs_data_t *obj)
|
||||
obs_data_set_bool(obj, "disableHints", disableHints);
|
||||
obs_data_set_bool(obj, "disableFilterComboboxFilter",
|
||||
disableFilterComboboxFilter);
|
||||
obs_data_set_bool(obj, "disableMacroWidgetCache",
|
||||
disableMacroWidgetCache);
|
||||
obs_data_set_bool(obj, "warnPluginLoadFailure", warnPluginLoadFailure);
|
||||
obs_data_set_bool(obj, "hideLegacyTabs", hideLegacyTabs);
|
||||
|
||||
@@ -602,8 +591,6 @@ void SwitcherData::LoadGeneralSettings(obs_data_t *obj)
|
||||
disableHints = obs_data_get_bool(obj, "disableHints");
|
||||
disableFilterComboboxFilter =
|
||||
obs_data_get_bool(obj, "disableFilterComboboxFilter");
|
||||
disableMacroWidgetCache =
|
||||
obs_data_get_bool(obj, "disableMacroWidgetCache");
|
||||
obs_data_set_default_bool(obj, "warnPluginLoadFailure", true);
|
||||
warnPluginLoadFailure = obs_data_get_bool(obj, "warnPluginLoadFailure");
|
||||
obs_data_set_default_bool(obj, "hideLegacyTabs", true);
|
||||
@@ -927,9 +914,6 @@ void AdvSceneSwitcher::SetupGeneralTab()
|
||||
switcher->disableFilterComboboxFilter);
|
||||
FilterComboBox::SetFilterBehaviourEnabled(
|
||||
!switcher->disableFilterComboboxFilter);
|
||||
ui->disableMacroWidgetCache->setChecked(
|
||||
switcher->disableMacroWidgetCache);
|
||||
MacroSegmentList::SetCachingEnabled(!switcher->disableMacroWidgetCache);
|
||||
ui->warnPluginLoadFailure->setChecked(switcher->warnPluginLoadFailure);
|
||||
ui->hideLegacyTabs->setChecked(switcher->hideLegacyTabs);
|
||||
|
||||
@@ -1013,6 +997,19 @@ void AdvSceneSwitcher::SetupGeneralTab()
|
||||
switcher->CheckAutoStart();
|
||||
});
|
||||
|
||||
ui->alwaysShowMacroSearch->setChecked(
|
||||
GetMacroSearchSettings().showAlways);
|
||||
|
||||
connect(ui->alwaysShowMacroSearch, &QCheckBox::stateChanged, this,
|
||||
[this](int enabled) {
|
||||
GetMacroSearchSettings().showAlways = enabled;
|
||||
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
CheckMacroSearchVisibility();
|
||||
});
|
||||
|
||||
// Set up status control
|
||||
auto statusControl = new StatusControl(this, true);
|
||||
ui->statusLayout->addWidget(statusControl->StatusPrefixLabel(), 1, 0);
|
||||
|
||||
@@ -28,8 +28,7 @@ static inline void populateActionSelection(QComboBox *list)
|
||||
}
|
||||
|
||||
MacroActionEdit::MacroActionEdit(QWidget *parent,
|
||||
std::shared_ptr<MacroAction> *entryData,
|
||||
const std::string &id)
|
||||
std::shared_ptr<MacroAction> *entryData)
|
||||
: MacroSegmentEdit(parent),
|
||||
_actionSelection(new FilterComboBox()),
|
||||
_enable(new SwitchButton()),
|
||||
|
||||
@@ -13,10 +13,8 @@ class MacroActionEdit : public MacroSegmentEdit {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroActionEdit(
|
||||
QWidget *parent = nullptr,
|
||||
std::shared_ptr<MacroAction> * = nullptr,
|
||||
const std::string &id = MacroAction::GetDefaultID().data());
|
||||
MacroActionEdit(QWidget *parent = nullptr,
|
||||
std::shared_ptr<MacroAction> * = nullptr);
|
||||
void SetupWidgets(bool basicSetup = false);
|
||||
void SetEntryData(std::shared_ptr<MacroAction> *);
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ void DurationModifierEdit::Collapse(bool collapse)
|
||||
|
||||
MacroConditionEdit::MacroConditionEdit(
|
||||
QWidget *parent, std::shared_ptr<MacroCondition> *entryData,
|
||||
const std::string &id, bool isRootCondition)
|
||||
bool isRootCondition)
|
||||
: MacroSegmentEdit(parent),
|
||||
_logicSelection(new QComboBox()),
|
||||
_conditionSelection(new FilterComboBox()),
|
||||
|
||||
@@ -34,11 +34,9 @@ class MacroConditionEdit : public MacroSegmentEdit {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroConditionEdit(
|
||||
QWidget *parent = nullptr,
|
||||
std::shared_ptr<MacroCondition> * = nullptr,
|
||||
const std::string &id = MacroCondition::GetDefaultID().data(),
|
||||
bool root = true);
|
||||
MacroConditionEdit(QWidget *parent = nullptr,
|
||||
std::shared_ptr<MacroCondition> * = nullptr,
|
||||
bool root = true);
|
||||
bool IsRootNode() const;
|
||||
void SetRootNode(bool);
|
||||
void SetupWidgets(bool basicSetup = false);
|
||||
|
||||
@@ -418,8 +418,7 @@ void MacroEdit::PopulateMacroActions(Macro &m, uint32_t afterIdx)
|
||||
ui->actionsList->SetVisibilityCheckEnable(false);
|
||||
|
||||
for (; afterIdx < actions.size(); afterIdx++) {
|
||||
auto newEntry = new MacroActionEdit(this, &actions[afterIdx],
|
||||
actions[afterIdx]->GetId());
|
||||
auto newEntry = new MacroActionEdit(this, &actions[afterIdx]);
|
||||
ui->actionsList->Add(newEntry);
|
||||
}
|
||||
|
||||
@@ -444,8 +443,7 @@ void MacroEdit::PopulateMacroElseActions(Macro &m, uint32_t afterIdx)
|
||||
ui->elseActionsList->SetVisibilityCheckEnable(false);
|
||||
|
||||
for (; afterIdx < actions.size(); afterIdx++) {
|
||||
auto newEntry = new MacroActionEdit(this, &actions[afterIdx],
|
||||
actions[afterIdx]->GetId());
|
||||
auto newEntry = new MacroActionEdit(this, &actions[afterIdx]);
|
||||
ui->elseActionsList->Add(newEntry);
|
||||
}
|
||||
|
||||
@@ -472,8 +470,7 @@ void MacroEdit::PopulateMacroConditions(Macro &m, uint32_t afterIdx)
|
||||
|
||||
for (; afterIdx < conditions.size(); afterIdx++) {
|
||||
auto newEntry = new MacroConditionEdit(
|
||||
this, &conditions[afterIdx],
|
||||
conditions[afterIdx]->GetId(), root);
|
||||
this, &conditions[afterIdx], root);
|
||||
ui->conditionsList->Add(newEntry);
|
||||
root = false;
|
||||
}
|
||||
@@ -1083,8 +1080,7 @@ void MacroEdit::AddMacroAction(Macro *macro, int idx, const std::string &id,
|
||||
RunAndClearPostLoadSteps();
|
||||
macro->UpdateActionIndices();
|
||||
ui->actionsList->Insert(
|
||||
idx,
|
||||
new MacroActionEdit(this, ¯o->Actions()[idx], id));
|
||||
idx, new MacroActionEdit(this, ¯o->Actions()[idx]));
|
||||
SetActionData(*macro);
|
||||
}
|
||||
HighlightAction(idx);
|
||||
@@ -1386,8 +1382,8 @@ void MacroEdit::AddMacroElseAction(Macro *macro, int idx, const std::string &id,
|
||||
RunAndClearPostLoadSteps();
|
||||
macro->UpdateElseActionIndices();
|
||||
ui->elseActionsList->Insert(
|
||||
idx, new MacroActionEdit(
|
||||
this, ¯o->ElseActions()[idx], id));
|
||||
idx,
|
||||
new MacroActionEdit(this, ¯o->ElseActions()[idx]));
|
||||
SetElseActionData(*macro);
|
||||
}
|
||||
HighlightElseAction(idx);
|
||||
@@ -1589,7 +1585,7 @@ void MacroEdit::AddMacroCondition(Macro *macro, int idx, const std::string &id,
|
||||
ui->conditionsList->Insert(
|
||||
idx,
|
||||
new MacroConditionEdit(this, ¯o->Conditions()[idx],
|
||||
id, idx == 0));
|
||||
idx == 0));
|
||||
SetConditionData(*macro);
|
||||
}
|
||||
HighlightCondition(idx);
|
||||
|
||||
@@ -63,6 +63,33 @@ std::deque<std::shared_ptr<Macro>> GetAllMacros()
|
||||
return macros;
|
||||
}
|
||||
|
||||
Macro *GetMacroByName(const char *name)
|
||||
{
|
||||
for (const auto &m : GetTopLevelMacros()) {
|
||||
if (m->Name() == name) {
|
||||
return m.get();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Macro *GetMacroByQString(const QString &name)
|
||||
{
|
||||
return GetMacroByName(name.toUtf8().constData());
|
||||
}
|
||||
|
||||
std::weak_ptr<Macro> GetWeakMacroByName(const char *name)
|
||||
{
|
||||
for (const auto &m : GetTopLevelMacros()) {
|
||||
if (m->Name() == name) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<std::deque<std::shared_ptr<MacroAction>>>
|
||||
GetMacroActions(Macro *macro)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
@@ -22,6 +24,10 @@ EXPORT std::deque<std::shared_ptr<Macro>> &GetTopLevelMacros();
|
||||
std::deque<std::shared_ptr<Macro>> &GetTemporaryMacros();
|
||||
EXPORT std::deque<std::shared_ptr<Macro>> GetAllMacros();
|
||||
|
||||
Macro *GetMacroByName(const char *name);
|
||||
Macro *GetMacroByQString(const QString &name);
|
||||
std::weak_ptr<Macro> GetWeakMacroByName(const char *name);
|
||||
|
||||
EXPORT std::optional<std::deque<std::shared_ptr<MacroAction>>>
|
||||
GetMacroActions(Macro *);
|
||||
EXPORT std::optional<std::deque<std::shared_ptr<MacroAction>>>
|
||||
|
||||
336
lib/macro/macro-search.cpp
Normal file
336
lib/macro/macro-search.cpp
Normal file
@@ -0,0 +1,336 @@
|
||||
#include "macro-search.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "macro-action-factory.hpp"
|
||||
#include "macro-condition-factory.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "macro-signals.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <obs.hpp>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace advss {
|
||||
|
||||
static bool searchEnabled = false;
|
||||
static bool setup();
|
||||
static bool setupDone = setup();
|
||||
|
||||
static QLayout *searchLayout = nullptr;
|
||||
static QComboBox *searchType = nullptr;
|
||||
static RegexConfigWidget *searchRegex = nullptr;
|
||||
static QPushButton *showSettings = nullptr;
|
||||
static std::function<void()> refreshFilter;
|
||||
|
||||
static void save(obs_data_t *data)
|
||||
{
|
||||
GetMacroSearchSettings().Save(data, "macroSearchSettings");
|
||||
}
|
||||
|
||||
static void load(obs_data_t *data)
|
||||
{
|
||||
GetMacroSearchSettings().Load(data, "macroSearchSettings");
|
||||
}
|
||||
|
||||
static bool setup()
|
||||
{
|
||||
AddSaveStep(save);
|
||||
AddLoadStep(load);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MacroSearchSettings::Save(obs_data_t *data, const char *name)
|
||||
{
|
||||
OBSDataAutoRelease settings = obs_data_create();
|
||||
obs_data_set_bool(settings, "showAlways", showAlways);
|
||||
obs_data_set_int(settings, "searchType", static_cast<int>(searchType));
|
||||
obs_data_set_string(settings, "searchString", searchString.c_str());
|
||||
regex.Save(settings);
|
||||
obs_data_set_obj(data, name, settings);
|
||||
}
|
||||
|
||||
void MacroSearchSettings::Load(obs_data_t *data, const char *name)
|
||||
{
|
||||
OBSDataAutoRelease settings = obs_data_get_obj(data, name);
|
||||
showAlways = obs_data_get_bool(settings, "showAlways");
|
||||
searchType = static_cast<SearchType>(
|
||||
obs_data_get_int(settings, "searchType"));
|
||||
searchString = obs_data_get_string(settings, "searchString");
|
||||
regex.Load(settings);
|
||||
}
|
||||
|
||||
static void showAdvancedSearchSettings(bool show)
|
||||
{
|
||||
assert(searchType);
|
||||
assert(searchRegex);
|
||||
|
||||
searchType->setVisible(show);
|
||||
searchRegex->setVisible(show);
|
||||
}
|
||||
|
||||
static bool shouldShowSearch()
|
||||
{
|
||||
static const int showSearchThreshold = 10;
|
||||
return GetMacroSearchSettings().showAlways ||
|
||||
GetTopLevelMacros().size() >= showSearchThreshold;
|
||||
}
|
||||
|
||||
void CheckMacroSearchVisibility()
|
||||
{
|
||||
assert(searchLayout);
|
||||
assert(searchType);
|
||||
assert(searchRegex);
|
||||
assert(showSettings);
|
||||
|
||||
searchEnabled = shouldShowSearch();
|
||||
SetLayoutVisible(searchLayout, searchEnabled);
|
||||
showAdvancedSearchSettings(false);
|
||||
showSettings->setChecked(false);
|
||||
refreshFilter();
|
||||
}
|
||||
|
||||
void SetupMacroSearchWidgets(QLayout *searchLayoutArg, QLineEdit *searchText,
|
||||
QPushButton *searchClear, QComboBox *searchTypeArg,
|
||||
RegexConfigWidget *searchRegexArg,
|
||||
QPushButton *showSettingsArg,
|
||||
const std::function<void()> &refreshArg)
|
||||
{
|
||||
searchLayout = searchLayoutArg;
|
||||
searchType = searchTypeArg;
|
||||
searchRegex = searchRegexArg;
|
||||
refreshFilter = refreshArg;
|
||||
showSettings = showSettingsArg;
|
||||
|
||||
searchClear->setMaximumWidth(22);
|
||||
SetButtonIcon(searchClear, GetThemeTypeName() == "Light"
|
||||
? "theme:Light/close.svg"
|
||||
: "theme:Dark/close.svg");
|
||||
searchClear->setDisabled(GetMacroSearchSettings().searchString.empty());
|
||||
|
||||
QWidget::connect(searchClear, &QPushButton::clicked, searchClear,
|
||||
[=]() {
|
||||
searchText->setText("");
|
||||
searchClear->setDisabled(true);
|
||||
});
|
||||
|
||||
const auto ph = searchText->placeholderText();
|
||||
const QFontMetrics fm(searchText->font());
|
||||
const int width = fm.horizontalAdvance(ph);
|
||||
// Add a little padding so the text isn't cramped
|
||||
searchText->setMinimumWidth(width + 10);
|
||||
|
||||
searchText->setText(
|
||||
QString::fromStdString(GetMacroSearchSettings().searchString));
|
||||
QWidget::connect(searchText, &QLineEdit::textChanged, searchText,
|
||||
[searchClear](const QString &text) {
|
||||
GetMacroSearchSettings().searchString =
|
||||
text.toStdString();
|
||||
searchClear->setDisabled(text.isEmpty());
|
||||
refreshFilter();
|
||||
});
|
||||
|
||||
searchType->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.search.name"),
|
||||
static_cast<int>(MacroSearchSettings::SearchType::NAME));
|
||||
searchType->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.search.allSegments"),
|
||||
static_cast<int>(
|
||||
MacroSearchSettings::SearchType::ALL_SEGMENTS));
|
||||
searchType->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.search.conditions"),
|
||||
static_cast<int>(MacroSearchSettings::SearchType::CONDITIONS));
|
||||
searchType->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.search.actions"),
|
||||
static_cast<int>(MacroSearchSettings::SearchType::ACTIONS));
|
||||
searchType->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.search.label"),
|
||||
static_cast<int>(MacroSearchSettings::SearchType::LABEL));
|
||||
searchType->setCurrentIndex(searchType->findData(
|
||||
static_cast<int>(GetMacroSearchSettings().searchType)));
|
||||
QWidget::connect(
|
||||
searchType, &QComboBox::currentIndexChanged, searchType, []() {
|
||||
GetMacroSearchSettings().searchType =
|
||||
static_cast<MacroSearchSettings::SearchType>(
|
||||
searchType->currentData().toInt());
|
||||
refreshFilter();
|
||||
});
|
||||
|
||||
searchRegex->SetRegexConfig(GetMacroSearchSettings().regex);
|
||||
QWidget::connect(searchRegex, &RegexConfigWidget::RegexConfigChanged,
|
||||
searchRegex, [](const RegexConfig ®ex) {
|
||||
GetMacroSearchSettings().regex = regex;
|
||||
refreshFilter();
|
||||
});
|
||||
|
||||
showSettings->setCheckable(true);
|
||||
showSettings->setMaximumWidth(11);
|
||||
SetButtonIcon(showSettings, GetThemeTypeName() == "Light"
|
||||
? ":/res/images/dots-vert.svg"
|
||||
: "theme:Dark/dots-vert.svg");
|
||||
QWidget::connect(showSettings, &QPushButton::toggled, showSettings,
|
||||
showAdvancedSearchSettings);
|
||||
|
||||
QWidget::connect(MacroSignalManager::Instance(),
|
||||
&MacroSignalManager::Rename, searchText,
|
||||
[]() { refreshFilter(); });
|
||||
|
||||
CheckMacroSearchVisibility();
|
||||
}
|
||||
|
||||
MacroSearchSettings &GetMacroSearchSettings()
|
||||
{
|
||||
static MacroSearchSettings settings;
|
||||
return settings;
|
||||
}
|
||||
|
||||
static bool stringMatches(const std::string &text)
|
||||
{
|
||||
const auto &settings = GetMacroSearchSettings();
|
||||
const auto ®ex = settings.regex;
|
||||
const auto &searchString = settings.searchString;
|
||||
|
||||
if (regex.Enabled()) {
|
||||
return regex.Matches(text, searchString);
|
||||
}
|
||||
|
||||
return QString::fromStdString(text).contains(
|
||||
QString::fromStdString(searchString), Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
static bool segmentTypeMatches(MacroSegment *segment, bool isCondition)
|
||||
{
|
||||
if (!segment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto getNameFromId =
|
||||
isCondition ? MacroConditionFactory::GetConditionName
|
||||
: MacroActionFactory::GetActionName;
|
||||
const auto name = getNameFromId(segment->GetId());
|
||||
return stringMatches(obs_module_text(name.c_str()));
|
||||
}
|
||||
|
||||
static bool segmentLabelMatches(MacroSegment *segment)
|
||||
{
|
||||
if (!segment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!segment->GetUseCustomLabel()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto label = segment->GetCustomLabel();
|
||||
return stringMatches(label);
|
||||
}
|
||||
|
||||
bool MacroMatchesSearchFilter(Macro *macro)
|
||||
{
|
||||
assert(macro);
|
||||
|
||||
if (!searchEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto &settings = GetMacroSearchSettings();
|
||||
|
||||
if (settings.searchString.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (macro->IsGroup()) {
|
||||
std::vector<std::shared_ptr<Macro>> subItems;
|
||||
subItems.reserve(macro->GroupSize());
|
||||
|
||||
const auto ¯os = GetTopLevelMacros();
|
||||
for (auto it = macros.begin(); it < macros.end(); it++) {
|
||||
if ((*it)->Name() != macro->Name()) {
|
||||
continue;
|
||||
}
|
||||
for (uint32_t i = 1; i <= macro->GroupSize(); i++) {
|
||||
subItems.emplace_back(*std::next(it, i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (const auto &item : subItems) {
|
||||
if (MacroMatchesSearchFilter(item.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (settings.searchType) {
|
||||
case MacroSearchSettings::SearchType::NAME: {
|
||||
const auto name = macro->Name();
|
||||
return stringMatches(name);
|
||||
}
|
||||
case MacroSearchSettings::SearchType::ALL_SEGMENTS:
|
||||
for (const auto &condition : macro->Conditions()) {
|
||||
if (segmentTypeMatches(condition.get(), true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (const auto &action : macro->Actions()) {
|
||||
if (segmentTypeMatches(action.get(), false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (const auto &action : macro->ElseActions()) {
|
||||
if (segmentTypeMatches(action.get(), false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case MacroSearchSettings::SearchType::CONDITIONS:
|
||||
for (const auto &condition : macro->Conditions()) {
|
||||
if (segmentTypeMatches(condition.get(), true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case MacroSearchSettings::SearchType::ACTIONS:
|
||||
for (const auto &action : macro->Actions()) {
|
||||
if (segmentTypeMatches(action.get(), false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (const auto &action : macro->ElseActions()) {
|
||||
if (segmentTypeMatches(action.get(), false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case MacroSearchSettings::SearchType::LABEL:
|
||||
for (const auto &condition : macro->Conditions()) {
|
||||
if (segmentLabelMatches(condition.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (const auto &action : macro->Actions()) {
|
||||
if (segmentLabelMatches(action.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (const auto &action : macro->ElseActions()) {
|
||||
if (segmentLabelMatches(action.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Unhandled search type
|
||||
assert(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
43
lib/macro/macro-search.hpp
Normal file
43
lib/macro/macro-search.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include "regex-config.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
class QComboBox;
|
||||
class QLayout;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
|
||||
namespace advss {
|
||||
|
||||
class Macro;
|
||||
|
||||
struct MacroSearchSettings {
|
||||
void Save(obs_data_t *data, const char *name);
|
||||
void Load(obs_data_t *data, const char *name);
|
||||
|
||||
enum class SearchType {
|
||||
NAME = 0,
|
||||
ALL_SEGMENTS = 10,
|
||||
CONDITIONS = 20,
|
||||
ACTIONS = 30,
|
||||
LABEL = 40,
|
||||
};
|
||||
|
||||
SearchType searchType = SearchType::NAME;
|
||||
std::string searchString;
|
||||
RegexConfig regex;
|
||||
bool showAlways = false;
|
||||
};
|
||||
|
||||
void CheckMacroSearchVisibility();
|
||||
void SetupMacroSearchWidgets(QLayout *searchLayout, QLineEdit *searchText,
|
||||
QPushButton *searchClear, QComboBox *searchType,
|
||||
RegexConfigWidget *searchRegex,
|
||||
QPushButton *showSettings,
|
||||
const std::function<void()> &refresh);
|
||||
MacroSearchSettings &GetMacroSearchSettings();
|
||||
bool MacroMatchesSearchFilter(Macro *macro);
|
||||
|
||||
} // namespace advss
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "macro-condition-edit.hpp"
|
||||
#include "macro-export-import-dialog.hpp"
|
||||
#include "macro-settings.hpp"
|
||||
#include "macro-search.hpp"
|
||||
#include "macro-signals.hpp"
|
||||
#include "macro-tree.hpp"
|
||||
#include "macro.hpp"
|
||||
@@ -207,7 +208,7 @@ void AdvSceneSwitcher::RemoveMacro(std::shared_ptr<Macro> ¯o)
|
||||
// Don't cache widgets for about to be deleted macros
|
||||
MacroSegmentList::SetCachingEnabled(false);
|
||||
ui->macros->Remove(macro);
|
||||
MacroSegmentList::SetCachingEnabled(!switcher->disableMacroWidgetCache);
|
||||
MacroSegmentList::SetCachingEnabled(true);
|
||||
|
||||
MacroSignalManager::Instance()->Remove(name);
|
||||
}
|
||||
@@ -615,17 +616,20 @@ setupToolBar(const std::initializer_list<std::initializer_list<QWidget *>>
|
||||
auto toolbar = new QToolBar();
|
||||
toolbar->setIconSize({16, 16});
|
||||
|
||||
QAction *lastSeperator = nullptr;
|
||||
QAction *lastSeparator = nullptr;
|
||||
|
||||
for (const auto &widgetGroup : widgetGroups) {
|
||||
for (const auto &widget : widgetGroup) {
|
||||
if (!widget) {
|
||||
continue;
|
||||
}
|
||||
toolbar->addWidget(widget);
|
||||
}
|
||||
lastSeperator = toolbar->addSeparator();
|
||||
lastSeparator = toolbar->addSeparator();
|
||||
}
|
||||
|
||||
if (lastSeperator) {
|
||||
toolbar->removeAction(lastSeperator);
|
||||
if (lastSeparator) {
|
||||
toolbar->removeAction(lastSeparator);
|
||||
}
|
||||
|
||||
// Prevent "extension" button from showing up
|
||||
@@ -638,7 +642,9 @@ void AdvSceneSwitcher::SetupMacroTab()
|
||||
{
|
||||
ui->macros->installEventFilter(this);
|
||||
|
||||
if (GetTopLevelMacros().size() == 0 && !switcher->disableHints) {
|
||||
auto ¯os = GetTopLevelMacros();
|
||||
|
||||
if (macros.size() == 0 && !switcher->disableHints) {
|
||||
addPulse = HighlightWidget(ui->macroAdd, QColor(Qt::green));
|
||||
}
|
||||
|
||||
@@ -646,8 +652,7 @@ void AdvSceneSwitcher::SetupMacroTab()
|
||||
{ui->macroUp, ui->macroDown}});
|
||||
ui->macroControlLayout->addWidget(macroControls);
|
||||
|
||||
ui->macros->Reset(GetTopLevelMacros(),
|
||||
GetGlobalMacroSettings()._highlightExecuted);
|
||||
ui->macros->Reset(macros, GetGlobalMacroSettings()._highlightExecuted);
|
||||
connect(ui->macros, SIGNAL(MacroSelectionChanged()), this,
|
||||
SLOT(MacroSelectionChanged()));
|
||||
ui->runMacro->SetMacroTree(ui->macros);
|
||||
@@ -676,6 +681,12 @@ void AdvSceneSwitcher::SetupMacroTab()
|
||||
switcher->macroListMacroEditSplitterPosition);
|
||||
}
|
||||
}
|
||||
|
||||
SetupMacroSearchWidgets(ui->macroSearchLayout, ui->macroSearchText,
|
||||
ui->macroSearchClear, ui->macroSearchType,
|
||||
ui->macroSearchRegex,
|
||||
ui->macroSearchShowSettings,
|
||||
[this]() { ui->macros->RefreshFilter(); });
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::ShowMacroContextMenu(const QPoint &pos)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "macro-tree.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "macro-search.hpp"
|
||||
#include "macro-signals.hpp"
|
||||
#include "path-helpers.hpp"
|
||||
#include "sync-helpers.hpp"
|
||||
@@ -783,7 +784,8 @@ void MacroTree::Reset(std::deque<std::shared_ptr<Macro>> ¯os,
|
||||
bool highlight)
|
||||
{
|
||||
_highlight = highlight;
|
||||
MacroTreeModel *mtm = new MacroTreeModel(this, macros);
|
||||
|
||||
auto mtm = new MacroTreeModel(this, macros);
|
||||
setModel(mtm);
|
||||
GetModel()->Reset(macros);
|
||||
connect(selectionModel(),
|
||||
@@ -869,7 +871,7 @@ void MacroTree::UpdateWidgets(bool force)
|
||||
|
||||
for (int i = 0; i < (int)mtm->_macros.size(); i++) {
|
||||
std::shared_ptr<Macro> item = mtm->_macros[i];
|
||||
MacroTreeItem *widget = GetItemWidget(i);
|
||||
auto widget = GetItemWidget(i);
|
||||
|
||||
if (!widget) {
|
||||
UpdateWidget(mtm->createIndex(i, 0, nullptr), item);
|
||||
@@ -1204,6 +1206,12 @@ void MacroTree::CollapseGroup(std::shared_ptr<Macro> item) const
|
||||
mtm->CollapseGroup(item);
|
||||
}
|
||||
|
||||
void MacroTree::RefreshFilter()
|
||||
{
|
||||
UpdateWidgets();
|
||||
doItemsLayout();
|
||||
}
|
||||
|
||||
void MacroTree::MoveItemBefore(const std::shared_ptr<Macro> &item,
|
||||
const std::shared_ptr<Macro> &after) const
|
||||
{
|
||||
@@ -1218,7 +1226,7 @@ void MacroTree::MoveItemAfter(const std::shared_ptr<Macro> &item,
|
||||
|
||||
MacroTreeModel *MacroTree::GetModel() const
|
||||
{
|
||||
return reinterpret_cast<MacroTreeModel *>(model());
|
||||
return qobject_cast<MacroTreeModel *>(model());
|
||||
}
|
||||
|
||||
void MacroTree::Remove(std::shared_ptr<Macro> item) const
|
||||
@@ -1333,8 +1341,8 @@ void MacroTree::SelectionChangedHelper(const QItemSelection &,
|
||||
|
||||
inline MacroTreeItem *MacroTree::GetItemWidget(int idx) const
|
||||
{
|
||||
QWidget *widget = indexWidget(GetModel()->createIndex(idx, 0, nullptr));
|
||||
return reinterpret_cast<MacroTreeItem *>(widget);
|
||||
auto widget = indexWidget(GetModel()->createIndex(idx, 0, nullptr));
|
||||
return qobject_cast<MacroTreeItem *>(widget);
|
||||
}
|
||||
|
||||
void MacroTree::paintEvent(QPaintEvent *event)
|
||||
@@ -1361,14 +1369,25 @@ MacroTreeDelegate::MacroTreeDelegate(QObject *parent)
|
||||
QSize MacroTreeDelegate::sizeHint(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
MacroTree *tree = qobject_cast<MacroTree *>(parent());
|
||||
QWidget *item = tree->indexWidget(index);
|
||||
auto tree = qobject_cast<MacroTree *>(parent());
|
||||
auto widget = tree->indexWidget(index);
|
||||
|
||||
if (!item) {
|
||||
if (!widget) {
|
||||
return QStyledItemDelegate::sizeHint(option, index);
|
||||
}
|
||||
|
||||
return QSize(item->sizeHint());
|
||||
auto name = index.data(Qt::AccessibleTextRole).toString();
|
||||
auto macro = GetMacroByQString(name);
|
||||
|
||||
if (!macro) {
|
||||
return QStyledItemDelegate::sizeHint(option, index);
|
||||
}
|
||||
|
||||
if (MacroMatchesSearchFilter(macro)) {
|
||||
return QSize(widget->sizeHint());
|
||||
}
|
||||
|
||||
return QSize(0, 0);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
||||
@@ -142,6 +142,7 @@ public:
|
||||
bool GroupsExist() const;
|
||||
void ExpandGroup(std::shared_ptr<Macro> item) const;
|
||||
void CollapseGroup(std::shared_ptr<Macro> item) const;
|
||||
void RefreshFilter();
|
||||
|
||||
public slots:
|
||||
void GroupSelectedItems();
|
||||
|
||||
@@ -1255,33 +1255,6 @@ void StopAllMacros()
|
||||
}
|
||||
}
|
||||
|
||||
Macro *GetMacroByName(const char *name)
|
||||
{
|
||||
for (const auto &m : GetTopLevelMacros()) {
|
||||
if (m->Name() == name) {
|
||||
return m.get();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Macro *GetMacroByQString(const QString &name)
|
||||
{
|
||||
return GetMacroByName(name.toUtf8().constData());
|
||||
}
|
||||
|
||||
std::weak_ptr<Macro> GetWeakMacroByName(const char *name)
|
||||
{
|
||||
for (const auto &m : GetTopLevelMacros()) {
|
||||
if (m->Name() == name) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void InvalidateMacroTempVarValues()
|
||||
{
|
||||
for (const auto &m : GetTopLevelMacros()) {
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include "temp-variable.hpp"
|
||||
|
||||
#include <future>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
@@ -220,9 +218,6 @@ void SaveMacros(obs_data_t *obj);
|
||||
bool CheckMacros();
|
||||
bool RunMacros();
|
||||
void StopAllMacros();
|
||||
Macro *GetMacroByName(const char *name);
|
||||
Macro *GetMacroByQString(const QString &name);
|
||||
std::weak_ptr<Macro> GetWeakMacroByName(const char *name);
|
||||
void InvalidateMacroTempVarValues();
|
||||
std::shared_ptr<Macro> GetMacroWithInvalidConditionInterval();
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ bool IsFullscreen(const std::string &title)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<std::string> GetTextInWindow(const std::string &window)
|
||||
std::optional<std::string> GetTextInWindow(const std::string &)
|
||||
{
|
||||
// Not implemented
|
||||
return {};
|
||||
|
||||
@@ -163,7 +163,6 @@ public:
|
||||
bool warnPluginLoadFailure = true;
|
||||
bool disableHints = false;
|
||||
bool disableFilterComboboxFilter = false;
|
||||
bool disableMacroWidgetCache = false;
|
||||
bool hideLegacyTabs = true;
|
||||
bool saveWindowGeo = false;
|
||||
QPoint windowPos = {};
|
||||
|
||||
@@ -67,7 +67,7 @@ int GetCanvasCount()
|
||||
return 1;
|
||||
#else
|
||||
static const auto enumCanvases = [](void *countPtr,
|
||||
obs_canvas_t *canvas) -> bool {
|
||||
obs_canvas_t *) -> bool {
|
||||
auto count = static_cast<int *>(countPtr);
|
||||
(*count)++;
|
||||
return true;
|
||||
@@ -145,6 +145,15 @@ OBSWeakSource GetActiveCanvasScene(const OBSWeakCanvas &weakCanvas)
|
||||
}
|
||||
#endif
|
||||
|
||||
OBSCanvasAutoRelease mainCanvas = obs_get_main_canvas();
|
||||
|
||||
// The frontend scene order does not necessarily match the order of the
|
||||
// scenes in the canvas.
|
||||
if (canvas == mainCanvas) {
|
||||
OBSSourceAutoRelease scene = obs_frontend_get_current_scene();
|
||||
return OBSGetWeakRef(scene);
|
||||
}
|
||||
|
||||
static const auto enumCanvasScenes = [](void *scenePtr,
|
||||
obs_source_t *source) -> bool {
|
||||
auto scene = static_cast<OBSWeakSource *>(scenePtr);
|
||||
@@ -181,6 +190,25 @@ OBSWeakSource GetSceneAtIndex(const OBSWeakCanvas &weakCanvas, int idx)
|
||||
}
|
||||
#endif
|
||||
|
||||
OBSCanvasAutoRelease mainCanvas = obs_get_main_canvas();
|
||||
|
||||
// The frontend scene order does not necessarily match the order of the
|
||||
// scenes in the canvas.
|
||||
// So, rely on obs_frontend_get_scenes() in case of the main canvas
|
||||
// instead.
|
||||
if (canvas == mainCanvas) {
|
||||
struct obs_frontend_source_list scenes = {0};
|
||||
obs_frontend_get_scenes(&scenes);
|
||||
if (idx >= (int)scenes.sources.num) {
|
||||
obs_frontend_source_list_free(&scenes);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto scene = OBSGetWeakRef(scenes.sources.array[idx]);
|
||||
obs_frontend_source_list_free(&scenes);
|
||||
return scene;
|
||||
}
|
||||
|
||||
struct Data {
|
||||
const int idx;
|
||||
int currentIdx;
|
||||
@@ -223,6 +251,29 @@ int GetIndexOfScene(const OBSWeakCanvas &weakCanvas, const OBSWeakSource &scene)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
OBSCanvasAutoRelease mainCanvas = obs_get_main_canvas();
|
||||
|
||||
// The frontend scene order does not necessarily match the order of the
|
||||
// scenes in the canvas.
|
||||
// So, rely on obs_frontend_get_scenes() in case of the main canvas
|
||||
// instead.
|
||||
if (canvas == mainCanvas) {
|
||||
struct obs_frontend_source_list scenes = {0};
|
||||
obs_frontend_get_scenes(&scenes);
|
||||
|
||||
OBSSourceAutoRelease sceneSource = OBSGetStrongRef(scene);
|
||||
int idx = 0;
|
||||
|
||||
for (size_t i = 0; i < scenes.sources.num; i++) {
|
||||
if (scenes.sources.array[i] == sceneSource) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
obs_frontend_source_list_free(&scenes);
|
||||
return idx;
|
||||
}
|
||||
|
||||
struct Data {
|
||||
int idx;
|
||||
@@ -246,6 +297,12 @@ int GetIndexOfScene(const OBSWeakCanvas &weakCanvas, const OBSWeakSource &scene)
|
||||
return data.idx;
|
||||
}
|
||||
|
||||
OBSWeakCanvas GetMainCanvas()
|
||||
{
|
||||
OBSCanvasAutoRelease mainCanvas = obs_get_main_canvas();
|
||||
return OBSGetWeakRef(mainCanvas);
|
||||
}
|
||||
|
||||
#if LIBOBS_API_VER < MAKE_SEMANTIC_VERSION(31, 1, 0)
|
||||
|
||||
obs_canvas_t *obs_canvas_get_ref(obs_canvas_t *)
|
||||
|
||||
@@ -42,6 +42,7 @@ EXPORT OBSWeakSource GetActiveCanvasScene(const OBSWeakCanvas &canvas);
|
||||
EXPORT OBSWeakSource GetSceneAtIndex(const OBSWeakCanvas &weakCanvas, int idx);
|
||||
EXPORT int GetIndexOfScene(const OBSWeakCanvas &weakCanvas,
|
||||
const OBSWeakSource &scene);
|
||||
EXPORT OBSWeakCanvas GetMainCanvas();
|
||||
|
||||
class CanvasSelection : public FilterComboBox {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -56,7 +56,7 @@ std::optional<double> GetDouble(const std::string &str)
|
||||
std::optional<int> GetInt(const std::string &str)
|
||||
{
|
||||
char *end = nullptr;
|
||||
int value = std::strtol(str.c_str(), &end, 10);
|
||||
int value = (int)std::strtol(str.c_str(), &end, 10);
|
||||
|
||||
if (end != str.c_str() && *end == '\0' && value != INT_MAX &&
|
||||
value != INT_MIN) {
|
||||
|
||||
@@ -103,10 +103,11 @@ void SceneSelection::Load(obs_data_t *obj, const char *name,
|
||||
OBSDataAutoRelease data =
|
||||
obs_data_get_obj(obj, selectionSaveName.data());
|
||||
|
||||
if (obs_data_has_user_value(data, canvasSaveName.data())) {
|
||||
_canvas = GetWeakCanvasByName(
|
||||
obs_data_get_string(data, canvasSaveName.data()));
|
||||
} else {
|
||||
const char *canvasName =
|
||||
obs_data_get_string(data, canvasSaveName.data());
|
||||
_canvas = GetWeakCanvasByName(
|
||||
obs_data_get_string(data, canvasSaveName.data()));
|
||||
if (strcmp(canvasName, "") == 0) {
|
||||
OBSCanvasAutoRelease mainCanvas = obs_get_main_canvas();
|
||||
_canvas = obs_canvas_get_weak_canvas(mainCanvas);
|
||||
obs_weak_canvas_release(_canvas);
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
private:
|
||||
OBSWeakSource _scene;
|
||||
OBSWeakCanvas _canvas;
|
||||
OBSWeakCanvas _canvas = GetMainCanvas();
|
||||
SceneGroup *_group = nullptr;
|
||||
std::weak_ptr<Variable> _variable;
|
||||
Type _type = Type::SCENE;
|
||||
|
||||
@@ -467,9 +467,9 @@ static void setupTab(QTabWidget *tab)
|
||||
setTabVisible(tab, false);
|
||||
}
|
||||
|
||||
QWidget::connect(
|
||||
VariableSignalManager::Instance(), &VariableSignalManager::Add,
|
||||
tab, [tab](const QString &name) { setTabVisible(tab, true); });
|
||||
QWidget::connect(VariableSignalManager::Instance(),
|
||||
&VariableSignalManager::Add, tab,
|
||||
[tab](const QString &) { setTabVisible(tab, true); });
|
||||
}
|
||||
|
||||
void VariableTable::Settings::Save(obs_data_t *data, const char *name)
|
||||
|
||||
@@ -137,31 +137,51 @@ bool MacroActionSwitchScene::WaitForTransition(OBSWeakSource &scene,
|
||||
bool MacroActionSwitchScene::PerformAction()
|
||||
{
|
||||
OBSWeakSource sceneToSwitchTo;
|
||||
OBSWeakCanvas canvas;
|
||||
OBSWeakCanvas canvasToSwitchFor;
|
||||
|
||||
OBSCanvasAutoRelease mainCanvas = obs_get_main_canvas();
|
||||
OBSWeakCanvas mainCanvasWeak = OBSGetWeakRef(mainCanvas);
|
||||
|
||||
const auto getActiveSceneHelper = [this](const OBSWeakCanvas &canvas) {
|
||||
OBSWeakSource activeScene;
|
||||
if (IsMainCanvas(canvas) && _sceneType == SceneType::PREVIEW) {
|
||||
OBSSourceAutoRelease previewSource =
|
||||
obs_frontend_get_current_preview_scene();
|
||||
return OBSGetWeakRef(previewSource);
|
||||
} else {
|
||||
return GetActiveCanvasScene(canvas);
|
||||
}
|
||||
};
|
||||
|
||||
switch (_action) {
|
||||
case Action::SCENE_NAME:
|
||||
sceneToSwitchTo = _scene.GetScene();
|
||||
canvas = _scene.GetCanvas();
|
||||
canvasToSwitchFor = _scene.GetCanvas();
|
||||
break;
|
||||
case Action::SCENE_LIST_NEXT: {
|
||||
const auto activeScene = GetActiveCanvasScene(_canvas);
|
||||
const int currentIndex = GetIndexOfScene(_canvas, activeScene);
|
||||
sceneToSwitchTo = GetSceneAtIndex(_canvas, currentIndex + 1);
|
||||
canvas = _canvas;
|
||||
canvasToSwitchFor = _canvas ? _canvas : mainCanvasWeak;
|
||||
const auto activeScene =
|
||||
getActiveSceneHelper(canvasToSwitchFor);
|
||||
const int currentIndex =
|
||||
GetIndexOfScene(canvasToSwitchFor, activeScene);
|
||||
sceneToSwitchTo =
|
||||
GetSceneAtIndex(canvasToSwitchFor, currentIndex + 1);
|
||||
break;
|
||||
}
|
||||
case Action::SCENE_LIST_PREVIOUS: {
|
||||
const auto activeScene = GetActiveCanvasScene(_canvas);
|
||||
const int currentIndex = GetIndexOfScene(_canvas, activeScene);
|
||||
sceneToSwitchTo = GetSceneAtIndex(_canvas, currentIndex - 1);
|
||||
canvas = _canvas;
|
||||
canvasToSwitchFor = _canvas ? _canvas : mainCanvasWeak;
|
||||
const auto activeScene =
|
||||
getActiveSceneHelper(canvasToSwitchFor);
|
||||
const int currentIndex =
|
||||
GetIndexOfScene(canvasToSwitchFor, activeScene);
|
||||
sceneToSwitchTo =
|
||||
GetSceneAtIndex(canvasToSwitchFor, currentIndex - 1);
|
||||
break;
|
||||
}
|
||||
case Action::SCENE_LIST_INDEX: {
|
||||
sceneToSwitchTo =
|
||||
GetSceneAtIndex(_canvas, _index.GetValue() - 1);
|
||||
canvas = _canvas;
|
||||
canvasToSwitchFor = _canvas ? _canvas : mainCanvasWeak;
|
||||
sceneToSwitchTo = GetSceneAtIndex(canvasToSwitchFor,
|
||||
_index.GetValue() - 1);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -176,11 +196,12 @@ bool MacroActionSwitchScene::PerformAction()
|
||||
}
|
||||
|
||||
auto transition = _transition.GetTransition();
|
||||
SwitchScene({sceneToSwitchTo, transition,
|
||||
(int)(_duration.Milliseconds())},
|
||||
obs_frontend_preview_program_mode_active(), canvas);
|
||||
SwitchScene(
|
||||
{sceneToSwitchTo, transition, (int)(_duration.Milliseconds())},
|
||||
obs_frontend_preview_program_mode_active(), canvasToSwitchFor);
|
||||
if (_blockUntilTransitionDone && sceneToSwitchTo &&
|
||||
sceneToSwitchTo != GetCurrentScene() && IsMainCanvas(canvas)) {
|
||||
sceneToSwitchTo != GetCurrentScene() &&
|
||||
IsMainCanvas(canvasToSwitchFor)) {
|
||||
return WaitForTransition(sceneToSwitchTo, transition);
|
||||
}
|
||||
return true;
|
||||
@@ -392,6 +413,7 @@ void MacroActionSwitchSceneEdit::SetWidgetData() const
|
||||
_sceneTypes->setCurrentIndex(_sceneTypes->findData(
|
||||
static_cast<int>(_entryData->_sceneType)));
|
||||
_scenes->SetScene(_entryData->_scene);
|
||||
_canvas->SetCanvas(_entryData->_canvas);
|
||||
_transitions->SetTransition(_entryData->_transition);
|
||||
_duration->SetDuration(_entryData->_duration);
|
||||
_blockUntilTransitionDone->setChecked(
|
||||
@@ -431,7 +453,7 @@ void MacroActionSwitchSceneEdit::SceneSelectionCanvasChanged(
|
||||
SetWidgetVisibility();
|
||||
}
|
||||
|
||||
void MacroActionSwitchSceneEdit::ActionChanged(int value)
|
||||
void MacroActionSwitchSceneEdit::ActionChanged(int)
|
||||
{
|
||||
GUARD_LOADING_AND_LOCK();
|
||||
_entryData->_action = static_cast<MacroActionSwitchScene::Action>(
|
||||
@@ -561,9 +583,17 @@ void MacroActionSwitchSceneEdit::SetWidgetVisibility()
|
||||
{{"{{transitions}}", _transitions},
|
||||
{"{{duration}}", _duration}});
|
||||
|
||||
const auto canvas = action == MacroActionSwitchScene::Action::SCENE_NAME
|
||||
? _entryData->_scene.GetCanvas()
|
||||
: _entryData->_canvas;
|
||||
OBSWeakCanvas canvas;
|
||||
if (action == MacroActionSwitchScene::Action::SCENE_NAME) {
|
||||
canvas = _entryData->_scene.GetCanvas();
|
||||
} else {
|
||||
if (_entryData->_canvas) {
|
||||
canvas = _entryData->_canvas;
|
||||
} else {
|
||||
OBSCanvasAutoRelease mainCanvas = obs_get_main_canvas();
|
||||
canvas = OBSGetWeakRef(mainCanvas);
|
||||
}
|
||||
}
|
||||
const bool isMainCanvas = IsMainCanvas(canvas);
|
||||
SetLayoutVisible(_transitionLayout, isMainCanvas);
|
||||
_blockUntilTransitionDone->setVisible(isMainCanvas);
|
||||
@@ -580,7 +610,7 @@ void MacroActionSwitchSceneEdit::SetWidgetVisibility()
|
||||
_notSupportedWarning->setText(
|
||||
fmt.arg(QString::fromStdString(GetWeakCanvasName(canvas))));
|
||||
_notSupportedWarning->setVisible(
|
||||
!IsMainCanvas(canvas) &&
|
||||
!isMainCanvas &&
|
||||
_entryData->_sceneType ==
|
||||
MacroActionSwitchScene::SceneType::PREVIEW);
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ void MacroConditionProcessEdit::ProcessChanged(const QString &text)
|
||||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionProcessEdit::showEvent(QShowEvent *event)
|
||||
void MacroConditionProcessEdit::showEvent(QShowEvent *)
|
||||
{
|
||||
const QSignalBlocker b(_processSelection);
|
||||
const auto text = _processSelection->currentText();
|
||||
|
||||
@@ -31,6 +31,10 @@ static int currentRecordingDurationInSeconds = 0;
|
||||
|
||||
bool MacroConditionRecord::CheckCondition()
|
||||
{
|
||||
char *lastSavePath = obs_frontend_get_last_recording();
|
||||
SetTempVarValue("lastSavePath", lastSavePath ? lastSavePath : "");
|
||||
bfree(lastSavePath);
|
||||
|
||||
switch (_condition) {
|
||||
case Condition::STOP:
|
||||
return !obs_frontend_recording_active();
|
||||
@@ -74,6 +78,14 @@ void MacroConditionRecord::SetCondition(Condition condition)
|
||||
void MacroConditionRecord::SetupTempVars()
|
||||
{
|
||||
MacroCondition::SetupTempVars();
|
||||
|
||||
AddTempvar(
|
||||
"lastSavePath",
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.tempVar.recording.lastSavePath"),
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.tempVar.recording.lastSavePath.description"));
|
||||
|
||||
switch (_condition) {
|
||||
case Condition::DURATION:
|
||||
AddTempvar(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "token.hpp"
|
||||
#include "twitch-helpers.hpp"
|
||||
|
||||
#include <help-icon.hpp>
|
||||
#include <layout-helpers.hpp>
|
||||
#include <log-helper.hpp>
|
||||
#include <obs-module-helper.hpp>
|
||||
@@ -163,7 +164,8 @@ TwitchToken::TwitchToken(const TwitchToken &other)
|
||||
_userID(other._userID),
|
||||
_tokenOptions(other._tokenOptions),
|
||||
_eventSub(),
|
||||
_validateEventSubTimestamps(other._validateEventSubTimestamps)
|
||||
_validateEventSubTimestamps(other._validateEventSubTimestamps),
|
||||
_warnIfInvalid(other._warnIfInvalid)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -174,6 +176,7 @@ TwitchToken &TwitchToken::operator=(const TwitchToken &other)
|
||||
_userID = other._userID;
|
||||
_tokenOptions = other._tokenOptions;
|
||||
_validateEventSubTimestamps = other._validateEventSubTimestamps;
|
||||
_warnIfInvalid = other._warnIfInvalid;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -185,6 +188,9 @@ void TwitchToken::Load(obs_data_t *obj)
|
||||
obs_data_set_default_bool(obj, "validateEventSubTimestamps", true);
|
||||
_validateEventSubTimestamps =
|
||||
obs_data_get_bool(obj, "validateEventSubTimestamps");
|
||||
_warnIfInvalid = obs_data_has_user_value(obj, "warnIfInvalid")
|
||||
? obs_data_get_bool(obj, "warnIfInvalid")
|
||||
: true;
|
||||
_tokenOptions.clear();
|
||||
OBSDataArrayAutoRelease options = obs_data_get_array(obj, "options");
|
||||
size_t count = obs_data_array_count(options);
|
||||
@@ -203,6 +209,7 @@ void TwitchToken::Save(obs_data_t *obj) const
|
||||
obs_data_set_string(obj, "userID", _userID.c_str());
|
||||
obs_data_set_bool(obj, "validateEventSubTimestamps",
|
||||
_validateEventSubTimestamps);
|
||||
obs_data_set_bool(obj, "warnIfInvalid", _warnIfInvalid);
|
||||
OBSDataArrayAutoRelease options = obs_data_array_create();
|
||||
for (auto &option : _tokenOptions) {
|
||||
OBSDataAutoRelease arrayObj = obs_data_create();
|
||||
@@ -477,7 +484,9 @@ TwitchTokenSettingsDialog::TwitchTokenSettingsDialog(
|
||||
_tokenStatus(new QLabel()),
|
||||
_generalSettingsGrid(new QGridLayout()),
|
||||
_validateTimestamps(new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.twitchToken.validateTimestamps")))
|
||||
"AdvSceneSwitcher.twitchToken.validateTimestamps"))),
|
||||
_warnIfInvalid(new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.twitchToken.warnIfInvalid")))
|
||||
{
|
||||
_showToken->setMaximumWidth(22);
|
||||
_showToken->setFlat(true);
|
||||
@@ -539,11 +548,18 @@ TwitchTokenSettingsDialog::TwitchTokenSettingsDialog(
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
auto timestampsLayout = new QHBoxLayout();
|
||||
timestampsLayout->addWidget(_validateTimestamps);
|
||||
auto timestampHelp = new HelpIcon(obs_module_text(
|
||||
"AdvSceneSwitcher.twitchToken.validateTimestamps.tooltip"));
|
||||
timestampsLayout->addWidget(timestampHelp);
|
||||
|
||||
auto contentWidget = new QWidget(scrollArea);
|
||||
auto layout = new QVBoxLayout(contentWidget);
|
||||
layout->addLayout(_generalSettingsGrid);
|
||||
layout->addWidget(optionsBox);
|
||||
layout->addWidget(_validateTimestamps);
|
||||
layout->addLayout(timestampsLayout);
|
||||
layout->addWidget(_warnIfInvalid);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
scrollArea->setWidget(contentWidget);
|
||||
|
||||
@@ -569,6 +585,7 @@ TwitchTokenSettingsDialog::TwitchTokenSettingsDialog(
|
||||
#ifndef VERIFY_TIMESTAMPS
|
||||
_validateTimestamps->hide();
|
||||
#endif
|
||||
_warnIfInvalid->setChecked(settings._warnIfInvalid);
|
||||
|
||||
_currentToken = settings;
|
||||
|
||||
@@ -777,6 +794,8 @@ bool TwitchTokenSettingsDialog::AskForSettings(QWidget *parent,
|
||||
settings._tokenOptions = dialog.GetEnabledOptions();
|
||||
settings._validateEventSubTimestamps =
|
||||
dialog._validateTimestamps->isChecked();
|
||||
settings._warnIfInvalid = dialog._warnIfInvalid->isChecked();
|
||||
|
||||
if (settings._eventSub) {
|
||||
settings._eventSub->EnableTimestampValidation(
|
||||
settings._validateEventSubTimestamps);
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
std::shared_ptr<EventSub> GetEventSub();
|
||||
bool ValidateTimestamps() const { return _validateEventSubTimestamps; }
|
||||
bool IsValid(bool forceUpdate = false) const;
|
||||
bool WarnIfInvalid() const { return _warnIfInvalid; }
|
||||
void SetWarnIfInvalid(bool value) { _warnIfInvalid = value; }
|
||||
size_t PermissionCount() const { return _tokenOptions.size(); }
|
||||
|
||||
private:
|
||||
@@ -67,6 +69,7 @@ private:
|
||||
std::set<TokenOption> _tokenOptions = TokenOption::GetAllTokenOptions();
|
||||
std::shared_ptr<EventSub> _eventSub;
|
||||
bool _validateEventSubTimestamps = false;
|
||||
bool _warnIfInvalid = true;
|
||||
|
||||
static bool _setup;
|
||||
|
||||
@@ -131,6 +134,7 @@ private:
|
||||
TwitchToken _currentToken;
|
||||
std::unordered_map<std::string, QCheckBox *> _optionWidgets;
|
||||
QCheckBox *_validateTimestamps;
|
||||
QCheckBox *_warnIfInvalid;
|
||||
QTimer _validationTimer;
|
||||
};
|
||||
|
||||
|
||||
@@ -144,9 +144,14 @@ static void handleThrottling(const httplib::Result &response)
|
||||
return;
|
||||
}
|
||||
|
||||
blog(LOG_WARNING, "Twitch API access is throttled for %lld seconds!",
|
||||
if (sleepDuration < std::chrono::seconds(1)) {
|
||||
sleepDuration = std::chrono::seconds(1);
|
||||
}
|
||||
|
||||
blog(LOG_WARNING,
|
||||
"Twitch API access is throttled for %lld milliseconds!",
|
||||
static_cast<long long int>(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
sleepDuration)
|
||||
.count()));
|
||||
apiIsThrottling = true;
|
||||
|
||||
@@ -1,24 +1,47 @@
|
||||
#include "twitch-tab.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "sync-helpers.hpp"
|
||||
#include "tab-helpers.hpp"
|
||||
#include "token.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTabWidget>
|
||||
|
||||
namespace advss {
|
||||
|
||||
static bool registerTab();
|
||||
static bool setup();
|
||||
static void setupTab(QTabWidget *);
|
||||
static bool registerTabDone = registerTab();
|
||||
static bool setupDone = setup();
|
||||
|
||||
static TwitchConnectionsTable *tabWidget = nullptr;
|
||||
|
||||
static bool registerTab()
|
||||
static QStringList getInvalidTokens();
|
||||
|
||||
static bool setup()
|
||||
{
|
||||
AddSetupTabCallback("twitchConnectionTab",
|
||||
TwitchConnectionsTable::Create, setupTab);
|
||||
|
||||
static const auto showInvalidWarnings = []() {
|
||||
const auto invalidTokens = getInvalidTokens();
|
||||
for (const auto &token : invalidTokens) {
|
||||
QueueUITask(
|
||||
[](void *tokenPtr) {
|
||||
auto tokenName = static_cast<QString *>(
|
||||
tokenPtr);
|
||||
InvalidTokenDialog::ShowWarning(
|
||||
*tokenName);
|
||||
},
|
||||
(void *)&token);
|
||||
}
|
||||
};
|
||||
|
||||
AddLoadStep([](obs_data_t *) {
|
||||
AddPostLoadStep([]() { showInvalidWarnings(); });
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -188,6 +211,25 @@ static void updateConnectionStatus(QTableWidget *table)
|
||||
}
|
||||
}
|
||||
|
||||
static QStringList getInvalidTokens()
|
||||
{
|
||||
QStringList tokens;
|
||||
for (const auto &t : GetTwitchTokens()) {
|
||||
if (!t) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto token = std::static_pointer_cast<TwitchToken>(t);
|
||||
if (!token->WarnIfInvalid() || token->IsValid(true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tokens << QString::fromStdString(token->GetName());
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
static void setupTab(QTabWidget *tab)
|
||||
{
|
||||
if (GetTwitchTokens().empty()) {
|
||||
@@ -222,6 +264,63 @@ static void setupTab(QTabWidget *tab)
|
||||
updateConnectionStatus(tabWidget->Table());
|
||||
}
|
||||
});
|
||||
|
||||
const auto invalidTokens = getInvalidTokens();
|
||||
for (const auto &token : invalidTokens) {
|
||||
// Constructing the warning dialog in the constructor of the settings
|
||||
// window might lead to a crash, so wait for the settings window
|
||||
// constructor to complete
|
||||
QTimer::singleShot(0, tab, [token]() {
|
||||
InvalidTokenDialog::ShowWarning(token);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void InvalidTokenDialog::ShowWarning(const QString &tokenName)
|
||||
{
|
||||
auto weakToken = GetWeakTwitchTokenByQString(tokenName);
|
||||
auto token = weakToken.lock();
|
||||
if (!token) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dialog = new InvalidTokenDialog(tokenName);
|
||||
dialog->setWindowTitle(obs_module_text("AdvSceneSwitcher.windowTitle"));
|
||||
const bool ignore = dialog->exec() != DialogCode::Accepted;
|
||||
token->SetWarnIfInvalid(!dialog->_doNotShowAgain->isChecked());
|
||||
dialog->deleteLater();
|
||||
|
||||
if (ignore) {
|
||||
return;
|
||||
}
|
||||
|
||||
TwitchTokenSettingsDialog::AskForSettings(GetSettingsWindow(),
|
||||
*token.get());
|
||||
}
|
||||
|
||||
InvalidTokenDialog::InvalidTokenDialog(const QString &name)
|
||||
: QDialog(GetSettingsWindow()),
|
||||
_doNotShowAgain(new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.twitchToken.warnIfInvalid.doNotShowAgain")))
|
||||
{
|
||||
auto buttons = new QDialogButtonBox(QDialogButtonBox::Ignore |
|
||||
QDialogButtonBox::Open);
|
||||
|
||||
connect(buttons->button(QDialogButtonBox::Ignore),
|
||||
&QPushButton::clicked, this, &QDialog::reject);
|
||||
connect(buttons->button(QDialogButtonBox::Open), &QPushButton::clicked,
|
||||
this, &QDialog::accept);
|
||||
buttons->setCenterButtons(true);
|
||||
|
||||
const QString format(obs_module_text(
|
||||
"AdvSceneSwitcher.twitchToken.warnIfInvalid.message"));
|
||||
const QString message = format.arg(name);
|
||||
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->addWidget(new QLabel(message));
|
||||
layout->addWidget(_doNotShowAgain);
|
||||
layout->addWidget(buttons);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
#include "resource-table.hpp"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
|
||||
namespace advss {
|
||||
|
||||
class TwitchConnectionsTable final : public ResourceTable {
|
||||
@@ -17,4 +20,14 @@ private:
|
||||
TwitchConnectionsTable(QTabWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
class InvalidTokenDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void ShowWarning(const QString &name);
|
||||
|
||||
private:
|
||||
InvalidTokenDialog(const QString &name);
|
||||
QCheckBox *_doNotShowAgain;
|
||||
};
|
||||
|
||||
} // namespace advss
|
||||
|
||||
@@ -106,8 +106,11 @@ target_sources(
|
||||
|
||||
# --- variable --- #
|
||||
|
||||
if(NOT OS_WINDOWS)
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-error=shadow)
|
||||
if(OS_WINDOWS)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /wd4100)
|
||||
else()
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-error=shadow
|
||||
-Wno-unused-parameter)
|
||||
endif()
|
||||
|
||||
target_sources(
|
||||
|
||||
Reference in New Issue
Block a user