Compare commits
238 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ada858046 | ||
|
|
51d121bda2 | ||
|
|
a7cf5769dd | ||
|
|
63ee36ddfe | ||
|
|
43967f5ded | ||
|
|
c043053b2b | ||
|
|
220f27bd0a | ||
|
|
83914d5378 | ||
|
|
57e4b1a3f1 | ||
|
|
c85e556924 | ||
|
|
8c0be8011d | ||
|
|
7914f75876 | ||
|
|
7d1253e14e | ||
|
|
d7c58b3eb3 | ||
|
|
fb664b6f08 | ||
|
|
258a6d076e | ||
|
|
32ab060153 | ||
|
|
91d3784f9b | ||
|
|
8a5aac3d31 | ||
|
|
06c6effb7d | ||
|
|
f3789c05bd | ||
|
|
c64e1f5e51 | ||
|
|
5d8e24c19a | ||
|
|
f756de05c3 | ||
|
|
574fdb496f | ||
|
|
5580da69eb | ||
|
|
35274863c9 | ||
|
|
1f31b81f0d | ||
|
|
cde111ddeb | ||
|
|
845c12c01c | ||
|
|
99a0118d31 | ||
|
|
bb7ee17362 | ||
|
|
70854ef012 | ||
|
|
053c14056d | ||
|
|
9397d50764 | ||
|
|
473e24cc42 | ||
|
|
d9394605f4 | ||
|
|
d2b9074852 | ||
|
|
b525eb7a0e | ||
|
|
3805aaeeec | ||
|
|
50dc404689 | ||
|
|
975eacbc7e | ||
|
|
7e56dc35b8 | ||
|
|
b3566d98bf | ||
|
|
15379a8e20 | ||
|
|
1e178f4223 | ||
|
|
c16a7b93ea | ||
|
|
f89bb1a750 | ||
|
|
79961aabe4 | ||
|
|
4686fc2b01 | ||
|
|
569b915c07 | ||
|
|
324d3fe7a5 | ||
|
|
ae8d0bf5cb | ||
|
|
17efa82057 | ||
|
|
c17523a476 | ||
|
|
33635d6991 | ||
|
|
d290dbe86b | ||
|
|
c1f5c49eda | ||
|
|
c3f4caa6f3 | ||
|
|
d4c7b0e455 | ||
|
|
b0cb52fe90 | ||
|
|
386f831cd4 | ||
|
|
449daa80cc | ||
|
|
3003547b83 | ||
|
|
1664eb672f | ||
|
|
0939dcacb6 | ||
|
|
54b81d1a42 | ||
|
|
626606100f | ||
|
|
53a0b76e8c | ||
|
|
e16ac9400a | ||
|
|
94060c236b | ||
|
|
890792c270 | ||
|
|
7bc1fc3d0d | ||
|
|
9ea90ed61b | ||
|
|
ce40b80d90 | ||
|
|
53fcd94c5a | ||
|
|
ecb6247959 | ||
|
|
3b4cb6934d | ||
|
|
babe93a6ce | ||
|
|
1e9173699c | ||
|
|
37ba7aa2ca | ||
|
|
a83d2d9910 | ||
|
|
0449064f5d | ||
|
|
6cf1073a3c | ||
|
|
9ac9171206 | ||
|
|
25ce8cd2e4 | ||
|
|
e50522ab89 | ||
|
|
4801502f32 | ||
|
|
e13e4b5ddd | ||
|
|
de8da553f1 | ||
|
|
6558792e73 | ||
|
|
ea5e92017e | ||
|
|
46199efb58 | ||
|
|
8a6eae6c97 | ||
|
|
67eef8a004 | ||
|
|
b5341e5cde | ||
|
|
ac6140b17a | ||
|
|
b1489d98f0 | ||
|
|
3b7119ec58 | ||
|
|
efa34d080e | ||
|
|
19a6277841 | ||
|
|
107e1413ed | ||
|
|
94416dd881 | ||
|
|
8efc39958f | ||
|
|
569f794e33 | ||
|
|
fc1460e592 | ||
|
|
d6e4ee0203 | ||
|
|
0c8135078d | ||
|
|
24f4b864c4 | ||
|
|
41e47f32b6 | ||
|
|
a73ccb15a1 | ||
|
|
36a78f49a5 | ||
|
|
cbd459b0a5 | ||
|
|
03bb1fd089 | ||
|
|
4e2c254717 | ||
|
|
fffb6c5f29 | ||
|
|
81f669e226 | ||
|
|
6484ae54c0 | ||
|
|
1c52caf5e9 | ||
|
|
ce1d4cce57 | ||
|
|
8246197ae6 | ||
|
|
8f90bf8846 | ||
|
|
b955e8a0ea | ||
|
|
81da32f7a2 | ||
|
|
5324fa9350 | ||
|
|
c375daa258 | ||
|
|
4f3bd699c8 | ||
|
|
f5024621c0 | ||
|
|
8308506d71 | ||
|
|
6605c19202 | ||
|
|
fdf1a94f97 | ||
|
|
6b6e37da92 | ||
|
|
0f0fc8ae4e | ||
|
|
4d7e2992e5 | ||
|
|
a5050d4810 | ||
|
|
9df6963f08 | ||
|
|
b833dd4576 | ||
|
|
39378ae20f | ||
|
|
5a2cb943f7 | ||
|
|
b88209f63d | ||
|
|
9c848938f8 | ||
|
|
07b86dda41 | ||
|
|
49e8bf7639 | ||
|
|
a2d0a7f544 | ||
|
|
1a8c894ddf | ||
|
|
3f51f63298 | ||
|
|
a0b4df574b | ||
|
|
68c6492c3f | ||
|
|
0ba7ba77d8 | ||
|
|
04b2b3474d | ||
|
|
ecbb5ebbd7 | ||
|
|
b62757b65d | ||
|
|
b1a3ab5493 | ||
|
|
abc3357180 | ||
|
|
29f9cba236 | ||
|
|
9a62522140 | ||
|
|
666c52556e | ||
|
|
1c0734d1cb | ||
|
|
1304ac7336 | ||
|
|
884fb1b637 | ||
|
|
a82bce947f | ||
|
|
d5241f0700 | ||
|
|
f24f258c9c | ||
|
|
eddd9fa8ab | ||
|
|
6cc224aeec | ||
|
|
4b0a631987 | ||
|
|
dcae0e8e8b | ||
|
|
29f810a2a0 | ||
|
|
719dfa7b72 | ||
|
|
259aac8fcd | ||
|
|
5be2cd278f | ||
|
|
211eac5313 | ||
|
|
f92ed3139d | ||
|
|
bdff84c605 | ||
|
|
08e430396a | ||
|
|
df7fc7ec01 | ||
|
|
9eef581161 | ||
|
|
52811e44f4 | ||
|
|
7b1c56877e | ||
|
|
78d73af589 | ||
|
|
d9c1ef4c22 | ||
|
|
93f96ee660 | ||
|
|
d25a8d4efb | ||
|
|
1f22278496 | ||
|
|
70b705e0fd | ||
|
|
9e1dfdc3f0 | ||
|
|
47d6d4ac06 | ||
|
|
fe3586b6f4 | ||
|
|
650881204f | ||
|
|
8c0ba112e2 | ||
|
|
a17d8f7e09 | ||
|
|
371b4ae05d | ||
|
|
1d7ce510f7 | ||
|
|
d759ded64d | ||
|
|
0b2e1b88cc | ||
|
|
72a11eedfc | ||
|
|
1f02226620 | ||
|
|
ad8c29997c | ||
|
|
2c7c40c3f0 | ||
|
|
c9c0e4db2e | ||
|
|
dd880b13c0 | ||
|
|
76c759c8f4 | ||
|
|
284c8020b2 | ||
|
|
f506600b8c | ||
|
|
339418b5f3 | ||
|
|
2eca2cc2e9 | ||
|
|
4315d309f2 | ||
|
|
8d18bb363a | ||
|
|
592f31f059 | ||
|
|
300ad15ad0 | ||
|
|
91f93169eb | ||
|
|
5d95069291 | ||
|
|
e5bb9162ef | ||
|
|
6869cc8a01 | ||
|
|
55c7ac8a32 | ||
|
|
101a85b063 | ||
|
|
e7c6afbc6a | ||
|
|
18e19fb6c8 | ||
|
|
a7ccfc3282 | ||
|
|
85eb2a4235 | ||
|
|
3e3805b542 | ||
|
|
c59acd836a | ||
|
|
1e81181312 | ||
|
|
8a796efdb3 | ||
|
|
1a07a93552 | ||
|
|
bd74629420 | ||
|
|
dabb293cc0 | ||
|
|
b6031bd29a | ||
|
|
05fa3af2ac | ||
|
|
c52166bfec | ||
|
|
6d3964fa5d | ||
|
|
65545d85ba | ||
|
|
dea4ff47cd | ||
|
|
258a5f6ab7 | ||
|
|
2048ca2816 | ||
|
|
eb9e2e8062 | ||
|
|
3229bf0150 | ||
|
|
dfa12f9807 |
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -22,6 +22,7 @@ A clear and concise description of what you expected to happen.
|
|||||||
|
|
||||||
**Logs**
|
**Logs**
|
||||||
Please provide a log of your issue with verbose logging enabled (See General tab of the plugin).
|
Please provide a log of your issue with verbose logging enabled (See General tab of the plugin).
|
||||||
|
In case of a crash, please also include the corresponding crash log.
|
||||||
See [here](https://obsproject.com/forum/threads/please-post-a-log-with-your-issue-heres-how.23074/) for a description where to find the log files and how to share them.
|
See [here](https://obsproject.com/forum/threads/please-post-a-log-with-your-issue-heres-how.23074/) for a description where to find the log files and how to share them.
|
||||||
Please share the currently used plugin settings by exporting them them to a file (See General tab of the plugin).
|
Please share the currently used plugin settings by exporting them them to a file (See General tab of the plugin).
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|||||||
79
.github/actions/build-dependencies/action.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
name: 'Setup plugin build dependencies'
|
||||||
|
description: 'Builds the plugin build dependencies'
|
||||||
|
inputs:
|
||||||
|
target:
|
||||||
|
description: 'Build target for dependencies'
|
||||||
|
required: true
|
||||||
|
config:
|
||||||
|
description: 'Build configuration'
|
||||||
|
required: false
|
||||||
|
default: 'Release'
|
||||||
|
visualStudio:
|
||||||
|
description: 'Visual Studio version (Windows only)'
|
||||||
|
required: false
|
||||||
|
default: 'Visual Studio 16 2019'
|
||||||
|
workingDirectory:
|
||||||
|
description: 'Working directory for packaging'
|
||||||
|
required: false
|
||||||
|
default: ${{ github.workspace }}
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Setup cmake
|
||||||
|
uses: jwlawson/actions-setup-cmake@v1.13
|
||||||
|
with:
|
||||||
|
cmake-version: '3.24.x'
|
||||||
|
|
||||||
|
- name: Restore cached dependencies
|
||||||
|
id: restore-cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ env.DEP_DIR }}
|
||||||
|
key: ${{ env.DEP_DIR }}-${{ runner.os }}-${{ inputs.target }}
|
||||||
|
|
||||||
|
- name: Run macOS Build
|
||||||
|
if: ${{ runner.os == 'macOS' && steps.restore-cache.outputs.cache-hit != 'true' }}
|
||||||
|
shell: zsh {0}
|
||||||
|
run: |
|
||||||
|
build_args=(
|
||||||
|
-c ${{ inputs.config }}
|
||||||
|
-t macos-${{ inputs.target }}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||||
|
|
||||||
|
${{ inputs.workingDirectory }}/.github/scripts/build-deps-macos.zsh -o ${{ env.DEP_DIR }} ${build_args}
|
||||||
|
|
||||||
|
- name: Run Linux Build
|
||||||
|
if: ${{ runner.os == 'Linux' && steps.restore-cache.outputs.cache-hit != 'true' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
build_args=(
|
||||||
|
-c ${{ inputs.config }}
|
||||||
|
-t linux-${{ inputs.target }}
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ -n "${CI}" && -n "${RUNNER_DEBUG}" ]]; then
|
||||||
|
build_args+=(--debug)
|
||||||
|
fi
|
||||||
|
|
||||||
|
${{ inputs.workingDirectory }}/.github/scripts/build-deps-linux.sh -o ${{ env.DEP_DIR }} "${build_args[@]}"
|
||||||
|
|
||||||
|
- name: Run Windows Build
|
||||||
|
if: ${{ runner.os == 'Windows' && steps.restore-cache.outputs.cache-hit != 'true' }}
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$BuildArgs = @{
|
||||||
|
Target = '${{ inputs.target }}'
|
||||||
|
Configuration = '${{ inputs.config }}'
|
||||||
|
CMakeGenerator = '${{ inputs.visualStudio }}'
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( Test-Path env:CI ) -and ( Test-Path env:RUNNER_DEBUG ) ) {
|
||||||
|
$BuildArgs += @{
|
||||||
|
Debug = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
${{ inputs.workingDirectory }}/.github/scripts/Build-Deps-Windows.ps1 -OutDirName ${{ env.DEP_DIR }} @BuildArgs
|
||||||
|
|
||||||
6
.github/actions/build-plugin/action.yml
vendored
@@ -49,7 +49,7 @@ runs:
|
|||||||
if [[ '${{ inputs.codesign }}' == 'true' ]] build_args+=(-s)
|
if [[ '${{ inputs.codesign }}' == 'true' ]] build_args+=(-s)
|
||||||
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||||
|
|
||||||
${{ inputs.workingDirectory }}/.github/scripts/build-macos.zsh ${build_args}
|
${{ inputs.workingDirectory }}/.github/scripts/build-macos.zsh -d ${{ env.DEP_DIR }} ${build_args}
|
||||||
|
|
||||||
- name: Run Linux Build
|
- name: Run Linux Build
|
||||||
if: ${{ runner.os == 'Linux' }}
|
if: ${{ runner.os == 'Linux' }}
|
||||||
@@ -68,7 +68,7 @@ runs:
|
|||||||
build_args+=(-p)
|
build_args+=(-p)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${{ inputs.workingDirectory }}/.github/scripts/build-linux.sh "${build_args[@]}"
|
${{ inputs.workingDirectory }}/.github/scripts/build-linux.sh -d ${{ env.DEP_DIR }} "${build_args[@]}"
|
||||||
|
|
||||||
- name: Run Windows Build
|
- name: Run Windows Build
|
||||||
if: ${{ runner.os == 'Windows' }}
|
if: ${{ runner.os == 'Windows' }}
|
||||||
@@ -86,4 +86,4 @@ runs:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${{ inputs.workingDirectory }}/.github/scripts/Build-Windows.ps1 @BuildArgs
|
${{ inputs.workingDirectory }}/.github/scripts/Build-Windows.ps1 -ADVSSDepName ${{ env.DEP_DIR }} @BuildArgs
|
||||||
|
|||||||
5
.github/scripts/.Aptfile
vendored
@@ -7,3 +7,8 @@ package 'ninja-build', bin: 'ninja'
|
|||||||
package 'pkg-config'
|
package 'pkg-config'
|
||||||
package 'clang'
|
package 'clang'
|
||||||
package 'clang-format-13'
|
package 'clang-format-13'
|
||||||
|
package 'libxtst-dev'
|
||||||
|
package 'libxss-dev'
|
||||||
|
package 'libopencv-dev'
|
||||||
|
package 'libtesseract-dev'
|
||||||
|
package 'libprocps-dev'
|
||||||
|
|||||||
1
.github/scripts/.Wingetfile
vendored
@@ -1,3 +1,4 @@
|
|||||||
package '7zip.7zip', path: '7-zip', bin: '7z'
|
package '7zip.7zip', path: '7-zip', bin: '7z'
|
||||||
package 'cmake', path: 'Cmake\bin', bin: 'cmake'
|
package 'cmake', path: 'Cmake\bin', bin: 'cmake'
|
||||||
package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'
|
package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'
|
||||||
|
package 'OpenSSL', path: 'OpenSSL', bin: 'openssl'
|
||||||
|
|||||||
324
.github/scripts/.build-deps.zsh
vendored
Executable file
@@ -0,0 +1,324 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
builtin emulate -L zsh
|
||||||
|
setopt EXTENDED_GLOB
|
||||||
|
setopt PUSHD_SILENT
|
||||||
|
setopt ERR_EXIT
|
||||||
|
setopt ERR_RETURN
|
||||||
|
setopt NO_UNSET
|
||||||
|
setopt PIPE_FAIL
|
||||||
|
setopt NO_AUTO_PUSHD
|
||||||
|
setopt NO_PUSHD_IGNORE_DUPS
|
||||||
|
setopt FUNCTION_ARGZERO
|
||||||
|
|
||||||
|
## Enable for script debugging
|
||||||
|
# setopt WARN_CREATE_GLOBAL
|
||||||
|
# setopt WARN_NESTED_VAR
|
||||||
|
# setopt XTRACE
|
||||||
|
|
||||||
|
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||||
|
print -u2 -PR "%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_trap_error() {
|
||||||
|
print -u2 -PR '%F{1} ✖︎ script execution error%f'
|
||||||
|
print -PR -e "
|
||||||
|
Callstack:
|
||||||
|
${(j:\n :)funcfiletrace}
|
||||||
|
"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
|
||||||
|
local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[3]}
|
||||||
|
local target="${host_os}-${CPUTYPE}"
|
||||||
|
local project_root=${SCRIPT_HOME:A:h:h}
|
||||||
|
local buildspec_file="${project_root}/buildspec.json"
|
||||||
|
|
||||||
|
trap '_trap_error' ZERR
|
||||||
|
|
||||||
|
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
|
||||||
|
autoload -Uz log_info log_error log_output set_loglevel check_${host_os} setup_${host_os} setup_obs setup_ccache
|
||||||
|
|
||||||
|
if [[ ! -r ${buildspec_file} ]] {
|
||||||
|
log_error \
|
||||||
|
'No buildspec.json found. Please create a build specification for your project.' \
|
||||||
|
'A buildspec.json.template file is provided in the repository to get you started.'
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
typeset -g -a skips=()
|
||||||
|
local -i _verbosity=1
|
||||||
|
local -r _version='1.0.0'
|
||||||
|
local -r -a _valid_targets=(
|
||||||
|
macos-x86_64
|
||||||
|
macos-arm64
|
||||||
|
macos-universal
|
||||||
|
linux-x86_64
|
||||||
|
)
|
||||||
|
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
|
||||||
|
if [[ ${host_os} == 'macos' ]] {
|
||||||
|
local -r -a _valid_generators=(Xcode Ninja 'Unix Makefiles')
|
||||||
|
local generator="${${CI:+Ninja}:-Xcode}"
|
||||||
|
} else {
|
||||||
|
local -r -a _valid_generators=(Ninja 'Unix Makefiles')
|
||||||
|
local generator='Ninja'
|
||||||
|
}
|
||||||
|
local -r _usage="
|
||||||
|
Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
||||||
|
|
||||||
|
%BOptions%b:
|
||||||
|
|
||||||
|
%F{yellow} Build configuration options%f
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
%B-t | --target%b Specify target - default: %B%F{green}${host_os}-${CPUTYPE}%f%b
|
||||||
|
%B-c | --config%b Build configuration - default: %B%F{green}RelWithDebInfo%f%b
|
||||||
|
%B-o | --out%b Output directory - default: %B%F{green}RelWithDebInfo%f%b
|
||||||
|
%B--generator%b Specify build system to generate - default: %B%F{green}Ninja%f%b
|
||||||
|
Available generators:
|
||||||
|
- Ninja
|
||||||
|
- Unix Makefiles
|
||||||
|
- Xcode (macOS only)
|
||||||
|
|
||||||
|
%F{yellow} Output options%f
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
%B-q | --quiet%b Quiet (error output only)
|
||||||
|
%B-v | --verbose%b Verbose (more detailed output)
|
||||||
|
%B--skip-[all|build|deps|unpack]%b Skip all|building OBS|checking for dependencies|unpacking dependencies
|
||||||
|
%B--debug%b Debug (very detailed and added output)
|
||||||
|
|
||||||
|
%F{yellow} General options%f
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
%B-h | --help%b Print this usage help
|
||||||
|
%B-V | --version%b Print script version information"
|
||||||
|
|
||||||
|
local -a args
|
||||||
|
while (( # )) {
|
||||||
|
case ${1} {
|
||||||
|
-t|--target|-c|--config|--generator)
|
||||||
|
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
|
||||||
|
log_error "Missing value for option %B${1}%b"
|
||||||
|
log_output ${_usage}
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
}
|
||||||
|
case ${1} {
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
args+=($@)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-t|--target)
|
||||||
|
if (( ! ${_valid_targets[(Ie)${2}]} )) {
|
||||||
|
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||||
|
log_output ${_usage}
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
target=${2}
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-c|--config)
|
||||||
|
if (( ! ${_valid_configs[(Ie)${2}]} )) {
|
||||||
|
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||||
|
log_output ${_usage}
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
BUILD_CONFIG=${2}
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-o|--out)
|
||||||
|
OUT_DIR="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-q|--quiet) (( _verbosity -= 1 )) || true; shift ;;
|
||||||
|
-v|--verbose) (( _verbosity += 1 )); shift ;;
|
||||||
|
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||||
|
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||||
|
--debug) _verbosity=3; shift ;;
|
||||||
|
--generator)
|
||||||
|
if (( ! ${_valid_generators[(Ie)${2}]} )) {
|
||||||
|
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||||
|
log_output ${_usage}
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
generator=${2}
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--skip-*)
|
||||||
|
local _skip="${${(s:-:)1}[-1]}"
|
||||||
|
local _check=(all deps unpack build)
|
||||||
|
(( ${_check[(Ie)${_skip}]} )) || log_warning "Invalid skip mode %B${_skip}%b supplied"
|
||||||
|
typeset -g -a skips=(${skips} ${_skip})
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set -- ${(@)args}
|
||||||
|
set_loglevel ${_verbosity}
|
||||||
|
|
||||||
|
check_${host_os}
|
||||||
|
setup_ccache
|
||||||
|
|
||||||
|
typeset -g QT_VERSION
|
||||||
|
typeset -g DEPLOYMENT_TARGET
|
||||||
|
typeset -g OBS_DEPS_VERSION
|
||||||
|
setup_${host_os}
|
||||||
|
|
||||||
|
local product_name
|
||||||
|
local product_version
|
||||||
|
local git_tag="$(git describe --tags)"
|
||||||
|
|
||||||
|
read -r product_name product_version <<< \
|
||||||
|
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
|
||||||
|
|
||||||
|
if [[ "${git_tag}" =~ '^([0-9]+\.){0,2}(\*|[0-9]+)$' ]] {
|
||||||
|
log_info "Using git tag as version identifier '${git_tag}'"
|
||||||
|
product_version="${git_tag}"
|
||||||
|
} else {
|
||||||
|
log_info "Using buildspec.json version identifier '${product_version}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -z "${OUT_DIR}" ]] {
|
||||||
|
OUT_DIR="advss-build-dependencies"
|
||||||
|
}
|
||||||
|
mkdir -p "${project_root}/../${OUT_DIR}"
|
||||||
|
local advss_dep_path="$(realpath ${project_root}/../${OUT_DIR})"
|
||||||
|
local _plugin_deps="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
|
||||||
|
|
||||||
|
case ${host_os} {
|
||||||
|
macos)
|
||||||
|
local opencv_dir="${project_root}/deps/opencv"
|
||||||
|
local opencv_build_dir="${opencv_dir}/build_${target##*-}"
|
||||||
|
|
||||||
|
local -a opencv_cmake_args=(
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DBUILD_LIST=core,imgproc,objdetect
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
||||||
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
||||||
|
-DCMAKE_PREFIX_PATH="${advss_dep_path};${_plugin_deps}"
|
||||||
|
-DCMAKE_INSTALL_PREFIX="${advss_dep_path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "${target}" != "macos-x86_64" ]; then
|
||||||
|
opencv_cmake_args+=(-DWITH_IPP=OFF)
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd ${opencv_dir}
|
||||||
|
log_info "Configure OpenCV ..."
|
||||||
|
cmake -S . -B ${opencv_build_dir} -G ${generator} ${opencv_cmake_args}
|
||||||
|
|
||||||
|
log_info "Building OpenCV ..."
|
||||||
|
cmake --build ${opencv_build_dir} --config Release
|
||||||
|
|
||||||
|
log_info "Installing OpenCV..."
|
||||||
|
cmake --install ${opencv_build_dir} --prefix "${advss_dep_path}" --config Release || true
|
||||||
|
popd
|
||||||
|
|
||||||
|
local leptonica_dir="${project_root}/deps/leptonica"
|
||||||
|
local leptonica_build_dir="${leptonica_dir}/build_${target##*-}"
|
||||||
|
|
||||||
|
local -a leptonica_cmake_args=(
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
||||||
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
||||||
|
-DSW_BUILD=OFF
|
||||||
|
-DOPENJPEG_SUPPORT=OFF
|
||||||
|
-DLIBWEBP_SUPPORT=OFF
|
||||||
|
-DCMAKE_DISABLE_FIND_PACKAGE_GIF=TRUE
|
||||||
|
-DCMAKE_DISABLE_FIND_PACKAGE_JPEG=TRUE
|
||||||
|
-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=TRUE
|
||||||
|
-DCMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE
|
||||||
|
-DCMAKE_PREFIX_PATH="${advss_dep_path};${_plugin_deps}"
|
||||||
|
-DCMAKE_INSTALL_PREFIX="${advss_dep_path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
pushd ${leptonica_dir}
|
||||||
|
log_info "Configure Leptonica ..."
|
||||||
|
cmake -S . -B ${leptonica_build_dir} -G ${generator} ${leptonica_cmake_args}
|
||||||
|
|
||||||
|
log_info "Building Leptonica ..."
|
||||||
|
cmake --build ${leptonica_build_dir} --config Release
|
||||||
|
|
||||||
|
log_info "Installing Leptonica..."
|
||||||
|
# Workaround for "unknown file attribute: H" errors when running install
|
||||||
|
cmake --install ${leptonica_build_dir} --prefix "${advss_dep_path}" --config Release || :
|
||||||
|
popd
|
||||||
|
|
||||||
|
local tesseract_dir="${project_root}/deps/tesseract"
|
||||||
|
local tesseract_build_dir="${tesseract_dir}/build_${target##*-}"
|
||||||
|
|
||||||
|
local -a tesseract_cmake_args=(
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
||||||
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
||||||
|
-DSW_BUILD=OFF
|
||||||
|
-DBUILD_TRAINING_TOOLS=OFF
|
||||||
|
-DCMAKE_PREFIX_PATH="${advss_dep_path};${_plugin_deps}"
|
||||||
|
-DCMAKE_INSTALL_PREFIX="${advss_dep_path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "${target}" != "macos-x86_64" ]; then
|
||||||
|
tesseract_cmake_args+=(
|
||||||
|
-DCMAKE_SYSTEM_PROCESSOR=aarch64
|
||||||
|
-DHAVE_AVX=FALSE
|
||||||
|
-DHAVE_AVX2=FALSE
|
||||||
|
-DHAVE_AVX512F=FALSE
|
||||||
|
-DHAVE_FMA=FALSE
|
||||||
|
-DHAVE_SSE4_1=FALSE
|
||||||
|
-DHAVE_NEON=TRUE
|
||||||
|
)
|
||||||
|
sed -i'.original' 's/HAVE_NEON FALSE/HAVE_NEON TRUE/g' "${tesseract_dir}/CMakeLists.txt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd ${tesseract_dir}
|
||||||
|
log_info "Configure Tesseract ..."
|
||||||
|
cmake -S . -B ${tesseract_build_dir} -G ${generator} ${tesseract_cmake_args}
|
||||||
|
|
||||||
|
log_info "Building Tesseract ..."
|
||||||
|
cmake --build ${tesseract_build_dir} --config Release
|
||||||
|
|
||||||
|
log_info "Installing Tesseract..."
|
||||||
|
cmake --install ${tesseract_build_dir} --prefix "${advss_dep_path}" --config Release
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd ${advss_dep_path}
|
||||||
|
log_info "Prepare openssl ..."
|
||||||
|
rm -rf openssl
|
||||||
|
git clone git://git.openssl.org/openssl.git --branch openssl-3.1.2 --depth 1
|
||||||
|
mv openssl openssl_x86
|
||||||
|
cp -r openssl_x86 openssl_arm
|
||||||
|
|
||||||
|
log_info "Building openssl x86 ..."
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET=10.9
|
||||||
|
cd openssl_x86
|
||||||
|
./Configure darwin64-x86_64-cc shared
|
||||||
|
make
|
||||||
|
|
||||||
|
log_info "Building openssl arm ..."
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET=10.15
|
||||||
|
cd ../openssl_arm
|
||||||
|
./Configure enable-rc5 zlib darwin64-arm64-cc no-asm
|
||||||
|
make
|
||||||
|
|
||||||
|
log_info "Combine arm and x86 openssl binaries ..."
|
||||||
|
cd ..
|
||||||
|
mkdir openssl-combined
|
||||||
|
lipo -create openssl_x86/libcrypto.a openssl_arm/libcrypto.a -output openssl-combined/libcrypto.a
|
||||||
|
lipo -create openssl_x86/libssl.a openssl_arm/libssl.a -output openssl-combined/libssl.a
|
||||||
|
|
||||||
|
log_info "Clean up openssl dir..."
|
||||||
|
mv openssl_x86 openssl
|
||||||
|
rm -rf openssl_arm
|
||||||
|
;;
|
||||||
|
linux)
|
||||||
|
# Nothing to do for now
|
||||||
|
;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
build ${@}
|
||||||
112
.github/scripts/.build.zsh
vendored
@@ -36,6 +36,7 @@ build() {
|
|||||||
local target="${host_os}-${CPUTYPE}"
|
local target="${host_os}-${CPUTYPE}"
|
||||||
local project_root=${SCRIPT_HOME:A:h:h}
|
local project_root=${SCRIPT_HOME:A:h:h}
|
||||||
local buildspec_file="${project_root}/buildspec.json"
|
local buildspec_file="${project_root}/buildspec.json"
|
||||||
|
local dep_dir=""
|
||||||
|
|
||||||
trap '_trap_error' ZERR
|
trap '_trap_error' ZERR
|
||||||
|
|
||||||
@@ -77,6 +78,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||||||
%B-c | --config%b Build configuration - default: %B%F{green}RelWithDebInfo%f%b
|
%B-c | --config%b Build configuration - default: %B%F{green}RelWithDebInfo%f%b
|
||||||
%B-s | --codesign%b Enable codesigning (macOS only)
|
%B-s | --codesign%b Enable codesigning (macOS only)
|
||||||
%B-p | --portable%b Enable portable mode (Linux only)
|
%B-p | --portable%b Enable portable mode (Linux only)
|
||||||
|
%B-d | --dep%b Dependency directory name - default: %B%F{green}advss-build-dependencies%f%b
|
||||||
%B--generator%b Specify build system to generate - default: %B%F{green}Ninja%f%b
|
%B--generator%b Specify build system to generate - default: %B%F{green}Ninja%f%b
|
||||||
Available generators:
|
Available generators:
|
||||||
- Ninja
|
- Ninja
|
||||||
@@ -130,6 +132,10 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||||||
BUILD_CONFIG=${2}
|
BUILD_CONFIG=${2}
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-d|--dep)
|
||||||
|
dep_dir="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-s|--codesign) CODESIGN=1; shift ;;
|
-s|--codesign) CODESIGN=1; shift ;;
|
||||||
-p|--portable) typeset -g PORTABLE=1; shift ;;
|
-p|--portable) typeset -g PORTABLE=1; shift ;;
|
||||||
-q|--quiet) (( _verbosity -= 1 )) || true; shift ;;
|
-q|--quiet) (( _verbosity -= 1 )) || true; shift ;;
|
||||||
@@ -168,6 +174,15 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||||||
typeset -g OBS_DEPS_VERSION
|
typeset -g OBS_DEPS_VERSION
|
||||||
setup_${host_os}
|
setup_${host_os}
|
||||||
|
|
||||||
|
local advss_deps_path
|
||||||
|
if [[ -z "${dep_dir}" ]] {
|
||||||
|
log_info "Building advss deps ..."
|
||||||
|
dep_dir="advss-build-dependencies"
|
||||||
|
${SCRIPT_HOME}/build-deps-${host_os}.zsh -c "${BUILD_CONFIG:-RelWithDebInfo}" -t "${target}" --generator "${generator}" -o "${dep_dir}" --skip-deps --skip-unpack
|
||||||
|
}
|
||||||
|
advss_deps_path=$(realpath ${project_root}/../${dep_dir})
|
||||||
|
log_info "Using advss deps at $advss_deps_path ..."
|
||||||
|
|
||||||
local product_name
|
local product_name
|
||||||
local product_version
|
local product_version
|
||||||
local git_tag="$(git describe --tags)"
|
local git_tag="$(git describe --tags)"
|
||||||
@@ -187,96 +202,6 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||||||
sed -i '' \
|
sed -i '' \
|
||||||
"s/project(\(.*\) VERSION \(.*\))/project(${product_name} VERSION ${product_version})/" \
|
"s/project(\(.*\) VERSION \(.*\))/project(${product_name} VERSION ${product_version})/" \
|
||||||
"${project_root}/CMakeLists.txt"
|
"${project_root}/CMakeLists.txt"
|
||||||
|
|
||||||
local opencv_dir="${project_root}/deps/opencv"
|
|
||||||
local opencv_build_dir="${opencv_dir}/build_${target##*-}"
|
|
||||||
|
|
||||||
local -a opencv_cmake_args=(
|
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
|
||||||
-DBUILD_LIST=core,imgproc,objdetect
|
|
||||||
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
|
||||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${target}" != "macos-x86_64" ]; then
|
|
||||||
opencv_cmake_args+=(-DWITH_IPP=OFF)
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd ${opencv_dir}
|
|
||||||
log_info "Configure OpenCV ..."
|
|
||||||
cmake -S . -B ${opencv_build_dir} -G ${generator} ${opencv_cmake_args}
|
|
||||||
|
|
||||||
log_info "Building OpenCV ..."
|
|
||||||
cmake --build ${opencv_build_dir} --config Release
|
|
||||||
|
|
||||||
log_info "Installing OpenCV..."
|
|
||||||
cmake --install ${opencv_build_dir} --config Release || true
|
|
||||||
popd
|
|
||||||
|
|
||||||
local leptonica_dir="${project_root}/deps/leptonica"
|
|
||||||
local leptonica_build_dir="${leptonica_dir}/build_${target##*-}"
|
|
||||||
|
|
||||||
local -a leptonica_cmake_args=(
|
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
|
||||||
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
|
||||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
|
||||||
-DSW_BUILD=OFF
|
|
||||||
-DOPENJPEG_SUPPORT=OFF
|
|
||||||
-DLIBWEBP_SUPPORT=OFF
|
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_GIF=TRUE
|
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_JPEG=TRUE
|
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=TRUE
|
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
pushd ${leptonica_dir}
|
|
||||||
log_info "Configure Leptonica ..."
|
|
||||||
cmake -S . -B ${leptonica_build_dir} -G ${generator} ${leptonica_cmake_args}
|
|
||||||
|
|
||||||
log_info "Building Leptonica ..."
|
|
||||||
cmake --build ${leptonica_build_dir} --config Release
|
|
||||||
|
|
||||||
log_info "Installing Leptonica..."
|
|
||||||
# Workaround for "unknown file attribute: H" errors when running install
|
|
||||||
cmake --install ${leptonica_build_dir} --config Release || :
|
|
||||||
popd
|
|
||||||
|
|
||||||
local tesseract_dir="${project_root}/deps/tesseract"
|
|
||||||
local tesseract_build_dir="${tesseract_dir}/build_${target##*-}"
|
|
||||||
|
|
||||||
local -a tesseract_cmake_args=(
|
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
|
||||||
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
|
||||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
|
||||||
-DSW_BUILD=OFF
|
|
||||||
-DBUILD_TRAINING_TOOLS=OFF
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${target}" != "macos-x86_64" ]; then
|
|
||||||
tesseract_cmake_args+=(
|
|
||||||
-DCMAKE_SYSTEM_PROCESSOR=aarch64
|
|
||||||
-DHAVE_AVX=FALSE
|
|
||||||
-DHAVE_AVX2=FALSE
|
|
||||||
-DHAVE_AVX512F=FALSE
|
|
||||||
-DHAVE_FMA=FALSE
|
|
||||||
-DHAVE_SSE4_1=FALSE
|
|
||||||
-DHAVE_NEON=TRUE
|
|
||||||
)
|
|
||||||
sed -i'.original' 's/HAVE_NEON FALSE/HAVE_NEON TRUE/g' "${tesseract_dir}/CMakeLists.txt"
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd ${tesseract_dir}
|
|
||||||
log_info "Configure Tesseract ..."
|
|
||||||
cmake -S . -B ${tesseract_build_dir} -G ${generator} ${tesseract_cmake_args}
|
|
||||||
|
|
||||||
log_info "Building Tesseract ..."
|
|
||||||
#cmake --build ${tesseract_build_dir} --config Release --target libtesseract
|
|
||||||
cmake --build ${tesseract_build_dir} --config Release
|
|
||||||
|
|
||||||
log_info "Installing Tesseract..."
|
|
||||||
#cmake --install ${tesseract_build_dir} --config Release --component libtesseract
|
|
||||||
cmake --install ${tesseract_build_dir} --config Release
|
|
||||||
popd
|
|
||||||
;;
|
;;
|
||||||
linux)
|
linux)
|
||||||
sed -i'' \
|
sed -i'' \
|
||||||
@@ -295,7 +220,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||||||
local -a cmake_args=(
|
local -a cmake_args=(
|
||||||
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG:-RelWithDebInfo}
|
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG:-RelWithDebInfo}
|
||||||
-DQT_VERSION=${QT_VERSION}
|
-DQT_VERSION=${QT_VERSION}
|
||||||
-DCMAKE_PREFIX_PATH="${_plugin_deps}"
|
-DCMAKE_PREFIX_PATH="${_plugin_deps};${advss_deps_path}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (( _loglevel == 0 )) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR)
|
if (( _loglevel == 0 )) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR)
|
||||||
@@ -312,12 +237,17 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
|||||||
|
|
||||||
num_procs=$(( $(sysctl -n hw.ncpu) + 1 ))
|
num_procs=$(( $(sysctl -n hw.ncpu) + 1 ))
|
||||||
|
|
||||||
|
local openssl_lib_dir="${advss_deps_path}/openssl-combined/"
|
||||||
|
local openssl_include_dir="${advss_deps_path}/openssl/include"
|
||||||
|
|
||||||
cmake_args+=(
|
cmake_args+=(
|
||||||
-DCMAKE_FRAMEWORK_PATH="${_plugin_deps}/Frameworks"
|
-DCMAKE_FRAMEWORK_PATH="${_plugin_deps}/Frameworks"
|
||||||
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
|
||||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
|
||||||
-DOBS_CODESIGN_LINKER=ON
|
-DOBS_CODESIGN_LINKER=ON
|
||||||
-DOBS_BUNDLE_CODESIGN_IDENTITY="${CODESIGN_IDENT:--}"
|
-DOBS_BUNDLE_CODESIGN_IDENTITY="${CODESIGN_IDENT:--}"
|
||||||
|
-DOPENSSL_INCLUDE_DIR="${openssl_include_dir}"
|
||||||
|
-DOPENSSL_LIBRARIES="${openssl_lib_dir}/libcrypto.a;${openssl_lib_dir}/libssl.a"
|
||||||
)
|
)
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|||||||
172
.github/scripts/Build-Deps-Windows.ps1
vendored
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||||
|
[string] $Configuration = 'RelWithDebInfo',
|
||||||
|
[ValidateSet('x86', 'x64')]
|
||||||
|
[string] $Target,
|
||||||
|
[ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
|
||||||
|
[string] $CMakeGenerator,
|
||||||
|
[string] $OutDirName,
|
||||||
|
[switch] $SkipDeps,
|
||||||
|
[switch] $SkipUnpack
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
if ( $DebugPreference -eq 'Continue' ) {
|
||||||
|
$VerbosePreference = 'Continue'
|
||||||
|
$InformationPreference = 'Continue'
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
|
||||||
|
Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
function Build {
|
||||||
|
trap {
|
||||||
|
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
|
||||||
|
Write-Error $_
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
$ScriptHome = $PSScriptRoot
|
||||||
|
$ProjectRoot = Resolve-Path -Path "$PSScriptRoot/../.."
|
||||||
|
$BuildSpecFile = "${ProjectRoot}/buildspec.json"
|
||||||
|
|
||||||
|
$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
|
||||||
|
|
||||||
|
foreach ($Utility in $UtilityFunctions) {
|
||||||
|
Write-Debug "Loading $($Utility.FullName)"
|
||||||
|
. $Utility.FullName
|
||||||
|
}
|
||||||
|
|
||||||
|
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||||
|
$ProductName = $BuildSpec.name
|
||||||
|
$ProductVersion = $BuildSpec.version
|
||||||
|
|
||||||
|
$script:VisualStudioVersion = ''
|
||||||
|
$script:PlatformSDK = '10.0.18363.657'
|
||||||
|
|
||||||
|
Setup-Host
|
||||||
|
|
||||||
|
if ( $CmakeGenerator -eq '' ) {
|
||||||
|
$CmakeGenerator = $script:VisualStudioVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
$DepsPath = "plugin-deps-${script:DepsVersion}-*-${script:Target}"
|
||||||
|
$OBSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../obs-build-dependencies/${DepsPath})"
|
||||||
|
|
||||||
|
if ( $OutDirName -eq '' ) {
|
||||||
|
$OutDirName = "advss-build-dependencies"
|
||||||
|
}
|
||||||
|
New-Item -ItemType Directory -Force -Path ${ProjectRoot}/../${OutDirName}
|
||||||
|
|
||||||
|
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../${OutDirName})"
|
||||||
|
|
||||||
|
$OpenCVPath = "${ProjectRoot}/deps/opencv"
|
||||||
|
$OpenCVBuildPath = "${OpenCVPath}/build"
|
||||||
|
|
||||||
|
Push-Location -Stack BuildOpenCVTemp
|
||||||
|
Ensure-Location $ProjectRoot
|
||||||
|
|
||||||
|
$OpenCVCmakeArgs = @(
|
||||||
|
'-G', $CmakeGenerator
|
||||||
|
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||||
|
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||||
|
"-DCMAKE_BUILD_TYPE=Release"
|
||||||
|
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
|
||||||
|
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
|
||||||
|
"-DBUILD_LIST=core,imgproc,objdetect"
|
||||||
|
)
|
||||||
|
|
||||||
|
Log-Information "Configuring OpenCV..."
|
||||||
|
Invoke-External cmake -S ${OpenCVPath} -B ${OpenCVBuildPath} @OpenCVCmakeArgs
|
||||||
|
|
||||||
|
$OpenCVCmakeArgs = @(
|
||||||
|
'--config', "Release"
|
||||||
|
)
|
||||||
|
|
||||||
|
if ( $VerbosePreference -eq 'Continue' ) {
|
||||||
|
$OpenCVCmakeArgs += ('--verbose')
|
||||||
|
}
|
||||||
|
|
||||||
|
Log-Information "Building OpenCV..."
|
||||||
|
Invoke-External cmake --build "${OpenCVBuildPath}" @OpenCVCmakeArgs
|
||||||
|
Log-Information "Install OpenCV}..."
|
||||||
|
Invoke-External cmake --install "${OpenCVBuildPath}" --prefix "${ADVSSDepPath}" @OpenCVCmakeArgs
|
||||||
|
|
||||||
|
$LeptonicaPath = "${ProjectRoot}/deps/leptonica"
|
||||||
|
$LeptonicaBuildPath = "${LeptonicaPath}/build"
|
||||||
|
|
||||||
|
Push-Location -Stack BuildLeptonicaTemp
|
||||||
|
Ensure-Location $ProjectRoot
|
||||||
|
|
||||||
|
$LeptonicaCmakeArgs = @(
|
||||||
|
'-G', $CmakeGenerator
|
||||||
|
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||||
|
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||||
|
"-DCMAKE_BUILD_TYPE=${Configuration}"
|
||||||
|
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
|
||||||
|
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
|
||||||
|
"-DSW_BUILD=OFF"
|
||||||
|
"-DLIBWEBP_SUPPORT=OFF"
|
||||||
|
)
|
||||||
|
|
||||||
|
Log-Information "Configuring leptonica..."
|
||||||
|
Invoke-External cmake -S ${LeptonicaPath} -B ${LeptonicaBuildPath} @LeptonicaCmakeArgs
|
||||||
|
|
||||||
|
$LeptonicaCmakeArgs = @(
|
||||||
|
'--config', "${Configuration}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if ( $VerbosePreference -eq 'Continue' ) {
|
||||||
|
$LeptonicaCmakeArgs += ('--verbose')
|
||||||
|
}
|
||||||
|
|
||||||
|
Log-Information "Building leptonica..."
|
||||||
|
Invoke-External cmake --build "${LeptonicaBuildPath}" @LeptonicaCmakeArgs
|
||||||
|
|
||||||
|
Log-Information "Install leptonica..."
|
||||||
|
Invoke-External cmake --install "${LeptonicaBuildPath}" --prefix "${ADVSSDepPath}" @LeptonicaCmakeArgs
|
||||||
|
|
||||||
|
Push-Location -Stack BuildTesseractTemp
|
||||||
|
Ensure-Location $ProjectRoot
|
||||||
|
|
||||||
|
$TesseractPath = "${ProjectRoot}/deps/tesseract"
|
||||||
|
$TesseractBuildPath = "${TesseractPath}/build"
|
||||||
|
|
||||||
|
# Explicitly disable PkgConfig and tiff as it will lead build errors
|
||||||
|
$TesseractCmakeArgs = @(
|
||||||
|
'-G', $CmakeGenerator
|
||||||
|
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||||
|
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||||
|
"-DCMAKE_BUILD_TYPE=${Configuration}"
|
||||||
|
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
|
||||||
|
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
|
||||||
|
"-DSW_BUILD=OFF"
|
||||||
|
"-DDISABLE_CURL=ON"
|
||||||
|
"-DBUILD_TRAINING_TOOLS=OFF"
|
||||||
|
"-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=TRUE"
|
||||||
|
"-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=TRUE"
|
||||||
|
)
|
||||||
|
|
||||||
|
Log-Information "Configuring tesseract..."
|
||||||
|
Invoke-External cmake -S ${TesseractPath} -B ${TesseractBuildPath} @TesseractCmakeArgs
|
||||||
|
|
||||||
|
$TesseractCmakeArgs = @(
|
||||||
|
'--config', "${Configuration}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if ( $VerbosePreference -eq 'Continue' ) {
|
||||||
|
$TesseractCmakeArgs += ('--verbose')
|
||||||
|
}
|
||||||
|
|
||||||
|
Log-Information "Building tesseract..."
|
||||||
|
Invoke-External cmake --build "${TesseractBuildPath}" @TesseractCmakeArgs
|
||||||
|
|
||||||
|
Log-Information "Install tesseract..."
|
||||||
|
Invoke-External cmake --install "${TesseractBuildPath}" --prefix "${ADVSSDepPath}" @TesseractCmakeArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
Build
|
||||||
116
.github/scripts/Build-Windows.ps1
vendored
@@ -6,6 +6,7 @@ param(
|
|||||||
[string] $Target,
|
[string] $Target,
|
||||||
[ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
|
[ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
|
||||||
[string] $CMakeGenerator,
|
[string] $CMakeGenerator,
|
||||||
|
[string] $ADVSSDepName,
|
||||||
[switch] $SkipAll,
|
[switch] $SkipAll,
|
||||||
[switch] $SkipBuild,
|
[switch] $SkipBuild,
|
||||||
[switch] $SkipDeps,
|
[switch] $SkipDeps,
|
||||||
@@ -60,116 +61,17 @@ function Build {
|
|||||||
$DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
|
$DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
|
||||||
$DepInstallPath = "$(Resolve-Path -Path ${ProjectRoot}/../obs-build-dependencies/${DepsPath})"
|
$DepInstallPath = "$(Resolve-Path -Path ${ProjectRoot}/../obs-build-dependencies/${DepsPath})"
|
||||||
|
|
||||||
$OpenCVPath = "${ProjectRoot}/deps/opencv"
|
if ( $ADVSSDepName -eq '' ) {
|
||||||
$OpenCVBuildPath = "${OpenCVPath}/build"
|
Log-Information "Building advss deps ..."
|
||||||
|
$ADVSSDepName = "advss-build-dependencies"
|
||||||
Push-Location -Stack BuildOpenCVTemp
|
invoke-expression -Command "$PSScriptRoot/Build-Deps-Windows.ps1 -Configuration $Configuration -Target $Target -CMakeGenerator `"$CMakeGenerator`" -OutDirName $ADVSSDepName -SkipDeps -SkipUnpack"
|
||||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
|
||||||
Ensure-Location $ProjectRoot
|
|
||||||
|
|
||||||
$OpenCVCmakeArgs = @(
|
|
||||||
'-G', $CmakeGenerator
|
|
||||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
|
||||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
|
||||||
"-DCMAKE_BUILD_TYPE=Release"
|
|
||||||
"-DCMAKE_PREFIX_PATH:PATH=${DepInstallPath}"
|
|
||||||
"-DBUILD_LIST=core,imgproc,objdetect"
|
|
||||||
)
|
|
||||||
|
|
||||||
Log-Information "Configuring OpenCV..."
|
|
||||||
Invoke-External cmake -S ${OpenCVPath} -B ${OpenCVBuildPath} @OpenCVCmakeArgs
|
|
||||||
|
|
||||||
$OpenCVCmakeArgs = @(
|
|
||||||
'--config', "Release"
|
|
||||||
)
|
|
||||||
|
|
||||||
if ( $VerbosePreference -eq 'Continue' ) {
|
|
||||||
$OpenCVCmakeArgs += ('--verbose')
|
|
||||||
}
|
|
||||||
|
|
||||||
Log-Information "Building OpenCV..."
|
|
||||||
Invoke-External cmake --build "${OpenCVBuildPath}" @OpenCVCmakeArgs
|
|
||||||
}
|
}
|
||||||
Log-Information "Install OpenCV}..."
|
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../${script:ADVSSDepName})"
|
||||||
Invoke-External cmake --install "${OpenCVBuildPath}" --prefix "${DepInstallPath}" @OpenCVCmakeArgs
|
Log-Information "Using advss deps at $ADVSSDepPath ..."
|
||||||
|
|
||||||
$LeptonicaPath = "${ProjectRoot}/deps/leptonica"
|
|
||||||
$LeptonicaBuildPath = "${LeptonicaPath}/build"
|
|
||||||
|
|
||||||
Push-Location -Stack BuildLeptonicaTemp
|
|
||||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
|
||||||
Ensure-Location $ProjectRoot
|
|
||||||
|
|
||||||
$LeptonicaCmakeArgs = @(
|
|
||||||
'-G', $CmakeGenerator
|
|
||||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
|
||||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
|
||||||
"-DCMAKE_BUILD_TYPE=Release"
|
|
||||||
"-DCMAKE_PREFIX_PATH:PATH=${DepInstallPath}"
|
|
||||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DepInstallPath}"
|
|
||||||
"-DSW_BUILD=OFF"
|
|
||||||
"-DLIBWEBP_SUPPORT=OFF"
|
|
||||||
)
|
|
||||||
|
|
||||||
Log-Information "Configuring leptonica..."
|
|
||||||
Invoke-External cmake -S ${LeptonicaPath} -B ${LeptonicaBuildPath} @LeptonicaCmakeArgs
|
|
||||||
|
|
||||||
$LeptonicaCmakeArgs = @(
|
|
||||||
'--config', "Release"
|
|
||||||
)
|
|
||||||
|
|
||||||
if ( $VerbosePreference -eq 'Continue' ) {
|
|
||||||
$LeptonicaCmakeArgs += ('--verbose')
|
|
||||||
}
|
|
||||||
|
|
||||||
Log-Information "Building leptonica..."
|
|
||||||
Invoke-External cmake --build "${LeptonicaBuildPath}" @LeptonicaCmakeArgs
|
|
||||||
}
|
|
||||||
Log-Information "Install leptonica..."
|
|
||||||
Invoke-External cmake --install "${LeptonicaBuildPath}" --prefix "${DepInstallPath}" @LeptonicaCmakeArgs
|
|
||||||
|
|
||||||
Push-Location -Stack BuildTesseractTemp
|
|
||||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
|
||||||
Ensure-Location $ProjectRoot
|
|
||||||
|
|
||||||
$TesseractPath = "${ProjectRoot}/deps/tesseract"
|
|
||||||
$TesseractBuildPath = "${TesseractPath}/build"
|
|
||||||
|
|
||||||
# Explicitly disable PkgConfig and tiff as it will lead build errors
|
|
||||||
$TesseractCmakeArgs = @(
|
|
||||||
'-G', $CmakeGenerator
|
|
||||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
|
||||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
|
||||||
"-DCMAKE_BUILD_TYPE=Release"
|
|
||||||
"-DCMAKE_PREFIX_PATH:PATH=${DepInstallPath}"
|
|
||||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DepInstallPath}"
|
|
||||||
"-DSW_BUILD=OFF"
|
|
||||||
"-DDISABLE_CURL=ON"
|
|
||||||
"-DBUILD_TRAINING_TOOLS=OFF"
|
|
||||||
"-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=TRUE"
|
|
||||||
"-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=TRUE"
|
|
||||||
)
|
|
||||||
|
|
||||||
Log-Information "Configuring tesseract..."
|
|
||||||
Invoke-External cmake -S ${TesseractPath} -B ${TesseractBuildPath} @TesseractCmakeArgs
|
|
||||||
|
|
||||||
$TesseractCmakeArgs = @(
|
|
||||||
'--config', "Release"
|
|
||||||
)
|
|
||||||
|
|
||||||
if ( $VerbosePreference -eq 'Continue' ) {
|
|
||||||
$TesseractCmakeArgs += ('--verbose')
|
|
||||||
}
|
|
||||||
|
|
||||||
Log-Information "Building tesseract..."
|
|
||||||
Invoke-External cmake --build "${TesseractBuildPath}" @TesseractCmakeArgs
|
|
||||||
}
|
|
||||||
Log-Information "Install tesseract..."
|
|
||||||
Invoke-External cmake --install "${TesseractBuildPath}" --prefix "${DepInstallPath}" @TesseractCmakeArgs
|
|
||||||
|
|
||||||
(Get-Content -Path ${ProjectRoot}/CMakeLists.txt -Raw) `
|
(Get-Content -Path ${ProjectRoot}/CMakeLists.txt -Raw) `
|
||||||
-replace "project\((.*) VERSION (.*)\)", "project(${ProductName} VERSION ${ProductVersion})" `
|
-replace "project\((.*) VERSION (.*)\)", "project(${ProductName} VERSION ${ProductVersion})" `
|
||||||
| Out-File -Path ${ProjectRoot}/CMakeLists.txt
|
| Out-File -Path ${ProjectRoot}/CMakeLists.txt -NoNewline
|
||||||
|
|
||||||
Setup-Obs
|
Setup-Obs
|
||||||
|
|
||||||
@@ -182,7 +84,7 @@ function Build {
|
|||||||
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
|
||||||
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
|
||||||
"-DCMAKE_BUILD_TYPE=${Configuration}"
|
"-DCMAKE_BUILD_TYPE=${Configuration}"
|
||||||
"-DCMAKE_PREFIX_PATH:PATH=${DepInstallPath}"
|
"-DCMAKE_PREFIX_PATH:PATH=${DepInstallPath};${ADVSSDepPath}"
|
||||||
"-DQT_VERSION=${script:QtVersion}"
|
"-DQT_VERSION=${script:QtVersion}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
13
.github/scripts/build-deps-linux.sh
vendored
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if ! type zsh > /dev/null 2>&1; then
|
||||||
|
echo ' => Installing script dependency Zsh.'
|
||||||
|
|
||||||
|
sudo apt-get -y update
|
||||||
|
sudo apt-get -y install zsh
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT=$(readlink -f "${0}")
|
||||||
|
SCRIPT_DIR=$(dirname "${SCRIPT}")
|
||||||
|
|
||||||
|
zsh ${SCRIPT_DIR}/build-deps-linux.zsh "${@}"
|
||||||
1
.github/scripts/build-deps-linux.zsh
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
.build-deps.zsh
|
||||||
1
.github/scripts/build-deps-macos.zsh
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
.build-deps.zsh
|
||||||
2
.github/scripts/utils.zsh/check_packages
vendored
@@ -24,7 +24,7 @@ if (( ! ${+commands[packagesbuild]} )) {
|
|||||||
pushd
|
pushd
|
||||||
mkcd ${project_root:h}/obs-build-dependencies
|
mkcd ${project_root:h}/obs-build-dependencies
|
||||||
|
|
||||||
local packages_url='http://s.sudre.free.fr/Software/files/Packages.dmg'
|
local packages_url='https://web.archive.org/web/20230727054218/http://s.sudre.free.fr/Software/files/Packages.dmg'
|
||||||
local packages_hash='6afdd25386295974dad8f078b8f1e41cabebd08e72d970bf92f707c7e48b16c9'
|
local packages_hash='6afdd25386295974dad8f078b8f1e41cabebd08e72d970bf92f707c7e48b16c9'
|
||||||
|
|
||||||
if [[ ! -f Packages.dmg ]] {
|
if [[ ! -f Packages.dmg ]] {
|
||||||
|
|||||||
7
.github/scripts/utils.zsh/setup_linux
vendored
@@ -34,13 +34,6 @@ if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
|||||||
|
|
||||||
log_info 'Installing obs plugin dependencies...'
|
log_info 'Installing obs plugin dependencies...'
|
||||||
|
|
||||||
sudo apt-get install -y \
|
|
||||||
libxtst-dev \
|
|
||||||
libxss-dev \
|
|
||||||
libopencv-dev \
|
|
||||||
libtesseract-dev \
|
|
||||||
libprocps-dev
|
|
||||||
|
|
||||||
local -a _qt_packages=()
|
local -a _qt_packages=()
|
||||||
|
|
||||||
if (( QT_VERSION == 5 )) {
|
if (( QT_VERSION == 5 )) {
|
||||||
|
|||||||
29
.github/workflows/main.yml
vendored
@@ -17,6 +17,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
PLUGIN_NAME: SceneSwitcher
|
PLUGIN_NAME: SceneSwitcher
|
||||||
LIB_NAME: advanced-scene-switcher
|
LIB_NAME: advanced-scene-switcher
|
||||||
|
DEP_DIR: advss-build-dependencies-1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
clang_check:
|
clang_check:
|
||||||
@@ -115,9 +116,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
${{ github.workspace }}/.ccache
|
${{ github.workspace }}/.ccache
|
||||||
${{ github.workspace }}/plugin/deps/opencv/build_*
|
|
||||||
${{ github.workspace }}/plugin/deps/leptonica/build_*
|
|
||||||
${{ github.workspace }}/plugin/deps/tesseract/build*
|
|
||||||
key: macos-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
|
key: macos-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
macos-${{ matrix.arch }}-ccache-plugin-
|
macos-${{ matrix.arch }}-ccache-plugin-
|
||||||
@@ -146,6 +144,13 @@ jobs:
|
|||||||
print "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" >> $GITHUB_ENV
|
print "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" >> $GITHUB_ENV
|
||||||
print "CODESIGN_IDENT_INSTALLER=${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" >> $GITHUB_ENV
|
print "CODESIGN_IDENT_INSTALLER=${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build Dependencies
|
||||||
|
uses: ./plugin/.github/actions/build-dependencies
|
||||||
|
with:
|
||||||
|
workingDirectory: ${{ github.workspace }}/plugin
|
||||||
|
target: ${{ matrix.arch }}
|
||||||
|
config: RelWithDebInfo
|
||||||
|
|
||||||
- name: Build Plugin
|
- name: Build Plugin
|
||||||
uses: ./plugin/.github/actions/build-plugin
|
uses: ./plugin/.github/actions/build-plugin
|
||||||
with:
|
with:
|
||||||
@@ -248,6 +253,13 @@ jobs:
|
|||||||
echo 'found=false' >> $GITHUB_OUTPUT
|
echo 'found=false' >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Build Dependencies
|
||||||
|
uses: ./plugin/.github/actions/build-dependencies
|
||||||
|
with:
|
||||||
|
workingDirectory: ${{ github.workspace }}/plugin
|
||||||
|
target: ${{ matrix.arch }}
|
||||||
|
config: RelWithDebInfo
|
||||||
|
|
||||||
- name: Build Plugin
|
- name: Build Plugin
|
||||||
uses: ./plugin/.github/actions/build-plugin
|
uses: ./plugin/.github/actions/build-plugin
|
||||||
with:
|
with:
|
||||||
@@ -329,9 +341,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
${{ github.workspace }}/.ccache
|
${{ github.workspace }}/.ccache
|
||||||
${{ github.workspace }}/plugin/deps/opencv/build_*
|
|
||||||
${{ github.workspace }}/plugin/deps/leptonica/build_*
|
|
||||||
${{ github.workspace }}/plugin/deps/tesseract/build*
|
|
||||||
key: windows-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
|
key: windows-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
windows-${{ matrix.arch }}-ccache-plugin-
|
windows-${{ matrix.arch }}-ccache-plugin-
|
||||||
@@ -357,6 +366,14 @@ jobs:
|
|||||||
|
|
||||||
"found=$(([string]${LabelFound}).ToLower())" >> $env:GITHUB_OUTPUT
|
"found=$(([string]${LabelFound}).ToLower())" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build Dependencies
|
||||||
|
uses: ./plugin/.github/actions/build-dependencies
|
||||||
|
with:
|
||||||
|
workingDirectory: ${{ github.workspace }}/plugin
|
||||||
|
target: ${{ matrix.arch }}
|
||||||
|
config: RelWithDebInfo
|
||||||
|
visualStudio: 'Visual Studio 17 2022'
|
||||||
|
|
||||||
- name: Build Plugin
|
- name: Build Plugin
|
||||||
uses: ./plugin/.github/actions/build-plugin
|
uses: ./plugin/.github/actions/build-plugin
|
||||||
with:
|
with:
|
||||||
|
|||||||
1
.gitignore
vendored
@@ -91,6 +91,7 @@ Thumbs.db
|
|||||||
.settings
|
.settings
|
||||||
.idea
|
.idea
|
||||||
.metadata
|
.metadata
|
||||||
|
.vscode
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.sublime*
|
*.sublime*
|
||||||
|
|||||||
6
.gitmodules
vendored
@@ -19,3 +19,9 @@
|
|||||||
[submodule "deps/libremidi"]
|
[submodule "deps/libremidi"]
|
||||||
path = deps/libremidi
|
path = deps/libremidi
|
||||||
url = https://github.com/jcelerier/libremidi.git
|
url = https://github.com/jcelerier/libremidi.git
|
||||||
|
[submodule "deps/cpp-httplib"]
|
||||||
|
path = deps/cpp-httplib
|
||||||
|
url = https://github.com/yhirose/cpp-httplib.git
|
||||||
|
[submodule "deps/json"]
|
||||||
|
path = deps/json
|
||||||
|
url = https://github.com/nlohmann/json.git
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ target_sources(
|
|||||||
${LIB_NAME}
|
${LIB_NAME}
|
||||||
PRIVATE src/macro-core/macro-action-audio.cpp
|
PRIVATE src/macro-core/macro-action-audio.cpp
|
||||||
src/macro-core/macro-action-audio.hpp
|
src/macro-core/macro-action-audio.hpp
|
||||||
|
src/macro-core/macro-action-clipboard.cpp
|
||||||
|
src/macro-core/macro-action-clipboard.hpp
|
||||||
src/macro-core/macro-action-edit.cpp
|
src/macro-core/macro-action-edit.cpp
|
||||||
src/macro-core/macro-action-edit.hpp
|
src/macro-core/macro-action-edit.hpp
|
||||||
src/macro-core/macro-action-file.cpp
|
src/macro-core/macro-action-file.cpp
|
||||||
@@ -125,6 +127,8 @@ target_sources(
|
|||||||
src/macro-core/macro-action-run.hpp
|
src/macro-core/macro-action-run.hpp
|
||||||
src/macro-core/macro-action-scene-collection.cpp
|
src/macro-core/macro-action-scene-collection.cpp
|
||||||
src/macro-core/macro-action-scene-collection.hpp
|
src/macro-core/macro-action-scene-collection.hpp
|
||||||
|
src/macro-core/macro-action-scene-lock.cpp
|
||||||
|
src/macro-core/macro-action-scene-lock.hpp
|
||||||
src/macro-core/macro-action-scene-order.cpp
|
src/macro-core/macro-action-scene-order.cpp
|
||||||
src/macro-core/macro-action-scene-order.hpp
|
src/macro-core/macro-action-scene-order.hpp
|
||||||
src/macro-core/macro-action-scene-switch.cpp
|
src/macro-core/macro-action-scene-switch.cpp
|
||||||
@@ -201,6 +205,8 @@ target_sources(
|
|||||||
src/macro-core/macro-condition-scene-transform.hpp
|
src/macro-core/macro-condition-scene-transform.hpp
|
||||||
src/macro-core/macro-condition-scene-visibility.cpp
|
src/macro-core/macro-condition-scene-visibility.cpp
|
||||||
src/macro-core/macro-condition-scene-visibility.hpp
|
src/macro-core/macro-condition-scene-visibility.hpp
|
||||||
|
src/macro-core/macro-condition-slideshow.cpp
|
||||||
|
src/macro-core/macro-condition-slideshow.hpp
|
||||||
src/macro-core/macro-condition-scene.cpp
|
src/macro-core/macro-condition-scene.cpp
|
||||||
src/macro-core/macro-condition-scene.hpp
|
src/macro-core/macro-condition-scene.hpp
|
||||||
src/macro-core/macro-condition-source.cpp
|
src/macro-core/macro-condition-source.cpp
|
||||||
@@ -209,6 +215,8 @@ target_sources(
|
|||||||
src/macro-core/macro-condition-streaming.hpp
|
src/macro-core/macro-condition-streaming.hpp
|
||||||
src/macro-core/macro-condition-studio-mode.cpp
|
src/macro-core/macro-condition-studio-mode.cpp
|
||||||
src/macro-core/macro-condition-studio-mode.hpp
|
src/macro-core/macro-condition-studio-mode.hpp
|
||||||
|
src/macro-core/macro-condition-tempvar.cpp
|
||||||
|
src/macro-core/macro-condition-tempvar.hpp
|
||||||
src/macro-core/macro-condition-timer.cpp
|
src/macro-core/macro-condition-timer.cpp
|
||||||
src/macro-core/macro-condition-timer.hpp
|
src/macro-core/macro-condition-timer.hpp
|
||||||
src/macro-core/macro-condition-transition.cpp
|
src/macro-core/macro-condition-transition.cpp
|
||||||
@@ -248,28 +256,43 @@ target_sources(
|
|||||||
src/utils/connection-manager.hpp
|
src/utils/connection-manager.hpp
|
||||||
src/utils/curl-helper.cpp
|
src/utils/curl-helper.cpp
|
||||||
src/utils/curl-helper.hpp
|
src/utils/curl-helper.hpp
|
||||||
|
src/utils/duration.cpp
|
||||||
|
src/utils/duration.hpp
|
||||||
src/utils/duration-control.cpp
|
src/utils/duration-control.cpp
|
||||||
src/utils/duration-control.hpp
|
src/utils/duration-control.hpp
|
||||||
|
src/utils/export-symbol-helper.hpp
|
||||||
src/utils/item-selection-helpers.cpp
|
src/utils/item-selection-helpers.cpp
|
||||||
src/utils/item-selection-helpers.hpp
|
src/utils/item-selection-helpers.hpp
|
||||||
src/utils/log-helper.hpp
|
src/utils/log-helper.hpp
|
||||||
src/utils/file-selection.cpp
|
src/utils/file-selection.cpp
|
||||||
src/utils/file-selection.hpp
|
src/utils/file-selection.hpp
|
||||||
|
src/utils/filter-combo-box.cpp
|
||||||
|
src/utils/filter-combo-box.hpp
|
||||||
src/utils/filter-selection.cpp
|
src/utils/filter-selection.cpp
|
||||||
src/utils/filter-selection.hpp
|
src/utils/filter-selection.hpp
|
||||||
|
src/utils/macro-export-import-dialog.cpp
|
||||||
|
src/utils/macro-export-import-dialog.hpp
|
||||||
src/utils/macro-list.cpp
|
src/utils/macro-list.cpp
|
||||||
src/utils/macro-list.hpp
|
src/utils/macro-list.hpp
|
||||||
|
src/utils/macro-run-button.cpp
|
||||||
|
src/utils/macro-run-button.hpp
|
||||||
|
src/utils/macro-segment-selection.cpp
|
||||||
|
src/utils/macro-segment-selection.hpp
|
||||||
src/utils/math-helpers.cpp
|
src/utils/math-helpers.cpp
|
||||||
src/utils/math-helpers.hpp
|
src/utils/math-helpers.hpp
|
||||||
src/utils/mouse-wheel-guard.cpp
|
src/utils/mouse-wheel-guard.cpp
|
||||||
src/utils/mouse-wheel-guard.hpp
|
src/utils/mouse-wheel-guard.hpp
|
||||||
src/utils/name-dialog.cpp
|
src/utils/name-dialog.cpp
|
||||||
src/utils/name-dialog.hpp
|
src/utils/name-dialog.hpp
|
||||||
|
src/utils/non-modal-dialog.cpp
|
||||||
|
src/utils/non-modal-dialog.hpp
|
||||||
src/utils/obs-dock.hpp
|
src/utils/obs-dock.hpp
|
||||||
src/utils/obs-module-helper.cpp
|
src/utils/obs-module-helper.cpp
|
||||||
src/utils/obs-module-helper.hpp
|
src/utils/obs-module-helper.hpp
|
||||||
src/utils/osc-helpers.cpp
|
src/utils/osc-helpers.cpp
|
||||||
src/utils/osc-helpers.hpp
|
src/utils/osc-helpers.hpp
|
||||||
|
src/utils/plugin-state-helper.cpp
|
||||||
|
src/utils/plugin-state-helper.hpp
|
||||||
src/utils/priority-helper.cpp
|
src/utils/priority-helper.cpp
|
||||||
src/utils/priority-helper.hpp
|
src/utils/priority-helper.hpp
|
||||||
src/utils/process-config.cpp
|
src/utils/process-config.cpp
|
||||||
@@ -292,12 +315,18 @@ target_sources(
|
|||||||
src/utils/slider-spinbox.hpp
|
src/utils/slider-spinbox.hpp
|
||||||
src/utils/source-selection.cpp
|
src/utils/source-selection.cpp
|
||||||
src/utils/source-selection.hpp
|
src/utils/source-selection.hpp
|
||||||
|
src/utils/source-setting.cpp
|
||||||
|
src/utils/source-setting.hpp
|
||||||
src/utils/string-list.cpp
|
src/utils/string-list.cpp
|
||||||
src/utils/string-list.hpp
|
src/utils/string-list.hpp
|
||||||
src/utils/striped-frame.cpp
|
src/utils/striped-frame.cpp
|
||||||
src/utils/striped-frame.hpp
|
src/utils/striped-frame.hpp
|
||||||
|
src/utils/switch-button.cpp
|
||||||
|
src/utils/switch-button.hpp
|
||||||
src/utils/sync-helper.cpp
|
src/utils/sync-helper.cpp
|
||||||
src/utils/sync-helper.hpp
|
src/utils/sync-helper.hpp
|
||||||
|
src/utils/temp-variable.cpp
|
||||||
|
src/utils/temp-variable.hpp
|
||||||
src/utils/transition-selection.cpp
|
src/utils/transition-selection.cpp
|
||||||
src/utils/transition-selection.hpp
|
src/utils/transition-selection.hpp
|
||||||
src/utils/utility.cpp
|
src/utils/utility.cpp
|
||||||
@@ -361,6 +390,14 @@ target_include_directories(
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/obs-websocket/lib"
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/obs-websocket/lib"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk")
|
"${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk")
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/json/CMakeLists.txt")
|
||||||
|
add_subdirectory(deps/json)
|
||||||
|
else()
|
||||||
|
find_package(nlohmann_json REQUIRED)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(${LIB_NAME} PUBLIC nlohmann_json::nlohmann_json)
|
||||||
|
target_compile_definitions(${LIB_NAME} PRIVATE ADVSS_EXPORT_SYMBOLS=1)
|
||||||
|
|
||||||
# --- End of section ---
|
# --- End of section ---
|
||||||
|
|
||||||
# --- Windows-specific build settings and tasks ---
|
# --- Windows-specific build settings and tasks ---
|
||||||
@@ -427,27 +464,24 @@ else()
|
|||||||
|
|
||||||
find_path(PROCPS_INCLUDE_DIR NAMES proc/procps.h)
|
find_path(PROCPS_INCLUDE_DIR NAMES proc/procps.h)
|
||||||
find_path(PROCPS2_INCLUDE_DIR NAMES libproc2/pids.h)
|
find_path(PROCPS2_INCLUDE_DIR NAMES libproc2/pids.h)
|
||||||
find_library(PROCPS_LIBRARY NAMES procps)
|
if(PROCPS_INCLUDE_DIR)
|
||||||
find_library(PROCPS2_LIBRARY NAMES proc2)
|
|
||||||
if(PROCPS_INCLUDE_DIR AND PROCPS_LIBRARY)
|
|
||||||
message(STATUS "${PROJECT_NAME} using procps")
|
message(STATUS "${PROJECT_NAME} using procps")
|
||||||
set(PROC_INCLUDE_DIR "${PROCPS_INCLUDE_DIR}")
|
set(PROC_INCLUDE_DIR "${PROCPS_INCLUDE_DIR}")
|
||||||
set(PROC_LIBRARY "${PROCPS_LIBRARY}")
|
target_compile_definitions(${LIB_NAME} PRIVATE PROCPS_AVAILABLE)
|
||||||
target_compile_definitions(${LIB_NAME} PRIVATE USE_PROCPS)
|
set(PROCESS_CONDITION_SUPPORTED 1)
|
||||||
elseif(PROCPS2_INCLUDE_DIR AND PROCPS2_LIBRARY)
|
endif()
|
||||||
|
if(PROCPS2_INCLUDE_DIR)
|
||||||
message(STATUS "${PROJECT_NAME} using libproc2")
|
message(STATUS "${PROJECT_NAME} using libproc2")
|
||||||
set(PROC_INCLUDE_DIR "${PROCPS2_INCLUDE_DIR}")
|
set(PROC_INCLUDE_DIR "${PROCPS2_INCLUDE_DIR}")
|
||||||
set(PROC_LIBRARY "${PROCPS2_LIBRARY}")
|
target_compile_definitions(${LIB_NAME} PRIVATE PROCPS2_AVAILABLE)
|
||||||
else()
|
set(PROCESS_CONDITION_SUPPORTED 1)
|
||||||
message(
|
endif()
|
||||||
FATAL_ERROR
|
if(NOT DEFINED PROCESS_CONDITION_SUPPORTED)
|
||||||
"found neither procps nor libproc2!
|
message(
|
||||||
please either set ...
|
WARNING
|
||||||
PROCPS_INCLUDE_DIR and PROCPS_LIBRARY
|
"found neither procps nor libproc2! Process condition will not be functional!"
|
||||||
... or ...
|
)
|
||||||
PROCPS2_INCLUDE_DIR and PROCPS2_LIBRARY")
|
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${LIB_NAME} PRIVATE "${PROC_LIBRARY}")
|
|
||||||
target_include_directories(${LIB_NAME} PRIVATE "${PROC_INCLUDE_DIR}")
|
target_include_directories(${LIB_NAME} PRIVATE "${PROC_INCLUDE_DIR}")
|
||||||
|
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
|
|||||||
@@ -146,18 +146,12 @@ AdvSceneSwitcher.condition.scene.previousSceneTransitionBehaviour="Während des
|
|||||||
AdvSceneSwitcher.condition.scene.entry.line1="{{sceneType}}{{scenes}}{{pattern}}"
|
AdvSceneSwitcher.condition.scene.entry.line1="{{sceneType}}{{scenes}}{{pattern}}"
|
||||||
AdvSceneSwitcher.condition.scene.entry.line2="{{useTransitionTargetScene}}"
|
AdvSceneSwitcher.condition.scene.entry.line2="{{useTransitionTargetScene}}"
|
||||||
AdvSceneSwitcher.condition.window="Fenster"
|
AdvSceneSwitcher.condition.window="Fenster"
|
||||||
AdvSceneSwitcher.condition.window.entry.line1="{{windows}} existiert und ..."
|
|
||||||
AdvSceneSwitcher.condition.window.entry.line2="... ist {{fullscreen}} Vollbild {{maximized}} Maximiert {{focused}} Fokusiert {{windowFocusChanged}} Vordergrundfenster geändert"
|
|
||||||
AdvSceneSwitcher.condition.window.entry.line3="Aktuelles Vordergrundfenster: {{focusWindow}}"
|
|
||||||
AdvSceneSwitcher.condition.file="Datei"
|
AdvSceneSwitcher.condition.file="Datei"
|
||||||
AdvSceneSwitcher.condition.file.type.match="entspricht"
|
AdvSceneSwitcher.condition.file.type.match="entspricht"
|
||||||
AdvSceneSwitcher.condition.file.type.contentChange="Inhalt geändert"
|
AdvSceneSwitcher.condition.file.type.contentChange="Inhalt geändert"
|
||||||
AdvSceneSwitcher.condition.file.type.dateChange="Änderungsdatum geändert"
|
AdvSceneSwitcher.condition.file.type.dateChange="Änderungsdatum geändert"
|
||||||
AdvSceneSwitcher.condition.file.remote="Entfernte Datei"
|
AdvSceneSwitcher.condition.file.remote="Entfernte Datei"
|
||||||
AdvSceneSwitcher.condition.file.local="Lokale Datei"
|
AdvSceneSwitcher.condition.file.local="Lokale Datei"
|
||||||
AdvSceneSwitcher.condition.file.entry.line1="{{fileType}}{{filePath}}{{conditions}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line2="{{matchText}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
|
||||||
AdvSceneSwitcher.condition.media="Medien"
|
AdvSceneSwitcher.condition.media="Medien"
|
||||||
AdvSceneSwitcher.condition.media.source="Quelle"
|
AdvSceneSwitcher.condition.media.source="Quelle"
|
||||||
AdvSceneSwitcher.condition.media.anyOnScene="Beliebige Medienquelle in"
|
AdvSceneSwitcher.condition.media.anyOnScene="Beliebige Medienquelle in"
|
||||||
@@ -224,9 +218,8 @@ AdvSceneSwitcher.condition.record="Aufnahme"
|
|||||||
AdvSceneSwitcher.condition.record.state.start="Aufnahme läuft"
|
AdvSceneSwitcher.condition.record.state.start="Aufnahme läuft"
|
||||||
AdvSceneSwitcher.condition.record.state.pause="Aufnahme pausiert"
|
AdvSceneSwitcher.condition.record.state.pause="Aufnahme pausiert"
|
||||||
AdvSceneSwitcher.condition.record.state.stop="Aufnahme gestoppt"
|
AdvSceneSwitcher.condition.record.state.stop="Aufnahme gestoppt"
|
||||||
AdvSceneSwitcher.condition.record.entry="{{recordState}}"
|
|
||||||
AdvSceneSwitcher.condition.process="Prozess"
|
AdvSceneSwitcher.condition.process="Prozess"
|
||||||
AdvSceneSwitcher.condition.process.entry="{{processes}} läuft {{focused}} und ist fokusiert"
|
AdvSceneSwitcher.condition.process.entry="{{processes}}{{regex}}läuft{{focused}}und ist fokusiert"
|
||||||
AdvSceneSwitcher.condition.process.entry.focus="Aktueller Vordergrundprozess: {{focusProcess}}"
|
AdvSceneSwitcher.condition.process.entry.focus="Aktueller Vordergrundprozess: {{focusProcess}}"
|
||||||
AdvSceneSwitcher.condition.idle="Leerlauf"
|
AdvSceneSwitcher.condition.idle="Leerlauf"
|
||||||
AdvSceneSwitcher.condition.idle.entry="Keine Tastatur- oder Mauseingaben für {{duration}}"
|
AdvSceneSwitcher.condition.idle.entry="Keine Tastatur- oder Mauseingaben für {{duration}}"
|
||||||
@@ -328,7 +321,9 @@ AdvSceneSwitcher.condition.date.entry.nextMatchDate="Nächster Treffer bei: %1"
|
|||||||
AdvSceneSwitcher.condition.date.entry.updateOnRepeat="{{updateOnRepeat}} Bei Wiederholung ausgewähltes Datum auf Wiederholungsdatum aktualisieren"
|
AdvSceneSwitcher.condition.date.entry.updateOnRepeat="{{updateOnRepeat}} Bei Wiederholung ausgewähltes Datum auf Wiederholungsdatum aktualisieren"
|
||||||
AdvSceneSwitcher.condition.sceneTransform="Szenenelement transformieren"
|
AdvSceneSwitcher.condition.sceneTransform="Szenenelement transformieren"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.getTransform="Transformation erhalten"
|
AdvSceneSwitcher.condition.sceneTransform.getTransform="Transformation erhalten"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line1="Auf{{scenes}}{{sources}}passt zur Transformation"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line1="Auf{{scenes}}{{sources}}{{types}}"
|
||||||
|
AdvSceneSwitcher.condition.sceneTransform.entry.type.matches="entspricht Transformation"
|
||||||
|
AdvSceneSwitcher.condition.sceneTransform.entry.type.changed="hat sich geändert"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
||||||
AdvSceneSwitcher.condition.transition="Übergang"
|
AdvSceneSwitcher.condition.transition="Übergang"
|
||||||
@@ -392,12 +387,11 @@ AdvSceneSwitcher.condition.variable.type.valueChanged="Wert verändert"
|
|||||||
AdvSceneSwitcher.condition.variable.type.equalsVariable="entspricht Variable"
|
AdvSceneSwitcher.condition.variable.type.equalsVariable="entspricht Variable"
|
||||||
AdvSceneSwitcher.condition.variable.type.lessThanVariable="ist kleiner als die Variable"
|
AdvSceneSwitcher.condition.variable.type.lessThanVariable="ist kleiner als die Variable"
|
||||||
AdvSceneSwitcher.condition.variable.type.greaterThanVariable="ist größer als die Variable"
|
AdvSceneSwitcher.condition.variable.type.greaterThanVariable="ist größer als die Variable"
|
||||||
AdvSceneSwitcher.condition.variable.entry="{{variables}}{{conditions}}{{strValue}}{{numValue}}{{variables2}}"
|
|
||||||
|
|
||||||
; Macro Actions
|
; Macro Actions
|
||||||
AdvSceneSwitcher.action.switchScene="Szene wechseln"
|
AdvSceneSwitcher.action.scene="Szene wechseln"
|
||||||
AdvSceneSwitcher.action.scene.entry="Wechsle zu Szene{{scenes}}mittels{{transitions}}mit einer Dauer von{{duration}}Sekunden"
|
AdvSceneSwitcher.action.scene.entry="Wechsle{{sceneTypes}}Szene zu{{scenes}}mittels{{transitions}}mit einer Dauer von{{duration}}Sekunden"
|
||||||
AdvSceneSwitcher.action.scene.entry.noDuration="Wechsle zu Szene{{scenes}}mittels{{transitions}}"
|
AdvSceneSwitcher.action.scene.entry.noDuration="Wechsle{{sceneTypes}}Szene zu{{scenes}}mittels{{transitions}}"
|
||||||
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Warten, bis der Übergang zur Zielszene abgeschlossen ist"
|
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Warten, bis der Übergang zur Zielszene abgeschlossen ist"
|
||||||
AdvSceneSwitcher.action.wait="Warten"
|
AdvSceneSwitcher.action.wait="Warten"
|
||||||
AdvSceneSwitcher.action.wait.type.fixed="fixe"
|
AdvSceneSwitcher.action.wait.type.fixed="fixe"
|
||||||
@@ -438,20 +432,15 @@ AdvSceneSwitcher.action.replay.entry="{{actions}}"
|
|||||||
AdvSceneSwitcher.action.streaming="Stream"
|
AdvSceneSwitcher.action.streaming="Stream"
|
||||||
AdvSceneSwitcher.action.streaming.type.stop="Stream stoppen"
|
AdvSceneSwitcher.action.streaming.type.stop="Stream stoppen"
|
||||||
AdvSceneSwitcher.action.streaming.type.start="Stream starten"
|
AdvSceneSwitcher.action.streaming.type.start="Stream starten"
|
||||||
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}"
|
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}{{stringValue}}{{showPassword}}"
|
||||||
AdvSceneSwitcher.action.run="Ausführen"
|
AdvSceneSwitcher.action.run="Ausführen"
|
||||||
AdvSceneSwitcher.action.run.arguments="Argumente:"
|
|
||||||
AdvSceneSwitcher.action.run.addArgument="Argument hinzufügen"
|
|
||||||
AdvSceneSwitcher.action.run.addArgumentDescription="Neues Argument hinzufügen:"
|
|
||||||
AdvSceneSwitcher.action.run.entry="Ausführen {{filePath}}"
|
|
||||||
AdvSceneSwitcher.action.run.entry.workingDirectory="Arbeitsverzeichnis:{{workingDirectory}}"
|
|
||||||
AdvSceneSwitcher.action.sceneVisibility="Sichtbarkeit von Szenenelementen"
|
AdvSceneSwitcher.action.sceneVisibility="Sichtbarkeit von Szenenelementen"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.show="Anzeigen"
|
AdvSceneSwitcher.action.sceneVisibility.type.show="Anzeigen"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.hide="Verstecken"
|
AdvSceneSwitcher.action.sceneVisibility.type.hide="Verstecken"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.toggle="Umschalten"
|
AdvSceneSwitcher.action.sceneVisibility.type.toggle="Umschalten"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.source="Quelle"
|
AdvSceneSwitcher.action.sceneVisibility.type.source="Quelle"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Beliebig"
|
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Beliebig"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.entry="Auf{{scenes}}{{actions}}{{sourceTypes}}{{sources}}{{sourceGroups}}"
|
AdvSceneSwitcher.action.sceneVisibility.entry="Auf{{scenes}}{{actions}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.filter="Filter"
|
AdvSceneSwitcher.action.filter="Filter"
|
||||||
AdvSceneSwitcher.action.filter.type.enable="Aktivieren"
|
AdvSceneSwitcher.action.filter.type.enable="Aktivieren"
|
||||||
AdvSceneSwitcher.action.filter.type.disable="Deaktivieren"
|
AdvSceneSwitcher.action.filter.type.disable="Deaktivieren"
|
||||||
@@ -466,7 +455,7 @@ AdvSceneSwitcher.action.source.type.refreshSettings="Aktualisieren der Quellenei
|
|||||||
AdvSceneSwitcher.action.source.type.pressSettingsButton="Drücken der Einstellungstaste"
|
AdvSceneSwitcher.action.source.type.pressSettingsButton="Drücken der Einstellungstaste"
|
||||||
AdvSceneSwitcher.action.source.type.refreshSettings.tooltip="Kann verwendet werden, um Browser-, Medien- usw. Quellen zu aktualisieren"
|
AdvSceneSwitcher.action.source.type.refreshSettings.tooltip="Kann verwendet werden, um Browser-, Medien- usw. Quellen zu aktualisieren"
|
||||||
AdvSceneSwitcher.action.source.noSettingsButtons="Keine Buttons gefunden!"
|
AdvSceneSwitcher.action.source.noSettingsButtons="Keine Buttons gefunden!"
|
||||||
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}"
|
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
|
||||||
AdvSceneSwitcher.action.source.warning="Warnung: Das globale Aktivieren und Deaktivieren von Quellen kann nicht über die OBS-Benutzeroberfläche gesteuert werden"
|
AdvSceneSwitcher.action.source.warning="Warnung: Das globale Aktivieren und Deaktivieren von Quellen kann nicht über die OBS-Benutzeroberfläche gesteuert werden"
|
||||||
AdvSceneSwitcher.action.source.getSettings="Aktuelle Einstellungen abfragen"
|
AdvSceneSwitcher.action.source.getSettings="Aktuelle Einstellungen abfragen"
|
||||||
AdvSceneSwitcher.action.media="Medien"
|
AdvSceneSwitcher.action.media="Medien"
|
||||||
@@ -476,15 +465,14 @@ AdvSceneSwitcher.action.media.type.stop="Stoppen"
|
|||||||
AdvSceneSwitcher.action.media.type.restart="Neu starten"
|
AdvSceneSwitcher.action.media.type.restart="Neu starten"
|
||||||
AdvSceneSwitcher.action.media.type.next="Nächste"
|
AdvSceneSwitcher.action.media.type.next="Nächste"
|
||||||
AdvSceneSwitcher.action.media.type.previous="Vorherige"
|
AdvSceneSwitcher.action.media.type.previous="Vorherige"
|
||||||
AdvSceneSwitcher.action.media.type.seek="Suche nach"
|
AdvSceneSwitcher.action.media.type.seek.duration="Suche nach"
|
||||||
AdvSceneSwitcher.action.media.entry="{{actions}}{{duration}}{{mediaSources}}"
|
|
||||||
AdvSceneSwitcher.action.macro="Makro"
|
AdvSceneSwitcher.action.macro="Makro"
|
||||||
AdvSceneSwitcher.action.macro.type.pause="Pausieren"
|
AdvSceneSwitcher.action.macro.type.pause="Pausieren"
|
||||||
AdvSceneSwitcher.action.macro.type.unpause="Nicht mehr pausieren"
|
AdvSceneSwitcher.action.macro.type.unpause="Nicht mehr pausieren"
|
||||||
AdvSceneSwitcher.action.macro.type.resetCounter="Zähler zurücksetzen"
|
AdvSceneSwitcher.action.macro.type.resetCounter="Zähler zurücksetzen"
|
||||||
AdvSceneSwitcher.action.macro.type.run="Aktionen ausführen"
|
AdvSceneSwitcher.action.macro.type.run="Aktionen ausführen"
|
||||||
AdvSceneSwitcher.action.macro.type.stop="Aktionen stoppen"
|
AdvSceneSwitcher.action.macro.type.stop="Aktionen stoppen"
|
||||||
AdvSceneSwitcher.action.macro.entry="{{actions}} {{macros}}"
|
AdvSceneSwitcher.action.macro.entry="{{actions}}{{actionIndex}}{{macros}}"
|
||||||
AdvSceneSwitcher.action.pluginState="Plugin-Status"
|
AdvSceneSwitcher.action.pluginState="Plugin-Status"
|
||||||
AdvSceneSwitcher.action.pluginState.type.stop="Erweiterten Automatischen Szenenwechsler stoppen"
|
AdvSceneSwitcher.action.pluginState.type.stop="Erweiterten Automatischen Szenenwechsler stoppen"
|
||||||
AdvSceneSwitcher.action.pluginState.type.noMatch="Ändern des Nichtübereinstimmungsverhaltens:"
|
AdvSceneSwitcher.action.pluginState.type.noMatch="Ändern des Nichtübereinstimmungsverhaltens:"
|
||||||
@@ -506,7 +494,6 @@ AdvSceneSwitcher.action.hotkey.leftMeta="Linke Meta-Taste"
|
|||||||
AdvSceneSwitcher.action.hotkey.rightMeta="Rechte Meta-Taste"
|
AdvSceneSwitcher.action.hotkey.rightMeta="Rechte Meta-Taste"
|
||||||
AdvSceneSwitcher.action.hotkey.onlyOBS="Tastendruck nur an OBS senden"
|
AdvSceneSwitcher.action.hotkey.onlyOBS="Tastendruck nur an OBS senden"
|
||||||
AdvSceneSwitcher.action.hotkey.disabled="Globale Tastendrücke können nicht simuliert werden - die Funktionalität beschränkt sich auf das Senden von Tastendrücken an OBS!"
|
AdvSceneSwitcher.action.hotkey.disabled="Globale Tastendrücke können nicht simuliert werden - die Funktionalität beschränkt sich auf das Senden von Tastendrücken an OBS!"
|
||||||
AdvSceneSwitcher.action.hotkey.entry="Drücke {{keys}} für {{duration}}"
|
|
||||||
AdvSceneSwitcher.action.sceneOrder="Reihenfolge der Szenenelemente"
|
AdvSceneSwitcher.action.sceneOrder="Reihenfolge der Szenenelemente"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveUp="Nach oben verschieben"
|
AdvSceneSwitcher.action.sceneOrder.type.moveUp="Nach oben verschieben"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveDown="Nach unten verschieben"
|
AdvSceneSwitcher.action.sceneOrder.type.moveDown="Nach unten verschieben"
|
||||||
@@ -516,7 +503,7 @@ AdvSceneSwitcher.action.sceneOrder.type.movePosition="An Position verschieben"
|
|||||||
AdvSceneSwitcher.action.sceneOrder.entry="Auf{{scenes}}{{actions}}{{sources}}{{position}}"
|
AdvSceneSwitcher.action.sceneOrder.entry="Auf{{scenes}}{{actions}}{{sources}}{{position}}"
|
||||||
AdvSceneSwitcher.action.sceneTransform="Szenenelement transformieren"
|
AdvSceneSwitcher.action.sceneTransform="Szenenelement transformieren"
|
||||||
AdvSceneSwitcher.action.sceneTransform.getTransform="Transformation erhalten"
|
AdvSceneSwitcher.action.sceneTransform.getTransform="Transformation erhalten"
|
||||||
AdvSceneSwitcher.action.sceneTransform.entry="Auf{{scenes}}transformieren{{sources}}"
|
AdvSceneSwitcher.action.sceneTransform.entry="Auf{{scenes}}{{action}}{{rotation}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.file="Datei"
|
AdvSceneSwitcher.action.file="Datei"
|
||||||
AdvSceneSwitcher.action.file.type.write="Schreiben"
|
AdvSceneSwitcher.action.file.type.write="Schreiben"
|
||||||
AdvSceneSwitcher.action.file.type.append="Anhängen"
|
AdvSceneSwitcher.action.file.type.append="Anhängen"
|
||||||
@@ -567,8 +554,6 @@ AdvSceneSwitcher.action.sequence.continueFrom="Weiter mit ausgewähltem Element"
|
|||||||
AdvSceneSwitcher.action.websocket="Websocket"
|
AdvSceneSwitcher.action.websocket="Websocket"
|
||||||
AdvSceneSwitcher.action.websocket.type.request="Anfrage"
|
AdvSceneSwitcher.action.websocket.type.request="Anfrage"
|
||||||
AdvSceneSwitcher.action.websocket.type.event="Ereignis"
|
AdvSceneSwitcher.action.websocket.type.event="Ereignis"
|
||||||
AdvSceneSwitcher.action.websocket.entry.request="Szenenwechsler {{type}} via {{connection}} senden"
|
|
||||||
AdvSceneSwitcher.action.websocket.entry.event="Szenenwechsler {{type}} an verbundene Clients senden"
|
|
||||||
AdvSceneSwitcher.action.http="HTTP"
|
AdvSceneSwitcher.action.http="HTTP"
|
||||||
AdvSceneSwitcher.action.http.type.get="GET"
|
AdvSceneSwitcher.action.http.type.get="GET"
|
||||||
AdvSceneSwitcher.action.http.type.post="POST"
|
AdvSceneSwitcher.action.http.type.post="POST"
|
||||||
@@ -586,7 +571,7 @@ AdvSceneSwitcher.action.variable.invalidSelection="Ungültige Auswahl!"
|
|||||||
AdvSceneSwitcher.action.variable.actionNoVariableSupport="Das Abrufen von Variablenwerten aus %1 Aktionen wird nicht unterstützt!"
|
AdvSceneSwitcher.action.variable.actionNoVariableSupport="Das Abrufen von Variablenwerten aus %1 Aktionen wird nicht unterstützt!"
|
||||||
AdvSceneSwitcher.action.variable.conditionNoVariableSupport="Das Abrufen von Variablenwerten aus %1 Bedingungen wird nicht unterstützt!"
|
AdvSceneSwitcher.action.variable.conditionNoVariableSupport="Das Abrufen von Variablenwerten aus %1 Bedingungen wird nicht unterstützt!"
|
||||||
AdvSceneSwitcher.action.variable.currentSegmentValue="Aktueller Wert:"
|
AdvSceneSwitcher.action.variable.currentSegmentValue="Aktueller Wert:"
|
||||||
AdvSceneSwitcher.action.variable.entry="{{actions}}{{variables}}{{variables2}}{{strValue}}{{numValue}}{{segmentIndex}}{{mathExpression}}"
|
AdvSceneSwitcher.action.variable.entry="{{actions}}{{variables}}{{variables2}}{{strValue}}{{numValue}}{{segmentIndex}}{{mathExpression}}{{envVariableName}}{{scenes}}{{tempVars}}"
|
||||||
|
|
||||||
|
|
||||||
; Transition Tab
|
; Transition Tab
|
||||||
@@ -646,7 +631,7 @@ AdvSceneSwitcher.mediaTab.states.none="Keine Auswahl"
|
|||||||
AdvSceneSwitcher.mediaTab.states.playing="Abspielen"
|
AdvSceneSwitcher.mediaTab.states.playing="Abspielen"
|
||||||
AdvSceneSwitcher.mediaTab.states.opening="Öffnen"
|
AdvSceneSwitcher.mediaTab.states.opening="Öffnen"
|
||||||
AdvSceneSwitcher.mediaTab.states.buffering="Buffern"
|
AdvSceneSwitcher.mediaTab.states.buffering="Buffern"
|
||||||
AdvSceneSwitcher.mediaTab.states.Paused="Pausiert"
|
AdvSceneSwitcher.mediaTab.states.paused="Pausiert"
|
||||||
AdvSceneSwitcher.mediaTab.states.stopped="Gestoppt"
|
AdvSceneSwitcher.mediaTab.states.stopped="Gestoppt"
|
||||||
AdvSceneSwitcher.mediaTab.states.ended="Beendet"
|
AdvSceneSwitcher.mediaTab.states.ended="Beendet"
|
||||||
AdvSceneSwitcher.mediaTab.states.error="Fehler"
|
AdvSceneSwitcher.mediaTab.states.error="Fehler"
|
||||||
|
|||||||
@@ -122,12 +122,7 @@ AdvSceneSwitcher.condition.scene.previousSceneTransitionBehaviour="Durante la tr
|
|||||||
AdvSceneSwitcher.condition.scene.entry.line1="{{sceneType}}{{scenes}}{{pattern}}"
|
AdvSceneSwitcher.condition.scene.entry.line1="{{sceneType}}{{scenes}}{{pattern}}"
|
||||||
AdvSceneSwitcher.condition.scene.entry.line2="{{useTransitionTargetScene}}"
|
AdvSceneSwitcher.condition.scene.entry.line2="{{useTransitionTargetScene}}"
|
||||||
AdvSceneSwitcher.condition.window="Ventana"
|
AdvSceneSwitcher.condition.window="Ventana"
|
||||||
AdvSceneSwitcher.condition.window.entry.line1="{{windows}} existen y ..."
|
|
||||||
AdvSceneSwitcher.condition.window.entry.line2="... es {{fullscreen}} pantalla completa {{maximized}} maximizada {{focused}} enfocada {{windowFocusChanged}} ventana de primer plano cambiada"
|
|
||||||
AdvSceneSwitcher.condition.file="Archivo"
|
AdvSceneSwitcher.condition.file="Archivo"
|
||||||
AdvSceneSwitcher.condition.file.entry.line1="Contenido de{{fileType}}{{filePath}}{{conditions}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line2="{{matchText}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
|
||||||
AdvSceneSwitcher.condition.media="Medios"
|
AdvSceneSwitcher.condition.media="Medios"
|
||||||
AdvSceneSwitcher.condition.media.anyOnScene="Cualquier fuente multimedia activada"
|
AdvSceneSwitcher.condition.media.anyOnScene="Cualquier fuente multimedia activada"
|
||||||
AdvSceneSwitcher.condition.media.allOnScene="Todas las fuentes de medios activadas"
|
AdvSceneSwitcher.condition.media.allOnScene="Todas las fuentes de medios activadas"
|
||||||
@@ -184,9 +179,8 @@ AdvSceneSwitcher.condition.record="Grabación"
|
|||||||
AdvSceneSwitcher.condition.record.state.start="Grabación en ejecución"
|
AdvSceneSwitcher.condition.record.state.start="Grabación en ejecución"
|
||||||
AdvSceneSwitcher.condition.record.state.pause="Grabación en pausa"
|
AdvSceneSwitcher.condition.record.state.pause="Grabación en pausa"
|
||||||
AdvSceneSwitcher.condition.record.state.stop="Grabación detenida"
|
AdvSceneSwitcher.condition.record.state.stop="Grabación detenida"
|
||||||
AdvSceneSwitcher.condition.record.entry="{{recordState}}"
|
|
||||||
AdvSceneSwitcher.condition.process="Proceso"
|
AdvSceneSwitcher.condition.process="Proceso"
|
||||||
AdvSceneSwitcher.condition.process.entry="{{processes}} se está ejecutando {{focused}} y está enfocado"
|
AdvSceneSwitcher.condition.process.entry="{{processes}}{{regex}}se está ejecutando{{focused}}y está enfocado"
|
||||||
AdvSceneSwitcher.condition.idle="Inactivo"
|
AdvSceneSwitcher.condition.idle="Inactivo"
|
||||||
AdvSceneSwitcher.condition.idle.entry="No hay entradas de teclado o ratón durante {{duration}}"
|
AdvSceneSwitcher.condition.idle.entry="No hay entradas de teclado o ratón durante {{duration}}"
|
||||||
AdvSceneSwitcher.condition.pluginState="Estado del complemento"
|
AdvSceneSwitcher.condition.pluginState="Estado del complemento"
|
||||||
@@ -277,7 +271,8 @@ AdvSceneSwitcher.condition.date.entry.nextMatchDate="Próxima coincidencia en: %
|
|||||||
AdvSceneSwitcher.condition.date.entry.updateOnRepeat="{{updateOnRepeat}} Al repetir actualizar la fecha seleccionada para repetir la fecha"
|
AdvSceneSwitcher.condition.date.entry.updateOnRepeat="{{updateOnRepeat}} Al repetir actualizar la fecha seleccionada para repetir la fecha"
|
||||||
AdvSceneSwitcher.condition.sceneTransform="Transformar elemento de escena"
|
AdvSceneSwitcher.condition.sceneTransform="Transformar elemento de escena"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.getTransform="Obtener transformación"
|
AdvSceneSwitcher.condition.sceneTransform.getTransform="Obtener transformación"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line1="En{{scenes}}{{sources}}coincide con la transformación"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line1="En{{scenes}}{{sources}}{{types}}"
|
||||||
|
AdvSceneSwitcher.condition.sceneTransform.entry.type.matches="coincide con la transformación"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
||||||
AdvSceneSwitcher.condition.transition="Transición"
|
AdvSceneSwitcher.condition.transition="Transición"
|
||||||
@@ -324,8 +319,8 @@ AdvSceneSwitcher.condition.stats.dockHint="Puede abrir el panel de \"Estadístic
|
|||||||
AdvSceneSwitcher.condition.stats.entry="{{stats}} esta {{condition}} {{value}}"
|
AdvSceneSwitcher.condition.stats.entry="{{stats}} esta {{condition}} {{value}}"
|
||||||
|
|
||||||
; Macro Actions
|
; Macro Actions
|
||||||
AdvSceneSwitcher.action.switchScene="Cambiar escena"
|
AdvSceneSwitcher.action.scene="Cambiar escena"
|
||||||
AdvSceneSwitcher.action.scene.entry="Cambiar a la escena {{scenes}} usando {{transitions}} con una duración de {{duration}} segundos"
|
AdvSceneSwitcher.action.scene.entry="Cambiar a la{{sceneTypes}}escena{{scenes}}usando{{transitions}}con una duración de{{duration}} segundos"
|
||||||
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Espere hasta que se complete la transición a la escena de destino"
|
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Espere hasta que se complete la transición a la escena de destino"
|
||||||
AdvSceneSwitcher.action.wait="Esperar"
|
AdvSceneSwitcher.action.wait="Esperar"
|
||||||
AdvSceneSwitcher.action.wait.type.fixed="fijo"
|
AdvSceneSwitcher.action.wait.type.fixed="fijo"
|
||||||
@@ -360,18 +355,14 @@ AdvSceneSwitcher.action.replay.entry="{{actions}}"
|
|||||||
AdvSceneSwitcher.action.streaming="Transmisión"
|
AdvSceneSwitcher.action.streaming="Transmisión"
|
||||||
AdvSceneSwitcher.action.streaming.type.stop="Detener transmisión"
|
AdvSceneSwitcher.action.streaming.type.stop="Detener transmisión"
|
||||||
AdvSceneSwitcher.action.streaming.type.start="Iniciar transmisión"
|
AdvSceneSwitcher.action.streaming.type.start="Iniciar transmisión"
|
||||||
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}"
|
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}{{stringValue}}{{showPassword}}"
|
||||||
AdvSceneSwitcher.action.run="Ejecutar"
|
AdvSceneSwitcher.action.run="Ejecutar"
|
||||||
AdvSceneSwitcher.action.run.arguments="Argumentos:"
|
|
||||||
AdvSceneSwitcher.action.run.addArgument="Agregar argumento"
|
|
||||||
AdvSceneSwitcher.action.run.addArgumentDescription="Añadir nuevo argumento:"
|
|
||||||
AdvSceneSwitcher.action.run.entry="Ejecutar {{filePath}}"
|
|
||||||
AdvSceneSwitcher.action.sceneVisibility="Visibilidad del elemento de escena"
|
AdvSceneSwitcher.action.sceneVisibility="Visibilidad del elemento de escena"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.show="Mostrar"
|
AdvSceneSwitcher.action.sceneVisibility.type.show="Mostrar"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.hide="Ocultar"
|
AdvSceneSwitcher.action.sceneVisibility.type.hide="Ocultar"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.source="Fuente"
|
AdvSceneSwitcher.action.sceneVisibility.type.source="Fuente"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Cualquiera"
|
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Cualquiera"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.entry="En{{scenes}}{{actions}}{{sourceTypes}}{{sources}}{{sourceGroups}}"
|
AdvSceneSwitcher.action.sceneVisibility.entry="En{{scenes}}{{actions}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.filter="Filtro"
|
AdvSceneSwitcher.action.filter="Filtro"
|
||||||
AdvSceneSwitcher.action.filter.type.enable="Habilitar"
|
AdvSceneSwitcher.action.filter.type.enable="Habilitar"
|
||||||
AdvSceneSwitcher.action.filter.type.disable="Deshabilitar"
|
AdvSceneSwitcher.action.filter.type.disable="Deshabilitar"
|
||||||
@@ -382,7 +373,7 @@ AdvSceneSwitcher.action.source="Fuente"
|
|||||||
AdvSceneSwitcher.action.source.type.enable="Habilitar"
|
AdvSceneSwitcher.action.source.type.enable="Habilitar"
|
||||||
AdvSceneSwitcher.action.source.type.disable="Deshabilitar"
|
AdvSceneSwitcher.action.source.type.disable="Deshabilitar"
|
||||||
AdvSceneSwitcher.action.source.type.settings="Establecer configuración"
|
AdvSceneSwitcher.action.source.type.settings="Establecer configuración"
|
||||||
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}"
|
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
|
||||||
AdvSceneSwitcher.action.source.warning="Advertencia: la IU de OBS no puede controlar la habilitación y deshabilitación global de fuentes"
|
AdvSceneSwitcher.action.source.warning="Advertencia: la IU de OBS no puede controlar la habilitación y deshabilitación global de fuentes"
|
||||||
AdvSceneSwitcher.action.source.getSettings="Obtener la configuración actual"
|
AdvSceneSwitcher.action.source.getSettings="Obtener la configuración actual"
|
||||||
AdvSceneSwitcher.action.media="Medios"
|
AdvSceneSwitcher.action.media="Medios"
|
||||||
@@ -392,15 +383,14 @@ AdvSceneSwitcher.action.media.type.stop="Detener"
|
|||||||
AdvSceneSwitcher.action.media.type.restart="Reiniciar"
|
AdvSceneSwitcher.action.media.type.restart="Reiniciar"
|
||||||
AdvSceneSwitcher.action.media.type.next="Siguiente"
|
AdvSceneSwitcher.action.media.type.next="Siguiente"
|
||||||
AdvSceneSwitcher.action.media.type.previous="Anterior"
|
AdvSceneSwitcher.action.media.type.previous="Anterior"
|
||||||
AdvSceneSwitcher.action.media.type.seek="Buscar"
|
AdvSceneSwitcher.action.media.type.seek.duration="Buscar"
|
||||||
AdvSceneSwitcher.action.media.entry="{{actions}}{{duration}}{{mediaSources}}"
|
|
||||||
AdvSceneSwitcher.action.macro="Macro"
|
AdvSceneSwitcher.action.macro="Macro"
|
||||||
AdvSceneSwitcher.action.macro.type.pause="Pausa"
|
AdvSceneSwitcher.action.macro.type.pause="Pausa"
|
||||||
AdvSceneSwitcher.action.macro.type.unpause="Reanudar"
|
AdvSceneSwitcher.action.macro.type.unpause="Reanudar"
|
||||||
AdvSceneSwitcher.action.macro.type.resetCounter="Reiniciar contador"
|
AdvSceneSwitcher.action.macro.type.resetCounter="Reiniciar contador"
|
||||||
AdvSceneSwitcher.action.macro.type.run="Ejecutar"
|
AdvSceneSwitcher.action.macro.type.run="Ejecutar"
|
||||||
AdvSceneSwitcher.action.macro.type.stop="Detener"
|
AdvSceneSwitcher.action.macro.type.stop="Detener"
|
||||||
AdvSceneSwitcher.action.macro.entry="{{actions}} {{macros}}"
|
AdvSceneSwitcher.action.macro.entry="{{actions}}{{actionIndex}}{{macros}}"
|
||||||
AdvSceneSwitcher.action.pluginState="Estado del complemento"
|
AdvSceneSwitcher.action.pluginState="Estado del complemento"
|
||||||
AdvSceneSwitcher.action.pluginState.type.stop="Detener el complemento Advanced Scene Switcher"
|
AdvSceneSwitcher.action.pluginState.type.stop="Detener el complemento Advanced Scene Switcher"
|
||||||
AdvSceneSwitcher.action.pluginState.type.noMatch="Cambiar el comportamiento de no coincidencia:"
|
AdvSceneSwitcher.action.pluginState.type.noMatch="Cambiar el comportamiento de no coincidencia:"
|
||||||
@@ -422,7 +412,6 @@ AdvSceneSwitcher.action.hotkey.leftMeta="Meta izquierda"
|
|||||||
AdvSceneSwitcher.action.hotkey.rightMeta="Meta derecho"
|
AdvSceneSwitcher.action.hotkey.rightMeta="Meta derecho"
|
||||||
AdvSceneSwitcher.action.hotkey.onlyOBS="Enviar pulsación de tecla solo a OBS"
|
AdvSceneSwitcher.action.hotkey.onlyOBS="Enviar pulsación de tecla solo a OBS"
|
||||||
AdvSceneSwitcher.action.hotkey.disabled="No se puede simular la pulsación de teclas: ¡funcionalidad desactivada!"
|
AdvSceneSwitcher.action.hotkey.disabled="No se puede simular la pulsación de teclas: ¡funcionalidad desactivada!"
|
||||||
AdvSceneSwitcher.action.hotkey.entry="Presione {{keys}} durante {{duration}}"
|
|
||||||
AdvSceneSwitcher.action.sceneOrder="Orden de elementos de escena"
|
AdvSceneSwitcher.action.sceneOrder="Orden de elementos de escena"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveUp="Mover hacia arriba"
|
AdvSceneSwitcher.action.sceneOrder.type.moveUp="Mover hacia arriba"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveDown="Mover hacia abajo"
|
AdvSceneSwitcher.action.sceneOrder.type.moveDown="Mover hacia abajo"
|
||||||
@@ -432,7 +421,7 @@ AdvSceneSwitcher.action.sceneOrder.type.movePosition="Mover a la posición"
|
|||||||
AdvSceneSwitcher.action.sceneOrder.entry="En{{scenes}}{{actions}}{{sources}}{{position}}"
|
AdvSceneSwitcher.action.sceneOrder.entry="En{{scenes}}{{actions}}{{sources}}{{position}}"
|
||||||
AdvSceneSwitcher.action.sceneTransform="Transformar elemento de escena"
|
AdvSceneSwitcher.action.sceneTransform="Transformar elemento de escena"
|
||||||
AdvSceneSwitcher.action.sceneTransform.getTransform="Obtener transformación"
|
AdvSceneSwitcher.action.sceneTransform.getTransform="Obtener transformación"
|
||||||
AdvSceneSwitcher.action.sceneTransform.entry="En{{scenes}}transformar{{sources}}"
|
AdvSceneSwitcher.action.sceneTransform.entry="En{{scenes}}{{action}}{{rotation}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.file="Archivo"
|
AdvSceneSwitcher.action.file="Archivo"
|
||||||
AdvSceneSwitcher.action.file.type.write="Escribir"
|
AdvSceneSwitcher.action.file.type.write="Escribir"
|
||||||
AdvSceneSwitcher.action.file.type.append="Agregar"
|
AdvSceneSwitcher.action.file.type.append="Agregar"
|
||||||
@@ -531,7 +520,7 @@ AdvSceneSwitcher.mediaTab.states.none="Ninguno"
|
|||||||
AdvSceneSwitcher.mediaTab.states.playing="Reproduciéndose"
|
AdvSceneSwitcher.mediaTab.states.playing="Reproduciéndose"
|
||||||
AdvSceneSwitcher.mediaTab.states.opening="Abriendo"
|
AdvSceneSwitcher.mediaTab.states.opening="Abriendo"
|
||||||
AdvSceneSwitcher.mediaTab.states.buffering="Almacenando en búfer"
|
AdvSceneSwitcher.mediaTab.states.buffering="Almacenando en búfer"
|
||||||
AdvSceneSwitcher.mediaTab.states.Paused="Pausado"
|
AdvSceneSwitcher.mediaTab.states.paused="Pausado"
|
||||||
AdvSceneSwitcher.mediaTab.states.stopped="Detenido"
|
AdvSceneSwitcher.mediaTab.states.stopped="Detenido"
|
||||||
AdvSceneSwitcher.mediaTab.states.ended="Finalizado"
|
AdvSceneSwitcher.mediaTab.states.ended="Finalizado"
|
||||||
AdvSceneSwitcher.mediaTab.states.error="Error"
|
AdvSceneSwitcher.mediaTab.states.error="Error"
|
||||||
|
|||||||
1201
data/locale/fr-FR.ini
Normal file
@@ -86,10 +86,7 @@ AdvSceneSwitcher.condition.scene="Сцена"
|
|||||||
AdvSceneSwitcher.condition.scene.type.current="Текущий"
|
AdvSceneSwitcher.condition.scene.type.current="Текущий"
|
||||||
AdvSceneSwitcher.condition.scene.type.previous="Предыдущий"
|
AdvSceneSwitcher.condition.scene.type.previous="Предыдущий"
|
||||||
AdvSceneSwitcher.condition.window="Окно"
|
AdvSceneSwitcher.condition.window="Окно"
|
||||||
AdvSceneSwitcher.condition.window.entry.line1="{{windows}} существует и ..."
|
|
||||||
AdvSceneSwitcher.condition.file="Файл"
|
AdvSceneSwitcher.condition.file="Файл"
|
||||||
AdvSceneSwitcher.condition.file.entry.line2="{{matchText}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
|
||||||
AdvSceneSwitcher.condition.media="Медиа"
|
AdvSceneSwitcher.condition.media="Медиа"
|
||||||
AdvSceneSwitcher.condition.video="Видео"
|
AdvSceneSwitcher.condition.video="Видео"
|
||||||
AdvSceneSwitcher.condition.video.condition.match="точно соответствует"
|
AdvSceneSwitcher.condition.video.condition.match="точно соответствует"
|
||||||
@@ -108,7 +105,7 @@ AdvSceneSwitcher.condition.record.state.start="Запись запущена"
|
|||||||
AdvSceneSwitcher.condition.record.state.pause="Запись приостановлена"
|
AdvSceneSwitcher.condition.record.state.pause="Запись приостановлена"
|
||||||
AdvSceneSwitcher.condition.record.state.stop="Запись остановлена"
|
AdvSceneSwitcher.condition.record.state.stop="Запись остановлена"
|
||||||
AdvSceneSwitcher.condition.process="Процесс"
|
AdvSceneSwitcher.condition.process="Процесс"
|
||||||
AdvSceneSwitcher.condition.process.entry="{{processes}} запущен {{focused}} и сфокусирован"
|
AdvSceneSwitcher.condition.process.entry="{{processes}}{{regex}}запущен{{focused}}и сфокусирован"
|
||||||
AdvSceneSwitcher.condition.idle="Простой"
|
AdvSceneSwitcher.condition.idle="Простой"
|
||||||
AdvSceneSwitcher.condition.idle.entry="Не было ни клавиатуры, ни мыши в течении{{duration}}"
|
AdvSceneSwitcher.condition.idle.entry="Не было ни клавиатуры, ни мыши в течении{{duration}}"
|
||||||
AdvSceneSwitcher.condition.pluginState="Состояние плагина"
|
AdvSceneSwitcher.condition.pluginState="Состояние плагина"
|
||||||
@@ -116,8 +113,8 @@ AdvSceneSwitcher.condition.pluginState.state.sceneSwitched="Автоматиче
|
|||||||
AdvSceneSwitcher.condition.pluginState.entry="{{condition}}"
|
AdvSceneSwitcher.condition.pluginState.entry="{{condition}}"
|
||||||
|
|
||||||
; Macro Actions
|
; Macro Actions
|
||||||
AdvSceneSwitcher.action.switchScene="Переключить сцену"
|
AdvSceneSwitcher.action.scene="Переключить сцену"
|
||||||
AdvSceneSwitcher.action.scene.entry="Перейти к сцене {{scenes}} используя {{transitions}} с продолжительностью {{duration}} секунд"
|
AdvSceneSwitcher.action.scene.entry="Перейти к сцене{{sceneTypes}}{{scenes}}используя{{transitions}}с продолжительностью{{duration}}секунд"
|
||||||
AdvSceneSwitcher.action.wait="Подождать"
|
AdvSceneSwitcher.action.wait="Подождать"
|
||||||
AdvSceneSwitcher.action.wait.type.fixed="фиксированный"
|
AdvSceneSwitcher.action.wait.type.fixed="фиксированный"
|
||||||
AdvSceneSwitcher.action.wait.type.random="случайный"
|
AdvSceneSwitcher.action.wait.type.random="случайный"
|
||||||
@@ -144,7 +141,7 @@ AdvSceneSwitcher.action.replay.entry="{{actions}}"
|
|||||||
AdvSceneSwitcher.action.streaming="Потоковое вещание"
|
AdvSceneSwitcher.action.streaming="Потоковое вещание"
|
||||||
AdvSceneSwitcher.action.streaming.type.stop="Остановить потоковое вещание"
|
AdvSceneSwitcher.action.streaming.type.stop="Остановить потоковое вещание"
|
||||||
AdvSceneSwitcher.action.streaming.type.start="Начать потоковое вещание"
|
AdvSceneSwitcher.action.streaming.type.start="Начать потоковое вещание"
|
||||||
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}"
|
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}{{stringValue}}{{showPassword}}"
|
||||||
AdvSceneSwitcher.action.run="Запустить"
|
AdvSceneSwitcher.action.run="Запустить"
|
||||||
|
|
||||||
|
|
||||||
@@ -205,7 +202,7 @@ AdvSceneSwitcher.mediaTab.states.none="Нет"
|
|||||||
AdvSceneSwitcher.mediaTab.states.playing="Играет"
|
AdvSceneSwitcher.mediaTab.states.playing="Играет"
|
||||||
AdvSceneSwitcher.mediaTab.states.opening="Открытие"
|
AdvSceneSwitcher.mediaTab.states.opening="Открытие"
|
||||||
AdvSceneSwitcher.mediaTab.states.buffering="Буферизация"
|
AdvSceneSwitcher.mediaTab.states.buffering="Буферизация"
|
||||||
AdvSceneSwitcher.mediaTab.states.Paused="Приостановлено"
|
AdvSceneSwitcher.mediaTab.states.paused="Приостановлено"
|
||||||
AdvSceneSwitcher.mediaTab.states.stopped="Остановлено"
|
AdvSceneSwitcher.mediaTab.states.stopped="Остановлено"
|
||||||
AdvSceneSwitcher.mediaTab.states.ended="Закончилось"
|
AdvSceneSwitcher.mediaTab.states.ended="Закончилось"
|
||||||
AdvSceneSwitcher.mediaTab.states.error="Ошибка"
|
AdvSceneSwitcher.mediaTab.states.error="Ошибка"
|
||||||
|
|||||||
@@ -112,12 +112,7 @@ AdvSceneSwitcher.condition.scene.currentSceneTransitionBehaviour="Geçiş hedefi
|
|||||||
AdvSceneSwitcher.condition.scene.entry.line1="{{sceneType}}{{scenes}}{{pattern}}"
|
AdvSceneSwitcher.condition.scene.entry.line1="{{sceneType}}{{scenes}}{{pattern}}"
|
||||||
AdvSceneSwitcher.condition.scene.entry.line2="{{useTransitionTargetScene}}"
|
AdvSceneSwitcher.condition.scene.entry.line2="{{useTransitionTargetScene}}"
|
||||||
AdvSceneSwitcher.condition.window="Pencere"
|
AdvSceneSwitcher.condition.window="Pencere"
|
||||||
AdvSceneSwitcher.condition.window.entry.line1="{{windows}} Varolan ve ..."
|
|
||||||
AdvSceneSwitcher.condition.window.entry.line2="... {{fullscreen}} Tam ekran {{maximized}} büyütüldü {{focused}} odaklanıldı {{windowFocusChanged}} ön plan penceresi değişikliği"
|
|
||||||
AdvSceneSwitcher.condition.file="Dosya"
|
AdvSceneSwitcher.condition.file="Dosya"
|
||||||
AdvSceneSwitcher.condition.file.entry.line1="İçerik{{fileType}}{{filePath}}{{conditions}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line2="{{matchText}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
|
||||||
AdvSceneSwitcher.condition.media="Medya"
|
AdvSceneSwitcher.condition.media="Medya"
|
||||||
AdvSceneSwitcher.condition.media.anyOnScene="Herhangi bir medya kaynağı"
|
AdvSceneSwitcher.condition.media.anyOnScene="Herhangi bir medya kaynağı"
|
||||||
AdvSceneSwitcher.condition.media.allOnScene="Tüm medya kaynakları "
|
AdvSceneSwitcher.condition.media.allOnScene="Tüm medya kaynakları "
|
||||||
@@ -161,9 +156,8 @@ AdvSceneSwitcher.condition.record="Kayıt"
|
|||||||
AdvSceneSwitcher.condition.record.state.start="Kayıt Çalışıyor"
|
AdvSceneSwitcher.condition.record.state.start="Kayıt Çalışıyor"
|
||||||
AdvSceneSwitcher.condition.record.state.pause="Kayıt durakladı"
|
AdvSceneSwitcher.condition.record.state.pause="Kayıt durakladı"
|
||||||
AdvSceneSwitcher.condition.record.state.stop="Kayıt durdu"
|
AdvSceneSwitcher.condition.record.state.stop="Kayıt durdu"
|
||||||
AdvSceneSwitcher.condition.record.entry="{{recordState}}"
|
|
||||||
AdvSceneSwitcher.condition.process="İşlem"
|
AdvSceneSwitcher.condition.process="İşlem"
|
||||||
AdvSceneSwitcher.condition.process.entry="{{processes}} çalışıyor {{focused}} ve odaklandı"
|
AdvSceneSwitcher.condition.process.entry="{{processes}}{{regex}}çalışıyor{{focused}}ve odaklandı"
|
||||||
AdvSceneSwitcher.condition.idle="Boşta"
|
AdvSceneSwitcher.condition.idle="Boşta"
|
||||||
AdvSceneSwitcher.condition.idle.entry="...için klavye veya fare girişi yok {{duration}}"
|
AdvSceneSwitcher.condition.idle.entry="...için klavye veya fare girişi yok {{duration}}"
|
||||||
AdvSceneSwitcher.condition.pluginState="Eklenti durumu"
|
AdvSceneSwitcher.condition.pluginState="Eklenti durumu"
|
||||||
@@ -233,7 +227,8 @@ AdvSceneSwitcher.condition.date.state.before="Önce"
|
|||||||
AdvSceneSwitcher.condition.date.state.between="Arasında"
|
AdvSceneSwitcher.condition.date.state.between="Arasında"
|
||||||
AdvSceneSwitcher.condition.sceneTransform="Sahne öğesi dönüşümü"
|
AdvSceneSwitcher.condition.sceneTransform="Sahne öğesi dönüşümü"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.getTransform="Dönüşümü al"
|
AdvSceneSwitcher.condition.sceneTransform.getTransform="Dönüşümü al"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line1="Açık{{scenes}}{{sources}} dönüşümle eşleşir"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line1="Açık{{scenes}}{{sources}}{{types}}"
|
||||||
|
AdvSceneSwitcher.condition.sceneTransform.entry.type.matches="dönüşümle eşleşir"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
||||||
AdvSceneSwitcher.condition.transition="Geçiş"
|
AdvSceneSwitcher.condition.transition="Geçiş"
|
||||||
@@ -261,8 +256,8 @@ AdvSceneSwitcher.condition.openvr.entry.line2="{{controls}}"
|
|||||||
AdvSceneSwitcher.condition.openvr.entry.line3="HMD mevcut {{xPos}} x {{yPos}} x {{zPos}}"
|
AdvSceneSwitcher.condition.openvr.entry.line3="HMD mevcut {{xPos}} x {{yPos}} x {{zPos}}"
|
||||||
|
|
||||||
; Macro Actions
|
; Macro Actions
|
||||||
AdvSceneSwitcher.action.switchScene="Sahne Degistirici"
|
AdvSceneSwitcher.action.scene="Sahne Degistirici"
|
||||||
AdvSceneSwitcher.action.scene.entry="Sahneyi {{scenes}} kullanarak {{transitions}} süresi olan {{duration}} saniye"
|
AdvSceneSwitcher.action.scene.entry="Sahneyi{{sceneTypes}}{{scenes}}kullanarak{{transitions}}süresi olan{{duration}}saniye"
|
||||||
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Hedef sahneye geçiş tamamlanana kadar bekleyin"
|
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Hedef sahneye geçiş tamamlanana kadar bekleyin"
|
||||||
AdvSceneSwitcher.action.wait="Bekle"
|
AdvSceneSwitcher.action.wait="Bekle"
|
||||||
AdvSceneSwitcher.action.wait.type.fixed="sabit"
|
AdvSceneSwitcher.action.wait.type.fixed="sabit"
|
||||||
@@ -290,18 +285,14 @@ AdvSceneSwitcher.action.replay.entry="{{actions}}"
|
|||||||
AdvSceneSwitcher.action.streaming="Yayın"
|
AdvSceneSwitcher.action.streaming="Yayın"
|
||||||
AdvSceneSwitcher.action.streaming.type.stop="Yayın durdur"
|
AdvSceneSwitcher.action.streaming.type.stop="Yayın durdur"
|
||||||
AdvSceneSwitcher.action.streaming.type.start="Yayın başlat"
|
AdvSceneSwitcher.action.streaming.type.start="Yayın başlat"
|
||||||
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}"
|
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}{{stringValue}}{{showPassword}}"
|
||||||
AdvSceneSwitcher.action.run="Çalıştır"
|
AdvSceneSwitcher.action.run="Çalıştır"
|
||||||
AdvSceneSwitcher.action.run.arguments="Argümanlar:"
|
|
||||||
AdvSceneSwitcher.action.run.addArgument="Argüman ekle"
|
|
||||||
AdvSceneSwitcher.action.run.addArgumentDescription="Yeni Argüman ekle:"
|
|
||||||
AdvSceneSwitcher.action.run.entry="Çalıştır {{filePath}}"
|
|
||||||
AdvSceneSwitcher.action.sceneVisibility="Sahne öğesi görünürlüğü"
|
AdvSceneSwitcher.action.sceneVisibility="Sahne öğesi görünürlüğü"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.show="Göster"
|
AdvSceneSwitcher.action.sceneVisibility.type.show="Göster"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.hide="Gizle"
|
AdvSceneSwitcher.action.sceneVisibility.type.hide="Gizle"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.source="Kayıt"
|
AdvSceneSwitcher.action.sceneVisibility.type.source="Kayıt"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Herhangi"
|
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Herhangi"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.entry="Açık{{scenes}}{{actions}}{{sourceTypes}}{{sources}}{{sourceGroups}}"
|
AdvSceneSwitcher.action.sceneVisibility.entry="Açık{{scenes}}{{actions}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.filter="Filtrele"
|
AdvSceneSwitcher.action.filter="Filtrele"
|
||||||
AdvSceneSwitcher.action.filter.type.enable="Etkin"
|
AdvSceneSwitcher.action.filter.type.enable="Etkin"
|
||||||
AdvSceneSwitcher.action.filter.type.disable="Etkisiz"
|
AdvSceneSwitcher.action.filter.type.disable="Etkisiz"
|
||||||
@@ -312,7 +303,7 @@ AdvSceneSwitcher.action.source="Kaynak"
|
|||||||
AdvSceneSwitcher.action.source.type.enable="Etkin"
|
AdvSceneSwitcher.action.source.type.enable="Etkin"
|
||||||
AdvSceneSwitcher.action.source.type.disable="Etkisiz"
|
AdvSceneSwitcher.action.source.type.disable="Etkisiz"
|
||||||
AdvSceneSwitcher.action.source.type.settings="Ayarları yap"
|
AdvSceneSwitcher.action.source.type.settings="Ayarları yap"
|
||||||
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}"
|
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
|
||||||
AdvSceneSwitcher.action.source.warning="Uyarı: Kaynakların global olarak etkinleştirilmesi ve devre dışı bırakılması, OBS UI tarafından kontrol edilemez"
|
AdvSceneSwitcher.action.source.warning="Uyarı: Kaynakların global olarak etkinleştirilmesi ve devre dışı bırakılması, OBS UI tarafından kontrol edilemez"
|
||||||
AdvSceneSwitcher.action.source.getSettings="Mevcut Ayarları yap"
|
AdvSceneSwitcher.action.source.getSettings="Mevcut Ayarları yap"
|
||||||
AdvSceneSwitcher.action.media="Medya"
|
AdvSceneSwitcher.action.media="Medya"
|
||||||
@@ -322,13 +313,12 @@ AdvSceneSwitcher.action.media.type.stop="Dur"
|
|||||||
AdvSceneSwitcher.action.media.type.restart="Yeniden Başlat"
|
AdvSceneSwitcher.action.media.type.restart="Yeniden Başlat"
|
||||||
AdvSceneSwitcher.action.media.type.next="Sonraki"
|
AdvSceneSwitcher.action.media.type.next="Sonraki"
|
||||||
AdvSceneSwitcher.action.media.type.previous="Önceki"
|
AdvSceneSwitcher.action.media.type.previous="Önceki"
|
||||||
AdvSceneSwitcher.action.media.entry="{{actions}}{{duration}}{{mediaSources}}"
|
|
||||||
AdvSceneSwitcher.action.macro="Makro"
|
AdvSceneSwitcher.action.macro="Makro"
|
||||||
AdvSceneSwitcher.action.macro.type.pause="Duraklat"
|
AdvSceneSwitcher.action.macro.type.pause="Duraklat"
|
||||||
AdvSceneSwitcher.action.macro.type.unpause="Duraklatma"
|
AdvSceneSwitcher.action.macro.type.unpause="Duraklatma"
|
||||||
AdvSceneSwitcher.action.macro.type.resetCounter="Sayacı sıfırla"
|
AdvSceneSwitcher.action.macro.type.resetCounter="Sayacı sıfırla"
|
||||||
AdvSceneSwitcher.action.macro.type.run="Çalıştır"
|
AdvSceneSwitcher.action.macro.type.run="Çalıştır"
|
||||||
AdvSceneSwitcher.action.macro.entry="{{actions}} {{macros}}"
|
AdvSceneSwitcher.action.macro.entry="{{actions}}{{actionIndex}}{{macros}}"
|
||||||
AdvSceneSwitcher.action.pluginState="Eklenti durumu"
|
AdvSceneSwitcher.action.pluginState="Eklenti durumu"
|
||||||
AdvSceneSwitcher.action.pluginState.type.stop="Advanced Scene Switcher eklentisini durdurun"
|
AdvSceneSwitcher.action.pluginState.type.stop="Advanced Scene Switcher eklentisini durdurun"
|
||||||
AdvSceneSwitcher.action.pluginState.type.noMatch="Eşleşmeme davranışını değiştirin:"
|
AdvSceneSwitcher.action.pluginState.type.noMatch="Eşleşmeme davranışını değiştirin:"
|
||||||
@@ -350,7 +340,6 @@ AdvSceneSwitcher.action.hotkey.leftMeta="Sol Meta"
|
|||||||
AdvSceneSwitcher.action.hotkey.rightMeta="Sağ Meta"
|
AdvSceneSwitcher.action.hotkey.rightMeta="Sağ Meta"
|
||||||
AdvSceneSwitcher.action.hotkey.onlyOBS="Tuşa basımı yalnızca OBS'ye gönder"
|
AdvSceneSwitcher.action.hotkey.onlyOBS="Tuşa basımı yalnızca OBS'ye gönder"
|
||||||
AdvSceneSwitcher.action.hotkey.disabled="Tuşa basma simülasyonu yapılamıyor - işlevsellik devre dışı!"
|
AdvSceneSwitcher.action.hotkey.disabled="Tuşa basma simülasyonu yapılamıyor - işlevsellik devre dışı!"
|
||||||
AdvSceneSwitcher.action.hotkey.entry="Bas {{keys}} uygun {{duration}}"
|
|
||||||
AdvSceneSwitcher.action.sceneOrder="Sahne öğesi sırası"
|
AdvSceneSwitcher.action.sceneOrder="Sahne öğesi sırası"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveUp="Yukarı taşı"
|
AdvSceneSwitcher.action.sceneOrder.type.moveUp="Yukarı taşı"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveDown="Aşağı indir"
|
AdvSceneSwitcher.action.sceneOrder.type.moveDown="Aşağı indir"
|
||||||
@@ -360,7 +349,7 @@ AdvSceneSwitcher.action.sceneOrder.type.movePosition="Konuma taşı"
|
|||||||
AdvSceneSwitcher.action.sceneOrder.entry="Açık{{scenes}}{{actions}}{{sources}}{{position}}"
|
AdvSceneSwitcher.action.sceneOrder.entry="Açık{{scenes}}{{actions}}{{sources}}{{position}}"
|
||||||
AdvSceneSwitcher.action.sceneTransform="Sahne öğesi dönüşümü"
|
AdvSceneSwitcher.action.sceneTransform="Sahne öğesi dönüşümü"
|
||||||
AdvSceneSwitcher.action.sceneTransform.getTransform="Dönüşümü al"
|
AdvSceneSwitcher.action.sceneTransform.getTransform="Dönüşümü al"
|
||||||
AdvSceneSwitcher.action.sceneTransform.entry="Açık{{scenes}}transform{{sources}}"
|
AdvSceneSwitcher.action.sceneTransform.entry="Açık{{scenes}}{{action}}{{rotation}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.file="Dosya"
|
AdvSceneSwitcher.action.file="Dosya"
|
||||||
AdvSceneSwitcher.action.file.type.write="Yaz"
|
AdvSceneSwitcher.action.file.type.write="Yaz"
|
||||||
AdvSceneSwitcher.action.file.type.append="Ekle"
|
AdvSceneSwitcher.action.file.type.append="Ekle"
|
||||||
@@ -442,7 +431,7 @@ AdvSceneSwitcher.mediaTab.states.none="Yok"
|
|||||||
AdvSceneSwitcher.mediaTab.states.playing="Oynamak"
|
AdvSceneSwitcher.mediaTab.states.playing="Oynamak"
|
||||||
AdvSceneSwitcher.mediaTab.states.opening="Açmak"
|
AdvSceneSwitcher.mediaTab.states.opening="Açmak"
|
||||||
AdvSceneSwitcher.mediaTab.states.buffering="Arabelleğe alma"
|
AdvSceneSwitcher.mediaTab.states.buffering="Arabelleğe alma"
|
||||||
AdvSceneSwitcher.mediaTab.states.Paused="Duraklatıldı"
|
AdvSceneSwitcher.mediaTab.states.paused="Duraklatıldı"
|
||||||
AdvSceneSwitcher.mediaTab.states.stopped="Durduruldu"
|
AdvSceneSwitcher.mediaTab.states.stopped="Durduruldu"
|
||||||
AdvSceneSwitcher.mediaTab.states.ended="Bitti"
|
AdvSceneSwitcher.mediaTab.states.ended="Bitti"
|
||||||
AdvSceneSwitcher.mediaTab.states.error="Hata"
|
AdvSceneSwitcher.mediaTab.states.error="Hata"
|
||||||
|
|||||||
@@ -178,9 +178,6 @@ AdvSceneSwitcher.condition.file.type.contentChange="内容已更改"
|
|||||||
AdvSceneSwitcher.condition.file.type.dateChange="修改日期已更改"
|
AdvSceneSwitcher.condition.file.type.dateChange="修改日期已更改"
|
||||||
AdvSceneSwitcher.condition.file.remote="远程文件"
|
AdvSceneSwitcher.condition.file.remote="远程文件"
|
||||||
AdvSceneSwitcher.condition.file.local="本地文件"
|
AdvSceneSwitcher.condition.file.local="本地文件"
|
||||||
AdvSceneSwitcher.condition.file.entry.line1="{{fileType}}{{filePath}}{{conditions}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line2="{{matchText}}"
|
|
||||||
AdvSceneSwitcher.condition.file.entry.line3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
|
||||||
AdvSceneSwitcher.condition.media="媒体"
|
AdvSceneSwitcher.condition.media="媒体"
|
||||||
AdvSceneSwitcher.condition.media.source="源"
|
AdvSceneSwitcher.condition.media.source="源"
|
||||||
AdvSceneSwitcher.condition.media.anyOnScene="任何媒体源"
|
AdvSceneSwitcher.condition.media.anyOnScene="任何媒体源"
|
||||||
@@ -267,9 +264,8 @@ AdvSceneSwitcher.condition.record="录制"
|
|||||||
AdvSceneSwitcher.condition.record.state.start="录制运行中"
|
AdvSceneSwitcher.condition.record.state.start="录制运行中"
|
||||||
AdvSceneSwitcher.condition.record.state.pause="录制暂停"
|
AdvSceneSwitcher.condition.record.state.pause="录制暂停"
|
||||||
AdvSceneSwitcher.condition.record.state.stop="录制停止"
|
AdvSceneSwitcher.condition.record.state.stop="录制停止"
|
||||||
AdvSceneSwitcher.condition.record.entry="{{recordState}}"
|
|
||||||
AdvSceneSwitcher.condition.process="进程"
|
AdvSceneSwitcher.condition.process="进程"
|
||||||
AdvSceneSwitcher.condition.process.entry="{{processes}} 是正在运行 {{focused}} 并且是获得焦点"
|
AdvSceneSwitcher.condition.process.entry="{{processes}}{{regex}}是正在运行{{focused}}并且是获得焦点"
|
||||||
AdvSceneSwitcher.condition.process.entry.focus="当前焦点进程: {{focusProcess}}"
|
AdvSceneSwitcher.condition.process.entry.focus="当前焦点进程: {{focusProcess}}"
|
||||||
AdvSceneSwitcher.condition.idle="闲置检测"
|
AdvSceneSwitcher.condition.idle="闲置检测"
|
||||||
AdvSceneSwitcher.condition.idle.entry="没有键盘或鼠标输入{{duration}}"
|
AdvSceneSwitcher.condition.idle.entry="没有键盘或鼠标输入{{duration}}"
|
||||||
@@ -371,7 +367,8 @@ AdvSceneSwitcher.condition.date.entry.nextMatchDate="下一次匹配 在: %1"
|
|||||||
AdvSceneSwitcher.condition.date.entry.updateOnRepeat="{{updateOnRepeat}} 重复时,将选定的日期更新为重复日期"
|
AdvSceneSwitcher.condition.date.entry.updateOnRepeat="{{updateOnRepeat}} 重复时,将选定的日期更新为重复日期"
|
||||||
AdvSceneSwitcher.condition.sceneTransform="场景项目被改变"
|
AdvSceneSwitcher.condition.sceneTransform="场景项目被改变"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.getTransform="内容或者设置被改变了"
|
AdvSceneSwitcher.condition.sceneTransform.getTransform="内容或者设置被改变了"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line1="在 {{scenes}} {{sources}} 匹配变换"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line1="在 {{scenes}} {{sources}} {{types}}"
|
||||||
|
AdvSceneSwitcher.condition.sceneTransform.entry.type.matches="匹配变换"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
||||||
AdvSceneSwitcher.condition.transition="转场"
|
AdvSceneSwitcher.condition.transition="转场"
|
||||||
@@ -435,7 +432,6 @@ AdvSceneSwitcher.condition.variable.type.valueChanged="值已更改"
|
|||||||
AdvSceneSwitcher.condition.variable.type.equalsVariable="等于变量"
|
AdvSceneSwitcher.condition.variable.type.equalsVariable="等于变量"
|
||||||
AdvSceneSwitcher.condition.variable.type.lessThanVariable="小于变量"
|
AdvSceneSwitcher.condition.variable.type.lessThanVariable="小于变量"
|
||||||
AdvSceneSwitcher.condition.variable.type.greaterThanVariable="大于变量"
|
AdvSceneSwitcher.condition.variable.type.greaterThanVariable="大于变量"
|
||||||
AdvSceneSwitcher.condition.variable.entry="{{variables}}{{conditions}}{{strValue}}{{numValue}}{{variables2}}"
|
|
||||||
AdvSceneSwitcher.condition.run="运行"
|
AdvSceneSwitcher.condition.run="运行"
|
||||||
AdvSceneSwitcher.condition.run.entry="进程在超时 {{timeout}} 秒之前退出"
|
AdvSceneSwitcher.condition.run.entry="进程在超时 {{timeout}} 秒之前退出"
|
||||||
AdvSceneSwitcher.condition.run.entry.exit="{{checkExitCode}}检查退出代码{{exitCode}}"
|
AdvSceneSwitcher.condition.run.entry.exit="{{checkExitCode}}检查退出代码{{exitCode}}"
|
||||||
@@ -448,9 +444,9 @@ AdvSceneSwitcher.condition.display.type.displayCount="连接的显示器的数
|
|||||||
AdvSceneSwitcher.condition.display.entry="{{conditions}}{{displays}}{{regex}}{{displayCount}}"
|
AdvSceneSwitcher.condition.display.entry="{{conditions}}{{displays}}{{regex}}{{displayCount}}"
|
||||||
|
|
||||||
; Macro Actions
|
; Macro Actions
|
||||||
AdvSceneSwitcher.action.switchScene="切换场景"
|
AdvSceneSwitcher.action.scene="切换场景"
|
||||||
AdvSceneSwitcher.action.scene.entry="切换场景 {{scenes}} 使用 {{transitions}} 时长 {{duration}} 秒"
|
AdvSceneSwitcher.action.scene.entry="切换场景{{sceneTypes}}{{scenes}}使用{{transitions}}时长{{duration}}秒"
|
||||||
AdvSceneSwitcher.action.scene.entry.noDuration="切换到场景{{scenes}}使用{{transitions}}"
|
AdvSceneSwitcher.action.scene.entry.noDuration="切换到场景{{sceneTypes}}{{scenes}}使用{{transitions}}"
|
||||||
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="等待目标场景的过渡完成"
|
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="等待目标场景的过渡完成"
|
||||||
AdvSceneSwitcher.action.wait="等待"
|
AdvSceneSwitcher.action.wait="等待"
|
||||||
AdvSceneSwitcher.action.wait.type.fixed="固定数值"
|
AdvSceneSwitcher.action.wait.type.fixed="固定数值"
|
||||||
@@ -494,7 +490,7 @@ AdvSceneSwitcher.action.streaming="推流"
|
|||||||
AdvSceneSwitcher.action.streaming.type.stop="停止推流"
|
AdvSceneSwitcher.action.streaming.type.stop="停止推流"
|
||||||
AdvSceneSwitcher.action.streaming.type.start="开始推流"
|
AdvSceneSwitcher.action.streaming.type.start="开始推流"
|
||||||
AdvSceneSwitcher.action.streaming.type.keyFrameInterval="设置关键帧间隔"
|
AdvSceneSwitcher.action.streaming.type.keyFrameInterval="设置关键帧间隔"
|
||||||
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}"
|
AdvSceneSwitcher.action.streaming.entry="{{actions}}{{keyFrameInterval}}{{stringValue}}{{showPassword}}"
|
||||||
AdvSceneSwitcher.action.run="运行"
|
AdvSceneSwitcher.action.run="运行"
|
||||||
AdvSceneSwitcher.action.sceneVisibility="场景项目可见性"
|
AdvSceneSwitcher.action.sceneVisibility="场景项目可见性"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.show="显示"
|
AdvSceneSwitcher.action.sceneVisibility.type.show="显示"
|
||||||
@@ -502,7 +498,7 @@ AdvSceneSwitcher.action.sceneVisibility.type.hide="隐藏"
|
|||||||
AdvSceneSwitcher.action.sceneVisibility.type.toggle="切换"
|
AdvSceneSwitcher.action.sceneVisibility.type.toggle="切换"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.source="来源"
|
AdvSceneSwitcher.action.sceneVisibility.type.source="来源"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="全部"
|
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="全部"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.entry="置{{scenes}}{{actions}}{{sourceTypes}}{{sources}}{{sourceGroups}}"
|
AdvSceneSwitcher.action.sceneVisibility.entry="置{{scenes}}{{actions}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.filter="滤镜"
|
AdvSceneSwitcher.action.filter="滤镜"
|
||||||
AdvSceneSwitcher.action.filter.type.enable="开启"
|
AdvSceneSwitcher.action.filter.type.enable="开启"
|
||||||
AdvSceneSwitcher.action.filter.type.disable="关闭"
|
AdvSceneSwitcher.action.filter.type.disable="关闭"
|
||||||
@@ -517,7 +513,7 @@ AdvSceneSwitcher.action.source.type.refreshSettings="刷新源设置"
|
|||||||
AdvSceneSwitcher.action.source.type.pressSettingsButton="按下设置按钮"
|
AdvSceneSwitcher.action.source.type.pressSettingsButton="按下设置按钮"
|
||||||
AdvSceneSwitcher.action.source.type.refreshSettings.tooltip="可用于刷新浏览器、媒体、源、etc"
|
AdvSceneSwitcher.action.source.type.refreshSettings.tooltip="可用于刷新浏览器、媒体、源、etc"
|
||||||
AdvSceneSwitcher.action.source.noSettingsButtons="未找到按钮!"
|
AdvSceneSwitcher.action.source.noSettingsButtons="未找到按钮!"
|
||||||
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}"
|
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
|
||||||
AdvSceneSwitcher.action.source.warning="警告:OBS UI无法控制全局启用和禁用源,注意,通过这个设置禁用,我测试,你必须通过这个在启用才行,不然点击小眼睛你无法显示!"
|
AdvSceneSwitcher.action.source.warning="警告:OBS UI无法控制全局启用和禁用源,注意,通过这个设置禁用,我测试,你必须通过这个在启用才行,不然点击小眼睛你无法显示!"
|
||||||
AdvSceneSwitcher.action.source.getSettings="获取当前设置"
|
AdvSceneSwitcher.action.source.getSettings="获取当前设置"
|
||||||
AdvSceneSwitcher.action.media="媒体"
|
AdvSceneSwitcher.action.media="媒体"
|
||||||
@@ -527,15 +523,14 @@ AdvSceneSwitcher.action.media.type.stop="停止"
|
|||||||
AdvSceneSwitcher.action.media.type.restart="重新启动"
|
AdvSceneSwitcher.action.media.type.restart="重新启动"
|
||||||
AdvSceneSwitcher.action.media.type.next="下一个"
|
AdvSceneSwitcher.action.media.type.next="下一个"
|
||||||
AdvSceneSwitcher.action.media.type.previous="上一个"
|
AdvSceneSwitcher.action.media.type.previous="上一个"
|
||||||
AdvSceneSwitcher.action.media.type.seek="时间轴定位"
|
AdvSceneSwitcher.action.media.type.seek.duration="时间轴定位"
|
||||||
AdvSceneSwitcher.action.media.entry="{{actions}}{{duration}}{{mediaSources}}"
|
|
||||||
AdvSceneSwitcher.action.macro="宏"
|
AdvSceneSwitcher.action.macro="宏"
|
||||||
AdvSceneSwitcher.action.macro.type.pause="暂停"
|
AdvSceneSwitcher.action.macro.type.pause="暂停"
|
||||||
AdvSceneSwitcher.action.macro.type.unpause="取消暂停"
|
AdvSceneSwitcher.action.macro.type.unpause="取消暂停"
|
||||||
AdvSceneSwitcher.action.macro.type.resetCounter="复位计数器"
|
AdvSceneSwitcher.action.macro.type.resetCounter="复位计数器"
|
||||||
AdvSceneSwitcher.action.macro.type.run="运行操作"
|
AdvSceneSwitcher.action.macro.type.run="运行操作"
|
||||||
AdvSceneSwitcher.action.macro.type.stop="停止操作"
|
AdvSceneSwitcher.action.macro.type.stop="停止操作"
|
||||||
AdvSceneSwitcher.action.macro.entry="{{actions}} {{macros}}"
|
AdvSceneSwitcher.action.macro.entry="{{actions}}{{actionIndex}}{{macros}}"
|
||||||
AdvSceneSwitcher.action.pluginState="插件状态"
|
AdvSceneSwitcher.action.pluginState="插件状态"
|
||||||
AdvSceneSwitcher.action.pluginState.type.stop="停止高级场景切换插件"
|
AdvSceneSwitcher.action.pluginState.type.stop="停止高级场景切换插件"
|
||||||
AdvSceneSwitcher.action.pluginState.type.noMatch="没有匹配项时:"
|
AdvSceneSwitcher.action.pluginState.type.noMatch="没有匹配项时:"
|
||||||
@@ -559,7 +554,6 @@ AdvSceneSwitcher.action.hotkey.leftMeta="左 Meta"
|
|||||||
AdvSceneSwitcher.action.hotkey.rightMeta="右 Meta"
|
AdvSceneSwitcher.action.hotkey.rightMeta="右 Meta"
|
||||||
AdvSceneSwitcher.action.hotkey.onlyOBS="仅向OBS发送按键"
|
AdvSceneSwitcher.action.hotkey.onlyOBS="仅向OBS发送按键"
|
||||||
AdvSceneSwitcher.action.hotkey.disabled="无法模拟按键-功能已禁用!"
|
AdvSceneSwitcher.action.hotkey.disabled="无法模拟按键-功能已禁用!"
|
||||||
AdvSceneSwitcher.action.hotkey.entry="按下 {{keys}} 在 {{duration}} 秒"
|
|
||||||
AdvSceneSwitcher.action.sceneOrder="场景项目顺序"
|
AdvSceneSwitcher.action.sceneOrder="场景项目顺序"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveUp="上移"
|
AdvSceneSwitcher.action.sceneOrder.type.moveUp="上移"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveDown="下移"
|
AdvSceneSwitcher.action.sceneOrder.type.moveDown="下移"
|
||||||
@@ -569,7 +563,7 @@ AdvSceneSwitcher.action.sceneOrder.type.movePosition="移动到数值位置"
|
|||||||
AdvSceneSwitcher.action.sceneOrder.entry="在 {{scenes}} {{actions}} {{sources}} {{position}}"
|
AdvSceneSwitcher.action.sceneOrder.entry="在 {{scenes}} {{actions}} {{sources}} {{position}}"
|
||||||
AdvSceneSwitcher.action.sceneTransform="场景项目转换"
|
AdvSceneSwitcher.action.sceneTransform="场景项目转换"
|
||||||
AdvSceneSwitcher.action.sceneTransform.getTransform="获得转换"
|
AdvSceneSwitcher.action.sceneTransform.getTransform="获得转换"
|
||||||
AdvSceneSwitcher.action.sceneTransform.entry="在 {{scenes}} 上转换 {{sources}}"
|
AdvSceneSwitcher.action.sceneTransform.entry="在 {{scenes}}{{action}}{{rotation}}{{sources}}"
|
||||||
AdvSceneSwitcher.action.file="文件"
|
AdvSceneSwitcher.action.file="文件"
|
||||||
AdvSceneSwitcher.action.file.type.write="写入"
|
AdvSceneSwitcher.action.file.type.write="写入"
|
||||||
AdvSceneSwitcher.action.file.type.append="追加写入"
|
AdvSceneSwitcher.action.file.type.append="追加写入"
|
||||||
@@ -624,8 +618,6 @@ AdvSceneSwitcher.action.sequence.continueFrom="继续所选项目"
|
|||||||
AdvSceneSwitcher.action.websocket="websocket"
|
AdvSceneSwitcher.action.websocket="websocket"
|
||||||
AdvSceneSwitcher.action.websocket.type.request="request"
|
AdvSceneSwitcher.action.websocket.type.request="request"
|
||||||
AdvSceneSwitcher.action.websocket.type.event="event"
|
AdvSceneSwitcher.action.websocket.type.event="event"
|
||||||
AdvSceneSwitcher.action.websocket.entry.request="通过{{connection}} 发送场景切换器 {{type}}"
|
|
||||||
AdvSceneSwitcher.action.websocket.entry.event="发送场景切换器 {{type}} 到连接的客户端"
|
|
||||||
AdvSceneSwitcher.action.http="Http"
|
AdvSceneSwitcher.action.http="Http"
|
||||||
AdvSceneSwitcher.action.http.setHeaders="设置头信息(SET headers)"
|
AdvSceneSwitcher.action.http.setHeaders="设置头信息(SET headers)"
|
||||||
AdvSceneSwitcher.action.http.headers="头信息(headers):"
|
AdvSceneSwitcher.action.http.headers="头信息(headers):"
|
||||||
@@ -655,7 +647,7 @@ AdvSceneSwitcher.action.variable.invalidSelection="无效选择!"
|
|||||||
AdvSceneSwitcher.action.variable.actionNoVariableSupport="不支持从 %1 个操作获取变量值!"
|
AdvSceneSwitcher.action.variable.actionNoVariableSupport="不支持从 %1 个操作获取变量值!"
|
||||||
AdvSceneSwitcher.action.variable.conditionNoVariableSupport="不支持从 %1 条件中获取变量值!"
|
AdvSceneSwitcher.action.variable.conditionNoVariableSupport="不支持从 %1 条件中获取变量值!"
|
||||||
AdvSceneSwitcher.action.variable.currentSegmentValue="当前值:"
|
AdvSceneSwitcher.action.variable.currentSegmentValue="当前值:"
|
||||||
AdvSceneSwitcher.action.variable.entry="{{actions}}{{variables}}{{variables2}}{{strValue}}{{numValue}}{{segmentIndex}}{{mathExpression}}"
|
AdvSceneSwitcher.action.variable.entry="{{actions}}{{variables}}{{variables2}}{{strValue}}{{numValue}}{{segmentIndex}}{{mathExpression}}{{envVariableName}}{{scenes}}{{tempVars}}"
|
||||||
AdvSceneSwitcher.action.variable.entry.substringIndex="子字符串开始:{{subStringStart}} 子字符串大小:{{subStringSize}}"
|
AdvSceneSwitcher.action.variable.entry.substringIndex="子字符串开始:{{subStringStart}} 子字符串大小:{{subStringSize}}"
|
||||||
AdvSceneSwitcher.action.variable.entry.substringRegex="使用正则表达式为 {{regexMatchIdx}} 匹配的值:"
|
AdvSceneSwitcher.action.variable.entry.substringRegex="使用正则表达式为 {{regexMatchIdx}} 匹配的值:"
|
||||||
AdvSceneSwitcher.action.variable.entry.findAndReplace="{{findStr}}{{replaceStr}}"
|
AdvSceneSwitcher.action.variable.entry.findAndReplace="{{findStr}}{{replaceStr}}"
|
||||||
@@ -732,7 +724,7 @@ AdvSceneSwitcher.mediaTab.states.none="无"
|
|||||||
AdvSceneSwitcher.mediaTab.states.playing="播放中"
|
AdvSceneSwitcher.mediaTab.states.playing="播放中"
|
||||||
AdvSceneSwitcher.mediaTab.states.opening="打开中"
|
AdvSceneSwitcher.mediaTab.states.opening="打开中"
|
||||||
AdvSceneSwitcher.mediaTab.states.buffering="缓冲中"
|
AdvSceneSwitcher.mediaTab.states.buffering="缓冲中"
|
||||||
AdvSceneSwitcher.mediaTab.states.Paused="暂停"
|
AdvSceneSwitcher.mediaTab.states.paused="暂停"
|
||||||
AdvSceneSwitcher.mediaTab.states.stopped="停止"
|
AdvSceneSwitcher.mediaTab.states.stopped="停止"
|
||||||
AdvSceneSwitcher.mediaTab.states.ended="结束"
|
AdvSceneSwitcher.mediaTab.states.ended="结束"
|
||||||
AdvSceneSwitcher.mediaTab.states.error="错误"
|
AdvSceneSwitcher.mediaTab.states.error="错误"
|
||||||
|
|||||||
9
data/res/images/DarkDoubleDown.svg
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<g class="layer">
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<path d="m1,2c0,-0.27 0.11,-0.52 0.29,-0.71c0.39,-0.39 1.03,-0.39 1.42,0l5.29,5.3l5.29,-5.3c0.39,-0.39 1.03,-0.39 1.42,0c0.18,0.19 0.29,0.44 0.29,0.71s-0.11,0.52 -0.29,0.71l-6,6c-0.39,0.39 -1.03,0.39 -1.42,0l-6,-6c-0.18,-0.19 -0.29,-0.44 -0.29,-0.71zm0,0" fill="#fefefe" id="svg_1" transform="matrix(1, 0, 0, 1, 0, 0)"/>
|
||||||
|
<path d="m1,8c0,-0.27 0.09,-0.52 0.28,-0.71c0.38,-0.39 1.03,-0.39 1.41,0l5.31,5.3l5.28,-5.3c0.38,-0.39 1.03,-0.39 1.41,0c0.19,0.19 0.31,0.44 0.31,0.71s-0.13,0.52 -0.31,0.71l-6,6c-0.38,0.39 -1.03,0.39 -1.41,0l-6,-6c-0.19,-0.19 -0.28,-0.44 -0.28,-0.71zm0,0" fill="#fefefe" id="svg_2"/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 791 B |
9
data/res/images/DarkDoubleUp.svg
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
|
||||||
|
<g class="layer">
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<path d="m1,8c0,-0.27 0.11,-0.52 0.29,-0.71l6,-6c0.39,-0.39 1.03,-0.39 1.42,0l6,6c0.18,0.19 0.29,0.44 0.29,0.71s-0.11,0.52 -0.29,0.71c-0.39,0.39 -1.03,0.39 -1.42,0l-5.29,-5.3l-5.29,5.3c-0.39,0.39 -1.03,0.39 -1.42,0c-0.18,-0.19 -0.29,-0.44 -0.29,-0.71zm0,0" fill="#fefefe" id="svg_1"/>
|
||||||
|
<path d="m1,14c0,-0.27 0.11,-0.52 0.28,-0.71l6,-6c0.39,-0.39 1.03,-0.39 1.42,0l6,6c0.19,0.19 0.3,0.44 0.3,0.71s-0.11,0.52 -0.3,0.71c-0.39,0.39 -1.03,0.39 -1.42,0l-5.28,-5.3l-5.3,5.3c-0.39,0.39 -1.03,0.39 -1.42,0c-0.17,-0.19 -0.28,-0.44 -0.28,-0.71zm0,0" fill="#fefefe" id="svg_2"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 753 B |
11
data/res/images/DarkNotEqual.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" version="1.1">
|
||||||
|
<!-- Created with SVG-edit - https://github.com/SVG-Edit/svgedit-->
|
||||||
|
|
||||||
|
<g class="layer">
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<rect fill="#fefefe" height="2.25" id="svg_1" stroke="#fefefe" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="4"/>
|
||||||
|
<rect fill="#fefefe" height="2.25" id="svg_2" stroke="#fefefe" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="10"/>
|
||||||
|
<rect fill="#fefefe" height="1" id="svg_4" stroke="#fefefe" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(0.341951, -0.926734, 0.939718, 0.337226, -1.948, 13.2448)" width="14" x="1" y="7"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 931 B |
8
data/res/images/DarkSearch.svg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="256" height="256" viewBox="0 0 256 256" xml:space="preserve">
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
</defs>
|
||||||
|
<g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" transform="translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)" >
|
||||||
|
<path d="M 87.803 77.194 L 68.212 57.602 c 9.5 -14.422 7.912 -34.054 -4.766 -46.732 c 0 0 -0.001 0 -0.001 0 c -14.495 -14.493 -38.08 -14.494 -52.574 0 c -14.494 14.495 -14.494 38.079 0 52.575 c 7.248 7.247 16.767 10.87 26.287 10.87 c 7.134 0 14.267 -2.035 20.445 -6.104 l 19.591 19.591 C 78.659 89.267 80.579 90 82.498 90 s 3.84 -0.733 5.305 -2.197 C 90.732 84.873 90.732 80.124 87.803 77.194 z M 21.48 52.837 c -8.645 -8.646 -8.645 -22.713 0 -31.358 c 4.323 -4.322 10 -6.483 15.679 -6.483 c 5.678 0 11.356 2.161 15.678 6.483 c 8.644 8.644 8.645 22.707 0.005 31.352 c -0.002 0.002 -0.004 0.003 -0.005 0.005 c -0.002 0.002 -0.003 0.003 -0.004 0.005 C 44.184 61.481 30.123 61.48 21.48 52.837 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: #fefefe; fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
9
data/res/images/LightDoubleDown.svg
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<g class="layer">
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<path d="m1,2c0,-0.27 0.11,-0.52 0.29,-0.71c0.39,-0.39 1.03,-0.39 1.42,0l5.29,5.3l5.29,-5.3c0.39,-0.39 1.03,-0.39 1.42,0c0.18,0.19 0.29,0.44 0.29,0.71s-0.11,0.52 -0.29,0.71l-6,6c-0.39,0.39 -1.03,0.39 -1.42,0l-6,-6c-0.18,-0.19 -0.29,-0.44 -0.29,-0.71zm0,0" fill="#202020" id="svg_1"/>
|
||||||
|
<path d="m1,8c0,-0.27 0.11,-0.52 0.29,-0.71c0.39,-0.39 1.03,-0.39 1.42,0l5.29,5.3l5.29,-5.3c0.39,-0.39 1.03,-0.39 1.42,0c0.18,0.19 0.29,0.44 0.29,0.71s-0.11,0.52 -0.29,0.71l-6,6c-0.39,0.39 -1.03,0.39 -1.42,0l-6,-6c-0.18,-0.19 -0.29,-0.44 -0.29,-0.71zm0,0" fill="#202020" id="svg_4" transform="matrix(1, 0, 0, 1, 0, 0)"/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 791 B |
9
data/res/images/LightDoubleUp.svg
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
|
||||||
|
<g class="layer">
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<path d="m1,8c0,-0.27 0.11,-0.52 0.29,-0.71l6,-6c0.39,-0.39 1.03,-0.39 1.42,0l6,6c0.18,0.19 0.29,0.44 0.29,0.71s-0.11,0.52 -0.29,0.71c-0.39,0.39 -1.03,0.39 -1.42,0l-5.29,-5.3l-5.29,5.3c-0.39,0.39 -1.03,0.39 -1.42,0c-0.18,-0.19 -0.29,-0.44 -0.29,-0.71zm0,0" fill="#202020" id="svg_1"/>
|
||||||
|
<path d="m1,14c0,-0.27 0.11,-0.52 0.29,-0.71l6,-6c0.39,-0.39 1.03,-0.39 1.42,0l6,6c0.18,0.19 0.29,0.44 0.29,0.71s-0.11,0.52 -0.29,0.71c-0.39,0.39 -1.03,0.39 -1.42,0l-5.29,-5.3l-5.29,5.3c-0.39,0.39 -1.03,0.39 -1.42,0c-0.18,-0.19 -0.29,-0.44 -0.29,-0.71zm0,0" fill="#202020" id="svg_2"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 757 B |
11
data/res/images/LightNotEqual.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" version="1.1">
|
||||||
|
<!-- Created with SVG-edit - https://github.com/SVG-Edit/svgedit-->
|
||||||
|
|
||||||
|
<g class="layer">
|
||||||
|
<title>Layer 1</title>
|
||||||
|
<rect fill="#202020" height="2.25" id="svg_1" stroke="#202020" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="4"/>
|
||||||
|
<rect fill="#202020" height="2.25" id="svg_2" stroke="#202020" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(1, 0, 0, 1, 0, 0)" width="13" x="1.5" y="10"/>
|
||||||
|
<rect fill="#202020" height="1" id="svg_4" stroke="#202020" stroke-dasharray="null" stroke-linecap="null" stroke-linejoin="null" transform="matrix(0.341951, -0.926734, 0.939718, 0.337226, -1.948, 13.2448)" width="14" x="1" y="7"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 931 B |
8
data/res/images/LightSearch.svg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="256" height="256" viewBox="0 0 256 256" xml:space="preserve">
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
</defs>
|
||||||
|
<g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" transform="translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)" >
|
||||||
|
<path d="M 87.803 77.194 L 68.212 57.602 c 9.5 -14.422 7.912 -34.054 -4.766 -46.732 c 0 0 -0.001 0 -0.001 0 c -14.495 -14.493 -38.08 -14.494 -52.574 0 c -14.494 14.495 -14.494 38.079 0 52.575 c 7.248 7.247 16.767 10.87 26.287 10.87 c 7.134 0 14.267 -2.035 20.445 -6.104 l 19.591 19.591 C 78.659 89.267 80.579 90 82.498 90 s 3.84 -0.733 5.305 -2.197 C 90.732 84.873 90.732 80.124 87.803 77.194 z M 21.48 52.837 c -8.645 -8.646 -8.645 -22.713 0 -31.358 c 4.323 -4.322 10 -6.483 15.679 -6.483 c 5.678 0 11.356 2.161 15.678 6.483 c 8.644 8.644 8.645 22.707 0.005 31.352 c -0.002 0.002 -0.004 0.003 -0.005 0.005 c -0.002 0.002 -0.003 0.003 -0.004 0.005 C 44.184 61.481 30.123 61.48 21.48 52.837 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: #202020; fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
2
deps/asio
vendored
1
deps/cpp-httplib
vendored
Submodule
1
deps/json
vendored
Submodule
2
deps/websocketpp
vendored
@@ -67,8 +67,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>957</width>
|
<width>962</width>
|
||||||
<height>905</height>
|
<height>1033</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||||
@@ -256,6 +256,30 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_26">
|
<layout class="QHBoxLayout" name="horizontalLayout_26">
|
||||||
<item>
|
<item>
|
||||||
@@ -805,7 +829,7 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>AdvSceneSwitcher.macroTab.edit</string>
|
<string>AdvSceneSwitcher.macroTab.edit</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
<layout class="QVBoxLayout" name="verticalLayout_38">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0,0,0,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0,0,0,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
@@ -819,7 +843,7 @@
|
|||||||
<widget class="QLineEdit" name="macroName"/>
|
<widget class="QLineEdit" name="macroName"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="runMacro">
|
<widget class="advss::MacroRunButton" name="runMacro">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>AdvSceneSwitcher.macroTab.run</string>
|
<string>AdvSceneSwitcher.macroTab.run</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -912,6 +936,16 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="advss::MacroSegmentList" name="conditionsList">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
@@ -988,6 +1022,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="conditionTop">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="conditionUp">
|
<widget class="QPushButton" name="conditionUp">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@@ -1023,6 +1070,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="conditionBottom">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_15">
|
<spacer name="horizontalSpacer_15">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -1040,144 +1100,376 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="macroActions" native="true">
|
<widget class="QSplitter" name="macroElseActionSplitter">
|
||||||
<layout class="QVBoxLayout" name="macroActionsLayout">
|
<property name="orientation">
|
||||||
<property name="leftMargin">
|
<enum>Qt::Vertical</enum>
|
||||||
<number>0</number>
|
</property>
|
||||||
</property>
|
<widget class="QWidget" name="macroActions" native="true">
|
||||||
<property name="topMargin">
|
<layout class="QVBoxLayout" name="macroActionsLayout">
|
||||||
<number>0</number>
|
<property name="leftMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="rightMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="topMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="bottomMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="rightMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<item>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
<property name="bottomMargin">
|
||||||
<property name="leftMargin">
|
<number>0</number>
|
||||||
<number>9</number>
|
</property>
|
||||||
</property>
|
<item>
|
||||||
<item>
|
<widget class="advss::MacroSegmentList" name="actionsList">
|
||||||
<widget class="QPushButton" name="actionAdd">
|
<property name="minimumSize">
|
||||||
<property name="maximumSize">
|
<size>
|
||||||
<size>
|
<width>0</width>
|
||||||
<width>22</width>
|
<height>1</height>
|
||||||
<height>16777215</height>
|
</size>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="flat">
|
</item>
|
||||||
<bool>true</bool>
|
<item>
|
||||||
</property>
|
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
||||||
<property name="themeID" stdset="0">
|
<property name="leftMargin">
|
||||||
<string notr="true">addIconSmall</string>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<widget class="QPushButton" name="actionAdd">
|
||||||
<item>
|
<property name="maximumSize">
|
||||||
<widget class="QPushButton" name="actionRemove">
|
<size>
|
||||||
<property name="maximumSize">
|
<width>22</width>
|
||||||
<size>
|
<height>16777215</height>
|
||||||
<width>22</width>
|
</size>
|
||||||
<height>16777215</height>
|
</property>
|
||||||
</size>
|
<property name="flat">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="flat">
|
</property>
|
||||||
<bool>true</bool>
|
<property name="themeID" stdset="0">
|
||||||
</property>
|
<string notr="true">addIconSmall</string>
|
||||||
<property name="themeID" stdset="0">
|
</property>
|
||||||
<string notr="true">removeIconSmall</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<widget class="QPushButton" name="actionRemove">
|
||||||
<item>
|
<property name="maximumSize">
|
||||||
<spacer name="horizontalSpacer_133">
|
<size>
|
||||||
<property name="orientation">
|
<width>22</width>
|
||||||
<enum>Qt::Horizontal</enum>
|
<height>16777215</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="sizeType">
|
</property>
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
<property name="flat">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="sizeHint" stdset="0">
|
</property>
|
||||||
<size>
|
<property name="themeID" stdset="0">
|
||||||
<width>5</width>
|
<string notr="true">removeIconSmall</string>
|
||||||
<height>20</height>
|
</property>
|
||||||
</size>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</spacer>
|
<item>
|
||||||
</item>
|
<spacer name="horizontalSpacer_133">
|
||||||
<item>
|
<property name="orientation">
|
||||||
<widget class="Line" name="line_47">
|
<enum>Qt::Horizontal</enum>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Vertical</enum>
|
<property name="sizeType">
|
||||||
</property>
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="sizeHint" stdset="0">
|
||||||
<item>
|
<size>
|
||||||
<spacer name="horizontalSpacer_132">
|
<width>5</width>
|
||||||
<property name="orientation">
|
<height>20</height>
|
||||||
<enum>Qt::Horizontal</enum>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
</spacer>
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="sizeHint" stdset="0">
|
<widget class="Line" name="line_47">
|
||||||
<size>
|
<property name="orientation">
|
||||||
<width>5</width>
|
<enum>Qt::Vertical</enum>
|
||||||
<height>20</height>
|
</property>
|
||||||
</size>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</spacer>
|
<item>
|
||||||
</item>
|
<spacer name="horizontalSpacer_132">
|
||||||
<item>
|
<property name="orientation">
|
||||||
<widget class="QPushButton" name="actionUp">
|
<enum>Qt::Horizontal</enum>
|
||||||
<property name="maximumSize">
|
</property>
|
||||||
<size>
|
<property name="sizeType">
|
||||||
<width>22</width>
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
<height>16777215</height>
|
</property>
|
||||||
</size>
|
<property name="sizeHint" stdset="0">
|
||||||
</property>
|
<size>
|
||||||
<property name="flat">
|
<width>5</width>
|
||||||
<bool>true</bool>
|
<height>20</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="themeID" stdset="0">
|
</property>
|
||||||
<string notr="true">upArrowIconSmall</string>
|
</spacer>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<widget class="QPushButton" name="actionTop">
|
||||||
<item>
|
<property name="maximumSize">
|
||||||
<widget class="QPushButton" name="actionDown">
|
<size>
|
||||||
<property name="maximumSize">
|
<width>22</width>
|
||||||
<size>
|
<height>16777215</height>
|
||||||
<width>22</width>
|
</size>
|
||||||
<height>16777215</height>
|
</property>
|
||||||
</size>
|
<property name="flat">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="flat">
|
</property>
|
||||||
<bool>true</bool>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="themeID" stdset="0">
|
<item>
|
||||||
<string notr="true">downArrowIconSmall</string>
|
<widget class="QPushButton" name="actionUp">
|
||||||
</property>
|
<property name="maximumSize">
|
||||||
</widget>
|
<size>
|
||||||
</item>
|
<width>22</width>
|
||||||
<item>
|
<height>16777215</height>
|
||||||
<spacer name="horizontalSpacer_14">
|
</size>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Horizontal</enum>
|
<property name="flat">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="sizeHint" stdset="0">
|
</property>
|
||||||
<size>
|
<property name="themeID" stdset="0">
|
||||||
<width>40</width>
|
<string notr="true">upArrowIconSmall</string>
|
||||||
<height>20</height>
|
</property>
|
||||||
</size>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</spacer>
|
<item>
|
||||||
</item>
|
<widget class="QPushButton" name="actionDown">
|
||||||
</layout>
|
<property name="maximumSize">
|
||||||
</item>
|
<size>
|
||||||
</layout>
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">downArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="actionBottom">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</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="QPushButton" name="toggleElseActions">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</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="horizontalLayout_33">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="elseActionAdd">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">addIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="elseActionRemove">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">removeIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_138">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>5</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_50">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_139">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>5</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="elseActionTop">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="elseActionUp">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">upArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="elseActionDown">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">downArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="elseActionBottom">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_22">
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -4567,6 +4859,17 @@
|
|||||||
<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>
|
||||||
|
<class>advss::MacroRunButton</class>
|
||||||
|
<extends>QPushButton</extends>
|
||||||
|
<header>macro-run-button.hpp</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@@ -1,13 +1,3 @@
|
|||||||
#include <QMainWindow>
|
|
||||||
#include <QAction>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QDirIterator>
|
|
||||||
#include <regex>
|
|
||||||
#include <filesystem>
|
|
||||||
|
|
||||||
#include <obs-module.h>
|
|
||||||
#include <obs-frontend-api.h>
|
|
||||||
|
|
||||||
#include "advanced-scene-switcher.hpp"
|
#include "advanced-scene-switcher.hpp"
|
||||||
#include "switcher-data.hpp"
|
#include "switcher-data.hpp"
|
||||||
#include "status-control.hpp"
|
#include "status-control.hpp"
|
||||||
@@ -17,6 +7,15 @@
|
|||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QDirIterator>
|
||||||
|
#include <regex>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <obs-module.h>
|
||||||
|
#include <obs-frontend-api.h>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
AdvSceneSwitcher *AdvSceneSwitcher::window = nullptr;
|
AdvSceneSwitcher *AdvSceneSwitcher::window = nullptr;
|
||||||
@@ -116,6 +115,23 @@ void AdvSceneSwitcher::LoadUI()
|
|||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AdvSceneSwitcher::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
auto eventType = event->type();
|
||||||
|
if (obj == ui->macroElseActions && eventType == QEvent::Resize) {
|
||||||
|
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
||||||
|
|
||||||
|
if (resizeEvent->size().height() == 0) {
|
||||||
|
SetElseActionsStateToHidden();
|
||||||
|
return QDialog::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetElseActionsStateToVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QDialog::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Saving and loading
|
* Saving and loading
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@@ -123,6 +139,10 @@ static void AskForBackup(obs_data_t *obj);
|
|||||||
|
|
||||||
static void SaveSceneSwitcher(obs_data_t *save_data, bool saving, void *)
|
static void SaveSceneSwitcher(obs_data_t *save_data, bool saving, void *)
|
||||||
{
|
{
|
||||||
|
if (!switcher) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (saving) {
|
if (saving) {
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
switcher->Prune();
|
switcher->Prune();
|
||||||
@@ -322,14 +342,15 @@ void SwitcherData::SetPreconditions()
|
|||||||
cursorPosChanged = cursorPos.first != switcher->lastCursorPos.first ||
|
cursorPosChanged = cursorPos.first != switcher->lastCursorPos.first ||
|
||||||
cursorPos.second != switcher->lastCursorPos.second;
|
cursorPos.second != switcher->lastCursorPos.second;
|
||||||
lastCursorPos = GetCursorPos();
|
lastCursorPos = GetCursorPos();
|
||||||
|
|
||||||
|
// Macro
|
||||||
|
InvalidateMacroTempVarValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitcherData::ResetForNextInterval()
|
void SwitcherData::ResetForNextInterval()
|
||||||
{
|
{
|
||||||
// Core reset functions
|
|
||||||
ClearWebsocketMessages();
|
|
||||||
// Plugin reset functions
|
// Plugin reset functions
|
||||||
for (const auto &func : resetForNextIntervalFuncs) {
|
for (const auto &func : resetIntervalSteps) {
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,6 +460,8 @@ void SwitcherData::Start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CloseAllInputDialogs();
|
||||||
|
|
||||||
void SwitcherData::Stop()
|
void SwitcherData::Stop()
|
||||||
{
|
{
|
||||||
if (th && th->isRunning()) {
|
if (th && th->isRunning()) {
|
||||||
@@ -447,10 +470,23 @@ void SwitcherData::Stop()
|
|||||||
abortMacroWait = true;
|
abortMacroWait = true;
|
||||||
macroWaitCv.notify_all();
|
macroWaitCv.notify_all();
|
||||||
macroTransitionCv.notify_all();
|
macroTransitionCv.notify_all();
|
||||||
th->wait();
|
|
||||||
delete th;
|
|
||||||
th = nullptr;
|
|
||||||
|
|
||||||
|
// Not waiting if a dialog was closed is a workaround to avoid
|
||||||
|
// deadlocks when a variable input dialog is opened while Stop()
|
||||||
|
// is called.
|
||||||
|
//
|
||||||
|
// The QEventLoop handling the dialog would not exit until Stop()
|
||||||
|
// would return, which itself would wait for the switcher thread
|
||||||
|
// to complete, which itself is blocked by the variable input
|
||||||
|
// dialog.
|
||||||
|
//
|
||||||
|
// Must be reworked in the future, as this will not go well when
|
||||||
|
// OBS is shutting down and a dialog is still opened.
|
||||||
|
if (!CloseAllInputDialogs()) {
|
||||||
|
th->wait();
|
||||||
|
delete th;
|
||||||
|
th = nullptr;
|
||||||
|
}
|
||||||
writeToStatusFile("Advanced Scene Switcher stopped");
|
writeToStatusFile("Advanced Scene Switcher stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,7 +635,7 @@ static void setStreamStopping()
|
|||||||
std::chrono::high_resolution_clock::now();
|
std::chrono::high_resolution_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleExit()
|
static void handleShutdown()
|
||||||
{
|
{
|
||||||
if (!switcher) {
|
if (!switcher) {
|
||||||
return;
|
return;
|
||||||
@@ -609,8 +645,14 @@ static void handleExit()
|
|||||||
switcher->Stop();
|
switcher->Stop();
|
||||||
switcher->CheckMacros();
|
switcher->CheckMacros();
|
||||||
switcher->RunMacros();
|
switcher->RunMacros();
|
||||||
|
|
||||||
|
// Unfortunately this will not work as OBS will now allow saving
|
||||||
|
// the scene collection data at this point, So any OBS specific
|
||||||
|
// changes done during shutdown will be lost
|
||||||
|
//
|
||||||
|
// TODO: Look for a way to possibly resolve this
|
||||||
|
obs_frontend_save();
|
||||||
}
|
}
|
||||||
FreeSceneSwitcher();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleSceneCollectionChanging()
|
static void handleSceneCollectionChanging()
|
||||||
@@ -634,8 +676,12 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case OBS_FRONTEND_EVENT_EXIT:
|
case OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN:
|
||||||
handleExit();
|
// Note: We are intentionally not listening for
|
||||||
|
// OBS_FRONTEND_EVENT_EXIT here as at that point all scene
|
||||||
|
// collection data will already have been cleared and thus all
|
||||||
|
// macros will have already been cleared
|
||||||
|
handleShutdown();
|
||||||
break;
|
break;
|
||||||
case OBS_FRONTEND_EVENT_SCENE_CHANGED:
|
case OBS_FRONTEND_EVENT_SCENE_CHANGED:
|
||||||
handleSceneChange();
|
handleSceneChange();
|
||||||
@@ -673,6 +719,9 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher)
|
|||||||
case OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING:
|
case OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING:
|
||||||
handleSceneCollectionChanging();
|
handleSceneCollectionChanging();
|
||||||
break;
|
break;
|
||||||
|
case OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP:
|
||||||
|
SaveSceneSwitcher(nullptr, false, nullptr);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -723,6 +772,9 @@ void OpenSettingsWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupConnectionManager();
|
||||||
|
void SetupWebsocketHelpers();
|
||||||
|
|
||||||
extern "C" void InitSceneSwitcher(obs_module_t *module, translateFunc translate)
|
extern "C" void InitSceneSwitcher(obs_module_t *module, translateFunc translate)
|
||||||
{
|
{
|
||||||
blog(LOG_INFO, "version: %s", g_GIT_TAG);
|
blog(LOG_INFO, "version: %s", g_GIT_TAG);
|
||||||
@@ -733,6 +785,8 @@ extern "C" void InitSceneSwitcher(obs_module_t *module, translateFunc translate)
|
|||||||
PlatformInit();
|
PlatformInit();
|
||||||
LoadPlugins();
|
LoadPlugins();
|
||||||
SetupDock();
|
SetupDock();
|
||||||
|
SetupConnectionManager();
|
||||||
|
SetupWebsocketHelpers();
|
||||||
|
|
||||||
obs_frontend_add_save_callback(SaveSceneSwitcher, nullptr);
|
obs_frontend_add_save_callback(SaveSceneSwitcher, nullptr);
|
||||||
obs_frontend_add_event_callback(OBSEvent, switcher);
|
obs_frontend_add_event_callback(OBSEvent, switcher);
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ public:
|
|||||||
void RestoreWindowGeo();
|
void RestoreWindowGeo();
|
||||||
void CheckFirstTimeSetup();
|
void CheckFirstTimeSetup();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
/* --- Begin of general tab section --- */
|
/* --- Begin of general tab section --- */
|
||||||
public:
|
public:
|
||||||
void SetupGeneralTab();
|
void SetupGeneralTab();
|
||||||
@@ -63,6 +66,7 @@ public slots:
|
|||||||
void on_saveWindowGeo_stateChanged(int state);
|
void on_saveWindowGeo_stateChanged(int state);
|
||||||
void on_showTrayNotifications_stateChanged(int state);
|
void on_showTrayNotifications_stateChanged(int state);
|
||||||
void on_uiHintsDisable_stateChanged(int state);
|
void on_uiHintsDisable_stateChanged(int state);
|
||||||
|
void on_disableComboBoxFilter_stateChanged(int state);
|
||||||
void on_warnPluginLoadFailure_stateChanged(int state);
|
void on_warnPluginLoadFailure_stateChanged(int state);
|
||||||
void on_hideLegacyTabs_stateChanged(int state);
|
void on_hideLegacyTabs_stateChanged(int state);
|
||||||
void on_priorityUp_clicked();
|
void on_priorityUp_clicked();
|
||||||
@@ -83,10 +87,13 @@ public:
|
|||||||
void SetEditMacro(Macro &m);
|
void SetEditMacro(Macro &m);
|
||||||
void SetMacroEditAreaDisabled(bool);
|
void SetMacroEditAreaDisabled(bool);
|
||||||
void HighlightAction(int idx, QColor color = QColor(Qt::green));
|
void HighlightAction(int idx, QColor color = QColor(Qt::green));
|
||||||
|
void HighlightElseAction(int idx, QColor color = QColor(Qt::green));
|
||||||
void HighlightCondition(int idx, QColor color = QColor(Qt::green));
|
void HighlightCondition(int idx, QColor color = QColor(Qt::green));
|
||||||
void PopulateMacroActions(Macro &m, uint32_t afterIdx = 0);
|
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 PopulateMacroConditions(Macro &m, uint32_t afterIdx = 0);
|
||||||
void SetActionData(Macro &m);
|
void SetActionData(Macro &m);
|
||||||
|
void SetElseActionData(Macro &m);
|
||||||
void SetConditionData(Macro &m);
|
void SetConditionData(Macro &m);
|
||||||
void SwapActions(Macro *m, int pos1, int pos2);
|
void SwapActions(Macro *m, int pos1, int pos2);
|
||||||
void SwapConditions(Macro *m, int pos1, int pos2);
|
void SwapConditions(Macro *m, int pos1, int pos2);
|
||||||
@@ -97,39 +104,67 @@ public slots:
|
|||||||
void on_macroUp_clicked();
|
void on_macroUp_clicked();
|
||||||
void on_macroDown_clicked();
|
void on_macroDown_clicked();
|
||||||
void on_macroName_editingFinished();
|
void on_macroName_editingFinished();
|
||||||
void on_runMacro_clicked();
|
|
||||||
void on_runMacroInParallel_stateChanged(int value);
|
void on_runMacroInParallel_stateChanged(int value);
|
||||||
void on_runMacroOnChange_stateChanged(int value);
|
void on_runMacroOnChange_stateChanged(int value);
|
||||||
void on_conditionAdd_clicked();
|
void on_conditionAdd_clicked();
|
||||||
void on_conditionRemove_clicked();
|
void on_conditionRemove_clicked();
|
||||||
|
void on_conditionTop_clicked();
|
||||||
void on_conditionUp_clicked();
|
void on_conditionUp_clicked();
|
||||||
void on_conditionDown_clicked();
|
void on_conditionDown_clicked();
|
||||||
|
void on_conditionBottom_clicked();
|
||||||
void on_actionAdd_clicked();
|
void on_actionAdd_clicked();
|
||||||
void on_actionRemove_clicked();
|
void on_actionRemove_clicked();
|
||||||
|
void on_actionTop_clicked();
|
||||||
void on_actionUp_clicked();
|
void on_actionUp_clicked();
|
||||||
void on_actionDown_clicked();
|
void on_actionDown_clicked();
|
||||||
void MacroSelectionChanged(const QItemSelection &,
|
void on_actionBottom_clicked();
|
||||||
const QItemSelection &);
|
void on_toggleElseActions_clicked();
|
||||||
|
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();
|
||||||
|
void MacroSelectionChanged();
|
||||||
void UpMacroSegementHotkey();
|
void UpMacroSegementHotkey();
|
||||||
void DownMacroSegementHotkey();
|
void DownMacroSegementHotkey();
|
||||||
void DeleteMacroSegementHotkey();
|
void DeleteMacroSegementHotkey();
|
||||||
void ShowMacroContextMenu(const QPoint &);
|
void ShowMacroContextMenu(const QPoint &);
|
||||||
void ShowMacroActionsContextMenu(const QPoint &);
|
void ShowMacroActionsContextMenu(const QPoint &);
|
||||||
|
void ShowMacroElseActionsContextMenu(const QPoint &);
|
||||||
void ShowMacroConditionsContextMenu(const QPoint &);
|
void ShowMacroConditionsContextMenu(const QPoint &);
|
||||||
void CopyMacro();
|
void CopyMacro();
|
||||||
void RenameCurrentMacro();
|
void RenameCurrentMacro();
|
||||||
|
void ExportMacros();
|
||||||
|
void ImportMacros();
|
||||||
void ExpandAllActions();
|
void ExpandAllActions();
|
||||||
|
void ExpandAllElseActions();
|
||||||
void ExpandAllConditions();
|
void ExpandAllConditions();
|
||||||
void CollapseAllActions();
|
void CollapseAllActions();
|
||||||
|
void CollapseAllElseActions();
|
||||||
void CollapseAllConditions();
|
void CollapseAllConditions();
|
||||||
void MinimizeActions();
|
void MinimizeActions();
|
||||||
|
void MaximizeActions();
|
||||||
|
void MinimizeElseActions();
|
||||||
|
void MaximizeElseActions();
|
||||||
void MinimizeConditions();
|
void MinimizeConditions();
|
||||||
|
void MaximizeConditions();
|
||||||
|
void SetElseActionsStateToHidden();
|
||||||
|
void SetElseActionsStateToVisible();
|
||||||
void MacroActionSelectionChanged(int idx);
|
void MacroActionSelectionChanged(int idx);
|
||||||
void MacroActionReorder(int to, int target);
|
void MacroActionReorder(int to, int target);
|
||||||
void AddMacroAction(int idx);
|
void AddMacroAction(int idx);
|
||||||
void RemoveMacroAction(int idx);
|
void RemoveMacroAction(int idx);
|
||||||
void MoveMacroActionUp(int idx);
|
void MoveMacroActionUp(int idx);
|
||||||
void MoveMacroActionDown(int idx);
|
void MoveMacroActionDown(int idx);
|
||||||
|
void MacroElseActionSelectionChanged(int idx);
|
||||||
|
void MacroElseActionReorder(int to, int target);
|
||||||
|
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 MacroConditionSelectionChanged(int idx);
|
||||||
void MacroConditionReorder(int to, int target);
|
void MacroConditionReorder(int to, int target);
|
||||||
void AddMacroCondition(int idx);
|
void AddMacroCondition(int idx);
|
||||||
@@ -149,8 +184,10 @@ signals:
|
|||||||
void MacroRemoved(const QString &name);
|
void MacroRemoved(const QString &name);
|
||||||
void MacroRenamed(const QString &oldName, const QString &newName);
|
void MacroRenamed(const QString &oldName, const QString &newName);
|
||||||
void MacroSegmentOrderChanged();
|
void MacroSegmentOrderChanged();
|
||||||
|
void SegmentTempVarsChanged();
|
||||||
void HighlightMacrosChanged(bool value);
|
void HighlightMacrosChanged(bool value);
|
||||||
void HighlightActionsChanged(bool value);
|
void HighlightActionsChanged(bool value);
|
||||||
|
void HighlightElseActionsChanged(bool value);
|
||||||
void HighlightConditionsChanged(bool value);
|
void HighlightConditionsChanged(bool value);
|
||||||
|
|
||||||
void ConnectionAdded(const QString &);
|
void ConnectionAdded(const QString &);
|
||||||
@@ -161,18 +198,16 @@ signals:
|
|||||||
void VariableRemoved(const QString &);
|
void VariableRemoved(const QString &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum class MacroSection { CONDITIONS, ACTIONS, ELSE_ACTIONS };
|
||||||
|
|
||||||
|
void SetupMacroSegmentSelection(MacroSection type, int idx);
|
||||||
|
bool ResolveMacroImportNameConflict(std::shared_ptr<Macro> &);
|
||||||
bool MacroTabIsInFocus();
|
bool MacroTabIsInFocus();
|
||||||
|
|
||||||
MacroSegmentList *conditionsList = nullptr;
|
|
||||||
MacroSegmentList *actionsList = nullptr;
|
|
||||||
|
|
||||||
enum class MacroSection {
|
|
||||||
CONDITIONS,
|
|
||||||
ACTIONS,
|
|
||||||
};
|
|
||||||
MacroSection lastInteracted = MacroSection::CONDITIONS;
|
MacroSection lastInteracted = MacroSection::CONDITIONS;
|
||||||
int currentConditionIdx = -1;
|
int currentConditionIdx = -1;
|
||||||
int currentActionIdx = -1;
|
int currentActionIdx = -1;
|
||||||
|
int currentElseActionIdx = -1;
|
||||||
|
|
||||||
/* --- End of macro tab section --- */
|
/* --- End of macro tab section --- */
|
||||||
|
|
||||||
@@ -305,7 +340,7 @@ public slots:
|
|||||||
void on_timeUp_clicked();
|
void on_timeUp_clicked();
|
||||||
void on_timeDown_clicked();
|
void on_timeDown_clicked();
|
||||||
|
|
||||||
// Video tab
|
// Audio tab
|
||||||
public:
|
public:
|
||||||
void SetupAudioTab();
|
void SetupAudioTab();
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "switcher-data.hpp"
|
#include "switcher-data.hpp"
|
||||||
#include "status-control.hpp"
|
#include "status-control.hpp"
|
||||||
#include "file-selection.hpp"
|
#include "file-selection.hpp"
|
||||||
|
#include "filter-combo-box.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ void AdvSceneSwitcher::on_noMatchDontSwitch_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
switcher->switchIfNotMatching = SwitcherData::NoMatch::NO_SWITCH;
|
switcher->switchIfNotMatching = NoMatchBehavior::NO_SWITCH;
|
||||||
ui->noMatchSwitchScene->setEnabled(false);
|
ui->noMatchSwitchScene->setEnabled(false);
|
||||||
ui->randomDisabledWarning->setVisible(true);
|
ui->randomDisabledWarning->setVisible(true);
|
||||||
}
|
}
|
||||||
@@ -44,7 +45,7 @@ void AdvSceneSwitcher::on_noMatchSwitch_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
switcher->switchIfNotMatching = SwitcherData::NoMatch::SWITCH;
|
switcher->switchIfNotMatching = NoMatchBehavior::SWITCH;
|
||||||
ui->noMatchSwitchScene->setEnabled(true);
|
ui->noMatchSwitchScene->setEnabled(true);
|
||||||
UpdateNonMatchingScene(ui->noMatchSwitchScene->currentText());
|
UpdateNonMatchingScene(ui->noMatchSwitchScene->currentText());
|
||||||
ui->randomDisabledWarning->setVisible(true);
|
ui->randomDisabledWarning->setVisible(true);
|
||||||
@@ -57,7 +58,7 @@ void AdvSceneSwitcher::on_noMatchRandomSwitch_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
switcher->switchIfNotMatching = SwitcherData::NoMatch::RANDOM_SWITCH;
|
switcher->switchIfNotMatching = NoMatchBehavior::RANDOM_SWITCH;
|
||||||
ui->noMatchSwitchScene->setEnabled(false);
|
ui->noMatchSwitchScene->setEnabled(false);
|
||||||
ui->randomDisabledWarning->setVisible(false);
|
ui->randomDisabledWarning->setVisible(false);
|
||||||
}
|
}
|
||||||
@@ -131,10 +132,9 @@ void AdvSceneSwitcher::closeEvent(QCloseEvent *)
|
|||||||
}
|
}
|
||||||
switcher->windowPos = this->pos();
|
switcher->windowPos = this->pos();
|
||||||
switcher->windowSize = this->size();
|
switcher->windowSize = this->size();
|
||||||
switcher->macroActionConditionSplitterPosition =
|
|
||||||
ui->macroActionConditionSplitter->sizes();
|
|
||||||
switcher->macroListMacroEditSplitterPosition =
|
switcher->macroListMacroEditSplitterPosition =
|
||||||
ui->macroListMacroEditSplitter->sizes();
|
ui->macroListMacroEditSplitter->sizes();
|
||||||
|
MacroSelectionAboutToChange(); // Trigger saving of splitter states
|
||||||
|
|
||||||
obs_frontend_save();
|
obs_frontend_save();
|
||||||
}
|
}
|
||||||
@@ -175,6 +175,16 @@ void AdvSceneSwitcher::on_uiHintsDisable_stateChanged(int state)
|
|||||||
switcher->disableHints = state;
|
switcher->disableHints = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::on_disableComboBoxFilter_stateChanged(int state)
|
||||||
|
{
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switcher->disableFilterComboboxFilter = state;
|
||||||
|
FilterComboBox::SetFilterBehaviourEnabled(!state);
|
||||||
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_warnPluginLoadFailure_stateChanged(int state)
|
void AdvSceneSwitcher::on_warnPluginLoadFailure_stateChanged(int state)
|
||||||
{
|
{
|
||||||
if (loading) {
|
if (loading) {
|
||||||
@@ -489,11 +499,18 @@ void SwitcherData::LoadSettings(obs_data_t *obj)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New post load steps to be declared during load
|
||||||
|
postLoadSteps.clear();
|
||||||
|
|
||||||
// Needs to be loaded before any entries which might rely on scene group
|
// Needs to be loaded before any entries which might rely on scene group
|
||||||
// selections to be available.
|
// selections to be available.
|
||||||
loadSceneGroups(obj);
|
loadSceneGroups(obj);
|
||||||
LoadVariables(obj);
|
LoadVariables(obj);
|
||||||
LoadConnections(obj);
|
|
||||||
|
for (const auto &func : loadSteps) {
|
||||||
|
func(obj);
|
||||||
|
}
|
||||||
|
|
||||||
LoadMacros(obj);
|
LoadMacros(obj);
|
||||||
loadWindowTitleSwitches(obj);
|
loadWindowTitleSwitches(obj);
|
||||||
loadScreenRegionSwitches(obj);
|
loadScreenRegionSwitches(obj);
|
||||||
@@ -514,8 +531,13 @@ void SwitcherData::LoadSettings(obs_data_t *obj)
|
|||||||
LoadHotkeys(obj);
|
LoadHotkeys(obj);
|
||||||
LoadUISettings(obj);
|
LoadUISettings(obj);
|
||||||
|
|
||||||
|
for (const auto &func : postLoadSteps) {
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
// Reset on startup and scene collection change
|
// Reset on startup and scene collection change
|
||||||
switcher->lastOpenedTab = -1;
|
switcher->lastOpenedTab = -1;
|
||||||
|
startupLoadDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitcherData::SaveSettings(obs_data_t *obj)
|
void SwitcherData::SaveSettings(obs_data_t *obj)
|
||||||
@@ -526,7 +548,6 @@ void SwitcherData::SaveSettings(obs_data_t *obj)
|
|||||||
|
|
||||||
saveSceneGroups(obj);
|
saveSceneGroups(obj);
|
||||||
SaveMacros(obj);
|
SaveMacros(obj);
|
||||||
SaveConnections(obj);
|
|
||||||
SaveVariables(obj);
|
SaveVariables(obj);
|
||||||
saveWindowTitleSwitches(obj);
|
saveWindowTitleSwitches(obj);
|
||||||
saveScreenRegionSwitches(obj);
|
saveScreenRegionSwitches(obj);
|
||||||
@@ -547,6 +568,10 @@ void SwitcherData::SaveSettings(obs_data_t *obj)
|
|||||||
SaveHotkeys(obj);
|
SaveHotkeys(obj);
|
||||||
SaveUISettings(obj);
|
SaveUISettings(obj);
|
||||||
SaveVersion(obj, g_GIT_SHA1);
|
SaveVersion(obj, g_GIT_SHA1);
|
||||||
|
|
||||||
|
for (const auto &func : saveSteps) {
|
||||||
|
func(obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitcherData::SaveGeneralSettings(obs_data_t *obj)
|
void SwitcherData::SaveGeneralSettings(obs_data_t *obj)
|
||||||
@@ -574,6 +599,8 @@ void SwitcherData::SaveGeneralSettings(obs_data_t *obj)
|
|||||||
obs_data_set_bool(obj, "showSystemTrayNotifications",
|
obs_data_set_bool(obj, "showSystemTrayNotifications",
|
||||||
showSystemTrayNotifications);
|
showSystemTrayNotifications);
|
||||||
obs_data_set_bool(obj, "disableHints", disableHints);
|
obs_data_set_bool(obj, "disableHints", disableHints);
|
||||||
|
obs_data_set_bool(obj, "disableFilterComboboxFilter",
|
||||||
|
disableFilterComboboxFilter);
|
||||||
obs_data_set_bool(obj, "warnPluginLoadFailure", warnPluginLoadFailure);
|
obs_data_set_bool(obj, "warnPluginLoadFailure", warnPluginLoadFailure);
|
||||||
obs_data_set_bool(obj, "hideLegacyTabs", hideLegacyTabs);
|
obs_data_set_bool(obj, "hideLegacyTabs", hideLegacyTabs);
|
||||||
|
|
||||||
@@ -595,9 +622,9 @@ void SwitcherData::LoadGeneralSettings(obs_data_t *obj)
|
|||||||
interval = obs_data_get_int(obj, "interval");
|
interval = obs_data_get_int(obj, "interval");
|
||||||
|
|
||||||
obs_data_set_default_int(obj, "switch_if_not_matching",
|
obs_data_set_default_int(obj, "switch_if_not_matching",
|
||||||
static_cast<int>(NoMatch::NO_SWITCH));
|
static_cast<int>(NoMatchBehavior::NO_SWITCH));
|
||||||
switchIfNotMatching =
|
switchIfNotMatching = static_cast<NoMatchBehavior>(
|
||||||
(NoMatch)obs_data_get_int(obj, "switch_if_not_matching");
|
obs_data_get_int(obj, "switch_if_not_matching"));
|
||||||
std::string nonMatchingSceneName =
|
std::string nonMatchingSceneName =
|
||||||
obs_data_get_string(obj, "non_matching_scene");
|
obs_data_get_string(obj, "non_matching_scene");
|
||||||
nonMatchingScene = GetWeakSourceByName(nonMatchingSceneName.c_str());
|
nonMatchingScene = GetWeakSourceByName(nonMatchingSceneName.c_str());
|
||||||
@@ -622,6 +649,8 @@ void SwitcherData::LoadGeneralSettings(obs_data_t *obj)
|
|||||||
showSystemTrayNotifications =
|
showSystemTrayNotifications =
|
||||||
obs_data_get_bool(obj, "showSystemTrayNotifications");
|
obs_data_get_bool(obj, "showSystemTrayNotifications");
|
||||||
disableHints = obs_data_get_bool(obj, "disableHints");
|
disableHints = obs_data_get_bool(obj, "disableHints");
|
||||||
|
disableFilterComboboxFilter =
|
||||||
|
obs_data_get_bool(obj, "disableFilterComboboxFilter");
|
||||||
obs_data_set_default_bool(obj, "warnPluginLoadFailure", true);
|
obs_data_set_default_bool(obj, "warnPluginLoadFailure", true);
|
||||||
warnPluginLoadFailure = obs_data_get_bool(obj, "warnPluginLoadFailure");
|
warnPluginLoadFailure = obs_data_get_bool(obj, "warnPluginLoadFailure");
|
||||||
obs_data_set_default_bool(obj, "hideLegacyTabs", true);
|
obs_data_set_default_bool(obj, "hideLegacyTabs", true);
|
||||||
@@ -651,34 +680,6 @@ void SwitcherData::LoadGeneralSettings(obs_data_t *obj)
|
|||||||
lastImportPath = obs_data_get_string(obj, "lastImportPath");
|
lastImportPath = obs_data_get_string(obj, "lastImportPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void saveSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
|
||||||
const std::string name)
|
|
||||||
{
|
|
||||||
auto array = obs_data_array_create();
|
|
||||||
for (int i = 0; i < sizes.count(); ++i) {
|
|
||||||
obs_data_t *array_obj = obs_data_create();
|
|
||||||
obs_data_set_int(array_obj, "pos", sizes[i]);
|
|
||||||
obs_data_array_push_back(array, array_obj);
|
|
||||||
obs_data_release(array_obj);
|
|
||||||
}
|
|
||||||
obs_data_set_array(obj, name.c_str(), array);
|
|
||||||
obs_data_array_release(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
|
||||||
const std::string name)
|
|
||||||
{
|
|
||||||
sizes.clear();
|
|
||||||
obs_data_array_t *array = obs_data_get_array(obj, name.c_str());
|
|
||||||
size_t count = obs_data_array_count(array);
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
|
||||||
obs_data_t *item = obs_data_array_item(array, i);
|
|
||||||
sizes << obs_data_get_int(item, "pos");
|
|
||||||
obs_data_release(item);
|
|
||||||
}
|
|
||||||
obs_data_array_release(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SwitcherData::SaveUISettings(obs_data_t *obj)
|
void SwitcherData::SaveUISettings(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
obs_data_set_int(obj, "generalTabPos", tabOrder[0]);
|
obs_data_set_int(obj, "generalTabPos", tabOrder[0]);
|
||||||
@@ -706,9 +707,7 @@ void SwitcherData::SaveUISettings(obs_data_t *obj)
|
|||||||
obs_data_set_int(obj, "windowWidth", windowSize.width());
|
obs_data_set_int(obj, "windowWidth", windowSize.width());
|
||||||
obs_data_set_int(obj, "windowHeight", windowSize.height());
|
obs_data_set_int(obj, "windowHeight", windowSize.height());
|
||||||
|
|
||||||
saveSplitterPos(macroActionConditionSplitterPosition, obj,
|
SaveSplitterPos(macroListMacroEditSplitterPosition, obj,
|
||||||
"macroActionConditionSplitterPosition");
|
|
||||||
saveSplitterPos(macroListMacroEditSplitterPosition, obj,
|
|
||||||
"macroListMacroEditSplitterPosition");
|
"macroListMacroEditSplitterPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -762,9 +761,8 @@ void SwitcherData::LoadUISettings(obs_data_t *obj)
|
|||||||
(int)obs_data_get_int(obj, "windowPosY")};
|
(int)obs_data_get_int(obj, "windowPosY")};
|
||||||
windowSize = {(int)obs_data_get_int(obj, "windowWidth"),
|
windowSize = {(int)obs_data_get_int(obj, "windowWidth"),
|
||||||
(int)obs_data_get_int(obj, "windowHeight")};
|
(int)obs_data_get_int(obj, "windowHeight")};
|
||||||
loadSplitterPos(macroActionConditionSplitterPosition, obj,
|
|
||||||
"macroActionConditionSplitterPosition");
|
LoadSplitterPos(macroListMacroEditSplitterPosition, obj,
|
||||||
loadSplitterPos(macroListMacroEditSplitterPosition, obj,
|
|
||||||
"macroListMacroEditSplitterPosition");
|
"macroListMacroEditSplitterPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,12 +798,13 @@ void SwitcherData::CheckNoMatchSwitch(bool &match, OBSWeakSource &scene,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switchIfNotMatching == NoMatch::SWITCH && nonMatchingScene) {
|
if (switchIfNotMatching == NoMatchBehavior::SWITCH &&
|
||||||
|
nonMatchingScene) {
|
||||||
match = true;
|
match = true;
|
||||||
scene = nonMatchingScene;
|
scene = nonMatchingScene;
|
||||||
transition = nullptr;
|
transition = nullptr;
|
||||||
}
|
}
|
||||||
if (switchIfNotMatching == NoMatch::RANDOM_SWITCH) {
|
if (switchIfNotMatching == NoMatchBehavior::RANDOM_SWITCH) {
|
||||||
match = checkRandom(scene, transition, sleep);
|
match = checkRandom(scene, transition, sleep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -956,11 +955,11 @@ void AdvSceneSwitcher::SetupGeneralTab()
|
|||||||
{
|
{
|
||||||
PopulateSceneSelection(ui->noMatchSwitchScene, false);
|
PopulateSceneSelection(ui->noMatchSwitchScene, false);
|
||||||
|
|
||||||
if (switcher->switchIfNotMatching == SwitcherData::NoMatch::SWITCH) {
|
if (switcher->switchIfNotMatching == NoMatchBehavior::SWITCH) {
|
||||||
ui->noMatchSwitch->setChecked(true);
|
ui->noMatchSwitch->setChecked(true);
|
||||||
ui->noMatchSwitchScene->setEnabled(true);
|
ui->noMatchSwitchScene->setEnabled(true);
|
||||||
} else if (switcher->switchIfNotMatching ==
|
} else if (switcher->switchIfNotMatching ==
|
||||||
SwitcherData::NoMatch::NO_SWITCH) {
|
NoMatchBehavior::NO_SWITCH) {
|
||||||
ui->noMatchDontSwitch->setChecked(true);
|
ui->noMatchDontSwitch->setChecked(true);
|
||||||
ui->noMatchSwitchScene->setEnabled(false);
|
ui->noMatchSwitchScene->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
@@ -996,6 +995,10 @@ void AdvSceneSwitcher::SetupGeneralTab()
|
|||||||
ui->showTrayNotifications->setChecked(
|
ui->showTrayNotifications->setChecked(
|
||||||
switcher->showSystemTrayNotifications);
|
switcher->showSystemTrayNotifications);
|
||||||
ui->uiHintsDisable->setChecked(switcher->disableHints);
|
ui->uiHintsDisable->setChecked(switcher->disableHints);
|
||||||
|
ui->disableComboBoxFilter->setChecked(
|
||||||
|
switcher->disableFilterComboboxFilter);
|
||||||
|
FilterComboBox::SetFilterBehaviourEnabled(
|
||||||
|
!switcher->disableFilterComboboxFilter);
|
||||||
ui->warnPluginLoadFailure->setChecked(switcher->warnPluginLoadFailure);
|
ui->warnPluginLoadFailure->setChecked(switcher->warnPluginLoadFailure);
|
||||||
ui->hideLegacyTabs->setChecked(switcher->hideLegacyTabs);
|
ui->hideLegacyTabs->setChecked(switcher->hideLegacyTabs);
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ void SwitcherData::writeToStatusFile(const QString &msg)
|
|||||||
if (file.open(QIODevice::ReadWrite)) {
|
if (file.open(QIODevice::ReadWrite)) {
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
stream << msg << endl;
|
stream << msg << "\n";
|
||||||
#else
|
#else
|
||||||
stream << msg << Qt::endl;
|
stream << msg << Qt::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -143,8 +143,7 @@ void AdvSceneSwitcher::SetupRandomTab()
|
|||||||
border-radius: 7px; \
|
border-radius: 7px; \
|
||||||
border-color: rgb(0,0,0,0) \
|
border-color: rgb(0,0,0,0) \
|
||||||
}");
|
}");
|
||||||
if (switcher->switchIfNotMatching !=
|
if (switcher->switchIfNotMatching != NoMatchBehavior::RANDOM_SWITCH) {
|
||||||
SwitcherData::NoMatch::RANDOM_SWITCH) {
|
|
||||||
if (!switcher->disableHints) {
|
if (!switcher->disableHints) {
|
||||||
PulseWidget(ui->randomDisabledWarning, QColor(Qt::red),
|
PulseWidget(ui->randomDisabledWarning, QColor(Qt::red),
|
||||||
QColor(0, 0, 0, 0));
|
QColor(0, 0, 0, 0));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "platform-funcs.hpp"
|
#include "platform-funcs.hpp"
|
||||||
#include "hotkey.hpp"
|
#include "hotkey.hpp"
|
||||||
|
#include "log-helper.hpp"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
@@ -25,9 +26,10 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QLibrary>
|
#include <QLibrary>
|
||||||
#ifdef USE_PROCPS
|
#ifdef PROCPS_AVAILABLE
|
||||||
#include <proc/readproc.h>
|
#include <proc/readproc.h>
|
||||||
#else
|
#endif
|
||||||
|
#ifdef PROCPS2_AVAILABLE
|
||||||
#include <libproc2/pids.h>
|
#include <libproc2/pids.h>
|
||||||
#endif
|
#endif
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -53,6 +55,31 @@ std::chrono::high_resolution_clock::time_point lastMouseLeftClickTime{};
|
|||||||
std::chrono::high_resolution_clock::time_point lastMouseMiddleClickTime{};
|
std::chrono::high_resolution_clock::time_point lastMouseMiddleClickTime{};
|
||||||
std::chrono::high_resolution_clock::time_point lastMouseRightClickTime{};
|
std::chrono::high_resolution_clock::time_point lastMouseRightClickTime{};
|
||||||
|
|
||||||
|
static QLibrary *libprocps = nullptr;
|
||||||
|
#ifdef PROCPS_AVAILABLE
|
||||||
|
typedef PROCTAB *(*openproc_func)(int flags);
|
||||||
|
typedef void (*closeproc_func)(PROCTAB *PT);
|
||||||
|
typedef proc_t *(*readproc_func)(PROCTAB *__restrict const PT,
|
||||||
|
proc_t *__restrict p);
|
||||||
|
static openproc_func openproc_ = nullptr;
|
||||||
|
static closeproc_func closeproc_ = nullptr;
|
||||||
|
static readproc_func readproc_ = nullptr;
|
||||||
|
#endif
|
||||||
|
static bool libprocpsSupported = false;
|
||||||
|
|
||||||
|
static QLibrary *libproc2 = nullptr;
|
||||||
|
#ifdef PROCPS2_AVAILABLE
|
||||||
|
typedef int (*procps_pids_new_func)(struct pids_info **info,
|
||||||
|
enum pids_item *items, int numitems);
|
||||||
|
typedef struct pids_stack *(*procps_pids_get_func)(struct pids_info *info,
|
||||||
|
enum pids_fetch_type which);
|
||||||
|
typedef int (*procps_pids_unref_func)(struct pids_info **info);
|
||||||
|
static procps_pids_new_func procps_pids_new_ = nullptr;
|
||||||
|
static procps_pids_get_func procps_pids_get_ = nullptr;
|
||||||
|
static procps_pids_unref_func procps_pids_unref_ = nullptr;
|
||||||
|
#endif
|
||||||
|
static bool libprocps2Supported = false;
|
||||||
|
|
||||||
Display *disp()
|
Display *disp()
|
||||||
{
|
{
|
||||||
if (!xdisplay) {
|
if (!xdisplay) {
|
||||||
@@ -332,52 +359,63 @@ bool IsFullscreen(const std::string &title)
|
|||||||
return windowStatesAreSet(title, states);
|
return windowStatesAreSet(title, states);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> GetTextInWindow(const std::string &window)
|
std::optional<std::string> GetTextInWindow(const std::string &)
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PROCPS
|
static void getProcessListProcps(QStringList &processes)
|
||||||
void GetProcessList(QStringList &processes)
|
|
||||||
{
|
{
|
||||||
processes.clear();
|
#ifdef PROCPS_AVAILABLE
|
||||||
PROCTAB *proc = openproc(PROC_FILLSTAT);
|
PROCTAB *proc = openproc_(PROC_FILLSTAT);
|
||||||
proc_t proc_info;
|
proc_t proc_info;
|
||||||
memset(&proc_info, 0, sizeof(proc_info));
|
memset(&proc_info, 0, sizeof(proc_info));
|
||||||
while (readproc(proc, &proc_info) != NULL) {
|
while (readproc_(proc, &proc_info) != NULL) {
|
||||||
QString procName(proc_info.cmd);
|
QString procName(proc_info.cmd);
|
||||||
if (!procName.isEmpty() && !processes.contains(procName)) {
|
if (!procName.isEmpty() && !processes.contains(procName)) {
|
||||||
processes << procName;
|
processes << procName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closeproc(proc);
|
closeproc_(proc);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void GetProcessList(QStringList &processes)
|
static void getProcessListProcps2(QStringList &processes)
|
||||||
{
|
{
|
||||||
processes.clear();
|
#ifdef PROCPS2_AVAILABLE
|
||||||
struct pids_info *info = NULL;
|
struct pids_info *info = NULL;
|
||||||
struct pids_stack *stack;
|
struct pids_stack *stack;
|
||||||
enum pids_item Items[] = {
|
enum pids_item Items[] = {
|
||||||
PIDS_CMD,
|
PIDS_CMD,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (procps_pids_new(&info, Items, sizeof(Items) / sizeof(Items[0])) <
|
if (procps_pids_new_(&info, Items, sizeof(Items) / sizeof(Items[0])) <
|
||||||
0) {
|
0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
while ((stack = procps_pids_get_(info, PIDS_FETCH_TASKS_ONLY))) {
|
||||||
while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
|
|
||||||
auto cmd = PIDS_VAL(0, str, stack, info);
|
auto cmd = PIDS_VAL(0, str, stack, info);
|
||||||
QString procName(cmd);
|
QString procName(cmd);
|
||||||
if (!procName.isEmpty() && !processes.contains(procName)) {
|
if (!procName.isEmpty() && !processes.contains(procName)) {
|
||||||
processes << procName;
|
processes << procName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
procps_pids_unref(&info);
|
procps_pids_unref_(&info);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetProcessList(QStringList &processes)
|
||||||
|
{
|
||||||
|
processes.clear();
|
||||||
|
if (libprocpsSupported) {
|
||||||
|
getProcessListProcps(processes);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (libprocps2Supported) {
|
||||||
|
getProcessListProcps2(processes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
long getForegroundProcessPid()
|
long getForegroundProcessPid()
|
||||||
{
|
{
|
||||||
@@ -633,6 +671,58 @@ void PressKeys(const std::vector<HotkeyType> keys, int duration)
|
|||||||
XFlush(display);
|
XFlush(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void initXtst()
|
||||||
|
{
|
||||||
|
libXtstHandle = new QLibrary("libXtst", nullptr);
|
||||||
|
pressFunc = (keyPressFunc)libXtstHandle->resolve("XTestFakeKeyEvent");
|
||||||
|
int _;
|
||||||
|
canSimulateKeyPresses = pressFunc &&
|
||||||
|
XQueryExtension(disp(), "XTEST", &_, &_, &_);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void initXss()
|
||||||
|
{
|
||||||
|
libXssHandle = new QLibrary("libXss", nullptr);
|
||||||
|
allocSSFunc = (XScreenSaverAllocInfoFunc)libXssHandle->resolve(
|
||||||
|
"XScreenSaverAllocInfo");
|
||||||
|
querySSFunc = (XScreenSaverQueryInfoFunc)libXssHandle->resolve(
|
||||||
|
"XScreenSaverQueryInfo");
|
||||||
|
int _;
|
||||||
|
canGetIdleTime = allocSSFunc && querySSFunc &&
|
||||||
|
XQueryExtension(disp(), ScreenSaverName, &_, &_, &_);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void initProcps()
|
||||||
|
{
|
||||||
|
#ifdef PROCPS_AVAILABLE
|
||||||
|
libprocps = new QLibrary("libprocps", nullptr);
|
||||||
|
openproc_ = (openproc_func)libprocps->resolve("openproc");
|
||||||
|
closeproc_ = (closeproc_func)libprocps->resolve("closeproc");
|
||||||
|
readproc_ = (readproc_func)libprocps->resolve("readproc");
|
||||||
|
if (openproc_ && closeproc_ && readproc_) {
|
||||||
|
libprocpsSupported = true;
|
||||||
|
blog(LOG_INFO, "libprocps symbols resolved successfully!");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void initProc2()
|
||||||
|
{
|
||||||
|
#ifdef PROCPS2_AVAILABLE
|
||||||
|
libproc2 = new QLibrary("libproc2", nullptr);
|
||||||
|
procps_pids_new_ =
|
||||||
|
(procps_pids_new_func)libproc2->resolve("procps_pids_new");
|
||||||
|
procps_pids_get_ =
|
||||||
|
(procps_pids_get_func)libproc2->resolve("procps_pids_get");
|
||||||
|
procps_pids_unref_ =
|
||||||
|
(procps_pids_unref_func)libproc2->resolve("procps_pids_unref");
|
||||||
|
if (procps_pids_new_ && procps_pids_get_ && procps_pids_unref_) {
|
||||||
|
libprocps2Supported = true;
|
||||||
|
blog(LOG_INFO, "libproc2 symbols resolved successfully!");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void PlatformInit()
|
void PlatformInit()
|
||||||
{
|
{
|
||||||
auto display = disp();
|
auto display = disp();
|
||||||
@@ -640,31 +730,26 @@ void PlatformInit()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
libXtstHandle = new QLibrary("libXtst", nullptr);
|
initXtst();
|
||||||
pressFunc = (keyPressFunc)libXtstHandle->resolve("XTestFakeKeyEvent");
|
initXss();
|
||||||
int _;
|
initProcps();
|
||||||
canSimulateKeyPresses = pressFunc &&
|
initProc2();
|
||||||
XQueryExtension(disp(), "XTEST", &_, &_, &_);
|
}
|
||||||
|
|
||||||
libXssHandle = new QLibrary("libXss", nullptr);
|
static void cleanupHelper(QLibrary *lib)
|
||||||
allocSSFunc = (XScreenSaverAllocInfoFunc)libXssHandle->resolve(
|
{
|
||||||
"XScreenSaverAllocInfo");
|
if (lib) {
|
||||||
querySSFunc = (XScreenSaverQueryInfoFunc)libXssHandle->resolve(
|
delete lib;
|
||||||
"XScreenSaverQueryInfo");
|
lib = nullptr;
|
||||||
canGetIdleTime = allocSSFunc && querySSFunc &&
|
}
|
||||||
XQueryExtension(disp(), ScreenSaverName, &_, &_, &_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlatformCleanup()
|
void PlatformCleanup()
|
||||||
{
|
{
|
||||||
if (libXtstHandle) {
|
cleanupHelper(libXtstHandle);
|
||||||
delete libXtstHandle;
|
cleanupHelper(libXssHandle);
|
||||||
libXtstHandle = nullptr;
|
cleanupHelper(libprocps);
|
||||||
}
|
cleanupHelper(libproc2);
|
||||||
if (libXssHandle) {
|
|
||||||
delete libXssHandle;
|
|
||||||
libXssHandle = nullptr;
|
|
||||||
}
|
|
||||||
cleanupDisplay();
|
cleanupDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,22 @@ const static std::map<MacroActionAudio::FadeType, std::string> fadeTypes = {
|
|||||||
constexpr auto fadeInterval = std::chrono::milliseconds(100);
|
constexpr auto fadeInterval = std::chrono::milliseconds(100);
|
||||||
constexpr float minFade = 0.000001f;
|
constexpr float minFade = 0.000001f;
|
||||||
|
|
||||||
|
// For backwards compatibility
|
||||||
|
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(29, 0, 0)
|
||||||
|
static float get_master_volume()
|
||||||
|
{
|
||||||
|
return 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_master_volume(float)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
auto get_master_volume = obs_get_master_volume;
|
||||||
|
auto set_master_volume = obs_set_master_volume;
|
||||||
|
#endif
|
||||||
|
|
||||||
void MacroActionAudio::SetFadeActive(bool value)
|
void MacroActionAudio::SetFadeActive(bool value)
|
||||||
{
|
{
|
||||||
if (_action == Action::SOURCE_VOLUME) {
|
if (_action == Action::SOURCE_VOLUME) {
|
||||||
@@ -87,7 +103,7 @@ void MacroActionAudio::SetVolume(float vol)
|
|||||||
obs_source_set_volume(s, vol);
|
obs_source_set_volume(s, vol);
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
} else {
|
} else {
|
||||||
obs_set_master_volume(vol);
|
set_master_volume(vol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +118,7 @@ float MacroActionAudio::GetVolume()
|
|||||||
curVol = obs_source_get_volume(s);
|
curVol = obs_source_get_volume(s);
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
} else {
|
} else {
|
||||||
curVol = obs_get_master_volume();
|
curVol = get_master_volume();
|
||||||
}
|
}
|
||||||
return curVol;
|
return curVol;
|
||||||
}
|
}
|
||||||
@@ -287,15 +303,13 @@ std::string MacroActionAudio::GetShortDesc() const
|
|||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (const auto &[action, name] : actionTypes) {
|
for (const auto &[action, name] : actionTypes) {
|
||||||
if (action == MacroActionAudio::Action::MONITOR) {
|
if (action == MacroActionAudio::Action::MONITOR &&
|
||||||
if (obs_audio_monitoring_available()) {
|
!obs_audio_monitoring_available()) {
|
||||||
list->addItem(obs_module_text(name.c_str()),
|
continue;
|
||||||
static_cast<int>(action));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
list->addItem(obs_module_text(name.c_str()),
|
|
||||||
static_cast<int>(action));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,12 +451,6 @@ void MacroActionAudioEdit::SetWidgetVisibility()
|
|||||||
_balance->setVisible(_entryData->_action ==
|
_balance->setVisible(_entryData->_action ==
|
||||||
MacroActionAudio::Action::BALANCE);
|
MacroActionAudio::Action::BALANCE);
|
||||||
|
|
||||||
_fadeTypes->setDisabled(!_entryData->_fade);
|
|
||||||
_wait->setDisabled(!_entryData->_fade);
|
|
||||||
_abortActiveFade->setDisabled(!_entryData->_fade);
|
|
||||||
_duration->setDisabled(!_entryData->_fade);
|
|
||||||
_rate->setDisabled(!_entryData->_fade);
|
|
||||||
|
|
||||||
_fadeTypeLayout->removeWidget(_fade);
|
_fadeTypeLayout->removeWidget(_fade);
|
||||||
_fadeTypeLayout->removeWidget(_fadeTypes);
|
_fadeTypeLayout->removeWidget(_fadeTypes);
|
||||||
_fadeTypeLayout->removeWidget(_duration);
|
_fadeTypeLayout->removeWidget(_duration);
|
||||||
@@ -474,6 +482,20 @@ void MacroActionAudioEdit::SetWidgetVisibility()
|
|||||||
hasVolumeControl(_entryData->_action));
|
hasVolumeControl(_entryData->_action));
|
||||||
SetLayoutVisible(_fadeOptionsLayout,
|
SetLayoutVisible(_fadeOptionsLayout,
|
||||||
hasVolumeControl(_entryData->_action));
|
hasVolumeControl(_entryData->_action));
|
||||||
|
_abortActiveFade->setVisible(hasVolumeControl(_entryData->_action) &&
|
||||||
|
_entryData->_fade);
|
||||||
|
_wait->setVisible(hasVolumeControl(_entryData->_action) &&
|
||||||
|
_entryData->_fade);
|
||||||
|
|
||||||
|
// TODO: Remove this in a future version:
|
||||||
|
if (_entryData->_action != MacroActionAudio::Action::MASTER_VOLUME &&
|
||||||
|
obs_get_version() >= MAKE_SEMANTIC_VERSION(29, 0, 0)) {
|
||||||
|
_actions->removeItem(_actions->findText(obs_module_text(
|
||||||
|
actionTypes.at(MacroActionAudio::Action::MASTER_VOLUME)
|
||||||
|
.c_str())));
|
||||||
|
}
|
||||||
|
|
||||||
|
updateGeometry();
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
257
src/macro-core/macro-action-clipboard.cpp
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
#include "macro-action-clipboard.hpp"
|
||||||
|
#include "curl-helper.hpp"
|
||||||
|
#include "switcher-data.hpp"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
const std::string MacroActionClipboard::id = "clipboard";
|
||||||
|
|
||||||
|
bool MacroActionClipboard::_registered = MacroActionFactory::Register(
|
||||||
|
MacroActionClipboard::id,
|
||||||
|
{MacroActionClipboard::Create, MacroActionClipboardEdit::Create,
|
||||||
|
"AdvSceneSwitcher.action.clipboard"});
|
||||||
|
|
||||||
|
const static std::map<MacroActionClipboard::Action, std::string> actionTypes = {
|
||||||
|
{MacroActionClipboard::Action::COPY_TEXT,
|
||||||
|
"AdvSceneSwitcher.action.clipboard.type.copy.text"},
|
||||||
|
{MacroActionClipboard::Action::COPY_IMAGE,
|
||||||
|
"AdvSceneSwitcher.action.clipboard.type.copy.image"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static size_t writeCallback(void *ptr, size_t size, size_t nmemb,
|
||||||
|
QByteArray *buffer)
|
||||||
|
{
|
||||||
|
buffer->append((char *)ptr, nmemb);
|
||||||
|
return size * nmemb;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::optional<QImage> getImageFromUrl(const char *url)
|
||||||
|
{
|
||||||
|
QByteArray response;
|
||||||
|
|
||||||
|
switcher->curl.SetOpt(CURLOPT_URL, url);
|
||||||
|
switcher->curl.SetOpt(CURLOPT_HTTPGET, 1L);
|
||||||
|
switcher->curl.SetOpt(CURLOPT_TIMEOUT_MS, 30000);
|
||||||
|
switcher->curl.SetOpt(CURLOPT_WRITEFUNCTION, writeCallback);
|
||||||
|
switcher->curl.SetOpt(CURLOPT_WRITEDATA, &response);
|
||||||
|
auto code = switcher->curl.Perform();
|
||||||
|
|
||||||
|
if (code != CURLE_OK) {
|
||||||
|
blog(LOG_WARNING,
|
||||||
|
"Retrieving image failed in %s with error: %s", __func__,
|
||||||
|
switcher->curl.GetError(code));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return QImage::fromData(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setMimeTypeParams(ClipboardQueueParams *params,
|
||||||
|
QClipboard *clipboard)
|
||||||
|
{
|
||||||
|
auto mimeData = clipboard->mimeData();
|
||||||
|
if (!mimeData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto mimeTypeList = mimeData->formats();
|
||||||
|
if (mimeTypeList.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params->mimeTypePrimary = mimeTypeList.first().toStdString();
|
||||||
|
params->mimeTypeAll = mimeTypeList.join(" ").toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void copyText(void *param)
|
||||||
|
{
|
||||||
|
auto params = static_cast<ClipboardTextQueueParams *>(param);
|
||||||
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
|
clipboard->setText(params->text.c_str());
|
||||||
|
|
||||||
|
setMimeTypeParams(params, clipboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void copyImageFromUrl(void *param)
|
||||||
|
{
|
||||||
|
auto params = static_cast<ClipboardImageQueueParams *>(param);
|
||||||
|
auto url = params->url.c_str();
|
||||||
|
auto image = getImageFromUrl(url);
|
||||||
|
|
||||||
|
if (!image || (*image).isNull()) {
|
||||||
|
blog(LOG_WARNING, "Failed to convert %s URL to image!", url);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
clipboard->setImage(*image);
|
||||||
|
|
||||||
|
setMimeTypeParams(params, clipboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionClipboard::PerformAction()
|
||||||
|
{
|
||||||
|
switch (_action) {
|
||||||
|
case Action::COPY_TEXT: {
|
||||||
|
ClipboardTextQueueParams params{"", "", _text};
|
||||||
|
obs_queue_task(OBS_TASK_UI, copyText, ¶ms, true);
|
||||||
|
SetTempVarValues(params);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Action::COPY_IMAGE: {
|
||||||
|
ClipboardImageQueueParams params{"", "", _url};
|
||||||
|
obs_queue_task(OBS_TASK_UI, copyImageFromUrl, ¶ms, true);
|
||||||
|
SetTempVarValues(params);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionClipboard::SetupTempVars()
|
||||||
|
{
|
||||||
|
MacroAction::SetupTempVars();
|
||||||
|
|
||||||
|
AddTempvar(
|
||||||
|
"mimeType.primary",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.clipboard.mimeType.primary"),
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.clipboard.mimeType.primary.description"));
|
||||||
|
AddTempvar(
|
||||||
|
"mimeType.all",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.clipboard.mimeType.all"),
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.clipboard.mimeType.all.description"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionClipboard::SetTempVarValues(const ClipboardQueueParams ¶ms)
|
||||||
|
{
|
||||||
|
SetTempVarValue("mimeType.primary", params.mimeTypePrimary);
|
||||||
|
SetTempVarValue("mimeType.all", params.mimeTypeAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionClipboard::Save(obs_data_t *obj) const
|
||||||
|
{
|
||||||
|
MacroAction::Save(obj);
|
||||||
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
|
_text.Save(obj, "text");
|
||||||
|
_url.Save(obj, "url");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionClipboard::Load(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Load(obj);
|
||||||
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
|
_text.Load(obj, "text");
|
||||||
|
_url.Load(obj, "url");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
for (const auto &[action, name] : actionTypes) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(action));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroActionClipboardEdit::MacroActionClipboardEdit(
|
||||||
|
QWidget *parent, std::shared_ptr<MacroActionClipboard> entryData)
|
||||||
|
: QWidget(parent),
|
||||||
|
_actions(new FilterComboBox(this)),
|
||||||
|
_text(new VariableLineEdit(this)),
|
||||||
|
_url(new VariableLineEdit(this))
|
||||||
|
{
|
||||||
|
populateActionSelection(_actions);
|
||||||
|
_url->setToolTip(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.clipboard.copy.image.url.tooltip"));
|
||||||
|
|
||||||
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(ActionChanged(int)));
|
||||||
|
QWidget::connect(_text, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(TextChanged()));
|
||||||
|
QWidget::connect(_url, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(UrlChanged()));
|
||||||
|
|
||||||
|
auto mainLayout = new QHBoxLayout();
|
||||||
|
mainLayout->addWidget(_actions);
|
||||||
|
mainLayout->addWidget(_text);
|
||||||
|
mainLayout->addWidget(_url);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
_entryData = entryData;
|
||||||
|
UpdateEntryData();
|
||||||
|
_loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionClipboardEdit::ActionChanged(int index)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_action = static_cast<MacroActionClipboard::Action>(
|
||||||
|
_actions->itemData(index).toInt());
|
||||||
|
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionClipboardEdit::TextChanged()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_text = _text->text().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionClipboardEdit::UrlChanged()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_url = _url->text().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionClipboardEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
_text->setVisible(_entryData->_action ==
|
||||||
|
MacroActionClipboard::Action::COPY_TEXT);
|
||||||
|
_url->setVisible(_entryData->_action ==
|
||||||
|
MacroActionClipboard::Action::COPY_IMAGE);
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionClipboardEdit::UpdateEntryData()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_actions->setCurrentIndex(
|
||||||
|
_actions->findData(static_cast<int>(_entryData->_action)));
|
||||||
|
_text->setText(_entryData->_text);
|
||||||
|
_url->setText(_entryData->_url);
|
||||||
|
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
89
src/macro-core/macro-action-clipboard.hpp
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "macro-action-edit.hpp"
|
||||||
|
#include "filter-combo-box.hpp"
|
||||||
|
|
||||||
|
#include <variable-line-edit.hpp>
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
struct ClipboardQueueParams {
|
||||||
|
std::string mimeTypePrimary;
|
||||||
|
std::string mimeTypeAll;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ClipboardTextQueueParams : ClipboardQueueParams {
|
||||||
|
StringVariable text;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ClipboardImageQueueParams : ClipboardQueueParams {
|
||||||
|
StringVariable url;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroActionClipboard : public MacroAction {
|
||||||
|
public:
|
||||||
|
MacroActionClipboard(Macro *m) : MacroAction(m) {}
|
||||||
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
|
{
|
||||||
|
return std::make_shared<MacroActionClipboard>(m);
|
||||||
|
}
|
||||||
|
std::string GetId() const { return id; };
|
||||||
|
|
||||||
|
bool PerformAction();
|
||||||
|
bool Save(obs_data_t *obj) const;
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
|
||||||
|
enum class Action {
|
||||||
|
COPY_TEXT,
|
||||||
|
COPY_IMAGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
Action _action = Action::COPY_TEXT;
|
||||||
|
|
||||||
|
StringVariable _text = obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.clipboard.copy.text.text.placeholder");
|
||||||
|
StringVariable _url = obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.clipboard.copy.image.url.placeholder");
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetupTempVars();
|
||||||
|
void SetTempVarValues(const ClipboardQueueParams ¶ms);
|
||||||
|
|
||||||
|
static bool _registered;
|
||||||
|
static const std::string id;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroActionClipboardEdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroActionClipboardEdit(
|
||||||
|
QWidget *parent,
|
||||||
|
std::shared_ptr<MacroActionClipboard> entryData = nullptr);
|
||||||
|
static QWidget *Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroAction> action)
|
||||||
|
{
|
||||||
|
return new MacroActionClipboardEdit(
|
||||||
|
parent, std::dynamic_pointer_cast<MacroActionClipboard>(
|
||||||
|
action));
|
||||||
|
}
|
||||||
|
void UpdateEntryData();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::shared_ptr<MacroActionClipboard> _entryData;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ActionChanged(int index);
|
||||||
|
void TextChanged();
|
||||||
|
void UrlChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
|
bool _loading = true;
|
||||||
|
|
||||||
|
FilterComboBox *_actions;
|
||||||
|
VariableLineEdit *_text;
|
||||||
|
VariableLineEdit *_url;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
@@ -3,8 +3,11 @@
|
|||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "macro-action-scene-switch.hpp"
|
#include "macro-action-scene-switch.hpp"
|
||||||
#include "section.hpp"
|
#include "section.hpp"
|
||||||
|
#include "switch-button.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
#include <QGraphicsOpacityEffect>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
std::map<std::string, MacroActionInfo> &MacroActionFactory::GetMap()
|
std::map<std::string, MacroActionInfo> &MacroActionFactory::GetMap()
|
||||||
@@ -78,26 +81,32 @@ MacroActionEdit::MacroActionEdit(QWidget *parent,
|
|||||||
std::shared_ptr<MacroAction> *entryData,
|
std::shared_ptr<MacroAction> *entryData,
|
||||||
const std::string &id)
|
const std::string &id)
|
||||||
: MacroSegmentEdit(switcher->macroProperties._highlightActions, parent),
|
: MacroSegmentEdit(switcher->macroProperties._highlightActions, parent),
|
||||||
_actionSelection(new QComboBox()),
|
_actionSelection(new FilterComboBox()),
|
||||||
|
_enable(new SwitchButton()),
|
||||||
_entryData(entryData)
|
_entryData(entryData)
|
||||||
{
|
{
|
||||||
QWidget::connect(_actionSelection,
|
QWidget::connect(_actionSelection,
|
||||||
SIGNAL(currentTextChanged(const QString &)), this,
|
SIGNAL(currentTextChanged(const QString &)), this,
|
||||||
SLOT(ActionSelectionChanged(const QString &)));
|
SLOT(ActionSelectionChanged(const QString &)));
|
||||||
|
QWidget::connect(_enable, SIGNAL(checked(bool)), this,
|
||||||
|
SLOT(ActionEnableChanged(bool)));
|
||||||
QWidget::connect(window(), SIGNAL(HighlightActionsChanged(bool)), this,
|
QWidget::connect(window(), SIGNAL(HighlightActionsChanged(bool)), this,
|
||||||
SLOT(EnableHighlight(bool)));
|
SLOT(EnableHighlight(bool)));
|
||||||
|
QWidget::connect(&_actionStateTimer, SIGNAL(timeout()), this,
|
||||||
|
SLOT(UpdateActionState()));
|
||||||
|
|
||||||
populateActionSelection(_actionSelection);
|
populateActionSelection(_actionSelection);
|
||||||
|
|
||||||
|
_section->AddHeaderWidget(_enable);
|
||||||
_section->AddHeaderWidget(_actionSelection);
|
_section->AddHeaderWidget(_actionSelection);
|
||||||
_section->AddHeaderWidget(_headerInfo);
|
_section->AddHeaderWidget(_headerInfo);
|
||||||
|
|
||||||
QVBoxLayout *actionLayout = new QVBoxLayout;
|
auto actionLayout = new QVBoxLayout;
|
||||||
actionLayout->setContentsMargins({7, 7, 7, 7});
|
actionLayout->setContentsMargins({7, 7, 7, 7});
|
||||||
actionLayout->addWidget(_section);
|
actionLayout->addWidget(_section);
|
||||||
_contentLayout->addLayout(actionLayout);
|
_contentLayout->addLayout(actionLayout);
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
auto mainLayout = new QHBoxLayout;
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
mainLayout->addWidget(_frame);
|
mainLayout->addWidget(_frame);
|
||||||
@@ -106,6 +115,7 @@ MacroActionEdit::MacroActionEdit(QWidget *parent,
|
|||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
UpdateEntryData(id);
|
UpdateEntryData(id);
|
||||||
|
|
||||||
|
_actionStateTimer.start(300);
|
||||||
_loading = false;
|
_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,15 +125,20 @@ void MacroActionEdit::ActionSelectionChanged(const QString &text)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string id = MacroActionFactory::GetIdByName(text);
|
||||||
|
if (id.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeaderInfoChanged("");
|
||||||
auto idx = _entryData->get()->GetIndex();
|
auto idx = _entryData->get()->GetIndex();
|
||||||
auto macro = _entryData->get()->GetMacro();
|
auto macro = _entryData->get()->GetMacro();
|
||||||
std::string id = MacroActionFactory::GetIdByName(text);
|
|
||||||
HeaderInfoChanged("");
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->reset();
|
_entryData->reset();
|
||||||
*_entryData = MacroActionFactory::Create(id, macro);
|
*_entryData = MacroActionFactory::Create(id, macro);
|
||||||
(*_entryData)->SetIndex(idx);
|
(*_entryData)->SetIndex(idx);
|
||||||
|
(*_entryData)->PostLoad();
|
||||||
}
|
}
|
||||||
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
||||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||||
@@ -136,6 +151,9 @@ void MacroActionEdit::UpdateEntryData(const std::string &id)
|
|||||||
{
|
{
|
||||||
_actionSelection->setCurrentText(
|
_actionSelection->setCurrentText(
|
||||||
obs_module_text(MacroActionFactory::GetActionName(id).c_str()));
|
obs_module_text(MacroActionFactory::GetActionName(id).c_str()));
|
||||||
|
const bool enabled = (*_entryData)->Enabled();
|
||||||
|
_enable->setChecked(enabled);
|
||||||
|
SetDisableEffect(!enabled);
|
||||||
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
||||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||||
this, SLOT(HeaderInfoChanged(const QString &)));
|
this, SLOT(HeaderInfoChanged(const QString &)));
|
||||||
@@ -150,7 +168,44 @@ void MacroActionEdit::SetEntryData(std::shared_ptr<MacroAction> *data)
|
|||||||
_entryData = data;
|
_entryData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<MacroSegment> MacroActionEdit::Data()
|
void MacroActionEdit::SetDisableEffect(bool value)
|
||||||
|
{
|
||||||
|
if (value) {
|
||||||
|
auto effect = new QGraphicsOpacityEffect(this);
|
||||||
|
effect->setOpacity(0.5);
|
||||||
|
_section->setGraphicsEffect(effect);
|
||||||
|
} else {
|
||||||
|
_section->setGraphicsEffect(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionEdit::ActionEnableChanged(bool value)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
(*_entryData)->SetEnabled(value);
|
||||||
|
SetDisableEffect(!value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionEdit::UpdateActionState()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetEnableAppearance((*_entryData)->Enabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionEdit::SetEnableAppearance(bool value)
|
||||||
|
{
|
||||||
|
_enable->setChecked(value);
|
||||||
|
SetDisableEffect(!value);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<MacroSegment> MacroActionEdit::Data() const
|
||||||
{
|
{
|
||||||
return *_entryData;
|
return *_entryData;
|
||||||
}
|
}
|
||||||
@@ -182,10 +237,11 @@ void AdvSceneSwitcher::AddMacroAction(int idx)
|
|||||||
auto data = obs_data_create();
|
auto data = obs_data_create();
|
||||||
macro->Actions().at(idx - 1)->Save(data);
|
macro->Actions().at(idx - 1)->Save(data);
|
||||||
macro->Actions().at(idx)->Load(data);
|
macro->Actions().at(idx)->Load(data);
|
||||||
|
macro->Actions().at(idx)->PostLoad();
|
||||||
obs_data_release(data);
|
obs_data_release(data);
|
||||||
}
|
}
|
||||||
macro->UpdateActionIndices();
|
macro->UpdateActionIndices();
|
||||||
actionsList->Insert(
|
ui->actionsList->Insert(
|
||||||
idx,
|
idx,
|
||||||
new MacroActionEdit(this, ¯o->Actions()[idx], id));
|
new MacroActionEdit(this, ¯o->Actions()[idx], id));
|
||||||
SetActionData(*macro);
|
SetActionData(*macro);
|
||||||
@@ -209,7 +265,7 @@ void AdvSceneSwitcher::on_actionAdd_clicked()
|
|||||||
if (currentActionIdx != -1) {
|
if (currentActionIdx != -1) {
|
||||||
MacroActionSelectionChanged(currentActionIdx + 1);
|
MacroActionSelectionChanged(currentActionIdx + 1);
|
||||||
}
|
}
|
||||||
actionsList->SetHelpMsgVisible(false);
|
ui->actionsList->SetHelpMsgVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::RemoveMacroAction(int idx)
|
void AdvSceneSwitcher::RemoveMacroAction(int idx)
|
||||||
@@ -225,7 +281,7 @@ void AdvSceneSwitcher::RemoveMacroAction(int idx)
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
actionsList->Remove(idx);
|
ui->actionsList->Remove(idx);
|
||||||
macro->Actions().erase(macro->Actions().begin() + idx);
|
macro->Actions().erase(macro->Actions().begin() + idx);
|
||||||
switcher->abortMacroWait = true;
|
switcher->abortMacroWait = true;
|
||||||
switcher->macroWaitCv.notify_all();
|
switcher->macroWaitCv.notify_all();
|
||||||
@@ -251,23 +307,115 @@ void AdvSceneSwitcher::on_actionRemove_clicked()
|
|||||||
MacroActionSelectionChanged(-1);
|
MacroActionSelectionChanged(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionUp_clicked()
|
void AdvSceneSwitcher::on_actionTop_clicked()
|
||||||
{
|
{
|
||||||
if (currentActionIdx == -1) {
|
if (currentActionIdx == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
MacroActionReorder(0, currentActionIdx);
|
||||||
|
MacroActionSelectionChanged(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::on_actionUp_clicked()
|
||||||
|
{
|
||||||
|
if (currentActionIdx == -1 || currentActionIdx == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
MoveMacroActionUp(currentActionIdx);
|
MoveMacroActionUp(currentActionIdx);
|
||||||
MacroActionSelectionChanged(currentActionIdx - 1);
|
MacroActionSelectionChanged(currentActionIdx - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_actionDown_clicked()
|
void AdvSceneSwitcher::on_actionDown_clicked()
|
||||||
{
|
{
|
||||||
if (currentActionIdx == -1) {
|
if (currentActionIdx == -1 ||
|
||||||
|
currentActionIdx == ui->actionsList->ContentLayout()->count() - 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MoveMacroActionDown(currentActionIdx);
|
MoveMacroActionDown(currentActionIdx);
|
||||||
MacroActionSelectionChanged(currentActionIdx + 1);
|
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);
|
||||||
|
}
|
||||||
|
ui->elseActionsList->SetHelpMsgVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::on_elseActionRemove_clicked()
|
||||||
|
{
|
||||||
|
if (currentElseActionIdx == -1) {
|
||||||
|
auto macro = GetSelectedMacro();
|
||||||
|
if (!macro) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RemoveMacroElseAction((int)macro->Actions().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)
|
void AdvSceneSwitcher::SwapActions(Macro *m, int pos1, int pos2)
|
||||||
{
|
{
|
||||||
if (pos1 == pos2) {
|
if (pos1 == pos2) {
|
||||||
@@ -281,11 +429,11 @@ void AdvSceneSwitcher::SwapActions(Macro *m, int pos1, int pos2)
|
|||||||
iter_swap(m->Actions().begin() + pos1, m->Actions().begin() + pos2);
|
iter_swap(m->Actions().begin() + pos1, m->Actions().begin() + pos2);
|
||||||
m->UpdateActionIndices();
|
m->UpdateActionIndices();
|
||||||
auto widget1 = static_cast<MacroActionEdit *>(
|
auto widget1 = static_cast<MacroActionEdit *>(
|
||||||
actionsList->ContentLayout()->takeAt(pos1)->widget());
|
ui->actionsList->ContentLayout()->takeAt(pos1)->widget());
|
||||||
auto widget2 = static_cast<MacroActionEdit *>(
|
auto widget2 = static_cast<MacroActionEdit *>(
|
||||||
actionsList->ContentLayout()->takeAt(pos2 - 1)->widget());
|
ui->actionsList->ContentLayout()->takeAt(pos2 - 1)->widget());
|
||||||
actionsList->Insert(pos1, widget2);
|
ui->actionsList->Insert(pos1, widget2);
|
||||||
actionsList->Insert(pos2, widget1);
|
ui->actionsList->Insert(pos2, widget1);
|
||||||
SetActionData(*m);
|
SetActionData(*m);
|
||||||
emit(MacroSegmentOrderChanged());
|
emit(MacroSegmentOrderChanged());
|
||||||
}
|
}
|
||||||
@@ -320,24 +468,159 @@ void AdvSceneSwitcher::MoveMacroActionDown(int idx)
|
|||||||
HighlightAction(idx + 1);
|
HighlightAction(idx + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroActionSelectionChanged(int idx)
|
void AdvSceneSwitcher::MacroElseActionSelectionChanged(int idx)
|
||||||
|
{
|
||||||
|
SetupMacroSegmentSelection(MacroSection::ELSE_ACTIONS, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::MacroElseActionReorder(int to, int from)
|
||||||
{
|
{
|
||||||
auto macro = GetSelectedMacro();
|
auto macro = GetSelectedMacro();
|
||||||
if (!macro) {
|
if (!macro) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
actionsList->SetSelection(idx);
|
if (to == from || from < 0 || from > (int)macro->ElseActions().size() ||
|
||||||
conditionsList->SetSelection(-1);
|
to < 0 || to > (int)macro->ElseActions().size()) {
|
||||||
|
return;
|
||||||
if (idx < 0 || (unsigned)idx >= macro->Actions().size()) {
|
|
||||||
currentActionIdx = -1;
|
|
||||||
} else {
|
|
||||||
currentActionIdx = idx;
|
|
||||||
lastInteracted = MacroSection::ACTIONS;
|
|
||||||
}
|
}
|
||||||
currentConditionIdx = -1;
|
{
|
||||||
HighlightControls();
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
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(int idx)
|
||||||
|
{
|
||||||
|
auto macro = GetSelectedMacro();
|
||||||
|
if (!macro) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idx < 0 || idx > (int)macro->ElseActions().size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string id;
|
||||||
|
if (idx - 1 >= 0) {
|
||||||
|
id = macro->ElseActions().at(idx - 1)->GetId();
|
||||||
|
} else {
|
||||||
|
MacroActionSwitchScene temp(nullptr);
|
||||||
|
id = temp.GetId();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
macro->ElseActions().emplace(
|
||||||
|
macro->ElseActions().begin() + idx,
|
||||||
|
MacroActionFactory::Create(id, macro.get()));
|
||||||
|
if (idx - 1 >= 0) {
|
||||||
|
OBSDataAutoRelease data = obs_data_create();
|
||||||
|
macro->ElseActions().at(idx - 1)->Save(data);
|
||||||
|
macro->ElseActions().at(idx)->Load(data);
|
||||||
|
}
|
||||||
|
macro->ElseActions().at(idx)->PostLoad();
|
||||||
|
macro->UpdateElseActionIndices();
|
||||||
|
ui->elseActionsList->Insert(
|
||||||
|
idx, new MacroActionEdit(
|
||||||
|
this, ¯o->ElseActions()[idx], id));
|
||||||
|
SetElseActionData(*macro);
|
||||||
|
}
|
||||||
|
HighlightElseAction(idx);
|
||||||
|
emit(MacroSegmentOrderChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::RemoveMacroElseAction(int idx)
|
||||||
|
{
|
||||||
|
auto macro = GetSelectedMacro();
|
||||||
|
if (!macro) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idx < 0 || idx >= (int)macro->ElseActions().size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
ui->elseActionsList->Remove(idx);
|
||||||
|
macro->ElseActions().erase(macro->ElseActions().begin() + idx);
|
||||||
|
switcher->abortMacroWait = true;
|
||||||
|
switcher->macroWaitCv.notify_all();
|
||||||
|
macro->UpdateElseActionIndices();
|
||||||
|
SetActionData(*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);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
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)
|
void AdvSceneSwitcher::MacroActionReorder(int to, int from)
|
||||||
@@ -347,8 +630,8 @@ void AdvSceneSwitcher::MacroActionReorder(int to, int from)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from < 0 || from > (int)macro->Actions().size() || to < 0 ||
|
if (to == from || from < 0 || from > (int)macro->Actions().size() ||
|
||||||
to > (int)macro->Actions().size()) {
|
to < 0 || to > (int)macro->Actions().size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -357,8 +640,8 @@ void AdvSceneSwitcher::MacroActionReorder(int to, int from)
|
|||||||
macro->Actions().erase(macro->Actions().begin() + from);
|
macro->Actions().erase(macro->Actions().begin() + from);
|
||||||
macro->Actions().insert(macro->Actions().begin() + to, action);
|
macro->Actions().insert(macro->Actions().begin() + to, action);
|
||||||
macro->UpdateActionIndices();
|
macro->UpdateActionIndices();
|
||||||
actionsList->ContentLayout()->insertItem(
|
ui->actionsList->ContentLayout()->insertItem(
|
||||||
to, actionsList->ContentLayout()->takeAt(from));
|
to, ui->actionsList->ContentLayout()->takeAt(from));
|
||||||
SetActionData(*macro);
|
SetActionData(*macro);
|
||||||
}
|
}
|
||||||
HighlightAction(to);
|
HighlightAction(to);
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action.hpp"
|
#include "macro-action.hpp"
|
||||||
|
#include "filter-combo-box.hpp"
|
||||||
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
|
class SwitchButton;
|
||||||
|
|
||||||
struct MacroActionInfo {
|
struct MacroActionInfo {
|
||||||
using TCreateMethod = std::shared_ptr<MacroAction> (*)(Macro *m);
|
using TCreateMethod = std::shared_ptr<MacroAction> (*)(Macro *m);
|
||||||
using TCreateWidgetMethod = QWidget *(*)(QWidget *parent,
|
using TCreateWidgetMethod = QWidget *(*)(QWidget *parent,
|
||||||
@@ -44,13 +46,19 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ActionSelectionChanged(const QString &text);
|
void ActionSelectionChanged(const QString &text);
|
||||||
|
void ActionEnableChanged(bool);
|
||||||
|
void UpdateActionState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<MacroSegment> Data();
|
std::shared_ptr<MacroSegment> Data() const;
|
||||||
|
void SetDisableEffect(bool);
|
||||||
|
void SetEnableAppearance(bool);
|
||||||
|
|
||||||
QComboBox *_actionSelection;
|
FilterComboBox *_actionSelection;
|
||||||
|
SwitchButton *_enable;
|
||||||
|
|
||||||
std::shared_ptr<MacroAction> *_entryData;
|
std::shared_ptr<MacroAction> *_entryData;
|
||||||
|
QTimer _actionStateTimer;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,27 +15,75 @@ const static std::map<MacroActionFilter::Action, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.filter.type.enable"},
|
"AdvSceneSwitcher.action.filter.type.enable"},
|
||||||
{MacroActionFilter::Action::DISABLE,
|
{MacroActionFilter::Action::DISABLE,
|
||||||
"AdvSceneSwitcher.action.filter.type.disable"},
|
"AdvSceneSwitcher.action.filter.type.disable"},
|
||||||
|
{MacroActionFilter::Action::TOGGLE,
|
||||||
|
"AdvSceneSwitcher.action.filter.type.toggle"},
|
||||||
{MacroActionFilter::Action::SETTINGS,
|
{MacroActionFilter::Action::SETTINGS,
|
||||||
"AdvSceneSwitcher.action.filter.type.settings"},
|
"AdvSceneSwitcher.action.filter.type.settings"},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MacroActionFilter::PerformAction()
|
const static std::map<MacroActionFilter::SettingsInputMethod, std::string>
|
||||||
|
inputMethods = {
|
||||||
|
{MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL,
|
||||||
|
"AdvSceneSwitcher.action.filter.inputMethod.individualManual"},
|
||||||
|
{MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR,
|
||||||
|
"AdvSceneSwitcher.action.filter.inputMethod.individualTempvar"},
|
||||||
|
{MacroActionFilter::SettingsInputMethod::JSON_STRING,
|
||||||
|
"AdvSceneSwitcher.action.filter.inputMethod.json"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static void performActionHelper(
|
||||||
|
MacroActionFilter::Action action, const OBSWeakSource &filter,
|
||||||
|
MacroActionFilter::SettingsInputMethod settingsInputMethod,
|
||||||
|
const SourceSetting &setting, const std::string &manualSettingValue,
|
||||||
|
const TempVariableRef &tempVar, Macro *macro,
|
||||||
|
const StringVariable &settingsString)
|
||||||
{
|
{
|
||||||
auto s = obs_weak_source_get_source(_filter.GetFilter(_source));
|
OBSSourceAutoRelease source = obs_weak_source_get_source(filter);
|
||||||
switch (_action) {
|
switch (action) {
|
||||||
case Action::ENABLE:
|
case MacroActionFilter::Action::ENABLE:
|
||||||
obs_source_set_enabled(s, true);
|
obs_source_set_enabled(source, true);
|
||||||
break;
|
break;
|
||||||
case Action::DISABLE:
|
case MacroActionFilter::Action::DISABLE:
|
||||||
obs_source_set_enabled(s, false);
|
obs_source_set_enabled(source, false);
|
||||||
break;
|
break;
|
||||||
case Action::SETTINGS:
|
case MacroActionFilter::Action::TOGGLE:
|
||||||
SetSourceSettings(s, _settings);
|
obs_source_set_enabled(source, !obs_source_enabled(source));
|
||||||
|
break;
|
||||||
|
case MacroActionFilter::Action::SETTINGS:
|
||||||
|
switch (settingsInputMethod) {
|
||||||
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL:
|
||||||
|
SetSourceSetting(source, setting, manualSettingValue);
|
||||||
|
break;
|
||||||
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR: {
|
||||||
|
auto var = tempVar.GetTempVariable(macro);
|
||||||
|
if (!var) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
auto value = var->Value();
|
||||||
|
if (!value) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SetSourceSetting(source, setting, *value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MacroActionFilter::SettingsInputMethod::JSON_STRING:
|
||||||
|
SetSourceSettings(source, settingsString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
obs_source_release(s);
|
}
|
||||||
|
|
||||||
|
bool MacroActionFilter::PerformAction()
|
||||||
|
{
|
||||||
|
auto filters = _filter.GetFilters(_source);
|
||||||
|
for (const auto &filter : filters) {
|
||||||
|
performActionHelper(_action, filter, _settingsInputMethod,
|
||||||
|
_setting, _manualSettingValue, _tempVar,
|
||||||
|
GetMacro(), _settingsString);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +107,13 @@ bool MacroActionFilter::Save(obs_data_t *obj) const
|
|||||||
_source.Save(obj);
|
_source.Save(obj);
|
||||||
_filter.Save(obj, "filter");
|
_filter.Save(obj, "filter");
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
_settings.Save(obj, "settings");
|
obs_data_set_int(obj, "inputMethod",
|
||||||
|
static_cast<int>(_settingsInputMethod));
|
||||||
|
_setting.Save(obj);
|
||||||
|
_manualSettingValue.Save(obj, "manualSettingValue");
|
||||||
|
_tempVar.Save(obj);
|
||||||
|
_settingsString.Save(obj, "settings");
|
||||||
|
obs_data_set_int(obj, "version", 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +122,28 @@ bool MacroActionFilter::Load(obs_data_t *obj)
|
|||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_source.Load(obj);
|
_source.Load(obj);
|
||||||
_filter.Load(obj, _source, "filter");
|
_filter.Load(obj, _source, "filter");
|
||||||
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
// TODO: Remove this fallback in future version
|
||||||
_settings.Load(obj, "settings");
|
if (!obs_data_has_user_value(obj, "version")) {
|
||||||
|
const auto value = obs_data_get_int(obj, "action");
|
||||||
|
if (value == 2) {
|
||||||
|
_action = Action::SETTINGS;
|
||||||
|
} else {
|
||||||
|
_action = static_cast<Action>(value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
|
}
|
||||||
|
// TODO: Remove fallback in future version
|
||||||
|
if (obs_data_has_user_value(obj, "inputMethod")) {
|
||||||
|
_settingsInputMethod = static_cast<SettingsInputMethod>(
|
||||||
|
obs_data_get_int(obj, "inputMethod"));
|
||||||
|
} else {
|
||||||
|
_settingsInputMethod = SettingsInputMethod::JSON_STRING;
|
||||||
|
}
|
||||||
|
_setting.Load(obj);
|
||||||
|
_settingsString.Load(obj, "settings");
|
||||||
|
_manualSettingValue.Load(obj, "manualSettingValue");
|
||||||
|
_tempVar.Load(obj, GetMacro());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +162,15 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void populateSettingsInputMethods(QComboBox *list)
|
||||||
|
{
|
||||||
|
list->clear();
|
||||||
|
for (const auto &[value, name] : inputMethods) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MacroActionFilterEdit::MacroActionFilterEdit(
|
MacroActionFilterEdit::MacroActionFilterEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionFilter> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionFilter> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
@@ -96,7 +179,12 @@ MacroActionFilterEdit::MacroActionFilterEdit(
|
|||||||
_actions(new QComboBox()),
|
_actions(new QComboBox()),
|
||||||
_getSettings(new QPushButton(obs_module_text(
|
_getSettings(new QPushButton(obs_module_text(
|
||||||
"AdvSceneSwitcher.action.filter.getSettings"))),
|
"AdvSceneSwitcher.action.filter.getSettings"))),
|
||||||
_settings(new VariableTextEdit(this))
|
_settingsLayout(new QHBoxLayout()),
|
||||||
|
_settingsInputMethods(new QComboBox(this)),
|
||||||
|
_manualSettingValue(new VariableTextEdit(this, 5, 1, 1)),
|
||||||
|
_tempVars(new TempVariableSelection(this)),
|
||||||
|
_filterSettings(new SourceSettingSelection(this)),
|
||||||
|
_settingsString(new VariableTextEdit(this))
|
||||||
{
|
{
|
||||||
_filters->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
_filters->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
|
||||||
@@ -105,6 +193,8 @@ MacroActionFilterEdit::MacroActionFilterEdit(
|
|||||||
sources.sort();
|
sources.sort();
|
||||||
_sources->SetSourceNameList(sources);
|
_sources->SetSourceNameList(sources);
|
||||||
|
|
||||||
|
populateSettingsInputMethods(_settingsInputMethods);
|
||||||
|
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ActionChanged(int)));
|
SLOT(ActionChanged(int)));
|
||||||
QWidget::connect(_sources,
|
QWidget::connect(_sources,
|
||||||
@@ -115,27 +205,48 @@ MacroActionFilterEdit::MacroActionFilterEdit(
|
|||||||
SLOT(FilterChanged(const FilterSelection &)));
|
SLOT(FilterChanged(const FilterSelection &)));
|
||||||
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
||||||
SLOT(GetSettingsClicked()));
|
SLOT(GetSettingsClicked()));
|
||||||
QWidget::connect(_settings, SIGNAL(textChanged()), this,
|
QWidget::connect(_settingsString, SIGNAL(textChanged()), this,
|
||||||
SLOT(SettingsChanged()));
|
SLOT(SettingsStringChanged()));
|
||||||
|
QWidget::connect(_tempVars,
|
||||||
|
SIGNAL(SelectionChanged(const TempVariableRef &)),
|
||||||
|
this, SLOT(SelectionChanged(const TempVariableRef &)));
|
||||||
|
QWidget::connect(_settingsInputMethods,
|
||||||
|
SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SettingsInputMethodChanged(int)));
|
||||||
|
QWidget::connect(_manualSettingValue, SIGNAL(textChanged()), this,
|
||||||
|
SLOT(ManualSettingsValueChanged()));
|
||||||
|
QWidget::connect(_filterSettings,
|
||||||
|
SIGNAL(SelectionChanged(const SourceSetting &)), this,
|
||||||
|
SLOT(SelectionChanged(const SourceSetting &)));
|
||||||
|
|
||||||
QHBoxLayout *entryLayout = new QHBoxLayout;
|
auto entrylayout = new QHBoxLayout;
|
||||||
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{sources}}", _sources}, {"{{filters}}", _filters},
|
{"{{sources}}", _sources},
|
||||||
{"{{actions}}", _actions}, {"{{settings}}", _settings},
|
{"{{filters}}", _filters},
|
||||||
|
{"{{actions}}", _actions},
|
||||||
|
{"{{settings}}", _filterSettings},
|
||||||
|
{"{{settingsInputMethod}}", _settingsInputMethods},
|
||||||
|
{"{{settingValue}}", _manualSettingValue},
|
||||||
|
{"{{tempVar}}", _tempVars},
|
||||||
{"{{getSettings}}", _getSettings},
|
{"{{getSettings}}", _getSettings},
|
||||||
};
|
};
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.filter.entry"),
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.filter.entry"),
|
||||||
entryLayout, widgetPlaceholders);
|
entrylayout, widgetPlaceholders);
|
||||||
|
_settingsLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
PlaceWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.filter.entry.settings"),
|
||||||
|
_settingsLayout, widgetPlaceholders);
|
||||||
|
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
auto buttonLayout = new QHBoxLayout;
|
||||||
buttonLayout->addWidget(_getSettings);
|
buttonLayout->addWidget(_getSettings);
|
||||||
buttonLayout->addStretch();
|
buttonLayout->addStretch();
|
||||||
buttonLayout->setContentsMargins(0, 0, 0, 0);
|
buttonLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
auto mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(entryLayout);
|
mainLayout->addLayout(entrylayout);
|
||||||
mainLayout->addWidget(_settings);
|
mainLayout->addLayout(_settingsLayout);
|
||||||
|
mainLayout->addWidget(_settingsString);
|
||||||
mainLayout->addLayout(buttonLayout);
|
mainLayout->addLayout(buttonLayout);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
@@ -153,12 +264,16 @@ void MacroActionFilterEdit::UpdateEntryData()
|
|||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
_sources->SetSource(_entryData->_source);
|
_sources->SetSource(_entryData->_source);
|
||||||
_filters->SetFilter(_entryData->_source, _entryData->_filter);
|
_filters->SetFilter(_entryData->_source, _entryData->_filter);
|
||||||
_settings->setPlainText(_entryData->_settings);
|
_settingsString->setPlainText(_entryData->_settingsString);
|
||||||
SetWidgetVisibility(_entryData->_action ==
|
const auto filters =
|
||||||
MacroActionFilter::Action::SETTINGS);
|
_entryData->_filter.GetFilters(_entryData->_source);
|
||||||
|
_filterSettings->SetSource(filters.empty() ? nullptr : filters.at(0));
|
||||||
adjustSize();
|
_filterSettings->SetSetting(_entryData->_setting);
|
||||||
updateGeometry();
|
_settingsInputMethods->setCurrentIndex(_settingsInputMethods->findData(
|
||||||
|
static_cast<int>(_entryData->_settingsInputMethod)));
|
||||||
|
_tempVars->SetVariable(_entryData->_tempVar);
|
||||||
|
_manualSettingValue->setPlainText(_entryData->_manualSettingValue);
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionFilterEdit::SourceChanged(const SourceSelection &source)
|
void MacroActionFilterEdit::SourceChanged(const SourceSelection &source)
|
||||||
@@ -177,8 +292,13 @@ void MacroActionFilterEdit::FilterChanged(const FilterSelection &filter)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
{
|
||||||
_entryData->_filter = filter;
|
auto lock = LockContext();
|
||||||
|
_entryData->_filter = filter;
|
||||||
|
}
|
||||||
|
const auto filters =
|
||||||
|
_entryData->_filter.GetFilters(_entryData->_source);
|
||||||
|
_filterSettings->SetSource(filters.empty() ? nullptr : filters.at(0));
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
@@ -191,38 +311,130 @@ void MacroActionFilterEdit::ActionChanged(int value)
|
|||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_action = static_cast<MacroActionFilter::Action>(value);
|
_entryData->_action = static_cast<MacroActionFilter::Action>(value);
|
||||||
SetWidgetVisibility(_entryData->_action ==
|
SetWidgetVisibility();
|
||||||
MacroActionFilter::Action::SETTINGS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionFilterEdit::GetSettingsClicked()
|
void MacroActionFilterEdit::GetSettingsClicked()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData ||
|
if (_loading || !_entryData ||
|
||||||
!_entryData->_filter.GetFilter(_entryData->_source)) {
|
_entryData->_filter.GetFilters(_entryData->_source).empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_settings->setPlainText(FormatJsonString(GetSourceSettings(
|
switch (_entryData->_settingsInputMethod) {
|
||||||
_entryData->_filter.GetFilter(_entryData->_source))));
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL: {
|
||||||
|
const auto filters =
|
||||||
|
_entryData->_filter.GetFilters(_entryData->_source);
|
||||||
|
_manualSettingValue->setPlainText(GetSourceSettingValue(
|
||||||
|
filters.empty() ? nullptr : filters.at(0),
|
||||||
|
_entryData->_setting));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR:
|
||||||
|
break;
|
||||||
|
case MacroActionFilter::SettingsInputMethod::JSON_STRING: {
|
||||||
|
const auto filters =
|
||||||
|
_entryData->_filter.GetFilters(_entryData->_source);
|
||||||
|
_settingsString->setPlainText(
|
||||||
|
FormatJsonString(GetSourceSettings(
|
||||||
|
filters.empty() ? nullptr : filters.at(0))));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionFilterEdit::SettingsChanged()
|
void MacroActionFilterEdit::SettingsStringChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_settings = _settings->toPlainText().toStdString();
|
_entryData->_settingsString =
|
||||||
|
_settingsString->toPlainText().toStdString();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionFilterEdit::SetWidgetVisibility(bool showSettings)
|
void MacroActionFilterEdit::SettingsInputMethodChanged(int idx)
|
||||||
{
|
{
|
||||||
_settings->setVisible(showSettings);
|
if (_loading || !_entryData) {
|
||||||
_getSettings->setVisible(showSettings);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_settingsInputMethod =
|
||||||
|
static_cast<MacroActionFilter::SettingsInputMethod>(
|
||||||
|
_settingsInputMethods->itemData(idx).toInt());
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionFilterEdit::SelectionChanged(const TempVariableRef &var)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_tempVar = var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionFilterEdit::SelectionChanged(const SourceSetting &setting)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_setting = setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionFilterEdit::ManualSettingsValueChanged()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_manualSettingValue =
|
||||||
|
_manualSettingValue->toPlainText().toStdString();
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionFilterEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
SetLayoutVisible(_settingsLayout,
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionFilter::Action::SETTINGS);
|
||||||
|
_filterSettings->setVisible(
|
||||||
|
_entryData->_action == MacroActionFilter::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod !=
|
||||||
|
MacroActionFilter::SettingsInputMethod::JSON_STRING);
|
||||||
|
_settingsString->setVisible(
|
||||||
|
_entryData->_action == MacroActionFilter::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionFilter::SettingsInputMethod::JSON_STRING);
|
||||||
|
_getSettings->setVisible(_entryData->_action ==
|
||||||
|
MacroActionFilter::Action::SETTINGS);
|
||||||
|
_tempVars->setVisible(_entryData->_action ==
|
||||||
|
MacroActionFilter::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionFilter::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_TEMPVAR);
|
||||||
|
|
||||||
|
if (_entryData->_action == MacroActionFilter::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL) {
|
||||||
|
RemoveStretchIfPresent(_settingsLayout);
|
||||||
|
_manualSettingValue->show();
|
||||||
|
} else {
|
||||||
|
AddStretchIfNecessary(_settingsLayout);
|
||||||
|
_manualSettingValue->hide();
|
||||||
|
}
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "variable-text-edit.hpp"
|
#include "variable-text-edit.hpp"
|
||||||
#include "source-selection.hpp"
|
#include "source-selection.hpp"
|
||||||
#include "filter-selection.hpp"
|
#include "filter-selection.hpp"
|
||||||
|
#include "source-setting.hpp"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
@@ -27,13 +28,25 @@ public:
|
|||||||
enum class Action {
|
enum class Action {
|
||||||
ENABLE,
|
ENABLE,
|
||||||
DISABLE,
|
DISABLE,
|
||||||
|
TOGGLE,
|
||||||
SETTINGS,
|
SETTINGS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class SettingsInputMethod {
|
||||||
|
INDIVIDUAL_MANUAL,
|
||||||
|
INDIVIDUAL_TEMPVAR,
|
||||||
|
JSON_STRING,
|
||||||
|
};
|
||||||
|
SettingsInputMethod _settingsInputMethod =
|
||||||
|
SettingsInputMethod::INDIVIDUAL_MANUAL;
|
||||||
|
|
||||||
SourceSelection _source;
|
SourceSelection _source;
|
||||||
FilterSelection _filter;
|
FilterSelection _filter;
|
||||||
Action _action = Action::ENABLE;
|
Action _action = Action::ENABLE;
|
||||||
StringVariable _settings = "";
|
StringVariable _settingsString = "";
|
||||||
|
TempVariableRef _tempVar;
|
||||||
|
StringVariable _manualSettingValue = "";
|
||||||
|
SourceSetting _setting;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
@@ -61,7 +74,11 @@ private slots:
|
|||||||
void FilterChanged(const FilterSelection &);
|
void FilterChanged(const FilterSelection &);
|
||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
void GetSettingsClicked();
|
void GetSettingsClicked();
|
||||||
void SettingsChanged();
|
void SettingsStringChanged();
|
||||||
|
void SettingsInputMethodChanged(int);
|
||||||
|
void SelectionChanged(const TempVariableRef &);
|
||||||
|
void SelectionChanged(const SourceSetting &);
|
||||||
|
void ManualSettingsValueChanged();
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
@@ -70,11 +87,17 @@ protected:
|
|||||||
FilterSelectionWidget *_filters;
|
FilterSelectionWidget *_filters;
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
QPushButton *_getSettings;
|
QPushButton *_getSettings;
|
||||||
VariableTextEdit *_settings;
|
QHBoxLayout *_settingsLayout;
|
||||||
|
QComboBox *_settingsInputMethods;
|
||||||
|
VariableTextEdit *_manualSettingValue;
|
||||||
|
TempVariableSelection *_tempVars;
|
||||||
|
SourceSettingSelection *_filterSettings;
|
||||||
|
VariableTextEdit *_settingsString;
|
||||||
|
|
||||||
std::shared_ptr<MacroActionFilter> _entryData;
|
std::shared_ptr<MacroActionFilter> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWidgetVisibility(bool);
|
void SetWidgetVisibility();
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "platform-funcs.hpp"
|
#include "platform-funcs.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
#include <obs-interaction.h>
|
#include <obs-interaction.h>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
@@ -13,6 +14,26 @@ bool MacroActionHotkey::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionHotkey::Create, MacroActionHotkeyEdit::Create,
|
{MacroActionHotkey::Create, MacroActionHotkeyEdit::Create,
|
||||||
"AdvSceneSwitcher.action.hotkey"});
|
"AdvSceneSwitcher.action.hotkey"});
|
||||||
|
|
||||||
|
const static std::map<MacroActionHotkey::Action, std::string> actionTypes = {
|
||||||
|
{MacroActionHotkey::Action::OBS_HOTKEY,
|
||||||
|
"AdvSceneSwitcher.action.hotkey.type.obs"},
|
||||||
|
{MacroActionHotkey::Action::CUSTOM,
|
||||||
|
"AdvSceneSwitcher.action.hotkey.type.custom"},
|
||||||
|
};
|
||||||
|
|
||||||
|
const static std::map<obs_hotkey_registerer_type, std::string> hotkeyTypes = {
|
||||||
|
{OBS_HOTKEY_REGISTERER_FRONTEND,
|
||||||
|
"AdvSceneSwitcher.action.hotkey.type.obs.type.frontend"},
|
||||||
|
{OBS_HOTKEY_REGISTERER_SOURCE,
|
||||||
|
"AdvSceneSwitcher.action.hotkey.type.obs.type.soruce"},
|
||||||
|
{OBS_HOTKEY_REGISTERER_OUTPUT,
|
||||||
|
"AdvSceneSwitcher.action.hotkey.type.obs.type.output"},
|
||||||
|
{OBS_HOTKEY_REGISTERER_ENCODER,
|
||||||
|
"AdvSceneSwitcher.action.hotkey.type.obs.type.encoder"},
|
||||||
|
{OBS_HOTKEY_REGISTERER_SERVICE,
|
||||||
|
"AdvSceneSwitcher.action.hotkey.type.obs.type.service"},
|
||||||
|
};
|
||||||
|
|
||||||
static std::unordered_map<HotkeyType, long> keyTable = {
|
static std::unordered_map<HotkeyType, long> keyTable = {
|
||||||
// Chars
|
// Chars
|
||||||
{HotkeyType::Key_A, OBS_KEY_A},
|
{HotkeyType::Key_A, OBS_KEY_A},
|
||||||
@@ -196,7 +217,92 @@ static void InjectKeys(const std::vector<HotkeyType> &keys, int duration)
|
|||||||
obs_hotkey_inject_event(combo, false);
|
obs_hotkey_inject_event(combo, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionHotkey::PerformAction()
|
static void addNamePrefix(std::string &name, obs_hotkey_t *hotkey)
|
||||||
|
{
|
||||||
|
const auto type = obs_hotkey_get_registerer_type(hotkey);
|
||||||
|
std::string prefix;
|
||||||
|
if (type == OBS_HOTKEY_REGISTERER_SOURCE) {
|
||||||
|
auto source = reinterpret_cast<obs_weak_source_t *>(
|
||||||
|
obs_hotkey_get_registerer(hotkey));
|
||||||
|
prefix = "[" + GetWeakSourceName(source) + "] ";
|
||||||
|
} else if (type == OBS_HOTKEY_REGISTERER_OUTPUT) {
|
||||||
|
auto weakOutput = reinterpret_cast<obs_weak_output_t *>(
|
||||||
|
obs_hotkey_get_registerer(hotkey));
|
||||||
|
std::string name;
|
||||||
|
auto output = obs_weak_output_get_output(weakOutput);
|
||||||
|
if (output) {
|
||||||
|
name = obs_output_get_name(output);
|
||||||
|
obs_output_release(output);
|
||||||
|
}
|
||||||
|
prefix = "[" + name + "] ";
|
||||||
|
} else if (type == OBS_HOTKEY_REGISTERER_ENCODER) {
|
||||||
|
auto weakEncoder = reinterpret_cast<obs_weak_encoder_t *>(
|
||||||
|
obs_hotkey_get_registerer(hotkey));
|
||||||
|
std::string name;
|
||||||
|
auto encoder = obs_weak_encoder_get_encoder(weakEncoder);
|
||||||
|
if (encoder) {
|
||||||
|
name = obs_encoder_get_name(encoder);
|
||||||
|
obs_encoder_release(encoder);
|
||||||
|
}
|
||||||
|
prefix = "[" + name + "] ";
|
||||||
|
} else if (type == OBS_HOTKEY_REGISTERER_SERVICE) {
|
||||||
|
auto weakService = reinterpret_cast<obs_weak_service_t *>(
|
||||||
|
obs_hotkey_get_registerer(hotkey));
|
||||||
|
std::string name;
|
||||||
|
auto service = obs_weak_service_get_service(weakService);
|
||||||
|
if (service) {
|
||||||
|
name = obs_service_get_name(service);
|
||||||
|
obs_service_release(service);
|
||||||
|
}
|
||||||
|
prefix = "[" + name + "] ";
|
||||||
|
}
|
||||||
|
name = prefix + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
static obs_hotkey_id getHotkeyIdByName(const std::string &name)
|
||||||
|
{
|
||||||
|
struct Parameters {
|
||||||
|
std::string name;
|
||||||
|
obs_hotkey_id id = OBS_INVALID_HOTKEY_ID;
|
||||||
|
} params;
|
||||||
|
|
||||||
|
auto func = [](void *param, obs_hotkey_id id, obs_hotkey_t *hotkey) {
|
||||||
|
auto params = static_cast<Parameters *>(param);
|
||||||
|
std::string name = obs_hotkey_get_name(hotkey);
|
||||||
|
addNamePrefix(name, hotkey);
|
||||||
|
if (name == params->name) {
|
||||||
|
params->id = id;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
params.name = name;
|
||||||
|
obs_enum_hotkeys(func, ¶ms);
|
||||||
|
return params.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionHotkey::SendOBSHotkey()
|
||||||
|
{
|
||||||
|
auto id = getHotkeyIdByName(_hotkeyName);
|
||||||
|
if (id == OBS_INVALID_HOTKEY_ID) {
|
||||||
|
blog(LOG_WARNING,
|
||||||
|
"failed to get hotkey id for \"%s\" - key will not be pressed",
|
||||||
|
_hotkeyName.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obs_queue_task(
|
||||||
|
OBS_TASK_UI,
|
||||||
|
[](void *param) {
|
||||||
|
auto id = (size_t *)param;
|
||||||
|
obs_hotkey_trigger_routed_callback(*id, false);
|
||||||
|
obs_hotkey_trigger_routed_callback(*id, true);
|
||||||
|
obs_hotkey_trigger_routed_callback(*id, false);
|
||||||
|
},
|
||||||
|
&id, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionHotkey::SendCustomHotkey()
|
||||||
{
|
{
|
||||||
std::vector<HotkeyType> keys;
|
std::vector<HotkeyType> keys;
|
||||||
if (_leftShift) {
|
if (_leftShift) {
|
||||||
@@ -237,18 +343,35 @@ bool MacroActionHotkey::PerformAction()
|
|||||||
t.detach();
|
t.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionHotkey::PerformAction()
|
||||||
|
{
|
||||||
|
switch (_action) {
|
||||||
|
case advss::MacroActionHotkey::Action::OBS_HOTKEY:
|
||||||
|
SendOBSHotkey();
|
||||||
|
break;
|
||||||
|
case advss::MacroActionHotkey::Action::CUSTOM:
|
||||||
|
SendCustomHotkey();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkey::LogAction() const
|
void MacroActionHotkey::LogAction() const
|
||||||
{
|
{
|
||||||
vblog(LOG_INFO, "sent hotkey");
|
vblog(LOG_INFO, "sent hotkey type %d", static_cast<int>(_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionHotkey::Save(obs_data_t *obj) const
|
bool MacroActionHotkey::Save(obs_data_t *obj) const
|
||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
|
obs_data_set_int(obj, "hotkeyType", _hotkeyType);
|
||||||
|
obs_data_set_string(obj, "hotkeyName", _hotkeyName.c_str());
|
||||||
obs_data_set_int(obj, "key", static_cast<int>(_key));
|
obs_data_set_int(obj, "key", static_cast<int>(_key));
|
||||||
obs_data_set_bool(obj, "left_shift", _leftShift);
|
obs_data_set_bool(obj, "left_shift", _leftShift);
|
||||||
obs_data_set_bool(obj, "right_shift", _rightShift);
|
obs_data_set_bool(obj, "right_shift", _rightShift);
|
||||||
@@ -260,13 +383,22 @@ bool MacroActionHotkey::Save(obs_data_t *obj) const
|
|||||||
obs_data_set_bool(obj, "right_meta", _rightMeta);
|
obs_data_set_bool(obj, "right_meta", _rightMeta);
|
||||||
_duration.Save(obj);
|
_duration.Save(obj);
|
||||||
obs_data_set_bool(obj, "onlyOBS", _onlySendToObs);
|
obs_data_set_bool(obj, "onlyOBS", _onlySendToObs);
|
||||||
obs_data_set_int(obj, "version", 1);
|
obs_data_set_int(obj, "version", 2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionHotkey::Load(obs_data_t *obj)
|
bool MacroActionHotkey::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
|
int version = obs_data_get_int(obj, "version");
|
||||||
|
if (version != 2) {
|
||||||
|
_action = Action::CUSTOM;
|
||||||
|
} else {
|
||||||
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
|
}
|
||||||
|
_hotkeyType = static_cast<obs_hotkey_registerer_type>(
|
||||||
|
obs_data_get_int(obj, "hotkeyType"));
|
||||||
|
_hotkeyName = obs_data_get_string(obj, "hotkeyName");
|
||||||
_key = static_cast<HotkeyType>(obs_data_get_int(obj, "key"));
|
_key = static_cast<HotkeyType>(obs_data_get_int(obj, "key"));
|
||||||
_leftShift = obs_data_get_bool(obj, "left_shift");
|
_leftShift = obs_data_get_bool(obj, "left_shift");
|
||||||
_rightShift = obs_data_get_bool(obj, "right_shift");
|
_rightShift = obs_data_get_bool(obj, "right_shift");
|
||||||
@@ -276,7 +408,7 @@ bool MacroActionHotkey::Load(obs_data_t *obj)
|
|||||||
_rightAlt = obs_data_get_bool(obj, "right_alt");
|
_rightAlt = obs_data_get_bool(obj, "right_alt");
|
||||||
_leftMeta = obs_data_get_bool(obj, "left_meta");
|
_leftMeta = obs_data_get_bool(obj, "left_meta");
|
||||||
_rightMeta = obs_data_get_bool(obj, "right_meta");
|
_rightMeta = obs_data_get_bool(obj, "right_meta");
|
||||||
if (!obs_data_has_user_value(obj, "version")) {
|
if (version == 0) {
|
||||||
_duration = obs_data_get_int(obj, "duration") / 1000.0;
|
_duration = obs_data_get_int(obj, "duration") / 1000.0;
|
||||||
} else {
|
} else {
|
||||||
_duration.Load(obj);
|
_duration.Load(obj);
|
||||||
@@ -395,9 +527,65 @@ static inline void populateKeySelection(QComboBox *list)
|
|||||||
list->addItem("NumpadEnter");
|
list->addItem("NumpadEnter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void populateActionSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
for (const auto &[_, value] : actionTypes) {
|
||||||
|
list->addItem(obs_module_text(value.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void populateHotkeyTypeSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
for (const auto &[_, value] : hotkeyTypes) {
|
||||||
|
list->addItem(obs_module_text(value.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void addNamePrefix(QString &name, obs_hotkey_t *hotkey)
|
||||||
|
{
|
||||||
|
auto temp = name.toStdString();
|
||||||
|
addNamePrefix(temp, hotkey);
|
||||||
|
name = QString::fromStdString(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void populateHotkeyNames(QComboBox *list,
|
||||||
|
obs_hotkey_registerer_type type)
|
||||||
|
{
|
||||||
|
struct Parameters {
|
||||||
|
QStringList names;
|
||||||
|
QStringList descriptions;
|
||||||
|
obs_hotkey_registerer_type type;
|
||||||
|
} params;
|
||||||
|
|
||||||
|
auto func = [](void *param, obs_hotkey_id, obs_hotkey_t *hotkey) {
|
||||||
|
auto params = static_cast<Parameters *>(param);
|
||||||
|
if (obs_hotkey_get_registerer_type(hotkey) == params->type) {
|
||||||
|
QString description(obs_hotkey_get_description(hotkey));
|
||||||
|
addNamePrefix(description, hotkey);
|
||||||
|
params->descriptions.append(description);
|
||||||
|
QString name(obs_hotkey_get_name(hotkey));
|
||||||
|
addNamePrefix(name, hotkey);
|
||||||
|
params->names.append(name);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
params.type = type;
|
||||||
|
obs_enum_hotkeys(func, ¶ms);
|
||||||
|
|
||||||
|
list->clear();
|
||||||
|
for (int i = 0; i < params.names.size(); i++) {
|
||||||
|
list->addItem(params.descriptions.at(i), params.names.at(i));
|
||||||
|
}
|
||||||
|
AddSelectionEntry(list,
|
||||||
|
obs_module_text("AdvSceneSwitcher.selectHotkey"));
|
||||||
|
}
|
||||||
|
|
||||||
MacroActionHotkeyEdit::MacroActionHotkeyEdit(
|
MacroActionHotkeyEdit::MacroActionHotkeyEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionHotkey> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionHotkey> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
|
_actionType(new QComboBox()),
|
||||||
|
_hotkeyType(new QComboBox()),
|
||||||
|
_obsHotkeys(new QComboBox()),
|
||||||
_keys(new QComboBox()),
|
_keys(new QComboBox()),
|
||||||
_leftShift(new QCheckBox(
|
_leftShift(new QCheckBox(
|
||||||
obs_module_text("AdvSceneSwitcher.action.hotkey.leftShift"))),
|
obs_module_text("AdvSceneSwitcher.action.hotkey.leftShift"))),
|
||||||
@@ -419,10 +607,20 @@ MacroActionHotkeyEdit::MacroActionHotkeyEdit(
|
|||||||
_onlySendToOBS(new QCheckBox(
|
_onlySendToOBS(new QCheckBox(
|
||||||
obs_module_text("AdvSceneSwitcher.action.hotkey.onlyOBS"))),
|
obs_module_text("AdvSceneSwitcher.action.hotkey.onlyOBS"))),
|
||||||
_noKeyPressSimulationWarning(new QLabel(
|
_noKeyPressSimulationWarning(new QLabel(
|
||||||
obs_module_text("AdvSceneSwitcher.action.hotkey.disabled")))
|
obs_module_text("AdvSceneSwitcher.action.hotkey.disabled"))),
|
||||||
|
_entryLayout(new QHBoxLayout()),
|
||||||
|
_keyConfigLayout(new QHBoxLayout())
|
||||||
{
|
{
|
||||||
populateKeySelection(_keys);
|
populateKeySelection(_keys);
|
||||||
|
populateActionSelection(_actionType);
|
||||||
|
populateHotkeyTypeSelection(_hotkeyType);
|
||||||
|
|
||||||
|
QWidget::connect(_actionType, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(ActionChanged(int)));
|
||||||
|
QWidget::connect(_hotkeyType, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(HotkeyTypeChanged(int)));
|
||||||
|
QWidget::connect(_obsHotkeys, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(OBSHotkeyChanged(int)));
|
||||||
QWidget::connect(_keys, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_keys, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(KeyChanged(int)));
|
SLOT(KeyChanged(int)));
|
||||||
QWidget::connect(_leftShift, SIGNAL(stateChanged(int)), this,
|
QWidget::connect(_leftShift, SIGNAL(stateChanged(int)), this,
|
||||||
@@ -446,28 +644,21 @@ MacroActionHotkeyEdit::MacroActionHotkeyEdit(
|
|||||||
QWidget::connect(_onlySendToOBS, SIGNAL(stateChanged(int)), this,
|
QWidget::connect(_onlySendToOBS, SIGNAL(stateChanged(int)), this,
|
||||||
SLOT(OnlySendToOBSChanged(int)));
|
SLOT(OnlySendToOBSChanged(int)));
|
||||||
|
|
||||||
QHBoxLayout *line1Layout = new QHBoxLayout;
|
_entryLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
_keyConfigLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
{"{{keys}}", _keys},
|
_keyConfigLayout->addWidget(_leftShift);
|
||||||
{"{{duration}}", _duration},
|
_keyConfigLayout->addWidget(_rightShift);
|
||||||
};
|
_keyConfigLayout->addWidget(_leftCtrl);
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.hotkey.entry"),
|
_keyConfigLayout->addWidget(_rightCtrl);
|
||||||
line1Layout, widgetPlaceholders);
|
_keyConfigLayout->addWidget(_leftAlt);
|
||||||
|
_keyConfigLayout->addWidget(_rightAlt);
|
||||||
|
_keyConfigLayout->addWidget(_leftMeta);
|
||||||
|
_keyConfigLayout->addWidget(_rightMeta);
|
||||||
|
_keyConfigLayout->addStretch();
|
||||||
|
|
||||||
QHBoxLayout *line2Layout = new QHBoxLayout;
|
auto mainLayout = new QVBoxLayout;
|
||||||
line2Layout->addWidget(_leftShift);
|
mainLayout->addLayout(_entryLayout);
|
||||||
line2Layout->addWidget(_rightShift);
|
mainLayout->addLayout(_keyConfigLayout);
|
||||||
line2Layout->addWidget(_leftCtrl);
|
|
||||||
line2Layout->addWidget(_rightCtrl);
|
|
||||||
line2Layout->addWidget(_leftAlt);
|
|
||||||
line2Layout->addWidget(_rightAlt);
|
|
||||||
line2Layout->addWidget(_leftMeta);
|
|
||||||
line2Layout->addWidget(_rightMeta);
|
|
||||||
line2Layout->addStretch();
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addLayout(line1Layout);
|
|
||||||
mainLayout->addLayout(line2Layout);
|
|
||||||
mainLayout->addWidget(_onlySendToOBS);
|
mainLayout->addWidget(_onlySendToOBS);
|
||||||
mainLayout->addWidget(_noKeyPressSimulationWarning);
|
mainLayout->addWidget(_noKeyPressSimulationWarning);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
@@ -479,10 +670,76 @@ MacroActionHotkeyEdit::MacroActionHotkeyEdit(
|
|||||||
_loading = false;
|
_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::SetWarningVisibility()
|
void MacroActionHotkeyEdit::RepopulateOBSHotkeySelection()
|
||||||
{
|
{
|
||||||
|
populateHotkeyNames(_obsHotkeys, _entryData->_hotkeyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionHotkeyEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
_entryLayout->removeWidget(_actionType);
|
||||||
|
_entryLayout->removeWidget(_hotkeyType);
|
||||||
|
_entryLayout->removeWidget(_obsHotkeys);
|
||||||
|
_entryLayout->removeWidget(_keys);
|
||||||
|
_entryLayout->removeWidget(_duration);
|
||||||
|
ClearLayout(_entryLayout);
|
||||||
|
PlaceWidgets(
|
||||||
|
obs_module_text(
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionHotkey::Action::OBS_HOTKEY
|
||||||
|
? "AdvSceneSwitcher.action.hotkey.entry.obs"
|
||||||
|
: "AdvSceneSwitcher.action.hotkey.entry.custom"),
|
||||||
|
_entryLayout,
|
||||||
|
{
|
||||||
|
{"{{actionType}}", _actionType},
|
||||||
|
{"{{hotkeyType}}", _hotkeyType},
|
||||||
|
{"{{obsHotkeys}}", _obsHotkeys},
|
||||||
|
{"{{keys}}", _keys},
|
||||||
|
{"{{duration}}", _duration},
|
||||||
|
});
|
||||||
|
|
||||||
_noKeyPressSimulationWarning->setVisible(!_entryData->_onlySendToObs &&
|
_noKeyPressSimulationWarning->setVisible(!_entryData->_onlySendToObs &&
|
||||||
!canSimulateKeyPresses);
|
!canSimulateKeyPresses);
|
||||||
|
SetLayoutVisible(_keyConfigLayout,
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionHotkey::Action::CUSTOM);
|
||||||
|
_duration->setVisible(_entryData->_action ==
|
||||||
|
MacroActionHotkey::Action::CUSTOM);
|
||||||
|
_keys->setVisible(_entryData->_action ==
|
||||||
|
MacroActionHotkey::Action::CUSTOM);
|
||||||
|
_onlySendToOBS->setVisible(_entryData->_action ==
|
||||||
|
MacroActionHotkey::Action::CUSTOM);
|
||||||
|
_hotkeyType->setVisible(_entryData->_action ==
|
||||||
|
MacroActionHotkey::Action::OBS_HOTKEY);
|
||||||
|
_obsHotkeys->setVisible(_entryData->_action ==
|
||||||
|
MacroActionHotkey::Action::OBS_HOTKEY);
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString getHotkeyDescriptionByName(const std::string &name)
|
||||||
|
{
|
||||||
|
struct Parameters {
|
||||||
|
std::string name;
|
||||||
|
QString description = "";
|
||||||
|
} params;
|
||||||
|
|
||||||
|
auto func = [](void *param, obs_hotkey_id, obs_hotkey_t *hotkey) {
|
||||||
|
auto params = static_cast<Parameters *>(param);
|
||||||
|
std::string name = obs_hotkey_get_name(hotkey);
|
||||||
|
addNamePrefix(name, hotkey);
|
||||||
|
if (name == params->name) {
|
||||||
|
params->description =
|
||||||
|
obs_hotkey_get_description(hotkey);
|
||||||
|
addNamePrefix(params->description, hotkey);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
params.name = name;
|
||||||
|
obs_enum_hotkeys(func, ¶ms);
|
||||||
|
return params.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::UpdateEntryData()
|
void MacroActionHotkeyEdit::UpdateEntryData()
|
||||||
@@ -491,6 +748,11 @@ void MacroActionHotkeyEdit::UpdateEntryData()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_actionType->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
|
_hotkeyType->setCurrentIndex(static_cast<int>(_entryData->_hotkeyType));
|
||||||
|
RepopulateOBSHotkeySelection();
|
||||||
|
_obsHotkeys->setCurrentText(
|
||||||
|
getHotkeyDescriptionByName(_entryData->_hotkeyName));
|
||||||
_keys->setCurrentIndex(static_cast<int>(_entryData->_key));
|
_keys->setCurrentIndex(static_cast<int>(_entryData->_key));
|
||||||
_leftShift->setChecked(_entryData->_leftShift);
|
_leftShift->setChecked(_entryData->_leftShift);
|
||||||
_rightShift->setChecked(_entryData->_rightShift);
|
_rightShift->setChecked(_entryData->_rightShift);
|
||||||
@@ -503,7 +765,7 @@ void MacroActionHotkeyEdit::UpdateEntryData()
|
|||||||
_duration->SetDuration(_entryData->_duration);
|
_duration->SetDuration(_entryData->_duration);
|
||||||
_onlySendToOBS->setChecked(_entryData->_onlySendToObs ||
|
_onlySendToOBS->setChecked(_entryData->_onlySendToObs ||
|
||||||
!canSimulateKeyPresses);
|
!canSimulateKeyPresses);
|
||||||
SetWarningVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::LShiftChanged(int state)
|
void MacroActionHotkeyEdit::LShiftChanged(int state)
|
||||||
@@ -604,7 +866,7 @@ void MacroActionHotkeyEdit::OnlySendToOBSChanged(int state)
|
|||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_onlySendToObs = state;
|
_entryData->_onlySendToObs = state;
|
||||||
SetWarningVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionHotkeyEdit::KeyChanged(int key)
|
void MacroActionHotkeyEdit::KeyChanged(int key)
|
||||||
@@ -617,4 +879,43 @@ void MacroActionHotkeyEdit::KeyChanged(int key)
|
|||||||
_entryData->_key = static_cast<HotkeyType>(key);
|
_entryData->_key = static_cast<HotkeyType>(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionHotkeyEdit::ActionChanged(int value)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_action = static_cast<MacroActionHotkey::Action>(value);
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionHotkeyEdit::HotkeyTypeChanged(int value)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_hotkeyType =
|
||||||
|
static_cast<obs_hotkey_registerer_type>(value);
|
||||||
|
}
|
||||||
|
RepopulateOBSHotkeySelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionHotkeyEdit::OBSHotkeyChanged(int idx)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
if (idx == -1) {
|
||||||
|
_entryData->_hotkeyName = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_entryData->_hotkeyName =
|
||||||
|
_obsHotkeys->itemData(idx).toString().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -23,7 +23,15 @@ public:
|
|||||||
return std::make_shared<MacroActionHotkey>(m);
|
return std::make_shared<MacroActionHotkey>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _HotkeySource;
|
enum class Action {
|
||||||
|
OBS_HOTKEY,
|
||||||
|
CUSTOM,
|
||||||
|
};
|
||||||
|
Action _action = Action::OBS_HOTKEY;
|
||||||
|
|
||||||
|
obs_hotkey_registerer_type _hotkeyType = OBS_HOTKEY_REGISTERER_FRONTEND;
|
||||||
|
std::string _hotkeyName;
|
||||||
|
|
||||||
HotkeyType _key = HotkeyType::Key_NoKey;
|
HotkeyType _key = HotkeyType::Key_NoKey;
|
||||||
bool _leftShift = false;
|
bool _leftShift = false;
|
||||||
bool _rightShift = false;
|
bool _rightShift = false;
|
||||||
@@ -41,6 +49,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SendOBSHotkey();
|
||||||
|
void SendCustomHotkey();
|
||||||
|
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
@@ -62,6 +73,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void ActionChanged(int key);
|
||||||
|
void HotkeyTypeChanged(int key);
|
||||||
|
void OBSHotkeyChanged(int);
|
||||||
void KeyChanged(int key);
|
void KeyChanged(int key);
|
||||||
void LShiftChanged(int state);
|
void LShiftChanged(int state);
|
||||||
void RShiftChanged(int state);
|
void RShiftChanged(int state);
|
||||||
@@ -75,6 +89,9 @@ private slots:
|
|||||||
void OnlySendToOBSChanged(int state);
|
void OnlySendToOBSChanged(int state);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
QComboBox *_actionType;
|
||||||
|
QComboBox *_hotkeyType;
|
||||||
|
QComboBox *_obsHotkeys;
|
||||||
QComboBox *_keys;
|
QComboBox *_keys;
|
||||||
QCheckBox *_leftShift;
|
QCheckBox *_leftShift;
|
||||||
QCheckBox *_rightShift;
|
QCheckBox *_rightShift;
|
||||||
@@ -91,8 +108,11 @@ protected:
|
|||||||
std::shared_ptr<MacroActionHotkey> _entryData;
|
std::shared_ptr<MacroActionHotkey> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWarningVisibility();
|
void RepopulateOBSHotkeySelection();
|
||||||
QHBoxLayout *_mainLayout;
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
|
QHBoxLayout *_entryLayout;
|
||||||
|
QHBoxLayout *_keyConfigLayout;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ MacroActionHttpEdit::MacroActionHttpEdit(
|
|||||||
_timeout(new DurationSelection(this, false))
|
_timeout(new DurationSelection(this, false))
|
||||||
{
|
{
|
||||||
populateMethodSelection(_methods);
|
populateMethodSelection(_methods);
|
||||||
|
_headerList->SetMaxStringSize(4096);
|
||||||
|
|
||||||
QWidget::connect(_url, SIGNAL(editingFinished()), this,
|
QWidget::connect(_url, SIGNAL(editingFinished()), this,
|
||||||
SLOT(URLChanged()));
|
SLOT(URLChanged()));
|
||||||
|
|||||||
@@ -11,14 +11,23 @@ bool MacroActionMacro::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionMacro::Create, MacroActionMacroEdit::Create,
|
{MacroActionMacro::Create, MacroActionMacroEdit::Create,
|
||||||
"AdvSceneSwitcher.action.macro"});
|
"AdvSceneSwitcher.action.macro"});
|
||||||
|
|
||||||
const static std::map<PerformMacroAction, std::string> actionTypes = {
|
const static std::map<MacroActionMacro::Action, std::string> actionTypes = {
|
||||||
{PerformMacroAction::PAUSE, "AdvSceneSwitcher.action.macro.type.pause"},
|
{MacroActionMacro::Action::PAUSE,
|
||||||
{PerformMacroAction::UNPAUSE,
|
"AdvSceneSwitcher.action.macro.type.pause"},
|
||||||
|
{MacroActionMacro::Action::UNPAUSE,
|
||||||
"AdvSceneSwitcher.action.macro.type.unpause"},
|
"AdvSceneSwitcher.action.macro.type.unpause"},
|
||||||
{PerformMacroAction::RESET_COUNTER,
|
{MacroActionMacro::Action::RESET_COUNTER,
|
||||||
"AdvSceneSwitcher.action.macro.type.resetCounter"},
|
"AdvSceneSwitcher.action.macro.type.resetCounter"},
|
||||||
{PerformMacroAction::RUN, "AdvSceneSwitcher.action.macro.type.run"},
|
{MacroActionMacro::Action::RUN,
|
||||||
{PerformMacroAction::STOP, "AdvSceneSwitcher.action.macro.type.stop"},
|
"AdvSceneSwitcher.action.macro.type.run"},
|
||||||
|
{MacroActionMacro::Action::STOP,
|
||||||
|
"AdvSceneSwitcher.action.macro.type.stop"},
|
||||||
|
{MacroActionMacro::Action::DISABLE_ACTION,
|
||||||
|
"AdvSceneSwitcher.action.macro.type.disableAction"},
|
||||||
|
{MacroActionMacro::Action::ENABLE_ACTION,
|
||||||
|
"AdvSceneSwitcher.action.macro.type.enableAction"},
|
||||||
|
{MacroActionMacro::Action::TOGGLE_ACTION,
|
||||||
|
"AdvSceneSwitcher.action.macro.type.toggleAction"},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MacroActionMacro::PerformAction()
|
bool MacroActionMacro::PerformAction()
|
||||||
@@ -29,23 +38,42 @@ bool MacroActionMacro::PerformAction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (_action) {
|
switch (_action) {
|
||||||
case PerformMacroAction::PAUSE:
|
case Action::PAUSE:
|
||||||
macro->SetPaused();
|
macro->SetPaused();
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::UNPAUSE:
|
case Action::UNPAUSE:
|
||||||
macro->SetPaused(false);
|
macro->SetPaused(false);
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::RESET_COUNTER:
|
case Action::RESET_COUNTER:
|
||||||
macro->ResetRunCount();
|
macro->ResetRunCount();
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::RUN:
|
case Action::RUN:
|
||||||
if (!macro->Paused()) {
|
if (!macro->Paused()) {
|
||||||
macro->PerformActions();
|
macro->PerformActions(true, false, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::STOP:
|
case Action::STOP:
|
||||||
macro->Stop();
|
macro->Stop();
|
||||||
break;
|
break;
|
||||||
|
case Action::DISABLE_ACTION:
|
||||||
|
if (IsValidMacroSegmentIndex(macro.get(), _actionIndex - 1,
|
||||||
|
false)) {
|
||||||
|
macro->Actions().at(_actionIndex - 1)->SetEnabled(false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Action::ENABLE_ACTION:
|
||||||
|
if (IsValidMacroSegmentIndex(macro.get(), _actionIndex - 1,
|
||||||
|
false)) {
|
||||||
|
macro->Actions().at(_actionIndex - 1)->SetEnabled(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Action::TOGGLE_ACTION:
|
||||||
|
if (IsValidMacroSegmentIndex(macro.get(), _actionIndex - 1,
|
||||||
|
false)) {
|
||||||
|
auto action = macro->Actions().at(_actionIndex - 1);
|
||||||
|
action->SetEnabled(!action->Enabled());
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -59,23 +87,35 @@ void MacroActionMacro::LogAction() const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (_action) {
|
switch (_action) {
|
||||||
case PerformMacroAction::PAUSE:
|
case Action::PAUSE:
|
||||||
vblog(LOG_INFO, "paused \"%s\"", macro->Name().c_str());
|
vblog(LOG_INFO, "paused \"%s\"", macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::UNPAUSE:
|
case Action::UNPAUSE:
|
||||||
vblog(LOG_INFO, "unpaused \"%s\"", macro->Name().c_str());
|
vblog(LOG_INFO, "unpaused \"%s\"", macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::RESET_COUNTER:
|
case Action::RESET_COUNTER:
|
||||||
vblog(LOG_INFO, "reset counter for \"%s\"",
|
vblog(LOG_INFO, "reset counter for \"%s\"",
|
||||||
macro->Name().c_str());
|
macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::RUN:
|
case Action::RUN:
|
||||||
vblog(LOG_INFO, "run nested macro \"%s\"",
|
vblog(LOG_INFO, "run nested macro \"%s\"",
|
||||||
macro->Name().c_str());
|
macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
case PerformMacroAction::STOP:
|
case Action::STOP:
|
||||||
vblog(LOG_INFO, "stopped macro \"%s\"", macro->Name().c_str());
|
vblog(LOG_INFO, "stopped macro \"%s\"", macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
|
case Action::DISABLE_ACTION:
|
||||||
|
vblog(LOG_INFO, "disabled action %d of macro \"%s\"",
|
||||||
|
_actionIndex.GetValue(), macro->Name().c_str());
|
||||||
|
break;
|
||||||
|
case Action::ENABLE_ACTION:
|
||||||
|
vblog(LOG_INFO, "enabled action %d of macro \"%s\"",
|
||||||
|
_actionIndex.GetValue(), macro->Name().c_str());
|
||||||
|
break;
|
||||||
|
case Action::TOGGLE_ACTION:
|
||||||
|
vblog(LOG_INFO, "toggled action %d of macro \"%s\"",
|
||||||
|
_actionIndex.GetValue(), macro->Name().c_str());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -85,6 +125,7 @@ bool MacroActionMacro::Save(obs_data_t *obj) const
|
|||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
_macro.Save(obj);
|
_macro.Save(obj);
|
||||||
|
_actionIndex.Save(obj, "actionIndex");
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -93,7 +134,8 @@ bool MacroActionMacro::Load(obs_data_t *obj)
|
|||||||
{
|
{
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_macro.Load(obj);
|
_macro.Load(obj);
|
||||||
_action = static_cast<PerformMacroAction>(
|
_actionIndex.Load(obj, "actionIndex");
|
||||||
|
_action = static_cast<MacroActionMacro::Action>(
|
||||||
obs_data_get_int(obj, "action"));
|
obs_data_get_int(obj, "action"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -112,25 +154,28 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
|
|
||||||
MacroActionMacroEdit::MacroActionMacroEdit(
|
MacroActionMacroEdit::MacroActionMacroEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionMacro> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionMacro> entryData)
|
||||||
: QWidget(parent)
|
: QWidget(parent),
|
||||||
|
_macros(new MacroSelection(parent)),
|
||||||
|
_actionIndex(new MacroSegmentSelection(
|
||||||
|
this, MacroSegmentSelection::Type::ACTION)),
|
||||||
|
_actions(new QComboBox())
|
||||||
{
|
{
|
||||||
_macros = new MacroSelection(parent);
|
|
||||||
_actions = new QComboBox();
|
|
||||||
|
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
|
|
||||||
QWidget::connect(_macros, SIGNAL(currentTextChanged(const QString &)),
|
QWidget::connect(_macros, SIGNAL(currentTextChanged(const QString &)),
|
||||||
this, SLOT(MacroChanged(const QString &)));
|
this, SLOT(MacroChanged(const QString &)));
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ActionChanged(int)));
|
SLOT(ActionChanged(int)));
|
||||||
|
QWidget::connect(_actionIndex,
|
||||||
|
SIGNAL(SelectionChanged(const IntVariable &)), this,
|
||||||
|
SLOT(ActionIndexChanged(const IntVariable &)));
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
auto mainLayout = new QHBoxLayout;
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
|
||||||
{"{{actions}}", _actions},
|
|
||||||
{"{{macros}}", _macros},
|
|
||||||
};
|
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.macro.entry"),
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.macro.entry"),
|
||||||
mainLayout, widgetPlaceholders);
|
mainLayout,
|
||||||
|
{{"{{actions}}", _actions},
|
||||||
|
{"{{actionIndex}}", _actionIndex},
|
||||||
|
{"{{macros}}", _macros}});
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
@@ -144,11 +189,10 @@ void MacroActionMacroEdit::UpdateEntryData()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
|
_actionIndex->SetValue(_entryData->_actionIndex);
|
||||||
|
_actionIndex->SetMacro(_entryData->_macro.GetMacro());
|
||||||
_macros->SetCurrentMacro(_entryData->_macro);
|
_macros->SetCurrentMacro(_entryData->_macro);
|
||||||
if (_entryData->_action == PerformMacroAction::RUN ||
|
SetWidgetVisibility();
|
||||||
_entryData->_action == PerformMacroAction::STOP) {
|
|
||||||
_macros->HideSelectedMacro();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMacroEdit::MacroChanged(const QString &text)
|
void MacroActionMacroEdit::MacroChanged(const QString &text)
|
||||||
@@ -159,6 +203,7 @@ void MacroActionMacroEdit::MacroChanged(const QString &text)
|
|||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_macro = text;
|
_entryData->_macro = text;
|
||||||
|
_actionIndex->SetMacro(_entryData->_macro.GetMacro());
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
@@ -170,14 +215,36 @@ void MacroActionMacroEdit::ActionChanged(int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_action = static_cast<PerformMacroAction>(value);
|
_entryData->_action = static_cast<MacroActionMacro::Action>(value);
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
if (_entryData->_action == PerformMacroAction::RUN ||
|
void MacroActionMacroEdit::ActionIndexChanged(const IntVariable &value)
|
||||||
_entryData->_action == PerformMacroAction::STOP) {
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_actionIndex = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionMacroEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
if (_entryData->_action == MacroActionMacro::Action::RUN ||
|
||||||
|
_entryData->_action == MacroActionMacro::Action::STOP) {
|
||||||
_macros->HideSelectedMacro();
|
_macros->HideSelectedMacro();
|
||||||
} else {
|
} else {
|
||||||
_macros->ShowAllMacros();
|
_macros->ShowAllMacros();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool isModifyingActionState =
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionMacro::Action::DISABLE_ACTION ||
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionMacro::Action::ENABLE_ACTION ||
|
||||||
|
_entryData->_action == MacroActionMacro::Action::TOGGLE_ACTION;
|
||||||
|
_actionIndex->setVisible(isModifyingActionState);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -1,19 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "macro-selection.hpp"
|
#include "macro-selection.hpp"
|
||||||
|
#include "macro-segment-selection.hpp"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
enum class PerformMacroAction {
|
|
||||||
PAUSE,
|
|
||||||
UNPAUSE,
|
|
||||||
RESET_COUNTER,
|
|
||||||
RUN,
|
|
||||||
STOP,
|
|
||||||
};
|
|
||||||
|
|
||||||
class MacroActionMacro : public MacroRefAction {
|
class MacroActionMacro : public MacroRefAction {
|
||||||
public:
|
public:
|
||||||
MacroActionMacro(Macro *m) : MacroAction(m), MacroRefAction(m) {}
|
MacroActionMacro(Macro *m) : MacroAction(m), MacroRefAction(m) {}
|
||||||
@@ -28,7 +21,18 @@ public:
|
|||||||
return std::make_shared<MacroActionMacro>(m);
|
return std::make_shared<MacroActionMacro>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformMacroAction _action = PerformMacroAction::PAUSE;
|
enum class Action {
|
||||||
|
PAUSE,
|
||||||
|
UNPAUSE,
|
||||||
|
RESET_COUNTER,
|
||||||
|
RUN,
|
||||||
|
STOP,
|
||||||
|
DISABLE_ACTION,
|
||||||
|
ENABLE_ACTION,
|
||||||
|
TOGGLE_ACTION,
|
||||||
|
};
|
||||||
|
Action _action = Action::PAUSE;
|
||||||
|
IntVariable _actionIndex = 1;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
@@ -54,16 +58,19 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void MacroChanged(const QString &text);
|
void MacroChanged(const QString &text);
|
||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
|
void ActionIndexChanged(const IntVariable &value);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MacroSelection *_macros;
|
MacroSelection *_macros;
|
||||||
|
MacroSegmentSelection *_actionIndex;
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
std::shared_ptr<MacroActionMacro> _entryData;
|
std::shared_ptr<MacroActionMacro> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHBoxLayout *_mainLayout;
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,22 +10,45 @@ bool MacroActionMedia::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionMedia::Create, MacroActionMediaEdit::Create,
|
{MacroActionMedia::Create, MacroActionMediaEdit::Create,
|
||||||
"AdvSceneSwitcher.action.media"});
|
"AdvSceneSwitcher.action.media"});
|
||||||
|
|
||||||
const static std::map<MediaAction, std::string> actionTypes = {
|
const static std::map<MacroActionMedia::Action, std::string> actionTypes = {
|
||||||
{MediaAction::PLAY, "AdvSceneSwitcher.action.media.type.play"},
|
{MacroActionMedia::Action::PLAY,
|
||||||
{MediaAction::PAUSE, "AdvSceneSwitcher.action.media.type.pause"},
|
"AdvSceneSwitcher.action.media.type.play"},
|
||||||
{MediaAction::STOP, "AdvSceneSwitcher.action.media.type.stop"},
|
{MacroActionMedia::Action::PAUSE,
|
||||||
{MediaAction::RESTART, "AdvSceneSwitcher.action.media.type.restart"},
|
"AdvSceneSwitcher.action.media.type.pause"},
|
||||||
{MediaAction::NEXT, "AdvSceneSwitcher.action.media.type.next"},
|
{MacroActionMedia::Action::STOP,
|
||||||
{MediaAction::PREVIOUS, "AdvSceneSwitcher.action.media.type.previous"},
|
"AdvSceneSwitcher.action.media.type.stop"},
|
||||||
{MediaAction::SEEK, "AdvSceneSwitcher.action.media.type.seek"},
|
{MacroActionMedia::Action::RESTART,
|
||||||
|
"AdvSceneSwitcher.action.media.type.restart"},
|
||||||
|
{MacroActionMedia::Action::NEXT,
|
||||||
|
"AdvSceneSwitcher.action.media.type.next"},
|
||||||
|
{MacroActionMedia::Action::PREVIOUS,
|
||||||
|
"AdvSceneSwitcher.action.media.type.previous"},
|
||||||
|
{MacroActionMedia::Action::SEEK_DURATION,
|
||||||
|
"AdvSceneSwitcher.action.media.type.seek.duration"},
|
||||||
|
{MacroActionMedia::Action::SEEK_PERCENTAGE,
|
||||||
|
"AdvSceneSwitcher.action.media.type.seek.percentage"},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string MacroActionMedia::GetShortDesc() const
|
||||||
|
{
|
||||||
|
return _mediaSource.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionMedia::SeekToPercentage(obs_source_t *source) const
|
||||||
|
{
|
||||||
|
auto totalTimeMs = obs_source_media_get_duration(source);
|
||||||
|
auto percentageTimeMs = round(totalTimeMs * _seekPercentage / 100);
|
||||||
|
|
||||||
|
obs_source_media_set_time(source, percentageTimeMs);
|
||||||
|
}
|
||||||
|
|
||||||
bool MacroActionMedia::PerformAction()
|
bool MacroActionMedia::PerformAction()
|
||||||
{
|
{
|
||||||
auto source = obs_weak_source_get_source(_mediaSource.GetSource());
|
auto source = obs_weak_source_get_source(_mediaSource.GetSource());
|
||||||
obs_media_state state = obs_source_media_get_state(source);
|
obs_media_state state = obs_source_media_get_state(source);
|
||||||
|
|
||||||
switch (_action) {
|
switch (_action) {
|
||||||
case MediaAction::PLAY:
|
case Action::PLAY:
|
||||||
if (state == OBS_MEDIA_STATE_STOPPED ||
|
if (state == OBS_MEDIA_STATE_STOPPED ||
|
||||||
state == OBS_MEDIA_STATE_ENDED) {
|
state == OBS_MEDIA_STATE_ENDED) {
|
||||||
obs_source_media_restart(source);
|
obs_source_media_restart(source);
|
||||||
@@ -33,27 +56,31 @@ bool MacroActionMedia::PerformAction()
|
|||||||
obs_source_media_play_pause(source, false);
|
obs_source_media_play_pause(source, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MediaAction::PAUSE:
|
case Action::PAUSE:
|
||||||
obs_source_media_play_pause(source, true);
|
obs_source_media_play_pause(source, true);
|
||||||
break;
|
break;
|
||||||
case MediaAction::STOP:
|
case Action::STOP:
|
||||||
obs_source_media_stop(source);
|
obs_source_media_stop(source);
|
||||||
break;
|
break;
|
||||||
case MediaAction::RESTART:
|
case Action::RESTART:
|
||||||
obs_source_media_restart(source);
|
obs_source_media_restart(source);
|
||||||
break;
|
break;
|
||||||
case MediaAction::NEXT:
|
case Action::NEXT:
|
||||||
obs_source_media_next(source);
|
obs_source_media_next(source);
|
||||||
break;
|
break;
|
||||||
case MediaAction::PREVIOUS:
|
case Action::PREVIOUS:
|
||||||
obs_source_media_previous(source);
|
obs_source_media_previous(source);
|
||||||
break;
|
break;
|
||||||
case MediaAction::SEEK:
|
case Action::SEEK_DURATION:
|
||||||
obs_source_media_set_time(source, _seek.Milliseconds());
|
obs_source_media_set_time(source, _seekDuration.Milliseconds());
|
||||||
|
break;
|
||||||
|
case Action::SEEK_PERCENTAGE:
|
||||||
|
SeekToPercentage(source);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_source_release(source);
|
obs_source_release(source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -73,39 +100,42 @@ void MacroActionMedia::LogAction() const
|
|||||||
bool MacroActionMedia::Save(obs_data_t *obj) const
|
bool MacroActionMedia::Save(obs_data_t *obj) const
|
||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
_mediaSource.Save(obj, "mediaSource");
|
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
_seek.Save(obj);
|
_seekDuration.Save(obj);
|
||||||
|
_seekPercentage.Save(obj, "seekPercentage");
|
||||||
|
_mediaSource.Save(obj, "mediaSource");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionMedia::Load(obs_data_t *obj)
|
bool MacroActionMedia::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
|
_seekDuration.Load(obj);
|
||||||
|
_seekPercentage.Load(obj, "seekPercentage");
|
||||||
_mediaSource.Load(obj, "mediaSource");
|
_mediaSource.Load(obj, "mediaSource");
|
||||||
_action = static_cast<MediaAction>(obs_data_get_int(obj, "action"));
|
|
||||||
_seek.Load(obj);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string MacroActionMedia::GetShortDesc() const
|
return true;
|
||||||
{
|
|
||||||
return _mediaSource.ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : actionTypes) {
|
for (const auto &[_, name] : actionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(name.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroActionMediaEdit::MacroActionMediaEdit(
|
MacroActionMediaEdit::MacroActionMediaEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionMedia> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionMedia> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_sources(new SourceSelectionWidget(this, QStringList(), true)),
|
|
||||||
_actions(new QComboBox()),
|
_actions(new QComboBox()),
|
||||||
_seek(new DurationSelection())
|
_seekDuration(new DurationSelection()),
|
||||||
|
_seekPercentage(new SliderSpinBox(
|
||||||
|
0, 100,
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.media.seek.percentage.label"))),
|
||||||
|
_sources(new SourceSelectionWidget(this, QStringList(), true))
|
||||||
{
|
{
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
auto sources = GetMediaSourceNames();
|
auto sources = GetMediaSourceNames();
|
||||||
@@ -114,39 +144,67 @@ MacroActionMediaEdit::MacroActionMediaEdit(
|
|||||||
|
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ActionChanged(int)));
|
SLOT(ActionChanged(int)));
|
||||||
|
QWidget::connect(_seekDuration,
|
||||||
|
SIGNAL(DurationChanged(const Duration &)), this,
|
||||||
|
SLOT(SeekDurationChanged(const Duration &)));
|
||||||
|
QWidget::connect(
|
||||||
|
_seekPercentage,
|
||||||
|
SIGNAL(DoubleValueChanged(const NumberVariable<double> &)),
|
||||||
|
this,
|
||||||
|
SLOT(SeekPercentageChanged(const NumberVariable<double> &)));
|
||||||
QWidget::connect(_sources,
|
QWidget::connect(_sources,
|
||||||
SIGNAL(SourceChanged(const SourceSelection &)), this,
|
SIGNAL(SourceChanged(const SourceSelection &)), this,
|
||||||
SLOT(SourceChanged(const SourceSelection &)));
|
SLOT(SourceChanged(const SourceSelection &)));
|
||||||
QWidget::connect(_seek, SIGNAL(DurationChanged(const Duration &)), this,
|
|
||||||
SLOT(DurationChanged(const Duration &)));
|
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
auto layout = new QHBoxLayout;
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{mediaSources}}", _sources},
|
|
||||||
{"{{actions}}", _actions},
|
{"{{actions}}", _actions},
|
||||||
{"{{duration}}", _seek},
|
{"{{seekDuration}}", _seekDuration},
|
||||||
|
{"{{seekPercentage}}", _seekPercentage},
|
||||||
|
{"{{mediaSources}}", _sources},
|
||||||
};
|
};
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.media.entry"),
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.media.entry"),
|
||||||
mainLayout, widgetPlaceholders);
|
layout, widgetPlaceholders);
|
||||||
setLayout(mainLayout);
|
setLayout(layout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
UpdateEntryData();
|
UpdateEntryData();
|
||||||
_loading = false;
|
_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMediaEdit::UpdateEntryData()
|
void MacroActionMediaEdit::ActionChanged(int value)
|
||||||
{
|
{
|
||||||
if (!_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_sources->SetSource(_entryData->_mediaSource);
|
auto lock = LockContext();
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_entryData->_action = static_cast<MacroActionMedia::Action>(value);
|
||||||
_seek->SetDuration(_entryData->_seek);
|
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionMediaEdit::SeekDurationChanged(const Duration &seekDuration)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_seekDuration = seekDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionMediaEdit::SeekPercentageChanged(
|
||||||
|
const NumberVariable<double> &seekPercentage)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_seekPercentage = seekPercentage;
|
||||||
|
}
|
||||||
|
|
||||||
void MacroActionMediaEdit::SourceChanged(const SourceSelection &source)
|
void MacroActionMediaEdit::SourceChanged(const SourceSelection &source)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
@@ -159,34 +217,32 @@ void MacroActionMediaEdit::SourceChanged(const SourceSelection &source)
|
|||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMediaEdit::ActionChanged(int value)
|
|
||||||
{
|
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_action = static_cast<MediaAction>(value);
|
|
||||||
SetWidgetVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MacroActionMediaEdit::DurationChanged(const Duration &dur)
|
|
||||||
{
|
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_seek = dur;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MacroActionMediaEdit::SetWidgetVisibility()
|
void MacroActionMediaEdit::SetWidgetVisibility()
|
||||||
{
|
{
|
||||||
if (!_entryData) {
|
if (!_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_seek->setVisible(_entryData->_action == MediaAction::SEEK);
|
|
||||||
|
_seekDuration->setVisible(_entryData->_action ==
|
||||||
|
MacroActionMedia::Action::SEEK_DURATION);
|
||||||
|
_seekPercentage->setVisible(_entryData->_action ==
|
||||||
|
MacroActionMedia::Action::SEEK_PERCENTAGE);
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionMediaEdit::UpdateEntryData()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
|
_seekDuration->SetDuration(_entryData->_seekDuration);
|
||||||
|
_seekPercentage->SetDoubleValue(_entryData->_seekPercentage);
|
||||||
|
_sources->SetSource(_entryData->_mediaSource);
|
||||||
|
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -1,42 +1,45 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "duration-control.hpp"
|
#include "duration-control.hpp"
|
||||||
|
#include "slider-spinbox.hpp"
|
||||||
#include "source-selection.hpp"
|
#include "source-selection.hpp"
|
||||||
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
enum class MediaAction {
|
|
||||||
PLAY,
|
|
||||||
PAUSE,
|
|
||||||
STOP,
|
|
||||||
RESTART,
|
|
||||||
NEXT,
|
|
||||||
PREVIOUS,
|
|
||||||
SEEK,
|
|
||||||
};
|
|
||||||
|
|
||||||
class MacroActionMedia : public MacroAction {
|
class MacroActionMedia : public MacroAction {
|
||||||
public:
|
public:
|
||||||
MacroActionMedia(Macro *m) : MacroAction(m) {}
|
MacroActionMedia(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
|
||||||
void LogAction() const;
|
|
||||||
bool Save(obs_data_t *obj) const;
|
|
||||||
bool Load(obs_data_t *obj);
|
|
||||||
std::string GetShortDesc() const;
|
|
||||||
std::string GetId() const { return id; };
|
|
||||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionMedia>(m);
|
return std::make_shared<MacroActionMedia>(m);
|
||||||
}
|
}
|
||||||
|
std::string GetId() const { return id; };
|
||||||
|
std::string GetShortDesc() const;
|
||||||
|
|
||||||
|
bool PerformAction();
|
||||||
|
void LogAction() const;
|
||||||
|
bool Save(obs_data_t *obj) const;
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
|
||||||
|
enum class Action {
|
||||||
|
PLAY,
|
||||||
|
PAUSE,
|
||||||
|
STOP,
|
||||||
|
RESTART,
|
||||||
|
NEXT,
|
||||||
|
PREVIOUS,
|
||||||
|
SEEK_DURATION,
|
||||||
|
SEEK_PERCENTAGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
Action _action = Action::PLAY;
|
||||||
|
Duration _seekDuration;
|
||||||
|
DoubleVariable _seekPercentage = 50;
|
||||||
SourceSelection _mediaSource;
|
SourceSelection _mediaSource;
|
||||||
MediaAction _action = MediaAction::PLAY;
|
|
||||||
Duration _seek;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SeekToPercentage(obs_source_t *source) const;
|
||||||
|
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
@@ -48,7 +51,6 @@ public:
|
|||||||
MacroActionMediaEdit(
|
MacroActionMediaEdit(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
std::shared_ptr<MacroActionMedia> entryData = nullptr);
|
std::shared_ptr<MacroActionMedia> entryData = nullptr);
|
||||||
void UpdateEntryData();
|
|
||||||
static QWidget *Create(QWidget *parent,
|
static QWidget *Create(QWidget *parent,
|
||||||
std::shared_ptr<MacroAction> action)
|
std::shared_ptr<MacroAction> action)
|
||||||
{
|
{
|
||||||
@@ -56,24 +58,27 @@ public:
|
|||||||
parent,
|
parent,
|
||||||
std::dynamic_pointer_cast<MacroActionMedia>(action));
|
std::dynamic_pointer_cast<MacroActionMedia>(action));
|
||||||
}
|
}
|
||||||
|
void UpdateEntryData();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SourceChanged(const SourceSelection &);
|
|
||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
void DurationChanged(const Duration &value);
|
void SeekDurationChanged(const Duration &seekDuration);
|
||||||
|
void
|
||||||
|
SeekPercentageChanged(const NumberVariable<double> &seekPercentage);
|
||||||
|
void SourceChanged(const SourceSelection &source);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
|
||||||
SourceSelectionWidget *_sources;
|
|
||||||
QComboBox *_actions;
|
|
||||||
DurationSelection *_seek;
|
|
||||||
std::shared_ptr<MacroActionMedia> _entryData;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWidgetVisibility();
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
QHBoxLayout *_mainLayout;
|
QComboBox *_actions;
|
||||||
|
DurationSelection *_seekDuration;
|
||||||
|
SliderSpinBox *_seekPercentage;
|
||||||
|
SourceSelectionWidget *_sources;
|
||||||
|
|
||||||
|
std::shared_ptr<MacroActionMedia> _entryData;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "macro-action-plugin-state.hpp"
|
#include "macro-action-plugin-state.hpp"
|
||||||
#include "switcher-data.hpp"
|
#include "plugin-state-helper.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <condition_variable>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
@@ -27,40 +28,38 @@ const static std::map<PluginStateAction, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.pluginState.type.terminate"},
|
"AdvSceneSwitcher.action.pluginState.type.terminate"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const static std::map<SwitcherData::NoMatch, std::string> noMatchValues = {
|
const static std::map<NoMatchBehavior, std::string> noMatchValues = {
|
||||||
{SwitcherData::NoMatch::NO_SWITCH,
|
{NoMatchBehavior::NO_SWITCH,
|
||||||
"AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.dontSwitch"},
|
"AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.dontSwitch"},
|
||||||
{SwitcherData::NoMatch::SWITCH,
|
{NoMatchBehavior::SWITCH,
|
||||||
"AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchTo"},
|
"AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchTo"},
|
||||||
{SwitcherData::NoMatch::RANDOM_SWITCH,
|
{NoMatchBehavior::RANDOM_SWITCH,
|
||||||
"AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchToRandom"},
|
"AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchToRandom"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void stopPlugin()
|
static void stopPlugin()
|
||||||
{
|
{
|
||||||
std::thread t([]() { switcher->Stop(); });
|
std::thread t([]() { StopPlugin(); });
|
||||||
t.detach();
|
t.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void importSettings(const std::string &path)
|
static void importSettings(const std::string &path)
|
||||||
{
|
{
|
||||||
if (switcher->settingsWindowOpened) {
|
if (SettingsWindowIsOpened()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
obs_data_t *obj = obs_data_create_from_json_file(path.c_str());
|
OBSDataAutoRelease obj = obs_data_create_from_json_file(path.c_str());
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switcher->LoadSettings(obj);
|
LoadPluginSettings(obj);
|
||||||
obs_data_release(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setNoMatchBehaviour(int value, OBSWeakSource &scene)
|
static void setNoMatchBehaviour(int value, OBSWeakSource &scene)
|
||||||
{
|
{
|
||||||
switcher->switchIfNotMatching =
|
SetPluginNoMatchBehavior(static_cast<NoMatchBehavior>(value));
|
||||||
static_cast<SwitcherData::NoMatch>(value);
|
if (GetPluginNoMatchBehavior() == NoMatchBehavior::SWITCH) {
|
||||||
if (switcher->switchIfNotMatching == SwitcherData::NoMatch::SWITCH) {
|
SetNoMatchScene(scene);
|
||||||
switcher->nonMatchingScene = scene;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,8 +341,8 @@ void MacroActionPluginStateEdit::SetWidgetVisibility()
|
|||||||
break;
|
break;
|
||||||
case PluginStateAction::NO_MATCH_BEHAVIOUR:
|
case PluginStateAction::NO_MATCH_BEHAVIOUR:
|
||||||
_values->show();
|
_values->show();
|
||||||
if (static_cast<SwitcherData::NoMatch>(_entryData->_value) ==
|
if (static_cast<NoMatchBehavior>(_entryData->_value) ==
|
||||||
SwitcherData::NoMatch::SWITCH) {
|
NoMatchBehavior::SWITCH) {
|
||||||
_scenes->show();
|
_scenes->show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ bool MacroActionProjector::PerformAction()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_fullscreen && _monitor == -1) {
|
||||||
|
blog(LOG_INFO, "refusing to open fullscreen projector"
|
||||||
|
" with invalid display selection");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
obs_frontend_open_projector(type, _fullscreen ? _monitor : -1, "",
|
obs_frontend_open_projector(type, _fullscreen ? _monitor : -1, "",
|
||||||
name.c_str());
|
name.c_str());
|
||||||
|
|
||||||
@@ -85,6 +91,7 @@ bool MacroActionProjector::Save(obs_data_t *obj) const
|
|||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
obs_data_set_int(obj, "type", static_cast<int>(_type));
|
obs_data_set_int(obj, "type", static_cast<int>(_type));
|
||||||
obs_data_set_int(obj, "monitor", _monitor);
|
obs_data_set_int(obj, "monitor", _monitor);
|
||||||
|
obs_data_set_string(obj, "monitorName", _monitorName.c_str());
|
||||||
obs_data_set_bool(obj, "fullscreen", _fullscreen);
|
obs_data_set_bool(obj, "fullscreen", _fullscreen);
|
||||||
_scene.Save(obj);
|
_scene.Save(obj);
|
||||||
_source.Save(obj);
|
_source.Save(obj);
|
||||||
@@ -96,12 +103,50 @@ bool MacroActionProjector::Load(obs_data_t *obj)
|
|||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_type = static_cast<Type>(obs_data_get_int(obj, "type"));
|
_type = static_cast<Type>(obs_data_get_int(obj, "type"));
|
||||||
_monitor = obs_data_get_int(obj, "monitor");
|
_monitor = obs_data_get_int(obj, "monitor");
|
||||||
|
_monitorName = obs_data_get_string(obj, "monitorName");
|
||||||
_fullscreen = obs_data_get_bool(obj, "fullscreen");
|
_fullscreen = obs_data_get_bool(obj, "fullscreen");
|
||||||
_scene.Load(obj);
|
_scene.Load(obj);
|
||||||
_source.Load(obj);
|
_source.Load(obj);
|
||||||
|
|
||||||
|
if (MonitorSetupChanged()) {
|
||||||
|
blog(LOG_INFO, "monitor setup seems to have changed! "
|
||||||
|
"resetting projector action monitor selection!");
|
||||||
|
_monitor = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionProjector::SetMonitor(int idx)
|
||||||
|
{
|
||||||
|
_monitor = idx;
|
||||||
|
auto monitorNames = GetMonitorNames();
|
||||||
|
if (_monitor < 0 || _monitor >= monitorNames.size()) {
|
||||||
|
// Monitor setup changed while settings were selected?
|
||||||
|
_monitorName = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_monitorName = monitorNames.at(_monitor).toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
int MacroActionProjector::GetMonitor() const
|
||||||
|
{
|
||||||
|
return _monitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionProjector::MonitorSetupChanged()
|
||||||
|
{
|
||||||
|
if (_monitorName.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
auto monitorNames = GetMonitorNames();
|
||||||
|
if (_monitor < 0 || _monitor >= monitorNames.size()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return monitorNames.at(_monitor) !=
|
||||||
|
QString::fromStdString(_monitorName);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void populateSelectionTypes(QComboBox *list)
|
static inline void populateSelectionTypes(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : selectionTypes) {
|
for (auto entry : selectionTypes) {
|
||||||
@@ -134,6 +179,8 @@ MacroActionProjectorEdit::MacroActionProjectorEdit(
|
|||||||
sources.sort();
|
sources.sort();
|
||||||
_sources->SetSourceNameList(sources);
|
_sources->SetSourceNameList(sources);
|
||||||
_monitors->addItems(GetMonitorNames());
|
_monitors->addItems(GetMonitorNames());
|
||||||
|
_monitors->setPlaceholderText(
|
||||||
|
obs_module_text("AdvSceneSwitcher.selectDisplay"));
|
||||||
|
|
||||||
QWidget::connect(_windowTypes, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_windowTypes, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(WindowTypeChanged(int)));
|
SLOT(WindowTypeChanged(int)));
|
||||||
@@ -177,7 +224,7 @@ void MacroActionProjectorEdit::UpdateEntryData()
|
|||||||
_types->setCurrentIndex(static_cast<int>(_entryData->_type));
|
_types->setCurrentIndex(static_cast<int>(_entryData->_type));
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
_sources->SetSource(_entryData->_source);
|
_sources->SetSource(_entryData->_source);
|
||||||
_monitors->setCurrentIndex(_entryData->_monitor);
|
_monitors->setCurrentIndex(_entryData->GetMonitor());
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +255,7 @@ void MacroActionProjectorEdit::MonitorChanged(int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_monitor = value;
|
_entryData->SetMonitor(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionProjectorEdit::WindowTypeChanged(int)
|
void MacroActionProjectorEdit::WindowTypeChanged(int)
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public:
|
|||||||
{
|
{
|
||||||
return std::make_shared<MacroActionProjector>(m);
|
return std::make_shared<MacroActionProjector>(m);
|
||||||
}
|
}
|
||||||
|
void SetMonitor(int);
|
||||||
|
int GetMonitor() const;
|
||||||
|
|
||||||
enum class Type {
|
enum class Type {
|
||||||
SOURCE,
|
SOURCE,
|
||||||
@@ -29,10 +31,15 @@ public:
|
|||||||
Type _type = Type::SCENE;
|
Type _type = Type::SCENE;
|
||||||
SourceSelection _source;
|
SourceSelection _source;
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
int _monitor = 0;
|
|
||||||
bool _fullscreen = true;
|
bool _fullscreen = true;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool MonitorSetupChanged();
|
||||||
|
|
||||||
|
int _monitor = -1;
|
||||||
|
// Only used to detect display setup changes
|
||||||
|
std::string _monitorName = "";
|
||||||
|
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,12 +54,12 @@ bool MacroActionRandom::PerformAction()
|
|||||||
}
|
}
|
||||||
if (macros.size() == 1) {
|
if (macros.size() == 1) {
|
||||||
lastRandomMacro = macros[0];
|
lastRandomMacro = macros[0];
|
||||||
return macros[0]->PerformActions();
|
return macros[0]->PerformActions(true);
|
||||||
}
|
}
|
||||||
srand((unsigned int)time(0));
|
srand((unsigned int)time(0));
|
||||||
size_t idx = std::rand() % (macros.size());
|
size_t idx = std::rand() % (macros.size());
|
||||||
lastRandomMacro = macros[idx];
|
lastRandomMacro = macros[idx];
|
||||||
return macros[idx]->PerformActions();
|
return macros[idx]->PerformActions(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionRandom::LogAction() const
|
void MacroActionRandom::LogAction() const
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "macro-action-scene-collection.hpp"
|
#include "macro-action-scene-collection.hpp"
|
||||||
#include "switcher-data.hpp"
|
#include "plugin-state-helper.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
@@ -17,7 +17,7 @@ bool MacroActionSceneCollection::PerformAction()
|
|||||||
// Changing the scene collection will also reload the settings of the
|
// Changing the scene collection will also reload the settings of the
|
||||||
// scene switcher, so to avoid issues of not being able to change
|
// scene switcher, so to avoid issues of not being able to change
|
||||||
// settings ignore this action if the settings dialog is opened.
|
// settings ignore this action if the settings dialog is opened.
|
||||||
if (switcher->settingsWindowOpened) {
|
if (SettingsWindowIsOpened()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
obs_frontend_set_current_scene_collection(_sceneCollection.c_str());
|
obs_frontend_set_current_scene_collection(_sceneCollection.c_str());
|
||||||
|
|||||||
176
src/macro-core/macro-action-scene-lock.cpp
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
#include "macro-action-scene-lock.hpp"
|
||||||
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
const std::string MacroActionSceneLock::id = "scene_lock";
|
||||||
|
|
||||||
|
bool MacroActionSceneLock::_registered = MacroActionFactory::Register(
|
||||||
|
MacroActionSceneLock::id,
|
||||||
|
{MacroActionSceneLock::Create, MacroActionSceneLockEdit::Create,
|
||||||
|
"AdvSceneSwitcher.action.sceneLock"});
|
||||||
|
|
||||||
|
const static std::map<MacroActionSceneLock::Action, std::string> actionTypes = {
|
||||||
|
{MacroActionSceneLock::Action::LOCK,
|
||||||
|
"AdvSceneSwitcher.action.sceneLock.type.lock"},
|
||||||
|
{MacroActionSceneLock::Action::UNLOCK,
|
||||||
|
"AdvSceneSwitcher.action.sceneLock.type.unlock"},
|
||||||
|
{MacroActionSceneLock::Action::TOGGLE,
|
||||||
|
"AdvSceneSwitcher.action.sceneLock.type.toggle"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static void setSceneItemLock(obs_sceneitem_t *item,
|
||||||
|
MacroActionSceneLock::Action action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case MacroActionSceneLock::Action::LOCK:
|
||||||
|
obs_sceneitem_set_locked(item, true);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneLock::Action::UNLOCK:
|
||||||
|
obs_sceneitem_set_locked(item, false);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneLock::Action::TOGGLE:
|
||||||
|
obs_sceneitem_set_locked(item, !obs_sceneitem_locked(item));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSceneLock::PerformAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
auto items = _source.GetSceneItems(_scene);
|
||||||
|
for (const auto &item : items) {
|
||||||
|
setSceneItemLock(item, _action);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneLock::LogAction() const
|
||||||
|
{
|
||||||
|
auto it = actionTypes.find(_action);
|
||||||
|
if (it != actionTypes.end()) {
|
||||||
|
vblog(LOG_INFO,
|
||||||
|
"performed action \"%s\" for source \"%s\" on scene \"%s\"",
|
||||||
|
it->second.c_str(), _source.ToString(true).c_str(),
|
||||||
|
_scene.ToString(true).c_str());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
blog(LOG_WARNING, "ignored unknown scene lock action %d",
|
||||||
|
static_cast<int>(_action));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSceneLock::Save(obs_data_t *obj) const
|
||||||
|
{
|
||||||
|
MacroAction::Save(obj);
|
||||||
|
_scene.Save(obj);
|
||||||
|
_source.Save(obj);
|
||||||
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSceneLock::Load(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Load(obj);
|
||||||
|
_scene.Load(obj);
|
||||||
|
_source.Load(obj);
|
||||||
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string MacroActionSceneLock::GetShortDesc() const
|
||||||
|
{
|
||||||
|
if (!_source.ToString().empty()) {
|
||||||
|
return _scene.ToString() + " - " + _source.ToString();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
for (const auto &[_, name] : actionTypes) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroActionSceneLockEdit::MacroActionSceneLockEdit(
|
||||||
|
QWidget *parent, std::shared_ptr<MacroActionSceneLock> entryData)
|
||||||
|
: QWidget(parent),
|
||||||
|
_scenes(new SceneSelectionWidget(window(), true, false, true, true)),
|
||||||
|
_sources(new SceneItemSelectionWidget(parent)),
|
||||||
|
_actions(new QComboBox())
|
||||||
|
{
|
||||||
|
populateActionSelection(_actions);
|
||||||
|
|
||||||
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(ActionChanged(int)));
|
||||||
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
|
_sources, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
|
QWidget::connect(_sources,
|
||||||
|
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
||||||
|
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
||||||
|
|
||||||
|
auto layout = new QHBoxLayout;
|
||||||
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
|
{"{{scenes}}", _scenes},
|
||||||
|
{"{{sources}}", _sources},
|
||||||
|
{"{{actions}}", _actions},
|
||||||
|
};
|
||||||
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.sceneLock.entry"),
|
||||||
|
layout, widgetPlaceholders);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
_entryData = entryData;
|
||||||
|
UpdateEntryData();
|
||||||
|
_loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneLockEdit::UpdateEntryData()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
|
_scenes->SetScene(_entryData->_scene);
|
||||||
|
_sources->SetSceneItem((_entryData->_source));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneLockEdit::SceneChanged(const SceneSelection &s)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_scene = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneLockEdit::SourceChanged(const SceneItemSelection &item)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_source = item;
|
||||||
|
emit HeaderInfoChanged(
|
||||||
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneLockEdit::ActionChanged(int value)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_action = static_cast<MacroActionSceneLock::Action>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
69
src/macro-core/macro-action-scene-lock.hpp
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "macro-action-edit.hpp"
|
||||||
|
#include "scene-selection.hpp"
|
||||||
|
#include "scene-item-selection.hpp"
|
||||||
|
|
||||||
|
namespace advss {
|
||||||
|
|
||||||
|
class MacroActionSceneLock : public MacroAction {
|
||||||
|
public:
|
||||||
|
MacroActionSceneLock(Macro *m) : MacroAction(m) {}
|
||||||
|
bool PerformAction();
|
||||||
|
void LogAction() const;
|
||||||
|
bool Save(obs_data_t *obj) const;
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
std::string GetShortDesc() const;
|
||||||
|
std::string GetId() const { return id; };
|
||||||
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
|
{
|
||||||
|
return std::make_shared<MacroActionSceneLock>(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Action {
|
||||||
|
LOCK,
|
||||||
|
UNLOCK,
|
||||||
|
TOGGLE,
|
||||||
|
};
|
||||||
|
Action _action = Action::LOCK;
|
||||||
|
SceneSelection _scene;
|
||||||
|
SceneItemSelection _source;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool _registered;
|
||||||
|
static const std::string id;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroActionSceneLockEdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroActionSceneLockEdit(
|
||||||
|
QWidget *parent,
|
||||||
|
std::shared_ptr<MacroActionSceneLock> entryData = nullptr);
|
||||||
|
void UpdateEntryData();
|
||||||
|
static QWidget *Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroAction> action)
|
||||||
|
{
|
||||||
|
return new MacroActionSceneLockEdit(
|
||||||
|
parent, std::dynamic_pointer_cast<MacroActionSceneLock>(
|
||||||
|
action));
|
||||||
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void SceneChanged(const SceneSelection &);
|
||||||
|
void SourceChanged(const SceneItemSelection &);
|
||||||
|
void ActionChanged(int value);
|
||||||
|
signals:
|
||||||
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SceneSelectionWidget *_scenes;
|
||||||
|
SceneItemSelectionWidget *_sources;
|
||||||
|
QComboBox *_actions;
|
||||||
|
std::shared_ptr<MacroActionSceneLock> _entryData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _loading = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace advss
|
||||||
@@ -23,7 +23,7 @@ const static std::map<SceneOrderAction, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.sceneOrder.type.movePosition"},
|
"AdvSceneSwitcher.action.sceneOrder.type.movePosition"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void moveSceneItemsUp(std::vector<obs_scene_item *> &items)
|
static void moveSceneItemsUp(std::vector<OBSSceneItem> &items)
|
||||||
{
|
{
|
||||||
// In the case of the same source being in two sequential positions
|
// In the case of the same source being in two sequential positions
|
||||||
// moving the sources up will cause the sources to swap positions due to
|
// moving the sources up will cause the sources to swap positions due to
|
||||||
@@ -33,41 +33,36 @@ static void moveSceneItemsUp(std::vector<obs_scene_item *> &items)
|
|||||||
// will be moved up.
|
// will be moved up.
|
||||||
std::reverse(items.begin(), items.end());
|
std::reverse(items.begin(), items.end());
|
||||||
|
|
||||||
for (auto &i : items) {
|
for (const auto &i : items) {
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_UP);
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_UP);
|
||||||
obs_sceneitem_release(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void moveSceneItemsDown(std::vector<obs_scene_item *> &items)
|
static void moveSceneItemsDown(std::vector<OBSSceneItem> &items)
|
||||||
{
|
{
|
||||||
for (auto &i : items) {
|
for (const auto &i : items) {
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_DOWN);
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_DOWN);
|
||||||
obs_sceneitem_release(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void moveSceneItemsTop(std::vector<obs_scene_item *> &items)
|
static void moveSceneItemsTop(std::vector<OBSSceneItem> &items)
|
||||||
{
|
{
|
||||||
for (auto &i : items) {
|
for (const auto &i : items) {
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_TOP);
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_TOP);
|
||||||
obs_sceneitem_release(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void moveSceneItemsBottom(std::vector<obs_scene_item *> &items)
|
static void moveSceneItemsBottom(std::vector<OBSSceneItem> &items)
|
||||||
{
|
{
|
||||||
for (auto &i : items) {
|
for (const auto &i : items) {
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_BOTTOM);
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_BOTTOM);
|
||||||
obs_sceneitem_release(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void moveSceneItemsPos(std::vector<obs_scene_item *> &items, int pos)
|
static void moveSceneItemsPos(std::vector<OBSSceneItem> &items, int pos)
|
||||||
{
|
{
|
||||||
for (auto &i : items) {
|
for (const auto &i : items) {
|
||||||
obs_sceneitem_set_order_position(i, pos);
|
obs_sceneitem_set_order_position(i, pos);
|
||||||
obs_sceneitem_release(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +144,7 @@ std::string MacroActionSceneOrder::GetShortDesc() const
|
|||||||
|
|
||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : actionTypes) {
|
for (const auto &entry : actionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(entry.second.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,6 +223,8 @@ void MacroActionSceneOrderEdit::SourceChanged(const SceneItemSelection &item)
|
|||||||
_entryData->_source = item;
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneOrderEdit::ActionChanged(int value)
|
void MacroActionSceneOrderEdit::ActionChanged(int value)
|
||||||
|
|||||||
@@ -12,7 +12,15 @@ const std::string MacroActionSwitchScene::id = "scene_switch";
|
|||||||
bool MacroActionSwitchScene::_registered = MacroActionFactory::Register(
|
bool MacroActionSwitchScene::_registered = MacroActionFactory::Register(
|
||||||
MacroActionSwitchScene::id,
|
MacroActionSwitchScene::id,
|
||||||
{MacroActionSwitchScene::Create, MacroActionSwitchSceneEdit::Create,
|
{MacroActionSwitchScene::Create, MacroActionSwitchSceneEdit::Create,
|
||||||
"AdvSceneSwitcher.action.switchScene"});
|
"AdvSceneSwitcher.action.scene"});
|
||||||
|
|
||||||
|
const static std::map<MacroActionSwitchScene::SceneType, std::string>
|
||||||
|
sceneTypes = {
|
||||||
|
{MacroActionSwitchScene::SceneType::PROGRAM,
|
||||||
|
"AdvSceneSwitcher.action.scene.type.program"},
|
||||||
|
{MacroActionSwitchScene::SceneType::PREVIEW,
|
||||||
|
"AdvSceneSwitcher.action.scene.type.preview"},
|
||||||
|
};
|
||||||
|
|
||||||
static void waitForTransitionChange(OBSWeakSource &transition,
|
static void waitForTransitionChange(OBSWeakSource &transition,
|
||||||
std::unique_lock<std::mutex> *lock,
|
std::unique_lock<std::mutex> *lock,
|
||||||
@@ -20,6 +28,9 @@ static void waitForTransitionChange(OBSWeakSource &transition,
|
|||||||
{
|
{
|
||||||
const auto time = 100ms;
|
const auto time = 100ms;
|
||||||
obs_source_t *source = obs_weak_source_get_source(transition);
|
obs_source_t *source = obs_weak_source_get_source(transition);
|
||||||
|
if (!source) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool stillTransitioning = true;
|
bool stillTransitioning = true;
|
||||||
while (stillTransitioning && !switcher->abortMacroWait &&
|
while (stillTransitioning && !switcher->abortMacroWait &&
|
||||||
@@ -123,10 +134,19 @@ bool MacroActionSwitchScene::WaitForTransition(OBSWeakSource &scene,
|
|||||||
bool MacroActionSwitchScene::PerformAction()
|
bool MacroActionSwitchScene::PerformAction()
|
||||||
{
|
{
|
||||||
auto scene = _scene.GetScene();
|
auto scene = _scene.GetScene();
|
||||||
|
|
||||||
|
if (_sceneType == SceneType::PREVIEW) {
|
||||||
|
OBSSourceAutoRelease previewScneSource =
|
||||||
|
obs_weak_source_get_source(scene);
|
||||||
|
obs_frontend_set_current_preview_scene(previewScneSource);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
auto transition = _transition.GetTransition();
|
auto transition = _transition.GetTransition();
|
||||||
SwitchScene({scene, transition, (int)(_duration.Milliseconds())},
|
SwitchScene({scene, transition, (int)(_duration.Milliseconds())},
|
||||||
obs_frontend_preview_program_mode_active());
|
obs_frontend_preview_program_mode_active());
|
||||||
if (_blockUntilTransitionDone && scene) {
|
if (_blockUntilTransitionDone && scene &&
|
||||||
|
scene != switcher->currentScene) {
|
||||||
return WaitForTransition(scene, transition);
|
return WaitForTransition(scene, transition);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -134,24 +154,9 @@ bool MacroActionSwitchScene::PerformAction()
|
|||||||
|
|
||||||
void MacroActionSwitchScene::LogAction() const
|
void MacroActionSwitchScene::LogAction() const
|
||||||
{
|
{
|
||||||
auto t = _scene.GetType();
|
vblog(LOG_INFO, "switch%s scene to '%s'",
|
||||||
auto sceneName = GetWeakSourceName(_scene.GetScene(false));
|
_sceneType == SceneType::PREVIEW ? " preview" : "",
|
||||||
switch (t) {
|
_scene.ToString(true).c_str());
|
||||||
case SceneSelection::Type::SCENE:
|
|
||||||
vblog(LOG_INFO, "switch to scene '%s'",
|
|
||||||
_scene.ToString(true).c_str());
|
|
||||||
break;
|
|
||||||
case SceneSelection::Type::GROUP:
|
|
||||||
vblog(LOG_INFO, "switch to scene '%s' (scene group '%s')",
|
|
||||||
sceneName.c_str(), _scene.ToString(true).c_str());
|
|
||||||
break;
|
|
||||||
case SceneSelection::Type::PREVIOUS:
|
|
||||||
vblog(LOG_INFO, "switch to previous scene '%s'",
|
|
||||||
sceneName.c_str());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionSwitchScene::Save(obs_data_t *obj) const
|
bool MacroActionSwitchScene::Save(obs_data_t *obj) const
|
||||||
@@ -162,6 +167,7 @@ bool MacroActionSwitchScene::Save(obs_data_t *obj) const
|
|||||||
_duration.Save(obj);
|
_duration.Save(obj);
|
||||||
obs_data_set_bool(obj, "blockUntilTransitionDone",
|
obs_data_set_bool(obj, "blockUntilTransitionDone",
|
||||||
_blockUntilTransitionDone);
|
_blockUntilTransitionDone);
|
||||||
|
obs_data_set_int(obj, "sceneType", static_cast<int>(_sceneType));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,6 +179,7 @@ bool MacroActionSwitchScene::Load(obs_data_t *obj)
|
|||||||
_duration.Load(obj);
|
_duration.Load(obj);
|
||||||
_blockUntilTransitionDone =
|
_blockUntilTransitionDone =
|
||||||
obs_data_get_bool(obj, "blockUntilTransitionDone");
|
obs_data_get_bool(obj, "blockUntilTransitionDone");
|
||||||
|
_sceneType = static_cast<SceneType>(obs_data_get_int(obj, "sceneType"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,6 +188,13 @@ std::string MacroActionSwitchScene::GetShortDesc() const
|
|||||||
return _scene.ToString();
|
return _scene.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void populateTypeSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
for (const auto &[_, name] : sceneTypes) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSwitchScene> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSwitchScene> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
@@ -189,9 +203,11 @@ MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
|||||||
_duration(new DurationSelection(parent, false)),
|
_duration(new DurationSelection(parent, false)),
|
||||||
_blockUntilTransitionDone(new QCheckBox(obs_module_text(
|
_blockUntilTransitionDone(new QCheckBox(obs_module_text(
|
||||||
"AdvSceneSwitcher.action.scene.blockUntilTransitionDone"))),
|
"AdvSceneSwitcher.action.scene.blockUntilTransitionDone"))),
|
||||||
|
_sceneTypes(new QComboBox()),
|
||||||
_entryLayout(new QHBoxLayout())
|
_entryLayout(new QHBoxLayout())
|
||||||
{
|
{
|
||||||
_duration->SpinBox()->setSpecialValueText("-");
|
_duration->SpinBox()->setSpecialValueText("-");
|
||||||
|
populateTypeSelection(_sceneTypes);
|
||||||
|
|
||||||
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SceneChanged(const SceneSelection &)));
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
@@ -203,28 +219,29 @@ MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
|||||||
this, SLOT(DurationChanged(const Duration &)));
|
this, SLOT(DurationChanged(const Duration &)));
|
||||||
QWidget::connect(_blockUntilTransitionDone, SIGNAL(stateChanged(int)),
|
QWidget::connect(_blockUntilTransitionDone, SIGNAL(stateChanged(int)),
|
||||||
this, SLOT(BlockUntilTransitionDoneChanged(int)));
|
this, SLOT(BlockUntilTransitionDoneChanged(int)));
|
||||||
|
QWidget::connect(_sceneTypes, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SceneTypeChanged(int)));
|
||||||
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
|
||||||
{"{{scenes}}", _scenes},
|
|
||||||
{"{{transitions}}", _transitions},
|
|
||||||
{"{{duration}}", _duration},
|
|
||||||
{"{{blockUntilTransitionDone}}", _blockUntilTransitionDone},
|
|
||||||
};
|
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.scene.entry"),
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.scene.entry"),
|
||||||
_entryLayout, widgetPlaceholders);
|
_entryLayout,
|
||||||
|
{{"{{scenes}}", _scenes},
|
||||||
|
{"{{transitions}}", _transitions},
|
||||||
|
{"{{duration}}", _duration},
|
||||||
|
{"{{sceneTypes}}", _sceneTypes}});
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
auto mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(_entryLayout);
|
mainLayout->addLayout(_entryLayout);
|
||||||
mainLayout->addWidget(_blockUntilTransitionDone);
|
mainLayout->addWidget(_blockUntilTransitionDone);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
|
_sceneTypes->setCurrentIndex(static_cast<int>(_entryData->_sceneType));
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
_transitions->SetTransition(_entryData->_transition);
|
_transitions->SetTransition(_entryData->_transition);
|
||||||
_duration->SetDuration(_entryData->_duration);
|
_duration->SetDuration(_entryData->_duration);
|
||||||
_blockUntilTransitionDone->setChecked(
|
_blockUntilTransitionDone->setChecked(
|
||||||
_entryData->_blockUntilTransitionDone);
|
_entryData->_blockUntilTransitionDone);
|
||||||
SetDurationVisibility();
|
SetWidgetVisibility();
|
||||||
_loading = false;
|
_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,8 +265,44 @@ void MacroActionSwitchSceneEdit::BlockUntilTransitionDoneChanged(int state)
|
|||||||
_entryData->_blockUntilTransitionDone = state;
|
_entryData->_blockUntilTransitionDone = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSwitchSceneEdit::SetDurationVisibility()
|
void MacroActionSwitchSceneEdit::SceneTypeChanged(int value)
|
||||||
{
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_sceneType =
|
||||||
|
static_cast<MacroActionSwitchScene::SceneType>(value);
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSwitchSceneEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
_entryLayout->removeWidget(_scenes);
|
||||||
|
_entryLayout->removeWidget(_transitions);
|
||||||
|
_entryLayout->removeWidget(_duration);
|
||||||
|
_entryLayout->removeWidget(_sceneTypes);
|
||||||
|
ClearLayout(_entryLayout);
|
||||||
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
|
{"{{scenes}}", _scenes},
|
||||||
|
{"{{transitions}}", _transitions},
|
||||||
|
{"{{duration}}", _duration},
|
||||||
|
{"{{sceneTypes}}", _sceneTypes},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_entryData->_sceneType ==
|
||||||
|
MacroActionSwitchScene::SceneType::PREVIEW) {
|
||||||
|
_transitions->hide();
|
||||||
|
_duration->hide();
|
||||||
|
PlaceWidgets(
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.scene.entry.preview"),
|
||||||
|
_entryLayout, widgetPlaceholders);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_transitions->show();
|
||||||
if (_entryData->_transition.GetType() !=
|
if (_entryData->_transition.GetType() !=
|
||||||
TransitionSelection::Type::TRANSITION) {
|
TransitionSelection::Type::TRANSITION) {
|
||||||
_duration->show();
|
_duration->show();
|
||||||
@@ -258,15 +311,6 @@ void MacroActionSwitchSceneEdit::SetDurationVisibility()
|
|||||||
_entryData->_transition.GetTransition());
|
_entryData->_transition.GetTransition());
|
||||||
_duration->setVisible(!fixedDuration);
|
_duration->setVisible(!fixedDuration);
|
||||||
|
|
||||||
_entryLayout->removeWidget(_scenes);
|
|
||||||
_entryLayout->removeWidget(_transitions);
|
|
||||||
_entryLayout->removeWidget(_duration);
|
|
||||||
ClearLayout(_entryLayout);
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
|
||||||
{"{{scenes}}", _scenes},
|
|
||||||
{"{{transitions}}", _transitions},
|
|
||||||
{"{{duration}}", _duration},
|
|
||||||
};
|
|
||||||
if (fixedDuration) {
|
if (fixedDuration) {
|
||||||
PlaceWidgets(
|
PlaceWidgets(
|
||||||
obs_module_text(
|
obs_module_text(
|
||||||
@@ -299,7 +343,7 @@ void MacroActionSwitchSceneEdit::TransitionChanged(const TransitionSelection &t)
|
|||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_transition = t;
|
_entryData->_transition = t;
|
||||||
SetDurationVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ public:
|
|||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSwitchScene>(m);
|
return std::make_shared<MacroActionSwitchScene>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class SceneType { PROGRAM, PREVIEW };
|
||||||
|
SceneType _sceneType = SceneType::PROGRAM;
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
TransitionSelection _transition;
|
TransitionSelection _transition;
|
||||||
Duration _duration;
|
Duration _duration;
|
||||||
@@ -55,20 +58,21 @@ private slots:
|
|||||||
void TransitionChanged(const TransitionSelection &);
|
void TransitionChanged(const TransitionSelection &);
|
||||||
void DurationChanged(const Duration &seconds);
|
void DurationChanged(const Duration &seconds);
|
||||||
void BlockUntilTransitionDoneChanged(int state);
|
void BlockUntilTransitionDoneChanged(int state);
|
||||||
|
void SceneTypeChanged(int);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
TransitionSelectionWidget *_transitions;
|
TransitionSelectionWidget *_transitions;
|
||||||
DurationSelection *_duration;
|
DurationSelection *_duration;
|
||||||
QCheckBox *_blockUntilTransitionDone;
|
QCheckBox *_blockUntilTransitionDone;
|
||||||
|
QComboBox *_sceneTypes;
|
||||||
QHBoxLayout *_entryLayout;
|
QHBoxLayout *_entryLayout;
|
||||||
|
|
||||||
std::shared_ptr<MacroActionSwitchScene> _entryData;
|
std::shared_ptr<MacroActionSwitchScene> _entryData;
|
||||||
|
|
||||||
private:
|
|
||||||
void SetDurationVisibility();
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "macro-action-scene-transform.hpp"
|
#include "macro-action-scene-transform.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
#include <graphics/matrix4.h>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
const std::string MacroActionSceneTransform::id = "scene_transform";
|
const std::string MacroActionSceneTransform::id = "scene_transform";
|
||||||
@@ -11,18 +13,242 @@ bool MacroActionSceneTransform::_registered = MacroActionFactory::Register(
|
|||||||
MacroActionSceneTransformEdit::Create,
|
MacroActionSceneTransformEdit::Create,
|
||||||
"AdvSceneSwitcher.action.sceneTransform"});
|
"AdvSceneSwitcher.action.sceneTransform"});
|
||||||
|
|
||||||
bool MacroActionSceneTransform::PerformAction()
|
const static std::map<MacroActionSceneTransform::Action, std::string> actions = {
|
||||||
{
|
{MacroActionSceneTransform::Action::MANUAL_TRANSFORM,
|
||||||
ApplySettings(_settings); // Resolves variables
|
"AdvSceneSwitcher.action.sceneTransform.type.manual"},
|
||||||
|
{MacroActionSceneTransform::Action::RESET,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.reset"},
|
||||||
|
{MacroActionSceneTransform::Action::ROTATE,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.rotate"},
|
||||||
|
{MacroActionSceneTransform::Action::FLIP_HORIZONTAL,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.flipHorizontal"},
|
||||||
|
{MacroActionSceneTransform::Action::FLIP_VERTICAL,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.flipVertical"},
|
||||||
|
{MacroActionSceneTransform::Action::FIT_TO_SCREEN,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.fitToScreen"},
|
||||||
|
{MacroActionSceneTransform::Action::STRETCH_TO_SCREEN,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.stretchToScreen"},
|
||||||
|
{MacroActionSceneTransform::Action::CENTER_TO_SCREEN,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.centerToScreen"},
|
||||||
|
{MacroActionSceneTransform::Action::CENTER_VERTICALLY,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.centerVertically"},
|
||||||
|
{MacroActionSceneTransform::Action::CENTER_HORIZONTALLY,
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.type.centerHorizontally"},
|
||||||
|
};
|
||||||
|
|
||||||
auto items = _source.GetSceneItems(_scene);
|
/* --------------- Helpers based on OBS window-basic-main.cpp --------------- */
|
||||||
for (auto &item : items) {
|
|
||||||
|
static void getItemBox(obs_sceneitem_t *item, vec3 &tl, vec3 &br)
|
||||||
|
{
|
||||||
|
matrix4 boxTransform;
|
||||||
|
obs_sceneitem_get_box_transform(item, &boxTransform);
|
||||||
|
|
||||||
|
vec3_set(&tl, M_INFINITE, M_INFINITE, 0.0f);
|
||||||
|
vec3_set(&br, -M_INFINITE, -M_INFINITE, 0.0f);
|
||||||
|
|
||||||
|
auto GetMinPos = [&](float x, float y) {
|
||||||
|
vec3 pos;
|
||||||
|
vec3_set(&pos, x, y, 0.0f);
|
||||||
|
vec3_transform(&pos, &pos, &boxTransform);
|
||||||
|
vec3_min(&tl, &tl, &pos);
|
||||||
|
vec3_max(&br, &br, &pos);
|
||||||
|
};
|
||||||
|
|
||||||
|
GetMinPos(0.0f, 0.0f);
|
||||||
|
GetMinPos(1.0f, 0.0f);
|
||||||
|
GetMinPos(0.0f, 1.0f);
|
||||||
|
GetMinPos(1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static vec3 getItemTL(obs_sceneitem_t *item)
|
||||||
|
{
|
||||||
|
vec3 tl, br;
|
||||||
|
getItemBox(item, tl, br);
|
||||||
|
return tl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setItemTL(obs_sceneitem_t *item, const vec3 &tl)
|
||||||
|
{
|
||||||
|
vec3 newTL;
|
||||||
|
vec2 pos;
|
||||||
|
|
||||||
|
obs_sceneitem_get_pos(item, &pos);
|
||||||
|
newTL = getItemTL(item);
|
||||||
|
pos.x += tl.x - newTL.x;
|
||||||
|
pos.y += tl.y - newTL.y;
|
||||||
|
obs_sceneitem_set_pos(item, &pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void reset(obs_sceneitem_t *item)
|
||||||
|
{
|
||||||
|
obs_transform_info info;
|
||||||
|
vec2_set(&info.pos, 0.0f, 0.0f);
|
||||||
|
vec2_set(&info.scale, 1.0f, 1.0f);
|
||||||
|
info.rot = 0.0f;
|
||||||
|
info.alignment = OBS_ALIGN_TOP | OBS_ALIGN_LEFT;
|
||||||
|
info.bounds_type = OBS_BOUNDS_NONE;
|
||||||
|
info.bounds_alignment = OBS_ALIGN_CENTER;
|
||||||
|
vec2_set(&info.bounds, 0.0f, 0.0f);
|
||||||
|
obs_sceneitem_set_info(item, &info);
|
||||||
|
|
||||||
|
obs_sceneitem_crop crop = {};
|
||||||
|
obs_sceneitem_set_crop(item, &crop);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rotate(obs_sceneitem_t *item, float rot)
|
||||||
|
{
|
||||||
|
vec3 tl = getItemTL(item);
|
||||||
|
rot += obs_sceneitem_get_rot(item);
|
||||||
|
if (rot >= 360.0f) {
|
||||||
|
rot -= 360.0f;
|
||||||
|
} else if (rot <= -360.0f) {
|
||||||
|
rot += 360.0f;
|
||||||
|
}
|
||||||
|
obs_sceneitem_set_rot(item, rot);
|
||||||
|
obs_sceneitem_force_update_transform(item);
|
||||||
|
setItemTL(item, tl);
|
||||||
|
};
|
||||||
|
|
||||||
|
static void flip(obs_sceneitem_t *item, const vec2 &mul)
|
||||||
|
{
|
||||||
|
vec3 tl = getItemTL(item);
|
||||||
|
vec2 scale;
|
||||||
|
obs_sceneitem_get_scale(item, &scale);
|
||||||
|
vec2_mul(&scale, &scale, &mul);
|
||||||
|
obs_sceneitem_set_scale(item, &scale);
|
||||||
|
obs_sceneitem_force_update_transform(item);
|
||||||
|
setItemTL(item, tl);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void centerAlign(obs_sceneitem_t *item, obs_bounds_type boundsType)
|
||||||
|
{
|
||||||
|
obs_video_info ovi;
|
||||||
|
obs_get_video_info(&ovi);
|
||||||
|
|
||||||
|
obs_transform_info itemInfo;
|
||||||
|
vec2_set(&itemInfo.pos, 0.0f, 0.0f);
|
||||||
|
vec2_set(&itemInfo.scale, 1.0f, 1.0f);
|
||||||
|
itemInfo.alignment = OBS_ALIGN_LEFT | OBS_ALIGN_TOP;
|
||||||
|
itemInfo.rot = 0.0f;
|
||||||
|
|
||||||
|
vec2_set(&itemInfo.bounds, float(ovi.base_width),
|
||||||
|
float(ovi.base_height));
|
||||||
|
itemInfo.bounds_type = boundsType;
|
||||||
|
itemInfo.bounds_alignment = OBS_ALIGN_CENTER;
|
||||||
|
|
||||||
|
obs_sceneitem_set_info(item, &itemInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class CenterType {
|
||||||
|
SCREEN,
|
||||||
|
VERTICAL,
|
||||||
|
HORIZONTAL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void center(obs_sceneitem_t *item, const CenterType ¢erType)
|
||||||
|
{
|
||||||
|
// Get center x, y coordinates of items
|
||||||
|
vec3 tl, br;
|
||||||
|
getItemBox(item, tl, br);
|
||||||
|
|
||||||
|
float left = tl.x;
|
||||||
|
float top = tl.y;
|
||||||
|
float right = br.x;
|
||||||
|
float bottom = br.y;
|
||||||
|
|
||||||
|
vec3 center;
|
||||||
|
center.x = (right + left) / 2.0f;
|
||||||
|
center.y = (top + bottom) / 2.0f;
|
||||||
|
center.z = 0.0f;
|
||||||
|
|
||||||
|
// Get coordinates of screen center
|
||||||
|
obs_video_info ovi;
|
||||||
|
obs_get_video_info(&ovi);
|
||||||
|
|
||||||
|
vec3 screenCenter;
|
||||||
|
vec3_set(&screenCenter, float(ovi.base_width), float(ovi.base_height),
|
||||||
|
0.0f);
|
||||||
|
|
||||||
|
vec3_mulf(&screenCenter, &screenCenter, 0.5f);
|
||||||
|
|
||||||
|
// Calculate difference between screen center and item center
|
||||||
|
vec3 offset;
|
||||||
|
vec3_sub(&offset, &screenCenter, ¢er);
|
||||||
|
|
||||||
|
// Shift item by offset
|
||||||
|
vec3_add(&tl, &tl, &offset);
|
||||||
|
|
||||||
|
vec3 itemTL = getItemTL(item);
|
||||||
|
|
||||||
|
if (centerType == CenterType::VERTICAL) {
|
||||||
|
tl.x = itemTL.x;
|
||||||
|
} else if (centerType == CenterType::HORIZONTAL) {
|
||||||
|
tl.y = itemTL.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
setItemTL(item, tl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void MacroActionSceneTransform::Transform(obs_scene_item *item)
|
||||||
|
{
|
||||||
|
if (!item) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (_action) {
|
||||||
|
case MacroActionSceneTransform::Action::RESET:
|
||||||
|
obs_sceneitem_defer_update_begin(item);
|
||||||
|
reset(item);
|
||||||
|
obs_sceneitem_defer_update_end(item);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MacroActionSceneTransform::Action::ROTATE:
|
||||||
|
rotate(item, _rotation);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneTransform::Action::FLIP_HORIZONTAL: {
|
||||||
|
vec2 scale;
|
||||||
|
vec2_set(&scale, -1.0f, 1.0f);
|
||||||
|
flip(item, scale);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MacroActionSceneTransform::Action::FLIP_VERTICAL: {
|
||||||
|
vec2 scale;
|
||||||
|
vec2_set(&scale, 1.0f, -1.0f);
|
||||||
|
flip(item, scale);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MacroActionSceneTransform::Action::FIT_TO_SCREEN:
|
||||||
|
centerAlign(item, OBS_BOUNDS_SCALE_INNER);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneTransform::Action::STRETCH_TO_SCREEN:
|
||||||
|
centerAlign(item, OBS_BOUNDS_STRETCH);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneTransform::Action::CENTER_TO_SCREEN:
|
||||||
|
center(item, CenterType::SCREEN);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneTransform::Action::CENTER_VERTICALLY:
|
||||||
|
center(item, CenterType::VERTICAL);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneTransform::Action::CENTER_HORIZONTALLY:
|
||||||
|
center(item, CenterType::HORIZONTAL);
|
||||||
|
break;
|
||||||
|
case MacroActionSceneTransform::Action::MANUAL_TRANSFORM:
|
||||||
|
ApplySettings(_settings); // Resolves variables
|
||||||
obs_sceneitem_defer_update_begin(item);
|
obs_sceneitem_defer_update_begin(item);
|
||||||
obs_sceneitem_set_info(item, &_info);
|
obs_sceneitem_set_info(item, &_info);
|
||||||
obs_sceneitem_set_crop(item, &_crop);
|
obs_sceneitem_set_crop(item, &_crop);
|
||||||
obs_sceneitem_defer_update_end(item);
|
obs_sceneitem_defer_update_end(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obs_sceneitem_release(item);
|
bool MacroActionSceneTransform::PerformAction()
|
||||||
|
{
|
||||||
|
auto items = _source.GetSceneItems(_scene);
|
||||||
|
for (const auto &item : items) {
|
||||||
|
Transform(item);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -30,15 +256,18 @@ bool MacroActionSceneTransform::PerformAction()
|
|||||||
void MacroActionSceneTransform::LogAction() const
|
void MacroActionSceneTransform::LogAction() const
|
||||||
{
|
{
|
||||||
vblog(LOG_INFO,
|
vblog(LOG_INFO,
|
||||||
"performed transform action for source \"%s\" on scene \"%s\"",
|
"performed transform action %d for source \"%s\" on scene \"%s\"",
|
||||||
_source.ToString(true).c_str(), _scene.ToString(true).c_str());
|
static_cast<int>(_action), _source.ToString(true).c_str(),
|
||||||
|
_scene.ToString(true).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionSceneTransform::Save(obs_data_t *obj) const
|
bool MacroActionSceneTransform::Save(obs_data_t *obj) const
|
||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
_scene.Save(obj);
|
_scene.Save(obj);
|
||||||
_source.Save(obj);
|
_source.Save(obj);
|
||||||
|
_rotation.Save(obj, "rotation");
|
||||||
_settings.Save(obj, "settings");
|
_settings.Save(obj, "settings");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -53,8 +282,15 @@ bool MacroActionSceneTransform::Load(obs_data_t *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
|
if (!obs_data_has_user_value(obj, "action")) {
|
||||||
|
_action =
|
||||||
|
Action::MANUAL_TRANSFORM; // TODO: Remove fallback in future
|
||||||
|
} else {
|
||||||
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
|
}
|
||||||
_scene.Load(obj);
|
_scene.Load(obj);
|
||||||
_source.Load(obj);
|
_source.Load(obj);
|
||||||
|
_rotation.Load(obj, "rotation");
|
||||||
_settings.Load(obj, "settings");
|
_settings.Load(obj, "settings");
|
||||||
|
|
||||||
// Convert old data format
|
// Convert old data format
|
||||||
@@ -107,21 +343,34 @@ void MacroActionSceneTransform::ApplySettings(const std::string &settings)
|
|||||||
}
|
}
|
||||||
obs_data_release(obj);
|
obs_data_release(obj);
|
||||||
}
|
}
|
||||||
for (auto item : items) {
|
|
||||||
obs_sceneitem_release(item);
|
|
||||||
}
|
|
||||||
obs_data_release(data);
|
obs_data_release(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
for (const auto &[type, name] : actions) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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)),
|
||||||
|
_sources(new SceneItemSelectionWidget(parent)),
|
||||||
|
_action(new QComboBox()),
|
||||||
|
_rotation(new VariableDoubleSpinBox()),
|
||||||
|
_getSettings(new QPushButton(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.sceneTransform.getTransform"))),
|
||||||
|
_settings(new VariableTextEdit(this)),
|
||||||
|
_buttonLayout(new QHBoxLayout())
|
||||||
{
|
{
|
||||||
_scenes = new SceneSelectionWidget(window(), true, false, false, true);
|
_rotation->setMinimum(-360);
|
||||||
_sources = new SceneItemSelectionWidget(parent);
|
_rotation->setMaximum(360);
|
||||||
_getSettings = new QPushButton(obs_module_text(
|
_rotation->setSuffix("°");
|
||||||
"AdvSceneSwitcher.action.sceneTransform.getTransform"));
|
|
||||||
_settings = new VariableTextEdit(this);
|
populateActionSelection(_action);
|
||||||
|
|
||||||
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SceneChanged(const SceneSelection &)));
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
@@ -130,6 +379,12 @@ MacroActionSceneTransformEdit::MacroActionSceneTransformEdit(
|
|||||||
QWidget::connect(_sources,
|
QWidget::connect(_sources,
|
||||||
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
||||||
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
||||||
|
QWidget::connect(_action, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(ActionChanged(int)));
|
||||||
|
QWidget::connect(
|
||||||
|
_rotation,
|
||||||
|
SIGNAL(NumberVariableChanged(const NumberVariable<double> &)),
|
||||||
|
this, SLOT(RotationChanged(const NumberVariable<double> &)));
|
||||||
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
||||||
SLOT(GetSettingsClicked()));
|
SLOT(GetSettingsClicked()));
|
||||||
QWidget::connect(_settings, SIGNAL(textChanged()), this,
|
QWidget::connect(_settings, SIGNAL(textChanged()), this,
|
||||||
@@ -138,23 +393,21 @@ MacroActionSceneTransformEdit::MacroActionSceneTransformEdit(
|
|||||||
QHBoxLayout *entryLayout = new QHBoxLayout;
|
QHBoxLayout *entryLayout = new QHBoxLayout;
|
||||||
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{scenes}}", _scenes},
|
{"{{scenes}}", _scenes}, {"{{rotation}}", _rotation},
|
||||||
{"{{sources}}", _sources},
|
{"{{sources}}", _sources}, {"{{action}}", _action},
|
||||||
{"{{settings}}", _settings},
|
{"{{settings}}", _settings}, {"{{getSettings}}", _getSettings},
|
||||||
{"{{getSettings}}", _getSettings},
|
|
||||||
};
|
};
|
||||||
PlaceWidgets(
|
PlaceWidgets(
|
||||||
obs_module_text("AdvSceneSwitcher.action.sceneTransform.entry"),
|
obs_module_text("AdvSceneSwitcher.action.sceneTransform.entry"),
|
||||||
entryLayout, widgetPlaceholders);
|
entryLayout, widgetPlaceholders);
|
||||||
|
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
_buttonLayout->addWidget(_getSettings);
|
||||||
buttonLayout->addWidget(_getSettings);
|
_buttonLayout->addStretch();
|
||||||
buttonLayout->addStretch();
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(entryLayout);
|
mainLayout->addLayout(entryLayout);
|
||||||
mainLayout->addWidget(_settings);
|
mainLayout->addWidget(_settings);
|
||||||
mainLayout->addLayout(buttonLayout);
|
mainLayout->addLayout(_buttonLayout);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
@@ -170,10 +423,11 @@ void MacroActionSceneTransformEdit::UpdateEntryData()
|
|||||||
|
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
_sources->SetSceneItem(_entryData->_source);
|
_sources->SetSceneItem(_entryData->_source);
|
||||||
|
_action->setCurrentIndex(
|
||||||
|
_action->findData(static_cast<int>(_entryData->_action)));
|
||||||
|
_rotation->SetValue(_entryData->_rotation);
|
||||||
_settings->setPlainText(_entryData->_settings);
|
_settings->setPlainText(_entryData->_settings);
|
||||||
|
SetWidgetVisibility();
|
||||||
adjustSize();
|
|
||||||
updateGeometry();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneTransformEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSceneTransformEdit::SceneChanged(const SceneSelection &s)
|
||||||
@@ -196,6 +450,30 @@ void MacroActionSceneTransformEdit::SourceChanged(const SceneItemSelection &item
|
|||||||
_entryData->_source = item;
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneTransformEdit::ActionChanged(int idx)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_action = static_cast<MacroActionSceneTransform::Action>(
|
||||||
|
_action->itemData(idx).toInt());
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneTransformEdit::RotationChanged(const DoubleVariable &value)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_rotation = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneTransformEdit::GetSettingsClicked()
|
void MacroActionSceneTransformEdit::GetSettingsClicked()
|
||||||
@@ -211,9 +489,6 @@ void MacroActionSceneTransformEdit::GetSettingsClicked()
|
|||||||
|
|
||||||
auto settings = GetSceneItemTransform(items[0]);
|
auto settings = GetSceneItemTransform(items[0]);
|
||||||
_settings->setPlainText(FormatJsonString(settings));
|
_settings->setPlainText(FormatJsonString(settings));
|
||||||
for (auto item : items) {
|
|
||||||
obs_sceneitem_release(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneTransformEdit::SettingsChanged()
|
void MacroActionSceneTransformEdit::SettingsChanged()
|
||||||
@@ -229,4 +504,19 @@ void MacroActionSceneTransformEdit::SettingsChanged()
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneTransformEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
SetLayoutVisible(
|
||||||
|
_buttonLayout,
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionSceneTransform::Action::MANUAL_TRANSFORM);
|
||||||
|
_settings->setVisible(
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionSceneTransform::Action::MANUAL_TRANSFORM);
|
||||||
|
_rotation->setVisible(_entryData->_action ==
|
||||||
|
MacroActionSceneTransform::Action::ROTATE);
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "scene-selection.hpp"
|
#include "scene-selection.hpp"
|
||||||
#include "scene-item-selection.hpp"
|
#include "scene-item-selection.hpp"
|
||||||
#include "variable-text-edit.hpp"
|
#include "variable-text-edit.hpp"
|
||||||
|
#include "variable-spinbox.hpp"
|
||||||
|
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
||||||
@@ -22,11 +23,27 @@ public:
|
|||||||
return std::make_shared<MacroActionSceneTransform>(m);
|
return std::make_shared<MacroActionSceneTransform>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class Action {
|
||||||
|
RESET,
|
||||||
|
ROTATE,
|
||||||
|
FLIP_HORIZONTAL,
|
||||||
|
FLIP_VERTICAL,
|
||||||
|
FIT_TO_SCREEN,
|
||||||
|
STRETCH_TO_SCREEN,
|
||||||
|
CENTER_TO_SCREEN,
|
||||||
|
CENTER_VERTICALLY,
|
||||||
|
CENTER_HORIZONTALLY,
|
||||||
|
MANUAL_TRANSFORM = 100,
|
||||||
|
};
|
||||||
|
|
||||||
|
Action _action = Action::RESET;
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
SceneItemSelection _source;
|
SceneItemSelection _source;
|
||||||
StringVariable _settings = "";
|
StringVariable _settings = "";
|
||||||
|
DoubleVariable _rotation = 90.0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Transform(obs_scene_item *);
|
||||||
void ApplySettings(const std::string &);
|
void ApplySettings(const std::string &);
|
||||||
std::string ConvertSettings();
|
std::string ConvertSettings();
|
||||||
|
|
||||||
@@ -57,19 +74,25 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceChanged(const SceneItemSelection &);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
|
void ActionChanged(int);
|
||||||
|
void RotationChanged(const NumberVariable<double> &value);
|
||||||
void GetSettingsClicked();
|
void GetSettingsClicked();
|
||||||
void SettingsChanged();
|
void SettingsChanged();
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
SceneItemSelectionWidget *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
|
QComboBox *_action;
|
||||||
|
VariableDoubleSpinBox *_rotation;
|
||||||
QPushButton *_getSettings;
|
QPushButton *_getSettings;
|
||||||
VariableTextEdit *_settings;
|
VariableTextEdit *_settings;
|
||||||
std::shared_ptr<MacroActionSceneTransform> _entryData;
|
QHBoxLayout *_buttonLayout;
|
||||||
|
|
||||||
private:
|
std::shared_ptr<MacroActionSceneTransform> _entryData;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,85 +11,38 @@ bool MacroActionSceneVisibility::_registered = MacroActionFactory::Register(
|
|||||||
MacroActionSceneVisibilityEdit::Create,
|
MacroActionSceneVisibilityEdit::Create,
|
||||||
"AdvSceneSwitcher.action.sceneVisibility"});
|
"AdvSceneSwitcher.action.sceneVisibility"});
|
||||||
|
|
||||||
const static std::map<SceneVisibilityAction, std::string> actionTypes = {
|
const static std::map<MacroActionSceneVisibility::Action, std::string>
|
||||||
{SceneVisibilityAction::SHOW,
|
actionTypes = {
|
||||||
"AdvSceneSwitcher.action.sceneVisibility.type.show"},
|
{MacroActionSceneVisibility::Action::SHOW,
|
||||||
{SceneVisibilityAction::HIDE,
|
"AdvSceneSwitcher.action.sceneVisibility.type.show"},
|
||||||
"AdvSceneSwitcher.action.sceneVisibility.type.hide"},
|
{MacroActionSceneVisibility::Action::HIDE,
|
||||||
{SceneVisibilityAction::TOGGLE,
|
"AdvSceneSwitcher.action.sceneVisibility.type.hide"},
|
||||||
"AdvSceneSwitcher.action.sceneVisibility.type.toggle"},
|
{MacroActionSceneVisibility::Action::TOGGLE,
|
||||||
};
|
"AdvSceneSwitcher.action.sceneVisibility.type.toggle"},
|
||||||
|
|
||||||
const static std::map<SceneItemSourceType, std::string> sourceItemSourceTypes = {
|
|
||||||
{SceneItemSourceType::SOURCE,
|
|
||||||
"AdvSceneSwitcher.action.sceneVisibility.type.source"},
|
|
||||||
{SceneItemSourceType::SOURCE_GROUP,
|
|
||||||
"AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup"},
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VisibilityData {
|
|
||||||
std::string name;
|
|
||||||
SceneVisibilityAction action;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void setSceneItemVisibility(obs_sceneitem_t *item,
|
static void setSceneItemVisibility(obs_sceneitem_t *item,
|
||||||
SceneVisibilityAction action)
|
MacroActionSceneVisibility::Action action)
|
||||||
{
|
{
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SceneVisibilityAction::SHOW:
|
case MacroActionSceneVisibility::Action::SHOW:
|
||||||
obs_sceneitem_set_visible(item, true);
|
obs_sceneitem_set_visible(item, true);
|
||||||
break;
|
break;
|
||||||
case SceneVisibilityAction::HIDE:
|
case MacroActionSceneVisibility::Action::HIDE:
|
||||||
obs_sceneitem_set_visible(item, false);
|
obs_sceneitem_set_visible(item, false);
|
||||||
break;
|
break;
|
||||||
case SceneVisibilityAction::TOGGLE:
|
case MacroActionSceneVisibility::Action::TOGGLE:
|
||||||
obs_sceneitem_set_visible(item, !obs_sceneitem_visible(item));
|
obs_sceneitem_set_visible(item, !obs_sceneitem_visible(item));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool visibilitySourceTypeEnum(obs_scene_t *, obs_sceneitem_t *item,
|
|
||||||
void *ptr)
|
|
||||||
{
|
|
||||||
VisibilityData *vInfo = reinterpret_cast<VisibilityData *>(ptr);
|
|
||||||
|
|
||||||
auto sourceTypeName = obs_source_get_display_name(
|
|
||||||
obs_source_get_id(obs_sceneitem_get_source(item)));
|
|
||||||
if (sourceTypeName && vInfo->name == sourceTypeName) {
|
|
||||||
setSceneItemVisibility(item, vInfo->action);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obs_sceneitem_is_group(item)) {
|
|
||||||
obs_scene_t *scene = obs_sceneitem_group_get_scene(item);
|
|
||||||
obs_scene_enum_items(scene, visibilitySourceTypeEnum, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MacroActionSceneVisibility::PerformAction()
|
bool MacroActionSceneVisibility::PerformAction()
|
||||||
{
|
{
|
||||||
switch (_sourceType) {
|
auto items = _source.GetSceneItems(_scene);
|
||||||
case SceneItemSourceType::SOURCE: {
|
for (const auto &item : items) {
|
||||||
auto items = _source.GetSceneItems(_scene);
|
setSceneItemVisibility(item, _action);
|
||||||
for (auto item : items) {
|
|
||||||
setSceneItemVisibility(item, _action);
|
|
||||||
obs_sceneitem_release(item);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case SceneItemSourceType::SOURCE_GROUP: {
|
|
||||||
auto s = obs_weak_source_get_source(_scene.GetScene());
|
|
||||||
auto scene = obs_scene_from_source(s);
|
|
||||||
VisibilityData vInfo = {_sourceGroup, _action};
|
|
||||||
obs_scene_enum_items(scene, visibilitySourceTypeEnum, &vInfo);
|
|
||||||
obs_source_release(s);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,18 +50,11 @@ void MacroActionSceneVisibility::LogAction() const
|
|||||||
{
|
{
|
||||||
auto it = actionTypes.find(_action);
|
auto it = actionTypes.find(_action);
|
||||||
if (it != actionTypes.end()) {
|
if (it != actionTypes.end()) {
|
||||||
if (_sourceType == SceneItemSourceType::SOURCE) {
|
vblog(LOG_INFO,
|
||||||
vblog(LOG_INFO,
|
"performed visibility action \"%s\" for source \"%s\" on scene \"%s\"",
|
||||||
"performed visibility action \"%s\" for source \"%s\" on scene \"%s\"",
|
it->second.c_str(), _source.ToString(true).c_str(),
|
||||||
it->second.c_str(),
|
_scene.ToString(true).c_str());
|
||||||
_source.ToString(true).c_str(),
|
|
||||||
_scene.ToString(true).c_str());
|
|
||||||
} else {
|
|
||||||
vblog(LOG_INFO,
|
|
||||||
"performed visibility action \"%s\" for any source type \"%s\" on scene \"%s\"",
|
|
||||||
it->second.c_str(), _sourceGroup.c_str(),
|
|
||||||
_scene.ToString(true).c_str());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
blog(LOG_WARNING, "ignored unknown SceneVisibility action %d",
|
blog(LOG_WARNING, "ignored unknown SceneVisibility action %d",
|
||||||
static_cast<int>(_action));
|
static_cast<int>(_action));
|
||||||
@@ -119,13 +65,8 @@ bool MacroActionSceneVisibility::Save(obs_data_t *obj) const
|
|||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
_scene.Save(obj);
|
_scene.Save(obj);
|
||||||
if (_sourceType == SceneItemSourceType::SOURCE) {
|
_source.Save(obj);
|
||||||
_source.Save(obj);
|
|
||||||
} else {
|
|
||||||
obs_data_set_string(obj, "sourceGroup", _sourceGroup.c_str());
|
|
||||||
}
|
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
obs_data_set_int(obj, "sourceType", static_cast<int>(_sourceType));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,89 +77,64 @@ bool MacroActionSceneVisibility::Load(obs_data_t *obj)
|
|||||||
if (obs_data_has_user_value(obj, "source")) {
|
if (obs_data_has_user_value(obj, "source")) {
|
||||||
auto sourceName = obs_data_get_string(obj, "source");
|
auto sourceName = obs_data_get_string(obj, "source");
|
||||||
obs_data_set_string(obj, "sceneItem", sourceName);
|
obs_data_set_string(obj, "sceneItem", sourceName);
|
||||||
obs_data_set_string(obj, "sourceGroup", sourceName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_scene.Load(obj);
|
_scene.Load(obj);
|
||||||
_source.Load(obj);
|
_source.Load(obj);
|
||||||
_sourceType = static_cast<SceneItemSourceType>(
|
_action = static_cast<MacroActionSceneVisibility::Action>(
|
||||||
obs_data_get_int(obj, "sourceType"));
|
|
||||||
_sourceGroup = obs_data_get_string(obj, "sourceGroup");
|
|
||||||
_action = static_cast<SceneVisibilityAction>(
|
|
||||||
obs_data_get_int(obj, "action"));
|
obs_data_get_int(obj, "action"));
|
||||||
|
|
||||||
|
// TODO: Remove in future version
|
||||||
|
if (obs_data_get_int(obj, "sourceType") != 0) {
|
||||||
|
auto sourceGroup = obs_data_get_string(obj, "sourceGroup");
|
||||||
|
_source.SetSourceTypeSelection(sourceGroup);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MacroActionSceneVisibility::GetShortDesc() const
|
std::string MacroActionSceneVisibility::GetShortDesc() const
|
||||||
{
|
{
|
||||||
if (_sourceType == SceneItemSourceType::SOURCE &&
|
if (!_source.ToString().empty()) {
|
||||||
!_source.ToString().empty()) {
|
|
||||||
return _scene.ToString() + " - " + _source.ToString();
|
return _scene.ToString() + " - " + _source.ToString();
|
||||||
}
|
}
|
||||||
if (_sourceType == SceneItemSourceType::SOURCE_GROUP &&
|
|
||||||
!_sourceGroup.empty()) {
|
|
||||||
return _scene.ToString() + " - " +
|
|
||||||
obs_module_text(
|
|
||||||
"AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup") +
|
|
||||||
" " + _sourceGroup;
|
|
||||||
}
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : actionTypes) {
|
for (const auto &entry : actionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void populateSourceItemTypeSelection(QComboBox *list)
|
|
||||||
{
|
|
||||||
for (auto entry : sourceItemSourceTypes) {
|
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(entry.second.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)),
|
||||||
|
_sources(new SceneItemSelectionWidget(parent)),
|
||||||
|
_actions(new QComboBox())
|
||||||
{
|
{
|
||||||
_scenes = new SceneSelectionWidget(window(), true, false, true, true);
|
|
||||||
_sourceTypes = new QComboBox();
|
|
||||||
_sources = new SceneItemSelectionWidget(parent);
|
|
||||||
_sourceGroups = new QComboBox();
|
|
||||||
_actions = new QComboBox();
|
|
||||||
|
|
||||||
populateSourceItemTypeSelection(_sourceTypes);
|
|
||||||
PopulateSourceGroupSelection(_sourceGroups);
|
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
|
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ActionChanged(int)));
|
SLOT(ActionChanged(int)));
|
||||||
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SceneChanged(const SceneSelection &)));
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
QWidget::connect(_sourceTypes, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SourceTypeChanged(int)));
|
|
||||||
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
_sources, SLOT(SceneChanged(const SceneSelection &)));
|
_sources, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
QWidget::connect(_sources,
|
QWidget::connect(_sources,
|
||||||
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
||||||
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
||||||
QWidget::connect(_sourceGroups,
|
|
||||||
SIGNAL(currentTextChanged(const QString &)), this,
|
|
||||||
SLOT(SourceGroupChanged(const QString &)));
|
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
auto layout = new QHBoxLayout;
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
|
||||||
{"{{scenes}}", _scenes}, {"{{sourceTypes}}", _sourceTypes},
|
|
||||||
{"{{sources}}", _sources}, {"{{sourceGroups}}", _sourceGroups},
|
|
||||||
{"{{actions}}", _actions},
|
|
||||||
};
|
|
||||||
PlaceWidgets(obs_module_text(
|
PlaceWidgets(obs_module_text(
|
||||||
"AdvSceneSwitcher.action.sceneVisibility.entry"),
|
"AdvSceneSwitcher.action.sceneVisibility.entry"),
|
||||||
mainLayout, widgetPlaceholders);
|
layout,
|
||||||
setLayout(mainLayout);
|
{{"{{scenes}}", _scenes},
|
||||||
|
{"{{sources}}", _sources},
|
||||||
|
{"{{actions}}", _actions}});
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
UpdateEntryData();
|
UpdateEntryData();
|
||||||
@@ -232,13 +148,8 @@ void MacroActionSceneVisibilityEdit::UpdateEntryData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
_sourceTypes->setCurrentIndex(
|
|
||||||
static_cast<int>(_entryData->_sourceType));
|
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
_sources->SetSceneItem((_entryData->_source));
|
_sources->SetSceneItem((_entryData->_source));
|
||||||
_sourceGroups->setCurrentText(
|
|
||||||
QString::fromStdString(_entryData->_sourceGroup));
|
|
||||||
SetWidgetVisibility();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
||||||
@@ -251,17 +162,6 @@ void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
|||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SourceTypeChanged(int value)
|
|
||||||
{
|
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_sourceType = static_cast<SceneItemSourceType>(value);
|
|
||||||
SetWidgetVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SourceChanged(
|
void MacroActionSceneVisibilityEdit::SourceChanged(
|
||||||
const SceneItemSelection &item)
|
const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
@@ -273,22 +173,8 @@ void MacroActionSceneVisibilityEdit::SourceChanged(
|
|||||||
_entryData->_source = item;
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
void MacroActionSceneVisibilityEdit::SourceGroupChanged(const QString &text)
|
|
||||||
{
|
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
if (text == obs_module_text("AdvSceneSwitcher.selectItem")) {
|
|
||||||
_entryData->_sourceGroup = "";
|
|
||||||
} else {
|
|
||||||
_entryData->_sourceGroup = text.toStdString();
|
|
||||||
}
|
|
||||||
emit HeaderInfoChanged(
|
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::ActionChanged(int value)
|
void MacroActionSceneVisibilityEdit::ActionChanged(int value)
|
||||||
@@ -298,19 +184,8 @@ void MacroActionSceneVisibilityEdit::ActionChanged(int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_action = static_cast<SceneVisibilityAction>(value);
|
_entryData->_action =
|
||||||
}
|
static_cast<MacroActionSceneVisibility::Action>(value);
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SetWidgetVisibility()
|
|
||||||
{
|
|
||||||
if (!_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_sources->setVisible(_entryData->_sourceType ==
|
|
||||||
SceneItemSourceType::SOURCE);
|
|
||||||
_sourceGroups->setVisible(_entryData->_sourceType ==
|
|
||||||
SceneItemSourceType::SOURCE_GROUP);
|
|
||||||
adjustSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -7,17 +7,6 @@
|
|||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
enum class SceneVisibilityAction {
|
|
||||||
SHOW,
|
|
||||||
HIDE,
|
|
||||||
TOGGLE,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class SceneItemSourceType {
|
|
||||||
SOURCE,
|
|
||||||
SOURCE_GROUP,
|
|
||||||
};
|
|
||||||
|
|
||||||
class MacroActionSceneVisibility : public MacroAction {
|
class MacroActionSceneVisibility : public MacroAction {
|
||||||
public:
|
public:
|
||||||
MacroActionSceneVisibility(Macro *m) : MacroAction(m) {}
|
MacroActionSceneVisibility(Macro *m) : MacroAction(m) {}
|
||||||
@@ -33,10 +22,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
SceneItemSourceType _sourceType = SceneItemSourceType::SOURCE;
|
|
||||||
SceneItemSelection _source;
|
SceneItemSelection _source;
|
||||||
std::string _sourceGroup = "";
|
|
||||||
SceneVisibilityAction _action = SceneVisibilityAction::SHOW;
|
enum class Action {
|
||||||
|
SHOW,
|
||||||
|
HIDE,
|
||||||
|
TOGGLE,
|
||||||
|
};
|
||||||
|
Action _action = Action::SHOW;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
@@ -62,25 +55,18 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceTypeChanged(int value);
|
|
||||||
void SourceChanged(const SceneItemSelection &);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
void SourceGroupChanged(const QString &text);
|
|
||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_sourceTypes;
|
|
||||||
SceneItemSelectionWidget *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
QComboBox *_sourceGroups;
|
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
std::shared_ptr<MacroActionSceneVisibility> _entryData;
|
std::shared_ptr<MacroActionSceneVisibility> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWidgetVisibility();
|
|
||||||
|
|
||||||
QHBoxLayout *_mainLayout;
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void MacroActionScreenshot::CustomScreenshot(OBSWeakSource &source)
|
|||||||
}
|
}
|
||||||
auto s = obs_weak_source_get_source(source);
|
auto s = obs_weak_source_get_source(source);
|
||||||
_screenshot.~ScreenshotHelper();
|
_screenshot.~ScreenshotHelper();
|
||||||
new (&_screenshot) ScreenshotHelper(s, false, 0, true, _path);
|
new (&_screenshot) ScreenshotHelper(s, QRect(), false, 0, true, _path);
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ bool MacroActionSequence::PerformAction()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return macro->PerformActions();
|
return macro->PerformActions(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSequence::LogAction() const
|
void MacroActionSequence::LogAction() const
|
||||||
|
|||||||
@@ -12,15 +12,66 @@ bool MacroActionSource::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionSource::Create, MacroActionSourceEdit::Create,
|
{MacroActionSource::Create, MacroActionSourceEdit::Create,
|
||||||
"AdvSceneSwitcher.action.source"});
|
"AdvSceneSwitcher.action.source"});
|
||||||
|
|
||||||
const static std::map<SourceAction, std::string> actionTypes = {
|
const static std::map<MacroActionSource::Action, std::string> actionTypes = {
|
||||||
{SourceAction::ENABLE, "AdvSceneSwitcher.action.source.type.enable"},
|
{MacroActionSource::Action::ENABLE,
|
||||||
{SourceAction::DISABLE, "AdvSceneSwitcher.action.source.type.disable"},
|
"AdvSceneSwitcher.action.source.type.enable"},
|
||||||
{SourceAction::SETTINGS,
|
{MacroActionSource::Action::DISABLE,
|
||||||
|
"AdvSceneSwitcher.action.source.type.disable"},
|
||||||
|
{MacroActionSource::Action::SETTINGS,
|
||||||
"AdvSceneSwitcher.action.source.type.settings"},
|
"AdvSceneSwitcher.action.source.type.settings"},
|
||||||
{SourceAction::REFRESH_SETTINGS,
|
{MacroActionSource::Action::REFRESH_SETTINGS,
|
||||||
"AdvSceneSwitcher.action.source.type.refreshSettings"},
|
"AdvSceneSwitcher.action.source.type.refreshSettings"},
|
||||||
{SourceAction::SETTINGS_BUTTON,
|
{MacroActionSource::Action::SETTINGS_BUTTON,
|
||||||
"AdvSceneSwitcher.action.source.type.pressSettingsButton"},
|
"AdvSceneSwitcher.action.source.type.pressSettingsButton"},
|
||||||
|
{MacroActionSource::Action::DEINTERLACE_MODE,
|
||||||
|
"AdvSceneSwitcher.action.source.type.deinterlaceMode"},
|
||||||
|
{MacroActionSource::Action::DEINTERLACE_FIELD_ORDER,
|
||||||
|
"AdvSceneSwitcher.action.source.type.deinterlaceOrder"},
|
||||||
|
{MacroActionSource::Action::OPEN_INTERACTION_DIALOG,
|
||||||
|
"AdvSceneSwitcher.action.source.type.openInteractionDialog"},
|
||||||
|
{MacroActionSource::Action::OPEN_FILTER_DIALOG,
|
||||||
|
"AdvSceneSwitcher.action.source.type.openFilterDialog"},
|
||||||
|
{MacroActionSource::Action::OPEN_PROPERTIES_DIALOG,
|
||||||
|
"AdvSceneSwitcher.action.source.type.openPropertiesDialog"},
|
||||||
|
};
|
||||||
|
|
||||||
|
const static std::map<obs_deinterlace_mode, std::string> deinterlaceModes = {
|
||||||
|
{OBS_DEINTERLACE_MODE_DISABLE,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.disable"},
|
||||||
|
{OBS_DEINTERLACE_MODE_DISCARD,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.disable"},
|
||||||
|
{OBS_DEINTERLACE_MODE_RETRO,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.retro"},
|
||||||
|
{OBS_DEINTERLACE_MODE_BLEND,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.blend"},
|
||||||
|
{OBS_DEINTERLACE_MODE_BLEND_2X,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.blend2x"},
|
||||||
|
{OBS_DEINTERLACE_MODE_LINEAR,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.linear"},
|
||||||
|
{OBS_DEINTERLACE_MODE_LINEAR_2X,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.linear2x"},
|
||||||
|
{OBS_DEINTERLACE_MODE_YADIF,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.yadif"},
|
||||||
|
{OBS_DEINTERLACE_MODE_YADIF_2X,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceMode.yadif2x"},
|
||||||
|
};
|
||||||
|
|
||||||
|
const static std::map<obs_deinterlace_field_order, std::string>
|
||||||
|
deinterlaceFieldOrders = {
|
||||||
|
{OBS_DEINTERLACE_FIELD_ORDER_TOP,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceOrder.topFieldFirst"},
|
||||||
|
{OBS_DEINTERLACE_FIELD_ORDER_BOTTOM,
|
||||||
|
"AdvSceneSwitcher.action.source.deinterlaceOrder.bottomFieldFirst"},
|
||||||
|
};
|
||||||
|
|
||||||
|
const static std::map<MacroActionSource::SettingsInputMethod, std::string>
|
||||||
|
inputMethods = {
|
||||||
|
{MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL,
|
||||||
|
"AdvSceneSwitcher.action.source.inputMethod.individualManual"},
|
||||||
|
{MacroActionSource::SettingsInputMethod::INDIVIDUAL_TEMPVAR,
|
||||||
|
"AdvSceneSwitcher.action.source.inputMethod.individualTempvar"},
|
||||||
|
{MacroActionSource::SettingsInputMethod::JSON_STRING,
|
||||||
|
"AdvSceneSwitcher.action.source.inputMethod.json"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<SourceSettingButton> getSourceButtons(OBSWeakSource source)
|
static std::vector<SourceSettingButton> getSourceButtons(OBSWeakSource source)
|
||||||
@@ -38,6 +89,7 @@ static std::vector<SourceSettingButton> getSourceButtons(OBSWeakSource source)
|
|||||||
buttons.emplace_back(button);
|
buttons.emplace_back(button);
|
||||||
} while (obs_property_next(&it));
|
} while (obs_property_next(&it));
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
|
obs_properties_destroy(sourceProperties);
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,25 +127,72 @@ static void refreshSourceSettings(obs_source_t *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isInteractable(obs_source_t *source)
|
||||||
|
{
|
||||||
|
uint32_t flags = obs_source_get_output_flags(source);
|
||||||
|
return (flags & OBS_SOURCE_INTERACTION) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool MacroActionSource::PerformAction()
|
bool MacroActionSource::PerformAction()
|
||||||
{
|
{
|
||||||
auto s = obs_weak_source_get_source(_source.GetSource());
|
auto s = obs_weak_source_get_source(_source.GetSource());
|
||||||
switch (_action) {
|
switch (_action) {
|
||||||
case SourceAction::ENABLE:
|
case Action::ENABLE:
|
||||||
obs_source_set_enabled(s, true);
|
obs_source_set_enabled(s, true);
|
||||||
break;
|
break;
|
||||||
case SourceAction::DISABLE:
|
case Action::DISABLE:
|
||||||
obs_source_set_enabled(s, false);
|
obs_source_set_enabled(s, false);
|
||||||
break;
|
break;
|
||||||
case SourceAction::SETTINGS:
|
case Action::SETTINGS:
|
||||||
SetSourceSettings(s, _settings);
|
switch (_settingsInputMethod) {
|
||||||
|
case SettingsInputMethod::INDIVIDUAL_MANUAL:
|
||||||
|
SetSourceSetting(s, _setting, _manualSettingValue);
|
||||||
|
break;
|
||||||
|
case SettingsInputMethod::INDIVIDUAL_TEMPVAR: {
|
||||||
|
auto var = _tempVar.GetTempVariable(GetMacro());
|
||||||
|
if (!var) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
auto value = var->Value();
|
||||||
|
if (!value) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SetSourceSetting(s, _setting, *value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SettingsInputMethod::JSON_STRING:
|
||||||
|
SetSourceSettings(s, _settingsString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SourceAction::REFRESH_SETTINGS:
|
case Action::REFRESH_SETTINGS:
|
||||||
refreshSourceSettings(s);
|
refreshSourceSettings(s);
|
||||||
break;
|
break;
|
||||||
case SourceAction::SETTINGS_BUTTON:
|
case Action::SETTINGS_BUTTON:
|
||||||
pressSourceButton(_button, s);
|
pressSourceButton(_button, s);
|
||||||
break;
|
break;
|
||||||
|
case Action::DEINTERLACE_MODE:
|
||||||
|
obs_source_set_deinterlace_mode(s, _deinterlaceMode);
|
||||||
|
break;
|
||||||
|
case Action::DEINTERLACE_FIELD_ORDER:
|
||||||
|
obs_source_set_deinterlace_field_order(s, _deinterlaceOrder);
|
||||||
|
break;
|
||||||
|
case Action::OPEN_INTERACTION_DIALOG:
|
||||||
|
if (isInteractable(s)) {
|
||||||
|
obs_frontend_open_source_interaction(s);
|
||||||
|
} else {
|
||||||
|
blog(LOG_INFO,
|
||||||
|
"refusing to open interaction dialog "
|
||||||
|
"for non intractable source \"%s\"",
|
||||||
|
_source.ToString().c_str());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Action::OPEN_FILTER_DIALOG:
|
||||||
|
obs_frontend_open_source_filters(s);
|
||||||
|
break;
|
||||||
|
case Action::OPEN_PROPERTIES_DIALOG:
|
||||||
|
obs_frontend_open_source_properties(s);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -119,7 +218,16 @@ bool MacroActionSource::Save(obs_data_t *obj) const
|
|||||||
_source.Save(obj);
|
_source.Save(obj);
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
_button.Save(obj);
|
_button.Save(obj);
|
||||||
_settings.Save(obj, "settings");
|
obs_data_set_int(obj, "inputMethod",
|
||||||
|
static_cast<int>(_settingsInputMethod));
|
||||||
|
_setting.Save(obj);
|
||||||
|
_manualSettingValue.Save(obj, "manualSettingValue");
|
||||||
|
_tempVar.Save(obj);
|
||||||
|
_settingsString.Save(obj, "settings");
|
||||||
|
obs_data_set_int(obj, "deinterlaceMode",
|
||||||
|
static_cast<int>(_deinterlaceMode));
|
||||||
|
obs_data_set_int(obj, "deinterlaceOrder",
|
||||||
|
static_cast<int>(_deinterlaceOrder));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,9 +235,23 @@ bool MacroActionSource::Load(obs_data_t *obj)
|
|||||||
{
|
{
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_source.Load(obj);
|
_source.Load(obj);
|
||||||
_action = static_cast<SourceAction>(obs_data_get_int(obj, "action"));
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
_button.Load(obj);
|
_button.Load(obj);
|
||||||
_settings.Load(obj, "settings");
|
// TODO: Remove fallback in future version
|
||||||
|
if (obs_data_has_user_value(obj, "inputMethod")) {
|
||||||
|
_settingsInputMethod = static_cast<SettingsInputMethod>(
|
||||||
|
obs_data_get_int(obj, "inputMethod"));
|
||||||
|
} else {
|
||||||
|
_settingsInputMethod = SettingsInputMethod::JSON_STRING;
|
||||||
|
}
|
||||||
|
_setting.Load(obj);
|
||||||
|
_settingsString.Load(obj, "settings");
|
||||||
|
_manualSettingValue.Load(obj, "manualSettingValue");
|
||||||
|
_tempVar.Load(obj, GetMacro());
|
||||||
|
_deinterlaceMode = static_cast<obs_deinterlace_mode>(
|
||||||
|
obs_data_get_int(obj, "deinterlaceMode"));
|
||||||
|
_deinterlaceOrder = static_cast<obs_deinterlace_field_order>(
|
||||||
|
obs_data_get_int(obj, "deinterlaceOrder"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +265,7 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
{
|
{
|
||||||
for (auto &[actionType, name] : actionTypes) {
|
for (auto &[actionType, name] : actionTypes) {
|
||||||
list->addItem(obs_module_text(name.c_str()));
|
list->addItem(obs_module_text(name.c_str()));
|
||||||
if (actionType == SourceAction::REFRESH_SETTINGS) {
|
if (actionType == MacroActionSource::Action::REFRESH_SETTINGS) {
|
||||||
list->setItemData(
|
list->setItemData(
|
||||||
list->count() - 1,
|
list->count() - 1,
|
||||||
obs_module_text(
|
obs_module_text(
|
||||||
@@ -170,23 +292,60 @@ static inline void populateSourceButtonSelection(QComboBox *list,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void populateDeinterlaceModeSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
list->clear();
|
||||||
|
for (const auto &[value, name] : deinterlaceModes) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void populateDeinterlaceFieldOrderSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
list->clear();
|
||||||
|
for (const auto &[value, name] : deinterlaceFieldOrders) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void populateSettingsInputMethods(QComboBox *list)
|
||||||
|
{
|
||||||
|
list->clear();
|
||||||
|
for (const auto &[value, name] : inputMethods) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MacroActionSourceEdit::MacroActionSourceEdit(
|
MacroActionSourceEdit::MacroActionSourceEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSource> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSource> entryData)
|
||||||
: QWidget(parent)
|
: QWidget(parent),
|
||||||
{
|
_sources(new SourceSelectionWidget(this, QStringList(), true)),
|
||||||
_sources = new SourceSelectionWidget(this, QStringList(), true);
|
_actions(new QComboBox()),
|
||||||
_actions = new QComboBox();
|
_settingsButtons(new QComboBox()),
|
||||||
_settingsButtons = new QComboBox();
|
_settingsLayout(new QHBoxLayout()),
|
||||||
_getSettings = new QPushButton(
|
_settingsInputMethods(new QComboBox(this)),
|
||||||
obs_module_text("AdvSceneSwitcher.action.source.getSettings"));
|
_manualSettingValue(new VariableTextEdit(this, 5, 1, 1)),
|
||||||
_settings = new VariableTextEdit(this);
|
_tempVars(new TempVariableSelection(this)),
|
||||||
_warning = new QLabel(
|
_sourceSettings(new SourceSettingSelection(this)),
|
||||||
obs_module_text("AdvSceneSwitcher.action.source.warning"));
|
_settingsString(new VariableTextEdit(this)),
|
||||||
|
_getSettings(new QPushButton(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.source.getSettings"))),
|
||||||
|
_deinterlaceMode(new QComboBox()),
|
||||||
|
_deinterlaceOrder(new QComboBox()),
|
||||||
|
_warning(new QLabel(
|
||||||
|
obs_module_text("AdvSceneSwitcher.action.source.warning")))
|
||||||
|
|
||||||
|
{
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
auto sources = GetSourceNames();
|
auto sources = GetSourceNames();
|
||||||
sources.sort();
|
sources.sort();
|
||||||
_sources->SetSourceNameList(sources);
|
_sources->SetSourceNameList(sources);
|
||||||
|
populateDeinterlaceModeSelection(_deinterlaceMode);
|
||||||
|
populateDeinterlaceFieldOrderSelection(_deinterlaceOrder);
|
||||||
|
populateSettingsInputMethods(_settingsInputMethods);
|
||||||
|
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ActionChanged(int)));
|
SLOT(ActionChanged(int)));
|
||||||
@@ -197,24 +356,51 @@ MacroActionSourceEdit::MacroActionSourceEdit(
|
|||||||
SLOT(SourceChanged(const SourceSelection &)));
|
SLOT(SourceChanged(const SourceSelection &)));
|
||||||
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
||||||
SLOT(GetSettingsClicked()));
|
SLOT(GetSettingsClicked()));
|
||||||
QWidget::connect(_settings, SIGNAL(textChanged()), this,
|
QWidget::connect(_settingsString, SIGNAL(textChanged()), this,
|
||||||
SLOT(SettingsChanged()));
|
SLOT(SettingsStringChanged()));
|
||||||
|
QWidget::connect(_deinterlaceMode, SIGNAL(currentIndexChanged(int)),
|
||||||
|
this, SLOT(DeinterlaceModeChanged(int)));
|
||||||
|
QWidget::connect(_deinterlaceOrder, SIGNAL(currentIndexChanged(int)),
|
||||||
|
this, SLOT(DeinterlaceOrderChanged(int)));
|
||||||
|
QWidget::connect(_tempVars,
|
||||||
|
SIGNAL(SelectionChanged(const TempVariableRef &)),
|
||||||
|
this, SLOT(SelectionChanged(const TempVariableRef &)));
|
||||||
|
QWidget::connect(_settingsInputMethods,
|
||||||
|
SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SettingsInputMethodChanged(int)));
|
||||||
|
QWidget::connect(_manualSettingValue, SIGNAL(textChanged()), this,
|
||||||
|
SLOT(ManualSettingsValueChanged()));
|
||||||
|
QWidget::connect(_sourceSettings,
|
||||||
|
SIGNAL(SelectionChanged(const SourceSetting &)), this,
|
||||||
|
SLOT(SelectionChanged(const SourceSetting &)));
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
auto entryLayout = new QHBoxLayout;
|
||||||
QHBoxLayout *entryLayout = new QHBoxLayout;
|
entryLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{sources}}", _sources},
|
{"{{sources}}", _sources},
|
||||||
{"{{actions}}", _actions},
|
{"{{actions}}", _actions},
|
||||||
{"{{settings}}", _settings},
|
{"{{settings}}", _sourceSettings},
|
||||||
|
{"{{settingsInputMethod}}", _settingsInputMethods},
|
||||||
|
{"{{settingValue}}", _manualSettingValue},
|
||||||
|
{"{{tempVar}}", _tempVars},
|
||||||
{"{{getSettings}}", _getSettings},
|
{"{{getSettings}}", _getSettings},
|
||||||
{"{{settingsButtons}}", _settingsButtons},
|
{"{{settingsButtons}}", _settingsButtons},
|
||||||
|
{"{{deinterlaceMode}}", _deinterlaceMode},
|
||||||
|
{"{{deinterlaceOrder}}", _deinterlaceOrder},
|
||||||
};
|
};
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.source.entry"),
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.source.entry"),
|
||||||
entryLayout, widgetPlaceholders);
|
entryLayout, widgetPlaceholders);
|
||||||
|
_settingsLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
PlaceWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.source.entry.settings"),
|
||||||
|
_settingsLayout, widgetPlaceholders);
|
||||||
|
auto mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(entryLayout);
|
mainLayout->addLayout(entryLayout);
|
||||||
|
mainLayout->addLayout(_settingsLayout);
|
||||||
mainLayout->addWidget(_warning);
|
mainLayout->addWidget(_warning);
|
||||||
mainLayout->addWidget(_settings);
|
mainLayout->addWidget(_settingsString);
|
||||||
|
auto buttonLayout = new QHBoxLayout;
|
||||||
|
buttonLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
buttonLayout->addWidget(_getSettings);
|
buttonLayout->addWidget(_getSettings);
|
||||||
buttonLayout->addStretch();
|
buttonLayout->addStretch();
|
||||||
mainLayout->addLayout(buttonLayout);
|
mainLayout->addLayout(buttonLayout);
|
||||||
@@ -235,13 +421,21 @@ void MacroActionSourceEdit::UpdateEntryData()
|
|||||||
_entryData->_source.GetSource());
|
_entryData->_source.GetSource());
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
_sources->SetSource(_entryData->_source);
|
_sources->SetSource(_entryData->_source);
|
||||||
|
_sourceSettings->SetSource(_entryData->_source.GetSource());
|
||||||
|
_sourceSettings->SetSetting(_entryData->_setting);
|
||||||
_settingsButtons->setCurrentText(
|
_settingsButtons->setCurrentText(
|
||||||
QString::fromStdString(_entryData->_button.ToString()));
|
QString::fromStdString(_entryData->_button.ToString()));
|
||||||
_settings->setPlainText(_entryData->_settings);
|
_settingsString->setPlainText(_entryData->_settingsString);
|
||||||
SetWidgetVisibility();
|
_deinterlaceMode->setCurrentIndex(_deinterlaceMode->findData(
|
||||||
|
static_cast<int>(_entryData->_deinterlaceMode)));
|
||||||
|
_deinterlaceOrder->setCurrentIndex(_deinterlaceOrder->findData(
|
||||||
|
static_cast<int>(_entryData->_deinterlaceOrder)));
|
||||||
|
_settingsInputMethods->setCurrentIndex(_settingsInputMethods->findData(
|
||||||
|
static_cast<int>(_entryData->_settingsInputMethod)));
|
||||||
|
_tempVars->SetVariable(_entryData->_tempVar);
|
||||||
|
_manualSettingValue->setPlainText(_entryData->_manualSettingValue);
|
||||||
|
|
||||||
adjustSize();
|
SetWidgetVisibility();
|
||||||
updateGeometry();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSourceEdit::SourceChanged(const SourceSelection &source)
|
void MacroActionSourceEdit::SourceChanged(const SourceSelection &source)
|
||||||
@@ -256,6 +450,7 @@ void MacroActionSourceEdit::SourceChanged(const SourceSelection &source)
|
|||||||
}
|
}
|
||||||
populateSourceButtonSelection(_settingsButtons,
|
populateSourceButtonSelection(_settingsButtons,
|
||||||
_entryData->_source.GetSource());
|
_entryData->_source.GetSource());
|
||||||
|
_sourceSettings->SetSource(_entryData->_source.GetSource());
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
@@ -267,7 +462,7 @@ void MacroActionSourceEdit::ActionChanged(int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_action = static_cast<SourceAction>(value);
|
_entryData->_action = static_cast<MacroActionSource::Action>(value);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,18 +483,99 @@ void MacroActionSourceEdit::GetSettingsClicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_settings->setPlainText(FormatJsonString(
|
switch (_entryData->_settingsInputMethod) {
|
||||||
GetSourceSettings(_entryData->_source.GetSource())));
|
case MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL:
|
||||||
|
_manualSettingValue->setPlainText(GetSourceSettingValue(
|
||||||
|
_entryData->_source.GetSource(), _entryData->_setting));
|
||||||
|
break;
|
||||||
|
case MacroActionSource::SettingsInputMethod::INDIVIDUAL_TEMPVAR:
|
||||||
|
break;
|
||||||
|
case MacroActionSource::SettingsInputMethod::JSON_STRING:
|
||||||
|
_settingsString->setPlainText(FormatJsonString(
|
||||||
|
GetSourceSettings(_entryData->_source.GetSource())));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSourceEdit::SettingsChanged()
|
void MacroActionSourceEdit::SettingsStringChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_settings = _settings->toPlainText().toStdString();
|
_entryData->_settingsString =
|
||||||
|
_settingsString->toPlainText().toStdString();
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSourceEdit::DeinterlaceModeChanged(int idx)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_deinterlaceMode = static_cast<obs_deinterlace_mode>(
|
||||||
|
_deinterlaceMode->itemData(idx).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSourceEdit::DeinterlaceOrderChanged(int idx)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_deinterlaceOrder =
|
||||||
|
static_cast<obs_deinterlace_field_order>(
|
||||||
|
_deinterlaceOrder->itemData(idx).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSourceEdit::SelectionChanged(const TempVariableRef &var)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_tempVar = var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSourceEdit::SettingsInputMethodChanged(int idx)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_settingsInputMethod =
|
||||||
|
static_cast<MacroActionSource::SettingsInputMethod>(
|
||||||
|
_settingsInputMethods->itemData(idx).toInt());
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSourceEdit::SelectionChanged(const SourceSetting &setting)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_setting = setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSourceEdit::ManualSettingsValueChanged()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_manualSettingValue =
|
||||||
|
_manualSettingValue->toPlainText().toStdString();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -307,15 +583,50 @@ void MacroActionSourceEdit::SettingsChanged()
|
|||||||
|
|
||||||
void MacroActionSourceEdit::SetWidgetVisibility()
|
void MacroActionSourceEdit::SetWidgetVisibility()
|
||||||
{
|
{
|
||||||
const bool showSettings = _entryData->_action == SourceAction::SETTINGS;
|
SetLayoutVisible(_settingsLayout,
|
||||||
const bool showWarning = _entryData->_action == SourceAction::ENABLE ||
|
_entryData->_action ==
|
||||||
_entryData->_action == SourceAction::DISABLE;
|
MacroActionSource::Action::SETTINGS);
|
||||||
_settings->setVisible(showSettings);
|
_sourceSettings->setVisible(
|
||||||
_getSettings->setVisible(showSettings);
|
_entryData->_action == MacroActionSource::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod !=
|
||||||
|
MacroActionSource::SettingsInputMethod::JSON_STRING);
|
||||||
|
_settingsString->setVisible(
|
||||||
|
_entryData->_action == MacroActionSource::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionSource::SettingsInputMethod::JSON_STRING);
|
||||||
|
_getSettings->setVisible(_entryData->_action ==
|
||||||
|
MacroActionSource::Action::SETTINGS);
|
||||||
|
_tempVars->setVisible(_entryData->_action ==
|
||||||
|
MacroActionSource::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionSource::SettingsInputMethod::
|
||||||
|
INDIVIDUAL_TEMPVAR);
|
||||||
|
|
||||||
|
if (_entryData->_action == MacroActionSource::Action::SETTINGS &&
|
||||||
|
_entryData->_settingsInputMethod ==
|
||||||
|
MacroActionSource::SettingsInputMethod::INDIVIDUAL_MANUAL) {
|
||||||
|
RemoveStretchIfPresent(_settingsLayout);
|
||||||
|
_manualSettingValue->show();
|
||||||
|
} else {
|
||||||
|
AddStretchIfNecessary(_settingsLayout);
|
||||||
|
_manualSettingValue->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool showWarning =
|
||||||
|
_entryData->_action == MacroActionSource::Action::ENABLE ||
|
||||||
|
_entryData->_action == MacroActionSource::Action::DISABLE;
|
||||||
_warning->setVisible(showWarning);
|
_warning->setVisible(showWarning);
|
||||||
_settingsButtons->setVisible(_entryData->_action ==
|
_settingsButtons->setVisible(
|
||||||
SourceAction::SETTINGS_BUTTON);
|
_entryData->_action ==
|
||||||
|
MacroActionSource::Action::SETTINGS_BUTTON);
|
||||||
|
_deinterlaceMode->setVisible(
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionSource::Action::DEINTERLACE_MODE);
|
||||||
|
_deinterlaceOrder->setVisible(
|
||||||
|
_entryData->_action ==
|
||||||
|
MacroActionSource::Action::DEINTERLACE_FIELD_ORDER);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SourceSettingButton::Save(obs_data_t *obj) const
|
bool SourceSettingButton::Save(obs_data_t *obj) const
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "variable-text-edit.hpp"
|
#include "variable-text-edit.hpp"
|
||||||
#include "source-selection.hpp"
|
#include "source-selection.hpp"
|
||||||
|
#include "source-setting.hpp"
|
||||||
|
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@@ -10,14 +11,6 @@
|
|||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
enum class SourceAction {
|
|
||||||
ENABLE,
|
|
||||||
DISABLE,
|
|
||||||
SETTINGS,
|
|
||||||
REFRESH_SETTINGS,
|
|
||||||
SETTINGS_BUTTON,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SourceSettingButton {
|
struct SourceSettingButton {
|
||||||
bool Save(obs_data_t *obj) const;
|
bool Save(obs_data_t *obj) const;
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
@@ -43,8 +36,35 @@ public:
|
|||||||
|
|
||||||
SourceSelection _source;
|
SourceSelection _source;
|
||||||
SourceSettingButton _button;
|
SourceSettingButton _button;
|
||||||
StringVariable _settings = "";
|
StringVariable _settingsString = "";
|
||||||
SourceAction _action = SourceAction::ENABLE;
|
StringVariable _manualSettingValue = "";
|
||||||
|
obs_deinterlace_mode _deinterlaceMode = OBS_DEINTERLACE_MODE_DISABLE;
|
||||||
|
obs_deinterlace_field_order _deinterlaceOrder =
|
||||||
|
OBS_DEINTERLACE_FIELD_ORDER_TOP;
|
||||||
|
TempVariableRef _tempVar;
|
||||||
|
SourceSetting _setting;
|
||||||
|
|
||||||
|
enum class Action {
|
||||||
|
ENABLE,
|
||||||
|
DISABLE,
|
||||||
|
SETTINGS,
|
||||||
|
REFRESH_SETTINGS,
|
||||||
|
SETTINGS_BUTTON,
|
||||||
|
DEINTERLACE_MODE,
|
||||||
|
DEINTERLACE_FIELD_ORDER,
|
||||||
|
OPEN_INTERACTION_DIALOG,
|
||||||
|
OPEN_FILTER_DIALOG,
|
||||||
|
OPEN_PROPERTIES_DIALOG,
|
||||||
|
};
|
||||||
|
Action _action = Action::SETTINGS;
|
||||||
|
|
||||||
|
enum class SettingsInputMethod {
|
||||||
|
INDIVIDUAL_MANUAL,
|
||||||
|
INDIVIDUAL_TEMPVAR,
|
||||||
|
JSON_STRING,
|
||||||
|
};
|
||||||
|
SettingsInputMethod _settingsInputMethod =
|
||||||
|
SettingsInputMethod::INDIVIDUAL_MANUAL;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
@@ -72,7 +92,13 @@ private slots:
|
|||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
void ButtonChanged(int idx);
|
void ButtonChanged(int idx);
|
||||||
void GetSettingsClicked();
|
void GetSettingsClicked();
|
||||||
void SettingsChanged();
|
void SettingsStringChanged();
|
||||||
|
void DeinterlaceModeChanged(int);
|
||||||
|
void DeinterlaceOrderChanged(int);
|
||||||
|
void SelectionChanged(const TempVariableRef &);
|
||||||
|
void SettingsInputMethodChanged(int);
|
||||||
|
void SelectionChanged(const SourceSetting &);
|
||||||
|
void ManualSettingsValueChanged();
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
@@ -80,9 +106,17 @@ protected:
|
|||||||
SourceSelectionWidget *_sources;
|
SourceSelectionWidget *_sources;
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
QComboBox *_settingsButtons;
|
QComboBox *_settingsButtons;
|
||||||
|
QHBoxLayout *_settingsLayout;
|
||||||
|
QComboBox *_settingsInputMethods;
|
||||||
|
VariableTextEdit *_manualSettingValue;
|
||||||
|
TempVariableSelection *_tempVars;
|
||||||
|
SourceSettingSelection *_sourceSettings;
|
||||||
|
VariableTextEdit *_settingsString;
|
||||||
QPushButton *_getSettings;
|
QPushButton *_getSettings;
|
||||||
VariableTextEdit *_settings;
|
QComboBox *_deinterlaceMode;
|
||||||
|
QComboBox *_deinterlaceOrder;
|
||||||
QLabel *_warning;
|
QLabel *_warning;
|
||||||
|
|
||||||
std::shared_ptr<MacroActionSource> _entryData;
|
std::shared_ptr<MacroActionSource> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -19,26 +19,65 @@ const static std::map<MacroActionStream::Action, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.streaming.type.start"},
|
"AdvSceneSwitcher.action.streaming.type.start"},
|
||||||
{MacroActionStream::Action::KEYFRAME_INTERVAL,
|
{MacroActionStream::Action::KEYFRAME_INTERVAL,
|
||||||
"AdvSceneSwitcher.action.streaming.type.keyFrameInterval"},
|
"AdvSceneSwitcher.action.streaming.type.keyFrameInterval"},
|
||||||
|
{MacroActionStream::Action::SERVER,
|
||||||
|
"AdvSceneSwitcher.action.streaming.type.server"},
|
||||||
|
{MacroActionStream::Action::STREAM_KEY,
|
||||||
|
"AdvSceneSwitcher.action.streaming.type.streamKey"},
|
||||||
|
{MacroActionStream::Action::USERNAME,
|
||||||
|
"AdvSceneSwitcher.action.streaming.type.username"},
|
||||||
|
{MacroActionStream::Action::PASSWORD,
|
||||||
|
"AdvSceneSwitcher.action.streaming.type.password"},
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr int streamStartCooldown = 5;
|
constexpr int streamStartCooldown = 5;
|
||||||
std::chrono::high_resolution_clock::time_point MacroActionStream::s_lastAttempt =
|
std::chrono::high_resolution_clock::time_point MacroActionStream::s_lastAttempt =
|
||||||
std::chrono::high_resolution_clock::now();
|
std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
void MacroActionStream::SetKeyFrameInterval()
|
void MacroActionStream::SetKeyFrameInterval() const
|
||||||
{
|
{
|
||||||
const auto configPath = GetPathInProfileDir("streamEncoder.json");
|
const auto configPath = GetPathInProfileDir("streamEncoder.json");
|
||||||
obs_data_t *settings =
|
auto settings =
|
||||||
obs_data_create_from_json_file_safe(configPath.c_str(), "bak");
|
obs_data_create_from_json_file_safe(configPath.c_str(), "bak");
|
||||||
obs_data_set_int(settings, "keyint_sec", _keyFrameInterval);
|
if (!settings) {
|
||||||
if (settings) {
|
blog(LOG_WARNING, "failed to set key frame interval");
|
||||||
obs_data_save_json_safe(settings, configPath.c_str(), "tmp",
|
return;
|
||||||
"bak");
|
|
||||||
obs_data_release(settings);
|
|
||||||
}
|
}
|
||||||
|
obs_data_set_int(settings, "keyint_sec", _keyFrameInterval);
|
||||||
|
obs_data_save_json_safe(settings, configPath.c_str(), "tmp", "bak");
|
||||||
|
obs_data_release(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionStream::CooldownDurationReached()
|
void MacroActionStream::SetStreamSettingsValue(const char *name,
|
||||||
|
const std::string &value,
|
||||||
|
bool enableAuth) const
|
||||||
|
{
|
||||||
|
const auto configPath = GetPathInProfileDir("service.json");
|
||||||
|
auto data =
|
||||||
|
obs_data_create_from_json_file_safe(configPath.c_str(), "bak");
|
||||||
|
if (!data) {
|
||||||
|
blog(LOG_WARNING, "failed to set %s", name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto settings = obs_data_get_obj(data, "settings");
|
||||||
|
if (!settings) {
|
||||||
|
blog(LOG_WARNING, "failed to set %s", name);
|
||||||
|
obs_data_release(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obs_data_set_string(settings, name, value.c_str());
|
||||||
|
if (enableAuth) {
|
||||||
|
obs_data_set_bool(settings, "use_auth", true);
|
||||||
|
}
|
||||||
|
obs_data_set_obj(data, "settings", settings);
|
||||||
|
auto service = obs_frontend_get_streaming_service();
|
||||||
|
obs_service_update(service, settings);
|
||||||
|
obs_frontend_save_streaming_service();
|
||||||
|
obs_frontend_set_streaming_service(service);
|
||||||
|
obs_data_release(settings);
|
||||||
|
obs_data_release(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionStream::CooldownDurationReached() const
|
||||||
{
|
{
|
||||||
auto timePassed = std::chrono::duration_cast<std::chrono::seconds>(
|
auto timePassed = std::chrono::duration_cast<std::chrono::seconds>(
|
||||||
std::chrono::high_resolution_clock::now() - s_lastAttempt);
|
std::chrono::high_resolution_clock::now() - s_lastAttempt);
|
||||||
@@ -64,6 +103,18 @@ bool MacroActionStream::PerformAction()
|
|||||||
case Action::KEYFRAME_INTERVAL:
|
case Action::KEYFRAME_INTERVAL:
|
||||||
SetKeyFrameInterval();
|
SetKeyFrameInterval();
|
||||||
break;
|
break;
|
||||||
|
case Action::SERVER:
|
||||||
|
SetStreamSettingsValue("server", _stringValue);
|
||||||
|
break;
|
||||||
|
case Action::STREAM_KEY:
|
||||||
|
SetStreamSettingsValue("key", _stringValue);
|
||||||
|
break;
|
||||||
|
case Action::USERNAME:
|
||||||
|
SetStreamSettingsValue("username", _stringValue, true);
|
||||||
|
break;
|
||||||
|
case Action::PASSWORD:
|
||||||
|
SetStreamSettingsValue("password", _stringValue, true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -86,6 +137,7 @@ bool MacroActionStream::Save(obs_data_t *obj) const
|
|||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
_keyFrameInterval.Save(obj, "keyFrameInterval");
|
_keyFrameInterval.Save(obj, "keyFrameInterval");
|
||||||
|
_stringValue.Save(obj, "stringValue");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +146,7 @@ bool MacroActionStream::Load(obs_data_t *obj)
|
|||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
_keyFrameInterval.Load(obj, "keyFrameInterval");
|
_keyFrameInterval.Load(obj, "keyFrameInterval");
|
||||||
|
_stringValue.Load(obj, "stringValue");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,11 +161,19 @@ MacroActionStreamEdit::MacroActionStreamEdit(
|
|||||||
QWidget *parent, std::shared_ptr<MacroActionStream> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionStream> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_actions(new QComboBox()),
|
_actions(new QComboBox()),
|
||||||
_keyFrameInterval(new VariableSpinBox())
|
_keyFrameInterval(new VariableSpinBox()),
|
||||||
|
_stringValue(new VariableLineEdit(this)),
|
||||||
|
_showPassword(new QPushButton()),
|
||||||
|
_layout(new QHBoxLayout())
|
||||||
{
|
{
|
||||||
_keyFrameInterval->setMinimum(0);
|
_keyFrameInterval->setMinimum(0);
|
||||||
_keyFrameInterval->setMaximum(25);
|
_keyFrameInterval->setMaximum(25);
|
||||||
|
|
||||||
|
_showPassword->setMaximumWidth(22);
|
||||||
|
_showPassword->setFlat(true);
|
||||||
|
_showPassword->setStyleSheet(
|
||||||
|
"QPushButton { background-color: transparent; border: 0px }");
|
||||||
|
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
|
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@@ -122,13 +183,20 @@ MacroActionStreamEdit::MacroActionStreamEdit(
|
|||||||
SIGNAL(NumberVariableChanged(const NumberVariable<int> &)),
|
SIGNAL(NumberVariableChanged(const NumberVariable<int> &)),
|
||||||
this,
|
this,
|
||||||
SLOT(KeyFrameIntervalChanged(const NumberVariable<int> &)));
|
SLOT(KeyFrameIntervalChanged(const NumberVariable<int> &)));
|
||||||
|
QWidget::connect(_stringValue, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(StringValueChanged()));
|
||||||
|
QWidget::connect(_showPassword, SIGNAL(pressed()), this,
|
||||||
|
SLOT(ShowPassword()));
|
||||||
|
QWidget::connect(_showPassword, SIGNAL(released()), this,
|
||||||
|
SLOT(HidePassword()));
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.streaming.entry"),
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.streaming.entry"),
|
||||||
mainLayout,
|
_layout,
|
||||||
{{"{{actions}}", _actions},
|
{{"{{actions}}", _actions},
|
||||||
{"{{keyFrameInterval}}", _keyFrameInterval}});
|
{"{{keyFrameInterval}}", _keyFrameInterval},
|
||||||
setLayout(mainLayout);
|
{"{{stringValue}}", _stringValue},
|
||||||
|
{"{{showPassword}}", _showPassword}});
|
||||||
|
setLayout(_layout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
UpdateEntryData();
|
UpdateEntryData();
|
||||||
@@ -142,6 +210,7 @@ void MacroActionStreamEdit::UpdateEntryData()
|
|||||||
}
|
}
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
_keyFrameInterval->SetValue(_entryData->_keyFrameInterval);
|
_keyFrameInterval->SetValue(_entryData->_keyFrameInterval);
|
||||||
|
_stringValue->setText(_entryData->_stringValue);
|
||||||
SetWidgetVisiblity();
|
SetWidgetVisiblity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,15 +225,59 @@ void MacroActionStreamEdit::KeyFrameIntervalChanged(
|
|||||||
_entryData->_keyFrameInterval = value;
|
_entryData->_keyFrameInterval = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionStreamEdit::StringValueChanged()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_stringValue = _stringValue->text().toStdString();
|
||||||
|
SetWidgetVisiblity();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionStreamEdit::ShowPassword()
|
||||||
|
{
|
||||||
|
SetButtonIcon(_showPassword, ":res/images/visible.svg");
|
||||||
|
_stringValue->setEchoMode(QLineEdit::Normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionStreamEdit::HidePassword()
|
||||||
|
{
|
||||||
|
SetButtonIcon(_showPassword, ":res/images/invisible.svg");
|
||||||
|
_stringValue->setEchoMode(QLineEdit::PasswordEchoOnEdit);
|
||||||
|
}
|
||||||
|
|
||||||
void MacroActionStreamEdit::SetWidgetVisiblity()
|
void MacroActionStreamEdit::SetWidgetVisiblity()
|
||||||
{
|
{
|
||||||
if (!_entryData) {
|
if (!_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto action = _entryData->_action;
|
||||||
_keyFrameInterval->setVisible(
|
_keyFrameInterval->setVisible(
|
||||||
_entryData->_action ==
|
action == MacroActionStream::Action::KEYFRAME_INTERVAL);
|
||||||
MacroActionStream::Action::KEYFRAME_INTERVAL);
|
const bool modifyingStringValue =
|
||||||
|
action == MacroActionStream::Action::SERVER ||
|
||||||
|
action == MacroActionStream::Action::STREAM_KEY ||
|
||||||
|
action == MacroActionStream::Action::USERNAME ||
|
||||||
|
action == MacroActionStream::Action::PASSWORD;
|
||||||
|
_stringValue->setVisible(modifyingStringValue);
|
||||||
|
if (modifyingStringValue) {
|
||||||
|
// Give as much space to string value line edit as posssible
|
||||||
|
RemoveStretchIfPresent(_layout);
|
||||||
|
} else {
|
||||||
|
AddStretchIfNecessary(_layout);
|
||||||
|
}
|
||||||
|
if (action == MacroActionStream::Action::PASSWORD ||
|
||||||
|
action == MacroActionStream::Action::STREAM_KEY) {
|
||||||
|
_stringValue->setEchoMode(QLineEdit::PasswordEchoOnEdit);
|
||||||
|
_showPassword->show();
|
||||||
|
HidePassword();
|
||||||
|
} else {
|
||||||
|
_stringValue->setEchoMode(QLineEdit::Normal);
|
||||||
|
_showPassword->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionStreamEdit::ActionChanged(int value)
|
void MacroActionStreamEdit::ActionChanged(int value)
|
||||||
@@ -172,9 +285,12 @@ void MacroActionStreamEdit::ActionChanged(int value)
|
|||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_action = static_cast<MacroActionStream::Action>(value);
|
_entryData->_action =
|
||||||
|
static_cast<MacroActionStream::Action>(value);
|
||||||
|
}
|
||||||
|
_stringValue->setText(QString(""));
|
||||||
SetWidgetVisiblity();
|
SetWidgetVisiblity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "variable-spinbox.hpp"
|
#include "variable-spinbox.hpp"
|
||||||
|
#include "variable-line-edit.hpp"
|
||||||
|
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
@@ -26,13 +27,20 @@ public:
|
|||||||
STOP,
|
STOP,
|
||||||
START,
|
START,
|
||||||
KEYFRAME_INTERVAL,
|
KEYFRAME_INTERVAL,
|
||||||
|
SERVER,
|
||||||
|
STREAM_KEY,
|
||||||
|
USERNAME,
|
||||||
|
PASSWORD,
|
||||||
};
|
};
|
||||||
Action _action = Action::STOP;
|
Action _action = Action::STOP;
|
||||||
NumberVariable<int> _keyFrameInterval = 0;
|
IntVariable _keyFrameInterval = 0;
|
||||||
|
StringVariable _stringValue;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetKeyFrameInterval();
|
void SetKeyFrameInterval() const;
|
||||||
bool CooldownDurationReached();
|
void SetStreamSettingsValue(const char *name, const std::string &value,
|
||||||
|
bool enableAuth = false) const;
|
||||||
|
bool CooldownDurationReached() const;
|
||||||
static std::chrono::high_resolution_clock::time_point s_lastAttempt;
|
static std::chrono::high_resolution_clock::time_point s_lastAttempt;
|
||||||
|
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
@@ -58,16 +66,21 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
void KeyFrameIntervalChanged(const NumberVariable<int> &);
|
void KeyFrameIntervalChanged(const NumberVariable<int> &);
|
||||||
|
void StringValueChanged();
|
||||||
|
void ShowPassword();
|
||||||
|
void HidePassword();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
VariableSpinBox *_keyFrameInterval;
|
VariableSpinBox *_keyFrameInterval;
|
||||||
|
VariableLineEdit *_stringValue;
|
||||||
|
QPushButton *_showPassword;
|
||||||
std::shared_ptr<MacroActionStream> _entryData;
|
std::shared_ptr<MacroActionStream> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWidgetVisiblity();
|
void SetWidgetVisiblity();
|
||||||
|
|
||||||
QHBoxLayout *_mainLayout;
|
QHBoxLayout *_layout;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ bool MacroActionSudioMode::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionSudioMode::Create, MacroActionSudioModeEdit::Create,
|
{MacroActionSudioMode::Create, MacroActionSudioModeEdit::Create,
|
||||||
"AdvSceneSwitcher.action.studioMode"});
|
"AdvSceneSwitcher.action.studioMode"});
|
||||||
|
|
||||||
const static std::map<StudioModeAction, std::string> actionTypes = {
|
const static std::map<MacroActionSudioMode::Action, std::string> actionTypes = {
|
||||||
{StudioModeAction::SWAP_SCENE,
|
{MacroActionSudioMode::Action::SWAP_SCENE,
|
||||||
"AdvSceneSwitcher.action.studioMode.type.swap"},
|
"AdvSceneSwitcher.action.studioMode.type.swap"},
|
||||||
{StudioModeAction::SET_SCENE,
|
{MacroActionSudioMode::Action::SET_SCENE,
|
||||||
"AdvSceneSwitcher.action.studioMode.type.setScene"},
|
"AdvSceneSwitcher.action.studioMode.type.setScene"},
|
||||||
{StudioModeAction::ENABLE_STUDIO_MODE,
|
{MacroActionSudioMode::Action::ENABLE_STUDIO_MODE,
|
||||||
"AdvSceneSwitcher.action.studioMode.type.enable"},
|
"AdvSceneSwitcher.action.studioMode.type.enable"},
|
||||||
{StudioModeAction::DISABLE_STUDIO_MODE,
|
{MacroActionSudioMode::Action::DISABLE_STUDIO_MODE,
|
||||||
"AdvSceneSwitcher.action.studioMode.type.disable"},
|
"AdvSceneSwitcher.action.studioMode.type.disable"},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,19 +41,19 @@ static void enableStudioMode(bool enable)
|
|||||||
bool MacroActionSudioMode::PerformAction()
|
bool MacroActionSudioMode::PerformAction()
|
||||||
{
|
{
|
||||||
switch (_action) {
|
switch (_action) {
|
||||||
case StudioModeAction::SWAP_SCENE:
|
case Action::SWAP_SCENE:
|
||||||
obs_frontend_preview_program_trigger_transition();
|
obs_frontend_preview_program_trigger_transition();
|
||||||
break;
|
break;
|
||||||
case StudioModeAction::SET_SCENE: {
|
case Action::SET_SCENE: {
|
||||||
auto s = obs_weak_source_get_source(_scene.GetScene());
|
auto s = obs_weak_source_get_source(_scene.GetScene());
|
||||||
obs_frontend_set_current_preview_scene(s);
|
obs_frontend_set_current_preview_scene(s);
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case StudioModeAction::ENABLE_STUDIO_MODE:
|
case Action::ENABLE_STUDIO_MODE:
|
||||||
enableStudioMode(true);
|
enableStudioMode(true);
|
||||||
break;
|
break;
|
||||||
case StudioModeAction::DISABLE_STUDIO_MODE:
|
case Action::DISABLE_STUDIO_MODE:
|
||||||
enableStudioMode(false);
|
enableStudioMode(false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -86,15 +86,14 @@ bool MacroActionSudioMode::Save(obs_data_t *obj) const
|
|||||||
bool MacroActionSudioMode::Load(obs_data_t *obj)
|
bool MacroActionSudioMode::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_action =
|
_action = static_cast<Action>(obs_data_get_int(obj, "action"));
|
||||||
static_cast<StudioModeAction>(obs_data_get_int(obj, "action"));
|
|
||||||
_scene.Load(obj);
|
_scene.Load(obj);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MacroActionSudioMode::GetShortDesc() const
|
std::string MacroActionSudioMode::GetShortDesc() const
|
||||||
{
|
{
|
||||||
if (_action == StudioModeAction::SET_SCENE) {
|
if (_action == Action::SET_SCENE) {
|
||||||
return _scene.ToString();
|
return _scene.ToString();
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@@ -102,8 +101,9 @@ std::string MacroActionSudioMode::GetShortDesc() const
|
|||||||
|
|
||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : actionTypes) {
|
for (const auto &[id, name] : actionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,9 +139,10 @@ void MacroActionSudioModeEdit::UpdateEntryData()
|
|||||||
if (!_entryData) {
|
if (!_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(
|
||||||
|
_actions->findData(static_cast<int>(_entryData->_action)));
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
_scenes->setVisible(_entryData->_action == StudioModeAction::SET_SCENE);
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSudioModeEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSudioModeEdit::SceneChanged(const SceneSelection &s)
|
||||||
@@ -156,15 +157,27 @@ void MacroActionSudioModeEdit::SceneChanged(const SceneSelection &s)
|
|||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSudioModeEdit::ActionChanged(int value)
|
void MacroActionSudioModeEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
_scenes->setVisible(_entryData->_action ==
|
||||||
|
MacroActionSudioMode::Action::SET_SCENE);
|
||||||
|
|
||||||
|
if (_entryData->_action != MacroActionSudioMode::Action::SET_SCENE) {
|
||||||
|
_actions->removeItem(_actions->findData(static_cast<int>(
|
||||||
|
MacroActionSudioMode::Action::SET_SCENE)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSudioModeEdit::ActionChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_action = static_cast<StudioModeAction>(value);
|
_entryData->_action = static_cast<MacroActionSudioMode::Action>(
|
||||||
_scenes->setVisible(_entryData->_action == StudioModeAction::SET_SCENE);
|
_actions->itemData(index).toInt());
|
||||||
|
SetWidgetVisibility();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,6 @@
|
|||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
enum class StudioModeAction {
|
|
||||||
SWAP_SCENE,
|
|
||||||
SET_SCENE,
|
|
||||||
ENABLE_STUDIO_MODE,
|
|
||||||
DISABLE_STUDIO_MODE,
|
|
||||||
};
|
|
||||||
|
|
||||||
class MacroActionSudioMode : public MacroAction {
|
class MacroActionSudioMode : public MacroAction {
|
||||||
public:
|
public:
|
||||||
MacroActionSudioMode(Macro *m) : MacroAction(m) {}
|
MacroActionSudioMode(Macro *m) : MacroAction(m) {}
|
||||||
@@ -25,7 +18,14 @@ public:
|
|||||||
return std::make_shared<MacroActionSudioMode>(m);
|
return std::make_shared<MacroActionSudioMode>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
StudioModeAction _action = StudioModeAction::SWAP_SCENE;
|
enum class Action {
|
||||||
|
SWAP_SCENE,
|
||||||
|
SET_SCENE, // TODO: Remove in future version as the
|
||||||
|
// functionality moved to the scene switch action
|
||||||
|
ENABLE_STUDIO_MODE,
|
||||||
|
DISABLE_STUDIO_MODE,
|
||||||
|
};
|
||||||
|
Action _action = Action::SWAP_SCENE;
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -55,12 +55,13 @@ private slots:
|
|||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
std::shared_ptr<MacroActionSudioMode> _entryData;
|
std::shared_ptr<MacroActionSudioMode> _entryData;
|
||||||
|
|
||||||
private:
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ bool MacroActionTimer::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionTimer::Create, MacroActionTimerEdit::Create,
|
{MacroActionTimer::Create, MacroActionTimerEdit::Create,
|
||||||
"AdvSceneSwitcher.action.timer"});
|
"AdvSceneSwitcher.action.timer"});
|
||||||
|
|
||||||
static std::map<TimerAction, std::string> timerActions = {
|
const static std::map<TimerAction, std::string> timerActions = {
|
||||||
{TimerAction::PAUSE, "AdvSceneSwitcher.action.timer.type.pause"},
|
{TimerAction::PAUSE, "AdvSceneSwitcher.action.timer.type.pause"},
|
||||||
{TimerAction::CONTINUE, "AdvSceneSwitcher.action.timer.type.continue"},
|
{TimerAction::CONTINUE, "AdvSceneSwitcher.action.timer.type.continue"},
|
||||||
{TimerAction::RESET, "AdvSceneSwitcher.action.timer.type.reset"},
|
{TimerAction::RESET, "AdvSceneSwitcher.action.timer.type.reset"},
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void MacroActionTransition::SetSourceTransition(bool show)
|
|||||||
obs_source_release(transition);
|
obs_source_release(transition);
|
||||||
|
|
||||||
const auto items = _source.GetSceneItems(_scene);
|
const auto items = _source.GetSceneItems(_scene);
|
||||||
for (auto &item : items) {
|
for (const auto &item : items) {
|
||||||
if (_setTransitionType) {
|
if (_setTransitionType) {
|
||||||
obs_sceneitem_set_transition(item, show, t);
|
obs_sceneitem_set_transition(item, show, t);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,6 @@ void MacroActionTransition::SetSourceTransition(bool show)
|
|||||||
obs_sceneitem_set_transition_duration(
|
obs_sceneitem_set_transition_duration(
|
||||||
item, show, _duration.Milliseconds());
|
item, show, _duration.Milliseconds());
|
||||||
}
|
}
|
||||||
obs_sceneitem_release(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_source_release(t);
|
obs_source_release(t);
|
||||||
@@ -200,7 +199,7 @@ std::string MacroActionTransition::GetShortDesc() const
|
|||||||
|
|
||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : actionTypes) {
|
for (const auto &entry : actionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(entry.second.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,6 +297,8 @@ void MacroActionTransitionEdit::SourceChanged(const SceneItemSelection &item)
|
|||||||
_entryData->_source = item;
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionTransitionEdit::ActionChanged(int value)
|
void MacroActionTransitionEdit::ActionChanged(int value)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "advanced-scene-switcher.hpp"
|
#include "advanced-scene-switcher.hpp"
|
||||||
#include "macro.hpp"
|
#include "macro.hpp"
|
||||||
#include "math-helpers.hpp"
|
#include "math-helpers.hpp"
|
||||||
|
#include "non-modal-dialog.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
@@ -15,7 +16,7 @@ bool MacroActionVariable::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionVariable::Create, MacroActionVariableEdit::Create,
|
{MacroActionVariable::Create, MacroActionVariableEdit::Create,
|
||||||
"AdvSceneSwitcher.action.variable"});
|
"AdvSceneSwitcher.action.variable"});
|
||||||
|
|
||||||
static std::map<MacroActionVariable::Type, std::string> actionTypes = {
|
const static std::map<MacroActionVariable::Type, std::string> actionTypes = {
|
||||||
{MacroActionVariable::Type::SET_FIXED_VALUE,
|
{MacroActionVariable::Type::SET_FIXED_VALUE,
|
||||||
"AdvSceneSwitcher.action.variable.type.set"},
|
"AdvSceneSwitcher.action.variable.type.set"},
|
||||||
{MacroActionVariable::Type::APPEND,
|
{MacroActionVariable::Type::APPEND,
|
||||||
@@ -38,6 +39,18 @@ static std::map<MacroActionVariable::Type, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.variable.type.findAndReplace"},
|
"AdvSceneSwitcher.action.variable.type.findAndReplace"},
|
||||||
{MacroActionVariable::Type::MATH_EXPRESSION,
|
{MacroActionVariable::Type::MATH_EXPRESSION,
|
||||||
"AdvSceneSwitcher.action.variable.type.mathExpression"},
|
"AdvSceneSwitcher.action.variable.type.mathExpression"},
|
||||||
|
{MacroActionVariable::Type::USER_INPUT,
|
||||||
|
"AdvSceneSwitcher.action.variable.type.askForValue"},
|
||||||
|
{MacroActionVariable::Type::ENV_VARIABLE,
|
||||||
|
"AdvSceneSwitcher.action.variable.type.environmentVariable"},
|
||||||
|
{MacroActionVariable::Type::SCENE_ITEM_COUNT,
|
||||||
|
"AdvSceneSwitcher.action.variable.type.sceneItemCount"},
|
||||||
|
{MacroActionVariable::Type::STRING_LENGTH,
|
||||||
|
"AdvSceneSwitcher.action.variable.type.stringLength"},
|
||||||
|
{MacroActionVariable::Type::EXTRACT_JSON,
|
||||||
|
"AdvSceneSwitcher.action.variable.type.extractJson"},
|
||||||
|
{MacroActionVariable::Type::SET_TO_TEMPVAR,
|
||||||
|
"AdvSceneSwitcher.action.variable.type.setToTempvar"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void apppend(Variable &var, const std::string &value)
|
static void apppend(Variable &var, const std::string &value)
|
||||||
@@ -121,6 +134,21 @@ void MacroActionVariable::HandleMathExpression(Variable *var)
|
|||||||
var->SetValue(std::get<double>(result));
|
var->SetValue(std::get<double>(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct AskForInputParams {
|
||||||
|
QString prompt;
|
||||||
|
QString placeholder;
|
||||||
|
std::optional<std::string> result;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void askForInput(void *param)
|
||||||
|
{
|
||||||
|
auto parameters = static_cast<AskForInputParams *>(param);
|
||||||
|
auto dialog = new NonModalMessageDialog(
|
||||||
|
parameters->prompt, NonModalMessageDialog::Type::INPUT);
|
||||||
|
dialog->SetInput(parameters->placeholder);
|
||||||
|
parameters->result = dialog->GetInput();
|
||||||
|
}
|
||||||
|
|
||||||
bool MacroActionVariable::PerformAction()
|
bool MacroActionVariable::PerformAction()
|
||||||
{
|
{
|
||||||
auto var = _variable.lock();
|
auto var = _variable.lock();
|
||||||
@@ -189,6 +217,57 @@ bool MacroActionVariable::PerformAction()
|
|||||||
HandleMathExpression(var.get());
|
HandleMathExpression(var.get());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case Type::USER_INPUT: {
|
||||||
|
AskForInputParams params{
|
||||||
|
_useCustomPrompt
|
||||||
|
? QString::fromStdString(_inputPrompt)
|
||||||
|
: QString(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.variable.askForValuePromptDefault"))
|
||||||
|
.arg(QString::fromStdString(
|
||||||
|
var->Name())),
|
||||||
|
_useCustomPrompt && _useInputPlaceholder
|
||||||
|
? QString::fromStdString(_inputPlaceholder)
|
||||||
|
: "",
|
||||||
|
{}};
|
||||||
|
obs_queue_task(OBS_TASK_UI, askForInput, ¶ms, true);
|
||||||
|
if (!params.result.has_value()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var->SetValue(*params.result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Type::ENV_VARIABLE: {
|
||||||
|
var->SetValue(std::getenv(_envVariableName.c_str()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Type::SCENE_ITEM_COUNT: {
|
||||||
|
var->SetValue(GetSceneItemCount(_scene.GetScene(false)));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Type::STRING_LENGTH: {
|
||||||
|
var->SetValue(std::string(_strValue).length());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Type::EXTRACT_JSON: {
|
||||||
|
auto value = GetJsonField(var->Value(), _strValue);
|
||||||
|
if (!value.has_value()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var->SetValue(*value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Type::SET_TO_TEMPVAR: {
|
||||||
|
auto tempVar = _tempVar.GetTempVariable(GetMacro());
|
||||||
|
if (!tempVar) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
auto value = tempVar->Value();
|
||||||
|
if (!value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var->SetValue(*value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -201,7 +280,7 @@ bool MacroActionVariable::Save(obs_data_t *obj) const
|
|||||||
GetWeakVariableName(_variable).c_str());
|
GetWeakVariableName(_variable).c_str());
|
||||||
obs_data_set_string(obj, "variable2Name",
|
obs_data_set_string(obj, "variable2Name",
|
||||||
GetWeakVariableName(_variable2).c_str());
|
GetWeakVariableName(_variable2).c_str());
|
||||||
obs_data_set_string(obj, "strValue", _strValue.c_str());
|
_strValue.Save(obj, "strValue");
|
||||||
obs_data_set_double(obj, "numValue", _numValue);
|
obs_data_set_double(obj, "numValue", _numValue);
|
||||||
obs_data_set_int(obj, "condition", static_cast<int>(_type));
|
obs_data_set_int(obj, "condition", static_cast<int>(_type));
|
||||||
obs_data_set_int(obj, "segmentIdx", GetSegmentIndexValue());
|
obs_data_set_int(obj, "segmentIdx", GetSegmentIndexValue());
|
||||||
@@ -209,10 +288,17 @@ bool MacroActionVariable::Save(obs_data_t *obj) const
|
|||||||
obs_data_set_int(obj, "subStringSize", _subStringSize);
|
obs_data_set_int(obj, "subStringSize", _subStringSize);
|
||||||
obs_data_set_string(obj, "regexPattern", _regexPattern.c_str());
|
obs_data_set_string(obj, "regexPattern", _regexPattern.c_str());
|
||||||
obs_data_set_int(obj, "regexMatchIdx", _regexMatchIdx);
|
obs_data_set_int(obj, "regexMatchIdx", _regexMatchIdx);
|
||||||
obs_data_set_string(obj, "findStr", _findStr.c_str());
|
_findStr.Save(obj, "findStr");
|
||||||
obs_data_set_string(obj, "replaceStr", _replaceStr.c_str());
|
_replaceStr.Save(obj, "replaceStr");
|
||||||
_regex.Save(obj);
|
_regex.Save(obj);
|
||||||
_mathExpression.Save(obj, "mathExpression");
|
_mathExpression.Save(obj, "mathExpression");
|
||||||
|
obs_data_set_bool(obj, "useCustomPrompt", _useCustomPrompt);
|
||||||
|
_inputPrompt.Save(obj, "inputPrompt");
|
||||||
|
obs_data_set_bool(obj, "useInputPlaceholder", _useInputPlaceholder);
|
||||||
|
_inputPlaceholder.Save(obj, "inputPlaceholder");
|
||||||
|
_envVariableName.Save(obj, "environmentVariableName");
|
||||||
|
_scene.Save(obj);
|
||||||
|
_tempVar.Save(obj);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +309,7 @@ bool MacroActionVariable::Load(obs_data_t *obj)
|
|||||||
GetWeakVariableByName(obs_data_get_string(obj, "variableName"));
|
GetWeakVariableByName(obs_data_get_string(obj, "variableName"));
|
||||||
_variable2 = GetWeakVariableByName(
|
_variable2 = GetWeakVariableByName(
|
||||||
obs_data_get_string(obj, "variable2Name"));
|
obs_data_get_string(obj, "variable2Name"));
|
||||||
_strValue = obs_data_get_string(obj, "strValue");
|
_strValue.Load(obj, "strValue");
|
||||||
_numValue = obs_data_get_double(obj, "numValue");
|
_numValue = obs_data_get_double(obj, "numValue");
|
||||||
_type = static_cast<Type>(obs_data_get_int(obj, "condition"));
|
_type = static_cast<Type>(obs_data_get_int(obj, "condition"));
|
||||||
_segmentIdxLoadValue = obs_data_get_int(obj, "segmentIdx");
|
_segmentIdxLoadValue = obs_data_get_int(obj, "segmentIdx");
|
||||||
@@ -232,9 +318,16 @@ bool MacroActionVariable::Load(obs_data_t *obj)
|
|||||||
_regex.Load(obj);
|
_regex.Load(obj);
|
||||||
_regexPattern = obs_data_get_string(obj, "regexPattern");
|
_regexPattern = obs_data_get_string(obj, "regexPattern");
|
||||||
_regexMatchIdx = obs_data_get_int(obj, "regexMatchIdx");
|
_regexMatchIdx = obs_data_get_int(obj, "regexMatchIdx");
|
||||||
_findStr = obs_data_get_string(obj, "findStr");
|
_findStr.Load(obj, "findStr");
|
||||||
_replaceStr = obs_data_get_string(obj, "replaceStr");
|
_replaceStr.Load(obj, "replaceStr");
|
||||||
_mathExpression.Load(obj, "mathExpression");
|
_mathExpression.Load(obj, "mathExpression");
|
||||||
|
_useCustomPrompt = obs_data_get_bool(obj, "useCustomPrompt");
|
||||||
|
_inputPrompt.Load(obj, "inputPrompt");
|
||||||
|
_useInputPlaceholder = obs_data_get_bool(obj, "useInputPlaceholder");
|
||||||
|
_inputPlaceholder.Load(obj, "inputPlaceholder");
|
||||||
|
_envVariableName.Load(obj, "environmentVariableName");
|
||||||
|
_scene.Load(obj);
|
||||||
|
_tempVar.Load(obj, GetMacro());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +370,7 @@ void MacroActionVariable::SetSegmentIndexValue(int value)
|
|||||||
|
|
||||||
_macroSegment = segment;
|
_macroSegment = segment;
|
||||||
if (segment) {
|
if (segment) {
|
||||||
segment->IncrementVariableRef();
|
IncrementVariableRef(segment.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,13 +412,14 @@ void MacroActionVariable::DecrementCurrentSegmentVariableRef()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
segment->DecrementVariableRef();
|
DecrementVariableRef(segment.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void populateTypeSelection(QComboBox *list)
|
static inline void populateTypeSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : actionTypes) {
|
for (const auto &[action, name] : actionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(name.c_str()),
|
||||||
|
static_cast<int>(action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,10 +428,11 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_variables(new VariableSelection(this)),
|
_variables(new VariableSelection(this)),
|
||||||
_variables2(new VariableSelection(this)),
|
_variables2(new VariableSelection(this)),
|
||||||
_actions(new QComboBox()),
|
_actions(new FilterComboBox(this)),
|
||||||
_strValue(new ResizingPlainTextEdit(this, 5, 1, 1)),
|
_strValue(new VariableTextEdit(this, 5, 1, 1)),
|
||||||
_numValue(new QDoubleSpinBox()),
|
_numValue(new QDoubleSpinBox()),
|
||||||
_segmentIdx(new QSpinBox()),
|
_segmentIdx(new MacroSegmentSelection(
|
||||||
|
this, MacroSegmentSelection::Type::CONDITION, false)),
|
||||||
_segmentValueStatus(new QLabel()),
|
_segmentValueStatus(new QLabel()),
|
||||||
_segmentValue(new ResizingPlainTextEdit(this, 10, 1, 1)),
|
_segmentValue(new ResizingPlainTextEdit(this, 10, 1, 1)),
|
||||||
_substringLayout(new QVBoxLayout()),
|
_substringLayout(new QVBoxLayout()),
|
||||||
@@ -349,16 +444,23 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
_regexPattern(new ResizingPlainTextEdit(this, 10, 1, 1)),
|
_regexPattern(new ResizingPlainTextEdit(this, 10, 1, 1)),
|
||||||
_regexMatchIdx(new QSpinBox()),
|
_regexMatchIdx(new QSpinBox()),
|
||||||
_findReplaceLayout(new QHBoxLayout()),
|
_findReplaceLayout(new QHBoxLayout()),
|
||||||
_findStr(new ResizingPlainTextEdit(this, 10, 1, 1)),
|
_findStr(new VariableTextEdit(this, 10, 1, 1)),
|
||||||
_replaceStr(new ResizingPlainTextEdit(this, 10, 1, 1)),
|
_replaceStr(new VariableTextEdit(this, 10, 1, 1)),
|
||||||
_mathExpression(new VariableLineEdit(this)),
|
_mathExpression(new VariableLineEdit(this)),
|
||||||
_mathExpressionResult(new QLabel())
|
_mathExpressionResult(new QLabel()),
|
||||||
|
_promptLayout(new QHBoxLayout()),
|
||||||
|
_useCustomPrompt(new QCheckBox()),
|
||||||
|
_inputPrompt(new VariableLineEdit(this)),
|
||||||
|
_placeholderLayout(new QHBoxLayout()),
|
||||||
|
_useInputPlaceholder(new QCheckBox()),
|
||||||
|
_inputPlaceholder(new VariableLineEdit(this)),
|
||||||
|
_envVariable(new VariableLineEdit(this)),
|
||||||
|
_scenes(new SceneSelectionWidget(this, true, false, true, true,
|
||||||
|
true)),
|
||||||
|
_tempVars(new TempVariableSelection(this))
|
||||||
{
|
{
|
||||||
_numValue->setMinimum(-9999999999);
|
_numValue->setMinimum(-9999999999);
|
||||||
_numValue->setMaximum(9999999999);
|
_numValue->setMaximum(9999999999);
|
||||||
_segmentIdx->setMinimum(0);
|
|
||||||
_segmentIdx->setMaximum(99);
|
|
||||||
_segmentIdx->setSpecialValueText("-");
|
|
||||||
_segmentValue->setReadOnly(true);
|
_segmentValue->setReadOnly(true);
|
||||||
_subStringStart->setMinimum(1);
|
_subStringStart->setMinimum(1);
|
||||||
_subStringStart->setMaximum(99999);
|
_subStringStart->setMaximum(99999);
|
||||||
@@ -371,6 +473,8 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
_regexMatchIdx->setMinimum(1);
|
_regexMatchIdx->setMinimum(1);
|
||||||
_regexMatchIdx->setMaximum(999);
|
_regexMatchIdx->setMaximum(999);
|
||||||
_regexMatchIdx->setSuffix(".");
|
_regexMatchIdx->setSuffix(".");
|
||||||
|
_inputPrompt->setSizePolicy(QSizePolicy::MinimumExpanding,
|
||||||
|
QSizePolicy::Preferred);
|
||||||
populateTypeSelection(_actions);
|
populateTypeSelection(_actions);
|
||||||
|
|
||||||
QWidget::connect(_variables, SIGNAL(SelectionChanged(const QString &)),
|
QWidget::connect(_variables, SIGNAL(SelectionChanged(const QString &)),
|
||||||
@@ -383,8 +487,9 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
SLOT(StrValueChanged()));
|
SLOT(StrValueChanged()));
|
||||||
QWidget::connect(_numValue, SIGNAL(valueChanged(double)), this,
|
QWidget::connect(_numValue, SIGNAL(valueChanged(double)), this,
|
||||||
SLOT(NumValueChanged(double)));
|
SLOT(NumValueChanged(double)));
|
||||||
QWidget::connect(_segmentIdx, SIGNAL(valueChanged(int)), this,
|
QWidget::connect(_segmentIdx,
|
||||||
SLOT(SegmentIndexChanged(int)));
|
SIGNAL(SelectionChanged(const IntVariable &)), this,
|
||||||
|
SLOT(SegmentIndexChanged(const IntVariable &)));
|
||||||
QWidget::connect(window(), SIGNAL(MacroSegmentOrderChanged()), this,
|
QWidget::connect(window(), SIGNAL(MacroSegmentOrderChanged()), this,
|
||||||
SLOT(MacroSegmentOrderChanged()));
|
SLOT(MacroSegmentOrderChanged()));
|
||||||
QWidget::connect(_subStringStart, SIGNAL(valueChanged(int)), this,
|
QWidget::connect(_subStringStart, SIGNAL(valueChanged(int)), this,
|
||||||
@@ -403,6 +508,21 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
SLOT(ReplaceStrValueChanged()));
|
SLOT(ReplaceStrValueChanged()));
|
||||||
QWidget::connect(_mathExpression, SIGNAL(editingFinished()), this,
|
QWidget::connect(_mathExpression, SIGNAL(editingFinished()), this,
|
||||||
SLOT(MathExpressionChanged()));
|
SLOT(MathExpressionChanged()));
|
||||||
|
QWidget::connect(_useCustomPrompt, SIGNAL(stateChanged(int)), this,
|
||||||
|
SLOT(UseCustomPromptChanged(int)));
|
||||||
|
QWidget::connect(_inputPrompt, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(InputPromptChanged()));
|
||||||
|
QWidget::connect(_useInputPlaceholder, SIGNAL(stateChanged(int)), this,
|
||||||
|
SLOT(UseInputPlaceholderChanged(int)));
|
||||||
|
QWidget::connect(_inputPlaceholder, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(InputPlaceholderChanged()));
|
||||||
|
QWidget::connect(_envVariable, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(EnvVariableChanged()));
|
||||||
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
|
QWidget::connect(_tempVars,
|
||||||
|
SIGNAL(SelectionChanged(const TempVariableRef &)),
|
||||||
|
this, SLOT(SelectionChanged(const TempVariableRef &)));
|
||||||
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{variables}}", _variables},
|
{"{{variables}}", _variables},
|
||||||
@@ -417,6 +537,13 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
{"{{findStr}}", _findStr},
|
{"{{findStr}}", _findStr},
|
||||||
{"{{replaceStr}}", _replaceStr},
|
{"{{replaceStr}}", _replaceStr},
|
||||||
{"{{mathExpression}}", _mathExpression},
|
{"{{mathExpression}}", _mathExpression},
|
||||||
|
{"{{useCustomPrompt}}", _useCustomPrompt},
|
||||||
|
{"{{inputPrompt}}", _inputPrompt},
|
||||||
|
{"{{useInputPlaceholder}}", _useInputPlaceholder},
|
||||||
|
{"{{inputPlaceholder}}", _inputPlaceholder},
|
||||||
|
{"{{envVariableName}}", _envVariable},
|
||||||
|
{"{{scenes}}", _scenes},
|
||||||
|
{"{{tempVars}}", _tempVars},
|
||||||
};
|
};
|
||||||
auto entryLayout = new QHBoxLayout;
|
auto entryLayout = new QHBoxLayout;
|
||||||
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.variable.entry"),
|
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.variable.entry"),
|
||||||
@@ -437,6 +564,15 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
"AdvSceneSwitcher.action.variable.entry.findAndReplace"),
|
"AdvSceneSwitcher.action.variable.entry.findAndReplace"),
|
||||||
_findReplaceLayout, widgetPlaceholders, false);
|
_findReplaceLayout, widgetPlaceholders, false);
|
||||||
|
|
||||||
|
PlaceWidgets(
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.variable.entry.userInput.customPrompt"),
|
||||||
|
_promptLayout, widgetPlaceholders);
|
||||||
|
PlaceWidgets(
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.variable.entry.userInput.placeholder"),
|
||||||
|
_placeholderLayout, widgetPlaceholders);
|
||||||
|
|
||||||
auto regexConfigLayout = new QHBoxLayout;
|
auto regexConfigLayout = new QHBoxLayout;
|
||||||
regexConfigLayout->addWidget(_regex);
|
regexConfigLayout->addWidget(_regex);
|
||||||
regexConfigLayout->addStretch();
|
regexConfigLayout->addStretch();
|
||||||
@@ -453,6 +589,8 @@ MacroActionVariableEdit::MacroActionVariableEdit(
|
|||||||
layout->addWidget(_segmentValue);
|
layout->addWidget(_segmentValue);
|
||||||
layout->addLayout(_findReplaceLayout);
|
layout->addLayout(_findReplaceLayout);
|
||||||
layout->addWidget(_mathExpressionResult);
|
layout->addWidget(_mathExpressionResult);
|
||||||
|
layout->addLayout(_promptLayout);
|
||||||
|
layout->addLayout(_placeholderLayout);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
@@ -473,20 +611,33 @@ void MacroActionVariableEdit::UpdateEntryData()
|
|||||||
|
|
||||||
_variables->SetVariable(_entryData->_variable);
|
_variables->SetVariable(_entryData->_variable);
|
||||||
_variables2->SetVariable(_entryData->_variable2);
|
_variables2->SetVariable(_entryData->_variable2);
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_type));
|
_actions->setCurrentIndex(
|
||||||
_strValue->setPlainText(QString::fromStdString(_entryData->_strValue));
|
_actions->findData(static_cast<int>(_entryData->_type)));
|
||||||
|
_strValue->setPlainText(_entryData->_strValue);
|
||||||
_numValue->setValue(_entryData->_numValue);
|
_numValue->setValue(_entryData->_numValue);
|
||||||
_segmentIdx->setValue(_entryData->GetSegmentIndexValue() + 1);
|
_segmentIdx->SetValue(_entryData->GetSegmentIndexValue() + 1);
|
||||||
|
_segmentIdx->SetMacro(_entryData->GetMacro());
|
||||||
|
_segmentIdx->SetType(
|
||||||
|
_entryData->_type ==
|
||||||
|
MacroActionVariable::Type::SET_CONDITION_VALUE
|
||||||
|
? MacroSegmentSelection::Type::CONDITION
|
||||||
|
: MacroSegmentSelection::Type::ACTION);
|
||||||
_subStringStart->setValue(_entryData->_subStringStart + 1);
|
_subStringStart->setValue(_entryData->_subStringStart + 1);
|
||||||
_subStringSize->setValue(_entryData->_subStringSize);
|
_subStringSize->setValue(_entryData->_subStringSize);
|
||||||
_regex->SetRegexConfig(_entryData->_regex);
|
_regex->SetRegexConfig(_entryData->_regex);
|
||||||
_regexPattern->setPlainText(
|
_regexPattern->setPlainText(
|
||||||
QString::fromStdString(_entryData->_regexPattern));
|
QString::fromStdString(_entryData->_regexPattern));
|
||||||
_regexMatchIdx->setValue(_entryData->_regexMatchIdx + 1);
|
_regexMatchIdx->setValue(_entryData->_regexMatchIdx + 1);
|
||||||
_findStr->setPlainText(QString::fromStdString(_entryData->_findStr));
|
_findStr->setPlainText(_entryData->_findStr);
|
||||||
_replaceStr->setPlainText(
|
_replaceStr->setPlainText(_entryData->_replaceStr);
|
||||||
QString::fromStdString(_entryData->_replaceStr));
|
|
||||||
_mathExpression->setText(_entryData->_mathExpression);
|
_mathExpression->setText(_entryData->_mathExpression);
|
||||||
|
_useCustomPrompt->setChecked(_entryData->_useCustomPrompt);
|
||||||
|
_inputPrompt->setText(_entryData->_inputPrompt);
|
||||||
|
_useInputPlaceholder->setChecked(_entryData->_useInputPlaceholder);
|
||||||
|
_inputPlaceholder->setText(_entryData->_inputPlaceholder);
|
||||||
|
_envVariable->setText(_entryData->_envVariableName);
|
||||||
|
_scenes->SetScene(_entryData->_scene);
|
||||||
|
_tempVars->SetVariable(_entryData->_tempVar);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,21 +661,23 @@ void MacroActionVariableEdit::Variable2Changed(const QString &text)
|
|||||||
_entryData->_variable2 = GetWeakVariableByQString(text);
|
_entryData->_variable2 = GetWeakVariableByQString(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionVariableEdit::ActionChanged(int value)
|
void MacroActionVariableEdit::ActionChanged(int idx)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData || idx == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_type = static_cast<MacroActionVariable::Type>(value);
|
_entryData->_type = static_cast<MacroActionVariable::Type>(
|
||||||
SetWidgetVisibility();
|
_actions->itemData(idx).toInt());
|
||||||
|
|
||||||
if (_entryData->_type == MacroActionVariable::Type::SET_ACTION_VALUE ||
|
if (_entryData->_type == MacroActionVariable::Type::SET_ACTION_VALUE) {
|
||||||
_entryData->_type ==
|
_segmentIdx->SetType(MacroSegmentSelection::Type::ACTION);
|
||||||
MacroActionVariable::Type::SET_CONDITION_VALUE) {
|
} else if (_entryData->_type ==
|
||||||
MarkSelectedSegment();
|
MacroActionVariable::Type::SET_CONDITION_VALUE) {
|
||||||
|
_segmentIdx->SetType(MacroSegmentSelection::Type::CONDITION);
|
||||||
}
|
}
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionVariableEdit::StrValueChanged()
|
void MacroActionVariableEdit::StrValueChanged()
|
||||||
@@ -549,7 +702,7 @@ void MacroActionVariableEdit::NumValueChanged(double val)
|
|||||||
_entryData->_numValue = val;
|
_entryData->_numValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionVariableEdit::SegmentIndexChanged(int val)
|
void MacroActionVariableEdit::SegmentIndexChanged(const IntVariable &val)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
@@ -557,7 +710,6 @@ void MacroActionVariableEdit::SegmentIndexChanged(int val)
|
|||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->SetSegmentIndexValue(val - 1);
|
_entryData->SetSegmentIndexValue(val - 1);
|
||||||
MarkSelectedSegment();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionVariableEdit::SetSegmentValueError(const QString &text)
|
void MacroActionVariableEdit::SetSegmentValueError(const QString &text)
|
||||||
@@ -590,7 +742,7 @@ void MacroActionVariableEdit::UpdateSegmentVariableValue()
|
|||||||
SetSegmentValueError(obs_module_text(
|
SetSegmentValueError(obs_module_text(
|
||||||
"AdvSceneSwitcher.action.variable.invalidSelection"));
|
"AdvSceneSwitcher.action.variable.invalidSelection"));
|
||||||
const QSignalBlocker b(_segmentIdx);
|
const QSignalBlocker b(_segmentIdx);
|
||||||
_segmentIdx->setValue(index);
|
_segmentIdx->SetValue(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +766,7 @@ void MacroActionVariableEdit::UpdateSegmentVariableValue()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!segment->SupportsVariableValue()) {
|
if (!SupportsVariableValue(segment.get())) {
|
||||||
std::string type;
|
std::string type;
|
||||||
QString fmt;
|
QString fmt;
|
||||||
|
|
||||||
@@ -639,8 +791,14 @@ void MacroActionVariableEdit::UpdateSegmentVariableValue()
|
|||||||
_segmentValueStatus->setText(obs_module_text(
|
_segmentValueStatus->setText(obs_module_text(
|
||||||
"AdvSceneSwitcher.action.variable.currentSegmentValue"));
|
"AdvSceneSwitcher.action.variable.currentSegmentValue"));
|
||||||
_segmentValue->show();
|
_segmentValue->show();
|
||||||
_segmentValue->setPlainText(
|
|
||||||
QString::fromStdString(segment->GetVariableValue()));
|
// Only update the text if the value changed to prevent possible text
|
||||||
|
// selections being lost
|
||||||
|
auto previousText = _segmentValue->toPlainText();
|
||||||
|
auto newText = QString::fromStdString(segment->GetVariableValue());
|
||||||
|
if (newText != previousText) {
|
||||||
|
_segmentValue->setPlainText(newText);
|
||||||
|
}
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
@@ -649,7 +807,7 @@ void MacroActionVariableEdit::UpdateSegmentVariableValue()
|
|||||||
void MacroActionVariableEdit::MacroSegmentOrderChanged()
|
void MacroActionVariableEdit::MacroSegmentOrderChanged()
|
||||||
{
|
{
|
||||||
const QSignalBlocker b(_segmentIdx);
|
const QSignalBlocker b(_segmentIdx);
|
||||||
_segmentIdx->setValue(_entryData->GetSegmentIndexValue() + 1);
|
_segmentIdx->SetValue(_entryData->GetSegmentIndexValue() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionVariableEdit::SubStringStartChanged(int val)
|
void MacroActionVariableEdit::SubStringStartChanged(int val)
|
||||||
@@ -752,40 +910,76 @@ void MacroActionVariableEdit::MathExpressionChanged()
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionVariableEdit::MarkSelectedSegment()
|
void MacroActionVariableEdit::UseCustomPromptChanged(int value)
|
||||||
{
|
{
|
||||||
if (switcher->disableHints) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto m = _entryData->GetMacro();
|
auto lock = LockContext();
|
||||||
if (!m) {
|
_entryData->_useCustomPrompt = value;
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionVariableEdit::InputPromptChanged()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = _entryData->GetSegmentIndexValue();
|
auto lock = LockContext();
|
||||||
if (index < 0) {
|
_entryData->_inputPrompt = _inputPrompt->text().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionVariableEdit::UseInputPlaceholderChanged(int value)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entryData->_type == MacroActionVariable::Type::SET_ACTION_VALUE) {
|
auto lock = LockContext();
|
||||||
const auto &actions = m->Actions();
|
_entryData->_useInputPlaceholder = value;
|
||||||
if (index >= (int)actions.size()) {
|
SetWidgetVisibility();
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
AdvSceneSwitcher::window->HighlightAction(
|
void MacroActionVariableEdit::InputPlaceholderChanged()
|
||||||
index, QColor(Qt::lightGray));
|
{
|
||||||
} else {
|
if (_loading || !_entryData) {
|
||||||
const auto &conditions = m->Conditions();
|
return;
|
||||||
if (index >= (int)conditions.size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
AdvSceneSwitcher::window->HighlightCondition(
|
|
||||||
index, QColor(Qt::lightGray));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PulseWidget(_segmentIdx, QColor(Qt::lightGray), QColor(0, 0, 0, 0),
|
auto lock = LockContext();
|
||||||
true);
|
_entryData->_inputPlaceholder = _inputPlaceholder->text().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionVariableEdit::EnvVariableChanged()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_envVariableName = _envVariable->text().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionVariableEdit::SceneChanged(const SceneSelection &scene)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_scene = scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionVariableEdit::SelectionChanged(const TempVariableRef &var)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_tempVar = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionVariableEdit::SetWidgetVisibility()
|
void MacroActionVariableEdit::SetWidgetVisibility()
|
||||||
@@ -799,7 +993,9 @@ void MacroActionVariableEdit::SetWidgetVisibility()
|
|||||||
_strValue->setVisible(
|
_strValue->setVisible(
|
||||||
_entryData->_type ==
|
_entryData->_type ==
|
||||||
MacroActionVariable::Type::SET_FIXED_VALUE ||
|
MacroActionVariable::Type::SET_FIXED_VALUE ||
|
||||||
_entryData->_type == MacroActionVariable::Type::APPEND);
|
_entryData->_type == MacroActionVariable::Type::APPEND ||
|
||||||
|
_entryData->_type == MacroActionVariable::Type::STRING_LENGTH ||
|
||||||
|
_entryData->_type == MacroActionVariable::Type::EXTRACT_JSON);
|
||||||
_numValue->setVisible(
|
_numValue->setVisible(
|
||||||
_entryData->_type == MacroActionVariable::Type::INCREMENT ||
|
_entryData->_type == MacroActionVariable::Type::INCREMENT ||
|
||||||
_entryData->_type == MacroActionVariable::Type::DECREMENT);
|
_entryData->_type == MacroActionVariable::Type::DECREMENT);
|
||||||
@@ -833,7 +1029,39 @@ void MacroActionVariableEdit::SetWidgetVisibility()
|
|||||||
_mathExpression->setVisible(_entryData->_type ==
|
_mathExpression->setVisible(_entryData->_type ==
|
||||||
MacroActionVariable::Type::MATH_EXPRESSION);
|
MacroActionVariable::Type::MATH_EXPRESSION);
|
||||||
_mathExpressionResult->hide();
|
_mathExpressionResult->hide();
|
||||||
|
SetLayoutVisible(_promptLayout,
|
||||||
|
_entryData->_type ==
|
||||||
|
MacroActionVariable::Type::USER_INPUT);
|
||||||
|
_inputPrompt->setVisible(
|
||||||
|
_entryData->_type == MacroActionVariable::Type::USER_INPUT &&
|
||||||
|
_entryData->_useCustomPrompt);
|
||||||
|
if (_entryData->_useCustomPrompt) {
|
||||||
|
RemoveStretchIfPresent(_promptLayout);
|
||||||
|
} else {
|
||||||
|
AddStretchIfNecessary(_promptLayout);
|
||||||
|
}
|
||||||
|
SetLayoutVisible(
|
||||||
|
_placeholderLayout,
|
||||||
|
_entryData->_type == MacroActionVariable::Type::USER_INPUT &&
|
||||||
|
_entryData->_useCustomPrompt);
|
||||||
|
_useInputPlaceholder->setVisible(
|
||||||
|
_entryData->_type == MacroActionVariable::Type::USER_INPUT &&
|
||||||
|
_entryData->_useCustomPrompt);
|
||||||
|
_inputPlaceholder->setVisible(
|
||||||
|
_entryData->_type == MacroActionVariable::Type::USER_INPUT &&
|
||||||
|
_entryData->_useCustomPrompt &&
|
||||||
|
_entryData->_useInputPlaceholder);
|
||||||
|
if (_entryData->_useInputPlaceholder) {
|
||||||
|
RemoveStretchIfPresent(_placeholderLayout);
|
||||||
|
} else {
|
||||||
|
AddStretchIfNecessary(_placeholderLayout);
|
||||||
|
}
|
||||||
|
_envVariable->setVisible(_entryData->_type ==
|
||||||
|
MacroActionVariable::Type::ENV_VARIABLE);
|
||||||
|
_scenes->setVisible(_entryData->_type ==
|
||||||
|
MacroActionVariable::Type::SCENE_ITEM_COUNT);
|
||||||
|
_tempVars->setVisible(_entryData->_type ==
|
||||||
|
MacroActionVariable::Type::SET_TO_TEMPVAR);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
|
#include "macro-segment-selection.hpp"
|
||||||
#include "regex-config.hpp"
|
#include "regex-config.hpp"
|
||||||
#include "resizing-text-edit.hpp"
|
#include "resizing-text-edit.hpp"
|
||||||
|
#include "scene-selection.hpp"
|
||||||
#include "variable-line-edit.hpp"
|
#include "variable-line-edit.hpp"
|
||||||
|
#include "variable-text-edit.hpp"
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
@@ -35,24 +38,43 @@ public:
|
|||||||
SUBSTRING,
|
SUBSTRING,
|
||||||
FIND_AND_REPLACE,
|
FIND_AND_REPLACE,
|
||||||
MATH_EXPRESSION,
|
MATH_EXPRESSION,
|
||||||
|
USER_INPUT,
|
||||||
|
ENV_VARIABLE,
|
||||||
|
SCENE_ITEM_COUNT,
|
||||||
|
STRING_LENGTH,
|
||||||
|
EXTRACT_JSON,
|
||||||
|
SET_TO_TEMPVAR,
|
||||||
};
|
};
|
||||||
|
|
||||||
Type _type = Type::SET_FIXED_VALUE;
|
Type _type = Type::SET_FIXED_VALUE;
|
||||||
std::weak_ptr<Variable> _variable;
|
std::weak_ptr<Variable> _variable;
|
||||||
std::weak_ptr<Variable> _variable2;
|
std::weak_ptr<Variable> _variable2;
|
||||||
std::string _strValue = "";
|
StringVariable _strValue = "";
|
||||||
double _numValue = 0;
|
double _numValue = 0;
|
||||||
int _subStringStart = 0;
|
int _subStringStart = 0;
|
||||||
int _subStringSize = 0;
|
int _subStringSize = 0;
|
||||||
RegexConfig _regex = RegexConfig::PartialMatchRegexConfig();
|
RegexConfig _regex = RegexConfig::PartialMatchRegexConfig();
|
||||||
std::string _regexPattern = ".*";
|
std::string _regexPattern = ".*";
|
||||||
int _regexMatchIdx = 0;
|
int _regexMatchIdx = 0;
|
||||||
std::string _findStr = obs_module_text(
|
StringVariable _findStr = obs_module_text(
|
||||||
"AdvSceneSwitcher.action.variable.findAndReplace.find");
|
"AdvSceneSwitcher.action.variable.findAndReplace.find");
|
||||||
std::string _replaceStr = obs_module_text(
|
StringVariable _replaceStr = obs_module_text(
|
||||||
"AdvSceneSwitcher.action.variable.findAndReplace.replace");
|
"AdvSceneSwitcher.action.variable.findAndReplace.replace");
|
||||||
StringVariable _mathExpression = obs_module_text(
|
StringVariable _mathExpression = obs_module_text(
|
||||||
"AdvSceneSwitcher.action.variable.mathExpression.example");
|
"AdvSceneSwitcher.action.variable.mathExpression.example");
|
||||||
|
bool _useCustomPrompt = false;
|
||||||
|
StringVariable _inputPrompt = obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.variable.askForValuePrompt");
|
||||||
|
bool _useInputPlaceholder = false;
|
||||||
|
StringVariable _inputPlaceholder =
|
||||||
|
obs_module_text("AdvSceneSwitcher.enterText");
|
||||||
|
#ifdef _WIN32
|
||||||
|
StringVariable _envVariableName = "USERPROFILE";
|
||||||
|
#else
|
||||||
|
StringVariable _envVariableName = "HOME";
|
||||||
|
#endif
|
||||||
|
SceneSelection _scene;
|
||||||
|
TempVariableRef _tempVar;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DecrementCurrentSegmentVariableRef();
|
void DecrementCurrentSegmentVariableRef();
|
||||||
@@ -89,7 +111,7 @@ private slots:
|
|||||||
void ActionChanged(int);
|
void ActionChanged(int);
|
||||||
void StrValueChanged();
|
void StrValueChanged();
|
||||||
void NumValueChanged(double);
|
void NumValueChanged(double);
|
||||||
void SegmentIndexChanged(int val);
|
void SegmentIndexChanged(const IntVariable &);
|
||||||
void UpdateSegmentVariableValue();
|
void UpdateSegmentVariableValue();
|
||||||
void MacroSegmentOrderChanged();
|
void MacroSegmentOrderChanged();
|
||||||
void SubStringStartChanged(int val);
|
void SubStringStartChanged(int val);
|
||||||
@@ -100,17 +122,27 @@ private slots:
|
|||||||
void FindStrValueChanged();
|
void FindStrValueChanged();
|
||||||
void ReplaceStrValueChanged();
|
void ReplaceStrValueChanged();
|
||||||
void MathExpressionChanged();
|
void MathExpressionChanged();
|
||||||
|
void UseCustomPromptChanged(int);
|
||||||
|
void InputPromptChanged();
|
||||||
|
void UseInputPlaceholderChanged(int);
|
||||||
|
void InputPlaceholderChanged();
|
||||||
|
void EnvVariableChanged();
|
||||||
|
void SceneChanged(const SceneSelection &);
|
||||||
|
void SelectionChanged(const TempVariableRef &var);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
void SetSegmentValueError(const QString &);
|
||||||
|
|
||||||
VariableSelection *_variables;
|
VariableSelection *_variables;
|
||||||
VariableSelection *_variables2;
|
VariableSelection *_variables2;
|
||||||
QComboBox *_actions;
|
FilterComboBox *_actions;
|
||||||
ResizingPlainTextEdit *_strValue;
|
VariableTextEdit *_strValue;
|
||||||
QDoubleSpinBox *_numValue;
|
QDoubleSpinBox *_numValue;
|
||||||
QSpinBox *_segmentIdx;
|
MacroSegmentSelection *_segmentIdx;
|
||||||
QLabel *_segmentValueStatus;
|
QLabel *_segmentValueStatus;
|
||||||
ResizingPlainTextEdit *_segmentValue;
|
ResizingPlainTextEdit *_segmentValue;
|
||||||
QVBoxLayout *_substringLayout;
|
QVBoxLayout *_substringLayout;
|
||||||
@@ -122,17 +154,21 @@ protected:
|
|||||||
ResizingPlainTextEdit *_regexPattern;
|
ResizingPlainTextEdit *_regexPattern;
|
||||||
QSpinBox *_regexMatchIdx;
|
QSpinBox *_regexMatchIdx;
|
||||||
QHBoxLayout *_findReplaceLayout;
|
QHBoxLayout *_findReplaceLayout;
|
||||||
ResizingPlainTextEdit *_findStr;
|
VariableTextEdit *_findStr;
|
||||||
ResizingPlainTextEdit *_replaceStr;
|
VariableTextEdit *_replaceStr;
|
||||||
VariableLineEdit *_mathExpression;
|
VariableLineEdit *_mathExpression;
|
||||||
QLabel *_mathExpressionResult;
|
QLabel *_mathExpressionResult;
|
||||||
|
QHBoxLayout *_promptLayout;
|
||||||
|
QCheckBox *_useCustomPrompt;
|
||||||
|
VariableLineEdit *_inputPrompt;
|
||||||
|
QHBoxLayout *_placeholderLayout;
|
||||||
|
QCheckBox *_useInputPlaceholder;
|
||||||
|
VariableLineEdit *_inputPlaceholder;
|
||||||
|
VariableLineEdit *_envVariable;
|
||||||
|
SceneSelectionWidget *_scenes;
|
||||||
|
TempVariableSelection *_tempVars;
|
||||||
|
|
||||||
std::shared_ptr<MacroActionVariable> _entryData;
|
std::shared_ptr<MacroActionVariable> _entryData;
|
||||||
|
|
||||||
private:
|
|
||||||
void MarkSelectedSegment();
|
|
||||||
void SetWidgetVisibility();
|
|
||||||
void SetSegmentValueError(const QString &);
|
|
||||||
|
|
||||||
QTimer _timer;
|
QTimer _timer;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ bool MacroActionWait::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionWait::Create, MacroActionWaitEdit::Create,
|
{MacroActionWait::Create, MacroActionWaitEdit::Create,
|
||||||
"AdvSceneSwitcher.action.wait"});
|
"AdvSceneSwitcher.action.wait"});
|
||||||
|
|
||||||
static std::map<WaitType, std::string> waitTypes = {
|
const static std::map<WaitType, std::string> waitTypes = {
|
||||||
{WaitType::FIXED, "AdvSceneSwitcher.action.wait.type.fixed"},
|
{WaitType::FIXED, "AdvSceneSwitcher.action.wait.type.fixed"},
|
||||||
{WaitType::RANDOM, "AdvSceneSwitcher.action.wait.type.random"},
|
{WaitType::RANDOM, "AdvSceneSwitcher.action.wait.type.random"},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,47 +10,75 @@ bool MacroActionWebsocket::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionWebsocket::Create, MacroActionWebsocketEdit::Create,
|
{MacroActionWebsocket::Create, MacroActionWebsocketEdit::Create,
|
||||||
"AdvSceneSwitcher.action.websocket"});
|
"AdvSceneSwitcher.action.websocket"});
|
||||||
|
|
||||||
static std::map<MacroActionWebsocket::Type, std::string> actionTypes = {
|
const static std::map<MacroActionWebsocket::API, std::string> apiTypes = {
|
||||||
{MacroActionWebsocket::Type::REQUEST,
|
{MacroActionWebsocket::API::SCENE_SWITCHER,
|
||||||
"AdvSceneSwitcher.action.websocket.type.request"},
|
"AdvSceneSwitcher.action.websocket.api.sceneSwitcher"},
|
||||||
{MacroActionWebsocket::Type::EVENT,
|
{MacroActionWebsocket::API::OBS_WEBSOCKET,
|
||||||
"AdvSceneSwitcher.action.websocket.type.event"},
|
"AdvSceneSwitcher.action.websocket.api.obsWebsocket"},
|
||||||
|
{MacroActionWebsocket::API::GENERIC_WEBSOCKET,
|
||||||
|
"AdvSceneSwitcher.action.websocket.api.genericWebsocket"},
|
||||||
};
|
};
|
||||||
|
|
||||||
void MacroActionWebsocket::SendRequest()
|
const static std::map<MacroActionWebsocket::MessageType, std::string>
|
||||||
|
messageTypes = {
|
||||||
|
{MacroActionWebsocket::MessageType::REQUEST,
|
||||||
|
"AdvSceneSwitcher.action.websocket.type.request"},
|
||||||
|
{MacroActionWebsocket::MessageType::EVENT,
|
||||||
|
"AdvSceneSwitcher.action.websocket.type.event"},
|
||||||
|
};
|
||||||
|
|
||||||
|
void MacroActionWebsocket::SendRequest(const std::string &msg)
|
||||||
{
|
{
|
||||||
auto connection = _connection.lock();
|
auto connection = _connection.lock();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connection->SendMsg(_message);
|
|
||||||
|
connection->SendMsg(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionWebsocket::PerformAction()
|
bool MacroActionWebsocket::PerformAction()
|
||||||
{
|
{
|
||||||
switch (_type) {
|
if (_api != MacroActionWebsocket::API::SCENE_SWITCHER) {
|
||||||
case MacroActionWebsocket::Type::REQUEST:
|
SendRequest(_message);
|
||||||
SendRequest();
|
return true;
|
||||||
break;
|
|
||||||
case MacroActionWebsocket::Type::EVENT:
|
|
||||||
SendWebsocketEvent(_message);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_type == MacroActionWebsocket::MessageType::REQUEST) {
|
||||||
|
auto vendorRequest = ConstructVendorRequestMessage(_message);
|
||||||
|
SendRequest(vendorRequest);
|
||||||
|
} else {
|
||||||
|
SendWebsocketEvent(_message);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionWebsocket::LogAction() const
|
void MacroActionWebsocket::LogAction() const
|
||||||
{
|
{
|
||||||
|
if (_api == API::GENERIC_WEBSOCKET) {
|
||||||
|
vblog(LOG_INFO,
|
||||||
|
"sent generic websocket message \"%s\" via \"%s\"",
|
||||||
|
_message.c_str(),
|
||||||
|
GetWeakConnectionName(_connection).c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_api == API::OBS_WEBSOCKET) {
|
||||||
|
vblog(LOG_INFO, "sent obs websocket message \"%s\" via \"%s\"",
|
||||||
|
_message.c_str(),
|
||||||
|
GetWeakConnectionName(_connection).c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case MacroActionWebsocket::Type::REQUEST:
|
case MacroActionWebsocket::MessageType::REQUEST:
|
||||||
vblog(LOG_INFO, "sent msg \"%s\" via \"%s\"", _message.c_str(),
|
vblog(LOG_INFO, "sent scene switcher message \"%s\" via \"%s\"",
|
||||||
|
_message.c_str(),
|
||||||
GetWeakConnectionName(_connection).c_str());
|
GetWeakConnectionName(_connection).c_str());
|
||||||
break;
|
break;
|
||||||
case MacroActionWebsocket::Type::EVENT:
|
case MacroActionWebsocket::MessageType::EVENT:
|
||||||
vblog(LOG_INFO, "sent event \"%s\" to connected clients",
|
vblog(LOG_INFO,
|
||||||
|
"sent scene switcher event \"%s\" to connected clients",
|
||||||
_message.c_str());
|
_message.c_str());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -61,6 +89,7 @@ void MacroActionWebsocket::LogAction() const
|
|||||||
bool MacroActionWebsocket::Save(obs_data_t *obj) const
|
bool MacroActionWebsocket::Save(obs_data_t *obj) const
|
||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
|
obs_data_set_int(obj, "api", static_cast<int>(_api));
|
||||||
obs_data_set_int(obj, "type", static_cast<int>(_type));
|
obs_data_set_int(obj, "type", static_cast<int>(_type));
|
||||||
_message.Save(obj, "message");
|
_message.Save(obj, "message");
|
||||||
obs_data_set_string(obj, "connection",
|
obs_data_set_string(obj, "connection",
|
||||||
@@ -71,7 +100,8 @@ bool MacroActionWebsocket::Save(obs_data_t *obj) const
|
|||||||
bool MacroActionWebsocket::Load(obs_data_t *obj)
|
bool MacroActionWebsocket::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_type = static_cast<Type>(obs_data_get_int(obj, "type"));
|
_api = static_cast<API>(obs_data_get_int(obj, "api"));
|
||||||
|
_type = static_cast<MessageType>(obs_data_get_int(obj, "type"));
|
||||||
_message.Load(obj, "message");
|
_message.Load(obj, "message");
|
||||||
_connection =
|
_connection =
|
||||||
GetWeakConnectionByName(obs_data_get_string(obj, "connection"));
|
GetWeakConnectionByName(obs_data_get_string(obj, "connection"));
|
||||||
@@ -80,40 +110,54 @@ bool MacroActionWebsocket::Load(obs_data_t *obj)
|
|||||||
|
|
||||||
std::string MacroActionWebsocket::GetShortDesc() const
|
std::string MacroActionWebsocket::GetShortDesc() const
|
||||||
{
|
{
|
||||||
if (_type == Type::REQUEST) {
|
if (_type == MessageType::REQUEST) {
|
||||||
return GetWeakConnectionName(_connection);
|
return GetWeakConnectionName(_connection);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateAPISelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : actionTypes) {
|
for (const auto &[_, name] : apiTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(name.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void populateMessageTypeSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
for (const auto &[_, name] : messageTypes) {
|
||||||
|
list->addItem(obs_module_text(name.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroActionWebsocketEdit::MacroActionWebsocketEdit(
|
MacroActionWebsocketEdit::MacroActionWebsocketEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionWebsocket> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionWebsocket> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_actions(new QComboBox(this)),
|
_apiType(new QComboBox(this)),
|
||||||
|
_messageType(new QComboBox(this)),
|
||||||
_message(new VariableTextEdit(this)),
|
_message(new VariableTextEdit(this)),
|
||||||
_connection(new ConnectionSelection(this)),
|
_connection(new ConnectionSelection(this)),
|
||||||
_editLayout(new QHBoxLayout())
|
_editLayout(new QHBoxLayout()),
|
||||||
|
_settingsConflict(new QLabel())
|
||||||
{
|
{
|
||||||
populateActionSelection(_actions);
|
populateAPISelection(_apiType);
|
||||||
|
populateMessageTypeSelection(_messageType);
|
||||||
|
_settingsConflict->setWordWrap(true);
|
||||||
|
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_apiType, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ActionChanged(int)));
|
SLOT(APITypeChanged(int)));
|
||||||
|
QWidget::connect(_messageType, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(MessageTypeChanged(int)));
|
||||||
QWidget::connect(_message, SIGNAL(textChanged()), this,
|
QWidget::connect(_message, SIGNAL(textChanged()), this,
|
||||||
SLOT(MessageChanged()));
|
SLOT(MessageChanged()));
|
||||||
QWidget::connect(_connection, SIGNAL(SelectionChanged(const QString &)),
|
QWidget::connect(_connection, SIGNAL(SelectionChanged(const QString &)),
|
||||||
this,
|
this,
|
||||||
SLOT(ConnectionSelectionChanged(const QString &)));
|
SLOT(ConnectionSelectionChanged(const QString &)));
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
auto mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(_editLayout);
|
mainLayout->addLayout(_editLayout);
|
||||||
mainLayout->addWidget(_message);
|
mainLayout->addWidget(_message);
|
||||||
|
mainLayout->addWidget(_settingsConflict);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
@@ -121,34 +165,111 @@ MacroActionWebsocketEdit::MacroActionWebsocketEdit(
|
|||||||
_loading = false;
|
_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionWebsocketEdit::CheckForSettingsConflict()
|
||||||
|
{
|
||||||
|
auto connection = _entryData->_connection.lock();
|
||||||
|
if (!connection) {
|
||||||
|
_settingsConflict->hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_entryData->_api == MacroActionWebsocket::API::GENERIC_WEBSOCKET &&
|
||||||
|
connection->IsUsingOBSProtocol()) {
|
||||||
|
_settingsConflict->show();
|
||||||
|
_settingsConflict->setText(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.websocket.settingsConflictGeneric"));
|
||||||
|
} else if (_entryData->_api !=
|
||||||
|
MacroActionWebsocket::API::GENERIC_WEBSOCKET &&
|
||||||
|
!connection->IsUsingOBSProtocol()) {
|
||||||
|
_settingsConflict->show();
|
||||||
|
_settingsConflict->setText(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.websocket.settingsConflictOBS"));
|
||||||
|
} else {
|
||||||
|
_settingsConflict->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionWebsocketEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
_messageType->setVisible(_entryData->_api ==
|
||||||
|
MacroActionWebsocket::API::SCENE_SWITCHER);
|
||||||
|
switch (_entryData->_api) {
|
||||||
|
case MacroActionWebsocket::API::SCENE_SWITCHER:
|
||||||
|
if (_entryData->_type ==
|
||||||
|
MacroActionWebsocket::MessageType::REQUEST) {
|
||||||
|
SetupRequestEdit();
|
||||||
|
} else {
|
||||||
|
SetupEventEdit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MacroActionWebsocket::API::OBS_WEBSOCKET:
|
||||||
|
case MacroActionWebsocket::API::GENERIC_WEBSOCKET:
|
||||||
|
SetupGenericEdit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckForSettingsConflict();
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
void MacroActionWebsocketEdit::SetupRequestEdit()
|
void MacroActionWebsocketEdit::SetupRequestEdit()
|
||||||
{
|
{
|
||||||
_editLayout->removeWidget(_actions);
|
ClearWidgets();
|
||||||
_editLayout->removeWidget(_connection);
|
PlaceWidgets(
|
||||||
ClearLayout(_editLayout);
|
obs_module_text(
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
"AdvSceneSwitcher.action.websocket.entry.sceneSwitcher.request"),
|
||||||
{"{{type}}", _actions},
|
_editLayout,
|
||||||
{"{{connection}}", _connection},
|
{{"{{api}}", _apiType},
|
||||||
};
|
{"{{type}}", _messageType},
|
||||||
PlaceWidgets(obs_module_text(
|
{"{{connection}}", _connection}});
|
||||||
"AdvSceneSwitcher.action.websocket.entry.request"),
|
|
||||||
_editLayout, widgetPlaceholders);
|
|
||||||
_connection->show();
|
_connection->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionWebsocketEdit::SetupEventEdit()
|
void MacroActionWebsocketEdit::SetupEventEdit()
|
||||||
{
|
{
|
||||||
_editLayout->removeWidget(_actions);
|
ClearWidgets();
|
||||||
|
PlaceWidgets(
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.websocket.entry.sceneSwitcher.event"),
|
||||||
|
_editLayout,
|
||||||
|
{{"{{api}}", _apiType},
|
||||||
|
{"{{type}}", _messageType},
|
||||||
|
{"{{connection}}", _connection}});
|
||||||
|
|
||||||
|
// Add widget to layout but hide it
|
||||||
|
_editLayout->addWidget(_connection);
|
||||||
|
_connection->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionWebsocketEdit::SetupGenericEdit()
|
||||||
|
{
|
||||||
|
ClearWidgets();
|
||||||
|
PlaceWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.websocket.entry.generic"),
|
||||||
|
_editLayout,
|
||||||
|
{{"{{api}}", _apiType},
|
||||||
|
{"{{type}}", _messageType},
|
||||||
|
{"{{connection}}", _connection}});
|
||||||
|
_connection->show();
|
||||||
|
|
||||||
|
// Add widget to layout but hide it
|
||||||
|
_editLayout->addWidget(_messageType);
|
||||||
|
_messageType->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionWebsocketEdit::ClearWidgets()
|
||||||
|
{
|
||||||
|
_editLayout->removeWidget(_apiType);
|
||||||
|
_editLayout->removeWidget(_messageType);
|
||||||
_editLayout->removeWidget(_connection);
|
_editLayout->removeWidget(_connection);
|
||||||
ClearLayout(_editLayout);
|
ClearLayout(_editLayout);
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
|
||||||
{"{{type}}", _actions},
|
|
||||||
{"{{connection}}", _connection},
|
|
||||||
};
|
|
||||||
PlaceWidgets(obs_module_text(
|
|
||||||
"AdvSceneSwitcher.action.websocket.entry.event"),
|
|
||||||
_editLayout, widgetPlaceholders);
|
|
||||||
_connection->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionWebsocketEdit::UpdateEntryData()
|
void MacroActionWebsocketEdit::UpdateEntryData()
|
||||||
@@ -157,33 +278,37 @@ void MacroActionWebsocketEdit::UpdateEntryData()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_type));
|
_apiType->setCurrentIndex(static_cast<int>(_entryData->_api));
|
||||||
|
_messageType->setCurrentIndex(static_cast<int>(_entryData->_type));
|
||||||
_message->setPlainText(_entryData->_message);
|
_message->setPlainText(_entryData->_message);
|
||||||
_connection->SetConnection(_entryData->_connection);
|
_connection->SetConnection(_entryData->_connection);
|
||||||
|
|
||||||
if (_entryData->_type == MacroActionWebsocket::Type::REQUEST) {
|
SetWidgetVisibility();
|
||||||
SetupRequestEdit();
|
|
||||||
} else {
|
|
||||||
SetupEventEdit();
|
|
||||||
}
|
|
||||||
|
|
||||||
adjustSize();
|
|
||||||
updateGeometry();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionWebsocketEdit::ActionChanged(int index)
|
void MacroActionWebsocketEdit::APITypeChanged(int index)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_type = static_cast<MacroActionWebsocket::Type>(index);
|
_entryData->_api = static_cast<MacroActionWebsocket::API>(index);
|
||||||
if (_entryData->_type == MacroActionWebsocket::Type::REQUEST) {
|
SetWidgetVisibility();
|
||||||
SetupRequestEdit();
|
emit HeaderInfoChanged(
|
||||||
} else {
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
SetupEventEdit();
|
}
|
||||||
|
|
||||||
|
void MacroActionWebsocketEdit::MessageTypeChanged(int index)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_type =
|
||||||
|
static_cast<MacroActionWebsocket::MessageType>(index);
|
||||||
|
SetWidgetVisibility();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
@@ -210,6 +335,7 @@ void MacroActionWebsocketEdit::ConnectionSelectionChanged(
|
|||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_connection = GetWeakConnectionByQString(connection);
|
_entryData->_connection = GetWeakConnectionByQString(connection);
|
||||||
|
CheckForSettingsConflict();
|
||||||
emit(HeaderInfoChanged(connection));
|
emit(HeaderInfoChanged(connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,17 +24,24 @@ public:
|
|||||||
return std::make_shared<MacroActionWebsocket>(m);
|
return std::make_shared<MacroActionWebsocket>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Type {
|
enum class API {
|
||||||
|
SCENE_SWITCHER,
|
||||||
|
OBS_WEBSOCKET,
|
||||||
|
GENERIC_WEBSOCKET,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class MessageType {
|
||||||
REQUEST,
|
REQUEST,
|
||||||
EVENT,
|
EVENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
Type _type = Type::REQUEST;
|
API _api = API::SCENE_SWITCHER;
|
||||||
|
MessageType _type = MessageType::REQUEST;
|
||||||
StringVariable _message = obs_module_text("AdvSceneSwitcher.enterText");
|
StringVariable _message = obs_module_text("AdvSceneSwitcher.enterText");
|
||||||
std::weak_ptr<Connection> _connection;
|
std::weak_ptr<Connection> _connection;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SendRequest();
|
void SendRequest(const std::string &msg);
|
||||||
|
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
static const std::string id;
|
static const std::string id;
|
||||||
@@ -57,7 +64,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ActionChanged(int);
|
void APITypeChanged(int);
|
||||||
|
void MessageTypeChanged(int);
|
||||||
void MessageChanged();
|
void MessageChanged();
|
||||||
void ConnectionSelectionChanged(const QString &);
|
void ConnectionSelectionChanged(const QString &);
|
||||||
signals:
|
signals:
|
||||||
@@ -67,13 +75,20 @@ protected:
|
|||||||
std::shared_ptr<MacroActionWebsocket> _entryData;
|
std::shared_ptr<MacroActionWebsocket> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void CheckForSettingsConflict();
|
||||||
|
void SetWidgetVisibility();
|
||||||
void SetupRequestEdit();
|
void SetupRequestEdit();
|
||||||
void SetupEventEdit();
|
void SetupEventEdit();
|
||||||
|
void SetupGenericEdit();
|
||||||
|
void ClearWidgets();
|
||||||
|
|
||||||
QComboBox *_actions;
|
QComboBox *_apiType;
|
||||||
|
QComboBox *_messageType;
|
||||||
VariableTextEdit *_message;
|
VariableTextEdit *_message;
|
||||||
ConnectionSelection *_connection;
|
ConnectionSelection *_connection;
|
||||||
QHBoxLayout *_editLayout;
|
QHBoxLayout *_editLayout;
|
||||||
|
QLabel *_settingsConflict;
|
||||||
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,15 @@ bool MacroAction::Save(obs_data_t *obj) const
|
|||||||
{
|
{
|
||||||
MacroSegment::Save(obj);
|
MacroSegment::Save(obj);
|
||||||
obs_data_set_string(obj, "id", GetId().c_str());
|
obs_data_set_string(obj, "id", GetId().c_str());
|
||||||
|
obs_data_set_bool(obj, "enabled", _enabled);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroAction::Load(obs_data_t *obj)
|
bool MacroAction::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
MacroSegment::Load(obj);
|
MacroSegment::Load(obj);
|
||||||
|
obs_data_set_default_bool(obj, "enabled", true);
|
||||||
|
_enabled = obs_data_get_bool(obj, "enabled");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +28,16 @@ void MacroAction::LogAction() const
|
|||||||
vblog(LOG_INFO, "performed action %s", GetId().c_str());
|
vblog(LOG_INFO, "performed action %s", GetId().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroAction::SetEnabled(bool value)
|
||||||
|
{
|
||||||
|
_enabled = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroAction::Enabled() const
|
||||||
|
{
|
||||||
|
return _enabled;
|
||||||
|
}
|
||||||
|
|
||||||
MacroRefAction::MacroRefAction(Macro *m, bool supportsVariableValue)
|
MacroRefAction::MacroRefAction(Macro *m, bool supportsVariableValue)
|
||||||
: MacroAction(m, supportsVariableValue)
|
: MacroAction(m, supportsVariableValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ public:
|
|||||||
virtual bool Save(obs_data_t *obj) const = 0;
|
virtual bool Save(obs_data_t *obj) const = 0;
|
||||||
virtual bool Load(obs_data_t *obj) = 0;
|
virtual bool Load(obs_data_t *obj) = 0;
|
||||||
virtual void LogAction() const;
|
virtual void LogAction() const;
|
||||||
|
void SetEnabled(bool);
|
||||||
|
bool Enabled() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _enabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroRefAction : virtual public MacroAction {
|
class MacroRefAction : virtual public MacroAction {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ bool MacroConditionAudio::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionAudio::Create, MacroConditionAudioEdit::Create,
|
{MacroConditionAudio::Create, MacroConditionAudioEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.audio"});
|
"AdvSceneSwitcher.condition.audio"});
|
||||||
|
|
||||||
static std::map<MacroConditionAudio::Type, std::string> checkTypes = {
|
const static std::map<MacroConditionAudio::Type, std::string> checkTypes = {
|
||||||
{MacroConditionAudio::Type::OUTPUT_VOLUME,
|
{MacroConditionAudio::Type::OUTPUT_VOLUME,
|
||||||
"AdvSceneSwitcher.condition.audio.type.output"},
|
"AdvSceneSwitcher.condition.audio.type.output"},
|
||||||
{MacroConditionAudio::Type::CONFIGURED_VOLUME,
|
{MacroConditionAudio::Type::CONFIGURED_VOLUME,
|
||||||
@@ -25,7 +25,7 @@ static std::map<MacroConditionAudio::Type, std::string> checkTypes = {
|
|||||||
"AdvSceneSwitcher.condition.audio.type.balance"},
|
"AdvSceneSwitcher.condition.audio.type.balance"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<MacroConditionAudio::OutputCondition, std::string>
|
const static std::map<MacroConditionAudio::OutputCondition, std::string>
|
||||||
audioOutputConditionTypes = {
|
audioOutputConditionTypes = {
|
||||||
{MacroConditionAudio::OutputCondition::ABOVE,
|
{MacroConditionAudio::OutputCondition::ABOVE,
|
||||||
"AdvSceneSwitcher.condition.audio.state.above"},
|
"AdvSceneSwitcher.condition.audio.state.above"},
|
||||||
@@ -33,7 +33,7 @@ static std::map<MacroConditionAudio::OutputCondition, std::string>
|
|||||||
"AdvSceneSwitcher.condition.audio.state.below"},
|
"AdvSceneSwitcher.condition.audio.state.below"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<MacroConditionAudio::VolumeCondition, std::string>
|
const static std::map<MacroConditionAudio::VolumeCondition, std::string>
|
||||||
audioVolumeConditionTypes = {
|
audioVolumeConditionTypes = {
|
||||||
{MacroConditionAudio::VolumeCondition::ABOVE,
|
{MacroConditionAudio::VolumeCondition::ABOVE,
|
||||||
"AdvSceneSwitcher.condition.audio.state.above"},
|
"AdvSceneSwitcher.condition.audio.state.above"},
|
||||||
@@ -47,6 +47,12 @@ static std::map<MacroConditionAudio::VolumeCondition, std::string>
|
|||||||
"AdvSceneSwitcher.condition.audio.state.unmute"},
|
"AdvSceneSwitcher.condition.audio.state.unmute"},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void MacroConditionAudio::SetType(const Type &type)
|
||||||
|
{
|
||||||
|
_checkType = type;
|
||||||
|
SetupTempVars();
|
||||||
|
}
|
||||||
|
|
||||||
MacroConditionAudio::~MacroConditionAudio()
|
MacroConditionAudio::~MacroConditionAudio()
|
||||||
{
|
{
|
||||||
obs_volmeter_remove_callback(_volmeter, SetVolumeLevel, this);
|
obs_volmeter_remove_callback(_volmeter, SetVolumeLevel, this);
|
||||||
@@ -74,6 +80,7 @@ bool MacroConditionAudio::CheckOutputCondition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetVariableValue(std::to_string(curVolume));
|
SetVariableValue(std::to_string(curVolume));
|
||||||
|
SetTempVarValue("output_volume", std::to_string(curVolume));
|
||||||
|
|
||||||
// Reset for next check
|
// Reset for next check
|
||||||
_peak = -std::numeric_limits<float>::infinity();
|
_peak = -std::numeric_limits<float>::infinity();
|
||||||
@@ -118,6 +125,9 @@ bool MacroConditionAudio::CheckVolumeCondition()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetTempVarValue("configured_volume", std::to_string(curVolume));
|
||||||
|
SetTempVarValue("muted", muted ? "true" : "false");
|
||||||
|
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -137,6 +147,7 @@ bool MacroConditionAudio::CheckSyncOffset()
|
|||||||
ret = curOffset < _syncOffset;
|
ret = curOffset < _syncOffset;
|
||||||
}
|
}
|
||||||
SetVariableValue(std::to_string(curOffset));
|
SetVariableValue(std::to_string(curOffset));
|
||||||
|
SetTempVarValue("sync_offset", std::to_string(curOffset));
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -151,6 +162,8 @@ bool MacroConditionAudio::CheckMonitor()
|
|||||||
auto s = obs_weak_source_get_source(_audioSource.GetSource());
|
auto s = obs_weak_source_get_source(_audioSource.GetSource());
|
||||||
ret = obs_source_get_monitoring_type(s) == _monitorType;
|
ret = obs_source_get_monitoring_type(s) == _monitorType;
|
||||||
SetVariableValue("");
|
SetVariableValue("");
|
||||||
|
SetTempVarValue("monitor",
|
||||||
|
std::to_string(obs_source_get_monitoring_type(s)));
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -170,6 +183,7 @@ bool MacroConditionAudio::CheckBalance()
|
|||||||
ret = curBalance < _balance;
|
ret = curBalance < _balance;
|
||||||
}
|
}
|
||||||
SetVariableValue(std::to_string(curBalance));
|
SetVariableValue(std::to_string(curBalance));
|
||||||
|
SetTempVarValue("balance", std::to_string(curBalance));
|
||||||
obs_source_release(s);
|
obs_source_release(s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -290,6 +304,50 @@ void MacroConditionAudio::ResetVolmeter()
|
|||||||
_volmeter = AddVolmeterToSource(this, _audioSource.GetSource());
|
_volmeter = AddVolmeterToSource(this, _audioSource.GetSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroConditionAudio::SetupTempVars()
|
||||||
|
{
|
||||||
|
MacroCondition::SetupTempVars();
|
||||||
|
switch (_checkType) {
|
||||||
|
case Type::OUTPUT_VOLUME:
|
||||||
|
AddTempvar(
|
||||||
|
"output_volume",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.output_volume"),
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.output_volume.description"));
|
||||||
|
break;
|
||||||
|
case Type::CONFIGURED_VOLUME:
|
||||||
|
AddTempvar(
|
||||||
|
"configured_volume",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.configured_volume"),
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.configured_volume.description"));
|
||||||
|
AddTempvar("muted",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.muted"));
|
||||||
|
break;
|
||||||
|
case Type::SYNC_OFFSET:
|
||||||
|
AddTempvar(
|
||||||
|
"sync_offset",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.sync_offset"));
|
||||||
|
break;
|
||||||
|
case Type::MONITOR:
|
||||||
|
AddTempvar("monitor",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.monitor"));
|
||||||
|
break;
|
||||||
|
case Type::BALANCE:
|
||||||
|
AddTempvar("balance",
|
||||||
|
obs_module_text(
|
||||||
|
"AdvSceneSwitcher.tempVar.audio.balance"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void populateCheckTypes(QComboBox *list)
|
static inline void populateCheckTypes(QComboBox *list)
|
||||||
{
|
{
|
||||||
list->clear();
|
list->clear();
|
||||||
@@ -479,10 +537,9 @@ void MacroConditionAudioEdit::ConditionChanged(int cond)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
if (_entryData->_checkType ==
|
if (_entryData->GetType() == MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
||||||
MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
_entryData->GetType() == MacroConditionAudio::Type::BALANCE ||
|
||||||
_entryData->_checkType == MacroConditionAudio::Type::BALANCE ||
|
_entryData->GetType() == MacroConditionAudio::Type::SYNC_OFFSET) {
|
||||||
_entryData->_checkType == MacroConditionAudio::Type::SYNC_OFFSET) {
|
|
||||||
_entryData->_outputCondition =
|
_entryData->_outputCondition =
|
||||||
static_cast<MacroConditionAudio::OutputCondition>(cond);
|
static_cast<MacroConditionAudio::OutputCondition>(cond);
|
||||||
} else {
|
} else {
|
||||||
@@ -499,16 +556,15 @@ void MacroConditionAudioEdit::CheckTypeChanged(int idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_checkType = static_cast<MacroConditionAudio::Type>(
|
_entryData->SetType(static_cast<MacroConditionAudio::Type>(
|
||||||
_checkTypes->itemData(idx).toInt());
|
_checkTypes->itemData(idx).toInt()));
|
||||||
|
|
||||||
const QSignalBlocker b(_condition);
|
const QSignalBlocker b(_condition);
|
||||||
if (_entryData->_checkType ==
|
if (_entryData->GetType() == MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
||||||
MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
_entryData->GetType() == MacroConditionAudio::Type::BALANCE ||
|
||||||
_entryData->_checkType == MacroConditionAudio::Type::BALANCE ||
|
_entryData->GetType() == MacroConditionAudio::Type::SYNC_OFFSET) {
|
||||||
_entryData->_checkType == MacroConditionAudio::Type::SYNC_OFFSET) {
|
|
||||||
populateOutputConditionSelection(_condition);
|
populateOutputConditionSelection(_condition);
|
||||||
} else if (_entryData->_checkType ==
|
} else if (_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::CONFIGURED_VOLUME) {
|
MacroConditionAudio::Type::CONFIGURED_VOLUME) {
|
||||||
populateVolumeConditionSelection(_condition);
|
populateVolumeConditionSelection(_condition);
|
||||||
}
|
}
|
||||||
@@ -526,17 +582,16 @@ void MacroConditionAudioEdit::UpdateEntryData()
|
|||||||
_syncOffset->SetValue(_entryData->_syncOffset);
|
_syncOffset->SetValue(_entryData->_syncOffset);
|
||||||
_monitorTypes->setCurrentIndex(_entryData->_monitorType);
|
_monitorTypes->setCurrentIndex(_entryData->_monitorType);
|
||||||
_balance->SetDoubleValue(_entryData->_balance);
|
_balance->SetDoubleValue(_entryData->_balance);
|
||||||
_checkTypes->setCurrentIndex(_checkTypes->findData(
|
_checkTypes->setCurrentIndex(
|
||||||
static_cast<int>(_entryData->_checkType)));
|
_checkTypes->findData(static_cast<int>(_entryData->GetType())));
|
||||||
|
|
||||||
if (_entryData->_checkType ==
|
if (_entryData->GetType() == MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
||||||
MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
_entryData->GetType() == MacroConditionAudio::Type::BALANCE ||
|
||||||
_entryData->_checkType == MacroConditionAudio::Type::BALANCE ||
|
_entryData->GetType() == MacroConditionAudio::Type::SYNC_OFFSET) {
|
||||||
_entryData->_checkType == MacroConditionAudio::Type::SYNC_OFFSET) {
|
|
||||||
populateOutputConditionSelection(_condition);
|
populateOutputConditionSelection(_condition);
|
||||||
_condition->setCurrentIndex(
|
_condition->setCurrentIndex(
|
||||||
static_cast<int>(_entryData->_outputCondition));
|
static_cast<int>(_entryData->_outputCondition));
|
||||||
} else if (_entryData->_checkType ==
|
} else if (_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::CONFIGURED_VOLUME) {
|
MacroConditionAudio::Type::CONFIGURED_VOLUME) {
|
||||||
populateVolumeConditionSelection(_condition);
|
populateVolumeConditionSelection(_condition);
|
||||||
_condition->setCurrentIndex(
|
_condition->setCurrentIndex(
|
||||||
@@ -554,9 +609,9 @@ void MacroConditionAudioEdit::SetWidgetVisibility()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_volume->setVisible(
|
_volume->setVisible(
|
||||||
_entryData->_checkType ==
|
_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
||||||
(_entryData->_checkType ==
|
(_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::CONFIGURED_VOLUME &&
|
MacroConditionAudio::Type::CONFIGURED_VOLUME &&
|
||||||
(_entryData->_volumeCondition ==
|
(_entryData->_volumeCondition ==
|
||||||
MacroConditionAudio::VolumeCondition::ABOVE ||
|
MacroConditionAudio::VolumeCondition::ABOVE ||
|
||||||
@@ -565,20 +620,20 @@ void MacroConditionAudioEdit::SetWidgetVisibility()
|
|||||||
_entryData->_volumeCondition ==
|
_entryData->_volumeCondition ==
|
||||||
MacroConditionAudio::VolumeCondition::BELOW)));
|
MacroConditionAudio::VolumeCondition::BELOW)));
|
||||||
_condition->setVisible(
|
_condition->setVisible(
|
||||||
_entryData->_checkType ==
|
_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
MacroConditionAudio::Type::OUTPUT_VOLUME ||
|
||||||
_entryData->_checkType ==
|
_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::CONFIGURED_VOLUME ||
|
MacroConditionAudio::Type::CONFIGURED_VOLUME ||
|
||||||
_entryData->_checkType == MacroConditionAudio::Type::BALANCE ||
|
_entryData->GetType() == MacroConditionAudio::Type::BALANCE ||
|
||||||
_entryData->_checkType ==
|
_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::SYNC_OFFSET);
|
MacroConditionAudio::Type::SYNC_OFFSET);
|
||||||
_syncOffset->setVisible(_entryData->_checkType ==
|
_syncOffset->setVisible(_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::SYNC_OFFSET);
|
MacroConditionAudio::Type::SYNC_OFFSET);
|
||||||
_monitorTypes->setVisible(_entryData->_checkType ==
|
_monitorTypes->setVisible(_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::MONITOR);
|
MacroConditionAudio::Type::MONITOR);
|
||||||
_balance->setVisible(_entryData->_checkType ==
|
_balance->setVisible(_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::BALANCE);
|
MacroConditionAudio::Type::BALANCE);
|
||||||
_volMeter->setVisible(_entryData->_checkType ==
|
_volMeter->setVisible(_entryData->GetType() ==
|
||||||
MacroConditionAudio::Type::OUTPUT_VOLUME);
|
MacroConditionAudio::Type::OUTPUT_VOLUME);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public:
|
|||||||
MONITOR,
|
MONITOR,
|
||||||
BALANCE,
|
BALANCE,
|
||||||
};
|
};
|
||||||
|
void SetType(const Type &);
|
||||||
|
Type GetType() const { return _checkType; }
|
||||||
|
|
||||||
enum class OutputCondition {
|
enum class OutputCondition {
|
||||||
ABOVE,
|
ABOVE,
|
||||||
@@ -56,7 +58,6 @@ public:
|
|||||||
NumberVariable<int> _syncOffset = 0;
|
NumberVariable<int> _syncOffset = 0;
|
||||||
obs_monitoring_type _monitorType = OBS_MONITORING_TYPE_NONE;
|
obs_monitoring_type _monitorType = OBS_MONITORING_TYPE_NONE;
|
||||||
NumberVariable<double> _balance = 0.5;
|
NumberVariable<double> _balance = 0.5;
|
||||||
Type _checkType = Type::OUTPUT_VOLUME;
|
|
||||||
OutputCondition _outputCondition = OutputCondition::ABOVE;
|
OutputCondition _outputCondition = OutputCondition::ABOVE;
|
||||||
VolumeCondition _volumeCondition = VolumeCondition::ABOVE;
|
VolumeCondition _volumeCondition = VolumeCondition::ABOVE;
|
||||||
obs_volmeter_t *_volmeter = nullptr;
|
obs_volmeter_t *_volmeter = nullptr;
|
||||||
@@ -67,7 +68,9 @@ private:
|
|||||||
bool CheckSyncOffset();
|
bool CheckSyncOffset();
|
||||||
bool CheckMonitor();
|
bool CheckMonitor();
|
||||||
bool CheckBalance();
|
bool CheckBalance();
|
||||||
|
void SetupTempVars();
|
||||||
|
|
||||||
|
Type _checkType = Type::OUTPUT_VOLUME;
|
||||||
float _peak = -std::numeric_limits<float>::infinity();
|
float _peak = -std::numeric_limits<float>::infinity();
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
static const std::string id;
|
static const std::string id;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ bool MacroConditionCursor::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionCursor::Create, MacroConditionCursorEdit::Create,
|
{MacroConditionCursor::Create, MacroConditionCursorEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.cursor"});
|
"AdvSceneSwitcher.condition.cursor"});
|
||||||
|
|
||||||
static std::map<MacroConditionCursor::Condition, std::string>
|
const static std::map<MacroConditionCursor::Condition, std::string>
|
||||||
cursorConditionTypes = {
|
cursorConditionTypes = {
|
||||||
{MacroConditionCursor::Condition::REGION,
|
{MacroConditionCursor::Condition::REGION,
|
||||||
"AdvSceneSwitcher.condition.cursor.type.region"},
|
"AdvSceneSwitcher.condition.cursor.type.region"},
|
||||||
@@ -27,7 +27,7 @@ static std::map<MacroConditionCursor::Condition, std::string>
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<MacroConditionCursor::Button, std::string> buttonTypes = {
|
const static std::map<MacroConditionCursor::Button, std::string> buttonTypes = {
|
||||||
{MacroConditionCursor::Button::LEFT,
|
{MacroConditionCursor::Button::LEFT,
|
||||||
"AdvSceneSwitcher.condition.cursor.button.left"},
|
"AdvSceneSwitcher.condition.cursor.button.left"},
|
||||||
{MacroConditionCursor::Button::MIDDLE,
|
{MacroConditionCursor::Button::MIDDLE,
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ bool MacroConditionDate::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionDate::Create, MacroConditionDateEdit::Create,
|
{MacroConditionDate::Create, MacroConditionDateEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.date", false});
|
"AdvSceneSwitcher.condition.date", false});
|
||||||
|
|
||||||
static std::map<MacroConditionDate::Condition, std::string> dateConditionTypes =
|
const static std::map<MacroConditionDate::Condition, std::string>
|
||||||
{
|
dateConditionTypes = {
|
||||||
{MacroConditionDate::Condition::AT,
|
{MacroConditionDate::Condition::AT,
|
||||||
"AdvSceneSwitcher.condition.date.state.at"},
|
"AdvSceneSwitcher.condition.date.state.at"},
|
||||||
{MacroConditionDate::Condition::AFTER,
|
{MacroConditionDate::Condition::AFTER,
|
||||||
@@ -28,8 +28,8 @@ static std::map<MacroConditionDate::Condition, std::string> dateConditionTypes =
|
|||||||
"AdvSceneSwitcher.condition.date.state.pattern"},
|
"AdvSceneSwitcher.condition.date.state.pattern"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<MacroConditionDate::Condition, std::string> weekConditionTypes =
|
const static std::map<MacroConditionDate::Condition, std::string>
|
||||||
{
|
weekConditionTypes = {
|
||||||
{MacroConditionDate::Condition::AT,
|
{MacroConditionDate::Condition::AT,
|
||||||
"AdvSceneSwitcher.condition.date.state.at"},
|
"AdvSceneSwitcher.condition.date.state.at"},
|
||||||
{MacroConditionDate::Condition::AFTER,
|
{MacroConditionDate::Condition::AFTER,
|
||||||
@@ -38,7 +38,7 @@ static std::map<MacroConditionDate::Condition, std::string> weekConditionTypes =
|
|||||||
"AdvSceneSwitcher.condition.date.state.before"},
|
"AdvSceneSwitcher.condition.date.state.before"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<MacroConditionDate::Day, std::string> dayOfWeekNames = {
|
const static std::map<MacroConditionDate::Day, std::string> dayOfWeekNames = {
|
||||||
{MacroConditionDate::Day::ANY,
|
{MacroConditionDate::Day::ANY,
|
||||||
"AdvSceneSwitcher.condition.date.anyDay"},
|
"AdvSceneSwitcher.condition.date.anyDay"},
|
||||||
{MacroConditionDate::Day::MONDAY,
|
{MacroConditionDate::Day::MONDAY,
|
||||||
@@ -60,7 +60,8 @@ static std::map<MacroConditionDate::Day, std::string> dayOfWeekNames = {
|
|||||||
bool MacroConditionDate::CheckDayOfWeek(int64_t msSinceLastCheck)
|
bool MacroConditionDate::CheckDayOfWeek(int64_t msSinceLastCheck)
|
||||||
{
|
{
|
||||||
QDateTime cur = QDateTime::currentDateTime();
|
QDateTime cur = QDateTime::currentDateTime();
|
||||||
SetVariableValue(cur.toString().toStdString());
|
SetVariables(cur);
|
||||||
|
|
||||||
if (_dayOfWeek != Day::ANY &&
|
if (_dayOfWeek != Day::ANY &&
|
||||||
cur.date().dayOfWeek() != static_cast<int>(_dayOfWeek)) {
|
cur.date().dayOfWeek() != static_cast<int>(_dayOfWeek)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -133,7 +134,7 @@ bool MacroConditionDate::CheckRegularDate(int64_t msSinceLastCheck)
|
|||||||
{
|
{
|
||||||
bool match = false;
|
bool match = false;
|
||||||
QDateTime cur = QDateTime::currentDateTime();
|
QDateTime cur = QDateTime::currentDateTime();
|
||||||
SetVariableValue(cur.toString().toStdString());
|
SetVariables(cur);
|
||||||
|
|
||||||
if (_ignoreDate) {
|
if (_ignoreDate) {
|
||||||
_dateTime.setDate(cur.date());
|
_dateTime.setDate(cur.date());
|
||||||
@@ -304,6 +305,37 @@ QDateTime MacroConditionDate::GetNextMatchDateTime() const
|
|||||||
return _dateTime;
|
return _dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroConditionDate::SetVariables(const QDateTime &date)
|
||||||
|
{
|
||||||
|
SetVariableValue(date.toString().toStdString());
|
||||||
|
|
||||||
|
SetTempVarValue("year", std::to_string(date.date().year()));
|
||||||
|
SetTempVarValue("month", std::to_string(date.date().month()));
|
||||||
|
SetTempVarValue("day", std::to_string(date.date().day()));
|
||||||
|
SetTempVarValue("hour", std::to_string(date.time().hour()));
|
||||||
|
SetTempVarValue("minute", std::to_string(date.time().minute()));
|
||||||
|
SetTempVarValue("second", std::to_string(date.time().second()));
|
||||||
|
SetTempVarValue("dayOfWeek", std::to_string(date.date().dayOfWeek()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionDate::SetupTempVars()
|
||||||
|
{
|
||||||
|
MacroCondition::SetupTempVars();
|
||||||
|
AddTempvar("year",
|
||||||
|
obs_module_text("AdvSceneSwitcher.tempVar.date.year"));
|
||||||
|
AddTempvar("month",
|
||||||
|
obs_module_text("AdvSceneSwitcher.tempVar.date.month"));
|
||||||
|
AddTempvar("day", obs_module_text("AdvSceneSwitcher.tempVar.date.day"));
|
||||||
|
AddTempvar("hour",
|
||||||
|
obs_module_text("AdvSceneSwitcher.tempVar.date.hour"));
|
||||||
|
AddTempvar("minute",
|
||||||
|
obs_module_text("AdvSceneSwitcher.tempVar.date.minute"));
|
||||||
|
AddTempvar("second",
|
||||||
|
obs_module_text("AdvSceneSwitcher.tempVar.date.second"));
|
||||||
|
AddTempvar("dayOfWeek",
|
||||||
|
obs_module_text("AdvSceneSwitcher.tempVar.date.dayOfWeek"));
|
||||||
|
}
|
||||||
|
|
||||||
static inline void populateDaySelection(QComboBox *list)
|
static inline void populateDaySelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : dayOfWeekNames) {
|
for (auto entry : dayOfWeekNames) {
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ private:
|
|||||||
bool CheckRegularDate(int64_t);
|
bool CheckRegularDate(int64_t);
|
||||||
bool CheckBetween(const QDateTime &now);
|
bool CheckBetween(const QDateTime &now);
|
||||||
bool CheckPattern(QDateTime now, int64_t secondsSinceLastCheck);
|
bool CheckPattern(QDateTime now, int64_t secondsSinceLastCheck);
|
||||||
|
void SetVariables(const QDateTime &date);
|
||||||
|
void SetupTempVars();
|
||||||
|
|
||||||
QDateTime _dateTime = QDateTime::currentDateTime();
|
QDateTime _dateTime = QDateTime::currentDateTime();
|
||||||
QDateTime _dateTime2 = QDateTime::currentDateTime();
|
QDateTime _dateTime2 = QDateTime::currentDateTime();
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ bool MacroConditionDisplay::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionDisplay::Create, MacroConditionDisplayEdit::Create,
|
{MacroConditionDisplay::Create, MacroConditionDisplayEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.display"});
|
"AdvSceneSwitcher.condition.display"});
|
||||||
|
|
||||||
static std::map<MacroConditionDisplay::Condition, std::string> conditionTypes = {
|
const static std::map<MacroConditionDisplay::Condition, std::string>
|
||||||
{MacroConditionDisplay::Condition::DISPLAY_NAME,
|
conditionTypes = {
|
||||||
"AdvSceneSwitcher.condition.display.type.displayName"},
|
{MacroConditionDisplay::Condition::DISPLAY_NAME,
|
||||||
{MacroConditionDisplay::Condition::DISPLAY_COUNT,
|
"AdvSceneSwitcher.condition.display.type.displayName"},
|
||||||
"AdvSceneSwitcher.condition.display.type.displayCount"},
|
{MacroConditionDisplay::Condition::DISPLAY_COUNT,
|
||||||
|
"AdvSceneSwitcher.condition.display.type.displayCount"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool matchDisplayNames(const std::string &name, const RegexConfig ®ex)
|
static bool matchDisplayNames(const std::string &name, const RegexConfig ®ex)
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ MacroConditionEdit::MacroConditionEdit(
|
|||||||
: MacroSegmentEdit(switcher->macroProperties._highlightConditions,
|
: MacroSegmentEdit(switcher->macroProperties._highlightConditions,
|
||||||
parent),
|
parent),
|
||||||
_logicSelection(new QComboBox()),
|
_logicSelection(new QComboBox()),
|
||||||
_conditionSelection(new QComboBox()),
|
_conditionSelection(new FilterComboBox()),
|
||||||
_dur(new DurationModifierEdit()),
|
_dur(new DurationModifierEdit()),
|
||||||
_entryData(entryData),
|
_entryData(entryData),
|
||||||
_isRoot(root)
|
_isRoot(root)
|
||||||
@@ -295,13 +295,16 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto idx = _entryData->get()->GetIndex();
|
|
||||||
auto macro = _entryData->get()->GetMacro();
|
|
||||||
std::string id = MacroConditionFactory::GetIdByName(text);
|
std::string id = MacroConditionFactory::GetIdByName(text);
|
||||||
|
if (id.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto temp = DurationModifier();
|
auto temp = DurationModifier();
|
||||||
_dur->SetValue(temp);
|
_dur->SetValue(temp);
|
||||||
HeaderInfoChanged("");
|
HeaderInfoChanged("");
|
||||||
|
auto idx = _entryData->get()->GetIndex();
|
||||||
|
auto macro = _entryData->get()->GetMacro();
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
auto logic = (*_entryData)->GetLogicType();
|
auto logic = (*_entryData)->GetLogicType();
|
||||||
@@ -309,6 +312,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
|||||||
*_entryData = MacroConditionFactory::Create(id, macro);
|
*_entryData = MacroConditionFactory::Create(id, macro);
|
||||||
(*_entryData)->SetIndex(idx);
|
(*_entryData)->SetIndex(idx);
|
||||||
(*_entryData)->SetLogicType(logic);
|
(*_entryData)->SetLogicType(logic);
|
||||||
|
(*_entryData)->PostLoad();
|
||||||
}
|
}
|
||||||
auto widget =
|
auto widget =
|
||||||
MacroConditionFactory::CreateWidget(id, this, *_entryData);
|
MacroConditionFactory::CreateWidget(id, this, *_entryData);
|
||||||
@@ -339,7 +343,7 @@ void MacroConditionEdit::DurationModifierChanged(DurationModifier::Type m)
|
|||||||
(*_entryData)->SetDurationModifier(m);
|
(*_entryData)->SetDurationModifier(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<MacroSegment> MacroConditionEdit::Data()
|
std::shared_ptr<MacroSegment> MacroConditionEdit::Data() const
|
||||||
{
|
{
|
||||||
return *_entryData;
|
return *_entryData;
|
||||||
}
|
}
|
||||||
@@ -380,9 +384,10 @@ void AdvSceneSwitcher::AddMacroCondition(int idx)
|
|||||||
macro->Conditions().at(idx)->Load(data);
|
macro->Conditions().at(idx)->Load(data);
|
||||||
obs_data_release(data);
|
obs_data_release(data);
|
||||||
}
|
}
|
||||||
|
macro->Conditions().at(idx)->PostLoad();
|
||||||
(*cond)->SetLogicType(logic);
|
(*cond)->SetLogicType(logic);
|
||||||
macro->UpdateConditionIndices();
|
macro->UpdateConditionIndices();
|
||||||
conditionsList->Insert(
|
ui->conditionsList->Insert(
|
||||||
idx,
|
idx,
|
||||||
new MacroConditionEdit(this, ¯o->Conditions()[idx],
|
new MacroConditionEdit(this, ¯o->Conditions()[idx],
|
||||||
id, idx == 0));
|
id, idx == 0));
|
||||||
@@ -407,7 +412,7 @@ void AdvSceneSwitcher::on_conditionAdd_clicked()
|
|||||||
if (currentConditionIdx != -1) {
|
if (currentConditionIdx != -1) {
|
||||||
MacroConditionSelectionChanged(currentConditionIdx + 1);
|
MacroConditionSelectionChanged(currentConditionIdx + 1);
|
||||||
}
|
}
|
||||||
conditionsList->SetHelpMsgVisible(false);
|
ui->conditionsList->SetHelpMsgVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::RemoveMacroCondition(int idx)
|
void AdvSceneSwitcher::RemoveMacroCondition(int idx)
|
||||||
@@ -423,14 +428,14 @@ void AdvSceneSwitcher::RemoveMacroCondition(int idx)
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
conditionsList->Remove(idx);
|
ui->conditionsList->Remove(idx);
|
||||||
macro->Conditions().erase(macro->Conditions().begin() + idx);
|
macro->Conditions().erase(macro->Conditions().begin() + idx);
|
||||||
macro->UpdateConditionIndices();
|
macro->UpdateConditionIndices();
|
||||||
if (idx == 0 && macro->Conditions().size() > 0) {
|
if (idx == 0 && macro->Conditions().size() > 0) {
|
||||||
auto newRoot = macro->Conditions().at(0);
|
auto newRoot = macro->Conditions().at(0);
|
||||||
newRoot->SetLogicType(LogicType::ROOT_NONE);
|
newRoot->SetLogicType(LogicType::ROOT_NONE);
|
||||||
static_cast<MacroConditionEdit *>(
|
static_cast<MacroConditionEdit *>(
|
||||||
conditionsList->WidgetAt(0))
|
ui->conditionsList->WidgetAt(0))
|
||||||
->SetRootNode(true);
|
->SetRootNode(true);
|
||||||
}
|
}
|
||||||
SetConditionData(*macro);
|
SetConditionData(*macro);
|
||||||
@@ -454,24 +459,45 @@ void AdvSceneSwitcher::on_conditionRemove_clicked()
|
|||||||
MacroConditionSelectionChanged(-1);
|
MacroConditionSelectionChanged(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionUp_clicked()
|
void AdvSceneSwitcher::on_conditionTop_clicked()
|
||||||
{
|
{
|
||||||
if (currentConditionIdx == -1) {
|
if (currentConditionIdx == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
MacroConditionReorder(0, currentConditionIdx);
|
||||||
|
MacroConditionSelectionChanged(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::on_conditionUp_clicked()
|
||||||
|
{
|
||||||
|
if (currentConditionIdx == -1 || currentConditionIdx == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
MoveMacroConditionUp(currentConditionIdx);
|
MoveMacroConditionUp(currentConditionIdx);
|
||||||
MacroConditionSelectionChanged(currentConditionIdx - 1);
|
MacroConditionSelectionChanged(currentConditionIdx - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_conditionDown_clicked()
|
void AdvSceneSwitcher::on_conditionDown_clicked()
|
||||||
{
|
{
|
||||||
if (currentConditionIdx == -1) {
|
if (currentConditionIdx == -1 ||
|
||||||
|
currentConditionIdx ==
|
||||||
|
ui->conditionsList->ContentLayout()->count() - 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MoveMacroConditionDown(currentConditionIdx);
|
MoveMacroConditionDown(currentConditionIdx);
|
||||||
MacroConditionSelectionChanged(currentConditionIdx + 1);
|
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)
|
void AdvSceneSwitcher::SwapConditions(Macro *m, int pos1, int pos2)
|
||||||
{
|
{
|
||||||
if (pos1 == pos2) {
|
if (pos1 == pos2) {
|
||||||
@@ -497,11 +523,11 @@ void AdvSceneSwitcher::SwapConditions(Macro *m, int pos1, int pos2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto widget1 = static_cast<MacroConditionEdit *>(
|
auto widget1 = static_cast<MacroConditionEdit *>(
|
||||||
conditionsList->ContentLayout()->takeAt(pos1)->widget());
|
ui->conditionsList->ContentLayout()->takeAt(pos1)->widget());
|
||||||
auto widget2 = static_cast<MacroConditionEdit *>(
|
auto widget2 = static_cast<MacroConditionEdit *>(
|
||||||
conditionsList->ContentLayout()->takeAt(pos2 - 1)->widget());
|
ui->conditionsList->ContentLayout()->takeAt(pos2 - 1)->widget());
|
||||||
conditionsList->Insert(pos1, widget2);
|
ui->conditionsList->Insert(pos1, widget2);
|
||||||
conditionsList->Insert(pos2, widget1);
|
ui->conditionsList->Insert(pos2, widget1);
|
||||||
SetConditionData(*m);
|
SetConditionData(*m);
|
||||||
widget2->SetRootNode(root);
|
widget2->SetRootNode(root);
|
||||||
widget1->SetRootNode(false);
|
widget1->SetRootNode(false);
|
||||||
@@ -540,22 +566,7 @@ void AdvSceneSwitcher::MoveMacroConditionDown(int idx)
|
|||||||
|
|
||||||
void AdvSceneSwitcher::MacroConditionSelectionChanged(int idx)
|
void AdvSceneSwitcher::MacroConditionSelectionChanged(int idx)
|
||||||
{
|
{
|
||||||
auto macro = GetSelectedMacro();
|
SetupMacroSegmentSelection(MacroSection::CONDITIONS, idx);
|
||||||
if (!macro) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
conditionsList->SetSelection(idx);
|
|
||||||
actionsList->SetSelection(-1);
|
|
||||||
|
|
||||||
if (idx < 0 || (unsigned)idx >= macro->Conditions().size()) {
|
|
||||||
currentConditionIdx = -1;
|
|
||||||
} else {
|
|
||||||
currentConditionIdx = idx;
|
|
||||||
lastInteracted = MacroSection::CONDITIONS;
|
|
||||||
}
|
|
||||||
currentActionIdx = -1;
|
|
||||||
HighlightControls();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::MacroConditionReorder(int to, int from)
|
void AdvSceneSwitcher::MacroConditionReorder(int to, int from)
|
||||||
@@ -565,8 +576,8 @@ void AdvSceneSwitcher::MacroConditionReorder(int to, int from)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from < 0 || from > (int)macro->Conditions().size() || to < 0 ||
|
if (to == from || from < 0 || from > (int)macro->Conditions().size() ||
|
||||||
to > (int)macro->Conditions().size()) {
|
to < 0 || to > (int)macro->Conditions().size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -575,30 +586,30 @@ void AdvSceneSwitcher::MacroConditionReorder(int to, int from)
|
|||||||
if (to == 0) {
|
if (to == 0) {
|
||||||
condition->SetLogicType(LogicType::ROOT_NONE);
|
condition->SetLogicType(LogicType::ROOT_NONE);
|
||||||
static_cast<MacroConditionEdit *>(
|
static_cast<MacroConditionEdit *>(
|
||||||
conditionsList->WidgetAt(from))
|
ui->conditionsList->WidgetAt(from))
|
||||||
->SetRootNode(true);
|
->SetRootNode(true);
|
||||||
macro->Conditions().at(0)->SetLogicType(LogicType::AND);
|
macro->Conditions().at(0)->SetLogicType(LogicType::AND);
|
||||||
static_cast<MacroConditionEdit *>(
|
static_cast<MacroConditionEdit *>(
|
||||||
conditionsList->WidgetAt(0))
|
ui->conditionsList->WidgetAt(0))
|
||||||
->SetRootNode(false);
|
->SetRootNode(false);
|
||||||
}
|
}
|
||||||
if (from == 0) {
|
if (from == 0) {
|
||||||
condition->SetLogicType(LogicType::AND);
|
condition->SetLogicType(LogicType::AND);
|
||||||
static_cast<MacroConditionEdit *>(
|
static_cast<MacroConditionEdit *>(
|
||||||
conditionsList->WidgetAt(from))
|
ui->conditionsList->WidgetAt(from))
|
||||||
->SetRootNode(false);
|
->SetRootNode(false);
|
||||||
macro->Conditions().at(1)->SetLogicType(
|
macro->Conditions().at(1)->SetLogicType(
|
||||||
LogicType::ROOT_NONE);
|
LogicType::ROOT_NONE);
|
||||||
static_cast<MacroConditionEdit *>(
|
static_cast<MacroConditionEdit *>(
|
||||||
conditionsList->WidgetAt(1))
|
ui->conditionsList->WidgetAt(1))
|
||||||
->SetRootNode(true);
|
->SetRootNode(true);
|
||||||
}
|
}
|
||||||
macro->Conditions().erase(macro->Conditions().begin() + from);
|
macro->Conditions().erase(macro->Conditions().begin() + from);
|
||||||
macro->Conditions().insert(macro->Conditions().begin() + to,
|
macro->Conditions().insert(macro->Conditions().begin() + to,
|
||||||
condition);
|
condition);
|
||||||
macro->UpdateConditionIndices();
|
macro->UpdateConditionIndices();
|
||||||
conditionsList->ContentLayout()->insertItem(
|
ui->conditionsList->ContentLayout()->insertItem(
|
||||||
to, conditionsList->ContentLayout()->takeAt(from));
|
to, ui->conditionsList->ContentLayout()->takeAt(from));
|
||||||
SetConditionData(*macro);
|
SetConditionData(*macro);
|
||||||
}
|
}
|
||||||
HighlightCondition(to);
|
HighlightCondition(to);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-condition.hpp"
|
#include "macro-condition.hpp"
|
||||||
|
#include "filter-combo-box.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -74,10 +75,10 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void SetLogicSelection();
|
void SetLogicSelection();
|
||||||
std::shared_ptr<MacroSegment> Data();
|
std::shared_ptr<MacroSegment> Data() const;
|
||||||
|
|
||||||
QComboBox *_logicSelection;
|
QComboBox *_logicSelection;
|
||||||
QComboBox *_conditionSelection;
|
FilterComboBox *_conditionSelection;
|
||||||
DurationModifierEdit *_dur;
|
DurationModifierEdit *_dur;
|
||||||
|
|
||||||
std::shared_ptr<MacroCondition> *_entryData;
|
std::shared_ptr<MacroCondition> *_entryData;
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <regex>
|
#include <array>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
@@ -41,86 +42,63 @@ static std::string getRemoteData(std::string &url)
|
|||||||
return readBuffer;
|
return readBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionFile::MatchFileContent(QString &filedata)
|
static bool stringsMatch(const QString &text, const std::string &pattern,
|
||||||
|
const RegexConfig ®ex)
|
||||||
{
|
{
|
||||||
if (_onlyMatchIfChanged) {
|
auto qpattern = QString::fromStdString(pattern);
|
||||||
size_t newHash = strHash(filedata.toUtf8().constData());
|
if (regex.Enabled()) {
|
||||||
if (newHash == _lastHash) {
|
return regex.Matches(text, qpattern);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_lastHash = newHash;
|
|
||||||
}
|
}
|
||||||
|
auto textCopy = text;
|
||||||
if (_regex.Enabled()) {
|
return CompareIgnoringLineEnding(qpattern, textCopy);
|
||||||
auto expr = _regex.GetRegularExpression(_text);
|
|
||||||
if (!expr.isValid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
auto match = expr.match(filedata);
|
|
||||||
return match.hasMatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString text = QString::fromStdString(_text);
|
|
||||||
return CompareIgnoringLineEnding(text, filedata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionFile::CheckRemoteFileContent()
|
static std::optional<QString> getFileContent(MacroConditionFile::FileType type,
|
||||||
|
const std::string &filePath)
|
||||||
{
|
{
|
||||||
std::string path = _file;
|
QString filedata;
|
||||||
std::string data = getRemoteData(path);
|
switch (type) {
|
||||||
SetVariableValue(data);
|
case MacroConditionFile::FileType::LOCAL: {
|
||||||
QString qdata = QString::fromStdString(data);
|
std::string path = filePath;
|
||||||
return MatchFileContent(qdata);
|
QFile file(QString::fromStdString(path));
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
filedata = QTextStream(&file).readAll();
|
||||||
|
file.close();
|
||||||
|
} break;
|
||||||
|
case MacroConditionFile::FileType::REMOTE: {
|
||||||
|
std::string path = filePath;
|
||||||
|
std::string data = getRemoteData(path);
|
||||||
|
filedata = QString::fromStdString(data);
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return filedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionFile::CheckLocalFileContent()
|
bool MacroConditionFile::CheckFileContentMatch()
|
||||||
{
|
{
|
||||||
QFile file(QString::fromStdString(_file));
|
auto fileData = getFileContent(_fileType, _file);
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!fileData) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const bool match = stringsMatch(*fileData, _text, _regex);
|
||||||
if (_useTime) {
|
SetVariableValue(fileData->toStdString());
|
||||||
QDateTime newLastMod = QFileInfo(file).lastModified();
|
|
||||||
if (_lastMod == newLastMod) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_lastMod = newLastMod;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString filedata = QTextStream(&file).readAll();
|
|
||||||
SetVariableValue(filedata.toStdString());
|
|
||||||
bool match = MatchFileContent(filedata);
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionFile::CheckChangeContent()
|
bool MacroConditionFile::CheckChangeContent()
|
||||||
{
|
{
|
||||||
QString filedata;
|
auto filedata = getFileContent(_fileType, _file);
|
||||||
switch (_fileType) {
|
if (!filedata) {
|
||||||
case FileType::LOCAL: {
|
return false;
|
||||||
std::string path = _file;
|
|
||||||
QFile file(QString::fromStdString(path));
|
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
filedata = QTextStream(&file).readAll();
|
|
||||||
file.close();
|
|
||||||
} break;
|
|
||||||
case FileType::REMOTE: {
|
|
||||||
std::string path = _file;
|
|
||||||
std::string data = getRemoteData(path);
|
|
||||||
QString filedata = QString::fromStdString(data);
|
|
||||||
} break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
size_t newHash = strHash(filedata->toUtf8().constData());
|
||||||
size_t newHash = strHash(filedata.toUtf8().constData());
|
|
||||||
const bool contentChanged = newHash != _lastHash;
|
const bool contentChanged = newHash != _lastHash;
|
||||||
_lastHash = newHash;
|
_lastHash = newHash;
|
||||||
|
SetVariableValue(contentChanged ? "true" : "false");
|
||||||
return contentChanged;
|
return contentChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,35 +113,94 @@ bool MacroConditionFile::CheckChangeDate()
|
|||||||
SetVariableValue(newLastMod.toString().toStdString());
|
SetVariableValue(newLastMod.toString().toStdString());
|
||||||
const bool dateChanged = _lastMod != newLastMod;
|
const bool dateChanged = _lastMod != newLastMod;
|
||||||
_lastMod = newLastMod;
|
_lastMod = newLastMod;
|
||||||
|
SetVariableValue(dateChanged ? "true" : "false");
|
||||||
return dateChanged;
|
return dateChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QStringList splitLines(const QString &string)
|
||||||
|
{
|
||||||
|
static auto regex = QRegularExpression("\n|\r\n|\r");
|
||||||
|
return string.split(regex);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroConditionFile::CheckChangedMatch()
|
||||||
|
{
|
||||||
|
static bool setupDone = false;
|
||||||
|
if (!setupDone) {
|
||||||
|
auto content = getFileContent(_fileType, _file);
|
||||||
|
if (!content) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_previousContent = splitLines(*content);
|
||||||
|
setupDone = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto currentFileContent = getFileContent(_fileType, _file);
|
||||||
|
if (!currentFileContent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto currentContent = splitLines(*currentFileContent);
|
||||||
|
auto newContent = currentContent;
|
||||||
|
|
||||||
|
QStringList addedLines;
|
||||||
|
QStringList removedLines;
|
||||||
|
|
||||||
|
for (const auto &line : newContent) {
|
||||||
|
if (auto it = std::find(_previousContent.begin(),
|
||||||
|
_previousContent.end(),
|
||||||
|
line) == _previousContent.end()) {
|
||||||
|
addedLines.push_back(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &line : _previousContent) {
|
||||||
|
if (std::find(newContent.begin(), newContent.end(), line) ==
|
||||||
|
newContent.end()) {
|
||||||
|
removedLines.push_back(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_previousContent = currentContent;
|
||||||
|
|
||||||
|
if (_changeMatchType == ChangeMatchType::ADDED ||
|
||||||
|
_changeMatchType == ChangeMatchType::ANY) {
|
||||||
|
for (const auto &line : addedLines) {
|
||||||
|
if (stringsMatch(line, _text, _regex)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_changeMatchType == ChangeMatchType::REMOVED ||
|
||||||
|
_changeMatchType == ChangeMatchType::ANY) {
|
||||||
|
for (const auto &line : removedLines) {
|
||||||
|
if (stringsMatch(line, _text, _regex)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MacroConditionFile::CheckCondition()
|
bool MacroConditionFile::CheckCondition()
|
||||||
{
|
{
|
||||||
bool ret = false;
|
|
||||||
switch (_condition) {
|
switch (_condition) {
|
||||||
case MacroConditionFile::ConditionType::MATCH:
|
case MacroConditionFile::ConditionType::MATCH:
|
||||||
if (_fileType == FileType::REMOTE) {
|
return CheckFileContentMatch();
|
||||||
ret = CheckRemoteFileContent();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ret = CheckLocalFileContent();
|
|
||||||
break;
|
|
||||||
case MacroConditionFile::ConditionType::CONTENT_CHANGE:
|
case MacroConditionFile::ConditionType::CONTENT_CHANGE:
|
||||||
ret = CheckChangeContent();
|
return CheckChangeContent();
|
||||||
break;
|
|
||||||
case MacroConditionFile::ConditionType::DATE_CHANGE:
|
case MacroConditionFile::ConditionType::DATE_CHANGE:
|
||||||
ret = CheckChangeDate();
|
return CheckChangeDate();
|
||||||
break;
|
case MacroConditionFile::ConditionType::CHANGES_MATCH:
|
||||||
|
return CheckChangedMatch();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetVariableValue().empty()) {
|
return false;
|
||||||
SetVariableValue(ret ? "true" : "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionFile::Save(obs_data_t *obj) const
|
bool MacroConditionFile::Save(obs_data_t *obj) const
|
||||||
@@ -173,9 +210,9 @@ bool MacroConditionFile::Save(obs_data_t *obj) const
|
|||||||
_file.Save(obj, "file");
|
_file.Save(obj, "file");
|
||||||
_text.Save(obj, "text");
|
_text.Save(obj, "text");
|
||||||
obs_data_set_int(obj, "fileType", static_cast<int>(_fileType));
|
obs_data_set_int(obj, "fileType", static_cast<int>(_fileType));
|
||||||
|
obs_data_set_int(obj, "changeMatchType",
|
||||||
|
static_cast<int>(_changeMatchType));
|
||||||
obs_data_set_int(obj, "condition", static_cast<int>(_condition));
|
obs_data_set_int(obj, "condition", static_cast<int>(_condition));
|
||||||
obs_data_set_bool(obj, "useTime", _useTime);
|
|
||||||
obs_data_set_bool(obj, "onlyMatchIfChanged", _onlyMatchIfChanged);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,10 +228,10 @@ bool MacroConditionFile::Load(obs_data_t *obj)
|
|||||||
_file.Load(obj, "file");
|
_file.Load(obj, "file");
|
||||||
_text.Load(obj, "text");
|
_text.Load(obj, "text");
|
||||||
_fileType = static_cast<FileType>(obs_data_get_int(obj, "fileType"));
|
_fileType = static_cast<FileType>(obs_data_get_int(obj, "fileType"));
|
||||||
|
_changeMatchType = static_cast<ChangeMatchType>(
|
||||||
|
obs_data_get_int(obj, "changeMatchType"));
|
||||||
_condition =
|
_condition =
|
||||||
static_cast<ConditionType>(obs_data_get_int(obj, "condition"));
|
static_cast<ConditionType>(obs_data_get_int(obj, "condition"));
|
||||||
_useTime = obs_data_get_bool(obj, "useTime");
|
|
||||||
_onlyMatchIfChanged = obs_data_get_bool(obj, "onlyMatchIfChanged");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,39 +242,79 @@ std::string MacroConditionFile::GetShortDesc() const
|
|||||||
|
|
||||||
static void populateFileTypes(QComboBox *list)
|
static void populateFileTypes(QComboBox *list)
|
||||||
{
|
{
|
||||||
list->addItem(obs_module_text("AdvSceneSwitcher.condition.file.local"));
|
static constexpr std::array<
|
||||||
list->addItem(
|
std::tuple<MacroConditionFile::FileType, std::string_view>, 2>
|
||||||
obs_module_text("AdvSceneSwitcher.condition.file.remote"));
|
fileTypes = {{{MacroConditionFile::FileType::LOCAL,
|
||||||
|
"AdvSceneSwitcher.condition.file.local"},
|
||||||
|
{MacroConditionFile::FileType::REMOTE,
|
||||||
|
"AdvSceneSwitcher.condition.file.remote"}}};
|
||||||
|
|
||||||
|
for (const auto &[type, name] : fileTypes) {
|
||||||
|
list->addItem(obs_module_text(name.data()),
|
||||||
|
static_cast<int>(type));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void populateConditions(QComboBox *list)
|
static void populateConditions(QComboBox *list)
|
||||||
{
|
{
|
||||||
list->addItem(
|
static constexpr std::array<
|
||||||
obs_module_text("AdvSceneSwitcher.condition.file.type.match"));
|
std::tuple<MacroConditionFile::ConditionType, std::string_view>,
|
||||||
list->addItem(obs_module_text(
|
4>
|
||||||
"AdvSceneSwitcher.condition.file.type.contentChange"));
|
conditionTypes = {{
|
||||||
list->addItem(obs_module_text(
|
{MacroConditionFile::ConditionType::MATCH,
|
||||||
"AdvSceneSwitcher.condition.file.type.dateChange"));
|
"AdvSceneSwitcher.condition.file.type.match"},
|
||||||
|
{MacroConditionFile::ConditionType::CONTENT_CHANGE,
|
||||||
|
"AdvSceneSwitcher.condition.file.type.contentChange"},
|
||||||
|
{MacroConditionFile::ConditionType::DATE_CHANGE,
|
||||||
|
"AdvSceneSwitcher.condition.file.type.dateChange"},
|
||||||
|
{MacroConditionFile::ConditionType::CHANGES_MATCH,
|
||||||
|
"AdvSceneSwitcher.condition.file.type.changesMatch"},
|
||||||
|
}};
|
||||||
|
|
||||||
|
for (const auto &[type, name] : conditionTypes) {
|
||||||
|
list->addItem(obs_module_text(name.data()),
|
||||||
|
static_cast<int>(type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void populateChangeMatchTypes(QComboBox *list)
|
||||||
|
{
|
||||||
|
static constexpr std::array<
|
||||||
|
std::tuple<MacroConditionFile::ChangeMatchType, std::string_view>,
|
||||||
|
3>
|
||||||
|
matchTypes = {{
|
||||||
|
{MacroConditionFile::ChangeMatchType::ANY,
|
||||||
|
"AdvSceneSwitcher.condition.file.changeMatchType.any"},
|
||||||
|
{MacroConditionFile::ChangeMatchType::ADDED,
|
||||||
|
"AdvSceneSwitcher.condition.file.changeMatchType.added"},
|
||||||
|
{MacroConditionFile::ChangeMatchType::REMOVED,
|
||||||
|
"AdvSceneSwitcher.condition.file.changeMatchType.removed"},
|
||||||
|
}};
|
||||||
|
|
||||||
|
for (const auto &[type, name] : matchTypes) {
|
||||||
|
list->addItem(obs_module_text(name.data()),
|
||||||
|
static_cast<int>(type));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroConditionFileEdit::MacroConditionFileEdit(
|
MacroConditionFileEdit::MacroConditionFileEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroConditionFile> entryData)
|
QWidget *parent, std::shared_ptr<MacroConditionFile> entryData)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_fileTypes(new QComboBox()),
|
_fileTypes(new QComboBox()),
|
||||||
|
_changeMatchTypes(new QComboBox()),
|
||||||
_conditions(new QComboBox()),
|
_conditions(new QComboBox()),
|
||||||
_filePath(new FileSelection()),
|
_filePath(new FileSelection()),
|
||||||
_matchText(new VariableTextEdit(this)),
|
_matchText(new VariableTextEdit(this)),
|
||||||
_regex(new RegexConfigWidget(parent)),
|
_regex(new RegexConfigWidget(parent))
|
||||||
_checkModificationDate(new QCheckBox(obs_module_text(
|
|
||||||
"AdvSceneSwitcher.fileTab.checkfileContentTime"))),
|
|
||||||
_checkFileContent(new QCheckBox(
|
|
||||||
obs_module_text("AdvSceneSwitcher.fileTab.checkfileContent")))
|
|
||||||
{
|
{
|
||||||
populateFileTypes(_fileTypes);
|
populateFileTypes(_fileTypes);
|
||||||
populateConditions(_conditions);
|
populateConditions(_conditions);
|
||||||
|
populateChangeMatchTypes(_changeMatchTypes);
|
||||||
|
|
||||||
QWidget::connect(_fileTypes, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_fileTypes, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(FileTypeChanged(int)));
|
SLOT(FileTypeChanged(int)));
|
||||||
|
QWidget::connect(_changeMatchTypes, SIGNAL(currentIndexChanged(int)),
|
||||||
|
this, SLOT(ChangeMatchTypeChanged(int)));
|
||||||
QWidget::connect(_conditions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_conditions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(ConditionChanged(int)));
|
SLOT(ConditionChanged(int)));
|
||||||
QWidget::connect(_filePath, SIGNAL(PathChanged(const QString &)), this,
|
QWidget::connect(_filePath, SIGNAL(PathChanged(const QString &)), this,
|
||||||
@@ -246,41 +323,30 @@ MacroConditionFileEdit::MacroConditionFileEdit(
|
|||||||
SLOT(MatchTextChanged()));
|
SLOT(MatchTextChanged()));
|
||||||
QWidget::connect(_regex, SIGNAL(RegexConfigChanged(RegexConfig)), this,
|
QWidget::connect(_regex, SIGNAL(RegexConfigChanged(RegexConfig)), this,
|
||||||
SLOT(RegexChanged(RegexConfig)));
|
SLOT(RegexChanged(RegexConfig)));
|
||||||
QWidget::connect(_checkModificationDate, SIGNAL(stateChanged(int)),
|
|
||||||
this, SLOT(CheckModificationDateChanged(int)));
|
|
||||||
QWidget::connect(_checkFileContent, SIGNAL(stateChanged(int)), this,
|
|
||||||
SLOT(OnlyMatchIfChangedChanged(int)));
|
|
||||||
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
const std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{fileType}}", _fileTypes},
|
{"{{fileType}}", _fileTypes},
|
||||||
|
{"{{changeMatchType}}", _changeMatchTypes},
|
||||||
{"{{conditions}}", _conditions},
|
{"{{conditions}}", _conditions},
|
||||||
{"{{filePath}}", _filePath},
|
{"{{filePath}}", _filePath},
|
||||||
{"{{matchText}}", _matchText},
|
{"{{matchText}}", _matchText},
|
||||||
{"{{useRegex}}", _regex},
|
{"{{useRegex}}", _regex},
|
||||||
{"{{checkModificationDate}}", _checkModificationDate},
|
|
||||||
{"{{checkFileContent}}", _checkFileContent},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
auto line1Layout = new QHBoxLayout;
|
||||||
QHBoxLayout *line1Layout = new QHBoxLayout;
|
|
||||||
QHBoxLayout *line2Layout = new QHBoxLayout;
|
|
||||||
QHBoxLayout *line3Layout = new QHBoxLayout;
|
|
||||||
line1Layout->setContentsMargins(0, 0, 0, 0);
|
line1Layout->setContentsMargins(0, 0, 0, 0);
|
||||||
line2Layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
line3Layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
PlaceWidgets(
|
PlaceWidgets(
|
||||||
obs_module_text("AdvSceneSwitcher.condition.file.entry.line1"),
|
obs_module_text("AdvSceneSwitcher.condition.file.entry.line1"),
|
||||||
line1Layout, widgetPlaceholders);
|
line1Layout, widgetPlaceholders);
|
||||||
|
auto line2Layout = new QHBoxLayout;
|
||||||
|
line2Layout->setContentsMargins(0, 0, 0, 0);
|
||||||
PlaceWidgets(
|
PlaceWidgets(
|
||||||
obs_module_text("AdvSceneSwitcher.condition.file.entry.line2"),
|
obs_module_text("AdvSceneSwitcher.condition.file.entry.line2"),
|
||||||
line2Layout, widgetPlaceholders, false);
|
line2Layout, widgetPlaceholders, false);
|
||||||
PlaceWidgets(
|
|
||||||
obs_module_text("AdvSceneSwitcher.condition.file.entry.line3"),
|
auto mainLayout = new QVBoxLayout;
|
||||||
line3Layout, widgetPlaceholders);
|
|
||||||
mainLayout->addLayout(line1Layout);
|
mainLayout->addLayout(line1Layout);
|
||||||
mainLayout->addLayout(line2Layout);
|
mainLayout->addLayout(line2Layout);
|
||||||
mainLayout->addLayout(line3Layout);
|
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
@@ -294,21 +360,15 @@ void MacroConditionFileEdit::UpdateEntryData()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_fileTypes->setCurrentIndex(static_cast<int>(_entryData->_fileType));
|
_fileTypes->setCurrentIndex(
|
||||||
_conditions->setCurrentIndex(static_cast<int>(_entryData->_condition));
|
_fileTypes->findData(static_cast<int>(_entryData->_fileType)));
|
||||||
|
_conditions->setCurrentIndex(_conditions->findData(
|
||||||
|
static_cast<int>(_entryData->_condition)));
|
||||||
|
_changeMatchTypes->setCurrentIndex(_changeMatchTypes->findData(
|
||||||
|
static_cast<int>(_entryData->_changeMatchType)));
|
||||||
_filePath->SetPath(_entryData->_file);
|
_filePath->SetPath(_entryData->_file);
|
||||||
_matchText->setPlainText(_entryData->_text);
|
_matchText->setPlainText(_entryData->_text);
|
||||||
_regex->SetRegexConfig(_entryData->_regex);
|
_regex->SetRegexConfig(_entryData->_regex);
|
||||||
_checkModificationDate->setChecked(_entryData->_useTime);
|
|
||||||
_checkFileContent->setChecked(_entryData->_onlyMatchIfChanged);
|
|
||||||
|
|
||||||
// TODO: Remove in future version
|
|
||||||
if (!_entryData->_useTime) {
|
|
||||||
_checkModificationDate->hide();
|
|
||||||
}
|
|
||||||
if (!_entryData->_onlyMatchIfChanged) {
|
|
||||||
_checkFileContent->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
@@ -319,19 +379,25 @@ void MacroConditionFileEdit::FileTypeChanged(int index)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroConditionFile::FileType type =
|
auto type = static_cast<MacroConditionFile::FileType>(
|
||||||
static_cast<MacroConditionFile::FileType>(index);
|
_fileTypes->itemData(index).toInt());
|
||||||
|
_filePath->Button()->setEnabled(type ==
|
||||||
|
MacroConditionFile::FileType::LOCAL);
|
||||||
|
auto lock = LockContext();
|
||||||
|
_entryData->_fileType = type;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == MacroConditionFile::FileType::LOCAL) {
|
void MacroConditionFileEdit::ChangeMatchTypeChanged(int index)
|
||||||
_filePath->Button()->setDisabled(false);
|
{
|
||||||
_checkModificationDate->setDisabled(false);
|
if (_loading || !_entryData) {
|
||||||
} else {
|
return;
|
||||||
_filePath->Button()->setDisabled(true);
|
|
||||||
_checkModificationDate->setDisabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_fileType = type;
|
_entryData->_changeMatchType =
|
||||||
|
static_cast<MacroConditionFile::ChangeMatchType>(
|
||||||
|
_changeMatchTypes->itemData(index).toInt());
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFileEdit::ConditionChanged(int index)
|
void MacroConditionFileEdit::ConditionChanged(int index)
|
||||||
@@ -341,8 +407,8 @@ void MacroConditionFileEdit::ConditionChanged(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_condition =
|
_entryData->_condition = static_cast<MacroConditionFile::ConditionType>(
|
||||||
static_cast<MacroConditionFile::ConditionType>(index);
|
_conditions->itemData(index).toInt());
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,44 +449,25 @@ void MacroConditionFileEdit::RegexChanged(RegexConfig conf)
|
|||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFileEdit::CheckModificationDateChanged(int state)
|
|
||||||
{
|
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_useTime = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MacroConditionFileEdit::OnlyMatchIfChangedChanged(int state)
|
|
||||||
{
|
|
||||||
if (_loading || !_entryData) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_onlyMatchIfChanged = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MacroConditionFileEdit::SetWidgetVisibility()
|
void MacroConditionFileEdit::SetWidgetVisibility()
|
||||||
{
|
{
|
||||||
if (!_entryData) {
|
if (!_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_matchText->setVisible(_entryData->_condition ==
|
_changeMatchTypes->setVisible(
|
||||||
MacroConditionFile::ConditionType::MATCH);
|
|
||||||
_regex->setVisible(_entryData->_condition ==
|
|
||||||
MacroConditionFile::ConditionType::MATCH);
|
|
||||||
_checkModificationDate->setVisible(
|
|
||||||
_entryData->_useTime &&
|
|
||||||
_entryData->_condition ==
|
_entryData->_condition ==
|
||||||
MacroConditionFile::ConditionType::MATCH);
|
MacroConditionFile::ConditionType::CHANGES_MATCH);
|
||||||
_checkFileContent->setVisible(
|
_matchText->setVisible(
|
||||||
_entryData->_onlyMatchIfChanged &&
|
|
||||||
_entryData->_condition ==
|
_entryData->_condition ==
|
||||||
MacroConditionFile::ConditionType::MATCH);
|
MacroConditionFile::ConditionType::MATCH ||
|
||||||
|
_entryData->_condition ==
|
||||||
|
MacroConditionFile::ConditionType::CHANGES_MATCH);
|
||||||
|
_regex->setVisible(
|
||||||
|
_entryData->_condition ==
|
||||||
|
MacroConditionFile::ConditionType::MATCH ||
|
||||||
|
_entryData->_condition ==
|
||||||
|
MacroConditionFile::ConditionType::CHANGES_MATCH);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
@@ -35,27 +36,31 @@ public:
|
|||||||
MATCH,
|
MATCH,
|
||||||
CONTENT_CHANGE,
|
CONTENT_CHANGE,
|
||||||
DATE_CHANGE,
|
DATE_CHANGE,
|
||||||
|
CHANGES_MATCH,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class ChangeMatchType {
|
||||||
|
ANY,
|
||||||
|
ADDED,
|
||||||
|
REMOVED,
|
||||||
};
|
};
|
||||||
|
|
||||||
StringVariable _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
StringVariable _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||||
StringVariable _text = obs_module_text("AdvSceneSwitcher.enterText");
|
StringVariable _text = obs_module_text("AdvSceneSwitcher.enterText");
|
||||||
FileType _fileType = FileType::LOCAL;
|
FileType _fileType = FileType::LOCAL;
|
||||||
|
ChangeMatchType _changeMatchType = ChangeMatchType::ANY;
|
||||||
ConditionType _condition = ConditionType::MATCH;
|
ConditionType _condition = ConditionType::MATCH;
|
||||||
RegexConfig _regex;
|
RegexConfig _regex;
|
||||||
|
|
||||||
// TODO: Remove in future version
|
|
||||||
bool _useTime = false;
|
|
||||||
bool _onlyMatchIfChanged = false;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool MatchFileContent(QString &filedata);
|
bool CheckFileContentMatch();
|
||||||
bool CheckRemoteFileContent();
|
|
||||||
bool CheckLocalFileContent();
|
|
||||||
bool CheckChangeContent();
|
bool CheckChangeContent();
|
||||||
bool CheckChangeDate();
|
bool CheckChangeDate();
|
||||||
|
bool CheckChangedMatch();
|
||||||
|
|
||||||
QDateTime _lastMod;
|
QDateTime _lastMod;
|
||||||
size_t _lastHash = 0;
|
size_t _lastHash = 0;
|
||||||
|
QStringList _previousContent;
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
@@ -78,23 +83,21 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void FileTypeChanged(int index);
|
void FileTypeChanged(int index);
|
||||||
|
void ChangeMatchTypeChanged(int index);
|
||||||
void ConditionChanged(int index);
|
void ConditionChanged(int index);
|
||||||
void PathChanged(const QString &text);
|
void PathChanged(const QString &text);
|
||||||
void MatchTextChanged();
|
void MatchTextChanged();
|
||||||
void RegexChanged(RegexConfig);
|
void RegexChanged(RegexConfig);
|
||||||
void CheckModificationDateChanged(int state);
|
|
||||||
void OnlyMatchIfChangedChanged(int state);
|
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QComboBox *_fileTypes;
|
QComboBox *_fileTypes;
|
||||||
|
QComboBox *_changeMatchTypes;
|
||||||
QComboBox *_conditions;
|
QComboBox *_conditions;
|
||||||
FileSelection *_filePath;
|
FileSelection *_filePath;
|
||||||
VariableTextEdit *_matchText;
|
VariableTextEdit *_matchText;
|
||||||
RegexConfigWidget *_regex;
|
RegexConfigWidget *_regex;
|
||||||
QCheckBox *_checkModificationDate;
|
|
||||||
QCheckBox *_checkFileContent;
|
|
||||||
std::shared_ptr<MacroConditionFile> _entryData;
|
std::shared_ptr<MacroConditionFile> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -12,25 +12,26 @@ bool MacroConditionFilter::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionFilter::Create, MacroConditionFilterEdit::Create,
|
{MacroConditionFilter::Create, MacroConditionFilterEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.filter"});
|
"AdvSceneSwitcher.condition.filter"});
|
||||||
|
|
||||||
static std::map<MacroConditionFilter::Condition, std::string>
|
const static std::map<MacroConditionFilter::Condition, std::string>
|
||||||
filterConditionTypes = {
|
filterConditionTypes = {
|
||||||
{MacroConditionFilter::Condition::ENABLED,
|
{MacroConditionFilter::Condition::ENABLED,
|
||||||
"AdvSceneSwitcher.condition.filter.type.active"},
|
"AdvSceneSwitcher.condition.filter.type.active"},
|
||||||
{MacroConditionFilter::Condition::DISABLED,
|
{MacroConditionFilter::Condition::DISABLED,
|
||||||
"AdvSceneSwitcher.condition.filter.type.showing"},
|
"AdvSceneSwitcher.condition.filter.type.showing"},
|
||||||
{MacroConditionFilter::Condition::SETTINGS,
|
{MacroConditionFilter::Condition::SETTINGS_MATCH,
|
||||||
"AdvSceneSwitcher.condition.filter.type.settings"},
|
"AdvSceneSwitcher.condition.filter.type.settings"},
|
||||||
|
{MacroConditionFilter::Condition::SETTINGS_CHANGED,
|
||||||
|
"AdvSceneSwitcher.condition.filter.type.settingsChanged"},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MacroConditionFilter::CheckCondition()
|
bool MacroConditionFilter::CheckConditionHelper(const OBSWeakSource &filter)
|
||||||
{
|
{
|
||||||
auto filterWeakSource = _filter.GetFilter(_source);
|
bool ret = false;
|
||||||
if (!filterWeakSource) {
|
OBSSourceAutoRelease filterSource = obs_weak_source_get_source(filter);
|
||||||
|
if (!filterSource.Get()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto filterSource = obs_weak_source_get_source(filterWeakSource);
|
|
||||||
|
|
||||||
bool ret = false;
|
|
||||||
switch (_condition) {
|
switch (_condition) {
|
||||||
case Condition::ENABLED:
|
case Condition::ENABLED:
|
||||||
ret = obs_source_enabled(filterSource);
|
ret = obs_source_enabled(filterSource);
|
||||||
@@ -38,18 +39,36 @@ bool MacroConditionFilter::CheckCondition()
|
|||||||
case Condition::DISABLED:
|
case Condition::DISABLED:
|
||||||
ret = !obs_source_enabled(filterSource);
|
ret = !obs_source_enabled(filterSource);
|
||||||
break;
|
break;
|
||||||
case Condition::SETTINGS:
|
case Condition::SETTINGS_MATCH:
|
||||||
ret = CompareSourceSettings(filterWeakSource, _settings,
|
ret = CompareSourceSettings(filter, _settings, _regex);
|
||||||
_regex);
|
|
||||||
if (IsReferencedInVars()) {
|
if (IsReferencedInVars()) {
|
||||||
SetVariableValue(GetSourceSettings(filterWeakSource));
|
SetVariableValue(GetSourceSettings(filter));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Condition::SETTINGS_CHANGED: {
|
||||||
|
std::string settings = GetSourceSettings(_source.GetSource());
|
||||||
|
ret = !_currentSettings.empty() && settings != _currentSettings;
|
||||||
|
_currentSettings = settings;
|
||||||
|
SetVariableValue(settings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
obs_source_release(filterSource);
|
bool MacroConditionFilter::CheckCondition()
|
||||||
|
{
|
||||||
|
auto filters = _filter.GetFilters(_source);
|
||||||
|
if (filters.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ret = true;
|
||||||
|
for (const auto &filter : filters) {
|
||||||
|
ret = ret && CheckConditionHelper(filter);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetVariableValue().empty()) {
|
if (GetVariableValue().empty()) {
|
||||||
SetVariableValue(ret ? "true" : "false");
|
SetVariableValue(ret ? "true" : "false");
|
||||||
@@ -95,8 +114,8 @@ std::string MacroConditionFilter::GetShortDesc() const
|
|||||||
|
|
||||||
static inline void populateConditionSelection(QComboBox *list)
|
static inline void populateConditionSelection(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : filterConditionTypes) {
|
for (const auto &[_, name] : filterConditionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(name.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,19 +213,20 @@ void MacroConditionFilterEdit::ConditionChanged(int index)
|
|||||||
auto lock = LockContext();
|
auto lock = LockContext();
|
||||||
_entryData->_condition =
|
_entryData->_condition =
|
||||||
static_cast<MacroConditionFilter::Condition>(index);
|
static_cast<MacroConditionFilter::Condition>(index);
|
||||||
SetSettingsSelectionVisible(_entryData->_condition ==
|
SetSettingsSelectionVisible(
|
||||||
MacroConditionFilter::Condition::SETTINGS);
|
_entryData->_condition ==
|
||||||
|
MacroConditionFilter::Condition::SETTINGS_MATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionFilterEdit::GetSettingsClicked()
|
void MacroConditionFilterEdit::GetSettingsClicked()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData ||
|
if (_loading || !_entryData ||
|
||||||
!_entryData->_filter.GetFilter(_entryData->_source)) {
|
_entryData->_filter.GetFilters(_entryData->_source).empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString json = FormatJsonString(GetSourceSettings(
|
QString json = FormatJsonString(GetSourceSettings(
|
||||||
_entryData->_filter.GetFilter(_entryData->_source)));
|
_entryData->_filter.GetFilters(_entryData->_source).at(0)));
|
||||||
if (_entryData->_regex.Enabled()) {
|
if (_entryData->_regex.Enabled()) {
|
||||||
json = EscapeForRegex(json);
|
json = EscapeForRegex(json);
|
||||||
}
|
}
|
||||||
@@ -259,8 +279,9 @@ void MacroConditionFilterEdit::UpdateEntryData()
|
|||||||
_conditions->setCurrentIndex(static_cast<int>(_entryData->_condition));
|
_conditions->setCurrentIndex(static_cast<int>(_entryData->_condition));
|
||||||
_settings->setPlainText(_entryData->_settings);
|
_settings->setPlainText(_entryData->_settings);
|
||||||
_regex->SetRegexConfig(_entryData->_regex);
|
_regex->SetRegexConfig(_entryData->_regex);
|
||||||
SetSettingsSelectionVisible(_entryData->_condition ==
|
SetSettingsSelectionVisible(
|
||||||
MacroConditionFilter::Condition::SETTINGS);
|
_entryData->_condition ==
|
||||||
|
MacroConditionFilter::Condition::SETTINGS_MATCH);
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|||||||