Compare commits

..

3 Commits

Author SHA1 Message Date
WarmUpTill
4c977a2e2f Add "None" support for scene items to Transition action 2026-06-25 21:25:48 +02:00
WarmUpTill
0f1273ab4c Add support for "None" transition type to scene item visibility action 2026-06-25 21:18:57 +02:00
WarmUpTill
67f6b1b459 Add "current transition" support to scene item visibility action 2026-06-25 20:59:36 +02:00
143 changed files with 3378 additions and 9325 deletions

View File

@@ -8,7 +8,6 @@ package 'libcurl4-openssl-dev'
package 'libxtst-dev'
package 'libxss-dev'
package 'libopencv-dev'
package 'libopencv-contrib-dev'
package 'libtesseract-dev'
package 'libproc2-dev'
package 'libusb-1.0-0-dev'

View File

@@ -284,56 +284,30 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
case ${host_os} {
macos)
local opencv_dir="${project_root}/deps/opencv"
local opencv_contrib_dir="${project_root}/deps/opencv_contrib"
local opencv_install_x86="${opencv_dir}/install_x86_64"
local opencv_install_arm="${opencv_dir}/install_arm64"
local opencv_build_dir="${opencv_dir}/build_${target##*-}"
local -a opencv_cmake_args_common=(
local -a opencv_cmake_args=(
-DCMAKE_BUILD_TYPE=Release
-DBUILD_LIST=core,imgproc,objdetect,xobjdetect,dnn
-DOPENCV_EXTRA_MODULES_PATH="${opencv_contrib_dir}/modules"
-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}"
-DWITH_KLEIDICV=OFF
-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} ${opencv_cmake_args}
log_info "Configure OpenCV (x86_64) ..."
cmake -S . -B build_x86_64 ${opencv_cmake_args_common} \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_PROJECT_INCLUDE="${SCRIPT_HOME}/opencv-force-processor-x86_64.cmake" \
-DCMAKE_INSTALL_PREFIX="${opencv_install_x86}" \
-DWITH_IPP=OFF
log_info "Building OpenCV ..."
cmake --build ${opencv_build_dir} --config Release
log_info "Building OpenCV (x86_64) ..."
cmake --build build_x86_64 --config Release
log_info "Installing OpenCV (x86_64) ..."
cmake --install build_x86_64 --prefix "${opencv_install_x86}" --config Release || true
log_info "Configure OpenCV (arm64) ..."
cmake -S . -B build_arm64 ${opencv_cmake_args_common} \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_INSTALL_PREFIX="${opencv_install_arm}"
log_info "Building OpenCV (arm64) ..."
cmake --build build_arm64 --config Release
log_info "Installing OpenCV (arm64) ..."
cmake --install build_arm64 --prefix "${opencv_install_arm}" --config Release || true
log_info "Merging OpenCV into universal binaries ..."
cp -R "${opencv_install_arm}/." "${advss_dep_path}"
for arm_lib in ${opencv_install_arm}/lib/**/*.(dylib|a)(.); do
local rel="${arm_lib#${opencv_install_arm}/}"
local x86_lib="${opencv_install_x86}/${rel}"
if [[ -f "${x86_lib}" ]]; then
lipo -create "${x86_lib}" "${arm_lib}" -output "${advss_dep_path}/${rel}"
fi
done
rm -rf "${opencv_install_x86}" "${opencv_install_arm}"
log_info "Installing OpenCV ..."
cmake --install ${opencv_build_dir} --prefix "${advss_dep_path}" --config Release || true
popd
local leptonica_dir="${project_root}/deps/leptonica"
@@ -345,7 +319,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
-DSW_BUILD=OFF
-DOPENJPEG_SUPPORT=OFF
-DENABLE_WEBP=OFF
-DLIBWEBP_SUPPORT=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_GIF=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_JPEG=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=TRUE

View File

@@ -259,7 +259,7 @@ ${_usage_host:-}"
cmake --build build_${target##*-} --config ${config} -t package ${cmake_args}
# Mark certain deps as optional
build-aux/CI/linux/demote-deps.sh ${project_root}/release/*.deb Recommends '(mqtt)|(opencv)|(tesseract)|(usb)|(x11)|(libobs)'
build-aux/CI/linux/demote-deps.sh ${project_root}/release/*.deb Recommends '(mqtt)|(opencv)|(tesseract)|(usb)|(x11)'
if [ ! -e ${project_root}/release/${output_name}.deb ]; then
mv ${project_root}/release/*.deb ${project_root}/release/${output_name}.deb

View File

@@ -106,7 +106,6 @@ function Build {
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/${OutDirName})"
$OpenCVPath = "${ProjectRoot}/deps/opencv"
$OpenCVContribPath = "${ProjectRoot}/deps/opencv_contrib"
$OpenCVBuildPath = "${OpenCVPath}/build"
Push-Location -Stack BuildOpenCVTemp
@@ -116,8 +115,7 @@ function Build {
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
"-DBUILD_LIST=core,imgproc,objdetect,xobjdetect"
"-DOPENCV_EXTRA_MODULES_PATH:PATH=${OpenCVContribPath}/modules"
"-DBUILD_LIST=core,imgproc,objdetect"
)
Log-Information "Configuring OpenCV..."

View File

@@ -96,25 +96,25 @@ function Package {
Log-Group
# --- Legacy zip (old layout, extract to OBS install directory) ---
Log-Group "Archiving ${ProductName} (portable)..."
$PortableStaging = "${ProjectRoot}/release/zip-staging-portable"
Remove-Item -Path $PortableStaging -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $PortableStaging | Out-Null
Copy-Item -Path "${CIWindowsDir}/README-portable.txt" -Destination "${PortableStaging}/README.txt"
Log-Group "Archiving ${ProductName} (legacy)..."
$LegStaging = "${ProjectRoot}/release/zip-staging-leg"
Remove-Item -Path $LegStaging -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $LegStaging | Out-Null
Copy-Item -Path "${CIWindowsDir}/README-legacy.txt" -Destination "${LegStaging}/README.txt"
if ( Test-Path -Path $NewBinPath ) {
$PortableBinPath = "${PortableStaging}/obs-plugins/64bit"
New-Item -ItemType Directory -Force -Path $PortableBinPath | Out-Null
Copy-Item -Path "${NewBinPath}/*" -Destination $PortableBinPath -Recurse -Force
$LegBinPath = "${LegStaging}/obs-plugins/64bit"
New-Item -ItemType Directory -Force -Path $LegBinPath | Out-Null
Copy-Item -Path "${NewBinPath}/*" -Destination $LegBinPath -Recurse -Force
}
if ( Test-Path -Path $NewDataPath ) {
$PortableDataPath = "${PortableStaging}/data/obs-plugins/${ProductName}"
New-Item -ItemType Directory -Force -Path $PortableDataPath | Out-Null
Copy-Item -Path "${NewDataPath}/*" -Destination $PortableDataPath -Recurse -Force
$LegDataPath = "${LegStaging}/data/obs-plugins/${ProductName}"
New-Item -ItemType Directory -Force -Path $LegDataPath | Out-Null
Copy-Item -Path "${NewDataPath}/*" -Destination $LegDataPath -Recurse -Force
}
Compress-Archive -Force -Path (Get-ChildItem -Path $PortableStaging) `
Compress-Archive -Force -Path (Get-ChildItem -Path $LegStaging) `
-CompressionLevel Optimal `
-DestinationPath "${ProjectRoot}/release/${OutputName}-portable.zip"
Remove-Item -Path $PortableStaging -Recurse -Force
-DestinationPath "${ProjectRoot}/release/${OutputName}-legacy.zip"
Remove-Item -Path $LegStaging -Recurse -Force
Log-Group
if ( ( $BuildInstaller ) ) {
@@ -137,12 +137,12 @@ function Package {
# Legacy layout (for OBS installation directory)
if ( Test-Path "${Configuration}/${ProductName}/bin/64bit" ) {
$PkgLegBin = "Package/portable/obs-plugins/64bit"
$PkgLegBin = "Package/legacy/obs-plugins/64bit"
New-Item -ItemType Directory -Force -Path $PkgLegBin | Out-Null
Copy-Item -Path "${Configuration}/${ProductName}/bin/64bit/*" -Destination $PkgLegBin -Recurse -Force
}
if ( Test-Path "${Configuration}/${ProductName}/data" ) {
$PkgLegData = "Package/portable/data/obs-plugins/${ProductName}"
$PkgLegData = "Package/legacy/data/obs-plugins/${ProductName}"
New-Item -ItemType Directory -Force -Path $PkgLegData | Out-Null
Copy-Item -Path "${Configuration}/${ProductName}/data/*" -Destination $PkgLegData -Recurse -Force
}

View File

@@ -1,7 +0,0 @@
# Injected via CMAKE_PROJECT_INCLUDE after opencv's project() call. Forces
# CMAKE_SYSTEM_PROCESSOR into the cache so that third-party subdirectories
# (mlas) that read the cache directly see x86_64 instead of the arm64 host
# processor on Apple Silicon CI runners.
set(CMAKE_SYSTEM_PROCESSOR
x86_64
CACHE INTERNAL "" FORCE)

View File

@@ -35,21 +35,14 @@ if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
sudo apt-get install ${apt_args} gcc-${${target##*-}//_/-}-linux-gnu g++-${${target##*-}//_/-}-linux-gnu
}
local dist_version
read -r dist_version <<< "$(source /etc/os-release; print "${VERSION_ID}")"
sudo add-apt-repository --yes ppa:obsproject/obs-studio
sudo apt update
# The OBS PPA may not yet support newer Ubuntu versions.
# On those, use the native obs-studio packages and install libobs-dev separately,
# as it is not bundled in obs-studio itself on newer Ubuntu releases.
local -a obs_packages=(build-essential libgles2-mesa-dev libsimde-dev obs-studio)
if is-at-least 26.04 ${dist_version}; then
obs_packages+=(libobs-dev)
else
sudo add-apt-repository --yes ppa:obsproject/obs-studio
sudo apt update
fi
sudo apt-get install ${apt_args} ${obs_packages}
sudo apt-get install ${apt_args} \
build-essential \
libgles2-mesa-dev \
libsimde-dev \
obs-studio
local -a _qt_packages=()

View File

@@ -6,7 +6,7 @@ on:
description: "Project name detected by parsing build spec file"
value: ${{ jobs.check-event.outputs.pluginName }}
env:
DEP_DIR: .deps/advss-build-dependencies-6
DEP_DIR: .deps/advss-build-dependencies-5
jobs:
check-event:
name: Check GitHub Event Data 🔎
@@ -213,17 +213,6 @@ jobs:
- name: Set up Homebrew 🍺
uses: Homebrew/actions/setup-homebrew@main
- name: Install Vulkan SDK 🌋
shell: bash
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc \
| sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list \
https://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list
sudo apt-get update -qq
sudo apt-get install -y vulkan-sdk
echo "VULKAN_SDK=/usr" >> "$GITHUB_ENV"
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
@@ -249,14 +238,6 @@ jobs:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-sources-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-source.*
- name: Rename artifacts for Ubuntu 24 🏷️
run: |
: Rename artifacts for Ubuntu 24 🏷️
for f in ${{ github.workspace }}/release/*-x86_64-linux-gnu.*; do
[ -e "${f}" ] || continue
mv "${f}" "${f/x86_64-linux-gnu/x86_64-ubuntu24.04-linux-gnu}"
done
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v7
with:
@@ -271,85 +252,6 @@ jobs:
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-x86_64*-dbgsym.ddeb
if-no-files-found: ignore
ubuntu-26-build:
name: Build for Ubuntu 26 🐧
runs-on: ubuntu-26.04
needs: check-event
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Set Up Environment 🔧
id: setup
run: |
: Set Up Environment 🔧
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
git_tag="$(git describe --tags)"
read -r product_name product_version <<< \
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
echo "pluginVersion=${git_tag}" >> $GITHUB_OUTPUT
- uses: actions/cache@v5
id: ccache-cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-x86_64-${{ needs.check-event.outputs.config }}
restore-keys: |
${{ runner.os }}-ccache-x86_64-
- name: Set up Homebrew 🍺
uses: Homebrew/actions/setup-homebrew@main
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
target: x86_64
config: ${{ needs.check-event.outputs.config }}
- name: Run tests
uses: ./.github/actions/run-tests
with:
target: x86_64
config: ${{ needs.check-event.outputs.config }}
- name: Package Plugin 📀
uses: ./.github/actions/package-plugin
with:
package: ${{ fromJSON(needs.check-event.outputs.package) }}
target: x86_64
config: ${{ needs.check-event.outputs.config }}
- name: Rename artifacts for Ubuntu 26 🏷️
run: |
: Rename artifacts for Ubuntu 26 🏷️
for f in ${{ github.workspace }}/release/*-x86_64-linux-gnu.*; do
[ -e "${f}" ] || continue
mv "${f}" "${f/x86_64-linux-gnu/x86_64-ubuntu26.04-linux-gnu}"
done
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v7
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-26.04-x86_64-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-x86_64*.*
- name: Upload debug symbol artifacts 🪲
uses: actions/upload-artifact@v7
if: ${{ fromJSON(needs.check-event.outputs.package) }}
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-26.04-x86_64-${{ needs.check-event.outputs.commitHash }}-dbgsym
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-x86_64*-dbgsym.ddeb
if-no-files-found: ignore
windows-build:
name: Build for Windows 🪟
runs-on: windows-2022
@@ -385,12 +287,6 @@ jobs:
target: x64
config: ${{ needs.check-event.outputs.config }}
- name: Install Vulkan SDK 🌋
uses: jakoch/install-vulkan-sdk-action@v1
with:
install_runtime: false
cache: true
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:

View File

@@ -78,7 +78,6 @@ jobs:
'windows-x64;zip|exe'
'macos-universal;tar.xz|pkg'
'ubuntu-24.04-x86_64;tar.xz|deb|ddeb'
'ubuntu-26.04-x86_64;tar.xz|deb|ddeb'
'sources;tar.xz'
)

9
.gitmodules vendored
View File

@@ -28,15 +28,12 @@
[submodule "deps/libusb"]
path = deps/libusb
url = https://github.com/libusb/libusb.git
[submodule "deps/date"]
path = deps/date
url = https://github.com/HowardHinnant/date.git
[submodule "deps/jsoncons"]
path = deps/jsoncons
url = https://github.com/danielaparker/jsoncons.git
[submodule "deps/paho.mqtt.cpp"]
path = deps/paho.mqtt.cpp
url = https://github.com/eclipse-paho/paho.mqtt.cpp.git
[submodule "deps/opencv_contrib"]
path = deps/opencv_contrib
url = https://github.com/opencv/opencv_contrib.git
[submodule "deps/whisper.cpp"]
path = deps/whisper.cpp
url = https://github.com/ggml-org/whisper.cpp.git

View File

@@ -16,14 +16,6 @@ if(BUILD_OUT_OF_TREE)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake"
NO_POLICY_SCOPE)
include(compilerconfig)
# OPENSSL_USE_STATIC_LIBS here ensures FindOpenSSL picks up the static libs
# preventing DLL name collisions with other plugins (e.g.NVIDIA AR SDK).
if(OS_WINDOWS)
set(OPENSSL_USE_STATIC_LIBS
ON
CACHE BOOL "Use static OpenSSL" FORCE)
include(cmake/windows/wingetssl.cmake)
endif()
include(defaults)
include(helpers)
endif()
@@ -42,6 +34,11 @@ include(cmake/common/get_git_revision_description.cmake)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
git_describe(GIT_TAG)
# Helper for OpenSSL
if(OS_WINDOWS)
include(cmake/windows/wingetssl.cmake)
endif()
if(${GIT_TAG} STREQUAL "GIT-NOTFOUND")
set(GIT_TAG ${PROJECT_VERSION})
endif()
@@ -107,8 +104,6 @@ target_sources(
lib/macro/macro-action-edit.hpp
lib/macro/macro-action-factory.cpp
lib/macro/macro-action-factory.hpp
lib/macro/macro-action-loop.cpp
lib/macro/macro-action-loop.hpp
lib/macro/macro-action-macro.cpp
lib/macro/macro-action-macro.hpp
lib/macro/macro-action-queue.cpp
@@ -214,13 +209,6 @@ target_sources(
lib/utils/filter-combo-box.hpp
lib/utils/first-run-wizard.cpp
lib/utils/first-run-wizard.hpp
lib/utils/first-run-wizard-audio.cpp
lib/utils/first-run-wizard-audio.hpp
lib/utils/first-run-wizard-helpers.hpp
lib/utils/first-run-wizard-sequence.cpp
lib/utils/first-run-wizard-sequence.hpp
lib/utils/first-run-wizard-window.cpp
lib/utils/first-run-wizard-window.hpp
lib/utils/help-icon.hpp
lib/utils/help-icon.cpp
lib/utils/item-selection-helpers.cpp
@@ -303,10 +291,6 @@ target_sources(
lib/utils/volume-control.hpp
lib/utils/websocket-api.cpp
lib/utils/websocket-api.hpp
lib/variables/variable-color-button.cpp
lib/variables/variable-color-button.hpp
lib/variables/variable-color.cpp
lib/variables/variable-color.hpp
lib/variables/variable-line-edit.cpp
lib/variables/variable-line-edit.hpp
lib/variables/variable-number.hpp
@@ -379,9 +363,6 @@ set_target_properties(${LIB_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_compile_features(${LIB_NAME} PUBLIC cxx_std_17)
target_precompile_headers(${LIB_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/lib/pch.hpp")
target_include_directories(
${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/obs-websocket/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk")
@@ -559,59 +540,3 @@ else()
set_target_properties_obs(${PROJECT_NAME} PROPERTIES PREFIX "")
endif()
endif()
# --- Install third-party dependency licenses ---
#
# Each entry is "display-name:path/to/license/file" relative to deps/. Files are
# silently skipped when a submodule is not checked out.
set(_dep_license_files
"asio:asio/asio/LICENSE_1_0.txt"
"cpp-httplib:cpp-httplib/LICENSE"
"json:json/LICENSE.MIT"
"jsoncons:jsoncons/LICENSE"
"leptonica:leptonica/leptonica-license.txt"
"libremidi:libremidi/LICENSE.md"
"libusb:libusb/COPYING"
"opencv:opencv/LICENSE"
"openvr:openvr/LICENSE"
"paho-mqtt:paho.mqtt.cpp/LICENSE"
"tesseract:tesseract/LICENSE"
"websocketpp:websocketpp/COPYING"
"whisper:whisper.cpp/LICENSE")
if(DEB_INSTALL)
if(NOT DATA_OUT_DIR)
set(DATA_OUT_DIR "/share/obs/obs-plugins/${PROJECT_NAME}")
endif()
set(_license_dest "${CMAKE_INSTALL_PREFIX}/${DATA_OUT_DIR}/licenses")
elseif(OS_MACOS)
# macOS: license files become bundle Resources/licenses/* entries
set(_license_dest "")
else()
# Windows and non-DEB Linux: alongside the plugin's data directory
set(_license_dest "${CMAKE_PROJECT_NAME}/data/licenses")
endif()
foreach(_entry IN LISTS _dep_license_files)
string(REGEX MATCH "^([^:]+):(.+)$" _m "${_entry}")
set(_dep_name "${CMAKE_MATCH_1}")
set(_dep_file "${CMAKE_CURRENT_SOURCE_DIR}/deps/${CMAKE_MATCH_2}")
if(NOT EXISTS "${_dep_file}")
continue()
endif()
if(OS_MACOS)
# Copy to binary dir so we can give the file a clean name
set(_staged "${CMAKE_CURRENT_BINARY_DIR}/licenses/LICENSE-${_dep_name}")
configure_file("${_dep_file}" "${_staged}" COPYONLY)
target_sources(${PROJECT_NAME} PRIVATE "${_staged}")
set_source_files_properties("${_staged}" PROPERTIES MACOSX_PACKAGE_LOCATION
"Resources/licenses")
else()
install(
FILES "${_dep_file}"
DESTINATION "${_license_dest}"
RENAME "LICENSE-${_dep_name}")
endif()
endforeach()

View File

@@ -1,11 +1,11 @@
Advanced Scene Switcher - Windows Installation (Portable)
==========================================================
Advanced Scene Switcher - Windows Installation (Legacy)
========================================================
For full installation instructions visit:
https://github.com/WarmUpTill/SceneSwitcher/wiki/Installation
This archive uses the portable plugin layout for older OBS versions,
This archive uses the legacy plugin layout for older OBS versions,
portable OBS installs, and Steam.
Extract the CONTENTS of this archive into your OBS installation directory,

View File

@@ -17,5 +17,5 @@ After extracting, the path should look like:
C:\ProgramData\obs-studio\plugins\advanced-scene-switcher\bin\64bit\advanced-scene-switcher.dll
If the plugin does not appear in OBS, try the portable archive instead:
advanced-scene-switcher-<version>-windows-x64-portable.zip
If the plugin does not appear in OBS, try the legacy archive instead:
advanced-scene-switcher-<version>-windows-x64-legacy.zip

View File

@@ -333,8 +333,6 @@ function(setup_advss_plugin target)
PRIVATE "${ADVSS_SOURCE_DIR}/lib" "${ADVSS_SOURCE_DIR}/lib/legacy"
"${ADVSS_SOURCE_DIR}/lib/macro" "${ADVSS_SOURCE_DIR}/lib/utils"
"${ADVSS_SOURCE_DIR}/lib/variables" "${ADVSS_SOURCE_DIR}/forms")
target_precompile_headers(${target} PRIVATE "${ADVSS_SOURCE_DIR}/lib/pch.hpp")
endfunction()
function(install_advss_plugin_dependency)

View File

@@ -191,21 +191,14 @@ function(_check_dependencies)
foreach(i RANGE 1 ${MAX_DOWNLOAD_RETRIES})
message(STATUS "Attempt ${i}/${MAX_DOWNLOAD_RETRIES} for ${url}")
file(DOWNLOAD "${url}" "${dependencies_dir}/${file}"
STATUS download_status)
file(
DOWNLOAD "${url}" "${dependencies_dir}/${file}"
STATUS download_status
EXPECTED_HASH SHA256=${hash})
list(GET download_status 0 error_code)
list(GET download_status 1 error_message)
if(error_code EQUAL 0)
file(SHA256 "${dependencies_dir}/${file}" actual_hash)
if(NOT actual_hash STREQUAL hash)
set(error_code 1)
set(error_message
"hash mismatch (expected ${hash}, got ${actual_hash})")
endif()
endif()
if(error_code EQUAL 0)
message(STATUS "Downloading ${url} - success on attempt ${i}")
set(download_success TRUE)

View File

@@ -22,7 +22,6 @@ set(CPACK_GENERATOR
"DEB"
CACHE STRING "CPack generator to use")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "obs-studio")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${PLUGIN_EMAIL}")
set(CPACK_SET_DESTDIR ON)

View File

@@ -33,7 +33,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
; Recommended layout - used when installing to %ProgramData%\obs-studio\plugins\
Source: "..\release\Package\recommended\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsRecommendedLayout
; Legacy layout - used when installing to the OBS installation directory
Source: "..\release\Package\portable\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsLegacyLayout
Source: "..\release\Package\legacy\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsLegacyLayout
Source: "..\LICENSE"; Flags: dontcopy
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
@@ -88,9 +88,9 @@ begin
Result := PrevPath;
end;
// Remove files placed by the portable installer (obs-plugins/64bit and
// Remove files placed by the legacy installer (obs-plugins/64bit and
// data/obs-plugins layout) so the plugin is not loaded twice by OBS.
// Only runs when upgrading from a portable location to the recommended one.
// Only runs when upgrading from a legacy location to the recommended one.
procedure RemoveLegacyFiles();
var
OldInstallPath: string;

View File

@@ -40,27 +40,19 @@ if(WIN32 AND (NOT OpenSSL_FOUND))
message(STATUS "Looking for OpenSSL built with CRT variant: ${_crt_kind}")
# Try to find the root and corresponding lib path
if(OPENSSL_USE_STATIC_LIBS)
set(_crypto_lib_name "libcrypto_static.lib")
set(_ssl_lib_name "libssl_static.lib")
else()
set(_crypto_lib_name "libcrypto.lib")
set(_ssl_lib_name "libssl.lib")
endif()
foreach(_root ${_openssl_roots})
if(EXISTS "${_root}/include/openssl/ssl.h")
foreach(_suffix ${_openssl_lib_suffixes})
if(_suffix MATCHES "${_crt_kind}$"
AND EXISTS "${_root}/${_suffix}/${_crypto_lib_name}")
AND EXISTS "${_root}/${_suffix}/libcrypto.lib")
set(OPENSSL_ROOT_DIR
"${_root}"
CACHE PATH "Path to OpenSSL root")
set(OPENSSL_CRYPTO_LIBRARY
"${_root}/${_suffix}/${_crypto_lib_name}"
"${_root}/${_suffix}/libcrypto.lib"
CACHE FILEPATH "OpenSSL crypto lib")
set(OPENSSL_SSL_LIBRARY
"${_root}/${_suffix}/${_ssl_lib_name}"
"${_root}/${_suffix}/libssl.lib"
CACHE FILEPATH "OpenSSL ssl lib")
set(OPENSSL_INCLUDE_DIR
"${_root}/include"

View File

@@ -382,8 +382,8 @@ AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Warten, bis der Übergan
AdvSceneSwitcher.action.wait="Warten"
AdvSceneSwitcher.action.wait.type.fixed="fixe"
AdvSceneSwitcher.action.wait.type.random="zufällig"
AdvSceneSwitcher.action.wait.layout.fixed="Warte für {{waitType}} Dauer von {{duration}}"
AdvSceneSwitcher.action.wait.layout.random="Warte für {{waitType}} Dauer von {{duration}} bis {{duration2}}"
AdvSceneSwitcher.action.wait.entry.fixed="Warte für {{waitType}} Dauer von {{duration}}"
AdvSceneSwitcher.action.wait.entry.random="Warte für {{waitType}} Dauer von {{duration}} bis {{duration2}}"
AdvSceneSwitcher.action.audio="Audio"
AdvSceneSwitcher.action.audio.type.mute="Stummgeschaltet"
AdvSceneSwitcher.action.audio.type.unmute="Nicht stummgeschaltet"

View File

@@ -206,8 +206,6 @@ AdvSceneSwitcher.macroTab.expandAllGroups="Expand all Groups"
AdvSceneSwitcher.macroTab.collapseAllGroups="Collapse all Groups"
AdvSceneSwitcher.macroTab.rename="Rename"
AdvSceneSwitcher.macroTab.remove="Remove"
AdvSceneSwitcher.macroTab.pause="Pause"
AdvSceneSwitcher.macroTab.unpause="Unpause"
AdvSceneSwitcher.macroTab.export="Export"
AdvSceneSwitcher.macroTab.export.info="Paste the string below into the import dialog to import the selected macros:"
AdvSceneSwitcher.macroTab.export.usePlainText="Use plain text"
@@ -446,7 +444,6 @@ AdvSceneSwitcher.condition.video.ocrConfigReload="Reload configuration file"
AdvSceneSwitcher.condition.video.ocrConfigHint="Tesseract config files consist of lines with parameter-value pairs (space separated).\nFor example:\n\ntessedit_char_blacklist\t\t\t\t\"abc\"\nlanguage_model_penalty_non_dict_word\t0"
AdvSceneSwitcher.condition.video.modelLoadFail="Model data could not be loaded!"
AdvSceneSwitcher.condition.video.selectColor="Select Color"
AdvSceneSwitcher.condition.video.colorVariableTooltip="Expected format: #RRGGBB or #AARRGGBB\nInvalid values will default to black."
AdvSceneSwitcher.condition.video.ocrMode.singleColumn="Single column of text of variable sizes"
AdvSceneSwitcher.condition.video.ocrMode.singleBlockVertText="Single uniform block of vertically aligned text"
AdvSceneSwitcher.condition.video.ocrMode.singleBlock="Single uniform block of text"
@@ -470,12 +467,12 @@ AdvSceneSwitcher.condition.video.layout.minNeighbor="Minimum neighbors:{{minNeig
AdvSceneSwitcher.condition.video.layout.throttle="{{throttleEnable}}Reduce CPU load by performing check only every{{throttleCount}}milliseconds"
AdvSceneSwitcher.condition.video.layout.checkAreaEnable="Perform check only in area"
AdvSceneSwitcher.condition.video.layout.checkArea="{{checkAreaEnable}}{{checkArea}}{{selectArea}}"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="Check for text color:{{color}}"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="Check for text color:{{textColor}}{{selectColor}}"
AdvSceneSwitcher.condition.video.layout.ocrTextType="Check for text type:{{textType}}"
AdvSceneSwitcher.condition.video.layout.ocrBaseDir="Tesseract base directory:{{tesseractBaseDir}}"
AdvSceneSwitcher.condition.video.layout.ocrLanguage="Check for language:{{languageCode}}"
AdvSceneSwitcher.condition.video.layout.ocrConfig="Config file:{{configFile}}{{openConfigFile}}{{reloadConfig}}{{configFileHint}}"
AdvSceneSwitcher.condition.video.layout.color="Check for color:{{color}}"
AdvSceneSwitcher.condition.video.layout.color="Check for color:{{color}}{{selectColor}}"
AdvSceneSwitcher.condition.video.minSize="Minimum size:"
AdvSceneSwitcher.condition.video.maxSize="Maximum size:"
AdvSceneSwitcher.condition.video.selectArea="Select area"
@@ -840,38 +837,6 @@ AdvSceneSwitcher.condition.clipboard.condition.isImage="Clipboard contains an im
AdvSceneSwitcher.condition.clipboard.condition.isURL="Clipboard contains an URL"
AdvSceneSwitcher.condition.clipboard.condition.matches="Clipboard content matches"
AdvSceneSwitcher.condition.clipboard.condition.entry="{{conditions}}{{regex}}{{urlInfo}}"
AdvSceneSwitcher.condition.speech="Speech Recognition (beta)"
AdvSceneSwitcher.condition.speech.condition.any="Any speech is detected for"
AdvSceneSwitcher.condition.speech.condition.contains="contains phrase"
AdvSceneSwitcher.condition.speech.condition.matches="matches"
AdvSceneSwitcher.condition.speech.layout.any="{{conditions}}{{source}}"
AdvSceneSwitcher.condition.speech.layout.contains="Transcript of{{source}}{{conditions}}:"
AdvSceneSwitcher.condition.speech.layout.matches="Transcript of{{source}}{{conditions}}:"
AdvSceneSwitcher.condition.speech.layout.phrase="{{phrase}}{{regex}}"
AdvSceneSwitcher.condition.speech.layout.model="Whisper model:{{modelPath}}{{help}}"
AdvSceneSwitcher.condition.speech.model.help="GGML model files can be downloaded from https://huggingface.co/ggerganov/whisper.cpp (e.g. ggml-base.bin).\nLarger models are more accurate but slower."
AdvSceneSwitcher.condition.speech.layout.buffer="Audio buffer:{{bufferDuration}}{{help}}"
AdvSceneSwitcher.condition.speech.browse="Browse..."
AdvSceneSwitcher.condition.speech.browse.title="Select Whisper model file"
AdvSceneSwitcher.condition.speech.browse.filter="GGML model files (*.bin);;All files (*)"
AdvSceneSwitcher.condition.speech.buffer.help="Longer buffer durations improve accuracy but increase latency."
AdvSceneSwitcher.condition.speech.advanced="Advanced"
AdvSceneSwitcher.condition.speech.layout.advanced.threads="Threads:{{threads}}"
AdvSceneSwitcher.condition.speech.layout.advanced.language="Language:{{language}}{{help}}"
AdvSceneSwitcher.condition.speech.advanced.language.help="Whisper language code (e.g. 'en', 'de', 'fr') or 'auto' to detect automatically."
AdvSceneSwitcher.condition.speech.layout.advanced.translate="{{translate}}{{help}}"
AdvSceneSwitcher.condition.speech.advanced.translate="Translate to English"
AdvSceneSwitcher.condition.speech.advanced.translate.help="Translate non-English speech to English before transcribing.\nUseful when the phrase or regex is written in English but the source speaks another language."
AdvSceneSwitcher.condition.speech.layout.advanced.vad="VAD energy threshold:{{vad}}{{help}}"
AdvSceneSwitcher.condition.speech.advanced.vad.help="Minimum RMS energy a buffer must have before running inference. Buffers below this level are treated as silence and skipped. Lower values are more sensitive; raise it if inference triggers on background noise."
AdvSceneSwitcher.condition.speech.layout.advanced.suppress="{{suppress}}{{help}}"
AdvSceneSwitcher.condition.speech.advanced.suppress="Suppress non-speech tokens"
AdvSceneSwitcher.condition.speech.advanced.suppress.help="Remove filler tokens such as [MUSIC] or (applause) that Whisper tends to insert when it detects non-speech sounds."
AdvSceneSwitcher.condition.speech.layout.advanced.noContext="{{noContext}}{{help}}"
AdvSceneSwitcher.condition.speech.advanced.noContext="No context"
AdvSceneSwitcher.condition.speech.advanced.noContext.help="Do not feed the previous transcription back as a prompt for the next buffer.\nPrevents repetition across buffer boundaries at the cost of slightly reduced coherence."
AdvSceneSwitcher.condition.speech.advanced.listenWhenMuted="Listen when source is muted"
AdvSceneSwitcher.condition.speech.advanced.useGpu="Use GPU"
AdvSceneSwitcher.condition.folder="Folder watch"
AdvSceneSwitcher.condition.folder.tooltip="This condition type will allow you to monitor the contents of a folder.\nNote that the monitoring will *not* recursively scan for changes in sub directories within directories of the selected folder!\nNote that if there are several changes during a short period of time, some of the changes might not emit this signal.\nHowever, the last change in the sequence of changes always will."
AdvSceneSwitcher.condition.folder.condition.any="Any change happened"
@@ -933,18 +898,8 @@ AdvSceneSwitcher.action.scene.canvasNotSupported="Not supported by the currently
AdvSceneSwitcher.action.wait="Wait"
AdvSceneSwitcher.action.wait.type.fixed="fixed"
AdvSceneSwitcher.action.wait.type.random="random"
AdvSceneSwitcher.action.wait.type.variableCondition="variable"
AdvSceneSwitcher.action.wait.layout.fixed="Wait for{{waitType}}duration of{{duration}}"
AdvSceneSwitcher.action.wait.layout.random="Wait for{{waitType}}duration from{{duration}}to{{duration2}}"
AdvSceneSwitcher.action.wait.condition.equals="equals"
AdvSceneSwitcher.action.wait.condition.doesNotEqual="does not equal"
AdvSceneSwitcher.action.wait.condition.isEmpty="is empty"
AdvSceneSwitcher.action.wait.condition.lessThan="is less than"
AdvSceneSwitcher.action.wait.condition.greaterThan="is greater than"
AdvSceneSwitcher.action.wait.layout.variableCondition="Wait until{{waitType}}{{variable}}{{condition}}{{strValue}}{{numValue}}{{regex}}"
AdvSceneSwitcher.action.wait.layout.timeout="Timeout:{{useTimeout}}{{conditionTimeout}}"
AdvSceneSwitcher.tempVar.wait.timedOut="Timed out"
AdvSceneSwitcher.tempVar.wait.timedOut.description="True if the wait action timed out before the condition was met, false if the condition was met in time"
AdvSceneSwitcher.action.wait.entry.fixed="Wait for{{waitType}}duration of{{duration}}"
AdvSceneSwitcher.action.wait.entry.random="Wait for{{waitType}}duration from{{duration}}to{{duration2}}"
AdvSceneSwitcher.action.audio="Audio"
AdvSceneSwitcher.action.audio.type.mute="Mute"
AdvSceneSwitcher.action.audio.type.unmute="Unmute"
@@ -984,8 +939,7 @@ AdvSceneSwitcher.action.recording.type.changeOutputFileFormat="Change filename f
AdvSceneSwitcher.action.recording.type.addChapter="Add chapter"
AdvSceneSwitcher.action.recording.pause.hint="Note that depending on your recording settings you might not be able to pause recording"
AdvSceneSwitcher.action.recording.split.hint="Make sure to enable automatic file splitting in the OBS settings first!"
AdvSceneSwitcher.action.recording.outputNotActive.hint="This change will only take effect when the Recording, Replay Buffer, ... output is not active.\nThe output needs to be restarted for the change to apply."
AdvSceneSwitcher.action.recording.layout="{{actions}}{{recordFolder}}{{recordFileFormat}}{{outputNotActiveHelp}}{{chapterName}}{{pauseHint}}{{splitHint}}"
AdvSceneSwitcher.action.recording.entry="{{actions}}{{recordFolder}}{{recordFileFormat}}{{chapterName}}{{pauseHint}}{{splitHint}}"
AdvSceneSwitcher.action.replay="Replay buffer"
AdvSceneSwitcher.action.replay.saveWarn="Warning: Saving too frequently might result in the replay buffer not actually being saved!"
AdvSceneSwitcher.action.replay.durationWarn="Warning: Changing the maximum replay time will only apply the next time the replay buffer is started!"
@@ -1016,7 +970,6 @@ AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Any"
AdvSceneSwitcher.action.sceneVisibility.layout="On{{scenes}}{{actions}}{{sources}}"
AdvSceneSwitcher.action.sceneVisibility.layout.transition="{{updateTransition}}Set transition to{{transitions}}"
AdvSceneSwitcher.action.sceneVisibility.layout.duration="{{updateDuration}}Set transition duration to{{duration}}seconds"
AdvSceneSwitcher.action.sceneVisibility.blockUntilTransitionDone="Wait until visibility transition is complete"
AdvSceneSwitcher.action.filter="Filter"
AdvSceneSwitcher.action.filter.type.enable="Enable"
AdvSceneSwitcher.action.filter.type.disable="Disable"
@@ -1028,7 +981,7 @@ AdvSceneSwitcher.action.filter.refresh.tooltip="Repopulate the filter settings s
AdvSceneSwitcher.action.filter.entry="On{{sources}}{{actions}}{{filters}}{{refresh}}{{settingsButtons}}"
AdvSceneSwitcher.action.filter.entry.settings="{{settings}}{{settingsInputMethod}}{{settingValue}}{{tempVar}}"
AdvSceneSwitcher.action.filter.getSettings="Get current settings"
AdvSceneSwitcher.action.filter.inputMethod.individualManual="Set to value"
AdvSceneSwitcher.action.filter.inputMethod.individualManual="Set to fixed value"
AdvSceneSwitcher.action.filter.inputMethod.individualListEntryManual="Set to list entry"
AdvSceneSwitcher.action.filter.inputMethod.individualTempvar="Set to macro property"
AdvSceneSwitcher.action.filter.inputMethod.json="Set setting JSON string"
@@ -1064,7 +1017,7 @@ AdvSceneSwitcher.action.source.deinterlaceMode.yadif="Yadif"
AdvSceneSwitcher.action.source.deinterlaceMode.yadif2x="Yadif 2x"
AdvSceneSwitcher.action.source.deinterlaceOrder.topFieldFirst="Top Field First"
AdvSceneSwitcher.action.source.deinterlaceOrder.bottomFieldFirst="Bottom Field First"
AdvSceneSwitcher.action.source.inputMethod.individualManual="Set to value"
AdvSceneSwitcher.action.source.inputMethod.individualManual="Set to fixed value"
AdvSceneSwitcher.action.source.inputMethod.individualListEntryManual="Set to list entry"
AdvSceneSwitcher.action.source.inputMethod.individualTempvar="Set to macro property"
AdvSceneSwitcher.action.source.inputMethod.json="Set setting JSON string"
@@ -1156,12 +1109,6 @@ AdvSceneSwitcher.action.macro.type.nestedMacro="Nested macro"
AdvSceneSwitcher.action.macro.actionSelectionType.index="at index"
AdvSceneSwitcher.action.macro.actionSelectionType.label="with label"
AdvSceneSwitcher.action.macro.actionSelectionType.id="of action type"
AdvSceneSwitcher.action.loop="Loop"
AdvSceneSwitcher.action.loop.maxIterations="Max iterations"
AdvSceneSwitcher.action.loop.conditionHelp="Define the loop condition. The actions below will be repeated while these conditions are met.\n\nClick the plus button below to add a new condition."
AdvSceneSwitcher.action.loop.actionHelp="Define the actions to perform each iteration.\n\nClick the plus button below to add a new action."
AdvSceneSwitcher.tempVar.loop.count="Iteration count"
AdvSceneSwitcher.tempVar.loop.count.description="The total number of iterations completed."
AdvSceneSwitcher.action.macro.type.nestedMacro.conditionHelp="This section allows you to define macro conditions.\n\nClick the plus button below to add a new condition."
AdvSceneSwitcher.action.macro.type.nestedMacro.actionHelp="This section allows you to define macro actions.\nThe actions in this section will be performed when the conditions are met.\n\nClick the plus button below to add a new action."
AdvSceneSwitcher.action.macro.type.nestedMacro.elseActionHelp="This section allows you to define macro actions.\nThe actions in this section will be performed when the conditions are *not* met.\n\nClick the plus button below to add a new action."
@@ -1341,8 +1288,6 @@ AdvSceneSwitcher.action.variable.type.stringLength="Set to length of string"
AdvSceneSwitcher.action.variable.type.extractJsonField="Extract JSON field with name"
AdvSceneSwitcher.action.variable.type.queryJson="Query JSON"
AdvSceneSwitcher.action.variable.type.queryJson.info="You can use \"JSONPath\" (RFC 9535) syntax here.\nSo, for example:\n\n • $['books'][0]['category']\n • $.books[0].category\n\nIf the query or the JSON should be invalid, the variable value will not be changed.\nIf the input is valid, the result of the query will always be a JSON array."
AdvSceneSwitcher.action.variable.type.queryJson.extractSingle="Extract value if single result"
AdvSceneSwitcher.action.variable.type.queryJson.extractSingle.info="When enabled and the query returns exactly one result, the value is extracted from the result array and stored directly.\nIf the query matches zero or more than one element, the full JSON array is stored as usual."
AdvSceneSwitcher.action.variable.type.accessJsonArray="Access JSON array at index"
AdvSceneSwitcher.action.variable.type.setToTempvar="Set to macro property"
AdvSceneSwitcher.action.variable.type.setToTempvar.help="This action type will allow you to extract values out of segments of the current macro and assign those values to the selected variable.\nFor example, you can get the current scene name from a scene condition and assign this name to a variable."
@@ -1375,7 +1320,6 @@ AdvSceneSwitcher.action.variable.actionNoVariableSupport="Getting variable value
AdvSceneSwitcher.action.variable.conditionNoVariableSupport="Getting variable values from %1 conditions is not supported!"
AdvSceneSwitcher.action.variable.currentSegmentValue="Current value:"
AdvSceneSwitcher.action.variable.layout.other="{{actions}}{{variables}}{{variables2}}{{strValue}}{{numValue}}{{segmentIndex}}{{mathExpression}}{{envVariableName}}{{scenes}}{{tempVars}}{{tempVarsHelp}}{{sceneItemIndex}}{{direction}}{{stringLength}}{{paddingCharSelection}}{{caseType}}{{jsonQuery}}{{jsonQueryHelp}}{{jsonIndex}}"
AdvSceneSwitcher.action.variable.layout.copy="{{actions}}{{variables2}}to{{variables}}"
AdvSceneSwitcher.action.variable.layout.pad="{{actions}}of{{variables}}to length{{stringLength}}by adding{{paddingCharSelection}}to the{{direction}}"
AdvSceneSwitcher.action.variable.layout.truncate="{{actions}}of{{variables}}to length{{stringLength}}by removing characters from the{{direction}}"
AdvSceneSwitcher.action.variable.layout.substringIndex="Substring start:{{subStringStart}}Substring size:{{subStringSize}}{{subStringRegex}}"
@@ -1415,8 +1359,6 @@ AdvSceneSwitcher.action.twitch.type.channel.info.language.set="Set stream langua
AdvSceneSwitcher.action.twitch.type.raid.start="Start raid"
AdvSceneSwitcher.action.twitch.type.raid.end="Cancel raid"
AdvSceneSwitcher.action.twitch.type.shoutout.send="Send shoutout"
AdvSceneSwitcher.action.twitch.type.poll.start="Start poll"
AdvSceneSwitcher.action.twitch.type.poll.end="End poll"
AdvSceneSwitcher.action.twitch.type.shieldMode.start="Enable shield mode"
AdvSceneSwitcher.action.twitch.type.shieldMode.end="Disable shield mode"
AdvSceneSwitcher.action.twitch.type.commercial.start="Start commercial"
@@ -1448,7 +1390,6 @@ AdvSceneSwitcher.action.twitch.type.user.vip.add="Add user as VIP"
AdvSceneSwitcher.action.twitch.type.user.vip.delete="Remove user as VIP"
AdvSceneSwitcher.action.twitch.type.reward.getInfo="Get channel points reward information"
AdvSceneSwitcher.action.twitch.type.channel.getInfo="Get channel information"
AdvSceneSwitcher.action.twitch.type.channel.ads.getInfo="Get channel ad schedule"
AdvSceneSwitcher.action.twitch.reward.toggleControl="Toggle reward name / variable selection control"
AdvSceneSwitcher.action.twitch.categorySelectionDisabled="Cannot select category without selecting a Twitch account first!"
AdvSceneSwitcher.action.twitch.layout.default="On{{account}}{{actions}}{{streamTitle}}{{category}}{{markerDescription}}{{clipHasDelay}}{{duration}}{{announcementColor}}{{nonModDelayDuration}}{{channel}}{{pointsReward}}"
@@ -1462,10 +1403,6 @@ AdvSceneSwitcher.action.twitch.layout.user.ban.row1="Using account{{account}}{{a
AdvSceneSwitcher.action.twitch.layout.user.ban.row2="on channel{{channel}}for{{userInfoQueryType}}{{userLogin}}{{userId}}reason{{banReason}}"
AdvSceneSwitcher.action.twitch.layout.reward.getInfo.row1="Using account{{account}}{{actions}}for channel{{channel}}"
AdvSceneSwitcher.action.twitch.layout.reward.getInfo.row2="{{pointsReward}}{{rewardVariable}}{{toggleRewardSelection}}"
AdvSceneSwitcher.action.twitch.layout.poll.start.row1="Using account{{account}}{{actions}}"
AdvSceneSwitcher.action.twitch.layout.poll.start.row2="on{{channel}}for{{duration}}"
AdvSceneSwitcher.action.twitch.layout.poll.end.row1="Using account{{account}}{{actions}}"
AdvSceneSwitcher.action.twitch.layout.poll.end.row2="on{{channel}}{{pollEndStatus}}"
AdvSceneSwitcher.action.twitch.title.title="Enter title"
AdvSceneSwitcher.action.twitch.marker.description="Describe marker"
AdvSceneSwitcher.action.twitch.clip.hasDelay="Add a slight delay before capturing the clip"
@@ -1475,9 +1412,6 @@ AdvSceneSwitcher.action.twitch.announcement.blue="Blue"
AdvSceneSwitcher.action.twitch.announcement.green="Green"
AdvSceneSwitcher.action.twitch.announcement.orange="Orange"
AdvSceneSwitcher.action.twitch.announcement.purple="Purple"
AdvSceneSwitcher.action.twitch.poll.choices="Enter one choice per line (2-10 choices, max 25 characters each)"
AdvSceneSwitcher.action.twitch.poll.end.terminated="Terminate (show results)"
AdvSceneSwitcher.action.twitch.poll.end.archived="Archive (hide results)"
AdvSceneSwitcher.action.twitch.user.getInfo.queryType.id="User Id"
AdvSceneSwitcher.action.twitch.user.getInfo.queryType.login="User login"
AdvSceneSwitcher.action.twitch.tags.add="Add Channel Tag"
@@ -1662,8 +1596,6 @@ AdvSceneSwitcher.actionQueues.invalid="Invalid action queue selection"
AdvSceneSwitcher.actionQueues.name="Name:"
AdvSceneSwitcher.actionQueues.runOnStartup="Run action queue when starting the plugin"
AdvSceneSwitcher.actionQueues.resolveVariablesOnAdd="Resolve variables when action is inserted into the queue"
AdvSceneSwitcher.actionQueues.cloneVariableContext="Clone variable context when action is inserted into the queue"
AdvSceneSwitcher.actionQueues.cloneVariableContext.tooltip="Captures the current values of all variables when the action is added to the queue.\nDuring execution, actions read from and write to this snapshot instead of the global variables.\nUnlike \"Resolve variables\", changes made by one action in the queue are visible to subsequent actions."
AdvSceneSwitcher.actionQueues.running="Queue is running"
AdvSceneSwitcher.actionQueues.stopped="Queue is stopped"
AdvSceneSwitcher.actionQueues.start="Start action queue"
@@ -1951,10 +1883,8 @@ AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.message="Subscriber Twitch
AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.message.description="The user login of the user who sent a resubscription chat message."
AdvSceneSwitcher.tempVar.twitch.user_name.subscribe.message="Subscriber Twitch user name"
AdvSceneSwitcher.tempVar.twitch.user_name.subscribe.message.description="The user display name of the user who a resubscription chat message."
AdvSceneSwitcher.tempVar.twitch.message.subscribe="Subscription message (JSON)"
AdvSceneSwitcher.tempVar.twitch.message.subscribe.description="A JSON object containing the resubscription message text and emote information. Use 'Subscription message text' to get the plain text."
AdvSceneSwitcher.tempVar.twitch.message_text.subscribe="Subscription message text"
AdvSceneSwitcher.tempVar.twitch.message_text.subscribe.description="The plain text of the resubscription message, with emotes replaced by their names."
AdvSceneSwitcher.tempVar.twitch.message.subscribe="Subscription message"
AdvSceneSwitcher.tempVar.twitch.message.subscribe.description="An object that contains the resubscription message and emote information needed to recreate the message."
AdvSceneSwitcher.tempVar.twitch.cumulative_months.subscribe="Number of months subscribed"
AdvSceneSwitcher.tempVar.twitch.cumulative_months.subscribe.description="The total number of months the user has been subscribed to the channel."
AdvSceneSwitcher.tempVar.twitch.streak_months.subscribe="Subscription streak"
@@ -2343,19 +2273,6 @@ AdvSceneSwitcher.tempVar.twitch.requester_user_login.commercial.description="The
AdvSceneSwitcher.tempVar.twitch.requester_user_name.commercial="Requester user name"
AdvSceneSwitcher.tempVar.twitch.requester_user_name.commercial.description="The display name of the user that requested the ad."
AdvSceneSwitcher.tempVar.twitch.snooze_count.ads="Snooze count"
AdvSceneSwitcher.tempVar.twitch.snooze_count.ads.description="The number of snoozes available for the broadcaster."
AdvSceneSwitcher.tempVar.twitch.snooze_refresh_at.ads="Snooze refresh time"
AdvSceneSwitcher.tempVar.twitch.snooze_refresh_at.ads.description="The UTC timestamp of when the broadcaster will have an additional snooze available, in RFC3339 format."
AdvSceneSwitcher.tempVar.twitch.next_ad_at.ads="Next ad time"
AdvSceneSwitcher.tempVar.twitch.next_ad_at.ads.description="The UTC timestamp of when the channel's next scheduled ad break will begin, in RFC3339 format."
AdvSceneSwitcher.tempVar.twitch.duration.ads="Ad duration"
AdvSceneSwitcher.tempVar.twitch.duration.ads.description="The length in seconds of the scheduled ad break."
AdvSceneSwitcher.tempVar.twitch.last_ad_at.ads="Last ad time"
AdvSceneSwitcher.tempVar.twitch.last_ad_at.ads.description="The UTC timestamp of the channel's last ad break, in RFC3339 format."
AdvSceneSwitcher.tempVar.twitch.preroll_free_time.ads="Pre-roll free time"
AdvSceneSwitcher.tempVar.twitch.preroll_free_time.ads.description="The amount of time in seconds the broadcaster must wait before running another commercial."
AdvSceneSwitcher.tempVar.audio.output_volume="Output volume"
AdvSceneSwitcher.tempVar.audio.output_volume.description="The volume the audio source is outputting."
AdvSceneSwitcher.tempVar.audio.configured_volume="Configured volume"
@@ -2492,9 +2409,6 @@ AdvSceneSwitcher.tempVar.streaming.serviceName.description="The name of the stre
AdvSceneSwitcher.tempVar.clipboard.text="Clipboard text"
AdvSceneSwitcher.tempVar.clipboard.text.description="The text contained in the clipboard.\nWill be empty if the clipboard does not contain text."
AdvSceneSwitcher.tempVar.speech.speech="Transcribed speech"
AdvSceneSwitcher.tempVar.speech.speech.description="The text transcribed from the last audio buffer. Only populated when the condition matched."
AdvSceneSwitcher.tempVar.file.content="File content"
AdvSceneSwitcher.tempVar.file.date="File modification date"
AdvSceneSwitcher.tempVar.file.basename="File basename"
@@ -2632,6 +2546,7 @@ AdvSceneSwitcher.selectCurrentScene="Current Scene"
AdvSceneSwitcher.selectPreviewScene="Preview Scene"
AdvSceneSwitcher.selectAnyScene="Any Scene"
AdvSceneSwitcher.currentTransition="Current Transition"
AdvSceneSwitcher.noneTransition="None"
AdvSceneSwitcher.anyTransition="Any Transition"
AdvSceneSwitcher.selectTransition="--select transition--"
AdvSceneSwitcher.selectWindow="--select window--"
@@ -2761,28 +2676,7 @@ FirstRunWizard.windowTitle="Advanced Scene Switcher - Setup Wizard"
FirstRunWizard.welcome.title="Welcome to Advanced Scene Switcher"
FirstRunWizard.welcome.subtitle="Let's create your first automation in a few easy steps."
FirstRunWizard.welcome.body="<p>Advanced Scene Switcher lets you build <b>Macros</b> - rules of the form:</p><blockquote><i>When [condition] -> perform [action]</i></blockquote><p>This wizard will guide you through creating your first automation. On the next page, choose the type of macro you want to set up.</p><p>You can skip at any time. Re-open this wizard later from the <b>General</b> tab inside the Advanced Scene Switcher dialog.</p>"
FirstRunWizard.template.title="Choose an Automation Type"
FirstRunWizard.template.subtitle="Select the kind of macro you would like to create."
FirstRunWizard.template.window="Switch to a scene when a window comes into focus"
FirstRunWizard.template.sequence="Run a timed sequence of scene switches"
FirstRunWizard.template.audio="Show or hide a source based on audio activity"
FirstRunWizard.audio.source.title="Choose an Audio Source"
FirstRunWizard.audio.source.subtitle="Select the audio source to monitor and configure when it should be considered active."
FirstRunWizard.audio.source.sourceRow="Audio source:{{source}}"
FirstRunWizard.audio.source.thresholdRow="Show when volume is above{{threshold}}for{{duration}}"
FirstRunWizard.audio.target.title="Choose a Target Source"
FirstRunWizard.audio.target.subtitle="Select the source to show when audio is active and hide when it is not."
FirstRunWizard.audio.target.sourceRow="Source to show/hide:{{source}}"
FirstRunWizard.audio.review.title="Review Your Macro"
FirstRunWizard.audio.review.subtitle="Click Back to make changes, or Finish to create the macro."
FirstRunWizard.audio.review.summary="<b>When</b> <i>%1</i> output volume is above <b>%2 dB</b> for <b>%3</b>:<br><br>&nbsp;&nbsp;<b>Show</b> <i>%4</i> on the current scene<br><br><b>Otherwise:</b><br><br>&nbsp;&nbsp;<b>Hide</b> <i>%4</i> on the current scene"
FirstRunWizard.audio.review.errorTitle="Macro Creation Failed"
FirstRunWizard.audio.review.errorBody="The audio macro could not be created. Please check the OBS log for details."
FirstRunWizard.welcome.body="<p>Advanced Scene Switcher lets you build <b>Macros</b> - rules of the form:</p><blockquote><i>When [condition] -> perform [action]</i></blockquote><p>This wizard creates a macro that <b>switches to a chosen OBS scene whenever a specific window comes into focus</b>.</p><p>You can skip at any time. Re-open this wizard later from the <b>General</b> tab inside the Advanced Scene Switcher dialog.</p>"
FirstRunWizard.scene.title="Choose a Target Scene"
FirstRunWizard.scene.subtitle="Which OBS scene should become active when your chosen window comes into focus?"
@@ -2803,26 +2697,6 @@ FirstRunWizard.review.summary="<b>Macro name:</b> Window -> %1<br><br><b>Conditi
FirstRunWizard.review.errorTitle="Macro Creation Failed"
FirstRunWizard.review.errorBody="The macro could not be created automatically.\n\nYou can create it manually on the Macros tab:\n Condition: Window -> contains \"%1\"\n Action: Switch scene -> \"%2\""
FirstRunWizard.seqTrigger.title="Choose a Trigger Scene"
FirstRunWizard.seqTrigger.subtitle="The sequence will start when you have been on this scene for the specified duration."
FirstRunWizard.seqTrigger.scene="Trigger scene:{{scene}}"
FirstRunWizard.seqTrigger.delay="Start sequence after{{duration}}"
FirstRunWizard.seqScenes.title="Build Your Sequence"
FirstRunWizard.seqScenes.subtitle="Add at least two scenes. The plugin will switch through them in order, waiting the configured time between each switch."
FirstRunWizard.seqScenes.triggerInfo="When on \"%1\" for %2, switch to:"
FirstRunWizard.seqScenes.addScene="Add scene"
FirstRunWizard.seqScenes.removeTooltip="Remove this scene from the sequence"
FirstRunWizard.seqScenes.switchTo="Switch to{{scene}}"
FirstRunWizard.seqScenes.thenWait="then wait{{duration}}"
FirstRunWizard.seqReview.title="Review Your Sequence"
FirstRunWizard.seqReview.subtitle="Click Back to make changes, or Finish to create the macro."
FirstRunWizard.seqReview.trigger="When on <b>%1</b> for at least <b>%2</b>:"
FirstRunWizard.seqReview.step="After %1, switch to %2"
FirstRunWizard.seqReview.errorTitle="Macro Creation Failed"
FirstRunWizard.seqReview.errorBody="The sequence macro could not be created. Please check the OBS log for details."
FirstRunWizard.done.title="You're all set!"
FirstRunWizard.done.subtitle="Your first macro has been created and is now active."
FirstRunWizard.done.body="<p>You can view and edit it on the <b>Macros</b> tab of the Advanced Scene Switcher dialog.</p><p>To learn more:</p><ul><li><a href=\"https://github.com/WarmUpTill/SceneSwitcher/wiki\">Plugin wiki</a></li><li><a href=\"https://obsproject.com/forum/resources/automatic-scene-switching.395/\">OBS forum thread</a></li></ul>"

View File

@@ -312,8 +312,8 @@ AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Espere hasta que se comp
AdvSceneSwitcher.action.wait="Esperar"
AdvSceneSwitcher.action.wait.type.fixed="fijo"
AdvSceneSwitcher.action.wait.type.random="aleatorio"
AdvSceneSwitcher.action.wait.layout.fixed="Espere {{waitType}} de {{duration}}"
AdvSceneSwitcher.action.wait.layout.random="Espere {{waitType}} de {{duration}} a {{duration2}}"
AdvSceneSwitcher.action.wait.entry.fixed="Espere {{waitType}} de {{duration}}"
AdvSceneSwitcher.action.wait.entry.random="Espere {{waitType}} de {{duration}} a {{duration2}}"
AdvSceneSwitcher.action.audio="Audio"
AdvSceneSwitcher.action.audio.type.mute="Silencio"
AdvSceneSwitcher.action.audio.type.unmute="Activar silencio"

View File

@@ -257,10 +257,10 @@ AdvSceneSwitcher.condition.video.layout.modelPath="Données du modèle (classifi
AdvSceneSwitcher.condition.video.layout.minNeighbor="Nombre minimum de voisins :{{minNeighbors}}"
AdvSceneSwitcher.condition.video.layout.throttle="{{throttleEnable}}Réduire la charge CPU en effectuant la vérification uniquement toutes les{{throttleCount}}millisecondes"
AdvSceneSwitcher.condition.video.layout.checkAreaEnable="Effectuer la vérification uniquement dans la zone"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="Vérifier la couleur du texte :{{color}}"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="Vérifier la couleur du texte :{{textColor}}{{selectColor}}"
AdvSceneSwitcher.condition.video.layout.ocrTextType="Vérifier le type de texte :{{textType}}"
AdvSceneSwitcher.condition.video.layout.ocrLanguage="Vérifier la langue :{{languageCode}}"
AdvSceneSwitcher.condition.video.layout.color="Vérifier la couleur :{{color}}"
AdvSceneSwitcher.condition.video.layout.color="Vérifier la couleur :{{color}}{{selectColor}}"
AdvSceneSwitcher.condition.video.minSize="Taille minimale :"
AdvSceneSwitcher.condition.video.maxSize="Taille maximale :"
AdvSceneSwitcher.condition.video.selectArea="Sélectionner la zone"
@@ -460,8 +460,8 @@ AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Attendre que la transiti
AdvSceneSwitcher.action.wait="Attendre"
AdvSceneSwitcher.action.wait.type.fixed="fixe"
AdvSceneSwitcher.action.wait.type.random="aléatoire"
AdvSceneSwitcher.action.wait.layout.fixed="Attendre pour{{waitType}}une durée de{{duration}}"
AdvSceneSwitcher.action.wait.layout.random="Attendre pour{{waitType}}une durée de{{duration}}à{{duration2}}"
AdvSceneSwitcher.action.wait.entry.fixed="Attendre pour{{waitType}}une durée de{{duration}}"
AdvSceneSwitcher.action.wait.entry.random="Attendre pour{{waitType}}une durée de{{duration}}à{{duration2}}"
AdvSceneSwitcher.action.audio="Audio"
AdvSceneSwitcher.action.audio.type.mute="Muet"
AdvSceneSwitcher.action.audio.type.unmute="Activer le son"

View File

@@ -414,12 +414,12 @@ AdvSceneSwitcher.condition.video.layout.minNeighbor="最小近傍数:{{minNeighb
AdvSceneSwitcher.condition.video.layout.throttle="{{throttleEnable}}:{{throttleCount}}ミリ秒ごとにのみパフォーマンスチェックを実行することでCPU負荷を軽減します"
AdvSceneSwitcher.condition.video.layout.checkAreaEnable="エリア内のみチェックを実施"
; AdvSceneSwitcher.condition.video.layout.checkArea="{{checkAreaEnable}}{{checkArea}}{{selectArea}}"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="テキストカラーの確認:{{color}}"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="テキストカラーの確認:{{textColor}}{{selectColor}}"
AdvSceneSwitcher.condition.video.layout.ocrTextType="テキストタイプの確認:{{textType}}"
AdvSceneSwitcher.condition.video.layout.ocrBaseDir="Tesseractベースディレクトリ:{{tesseractBaseDir}}"
AdvSceneSwitcher.condition.video.layout.ocrLanguage="言語の確認:{{languageCode}}"
AdvSceneSwitcher.condition.video.layout.ocrConfig="設定ファイル:{{configFile}}{{openConfigFile}}{{reloadConfig}}{{configFileHint}}"
AdvSceneSwitcher.condition.video.layout.color="カラーを確認してください:{{color}}"
AdvSceneSwitcher.condition.video.layout.color="カラーを確認してください:{{color}}{{selectColor}}"
AdvSceneSwitcher.condition.video.minSize="最小サイズ:"
AdvSceneSwitcher.condition.video.maxSize="最大サイズ:"
AdvSceneSwitcher.condition.video.selectArea="範囲指定"
@@ -800,8 +800,8 @@ AdvSceneSwitcher.action.scene.blockUntilTransitionDone="目的のシーンへの
; AdvSceneSwitcher.action.wait="Wait"
AdvSceneSwitcher.action.wait.type.fixed="指定"
AdvSceneSwitcher.action.wait.type.random="ランダム"
AdvSceneSwitcher.action.wait.layout.fixed="{{waitType}}期間{{duration}}待機します"
AdvSceneSwitcher.action.wait.layout.random="{{duration}}から{{duration2}}までの{{waitType}}期間待ちます"
AdvSceneSwitcher.action.wait.entry.fixed="{{waitType}}期間{{duration}}待機します"
AdvSceneSwitcher.action.wait.entry.random="{{duration}}から{{duration2}}までの{{waitType}}期間待ちます"
AdvSceneSwitcher.action.audio="音声"
AdvSceneSwitcher.action.audio.type.mute="ミュート"
AdvSceneSwitcher.action.audio.type.unmute="ミュート解除"
@@ -830,6 +830,7 @@ AdvSceneSwitcher.action.recording.type.changeOutputFolder="出力フォルダの
AdvSceneSwitcher.action.recording.type.changeOutputFileFormat="ファイル名の書式変更"
AdvSceneSwitcher.action.recording.pause.hint="録画設定によっては録画を一時停止できない場合がありますのでご注意ください"
AdvSceneSwitcher.action.recording.split.hint="まずOBS設定で自動ファイル分割を有効にしてください"
; AdvSceneSwitcher.action.recording.entry="{{actions}}{{recordFolder}}{{recordFileFormat}}{{pauseHint}}{{splitHint}}"
AdvSceneSwitcher.action.replay="リプレイバッファー"
AdvSceneSwitcher.action.replay.saveWarn="警告: 頻繁に保存しすぎると、リプレイ バッファーが実際には保存されなくなる可能性があります。"
AdvSceneSwitcher.action.replay.durationWarn="注意: 最大リプレイ時間の変更は、次回再生バッファを開始したときから適用されます!"

View File

@@ -371,10 +371,10 @@ AdvSceneSwitcher.condition.video.layout.minNeighbor="Vizinhos mínimos:{{minNeig
AdvSceneSwitcher.condition.video.layout.throttle="{{throttleEnable}}Reduzir carga de CPU realizando a verificação apenas a cada {{throttleCount}} milissegundos"
AdvSceneSwitcher.condition.video.layout.checkAreaEnable="Realizar verificação apenas na área"
AdvSceneSwitcher.condition.video.layout.checkArea="{{checkAreaEnable}}{{checkArea}}{{selectArea}}"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="Verificar cor do texto:{{color}}"
AdvSceneSwitcher.condition.video.layout.ocrColorPick="Verificar cor do texto:{{textColor}}{{selectColor}}"
AdvSceneSwitcher.condition.video.layout.ocrTextType="Verificar tipo de texto:{{textType}}"
AdvSceneSwitcher.condition.video.layout.ocrLanguage="Verificar idioma:{{languageCode}}"
AdvSceneSwitcher.condition.video.layout.color="Verificar cor:{{color}}"
AdvSceneSwitcher.condition.video.layout.color="Verificar cor:{{color}}{{selectColor}}"
AdvSceneSwitcher.condition.video.minSize="Tamanho mínimo:"
AdvSceneSwitcher.condition.video.maxSize="Tamanho máximo:"
AdvSceneSwitcher.condition.video.selectArea="Selecionar área"
@@ -718,8 +718,8 @@ AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Aguardar até que a tran
AdvSceneSwitcher.action.wait="Aguardar"
AdvSceneSwitcher.action.wait.type.fixed="fixo"
AdvSceneSwitcher.action.wait.type.random="aleatório"
AdvSceneSwitcher.action.wait.layout.fixed="Aguardando por{{waitType}}duração de{{duration}}"
AdvSceneSwitcher.action.wait.layout.random="Aguardando por{{waitType}}duração de{{duration}}para{{duration2}}"
AdvSceneSwitcher.action.wait.entry.fixed="Aguardando por{{waitType}}duração de{{duration}}"
AdvSceneSwitcher.action.wait.entry.random="Aguardando por{{waitType}}duração de{{duration}}para{{duration2}}"
AdvSceneSwitcher.action.audio="Áudio"
AdvSceneSwitcher.action.audio.type.mute="Silenciar"
AdvSceneSwitcher.action.audio.type.unmute="Ativar som"

View File

@@ -114,8 +114,8 @@ AdvSceneSwitcher.action.scene="Переключить сцену"
AdvSceneSwitcher.action.wait="Подождать"
AdvSceneSwitcher.action.wait.type.fixed="фиксированный"
AdvSceneSwitcher.action.wait.type.random="случайный"
AdvSceneSwitcher.action.wait.layout.fixed="Ожидать {{waitType}} в течении {{duration}}"
AdvSceneSwitcher.action.wait.layout.random="Ожидание {{waitType}} длительностью от {{duration}} до {{duration2}}"
AdvSceneSwitcher.action.wait.entry.fixed="Ожидать {{waitType}} в течении {{duration}}"
AdvSceneSwitcher.action.wait.entry.random="Ожидание {{waitType}} длительностью от {{duration}} до {{duration2}}"
AdvSceneSwitcher.action.audio="Аудио"
AdvSceneSwitcher.action.audio.type.mute="Замьютить"
AdvSceneSwitcher.action.audio.type.unmute="Размьютить"

View File

@@ -249,8 +249,8 @@ AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Hedef sahneye geçiş ta
AdvSceneSwitcher.action.wait="Bekle"
AdvSceneSwitcher.action.wait.type.fixed="sabit"
AdvSceneSwitcher.action.wait.type.random="rastgele"
AdvSceneSwitcher.action.wait.layout.fixed="Şunu bekle {{waitType}} süre {{duration}}"
AdvSceneSwitcher.action.wait.layout.random="Şunu bekle {{waitType}} bu aralıktan {{duration}} buna {{duration2}}"
AdvSceneSwitcher.action.wait.entry.fixed="Şunu bekle {{waitType}} süre {{duration}}"
AdvSceneSwitcher.action.wait.entry.random="Şunu bekle {{waitType}} bu aralıktan {{duration}} buna {{duration2}}"
AdvSceneSwitcher.action.audio="Ses"
AdvSceneSwitcher.action.audio.type.mute="Sessiz"
AdvSceneSwitcher.action.audio.type.unmute="Ses açmak"

File diff suppressed because it is too large Load Diff

Binary file not shown.

1
deps/date vendored Submodule

Submodule deps/date added at 5bdb7e6f31

2
deps/opencv vendored

1
deps/opencv_contrib vendored

Submodule deps/opencv_contrib deleted from 755e50675d

1
deps/whisper.cpp vendored

Submodule deps/whisper.cpp deleted from 306c88f4d1

View File

@@ -1,4 +1,7 @@
#pragma once
#include "macro-segment-list.hpp"
#include "condition-logic.hpp"
#include "log-helper.hpp"
#include <ui_advanced-scene-switcher.h>
@@ -114,8 +117,6 @@ public slots:
void RenameSelectedMacro();
void ExportMacros() const;
void ImportMacros();
void PauseSelectedMacros();
void UnpauseSelectedMacros();
void HighlightOnChange() const;
void on_macroSettings_clicked();

View File

@@ -4,10 +4,9 @@
#include "filter-combo-box.hpp"
#include "first-run-wizard.hpp"
#include "layout-helpers.hpp"
#include "macro-helpers.hpp"
#include "macro.hpp"
#include "macro-search.hpp"
#include "macro-settings.hpp"
#include "macro.hpp"
#include "path-helpers.hpp"
#include "source-helpers.hpp"
#include "splitter-helpers.hpp"
@@ -19,7 +18,6 @@
#include "version.h"
#include <obs-frontend-api.h>
#include <QFileDialog>
#include <QInputDialog>
#include <QMessageBox>
@@ -454,7 +452,7 @@ void AdvSceneSwitcher::CheckFirstTimeSetup()
}
bool wasSkipped = false;
auto macro = wiz::FirstRunWizard::ShowWizard(this, &wasSkipped);
auto macro = FirstRunWizard::ShowWizard(this, &wasSkipped);
if (macro) {
renameMacroIfNecessary(macro);
QTimer::singleShot(0, this,
@@ -468,7 +466,7 @@ void AdvSceneSwitcher::CheckFirstTimeSetup()
void AdvSceneSwitcher::on_openSetupWizard_clicked()
{
auto macro = wiz::FirstRunWizard::ShowWizard(this);
auto macro = FirstRunWizard::ShowWizard(this);
if (!macro) {
return;
}

View File

@@ -1,196 +0,0 @@
#include "macro-action-loop.hpp"
#include "layout-helpers.hpp"
#include "macro-action-factory.hpp"
#include "macro.hpp"
namespace advss {
const std::string MacroActionLoop::id = "loop";
bool MacroActionLoop::_registered = MacroActionFactory::Register(
MacroActionLoop::id,
{MacroActionLoop::Create, MacroActionLoopEdit::Create,
"AdvSceneSwitcher.action.loop"});
bool MacroActionLoop::PerformAction()
{
int iterations = 0;
const int maxIterations = _maxIterations;
Macro *parentMacro = GetMacro();
if (maxIterations <= 0) {
blog(LOG_WARNING,
"loop action has invalid max iterations value of %d",
maxIterations);
return true;
}
while (_loopMacro->CheckConditions()) {
if (iterations >= maxIterations) {
blog(LOG_WARNING,
"loop action reached iteration limit of %d",
maxIterations);
break;
}
ablog(LOG_INFO, "loop iteration %d", iterations);
if (!_loopMacro->PerformActions(true, false, true)) {
break;
}
++iterations;
if (parentMacro && parentMacro->GetStop()) {
break;
}
}
ablog(LOG_INFO, "loop completed after %d iteration(s)", iterations);
SetTempVarValue("count", std::to_string(iterations));
return true;
}
void MacroActionLoop::LogAction() const
{
ablog(LOG_INFO, "running loop (max %d iterations)",
_maxIterations.GetValue());
}
bool MacroActionLoop::Save(obs_data_t *obj) const
{
MacroAction::Save(obj);
_maxIterations.Save(obj, "maxIterations");
OBSDataAutoRelease loopMacroData = obs_data_create();
_loopMacro->Save(loopMacroData);
obs_data_set_obj(obj, "loopMacro", loopMacroData);
obs_data_set_int(obj, "customWidgetHeight", _customWidgetHeight);
return true;
}
bool MacroActionLoop::Load(obs_data_t *obj)
{
MacroAction::Load(obj);
_maxIterations.Load(obj, "maxIterations");
if (obs_data_has_user_value(obj, "loopMacro")) {
OBSDataAutoRelease loopMacroData =
obs_data_get_obj(obj, "loopMacro");
_loopMacro = std::make_shared<Macro>();
_loopMacro->Load(loopMacroData);
}
_customWidgetHeight = obs_data_get_int(obj, "customWidgetHeight");
return true;
}
bool MacroActionLoop::PostLoad()
{
MacroAction::PostLoad();
_loopMacro->PostLoad();
_loopMacro->SetActionTriggerMode(Macro::ActionTriggerMode::ALWAYS);
return true;
}
std::shared_ptr<MacroAction> MacroActionLoop::Create(Macro *m)
{
return std::make_shared<MacroActionLoop>(m);
}
std::shared_ptr<MacroAction> MacroActionLoop::Copy() const
{
auto copy = std::make_shared<MacroActionLoop>(*this);
OBSDataAutoRelease data = obs_data_create();
_loopMacro->Save(data);
copy->_loopMacro = std::make_shared<Macro>();
copy->_loopMacro->Load(data);
copy->_loopMacro->PostLoad();
return copy;
}
void MacroActionLoop::ResolveVariablesToFixedValues()
{
_maxIterations.ResolveVariables();
for (auto &action : _loopMacro->Actions()) {
action->ResolveVariablesToFixedValues();
}
}
void MacroActionLoop::SetupTempVars()
{
MacroAction::SetupTempVars();
AddTempvar("count",
obs_module_text("AdvSceneSwitcher.tempVar.loop.count"),
obs_module_text(
"AdvSceneSwitcher.tempVar.loop.count.description"));
}
MacroActionLoopEdit::MacroActionLoopEdit(
QWidget *parent, std::shared_ptr<MacroActionLoop> entryData)
: ResizableWidget(parent),
_macroEdit(new MacroEdit(
this, QStringList()
<< "AdvSceneSwitcher.action.loop.conditionHelp"
<< "AdvSceneSwitcher.action.loop.actionHelp"
<< "")),
_maxIterations(new VariableSpinBox())
{
_maxIterations->setMinimum(1);
_maxIterations->setMaximum(10000000);
QWidget::connect(
_maxIterations,
SIGNAL(NumberVariableChanged(const NumberVariable<int> &)),
this, SLOT(MaxIterationsChanged(const NumberVariable<int> &)));
auto controlsLayout = new QHBoxLayout();
controlsLayout->addWidget(new QLabel(
obs_module_text("AdvSceneSwitcher.action.loop.maxIterations")));
controlsLayout->addWidget(_maxIterations);
controlsLayout->addStretch();
auto layout = new QVBoxLayout();
layout->addLayout(controlsLayout);
layout->addWidget(_macroEdit);
setLayout(layout);
_macroEdit->HideElseSection();
_entryData = entryData;
UpdateEntryData();
_loading = false;
}
MacroActionLoopEdit::~MacroActionLoopEdit()
{
if (!_entryData) {
return;
}
_entryData->_customWidgetHeight = GetCustomHeight();
_macroEdit->SetMacro({});
}
void MacroActionLoopEdit::UpdateEntryData()
{
if (!_entryData) {
return;
}
_maxIterations->SetValue(_entryData->_maxIterations);
_macroEdit->SetMacro(_entryData->_loopMacro);
if (_macroEdit->IsEmpty()) {
_macroEdit->ShowAllMacroSections();
_entryData->_customWidgetHeight = 600;
}
SetResizingEnabled(true);
SetCustomHeight(_entryData->_customWidgetHeight);
adjustSize();
updateGeometry();
}
void MacroActionLoopEdit::MaxIterationsChanged(const NumberVariable<int> &value)
{
GUARD_LOADING_AND_LOCK();
_entryData->_maxIterations = value;
}
} // namespace advss

View File

@@ -1,64 +0,0 @@
#pragma once
#include "macro-action-edit.hpp"
#include "macro-edit.hpp"
#include "resizable-widget.hpp"
#include "variable-spinbox.hpp"
#include <QLabel>
#include <QVBoxLayout>
namespace advss {
class MacroActionLoop : public MacroAction {
public:
MacroActionLoop(Macro *m) : MacroAction(m) {}
bool PerformAction();
void LogAction() const;
bool Save(obs_data_t *obj) const;
bool Load(obs_data_t *obj);
bool PostLoad();
std::string GetId() const { return id; }
static std::shared_ptr<MacroAction> Create(Macro *m);
std::shared_ptr<MacroAction> Copy() const;
void ResolveVariablesToFixedValues();
std::shared_ptr<Macro> _loopMacro = std::make_shared<Macro>();
IntVariable _maxIterations = 100;
int _customWidgetHeight = 0;
private:
void SetupTempVars();
static bool _registered;
static const std::string id;
};
class MacroActionLoopEdit : public ResizableWidget {
Q_OBJECT
public:
MacroActionLoopEdit(
QWidget *parent,
std::shared_ptr<MacroActionLoop> entryData = nullptr);
~MacroActionLoopEdit();
void UpdateEntryData();
static QWidget *Create(QWidget *parent,
std::shared_ptr<MacroAction> action)
{
return new MacroActionLoopEdit(
parent,
std::dynamic_pointer_cast<MacroActionLoop>(action));
}
private slots:
void MaxIterationsChanged(const NumberVariable<int> &value);
private:
MacroEdit *_macroEdit;
VariableSpinBox *_maxIterations;
std::shared_ptr<MacroActionLoop> _entryData;
bool _loading = true;
};
} // namespace advss

View File

@@ -1,11 +1,8 @@
#include "macro-action-macro.hpp"
#include "condition-logic.hpp"
#include "help-icon.hpp"
#include "layout-helpers.hpp"
#include "macro-action-factory.hpp"
#include "macro-helpers.hpp"
#include "macro.hpp"
#include "macro-action-factory.hpp"
#include <chrono>

View File

@@ -447,19 +447,7 @@ bool MacroActionVariable::PerformAction()
if (!value.has_value()) {
return true;
}
if (!_jsonQueryExtractSingle) {
var->SetValue(*value);
return true;
}
auto extracted = ExtractSingleJsonArrayElement(*value);
if (extracted.has_value()) {
var->SetValue(*extracted);
} else {
var->SetValue(*value);
}
var->SetValue(*value);
return true;
}
case Action::ARRAY_JSON: {
@@ -563,8 +551,6 @@ bool MacroActionVariable::Save(obs_data_t *obj) const
obs_data_set_bool(obj, "allowRepeatValues", _allowRepeatValues);
_jsonQuery.Save(obj, "jsonQuery");
_jsonIndex.Save(obj, "jsonIndex");
obs_data_set_bool(obj, "jsonQueryExtractSingle",
_jsonQueryExtractSingle);
obs_data_set_int(obj, "version", 1);
@@ -625,8 +611,6 @@ bool MacroActionVariable::Load(obs_data_t *obj)
_allowRepeatValues = obs_data_get_bool(obj, "allowRepeatValues");
_jsonQuery.Load(obj, "jsonQuery");
_jsonIndex.Load(obj, "jsonIndex");
_jsonQueryExtractSingle =
obs_data_get_bool(obj, "jsonQueryExtractSingle");
return true;
}
@@ -920,15 +904,6 @@ MacroActionVariableEdit::MacroActionVariableEdit(
"AdvSceneSwitcher.action.variable.type.queryJson.info"),
this)),
_jsonIndex(new VariableSpinBox(this)),
_jsonExtractSingle(new QCheckBox(
obs_module_text(
"AdvSceneSwitcher.action.variable.type.queryJson.extractSingle"),
this)),
_jsonExtractSingleHelp(new HelpIcon(
obs_module_text(
"AdvSceneSwitcher.action.variable.type.queryJson.extractSingle.info"),
this)),
_jsonQueryLayout(new QVBoxLayout()),
_entryLayout(new QHBoxLayout())
{
_numValue->setMinimum(-9999999999);
@@ -960,11 +935,6 @@ MacroActionVariableEdit::MacroActionVariableEdit(
_randomNumberEnd->setMaximum(9999999999);
_randomValues->SetMaxStringSize(99999999);
_jsonIndex->setMaximum(999);
auto jsonExtractSingleLayout = new QHBoxLayout();
jsonExtractSingleLayout->addWidget(_jsonExtractSingle);
jsonExtractSingleLayout->addWidget(_jsonExtractSingleHelp);
jsonExtractSingleLayout->addStretch();
_jsonQueryLayout->addLayout(jsonExtractSingleLayout);
QWidget::connect(_variables, SIGNAL(SelectionChanged(const QString &)),
this, SLOT(VariableChanged(const QString &)));
@@ -1063,8 +1033,6 @@ MacroActionVariableEdit::MacroActionVariableEdit(
_jsonIndex,
SIGNAL(NumberVariableChanged(const NumberVariable<int> &)),
this, SLOT(JsonIndexChanged(const NumberVariable<int> &)));
QWidget::connect(_jsonExtractSingle, SIGNAL(stateChanged(int)), this,
SLOT(JsonQueryExtractSingleChanged(int)));
const std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
{"{{variables}}", _variables},
@@ -1141,7 +1109,6 @@ MacroActionVariableEdit::MacroActionVariableEdit(
auto layout = new QVBoxLayout;
layout->addLayout(_entryLayout);
layout->addLayout(_jsonQueryLayout);
layout->addLayout(_substringLayout);
layout->addWidget(_segmentValueStatus);
layout->addWidget(_segmentValue);
@@ -1213,7 +1180,6 @@ void MacroActionVariableEdit::UpdateEntryData()
_randomValues->SetStringList(_entryData->_randomValues);
_jsonQuery->setText(_entryData->_jsonQuery);
_jsonIndex->SetValue(_entryData->_jsonIndex);
_jsonExtractSingle->setChecked(_entryData->_jsonQueryExtractSingle);
SetWidgetVisibility();
}
@@ -1579,12 +1545,6 @@ void MacroActionVariableEdit::JsonIndexChanged(const NumberVariable<int> &value)
_entryData->_jsonIndex = value;
}
void MacroActionVariableEdit::JsonQueryExtractSingleChanged(int value)
{
GUARD_LOADING_AND_LOCK();
_entryData->_jsonQueryExtractSingle = value;
}
void MacroActionVariableEdit::SetWidgetVisibility()
{
if (!_entryData) {
@@ -1633,10 +1593,6 @@ void MacroActionVariableEdit::SetWidgetVisibility()
MacroActionVariable::Action::TRUNCATE) {
layoutString = obs_module_text(
"AdvSceneSwitcher.action.variable.layout.truncate");
} else if (_entryData->_action ==
MacroActionVariable::Action::COPY_VAR) {
layoutString = obs_module_text(
"AdvSceneSwitcher.action.variable.layout.copy");
} else {
layoutString = obs_module_text(
"AdvSceneSwitcher.action.variable.layout.other");
@@ -1784,9 +1740,6 @@ void MacroActionVariableEdit::SetWidgetVisibility()
MacroActionVariable::Action::QUERY_JSON);
_jsonIndex->setVisible(_entryData->_action ==
MacroActionVariable::Action::ARRAY_JSON);
SetLayoutVisible(_jsonQueryLayout,
_entryData->_action ==
MacroActionVariable::Action::QUERY_JSON);
adjustSize();
updateGeometry();

View File

@@ -116,7 +116,6 @@ public:
StringVariable _jsonQuery = "$.some.nested.value";
IntVariable _jsonIndex = 0;
bool _jsonQueryExtractSingle = true;
private:
void DecrementCurrentSegmentVariableRef();
@@ -188,7 +187,6 @@ private slots:
void AllowRepeatValuesChanged(int);
void JsonQueryChanged();
void JsonIndexChanged(const NumberVariable<int> &);
void JsonQueryExtractSingleChanged(int);
signals:
void HeaderInfoChanged(const QString &);
@@ -241,11 +239,8 @@ private:
QCheckBox *_allowRepeatValues;
QVBoxLayout *_randomValueLayout;
VariableLineEdit *_jsonQuery;
HelpIcon *_jsonQueryHelp;
QLabel *_jsonQueryHelp;
VariableSpinBox *_jsonIndex;
QCheckBox *_jsonExtractSingle;
HelpIcon *_jsonExtractSingleHelp;
QVBoxLayout *_jsonQueryLayout;
QHBoxLayout *_entryLayout;
std::shared_ptr<MacroActionVariable> _entryData;

View File

@@ -1,9 +1,7 @@
#include "macro-condition-edit.hpp"
#include "advanced-scene-switcher.hpp"
#include "condition-logic.hpp"
#include "macro-settings.hpp"
#include "macro-signals.hpp"
#include "macro-settings.hpp"
#include "macro.hpp"
#include "path-helpers.hpp"
#include "plugin-state-helpers.hpp"

View File

@@ -1,9 +1,6 @@
#include "macro-condition-macro.hpp"
#include "layout-helpers.hpp"
#include "macro-action-edit.hpp"
#include "macro-helpers.hpp"
#include "macro-ref.hpp"
#include "macro-signals.hpp"
#include "macro.hpp"

View File

@@ -1,7 +1,5 @@
#include "macro-condition.hpp"
#include "condition-logic.hpp"
namespace advss {
MacroCondition::MacroCondition(Macro *m, bool supportsVariableValue)

View File

@@ -1,11 +1,8 @@
#include "macro-dock-settings.hpp"
#include "macro-dock-window.hpp"
#include "macro-dock.hpp"
#include "macro-helpers.hpp"
#include "macro-dock-window.hpp"
#include "macro.hpp"
#include "plugin-state-helpers.hpp"
#include "variable-string.hpp"
#include <obs-frontend-api.h>
#include <util/platform.h>

View File

@@ -1,20 +1,17 @@
#include "macro-edit.hpp"
#include "condition-logic.hpp"
#include "cursor-shape-changer.hpp"
#include "macro.hpp"
#include "macro-action-edit.hpp"
#include "macro-action-macro.hpp"
#include "macro-condition-edit.hpp"
#include "macro-helpers.hpp"
#include "macro-segment-copy-paste.hpp"
#include "macro-segment-list.hpp"
#include "macro-settings.hpp"
#include "macro-signals.hpp"
#include "macro.hpp"
#include "math-helpers.hpp"
#include "name-dialog.hpp"
#include "obs-module-helper.hpp"
#include "path-helpers.hpp"
#include "obs-module-helper.hpp"
#include "plugin-state-helpers.hpp"
#include "splitter-helpers.hpp"
#include "tab-helpers.hpp"
@@ -1853,13 +1850,6 @@ bool MacroEdit::IsEmpty() const
ui->elseActionsList->IsEmpty();
}
void MacroEdit::HideElseSection() const
{
ui->toggleElseActions->setVisible(false);
ui->macroElseActions->setMaximumHeight(0);
ui->macroElseActionSplitter->handle(1)->setCursor(Qt::ArrowCursor);
}
void MacroEdit::ShowAllMacroSections()
{
if (!ElseSectionIsVisible()) {

View File

@@ -34,7 +34,6 @@ public:
void PasteMacroSegment();
bool IsEmpty() const;
void ShowAllMacroSections();
void HideElseSection() const;
private slots:
void on_conditionAdd_clicked();

View File

@@ -1,7 +1,6 @@
#include "macro-ref.hpp"
#include "macro-helpers.hpp"
#include "macro.hpp"
#include "plugin-state-helpers.hpp"
namespace advss {

View File

@@ -108,7 +108,7 @@ void MacroRunButton::Pressed()
const bool abortMacro = DisplayMessage(
err.arg(QString::fromStdString(macro->Name())), true);
if (abortMacro) {
macro->SignalStop();
macro->Stop();
}
}

View File

@@ -1,7 +1,5 @@
#include "macro-segment-copy-paste.hpp"
#include "advanced-scene-switcher.hpp"
#include "condition-logic.hpp"
#include "macro.hpp"
#include <QShortcut>

View File

@@ -1,5 +1,4 @@
#include "macro-segment.hpp"
#include "macro.hpp"
#include "mouse-wheel-guard.hpp"
#include "path-helpers.hpp"
@@ -9,13 +8,10 @@
#include <QApplication>
#include <QEvent>
#include <QFrame>
#include <QGraphicsOpacityEffect>
#include <QLabel>
#include <QMouseEvent>
#include <QPushButton>
#include <QScrollBar>
#include <QVBoxLayout>
namespace advss {

View File

@@ -7,17 +7,15 @@
#include "sync-helpers.hpp"
#include "temp-variable.hpp"
#include <obs-data.h>
#include <QHBoxLayout>
#include <QPushButton>
#include <QWidget>
#include <QFrame>
#include <QPushButton>
#include <QVBoxLayout>
#include <QTimer>
#include <obs-data.h>
#include <memory>
class QFrame;
class QLabel;
class QVBoxLayout;
namespace advss {

View File

@@ -1,11 +1,8 @@
#include "macro-selection.hpp"
#include "advanced-scene-switcher.hpp"
#include "layout-helpers.hpp"
#include "macro-helpers.hpp"
#include "macro-ref.hpp"
#include "macro-signals.hpp"
#include "macro.hpp"
#include "macro-signals.hpp"
#include "ui-helpers.hpp"
#include <QDialogButtonBox>

View File

@@ -2,9 +2,8 @@
#include "macro-action-edit.hpp"
#include "macro-condition-edit.hpp"
#include "macro-export-import-dialog.hpp"
#include "macro-helpers.hpp"
#include "macro-search.hpp"
#include "macro-settings.hpp"
#include "macro-search.hpp"
#include "macro-signals.hpp"
#include "macro-tree.hpp"
#include "macro.hpp"
@@ -18,7 +17,6 @@
#include "version.h"
#include <obs-frontend-api.h>
#include <QColor>
#include <QMenu>
@@ -745,17 +743,6 @@ void AdvSceneSwitcher::ShowMacroContextMenu(const QPoint &pos)
remove->setDisabled(ui->macros->SelectionEmpty());
menu.addSeparator();
auto pause = menu.addAction(
obs_module_text("AdvSceneSwitcher.macroTab.pause"), this,
&AdvSceneSwitcher::PauseSelectedMacros);
pause->setDisabled(ui->macros->SelectionEmpty());
auto unpause = menu.addAction(
obs_module_text("AdvSceneSwitcher.macroTab.unpause"), this,
&AdvSceneSwitcher::UnpauseSelectedMacros);
unpause->setDisabled(ui->macros->SelectionEmpty());
menu.addSeparator();
auto group = menu.addAction(
obs_module_text("AdvSceneSwitcher.macroTab.group"), ui->macros,
&MacroTree::GroupSelectedItems);
@@ -816,48 +803,6 @@ void AdvSceneSwitcher::CopyMacro()
MacroSignalManager::Instance()->Add(QString::fromStdString(name));
}
void AdvSceneSwitcher::PauseSelectedMacros()
{
auto selectedMacros = GetSelectedMacros();
if (selectedMacros.empty()) {
return;
}
auto lock = LockContext();
for (const auto &macro : selectedMacros) {
if (macro->IsGroup()) {
for (const auto &subitem :
GetGroupMacroEntries(macro.get())) {
subitem->SetPaused(true);
}
} else {
macro->SetPaused(true);
}
}
ui->macros->UpdateRunningStates();
}
void AdvSceneSwitcher::UnpauseSelectedMacros()
{
auto selectedMacros = GetSelectedMacros();
if (selectedMacros.empty()) {
return;
}
auto lock = LockContext();
for (const auto &macro : selectedMacros) {
if (macro->IsGroup()) {
for (const auto &subitem :
GetGroupMacroEntries(macro.get())) {
subitem->SetPaused(false);
}
} else {
macro->SetPaused(false);
}
}
ui->macros->UpdateRunningStates();
}
bool MacroTabIsInFocus()
{
return AdvSceneSwitcher::window &&

View File

@@ -1,25 +1,21 @@
#include "macro-tree.hpp"
#include "macro-helpers.hpp"
#include "macro.hpp"
#include "macro-search.hpp"
#include "macro-signals.hpp"
#include "macro.hpp"
#include "path-helpers.hpp"
#include "sync-helpers.hpp"
#include "ui-helpers.hpp"
#include <obs.h>
#include <QHBoxLayout>
#include <string>
#include <QLabel>
#include <QLineEdit>
#include <QMouseEvent>
#include <QSpacerItem>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QMouseEvent>
#include <QStylePainter>
#include <QToolTip>
#include <QVBoxLayout>
#include <string>
Q_DECLARE_METATYPE(std::shared_ptr<advss::Macro>);
@@ -981,17 +977,6 @@ void MacroTree::UpdateWidgets(bool force)
}
}
void MacroTree::UpdateRunningStates()
{
MacroTreeModel *mtm = GetModel();
for (int i = 0; i < (int)mtm->_macros.size(); i++) {
auto widget = GetItemWidget(i);
if (widget) {
widget->UpdateRunning();
}
}
}
static inline void MoveItem(std::deque<std::shared_ptr<Macro>> &items,
std::shared_ptr<Macro> &item, int to)
{

View File

@@ -145,7 +145,6 @@ public:
void ExpandGroup(std::shared_ptr<Macro> item) const;
void CollapseGroup(std::shared_ptr<Macro> item) const;
void RefreshFilter();
void UpdateRunningStates();
public slots:
void GroupSelectedItems();

View File

@@ -1,6 +1,4 @@
#include "macro.hpp"
#include "condition-logic.hpp"
#include "macro-action-factory.hpp"
#include "macro-condition-factory.hpp"
#include "macro-helpers.hpp"
@@ -9,14 +7,12 @@
#include "splitter-helpers.hpp"
#include "sync-helpers.hpp"
#include <obs-frontend-api.h>
#include <QAction>
#include <QMainWindow>
#include <chrono>
#include <limits>
#undef max
#include <obs-frontend-api.h>
#include <QAction>
#include <QMainWindow>
#include <unordered_map>
namespace advss {
@@ -556,12 +552,6 @@ Macro::PauseStateSaveBehavior Macro::GetPauseStateSaveBehavior() const
return _pauseSaveBehavior;
}
void Macro::SignalStop()
{
_stop = true;
GetMacroWaitCV().notify_all();
}
void Macro::Stop()
{
_stop = true;

View File

@@ -1,20 +1,21 @@
#pragma once
#include "macro-action.hpp"
#include "macro-condition.hpp"
#include "macro-dock-settings.hpp"
#include "macro-helpers.hpp"
#include "macro-input.hpp"
#include "macro-ref.hpp"
#include "variable-string.hpp"
#include "temp-variable.hpp"
#include <obs.hpp>
#include <QList>
#include <deque>
#include <future>
#include <memory>
#include <string>
#include <deque>
#include <memory>
#include <map>
#include <thread>
#include <obs.hpp>
#include <obs-module-helper.hpp>
namespace advss {
@@ -60,7 +61,7 @@ public:
PauseStateSaveBehavior GetPauseStateSaveBehavior() const;
void Stop();
void SignalStop();
void SignalStop() { _stop = true; }
bool GetStop() const { return _stop; }
void ResetTimers();
@@ -224,7 +225,12 @@ private:
MacroDockSettings _dockSettings;
};
void LoadMacros(obs_data_t *obj);
void SaveMacros(obs_data_t *obj);
bool CheckMacros();
bool RunMacros();
void WaitForAllMacros();
void InvalidateMacroTempVarValues();
std::shared_ptr<Macro> GetMacroWithInvalidConditionInterval();
} // namespace advss

View File

@@ -1,40 +0,0 @@
#pragma once
// OBS
#include <obs-data.h>
#include <obs-frontend-api.h>
#include <obs.hpp>
// Qt
#include <QCheckBox>
#include <QComboBox>
#include <QDialog>
#include <QDoubleSpinBox>
#include <QFrame>
#include <QHBoxLayout>
#include <QLabel>
#include <QLayout>
#include <QLineEdit>
#include <QList>
#include <QPushButton>
#include <QSpinBox>
#include <QString>
#include <QTimer>
#include <QVBoxLayout>
#include <QWidget>
// Standard library
#include <algorithm>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <deque>
#include <functional>
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <thread>
#include <unordered_map>
#include <vector>

View File

@@ -3,9 +3,6 @@
#include "plugin-state-helpers.hpp"
#include "ui-helpers.hpp"
#include <QGridLayout>
#include <QHBoxLayout>
namespace advss {
static std::deque<std::shared_ptr<Item>> queues;
@@ -45,7 +42,6 @@ void ActionQueue::Save(obs_data_t *obj) const
obs_data_set_string(obj, "name", _name.c_str());
obs_data_set_bool(obj, "runOnStartup", _runOnStartup);
obs_data_set_bool(obj, "resolveVariablesOnAdd", _resolveVariablesOnAdd);
obs_data_set_bool(obj, "cloneVariableContext", _cloneVariableContext);
}
void ActionQueue::Load(obs_data_t *obj)
@@ -55,7 +51,6 @@ void ActionQueue::Load(obs_data_t *obj)
_runOnStartup = obs_data_get_bool(obj, "runOnStartup");
_resolveVariablesOnAdd =
obs_data_get_bool(obj, "resolveVariablesOnAdd");
_cloneVariableContext = obs_data_get_bool(obj, "cloneVariableContext");
if (_runOnStartup) {
Start();
@@ -116,17 +111,9 @@ void ActionQueue::Add(const std::shared_ptr<MacroAction> &action)
copy->PostLoad();
RunAndClearPostLoadSteps();
copy->ResolveVariablesToFixedValues();
_actions.push_back({copy, {}});
} else if (_cloneVariableContext) {
auto copy = action->Copy();
OBSDataAutoRelease data = obs_data_create();
action->Save(data);
copy->Load(data);
copy->PostLoad();
RunAndClearPostLoadSteps();
_actions.push_back({copy, CreateVariableContext()});
_actions.emplace_back(copy);
} else {
_actions.push_back({action, {}});
_actions.emplace_back(action);
}
_cv.notify_all();
}
@@ -153,7 +140,7 @@ size_t ActionQueue::Size()
void ActionQueue::RunActions()
{
QueueEntry entry;
std::shared_ptr<MacroAction> action;
while (true) {
{ // Grab next action to run
std::unique_lock<std::mutex> lock(_mutex);
@@ -166,25 +153,20 @@ void ActionQueue::RunActions()
if (_stop) {
return;
}
entry = _actions.front();
action = _actions.front();
_actions.pop_front();
}
if (!entry.action) {
if (!action) {
continue;
}
if (ActionLoggingEnabled()) {
blog(LOG_INFO, "Performing action '%s' in queue '%s'",
entry.action->GetId().c_str(), _name.c_str());
entry.action->LogAction();
action->GetId().c_str(), _name.c_str());
action->LogAction();
}
if (entry.context) {
SetActiveVariableContext(&*entry.context);
}
entry.action->PerformAction();
SetActiveVariableContext(nullptr);
action->PerformAction();
}
}
@@ -202,7 +184,6 @@ ActionQueueSettingsDialog::ActionQueueSettingsDialog(QWidget *parent,
obs_module_text("AdvSceneSwitcher.actionQueues.clear"))),
_runOnStartup(new QCheckBox()),
_resolveVariablesOnAdd(new QCheckBox()),
_cloneVariableContext(new QCheckBox()),
_queue(settings)
{
QWidget::connect(_startStopToggle, SIGNAL(clicked()), this,
@@ -211,7 +192,6 @@ ActionQueueSettingsDialog::ActionQueueSettingsDialog(QWidget *parent,
_runOnStartup->setChecked(settings._runOnStartup);
_resolveVariablesOnAdd->setChecked(settings._resolveVariablesOnAdd);
_cloneVariableContext->setChecked(settings._cloneVariableContext);
UpdateLabels();
auto layout = new QGridLayout();
@@ -241,14 +221,6 @@ ActionQueueSettingsDialog::ActionQueueSettingsDialog(QWidget *parent,
_resolveVariablesOnAdd->setToolTip(obs_module_text(
"AdvSceneSwitcher.actionQueues.resolveVariablesOnAdd"));
++row;
layout->addWidget(
new QLabel(obs_module_text(
"AdvSceneSwitcher.actionQueues.cloneVariableContext")),
row, 0);
layout->addWidget(_cloneVariableContext, row, 1);
_cloneVariableContext->setToolTip(obs_module_text(
"AdvSceneSwitcher.actionQueues.cloneVariableContext.tooltip"));
++row;
layout->addWidget(_queueRunStatus, row, 0);
layout->addWidget(_startStopToggle, row, 1);
++row;
@@ -278,8 +250,6 @@ bool ActionQueueSettingsDialog::AskForSettings(QWidget *parent,
settings._runOnStartup = dialog._runOnStartup->isChecked();
settings._resolveVariablesOnAdd =
dialog._resolveVariablesOnAdd->isChecked();
settings._cloneVariableContext =
dialog._cloneVariableContext->isChecked();
return true;
}

View File

@@ -1,13 +1,11 @@
#pragma once
#include "item-selection-helpers.hpp"
#include "macro-action.hpp"
#include "variable.hpp"
#include <chrono>
#include <condition_variable>
#include <deque>
#include <obs-data.h>
#include <optional>
#include <QCheckBox>
#include <thread>
@@ -19,11 +17,6 @@ class ActionQueueSettingsDialog;
class ActionQueue : public Item {
using TimePoint = std::chrono::high_resolution_clock::time_point;
struct QueueEntry {
std::shared_ptr<MacroAction> action;
std::optional<VariableContext> context;
};
public:
ActionQueue();
~ActionQueue();
@@ -50,12 +43,11 @@ private:
bool _runOnStartup = true;
bool _resolveVariablesOnAdd = true;
bool _cloneVariableContext = false;
std::atomic_bool _stop = {true};
std::mutex _mutex;
std::condition_variable _cv;
std::thread _thread;
std::deque<QueueEntry> _actions;
std::deque<std::shared_ptr<MacroAction>> _actions;
TimePoint _lastEmpty;
friend ActionQueueSelection;
@@ -81,7 +73,6 @@ private:
QPushButton *_clear;
QCheckBox *_runOnStartup;
QCheckBox *_resolveVariablesOnAdd;
QCheckBox *_cloneVariableContext;
ActionQueue &_queue;
};

View File

@@ -1,425 +0,0 @@
#include "first-run-wizard-audio.hpp"
#include "first-run-wizard-helpers.hpp"
#include "layout-helpers.hpp"
#include "log-helper.hpp"
#include "macro-settings.hpp"
#include "selection-helpers.hpp"
#include <obs-data.h>
#include <obs.hpp>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QVBoxLayout>
#include <QWidget>
namespace advss {
namespace wiz {
// Builds the obs_data blob for an audio volume condition,
// matching MacroConditionAudio::Save() output.
//
// Checks output volume (checkType 0) ABOVE (outputCondition 0) the given
// threshold in dB, held for at least `duration`.
//
// {
// "segmentSettings": { "enabled": true, "version": 2 },
// "id": "audio",
// "logic": 0,
// "durationModifier": {
// "time_constraint": 1, // AT_LEAST
// "seconds": <Duration::Save output>
// },
// "audioSource": { "type": 0, "name": "<source>" },
// "monitor": 0,
// "volume": { "value": 0.0, "type": 0 },
// "syncOffset": { "value": 0, "type": 0 },
// "balance": { "value": 0.5, "type": 0 },
// "checkType": 0, // OUTPUT_VOLUME
// "outputCondition": 0, // ABOVE
// "volumeCondition": 0,
// "useDb": true,
// "volumeDB": { "value": <thresholdDb>, "type": 0 },
// "version": 3
// }
static OBSDataAutoRelease buildAudioConditionData(const QString &sourceName,
double thresholdDb,
const Duration &duration)
{
OBSDataAutoRelease seg = obs_data_create();
obs_data_set_bool(seg, "enabled", true);
obs_data_set_int(seg, "version", 2);
OBSDataAutoRelease durMod = obs_data_create();
obs_data_set_int(durMod, "time_constraint", 1);
duration.Save(durMod, "seconds");
OBSDataAutoRelease audioSrc = obs_data_create();
obs_data_set_int(audioSrc, "type", 0);
obs_data_set_string(audioSrc, "name", sourceName.toUtf8().constData());
OBSDataAutoRelease volume = obs_data_create();
obs_data_set_double(volume, "value", 0.0);
obs_data_set_int(volume, "type", 0);
OBSDataAutoRelease syncOffset = obs_data_create();
obs_data_set_int(syncOffset, "value", 0);
obs_data_set_int(syncOffset, "type", 0);
OBSDataAutoRelease balance = obs_data_create();
obs_data_set_double(balance, "value", 0.5);
obs_data_set_int(balance, "type", 0);
OBSDataAutoRelease volumeDB = obs_data_create();
obs_data_set_double(volumeDB, "value", thresholdDb);
obs_data_set_int(volumeDB, "type", 0);
OBSDataAutoRelease data = obs_data_create();
obs_data_set_obj(data, "segmentSettings", seg);
obs_data_set_string(data, "id", "audio");
obs_data_set_int(data, "logic", 0);
obs_data_set_obj(data, "durationModifier", durMod);
obs_data_set_obj(data, "audioSource", audioSrc);
obs_data_set_int(data, "monitor", 0);
obs_data_set_obj(data, "volume", volume);
obs_data_set_obj(data, "syncOffset", syncOffset);
obs_data_set_obj(data, "balance", balance);
obs_data_set_int(data, "checkType", 0);
obs_data_set_int(data, "outputCondition", 0);
obs_data_set_int(data, "volumeCondition", 0);
obs_data_set_bool(data, "useDb", true);
obs_data_set_obj(data, "volumeDB", volumeDB);
obs_data_set_int(data, "version", 3);
return data;
}
// Builds the obs_data blob for a scene-visibility action on the current scene,
// matching MacroActionSceneVisibility::Save() output.
//
// sceneSelection type 3 = current scene.
// action 0 = SHOW, action 1 = HIDE.
static OBSDataAutoRelease buildVisibilityActionData(const QString &sourceName,
int action)
{
OBSDataAutoRelease seg = obs_data_create();
obs_data_set_bool(seg, "enabled", true);
obs_data_set_int(seg, "version", 2);
OBSDataAutoRelease sceneSel = obs_data_create();
obs_data_set_int(sceneSel, "type", 3); // current scene
obs_data_set_string(sceneSel, "canvasSelection", "Main");
OBSDataAutoRelease itemSel = obs_data_create();
obs_data_set_int(itemSel, "type", 0);
obs_data_set_int(itemSel, "idxType", 0);
obs_data_set_int(itemSel, "idx", 0);
obs_data_set_string(itemSel, "item", sourceName.toUtf8().constData());
OBSDataAutoRelease data = obs_data_create();
obs_data_set_obj(data, "segmentSettings", seg);
obs_data_set_string(data, "id", "scene_visibility");
obs_data_set_obj(data, "sceneSelection", sceneSel);
obs_data_set_obj(data, "sceneItemSelection", itemSel);
obs_data_set_bool(data, "updateTransition", false);
obs_data_set_int(data, "transitionType", 0);
obs_data_set_string(data, "transition", "");
obs_data_set_bool(data, "updateDuration", false);
Duration().Save(data, "duration");
obs_data_set_int(data, "action", action);
return data;
}
// ===========================================================================
// AudioSourcePage
// ===========================================================================
AudioSourcePage::AudioSourcePage(QWidget *parent)
: QWizardPage(parent),
_sourceCombo(new QComboBox(this)),
_thresholdSpinbox(new QDoubleSpinBox(this)),
_durationSelection(new DurationSelection(this, true, 0.0)),
_volmeterLayout(new QVBoxLayout)
{
setTitle(obs_module_text("FirstRunWizard.audio.source.title"));
setSubTitle(obs_module_text("FirstRunWizard.audio.source.subtitle"));
_sourceCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
_thresholdSpinbox->setRange(-100.0, 0.0);
_thresholdSpinbox->setValue(-24.0);
_thresholdSpinbox->setDecimals(1);
_thresholdSpinbox->setSingleStep(1.0);
_thresholdSpinbox->setSuffix(" dB");
_durationSelection->SetDuration(Duration(1.0));
registerField("audioSourceName*", _sourceCombo, "currentText",
SIGNAL(currentTextChanged(QString)));
connect(_sourceCombo, &QComboBox::currentTextChanged, this,
&QWizardPage::completeChanged);
connect(_sourceCombo, &QComboBox::currentTextChanged, this,
&AudioSourcePage::UpdateVolmeter);
connect(_thresholdSpinbox,
QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
&AudioSourcePage::SyncSliderFromSpinbox);
auto *sourceRow = new QHBoxLayout;
PlaceWidgets(obs_module_text("FirstRunWizard.audio.source.sourceRow"),
sourceRow, {{"{{source}}", _sourceCombo}}, false);
auto *thresholdRow = new QHBoxLayout;
PlaceWidgets(
obs_module_text("FirstRunWizard.audio.source.thresholdRow"),
thresholdRow,
{{"{{threshold}}", _thresholdSpinbox},
{"{{duration}}", _durationSelection}},
false);
auto *layout = new QVBoxLayout(this);
layout->addLayout(sourceRow);
layout->addLayout(thresholdRow);
layout->addLayout(_volmeterLayout);
layout->addStretch();
}
void AudioSourcePage::initializePage()
{
_sourceCombo->clear();
PopulateAudioSelection(_sourceCombo, false);
}
void AudioSourcePage::UpdateVolmeter()
{
delete _volControl;
_volControl = nullptr;
OBSSourceAutoRelease source = obs_get_source_by_name(
_sourceCombo->currentText().toUtf8().constData());
if (!source) {
return;
}
_volControl = new VolControl(source.Get());
_volmeterLayout->addWidget(_volControl);
connect(_volControl->GetSlider(), &DoubleSlider::DoubleValChanged, this,
&AudioSourcePage::SyncSpinboxFromSlider);
SyncSliderFromSpinbox();
}
void AudioSourcePage::SyncSpinboxFromSlider()
{
if (!_volControl) {
return;
}
const QSignalBlocker blocker(_thresholdSpinbox);
_thresholdSpinbox->setValue(_volControl->GetSlider()->DoubleValue() -
100.0);
}
void AudioSourcePage::SyncSliderFromSpinbox()
{
if (!_volControl) {
return;
}
const QSignalBlocker blocker(_volControl->GetSlider());
_volControl->GetSlider()->SetDoubleVal(_thresholdSpinbox->value() +
100.0);
}
bool AudioSourcePage::isComplete() const
{
return _sourceCombo->count() > 0 &&
!_sourceCombo->currentText().isEmpty();
}
Duration AudioSourcePage::GetDuration() const
{
return _durationSelection->GetDuration();
}
// ===========================================================================
// AudioTargetPage
// ===========================================================================
AudioTargetPage::AudioTargetPage(QWidget *parent)
: QWizardPage(parent),
_sourceCombo(new QComboBox(this))
{
setTitle(obs_module_text("FirstRunWizard.audio.target.title"));
setSubTitle(obs_module_text("FirstRunWizard.audio.target.subtitle"));
_sourceCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
registerField("audioTargetSource*", _sourceCombo, "currentText",
SIGNAL(currentTextChanged(QString)));
connect(_sourceCombo, &QComboBox::currentTextChanged, this,
&QWizardPage::completeChanged);
auto *row = new QHBoxLayout;
PlaceWidgets(obs_module_text("FirstRunWizard.audio.target.sourceRow"),
row, {{"{{source}}", _sourceCombo}}, false);
auto *layout = new QVBoxLayout(this);
layout->addLayout(row);
layout->addStretch();
}
void AudioTargetPage::initializePage()
{
QStringList names;
auto enumScenes = [](void *param, obs_source_t *src) -> bool {
auto *list = reinterpret_cast<QStringList *>(param);
obs_scene_t *scene = obs_scene_from_source(src);
obs_scene_enum_items(
scene,
[](obs_scene_t *, obs_sceneitem_t *item,
void *p) -> bool {
auto *l = reinterpret_cast<QStringList *>(p);
OBSSource s = obs_sceneitem_get_source(item);
if (s) {
*l << obs_source_get_name(s);
}
return true;
},
list);
return true;
};
obs_enum_scenes(enumScenes, &names);
names.sort(Qt::CaseInsensitive);
names.removeDuplicates();
const QString prev = _sourceCombo->currentText();
_sourceCombo->clear();
_sourceCombo->addItems(names);
const int idx = _sourceCombo->findText(prev);
if (idx >= 0) {
_sourceCombo->setCurrentIndex(idx);
}
}
bool AudioTargetPage::isComplete() const
{
return _sourceCombo->count() > 0 &&
!_sourceCombo->currentText().isEmpty();
}
// ===========================================================================
// AudioReviewPage
// ===========================================================================
AudioReviewPage::AudioReviewPage(QWidget *parent, std::shared_ptr<Macro> &macro)
: QWizardPage(parent),
_summary(new QLabel(this)),
_macro(macro)
{
setTitle(obs_module_text("FirstRunWizard.audio.review.title"));
setSubTitle(obs_module_text("FirstRunWizard.audio.review.subtitle"));
detail::setupSummaryLabel(_summary);
auto *layout = new QVBoxLayout(this);
layout->addWidget(_summary);
layout->addStretch();
}
void AudioReviewPage::initializePage()
{
const QString audioSource = field("audioSourceName").toString();
const QString targetSource = field("audioTargetSource").toString();
auto *sourcePage = qobject_cast<AudioSourcePage *>(
wizard()->page(PAGE_AUDIO_SOURCE));
const double thresholdDb = sourcePage ? sourcePage->GetThresholdDb()
: -24.0;
const Duration duration = sourcePage ? sourcePage->GetDuration()
: Duration(1.0);
_summary->setText(
QString(obs_module_text("FirstRunWizard.audio.review.summary"))
.arg(audioSource.toHtmlEscaped())
.arg(thresholdDb, 0, 'f', 1)
.arg(QString::fromStdString(duration.ToString()))
.arg(targetSource.toHtmlEscaped()));
}
bool AudioReviewPage::validatePage()
{
const QString audioSource = field("audioSourceName").toString();
const QString targetSource = field("audioTargetSource").toString();
const std::string name =
("Audio: " + audioSource + " -> " + targetSource).toStdString();
auto *sourcePage = qobject_cast<AudioSourcePage *>(
wizard()->page(PAGE_AUDIO_SOURCE));
const double thresholdDb = sourcePage ? sourcePage->GetThresholdDb()
: -24.0;
const Duration duration = sourcePage ? sourcePage->GetDuration()
: Duration(1.0);
_macro = std::make_shared<Macro>(name, GetGlobalMacroSettings());
if (!_macro) {
blog(LOG_WARNING,
"FirstRunWizard: audio macro allocation failed");
return true;
}
_macro->SetActionConditionSplitterPosition(
{QWIDGETSIZE_MAX / 2, QWIDGETSIZE_MAX / 2});
_macro->SetElseActionSplitterPosition(
{QWIDGETSIZE_MAX / 2, QWIDGETSIZE_MAX / 2});
OBSDataAutoRelease condData =
buildAudioConditionData(audioSource, thresholdDb, duration);
if (!detail::addCondition(_macro.get(), "audio", condData)) {
_macro.reset();
QMessageBox::warning(
this,
obs_module_text(
"FirstRunWizard.audio.review.errorTitle"),
obs_module_text(
"FirstRunWizard.audio.review.errorBody"));
return true;
}
OBSDataAutoRelease showData =
buildVisibilityActionData(targetSource, 0);
if (!detail::addAction(_macro.get(), "scene_visibility", showData)) {
_macro.reset();
QMessageBox::warning(
this,
obs_module_text(
"FirstRunWizard.audio.review.errorTitle"),
obs_module_text(
"FirstRunWizard.audio.review.errorBody"));
return true;
}
OBSDataAutoRelease hideData =
buildVisibilityActionData(targetSource, 1);
if (!detail::addElseAction(_macro.get(), "scene_visibility",
hideData)) {
_macro.reset();
QMessageBox::warning(
this,
obs_module_text(
"FirstRunWizard.audio.review.errorTitle"),
obs_module_text(
"FirstRunWizard.audio.review.errorBody"));
return true;
}
blog(LOG_INFO, "FirstRunWizard: created audio macro '%s'",
name.c_str());
return true;
}
} // namespace wiz
} // namespace advss

View File

@@ -1,83 +0,0 @@
#pragma once
#include "duration-control.hpp"
#include "duration.hpp"
#include "first-run-wizard.hpp"
#include "volume-control.hpp"
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QVBoxLayout>
#include <memory>
namespace advss {
namespace wiz {
// ---------------------------------------------------------------------------
// AudioSourcePage
// Registers wizard field "audioSourceName" (QString).
// Volume threshold and duration are read back via getters.
// ---------------------------------------------------------------------------
class AudioSourcePage : public QWizardPage {
Q_OBJECT
public:
explicit AudioSourcePage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_AUDIO_TARGET; }
double GetThresholdDb() const { return _thresholdSpinbox->value(); }
Duration GetDuration() const;
private slots:
void UpdateVolmeter();
void SyncSpinboxFromSlider();
void SyncSliderFromSpinbox();
private:
QComboBox *_sourceCombo;
QDoubleSpinBox *_thresholdSpinbox;
DurationSelection *_durationSelection;
QVBoxLayout *_volmeterLayout;
VolControl *_volControl = nullptr;
};
// ---------------------------------------------------------------------------
// AudioTargetPage
// Registers wizard field "audioTargetSource" (QString).
// ---------------------------------------------------------------------------
class AudioTargetPage : public QWizardPage {
Q_OBJECT
public:
explicit AudioTargetPage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_AUDIO_REVIEW; }
private:
QComboBox *_sourceCombo;
};
// ---------------------------------------------------------------------------
// AudioReviewPage
// Displays a summary and builds the macro from wizard fields on Finish.
// ---------------------------------------------------------------------------
class AudioReviewPage : public QWizardPage {
Q_OBJECT
public:
explicit AudioReviewPage(QWidget *parent,
std::shared_ptr<advss::Macro> &macro);
void initializePage() override;
bool validatePage() override;
int nextId() const override { return PAGE_DONE; }
private:
QLabel *_summary;
std::shared_ptr<advss::Macro> &_macro;
};
} // namespace wiz
} // namespace advss

View File

@@ -1,85 +0,0 @@
#pragma once
#include "log-helper.hpp"
#include "macro.hpp"
#include "macro-action-factory.hpp"
#include "macro-condition-factory.hpp"
#include <obs-data.h>
#include <QFrame>
#include <QLabel>
#include <string>
namespace advss::wiz::detail {
static bool addCondition(advss::Macro *macro, const std::string &id,
obs_data_t *data)
{
auto cond = MacroConditionFactory::Create(id, macro);
if (!cond) {
blog(LOG_WARNING,
"FirstRunWizard: condition factory returned null for '%s'",
id.c_str());
return false;
}
if (!cond->Load(data)) {
blog(LOG_WARNING,
"FirstRunWizard: condition Load() failed for '%s'",
id.c_str());
return false;
}
macro->Conditions().emplace_back(cond);
return true;
}
static bool addAction(advss::Macro *macro, const std::string &id,
obs_data_t *data)
{
auto action = MacroActionFactory::Create(id, macro);
if (!action) {
blog(LOG_WARNING,
"FirstRunWizard: action factory returned null for '%s'",
id.c_str());
return false;
}
if (!action->Load(data)) {
blog(LOG_WARNING,
"FirstRunWizard: action Load() failed for '%s'",
id.c_str());
return false;
}
macro->Actions().emplace_back(action);
return true;
}
static bool addElseAction(advss::Macro *macro, const std::string &id,
obs_data_t *data)
{
auto action = MacroActionFactory::Create(id, macro);
if (!action) {
blog(LOG_WARNING,
"FirstRunWizard: else-action factory returned null for '%s'",
id.c_str());
return false;
}
if (!action->Load(data)) {
blog(LOG_WARNING,
"FirstRunWizard: else-action Load() failed for '%s'",
id.c_str());
return false;
}
macro->ElseActions().emplace_back(action);
return true;
}
static void setupSummaryLabel(QLabel *label)
{
label->setWordWrap(true);
label->setTextFormat(Qt::RichText);
label->setFrameShape(QFrame::StyledPanel);
label->setContentsMargins(12, 12, 12, 12);
}
} // namespace advss::wiz::detail

View File

@@ -1,499 +0,0 @@
#include "first-run-wizard-sequence.hpp"
#include "first-run-wizard-helpers.hpp"
#include "layout-helpers.hpp"
#include "log-helper.hpp"
#include "macro-settings.hpp"
#include "selection-helpers.hpp"
#include <obs-data.h>
#include <QFrame>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QScrollArea>
#include <QVBoxLayout>
namespace advss {
namespace wiz {
// Builds the obs_data blob for a "current scene == sceneName for at least
// triggerDuration" condition, matching MacroConditionScene::Save().
//
// {
// "segmentSettings": { "enabled": true, "version": 2 },
// "id": "scene",
// "logic": 0,
// "durationModifier": {
// "time_constraint": 1, // AT_LEAST
// "seconds": <Duration::Save output>
// },
// "sceneSelection": { "type": 0, "name": "<scene>", "canvasSelection": "Main" },
// "type": 10, // CURRENT_SCENE
// "version": 1
// }
static OBSDataAutoRelease
buildSceneConditionData(const QString &scene, const Duration &triggerDuration)
{
OBSDataAutoRelease seg = obs_data_create();
obs_data_set_bool(seg, "enabled", true);
obs_data_set_int(seg, "version", 2);
OBSDataAutoRelease durMod = obs_data_create();
obs_data_set_int(durMod, "time_constraint", 1);
triggerDuration.Save(durMod, "seconds");
OBSDataAutoRelease sceneSel = obs_data_create();
obs_data_set_int(sceneSel, "type", 0);
obs_data_set_string(sceneSel, "name", scene.toUtf8().constData());
obs_data_set_string(sceneSel, "canvasSelection", "Main");
OBSDataAutoRelease data = obs_data_create();
obs_data_set_obj(data, "segmentSettings", seg);
obs_data_set_string(data, "id", "scene");
obs_data_set_int(data, "logic", 0);
obs_data_set_obj(data, "durationModifier", durMod);
obs_data_set_obj(data, "sceneSelection", sceneSel);
obs_data_set_int(data, "type", 10);
obs_data_set_int(data, "version", 1);
return data;
}
// Builds the obs_data blob for a scene-switch action,
// matching MacroActionSwitchScene::Save().
//
// {
// "segmentSettings": { "enabled": true, "version": 2 },
// "id": "scene_switch",
// "action": 0,
// "sceneSelection": { "type": 0, "name": "<scene>", "canvasSelection": "Main" },
// "transitionType": 1, // scene's default transition
// "blockUntilTransitionDone": true,
// "sceneType": 0
// }
static OBSDataAutoRelease buildSceneSwitchData(const QString &scene)
{
OBSDataAutoRelease seg = obs_data_create();
obs_data_set_bool(seg, "enabled", true);
obs_data_set_int(seg, "version", 2);
OBSDataAutoRelease sceneSel = obs_data_create();
obs_data_set_int(sceneSel, "type", 0);
obs_data_set_string(sceneSel, "name", scene.toUtf8().constData());
obs_data_set_string(sceneSel, "canvasSelection", "Main");
OBSDataAutoRelease data = obs_data_create();
obs_data_set_obj(data, "segmentSettings", seg);
obs_data_set_string(data, "id", "scene_switch");
obs_data_set_int(data, "action", 0);
obs_data_set_obj(data, "sceneSelection", sceneSel);
obs_data_set_int(data, "transitionType", 1);
obs_data_set_bool(data, "blockUntilTransitionDone", true);
obs_data_set_int(data, "sceneType", 0);
return data;
}
// Builds the obs_data blob for a wait action, matching MacroActionWait::Save().
//
// {
// "segmentSettings": { "enabled": true, "version": 2 },
// "id": "wait",
// "duration": <Duration::Save output>,
// "waitType": 0,
// "version": 1
// }
static OBSDataAutoRelease buildWaitData(const Duration &duration)
{
OBSDataAutoRelease seg = obs_data_create();
obs_data_set_bool(seg, "enabled", true);
obs_data_set_int(seg, "version", 2);
OBSDataAutoRelease data = obs_data_create();
obs_data_set_obj(data, "segmentSettings", seg);
obs_data_set_string(data, "id", "wait");
duration.Save(data, "duration");
obs_data_set_int(data, "waitType", 0);
obs_data_set_int(data, "version", 1);
return data;
}
// ===========================================================================
// SequenceTriggerPage
// ===========================================================================
SequenceTriggerPage::SequenceTriggerPage(QWidget *parent)
: QWizardPage(parent),
_sceneCombo(new QComboBox(this)),
_delaySelection(new DurationSelection(this, true, 0.0))
{
setTitle(obs_module_text("FirstRunWizard.seqTrigger.title"));
setSubTitle(obs_module_text("FirstRunWizard.seqTrigger.subtitle"));
_sceneCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
_delaySelection->SetDuration(Duration(5.0));
registerField("seqTriggerScene*", _sceneCombo, "currentText",
SIGNAL(currentTextChanged(QString)));
connect(_sceneCombo, &QComboBox::currentTextChanged, this,
&QWizardPage::completeChanged);
auto *sceneRow = new QHBoxLayout;
PlaceWidgets(obs_module_text("FirstRunWizard.seqTrigger.scene"),
sceneRow, {{"{{scene}}", _sceneCombo}}, false);
auto *delayRow = new QHBoxLayout;
PlaceWidgets(obs_module_text("FirstRunWizard.seqTrigger.delay"),
delayRow, {{"{{duration}}", _delaySelection}}, false);
auto *layout = new QVBoxLayout(this);
layout->addLayout(sceneRow);
layout->addLayout(delayRow);
layout->addStretch();
}
void SequenceTriggerPage::initializePage()
{
_sceneCombo->clear();
for (const QString &name : GetSceneNames()) {
_sceneCombo->addItem(name);
}
}
bool SequenceTriggerPage::isComplete() const
{
return _sceneCombo->count() > 0 &&
!_sceneCombo->currentText().isEmpty();
}
Duration SequenceTriggerPage::GetTriggerDuration() const
{
return _delaySelection->GetDuration();
}
// ===========================================================================
// SequenceScenesPage
// ===========================================================================
SequenceScenesPage::SequenceScenesPage(QWidget *parent)
: QWizardPage(parent),
_triggerInfoLabel(new QLabel(this)),
_stepsContainer(new QWidget(this)),
_stepsLayout(new QVBoxLayout(_stepsContainer))
{
setTitle(obs_module_text("FirstRunWizard.seqScenes.title"));
setSubTitle(obs_module_text("FirstRunWizard.seqScenes.subtitle"));
_triggerInfoLabel->setWordWrap(true);
_triggerInfoLabel->setFrameShape(QFrame::StyledPanel);
_triggerInfoLabel->setContentsMargins(8, 4, 8, 4);
_stepsLayout->setContentsMargins(0, 0, 0, 0);
_stepsLayout->setSpacing(4);
auto *scrollArea = new QScrollArea(this);
scrollArea->setWidget(_stepsContainer);
scrollArea->setWidgetResizable(true);
scrollArea->setFrameShape(QFrame::NoFrame);
auto *addBtn = new QPushButton(
obs_module_text("FirstRunWizard.seqScenes.addScene"), this);
connect(addBtn, &QPushButton::clicked, this,
&SequenceScenesPage::onAddStepClicked);
auto *layout = new QVBoxLayout(this);
layout->addWidget(_triggerInfoLabel);
layout->addWidget(scrollArea, 1);
layout->addWidget(addBtn, 0, Qt::AlignLeft);
}
void SequenceScenesPage::initializePage()
{
const QString triggerScene = field("seqTriggerScene").toString();
auto *triggerPage = qobject_cast<SequenceTriggerPage *>(
wizard()->page(PAGE_SEQ_TRIGGER));
const Duration triggerDuration =
triggerPage ? triggerPage->GetTriggerDuration() : Duration(5.0);
_triggerInfoLabel->setText(
QString(obs_module_text("FirstRunWizard.seqScenes.triggerInfo"))
.arg(triggerScene)
.arg(QString::fromStdString(
triggerDuration.ToString())));
if (_initialized) {
return;
}
_initialized = true;
// Pre-select the scenes after the trigger scene so the user doesn't
// have to start by deselecting it manually.
const QStringList scenes = GetSceneNames();
const int count = static_cast<int>(scenes.size());
const int triggerIdx = scenes.indexOf(triggerScene);
const int firstIdx = count > 0 ? (triggerIdx + 1) % count : 0;
const int secondIdx = count > 0 ? (triggerIdx + 2) % count : 0;
AddStep(firstIdx);
AddStep(secondIdx);
}
bool SequenceScenesPage::isComplete() const
{
return _rows.size() >= 2;
}
QVector<QPair<QString, Duration>> SequenceScenesPage::GetSteps() const
{
QVector<QPair<QString, Duration>> steps;
steps.reserve(_rows.size());
for (int i = 0; i < _rows.size(); ++i) {
const Duration delay = (i < _rows.size() - 1)
? _rows[i].delay->GetDuration()
: Duration();
steps.append({_rows[i].scene->currentText(), delay});
}
return steps;
}
void SequenceScenesPage::onAddStepClicked()
{
const QStringList scenes = GetSceneNames();
const int count = static_cast<int>(scenes.size());
int nextIdx = 0;
if (!_rows.isEmpty() && count > 0) {
const int lastIdx = _rows.last().scene->currentIndex();
nextIdx = (lastIdx + 1) % count;
}
AddStep(nextIdx);
emit completeChanged();
}
void SequenceScenesPage::AddStep(int defaultSceneIndex)
{
auto *row = new QWidget(_stepsContainer);
auto *rowLayout = new QHBoxLayout(row);
rowLayout->setContentsMargins(0, 0, 0, 0);
auto *sceneCombo = new QComboBox(row);
sceneCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
const QStringList scenes = GetSceneNames();
for (const QString &name : scenes) {
sceneCombo->addItem(name);
}
if (defaultSceneIndex >= 0 && defaultSceneIndex < scenes.size()) {
sceneCombo->setCurrentIndex(defaultSceneIndex);
}
PlaceWidgets(obs_module_text("FirstRunWizard.seqScenes.switchTo"),
rowLayout, {{"{{scene}}", sceneCombo}}, false);
auto *delayWidget = new QWidget(row);
auto *delayLayout = new QHBoxLayout(delayWidget);
delayLayout->setContentsMargins(0, 0, 0, 0);
auto *durationSel = new DurationSelection(delayWidget, true, 0.1);
durationSel->SetDuration(Duration(5.0));
PlaceWidgets(obs_module_text("FirstRunWizard.seqScenes.thenWait"),
delayLayout, {{"{{duration}}", durationSel}}, false);
rowLayout->addWidget(delayWidget);
auto *removeBtn = new QPushButton(row);
removeBtn->setProperty("themeID",
QVariant(QString::fromUtf8("removeIconSmall")));
removeBtn->setProperty("class",
QVariant(QString::fromUtf8("icon-trash")));
removeBtn->setToolTip(
obs_module_text("FirstRunWizard.seqScenes.removeTooltip"));
removeBtn->setMaximumSize(22, 22);
rowLayout->addWidget(removeBtn);
_rows.append({row, sceneCombo, delayWidget, durationSel, removeBtn});
_stepsLayout->addWidget(row);
UpdateDelayVisibility();
UpdateRemoveButtons();
connect(removeBtn, &QPushButton::clicked, this,
[this, row]() { RemoveStep(row); });
}
void SequenceScenesPage::RemoveStep(QWidget *rowWidget)
{
int idx = -1;
for (int i = 0; i < _rows.size(); ++i) {
if (_rows[i].row == rowWidget) {
idx = i;
break;
}
}
if (idx < 0) {
return;
}
_stepsLayout->removeWidget(_rows[idx].row);
_rows[idx].row->deleteLater();
_rows.removeAt(idx);
UpdateDelayVisibility();
UpdateRemoveButtons();
emit completeChanged();
}
void SequenceScenesPage::UpdateDelayVisibility()
{
for (int i = 0; i < _rows.size(); ++i) {
_rows[i].delayWidget->setVisible(i < _rows.size() - 1);
}
}
void SequenceScenesPage::UpdateRemoveButtons()
{
const bool canRemove = _rows.size() > 1;
for (auto &step : _rows) {
step.remove->setEnabled(canRemove);
}
}
// ===========================================================================
// SequenceReviewPage
// ===========================================================================
SequenceReviewPage::SequenceReviewPage(QWidget *parent,
std::shared_ptr<Macro> &macro)
: QWizardPage(parent),
_summary(new QLabel(this)),
_macro(macro)
{
setTitle(obs_module_text("FirstRunWizard.seqReview.title"));
setSubTitle(obs_module_text("FirstRunWizard.seqReview.subtitle"));
detail::setupSummaryLabel(_summary);
auto *layout = new QVBoxLayout(this);
layout->addWidget(_summary);
layout->addStretch();
}
void SequenceReviewPage::initializePage()
{
const QString triggerScene = field("seqTriggerScene").toString();
auto *triggerPage = qobject_cast<SequenceTriggerPage *>(
wizard()->page(PAGE_SEQ_TRIGGER));
const Duration triggerDuration =
triggerPage ? triggerPage->GetTriggerDuration() : Duration(5.0);
auto *seqPage = qobject_cast<SequenceScenesPage *>(
wizard()->page(PAGE_SEQ_SCENES));
const auto steps = seqPage ? seqPage->GetSteps()
: QVector<QPair<QString, Duration>>{};
QString html =
QString("<p>%1</p>")
.arg(QString(obs_module_text(
"FirstRunWizard.seqReview.trigger"))
.arg(triggerScene.toHtmlEscaped())
.arg(QString::fromStdString(
triggerDuration.ToString())));
html += "<ol>";
for (int i = 0; i < steps.size(); ++i) {
const QString scene = steps[i].first.toHtmlEscaped();
if (i == 0) {
html += "<li>" + scene + "</li>";
} else {
const QString waitStr = QString::fromStdString(
steps[i - 1].second.ToString());
html += "<li>" +
QString(obs_module_text(
"FirstRunWizard.seqReview.step"))
.arg(waitStr)
.arg(scene) +
"</li>";
}
}
html += "</ol>";
_summary->setText(html);
}
bool SequenceReviewPage::validatePage()
{
const QString triggerScene = field("seqTriggerScene").toString();
const std::string name = ("Sequence: " + triggerScene).toStdString();
auto *triggerPage = qobject_cast<SequenceTriggerPage *>(
wizard()->page(PAGE_SEQ_TRIGGER));
const Duration triggerDuration =
triggerPage ? triggerPage->GetTriggerDuration() : Duration(5.0);
auto *seqPage = qobject_cast<SequenceScenesPage *>(
wizard()->page(PAGE_SEQ_SCENES));
if (!seqPage) {
return true;
}
const auto steps = seqPage->GetSteps();
_macro = std::make_shared<Macro>(name, GetGlobalMacroSettings());
if (!_macro) {
blog(LOG_WARNING,
"FirstRunWizard: sequence macro allocation failed");
return true;
}
_macro->SetRunInParallel(true);
// --- Condition ---
OBSDataAutoRelease condData =
buildSceneConditionData(triggerScene, triggerDuration);
if (!detail::addCondition(_macro.get(), "scene", condData)) {
_macro.reset();
QMessageBox::warning(
this,
obs_module_text("FirstRunWizard.seqReview.errorTitle"),
obs_module_text("FirstRunWizard.seqReview.errorBody"));
return true;
}
// --- Actions: scene_switch interleaved with wait ---
for (int i = 0; i < steps.size(); ++i) {
OBSDataAutoRelease switchData =
buildSceneSwitchData(steps[i].first);
if (!detail::addAction(_macro.get(), "scene_switch",
switchData)) {
_macro.reset();
QMessageBox::warning(
this,
obs_module_text(
"FirstRunWizard.seqReview.errorTitle"),
obs_module_text(
"FirstRunWizard.seqReview.errorBody"));
return true;
}
const bool isLastStep = (i == steps.size() - 1);
if (!isLastStep) {
OBSDataAutoRelease waitData =
buildWaitData(steps[i].second);
if (!detail::addAction(_macro.get(), "wait",
waitData)) {
_macro.reset();
QMessageBox::warning(
this,
obs_module_text(
"FirstRunWizard.seqReview.errorTitle"),
obs_module_text(
"FirstRunWizard.seqReview.errorBody"));
return true;
}
}
}
blog(LOG_INFO, "FirstRunWizard: created sequence macro '%s'",
name.c_str());
return true;
}
} // namespace wiz
} // namespace advss

View File

@@ -1,101 +0,0 @@
#pragma once
#include "duration-control.hpp"
#include "duration.hpp"
#include "first-run-wizard.hpp"
#include <QComboBox>
#include <QLabel>
#include <QPushButton>
#include <QVector>
#include <QWidget>
#include <memory>
class QVBoxLayout;
namespace advss {
namespace wiz {
// ---------------------------------------------------------------------------
// SequenceTriggerPage
// Registers wizard field "seqTriggerScene" (QString).
// Trigger duration is read back via GetTriggerDuration().
// ---------------------------------------------------------------------------
class SequenceTriggerPage : public QWizardPage {
Q_OBJECT
public:
explicit SequenceTriggerPage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_SEQ_SCENES; }
Duration GetTriggerDuration() const;
private:
QComboBox *_sceneCombo;
DurationSelection *_delaySelection;
};
// ---------------------------------------------------------------------------
// SequenceScenesPage
// Lets the user build an ordered list of scenes with delays between them.
// The delay after the last scene is ignored when building the macro.
// ---------------------------------------------------------------------------
struct SequenceStep {
QWidget *row;
QComboBox *scene;
QWidget *delayWidget; // hidden for the last row
DurationSelection *delay;
QPushButton *remove;
};
class SequenceScenesPage : public QWizardPage {
Q_OBJECT
public:
explicit SequenceScenesPage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_SEQ_REVIEW; }
// Returns (sceneName, delayAfter) pairs. The last entry's delayAfter
// is always a default-constructed Duration and must be ignored by the caller.
QVector<QPair<QString, Duration>> GetSteps() const;
private slots:
void onAddStepClicked();
private:
void AddStep(int defaultSceneIndex = 0);
void RemoveStep(QWidget *rowWidget);
void UpdateDelayVisibility();
void UpdateRemoveButtons();
QLabel *_triggerInfoLabel;
QWidget *_stepsContainer;
QVBoxLayout *_stepsLayout;
QVector<SequenceStep> _rows;
bool _initialized = false;
};
// ---------------------------------------------------------------------------
// SequenceReviewPage
// Displays a summary and builds the macro from wizard fields on Finish.
// ---------------------------------------------------------------------------
class SequenceReviewPage : public QWizardPage {
Q_OBJECT
public:
explicit SequenceReviewPage(QWidget *parent,
std::shared_ptr<advss::Macro> &macro);
void initializePage() override;
bool validatePage() override;
int nextId() const override { return PAGE_DONE; }
private:
QLabel *_summary;
std::shared_ptr<advss::Macro> &_macro;
};
} // namespace wiz
} // namespace advss

View File

@@ -1,308 +0,0 @@
#include "first-run-wizard-window.hpp"
#include "first-run-wizard-helpers.hpp"
#include "macro-settings.hpp"
#include "obs-module-helper.hpp"
#include "platform-funcs.hpp"
#include "selection-helpers.hpp"
#include <obs.hpp>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QRegularExpression>
#include <QVBoxLayout>
namespace advss {
namespace wiz {
static constexpr char kConditionIdWindow[] = "window";
static constexpr char kActionIdSceneSwitch[] = "scene_switch";
static QString detectFocusedWindow()
{
return QString::fromStdString(GetCurrentWindowTitle());
}
static QString escapeForRegex(const QString &input)
{
return QRegularExpression::escape(input);
}
// ===========================================================================
// WindowSceneSelectionPage
// ===========================================================================
WindowSceneSelectionPage::WindowSceneSelectionPage(QWidget *parent)
: QWizardPage(parent)
{
setTitle(obs_module_text("FirstRunWizard.scene.title"));
setSubTitle(obs_module_text("FirstRunWizard.scene.subtitle"));
auto label =
new QLabel(obs_module_text("FirstRunWizard.scene.label"), this);
_sceneCombo = new QComboBox(this);
_sceneCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// registerField with * suffix means the field is mandatory for Next
registerField("targetScene*", _sceneCombo, "currentText",
SIGNAL(currentTextChanged(QString)));
connect(_sceneCombo, &QComboBox::currentTextChanged, this,
&QWizardPage::completeChanged);
auto row = new QHBoxLayout;
row->addWidget(label);
row->addWidget(_sceneCombo, 1);
auto layout = new QVBoxLayout(this);
layout->addLayout(row);
layout->addStretch();
}
void WindowSceneSelectionPage::initializePage()
{
_sceneCombo->clear();
for (const QString &name : GetSceneNames()) {
_sceneCombo->addItem(name);
}
}
bool WindowSceneSelectionPage::isComplete() const
{
return _sceneCombo->count() > 0 &&
!_sceneCombo->currentText().isEmpty();
}
// ===========================================================================
// WindowConditionPage
// ===========================================================================
WindowConditionPage::WindowConditionPage(QWidget *parent)
: QWizardPage(parent),
_detectTimer(new QTimer(this))
{
setTitle(obs_module_text("FirstRunWizard.window.title"));
setSubTitle(obs_module_text("FirstRunWizard.window.subtitle"));
auto label = new QLabel(obs_module_text("FirstRunWizard.window.label"),
this);
_windowEdit = new QLineEdit(this);
_windowEdit->setPlaceholderText(
obs_module_text("FirstRunWizard.window.placeholder"));
_autoDetect = new QPushButton(
obs_module_text("FirstRunWizard.window.autoDetect"), this);
_autoDetect->setToolTip(
obs_module_text("FirstRunWizard.window.autoDetectTooltip"));
registerField("windowTitle*", _windowEdit);
connect(_windowEdit, &QLineEdit::textChanged, this,
&QWizardPage::completeChanged);
connect(_autoDetect, &QPushButton::clicked, this,
&WindowConditionPage::onAutoDetectClicked);
connect(_detectTimer, &QTimer::timeout, this,
&WindowConditionPage::onCountdownTick);
auto row = new QHBoxLayout;
row->addWidget(label);
row->addWidget(_windowEdit, 1);
auto hint =
new QLabel(obs_module_text("FirstRunWizard.window.hint"), this);
hint->setTextFormat(Qt::RichText);
hint->setWordWrap(true);
auto layout = new QVBoxLayout(this);
layout->addLayout(row);
layout->addWidget(_autoDetect, 0, Qt::AlignLeft);
layout->addWidget(hint);
layout->addStretch();
}
void WindowConditionPage::initializePage()
{
if (_windowEdit->text().isEmpty()) {
QString detected = detectFocusedWindow();
if (!detected.isEmpty()) {
_windowEdit->setText(detected);
}
}
}
bool WindowConditionPage::isComplete() const
{
return !_windowEdit->text().trimmed().isEmpty();
}
void WindowConditionPage::onAutoDetectClicked()
{
_countdown = 3;
_autoDetect->setEnabled(false);
_autoDetect->setText(
QString(obs_module_text(
"FirstRunWizard.window.autoDetectCountdown"))
.arg(_countdown));
_detectTimer->start(1000);
}
void WindowConditionPage::onCountdownTick()
{
--_countdown;
if (_countdown > 0) {
_autoDetect->setText(
QString(obs_module_text(
"FirstRunWizard.window.autoDetectCountdown"))
.arg(_countdown));
return;
}
_detectTimer->stop();
QString title = detectFocusedWindow();
if (!title.isEmpty()) {
_windowEdit->setText(title);
}
_autoDetect->setEnabled(true);
_autoDetect->setText(
obs_module_text("FirstRunWizard.window.autoDetect"));
}
// ===========================================================================
// WindowReviewPage
// ===========================================================================
WindowReviewPage::WindowReviewPage(QWidget *parent,
std::shared_ptr<Macro> &macro)
: QWizardPage(parent),
_macro(macro)
{
setTitle(obs_module_text("FirstRunWizard.review.title"));
setSubTitle(obs_module_text("FirstRunWizard.review.subtitle"));
_summary = new QLabel(this);
detail::setupSummaryLabel(_summary);
auto layout = new QVBoxLayout(this);
layout->addWidget(_summary);
layout->addStretch();
}
void WindowReviewPage::initializePage()
{
const QString scene = field("targetScene").toString();
const QString window = field("windowTitle").toString();
_summary->setText(
QString(obs_module_text("FirstRunWizard.review.summary"))
.arg(scene.toHtmlEscaped(), window.toHtmlEscaped()));
}
bool WindowReviewPage::validatePage()
{
const QString scene = field("targetScene").toString();
const QString window = escapeForRegex(field("windowTitle").toString());
const std::string name = ("Window -> " + scene).toStdString();
// Build condition data blob
// ---------------------------------------------------------------
// Condition blob — mirrors MacroConditionWindow::Save() output:
//
// {
// "segmentSettings": { "enabled": true, "version": 1 },
// "id": "window",
// "checkTitle": true,
// "window": "<user input>",
// "windowRegexConfig": {
// "enable": true, // use regex-style partial matching
// "partial": true, // match anywhere in the title
// "options": 3 // case-insensitive (QRegularExpression flags)
// },
// "focus": true, // only trigger when window is focused
// "version": 1
// }
// ---------------------------------------------------------------
OBSDataAutoRelease condSegment = obs_data_create();
obs_data_set_bool(condSegment, "enabled", true);
obs_data_set_int(condSegment, "version", 1);
OBSDataAutoRelease condRegex = obs_data_create();
obs_data_set_bool(condRegex, "enable", true);
obs_data_set_bool(condRegex, "partial", true);
obs_data_set_int(condRegex, "options", 3); // CaseInsensitiveOption
OBSDataAutoRelease condData = obs_data_create();
obs_data_set_obj(condData, "segmentSettings", condSegment);
obs_data_set_string(condData, "id", "window");
obs_data_set_bool(condData, "checkTitle", true);
obs_data_set_string(condData, "window", window.toUtf8().constData());
obs_data_set_obj(condData, "windowRegexConfig", condRegex);
obs_data_set_bool(condData, "focus", true);
obs_data_set_int(condData, "version", 1);
// Build action data blob
// ---------------------------------------------------------------
// Action blob — mirrors MacroActionSwitchScene::Save() output:
//
// {
// "segmentSettings": { "enabled": true, "version": 1 },
// "id": "scene_switch",
// "action": 0, // 0 = switch scene
// "sceneSelection": {
// "type": 0, // 0 = scene by name
// "name": "<scene>",
// "canvasSelection": "Main"
// },
// "transitionType": 1, // 1 = use scene's default transition
// "blockUntilTransitionDone": false,
// "sceneType": 0
// }
// ---------------------------------------------------------------
OBSDataAutoRelease actionSegment = obs_data_create();
obs_data_set_bool(actionSegment, "enabled", true);
obs_data_set_int(actionSegment, "version", 1);
OBSDataAutoRelease sceneSelection = obs_data_create();
obs_data_set_int(sceneSelection, "type", 0);
obs_data_set_string(sceneSelection, "name", scene.toUtf8().constData());
obs_data_set_string(sceneSelection, "canvasSelection", "Main");
OBSDataAutoRelease actionData = obs_data_create();
obs_data_set_obj(actionData, "segmentSettings", actionSegment);
obs_data_set_string(actionData, "id", "scene_switch");
obs_data_set_int(actionData, "action", 0);
obs_data_set_obj(actionData, "sceneSelection", sceneSelection);
obs_data_set_int(actionData, "transitionType", 1);
obs_data_set_bool(actionData, "blockUntilTransitionDone", false);
obs_data_set_int(actionData, "sceneType", 0);
_macro = std::make_shared<Macro>(name, GetGlobalMacroSettings());
if (!_macro) {
blog(LOG_WARNING,
"FirstRunWizard: window macro allocation failed");
return true;
}
if (!detail::addCondition(_macro.get(), kConditionIdWindow, condData) ||
!detail::addAction(_macro.get(), kActionIdSceneSwitch,
actionData)) {
QMessageBox::warning(
this,
obs_module_text("FirstRunWizard.review.errorTitle"),
QString(obs_module_text(
"FirstRunWizard.review.errorBody"))
.arg(window, scene));
_macro.reset();
// Still advance so the user is not stuck.
return true;
}
blog(LOG_INFO, "FirstRunWizard: created macro '%s'", name.c_str());
return true;
}
} // namespace wiz
} // namespace advss

View File

@@ -1,76 +0,0 @@
#pragma once
#include "first-run-wizard.hpp"
#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QTimer>
#include <memory>
namespace advss {
namespace wiz {
// ---------------------------------------------------------------------------
// WindowSceneSelectionPage
// Registers wizard field "targetScene" (QString).
// ---------------------------------------------------------------------------
class WindowSceneSelectionPage : public QWizardPage {
Q_OBJECT
public:
explicit WindowSceneSelectionPage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_WINDOW_CONDITION; }
private:
QComboBox *_sceneCombo;
};
// ---------------------------------------------------------------------------
// WindowConditionPage
// Registers wizard field "windowTitle" (QString).
// Auto-detect button samples the focused window after a countdown.
// ---------------------------------------------------------------------------
class WindowConditionPage : public QWizardPage {
Q_OBJECT
public:
explicit WindowConditionPage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_WINDOW_REVIEW; }
private slots:
void onAutoDetectClicked();
void onCountdownTick();
private:
QLineEdit *_windowEdit;
QPushButton *_autoDetect;
QTimer *_detectTimer;
int _countdown = 3;
};
// ---------------------------------------------------------------------------
// WindowReviewPage
// Displays a summary and builds the macro from wizard fields on Finish.
// ---------------------------------------------------------------------------
class WindowReviewPage : public QWizardPage {
Q_OBJECT
public:
explicit WindowReviewPage(QWidget *parent,
std::shared_ptr<advss::Macro> &macro);
void initializePage() override;
bool validatePage() override;
int nextId() const override { return PAGE_DONE; }
private:
QLabel *_summary;
std::shared_ptr<advss::Macro> &_macro;
};
} // namespace wiz
} // namespace advss

View File

@@ -1,17 +1,28 @@
#include "first-run-wizard.hpp"
#include "first-run-wizard-audio.hpp"
#include "first-run-wizard-sequence.hpp"
#include "first-run-wizard-window.hpp"
#include "log-helper.hpp"
#include "macro.hpp"
#include "macro-action-factory.hpp"
#include "macro-condition-factory.hpp"
#include "macro-settings.hpp"
#include "platform-funcs.hpp"
#include "selection-helpers.hpp"
#include <obs-frontend-api.h>
#include <obs-data.h>
#include <util/config-file.h>
#include <QFrame>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QRegularExpression>
#include <QVBoxLayout>
namespace advss {
static constexpr char kConditionIdWindow[] = "window";
static constexpr char kActionIdSceneSwitch[] = "scene_switch";
// ---------------------------------------------------------------------------
// OBS global config helpers
// ---------------------------------------------------------------------------
@@ -31,7 +42,7 @@ bool IsFirstRun()
return config_get_bool(cfg, kConfigSection, kFirstRunKey);
}
static void writeFirstRun(bool value)
static void WriteFirstRun(bool value)
{
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(31, 0, 0)
config_t *cfg = obs_frontend_get_user_config();
@@ -42,10 +53,10 @@ static void writeFirstRun(bool value)
config_save_safe(cfg, "tmp", nullptr);
}
} // namespace advss
namespace advss {
namespace wiz {
static QString DetectFocusedWindow()
{
return QString::fromStdString(GetCurrentWindowTitle());
}
// ===========================================================================
// WelcomePage
@@ -67,39 +78,271 @@ WelcomePage::WelcomePage(QWidget *parent) : QWizardPage(parent)
}
// ===========================================================================
// TemplatePage
// SceneSelectionPage
// ===========================================================================
TemplatePage::TemplatePage(QWidget *parent)
: QWizardPage(parent),
_windowRadio(new QRadioButton(
obs_module_text("FirstRunWizard.template.window"), this)),
_sequenceRadio(new QRadioButton(
obs_module_text("FirstRunWizard.template.sequence"), this)),
_audioRadio(new QRadioButton(
obs_module_text("FirstRunWizard.template.audio"), this))
SceneSelectionPage::SceneSelectionPage(QWidget *parent) : QWizardPage(parent)
{
setTitle(obs_module_text("FirstRunWizard.template.title"));
setSubTitle(obs_module_text("FirstRunWizard.template.subtitle"));
setTitle(obs_module_text("FirstRunWizard.scene.title"));
setSubTitle(obs_module_text("FirstRunWizard.scene.subtitle"));
_windowRadio->setChecked(true);
auto label =
new QLabel(obs_module_text("FirstRunWizard.scene.label"), this);
_sceneCombo = new QComboBox(this);
_sceneCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
auto *layout = new QVBoxLayout(this);
layout->addWidget(_windowRadio);
layout->addWidget(_sequenceRadio);
layout->addWidget(_audioRadio);
// registerField with * suffix means the field is mandatory for Next
registerField("targetScene*", _sceneCombo, "currentText",
SIGNAL(currentTextChanged(QString)));
connect(_sceneCombo, &QComboBox::currentTextChanged, this,
&QWizardPage::completeChanged);
auto row = new QHBoxLayout;
row->addWidget(label);
row->addWidget(_sceneCombo, 1);
auto layout = new QVBoxLayout(this);
layout->addLayout(row);
layout->addStretch();
}
int TemplatePage::nextId() const
void SceneSelectionPage::initializePage()
{
if (_sequenceRadio->isChecked()) {
return PAGE_SEQ_TRIGGER;
_sceneCombo->clear();
for (const QString &name : GetSceneNames())
_sceneCombo->addItem(name);
}
bool SceneSelectionPage::isComplete() const
{
return _sceneCombo->count() > 0 &&
!_sceneCombo->currentText().isEmpty();
}
// ===========================================================================
// WindowConditionPage
// ===========================================================================
WindowConditionPage::WindowConditionPage(QWidget *parent)
: QWizardPage(parent),
_detectTimer(new QTimer(this))
{
setTitle(obs_module_text("FirstRunWizard.window.title"));
setSubTitle(obs_module_text("FirstRunWizard.window.subtitle"));
auto label = new QLabel(obs_module_text("FirstRunWizard.window.label"),
this);
_windowEdit = new QLineEdit(this);
_windowEdit->setPlaceholderText(
obs_module_text("FirstRunWizard.window.placeholder"));
_autoDetect = new QPushButton(
obs_module_text("FirstRunWizard.window.autoDetect"), this);
_autoDetect->setToolTip(
obs_module_text("FirstRunWizard.window.autoDetectTooltip"));
registerField("windowTitle*", _windowEdit);
connect(_windowEdit, &QLineEdit::textChanged, this,
&QWizardPage::completeChanged);
connect(_autoDetect, &QPushButton::clicked, this,
&WindowConditionPage::onAutoDetectClicked);
connect(_detectTimer, &QTimer::timeout, this,
&WindowConditionPage::onCountdownTick);
auto row = new QHBoxLayout;
row->addWidget(label);
row->addWidget(_windowEdit, 1);
auto hint =
new QLabel(obs_module_text("FirstRunWizard.window.hint"), this);
hint->setTextFormat(Qt::RichText);
hint->setWordWrap(true);
auto layout = new QVBoxLayout(this);
layout->addLayout(row);
layout->addWidget(_autoDetect, 0, Qt::AlignLeft);
layout->addWidget(hint);
layout->addStretch();
}
void WindowConditionPage::initializePage()
{
if (_windowEdit->text().isEmpty()) {
QString detected = DetectFocusedWindow();
if (!detected.isEmpty()) {
_windowEdit->setText(detected);
}
}
if (_audioRadio->isChecked()) {
return PAGE_AUDIO_SOURCE;
}
bool WindowConditionPage::isComplete() const
{
return !_windowEdit->text().trimmed().isEmpty();
}
void WindowConditionPage::onAutoDetectClicked()
{
_countdown = 3;
_autoDetect->setEnabled(false);
_autoDetect->setText(
QString(obs_module_text(
"FirstRunWizard.window.autoDetectCountdown"))
.arg(_countdown));
_detectTimer->start(1000);
}
void WindowConditionPage::onCountdownTick()
{
--_countdown;
if (_countdown > 0) {
_autoDetect->setText(
QString(obs_module_text(
"FirstRunWizard.window.autoDetectCountdown"))
.arg(_countdown));
return;
}
return PAGE_WINDOW_SCENE;
_detectTimer->stop();
QString title = DetectFocusedWindow();
if (!title.isEmpty()) {
_windowEdit->setText(title);
}
_autoDetect->setEnabled(true);
_autoDetect->setText(
obs_module_text("FirstRunWizard.window.autoDetect"));
}
// ===========================================================================
// ReviewPage
// ===========================================================================
ReviewPage::ReviewPage(QWidget *parent, std::shared_ptr<Macro> &macro)
: QWizardPage(parent),
_macro(macro)
{
setTitle(obs_module_text("FirstRunWizard.review.title"));
setSubTitle(obs_module_text("FirstRunWizard.review.subtitle"));
_summary = new QLabel(this);
_summary->setWordWrap(true);
_summary->setTextFormat(Qt::RichText);
_summary->setFrameShape(QFrame::StyledPanel);
_summary->setContentsMargins(12, 12, 12, 12);
auto layout = new QVBoxLayout(this);
layout->addWidget(_summary);
layout->addStretch();
}
void ReviewPage::initializePage()
{
const QString scene = field("targetScene").toString();
const QString window = field("windowTitle").toString();
_summary->setText(
QString(obs_module_text("FirstRunWizard.review.summary"))
.arg(scene.toHtmlEscaped(), window.toHtmlEscaped()));
}
static QString escapeForRegex(const QString &input)
{
return QRegularExpression::escape(input);
}
bool ReviewPage::validatePage()
{
const QString scene = field("targetScene").toString();
const QString window = escapeForRegex(field("windowTitle").toString());
const std::string name = ("Window -> " + scene).toStdString();
// Build condition data blob
// ---------------------------------------------------------------
// Condition blob — mirrors MacroConditionWindow::Save() output:
//
// {
// "segmentSettings": { "enabled": true, "version": 1 },
// "id": "window",
// "checkTitle": true,
// "window": "<user input>",
// "windowRegexConfig": {
// "enable": true, // use regex-style partial matching
// "partial": true, // match anywhere in the title
// "options": 3 // case-insensitive (QRegularExpression flags)
// },
// "focus": true, // only trigger when window is focused
// "version": 1
// }
// ---------------------------------------------------------------
OBSDataAutoRelease condSegment = obs_data_create();
obs_data_set_bool(condSegment, "enabled", true);
obs_data_set_int(condSegment, "version", 1);
OBSDataAutoRelease condRegex = obs_data_create();
obs_data_set_bool(condRegex, "enable", true);
obs_data_set_bool(condRegex, "partial", true);
obs_data_set_int(condRegex, "options", 3); // CaseInsensitiveOption
OBSDataAutoRelease condData = obs_data_create();
obs_data_set_obj(condData, "segmentSettings", condSegment);
obs_data_set_string(condData, "id", "window");
obs_data_set_bool(condData, "checkTitle", true);
obs_data_set_string(condData, "window", window.toUtf8().constData());
obs_data_set_obj(condData, "windowRegexConfig", condRegex);
obs_data_set_bool(condData, "focus", true);
obs_data_set_int(condData, "version", 1);
// Build action data blob
// ---------------------------------------------------------------
// Action blob — mirrors MacroActionSwitchScene::Save() output:
//
// {
// "segmentSettings": { "enabled": true, "version": 1 },
// "id": "scene_switch",
// "action": 0, // 0 = switch scene
// "sceneSelection": {
// "type": 0, // 0 = scene by name
// "name": "<scene>",
// "canvasSelection": "Main"
// },
// "transitionType": 1, // 1 = use scene's default transition
// "blockUntilTransitionDone": false,
// "sceneType": 0
// }
// ---------------------------------------------------------------
OBSDataAutoRelease actionSegment = obs_data_create();
obs_data_set_bool(actionSegment, "enabled", true);
obs_data_set_int(actionSegment, "version", 1);
OBSDataAutoRelease sceneSelection = obs_data_create();
obs_data_set_int(sceneSelection, "type", 0);
obs_data_set_string(sceneSelection, "name", scene.toUtf8().constData());
obs_data_set_string(sceneSelection, "canvasSelection", "Main");
OBSDataAutoRelease actionData = obs_data_create();
obs_data_set_obj(actionData, "segmentSettings", actionSegment);
obs_data_set_string(actionData, "id", "scene_switch");
obs_data_set_int(actionData, "action", 0);
obs_data_set_obj(actionData, "sceneSelection", sceneSelection);
obs_data_set_int(actionData, "transitionType", 1);
obs_data_set_bool(actionData, "blockUntilTransitionDone", false);
obs_data_set_int(actionData, "sceneType", 0);
if (!FirstRunWizard::CreateMacro(_macro, name, kConditionIdWindow,
condData, kActionIdSceneSwitch,
actionData)) {
QMessageBox::warning(
this,
obs_module_text("FirstRunWizard.review.errorTitle"),
QString(obs_module_text(
"FirstRunWizard.review.errorBody"))
.arg(window, scene));
_macro.reset();
// Still advance so the user is not stuck.
}
return true;
}
// ===========================================================================
@@ -130,19 +373,12 @@ FirstRunWizard::FirstRunWizard(QWidget *parent) : QWizard(parent)
{
setWindowTitle(obs_module_text("FirstRunWizard.windowTitle"));
setWizardStyle(QWizard::ModernStyle);
setMinimumSize(600, 420);
setMinimumSize(540, 420);
setPage(PAGE_WELCOME, new WelcomePage(this));
setPage(PAGE_TEMPLATE, new TemplatePage(this));
setPage(PAGE_WINDOW_SCENE, new WindowSceneSelectionPage(this));
setPage(PAGE_WINDOW_CONDITION, new WindowConditionPage(this));
setPage(PAGE_WINDOW_REVIEW, new WindowReviewPage(this, _macro));
setPage(PAGE_SEQ_TRIGGER, new SequenceTriggerPage(this));
setPage(PAGE_SEQ_SCENES, new SequenceScenesPage(this));
setPage(PAGE_SEQ_REVIEW, new SequenceReviewPage(this, _macro));
setPage(PAGE_AUDIO_SOURCE, new AudioSourcePage(this));
setPage(PAGE_AUDIO_TARGET, new AudioTargetPage(this));
setPage(PAGE_AUDIO_REVIEW, new AudioReviewPage(this, _macro));
setPage(PAGE_SCENE, new SceneSelectionPage(this));
setPage(PAGE_WINDOW, new WindowConditionPage(this));
setPage(PAGE_REVIEW, new ReviewPage(this, _macro));
setPage(PAGE_DONE, new DonePage(this));
setStartId(PAGE_WELCOME);
@@ -158,7 +394,7 @@ FirstRunWizard::FirstRunWizard(QWidget *parent) : QWizard(parent)
void FirstRunWizard::markFirstRunComplete()
{
writeFirstRun(false);
WriteFirstRun(false);
}
// static
@@ -174,5 +410,58 @@ std::shared_ptr<Macro> FirstRunWizard::ShowWizard(QWidget *parent,
return wizard->_macro;
}
} // namespace wiz
// static
bool FirstRunWizard::CreateMacro(std::shared_ptr<Macro> &macro,
const std::string &macroName,
const std::string &conditionId,
obs_data_t *conditionData,
const std::string &actionId,
obs_data_t *actionData)
{
// 1. Create and register the Macro
macro = std::make_shared<Macro>(macroName, GetGlobalMacroSettings());
if (!macro) {
blog(LOG_WARNING, "FirstRunWizard: Macro allocation failed");
return false;
}
// 2. Instantiate condition via factory, then hydrate via Load()
auto condition =
MacroConditionFactory::Create(conditionId, macro.get());
if (!condition) {
blog(LOG_WARNING,
"FirstRunWizard: condition factory returned null "
"for id '%s' — is the base plugin loaded?",
conditionId.c_str());
return false;
}
if (!condition->Load(conditionData)) {
blog(LOG_WARNING,
"FirstRunWizard: condition Load() failed for id '%s'",
conditionId.c_str());
return false;
}
macro->Conditions().emplace_back(condition);
// 3. Instantiate action via factory, then hydrate via Load()
auto action = MacroActionFactory::Create(actionId, macro.get());
if (!action) {
blog(LOG_WARNING,
"FirstRunWizard: action factory returned null "
"for id '%s' — is the base plugin loaded?",
actionId.c_str());
return false;
}
if (!action->Load(actionData)) {
blog(LOG_WARNING,
"FirstRunWizard: action Load() failed for id '%s'",
actionId.c_str());
return false;
}
macro->Actions().emplace_back(action);
blog(LOG_INFO, "FirstRunWizard: created macro '%s'", macroName.c_str());
return true;
}
} // namespace advss

View File

@@ -1,34 +1,31 @@
#pragma once
#include <QRadioButton>
#include <obs-data.h>
#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QTimer>
#include <QWizard>
#include <QWizardPage>
#include <memory>
#include <string>
namespace advss {
bool IsFirstRun();
class Macro;
namespace wiz {
bool IsFirstRun();
// ---------------------------------------------------------------------------
// Page IDs
// ---------------------------------------------------------------------------
enum WizardPageId {
PAGE_WELCOME = 0,
PAGE_TEMPLATE,
PAGE_WINDOW_SCENE,
PAGE_WINDOW_CONDITION,
PAGE_WINDOW_REVIEW,
PAGE_SEQ_TRIGGER,
PAGE_SEQ_SCENES,
PAGE_SEQ_REVIEW,
PAGE_AUDIO_SOURCE,
PAGE_AUDIO_TARGET,
PAGE_AUDIO_REVIEW,
PAGE_SCENE,
PAGE_WINDOW,
PAGE_REVIEW,
PAGE_DONE,
};
@@ -39,23 +36,64 @@ class WelcomePage : public QWizardPage {
Q_OBJECT
public:
explicit WelcomePage(QWidget *parent = nullptr);
int nextId() const override { return PAGE_TEMPLATE; }
int nextId() const override { return PAGE_SCENE; }
};
// ---------------------------------------------------------------------------
// TemplatePage
// Lets the user choose which kind of automation to create.
// SceneSelectionPage
// Registers wizard field "targetScene" (QString).
// ---------------------------------------------------------------------------
class TemplatePage : public QWizardPage {
class SceneSelectionPage : public QWizardPage {
Q_OBJECT
public:
explicit TemplatePage(QWidget *parent = nullptr);
int nextId() const override;
explicit SceneSelectionPage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_WINDOW; }
private:
QRadioButton *_windowRadio;
QRadioButton *_sequenceRadio;
QRadioButton *_audioRadio;
QComboBox *_sceneCombo;
};
// ---------------------------------------------------------------------------
// WindowConditionPage
// Registers wizard field "windowTitle" (QString).
// Auto-detect button samples the focused window after a countdown.
// ---------------------------------------------------------------------------
class WindowConditionPage : public QWizardPage {
Q_OBJECT
public:
explicit WindowConditionPage(QWidget *parent = nullptr);
void initializePage() override;
bool isComplete() const override;
int nextId() const override { return PAGE_REVIEW; }
private slots:
void onAutoDetectClicked();
void onCountdownTick();
private:
QLineEdit *_windowEdit;
QPushButton *_autoDetect;
QTimer *_detectTimer;
int _countdown = 3;
};
// ---------------------------------------------------------------------------
// ReviewPage
// Displays a summary and calls FirstRunWizard::CreateMacro() on Finish.
// ---------------------------------------------------------------------------
class ReviewPage : public QWizardPage {
Q_OBJECT
public:
explicit ReviewPage(QWidget *parent, std::shared_ptr<Macro> &macro);
void initializePage() override;
bool validatePage() override;
int nextId() const override { return PAGE_DONE; }
private:
QLabel *_summary;
std::shared_ptr<Macro> &_macro;
};
// ---------------------------------------------------------------------------
@@ -75,14 +113,17 @@ class FirstRunWizard : public QWizard {
Q_OBJECT
public:
explicit FirstRunWizard(QWidget *parent = nullptr);
static std::shared_ptr<advss::Macro>
ShowWizard(QWidget *parent, bool *wasSkipped = nullptr);
static std::shared_ptr<Macro> ShowWizard(QWidget *parent,
bool *wasSkipped = nullptr);
static bool
CreateMacro(std::shared_ptr<Macro> &macro, const std::string &macroName,
const std::string &conditionId, obs_data_t *conditionData,
const std::string &actionId, obs_data_t *actionData);
private:
void markFirstRunComplete();
std::shared_ptr<advss::Macro> _macro;
std::shared_ptr<Macro> _macro;
};
} // namespace wiz
} // namespace advss

View File

@@ -99,23 +99,4 @@ std::optional<std::string> AccessJsonArrayIndex(const std::string &jsonStr,
return {};
}
std::optional<std::string>
ExtractSingleJsonArrayElement(const std::string &jsonStr)
{
try {
nlohmann::json json = nlohmann::json::parse(jsonStr);
if (!json.is_array() || json.size() != 1) {
return {};
}
auto result = json.at(0);
if (result.is_string()) {
return result.get<std::string>();
}
return result.dump();
} catch (const nlohmann::json::exception &) {
return {};
}
return {};
}
} // namespace advss

View File

@@ -17,7 +17,5 @@ EXPORT std::optional<std::string> QueryJson(const std::string &json,
const std::string &query);
EXPORT std::optional<std::string> AccessJsonArrayIndex(const std::string &json,
const int index);
EXPORT std::optional<std::string>
ExtractSingleJsonArrayElement(const std::string &json);
} // namespace advss

View File

@@ -1,8 +1,6 @@
#include "priority-helper.hpp"
#include "switcher-data.hpp"
#include "advanced-scene-switcher.hpp"
#include "macro-helpers.hpp"
#include "macro.hpp"
#include "scene-group.hpp"
#include "switch-audio.hpp"
#include "switch-executable.hpp"
@@ -12,16 +10,15 @@
#include "switch-pause.hpp"
#include "switch-random.hpp"
#include "switch-screen-region.hpp"
#include "switch-sequence.hpp"
#include "switch-time.hpp"
#include "switch-transitions.hpp"
#include "switch-video.hpp"
#include "switch-window.hpp"
#include "switcher-data.hpp"
#include <QThread>
#include "switch-sequence.hpp"
#include "switch-video.hpp"
#include "macro.hpp"
#include <algorithm>
#include <QThread>
namespace advss {

View File

@@ -1,7 +1,5 @@
#pragma once
#include <export-symbol-helper.hpp>
#include <QFrame>
#include <QGridLayout>
#include <QParallelAnimationGroup>
@@ -10,7 +8,7 @@
namespace advss {
class ADVSS_EXPORT Section : public QWidget {
class Section : public QWidget {
Q_OBJECT
public:

View File

@@ -10,7 +10,6 @@
#include <obs-frontend-api.h>
#include <QStandardItemModel>
#include <unordered_set>
namespace advss {
@@ -43,46 +42,34 @@ static void hasFilterEnum(obs_source_t *, obs_source_t *filter, void *ptr)
QStringList GetSourcesWithFilterNames()
{
struct EnumParam {
QStringList list;
// Some items appear in both obs_enum_sources and
// obs_enum_scenes, so track pointers to avoid adding them
// twice.
std::unordered_set<obs_source_t *> seen;
};
static auto enumSourcesWithFilters = [](void *param,
obs_source_t *source) {
if (!source) {
return true;
}
auto *ep = reinterpret_cast<EnumParam *>(param);
const auto [_, inserted] = ep->seen.insert(source);
if (!inserted) {
return true;
}
QStringList *list = reinterpret_cast<QStringList *>(param);
bool hasFilter = false;
obs_source_enum_filters(source, hasFilterEnum, &hasFilter);
if (hasFilter) {
ep->list << obs_source_get_name(source);
*list << obs_source_get_name(source);
}
return true;
};
EnumParam ep;
obs_enum_sources(enumSourcesWithFilters, &ep);
QStringList list;
obs_enum_sources(enumSourcesWithFilters, &list);
#if LIBOBS_API_VER < MAKE_SEMANTIC_VERSION(31, 1, 0)
obs_enum_scenes(enumSourcesWithFilters, &ep);
obs_enum_scenes(enumSourcesWithFilters, &list);
#else
static const auto enumCanvases = [](void *param,
static const auto enumCanvases = [](void *listPtr,
obs_canvas_t *canvas) -> bool {
obs_canvas_enum_scenes(canvas, enumSourcesWithFilters, param);
obs_canvas_enum_scenes(canvas, enumSourcesWithFilters, listPtr);
return true;
};
obs_enum_canvases(enumCanvases, &ep);
obs_enum_canvases(enumCanvases, &list);
#endif
return ep.list;
return list;
}
QStringList GetMediaSourceNames()
@@ -148,7 +135,7 @@ QStringList GetSourceNames()
}
void PopulateTransitionSelection(QComboBox *sel, bool addCurrent, bool addAny,
bool addSelect)
bool addSelect, bool addNone)
{
obs_frontend_source_list *transitions = new obs_frontend_source_list();
@@ -181,6 +168,11 @@ void PopulateTransitionSelection(QComboBox *sel, bool addCurrent, bool addAny,
addSelect ? 1 : 0,
obs_module_text("AdvSceneSwitcher.anyTransition"));
}
if (addNone) {
sel->insertItem(
addSelect ? 1 : 0,
obs_module_text("AdvSceneSwitcher.noneTransition"));
}
}
void PopulateWindowSelection(QComboBox *sel, bool addSelect)

View File

@@ -19,7 +19,8 @@ EXPORT QStringList GetSourceNames();
EXPORT void PopulateTransitionSelection(QComboBox *sel, bool addCurrent = true,
bool addAny = false,
bool addSelect = true);
bool addSelect = true,
bool addNone = false);
EXPORT void PopulateWindowSelection(QComboBox *sel, bool addSelect = true);
void PopulateAudioSelection(QComboBox *sel, bool addSelect = true);
void PopulateVideoSelection(QComboBox *sel, bool addMainOutput = false,

View File

@@ -1,11 +1,9 @@
#include "temp-variable.hpp"
#include "obs-module-helper.hpp"
#include "macro.hpp"
#include "macro-action-macro.hpp"
#include "macro-edit.hpp"
#include "macro-helpers.hpp"
#include "macro-segment.hpp"
#include "macro.hpp"
#include "obs-module-helper.hpp"
#include "plugin-state-helpers.hpp"
#include "sync-helpers.hpp"
#include "ui-helpers.hpp"

View File

@@ -1,18 +1,12 @@
#include "ui-helpers.hpp"
#include "advanced-scene-switcher.hpp"
#include "non-modal-dialog.hpp"
#include "obs-module-helper.hpp"
#include "plugin-state-helpers.hpp"
#include <obs-frontend-api.h>
#include <QAbstractButton>
#include <QComboBox>
#include <QCursor>
#include <QGraphicsColorizeEffect>
#include <QListView>
#include <QListWidget>
#include <QMainWindow>
#include <QPropertyAnimation>
#include <QScrollBar>

View File

@@ -1,18 +1,15 @@
#pragma once
#include "export-symbol-helper.hpp"
#include <QAbstractButton>
#include <QColor>
#include <QComboBox>
#include <QIcon>
#include <QListWidget>
#include <QString>
#include <QWidget>
#include <string>
class QAbstractButton;
class QComboBox;
class QListWidget;
class QWidget;
namespace advss {
// Returns QObject* to QPropertyAnimation object

View File

@@ -1,9 +1,6 @@
#include "utility.hpp"
#include <QCursor>
#include <QListWidget>
#include <QTextStream>
#include <sstream>
namespace advss {

View File

@@ -1,15 +1,14 @@
#pragma once
#include "export-symbol-helper.hpp"
#include <optional>
#include <QListWidget>
#include <QMetaObject>
#include <QPushButton>
#include <QString>
#include <QWidget>
#include <string>
class QListWidget;
class QObject;
class QWidget;
namespace advss {
EXPORT std::pair<int, int> GetCursorPos();

View File

@@ -1,7 +1,6 @@
#include "websocket-api.hpp"
#include "obs-websocket-api.h"
#include "plugin-state-helpers.hpp"
#include "version.h"
// Must be after "obs-websocket-api.h" to avoid logging function conflict
#include "log-helper.hpp"
@@ -16,7 +15,6 @@ static constexpr char VendorName[] = "AdvancedSceneSwitcher";
static constexpr char VendorRequestStart[] = "AdvancedSceneSwitcherStart";
static constexpr char VendorRequestStop[] = "AdvancedSceneSwitcherStop";
static constexpr char VendorRequestStatus[] = "IsAdvancedSceneSwitcherRunning";
static constexpr char VendorRequestVersion[] = "AdvancedSceneSwitcherVersion";
static obs_websocket_vendor vendor;
static void registerWebsocketVendor();
@@ -84,12 +82,6 @@ static void registerWebsocketVendor()
obs_data_set_bool(response, "isRunning",
PluginIsRunning());
});
registerWebsocketVendorRequest(
VendorRequestVersion,
[](obs_data_t *, obs_data_t *response, void *) {
obs_data_set_string(response, "version", g_GIT_TAG);
obs_data_set_string(response, "commit", g_GIT_SHA1);
});
}
const char *GetWebsocketVendorName()

View File

@@ -1,106 +0,0 @@
#include "variable-color-button.hpp"
#include "obs-module-helper.hpp"
#include "ui-helpers.hpp"
#include <QColorDialog>
#include <QHBoxLayout>
namespace advss {
VariableColorButton::VariableColorButton(QWidget *parent,
const QString &selectText)
: QWidget(parent),
_colorSwatch(new QLabel()),
_selectColor(new QPushButton(selectText)),
_variable(new VariableSelection(this)),
_toggleType(new QPushButton())
{
_toggleType->setCheckable(true);
_toggleType->setMaximumWidth(11);
SetButtonIcon(_toggleType, GetThemeTypeName() == "Light"
? ":/res/images/dots-vert.svg"
: "theme:Dark/dots-vert.svg");
QWidget::connect(_selectColor, SIGNAL(clicked()), this,
SLOT(SelectColorClicked()));
QWidget::connect(_toggleType, SIGNAL(toggled(bool)), this,
SLOT(ToggleTypeClicked(bool)));
QWidget::connect(_variable, SIGNAL(SelectionChanged(const QString &)),
this, SLOT(VariableChanged(const QString &)));
auto layout = new QHBoxLayout();
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(_colorSwatch);
layout->addWidget(_selectColor);
layout->addWidget(_variable);
layout->addWidget(_toggleType);
setLayout(layout);
SetVisibility();
}
void VariableColorButton::SetValue(const ColorVariable &color)
{
_color = color;
const QSignalBlocker b1(_toggleType);
const QSignalBlocker b2(_variable);
_toggleType->setChecked(!color.IsFixedType());
SetupColorLabel(color.GetFixedValue());
_variable->SetVariable(color.GetVariable());
SetVisibility();
}
void VariableColorButton::SelectColorClicked()
{
const QColor color = QColorDialog::getColor(
_color.GetFixedValue(), this, _selectColor->text(),
QColorDialog::ColorDialogOption());
if (!color.isValid()) {
return;
}
SetupColorLabel(color);
_color._value = color;
emit ColorVariableChanged(_color);
}
void VariableColorButton::VariableChanged(const QString &name)
{
_color._variable = GetWeakVariableByQString(name);
emit ColorVariableChanged(_color);
}
void VariableColorButton::ToggleTypeClicked(bool useVariable)
{
_color._type = useVariable ? ColorVariable::Type::VARIABLE
: ColorVariable::Type::FIXED_VALUE;
SetVisibility();
emit ColorVariableChanged(_color);
}
void VariableColorButton::SetupColorLabel(const QColor &color)
{
_colorSwatch->setText(color.name());
_colorSwatch->setStyleSheet(
QString("background-color: %1;").arg(color.name()));
}
void VariableColorButton::SetVisibility()
{
if (_color.IsFixedType()) {
SetupColorLabel(_color.GetFixedValue());
_colorSwatch->show();
_selectColor->show();
_variable->hide();
_toggleType->setVisible(!GetVariables().empty());
} else {
_colorSwatch->hide();
_selectColor->hide();
_variable->show();
_variable->setToolTip(obs_module_text(
"AdvSceneSwitcher.condition.video.colorVariableTooltip"));
_toggleType->show();
}
adjustSize();
updateGeometry();
}
} // namespace advss

View File

@@ -1,37 +0,0 @@
#pragma once
#include "export-symbol-helper.hpp"
#include "variable-color.hpp"
#include <QLabel>
#include <QPushButton>
#include <QWidget>
namespace advss {
class ADVSS_EXPORT VariableColorButton : public QWidget {
Q_OBJECT
public:
VariableColorButton(QWidget *parent, const QString &selectText);
void SetValue(const ColorVariable &);
ColorVariable Value() const { return _color; }
public slots:
void SelectColorClicked();
void VariableChanged(const QString &);
void ToggleTypeClicked(bool useVariable);
signals:
void ColorVariableChanged(const ColorVariable &);
private:
void SetupColorLabel(const QColor &);
void SetVisibility();
ColorVariable _color;
QLabel *_colorSwatch;
QPushButton *_selectColor;
VariableSelection *_variable;
QPushButton *_toggleType;
};
} // namespace advss

View File

@@ -1,53 +0,0 @@
#include "variable-color.hpp"
#include <obs.hpp>
namespace advss {
ColorVariable::ColorVariable(const QColor &value) : _value(value) {}
void ColorVariable::Save(obs_data_t *obj, const char *name) const
{
OBSDataAutoRelease data = obs_data_create();
obs_data_set_int(data, "version", 1);
obs_data_set_int(data, "type", static_cast<int>(_type));
auto var = _variable.lock();
if (var) {
obs_data_set_string(data, "variable", var->Name().c_str());
}
obs_data_set_int(data, "red", _value.red());
obs_data_set_int(data, "green", _value.green());
obs_data_set_int(data, "blue", _value.blue());
obs_data_set_obj(obj, name, data);
}
void ColorVariable::Load(obs_data_t *obj, const char *name)
{
OBSDataAutoRelease data = obs_data_get_obj(obj, name);
_value.setRed(obs_data_get_int(data, "red"));
_value.setGreen(obs_data_get_int(data, "green"));
_value.setBlue(obs_data_get_int(data, "blue"));
if (!obs_data_has_user_value(data, "version")) {
// Old format: no variable support, just R/G/B
_type = Type::FIXED_VALUE;
return;
}
auto variableName = obs_data_get_string(data, "variable");
_variable = GetWeakVariableByName(variableName);
_type = static_cast<Type>(obs_data_get_int(data, "type"));
}
QColor ColorVariable::GetValue() const
{
if (_type == Type::FIXED_VALUE) {
return _value;
}
auto var = _variable.lock();
if (!var) {
return Qt::black;
}
const QColor color(QString::fromStdString(var->Value()));
return color.isValid() ? color : Qt::black;
}
} // namespace advss

View File

@@ -1,35 +0,0 @@
#pragma once
#include "variable.hpp"
#include <obs-data.h>
#include <QColor>
namespace advss {
class VariableColorButton;
class ADVSS_EXPORT ColorVariable {
public:
enum class Type { FIXED_VALUE, VARIABLE };
ColorVariable() = default;
ColorVariable(const QColor &value);
void Save(obs_data_t *obj, const char *name) const;
void Load(obs_data_t *obj, const char *name);
QColor GetValue() const;
QColor GetFixedValue() const { return _value; }
bool IsFixedType() const { return _type == Type::FIXED_VALUE; }
Type GetType() const { return _type; }
std::weak_ptr<Variable> GetVariable() const { return _variable; }
private:
Type _type = Type::FIXED_VALUE;
QColor _value = Qt::black;
std::weak_ptr<Variable> _variable;
friend class VariableColorButton;
};
} // namespace advss

View File

@@ -18,30 +18,6 @@ static std::deque<std::shared_ptr<Item>> variables;
static std::mutex lastVariableChangeMutex;
static std::chrono::high_resolution_clock::time_point lastVariableChange{};
// When set, Variable::Value() and Variable::SetValue() operate on this context
// instead of the global variable state. Used by action queues to isolate
// variable reads and writes to a snapshot taken at the time the action was
// added to the queue, so that actions can modify variables without affecting
// the global state or other queue entries.
thread_local static VariableContext *activeVarContext = nullptr;
VariableContext CreateVariableContext()
{
VariableContext context;
for (const auto &v : variables) {
const auto &var = std::dynamic_pointer_cast<Variable>(v);
if (var) {
context[var->Name()] = var->Value(false);
}
}
return context;
}
void SetActiveVariableContext(VariableContext *context)
{
activeVarContext = context;
}
static bool setup()
{
AddEarlySaveStep(SaveVariables);
@@ -100,14 +76,6 @@ void Variable::Save(obs_data_t *obj) const
std::string Variable::Value(bool updateLastUsed) const
{
if (activeVarContext) {
auto it = activeVarContext->find(Name());
if (it == activeVarContext->end()) {
return "";
}
return it->second;
}
std::lock_guard<std::mutex> lock(_mutex);
if (updateLastUsed) {
UpdateLastUsed();
@@ -140,31 +108,16 @@ std::optional<int> Variable::IntValue() const
void Variable::SetValue(const std::string &value)
{
if (activeVarContext) {
auto it = activeVarContext->find(Name());
if (it == activeVarContext->end()) {
return;
}
it->second = value;
setLastVariableChangeTime();
return;
std::lock_guard<std::mutex> lock(_mutex);
_previousValue = _value;
_value = value;
UpdateLastUsed();
if (_previousValue != _value) {
_lastChanged = std::chrono::high_resolution_clock::now();
++_valueChangeCount;
}
{
std::lock_guard<std::mutex> lock(_mutex);
_previousValue = _value;
_value = value;
UpdateLastUsed();
if (_previousValue != _value) {
_lastChanged =
std::chrono::high_resolution_clock::now();
++_valueChangeCount;
}
setLastVariableChangeTime();
}
_cv.notify_all();
setLastVariableChangeTime();
}
void Variable::SetValue(double value)

View File

@@ -3,12 +3,10 @@
#include "item-selection-helpers.hpp"
#include "resizing-text-edit.hpp"
#include <condition_variable>
#include <mutex>
#include <obs-data.h>
#include <optional>
#include <string>
#include <unordered_map>
#include <QStringList>
namespace advss {
@@ -45,11 +43,6 @@ public:
std::optional<uint64_t> GetSecondsSinceLastUse() const;
std::optional<uint64_t> GetSecondsSinceLastChange() const;
void MarkAsUsed() const;
EXPORT std::condition_variable &GetCV() { return _cv; }
EXPORT std::unique_lock<std::mutex> GetCVLock()
{
return std::unique_lock<std::mutex>(_cvMutex);
}
private:
SaveAction _saveAction = SaveAction::DONT_SAVE;
@@ -60,8 +53,6 @@ private:
mutable std::chrono::high_resolution_clock::time_point _lastUsed;
mutable std::chrono::high_resolution_clock::time_point _lastChanged;
mutable std::mutex _mutex;
std::mutex _cvMutex;
std::condition_variable _cv;
void UpdateLastUsed() const;
@@ -117,10 +108,6 @@ signals:
void Remove(const QString &);
};
using VariableContext = std::unordered_map<std::string, std::string>;
VariableContext CreateVariableContext();
void SetActiveVariableContext(VariableContext *context);
std::deque<std::shared_ptr<Item>> &GetVariables();
EXPORT Variable *GetVariableByName(const std::string &name);
EXPORT Variable *GetVariableByQString(const QString &name);

View File

@@ -41,7 +41,6 @@ add_plugin(stream-deck)
add_plugin(twitch)
add_plugin(usb)
add_plugin(video)
add_plugin(speech)
# ---------------------------------------------------------------------------- #

View File

@@ -165,20 +165,12 @@ MacroActionRecordEdit::MacroActionRecordEdit(
QWidget *parent, std::shared_ptr<MacroActionRecord> entryData)
: QWidget(parent),
_actions(new QComboBox()),
_pauseHint(new HelpIcon(
obs_module_text(
"AdvSceneSwitcher.action.recording.pause.hint"),
this)),
_splitHint(new HelpIcon(
obs_module_text(
"AdvSceneSwitcher.action.recording.split.hint"),
this)),
_pauseHint(new QLabel(obs_module_text(
"AdvSceneSwitcher.action.recording.pause.hint"))),
_splitHint(new QLabel(obs_module_text(
"AdvSceneSwitcher.action.recording.split.hint"))),
_recordFolder(new FileSelection(FileSelection::Type::FOLDER, this)),
_recordFileFormat(new VariableLineEdit(this)),
_outputNotActiveHelp(new HelpIcon(
obs_module_text(
"AdvSceneSwitcher.action.recording.outputNotActive.hint"),
this)),
_chapterName(new VariableLineEdit(this))
{
populateActionSelection(_actions);
@@ -192,18 +184,16 @@ MacroActionRecordEdit::MacroActionRecordEdit(
QWidget::connect(_chapterName, SIGNAL(editingFinished()), this,
SLOT(ChapterNameChanged()));
_mainLayout = new QHBoxLayout;
PlaceWidgets(
obs_module_text("AdvSceneSwitcher.action.recording.layout"),
_mainLayout,
{{"{{actions}}", _actions},
{"{{pauseHint}}", _pauseHint},
{"{{splitHint}}", _splitHint},
{"{{recordFolder}}", _recordFolder},
{"{{recordFileFormat}}", _recordFileFormat},
{"{{outputNotActiveHelp}}", _outputNotActiveHelp},
{"{{chapterName}}", _chapterName}});
setLayout(_mainLayout);
auto mainLayout = new QHBoxLayout;
PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.recording.entry"),
mainLayout,
{{"{{actions}}", _actions},
{"{{pauseHint}}", _pauseHint},
{"{{splitHint}}", _splitHint},
{"{{recordFolder}}", _recordFolder},
{"{{recordFileFormat}}", _recordFileFormat},
{"{{chapterName}}", _chapterName}});
setLayout(mainLayout);
_entryData = entryData;
UpdateEntryData();
@@ -255,20 +245,8 @@ void MacroActionRecordEdit::SetWidgetVisibility()
MacroActionRecord::Action::FOLDER);
_recordFileFormat->setVisible(_entryData->_action ==
MacroActionRecord::Action::FILE_FORMAT);
_outputNotActiveHelp->setVisible(
_entryData->_action == MacroActionRecord::Action::FOLDER ||
_entryData->_action == MacroActionRecord::Action::FILE_FORMAT);
_chapterName->setVisible(_entryData->_action ==
MacroActionRecord::Action::ADD_CHAPTER);
const bool hasExtraWidget =
_entryData->_action == MacroActionRecord::Action::FOLDER ||
_entryData->_action == MacroActionRecord::Action::FILE_FORMAT ||
_entryData->_action == MacroActionRecord::Action::ADD_CHAPTER;
if (hasExtraWidget) {
RemoveStretchIfPresent(_mainLayout);
} else {
AddStretchIfNecessary(_mainLayout);
}
}
void MacroActionRecordEdit::ActionChanged(int value)

View File

@@ -1,7 +1,6 @@
#pragma once
#include "macro-action-edit.hpp"
#include "file-selection.hpp"
#include "help-icon.hpp"
#include "variable-line-edit.hpp"
#include <QDir>
@@ -65,19 +64,19 @@ private slots:
void FormatStringChanged();
void ChapterNameChanged();
protected:
QComboBox *_actions;
QLabel *_pauseHint;
QLabel *_splitHint;
FileSelection *_recordFolder;
VariableLineEdit *_recordFileFormat;
VariableLineEdit *_chapterName;
std::shared_ptr<MacroActionRecord> _entryData;
private:
void SetWidgetVisibility();
QComboBox *_actions;
HelpIcon *_pauseHint;
HelpIcon *_splitHint;
FileSelection *_recordFolder;
VariableLineEdit *_recordFileFormat;
HelpIcon *_outputNotActiveHelp;
VariableLineEdit *_chapterName;
std::shared_ptr<MacroActionRecord> _entryData;
QHBoxLayout *_mainLayout;
bool _loading = true;
};

View File

@@ -1,9 +1,7 @@
#include "macro-action-scene-collection.hpp"
#include "layout-helpers.hpp"
#include "plugin-state-helpers.hpp"
#include "selection-helpers.hpp"
#include "ui-helpers.hpp"
#include <obs-frontend-api.h>
@@ -17,20 +15,6 @@ bool MacroActionSceneCollection::_registered = MacroActionFactory::Register(
MacroActionSceneCollectionEdit::Create,
"AdvSceneSwitcher.action.sceneCollection"});
template<typename F> void QueueUITaskLambda(F &&func)
{
using FnType = std::decay_t<F>;
auto *heapFunc = new FnType(std::forward<F>(func));
QueueUITask(
[](void *param) {
std::unique_ptr<FnType> fn(
static_cast<FnType *>(param));
(*fn)();
},
heapFunc);
}
bool MacroActionSceneCollection::PerformAction()
{
// Changing the scene collection will also reload the settings of the
@@ -39,13 +23,7 @@ bool MacroActionSceneCollection::PerformAction()
if (SettingsWindowIsOpened()) {
return false;
}
const auto collectionName = _sceneCollection;
QueueUITaskLambda([collectionName]() {
obs_frontend_set_current_scene_collection(
collectionName.c_str());
});
obs_frontend_set_current_scene_collection(_sceneCollection.c_str());
// It does not make sense to continue as the current settings will be
// invalid after switching scene collection.
return false;

View File

@@ -1,8 +1,6 @@
#include "macro-action-scene-visibility.hpp"
#include "layout-helpers.hpp"
#include "macro-helpers.hpp"
#include "plugin-state-helpers.hpp"
#include "sync-helpers.hpp"
#include "transition-helpers.hpp"
#include <obs-frontend-api.h>
@@ -160,13 +158,13 @@ static void attachRestoreContext(obs_sceneitem_t *item,
signal_handler_connect(sh, "destroy", handleSourceDestroyed, ctx);
}
static obs_source_t *
setSceneItemVisibility(obs_sceneitem_t *item, const bool setTransition,
const OBSWeakSource &transitionWeak,
const bool setDuration, const Duration &duration,
MacroActionSceneVisibility::Action action)
static void setSceneItemVisibility(obs_sceneitem_t *item,
const bool setTransition,
const TransitionSelection &transitionSel,
const bool setDuration,
const Duration &duration,
MacroActionSceneVisibility::Action action)
{
const OBSSourceAutoRelease transition = OBSGetStrongRef(transitionWeak);
const bool itemIsVisible = obs_sceneitem_visible(item);
const OBSSource currentTransition =
@@ -176,6 +174,16 @@ setSceneItemVisibility(obs_sceneitem_t *item, const bool setTransition,
OBSSource privateTransitionSource = nullptr;
if (setTransition) {
OBSSourceAutoRelease transition;
if (transitionSel.GetType() ==
TransitionSelection::Type::CURRENT) {
transition = obs_source_get_ref(
obs_sceneitem_get_transition(item,
!itemIsVisible));
} else {
transition =
OBSGetStrongRef(transitionSel.GetTransition());
}
privateTransitionSource = SetSceneItemTransition(
item, transition, !itemIsVisible);
} else {
@@ -201,7 +209,7 @@ setSceneItemVisibility(obs_sceneitem_t *item, const bool setTransition,
}
if (!setTransition && !setDuration) {
return privateTransitionSource;
return;
}
if (!privateTransitionSource) {
@@ -214,151 +222,26 @@ setSceneItemVisibility(obs_sceneitem_t *item, const bool setTransition,
item, !itemIsVisible,
currentTransitionDuration);
}
return nullptr;
return;
}
auto sh = obs_source_get_signal_handler(privateTransitionSource);
if (!sh) {
return nullptr;
return;
}
attachRestoreContext(item, privateTransitionSource, itemIsVisible,
currentTransition, currentTransitionDuration);
return privateTransitionSource;
}
namespace {
struct TransitionWaitItem {
obs_sceneitem_t *sceneItem;
obs_source_t *expectedSource;
bool show;
std::atomic<int> *pendingCount;
std::atomic<bool> done{false};
void markDone()
{
bool expected = false;
if (done.compare_exchange_strong(expected, true)) {
(*pendingCount)--;
GetMacroTransitionCV().notify_all();
}
}
};
} // namespace
static void onTransitionDone(void *data, calldata_t *)
{
static_cast<TransitionWaitItem *>(data)->markDone();
}
static void waitForSceneItemTransitions(
std::atomic<int> &pendingCount,
const std::vector<std::unique_ptr<TransitionWaitItem>> &waitItems,
Macro *macro)
{
using namespace std::chrono_literals;
SetMacroAbortWait(false);
std::unique_lock<std::mutex> lock(*GetMutex());
while (pendingCount > 0 && !MacroWaitShouldAbort() &&
!MacroIsStopped(macro) && !OBSIsShuttingDown()) {
GetMacroTransitionCV().wait_for(lock, 100ms);
// Detect transitions replaced mid-wait (e.g. user sets
// transition to "None" via OBS context menu). In that
// case transition_stop never fires, so we poll.
for (const auto &wi : waitItems) {
if (wi->done) {
continue;
}
obs_source_t *current = obs_sceneitem_get_transition(
wi->sceneItem, wi->show);
if (current != wi->expectedSource) {
wi->markDone();
}
}
}
}
bool MacroActionSceneVisibility::PerformAction()
{
auto items = _source.GetSceneItems(_scene);
if (!_blockUntilTransitionDone) {
for (const auto &item : items) {
setSceneItemVisibility(item, _updateTransition,
_transition.GetTransition(),
_updateDuration, _duration,
_action);
}
return true;
}
std::atomic<int> pendingCount(0);
std::vector<OBSSourceAutoRelease> transitionSources;
std::vector<std::unique_ptr<TransitionWaitItem>> waitItems;
std::vector<OBSSignal> signalConnections;
for (const auto &item : items) {
const bool itemWasVisible = obs_sceneitem_visible(item);
bool targetVisible;
switch (_action) {
case Action::SHOW:
targetVisible = true;
break;
case Action::HIDE:
targetVisible = false;
break;
case Action::TOGGLE:
targetVisible = !itemWasVisible;
break;
default:
continue;
}
if (itemWasVisible == targetVisible) {
// No-op: visibility won't change, no transition will play
setSceneItemVisibility(item, _updateTransition,
_transition.GetTransition(),
_updateDuration, _duration,
_action);
continue;
}
auto *source = setSceneItemVisibility(
item, _updateTransition, _transition.GetTransition(),
_updateDuration, _duration, _action);
if (!source) {
continue;
}
auto *sh = obs_source_get_signal_handler(source);
if (!sh) {
continue;
}
transitionSources.emplace_back(obs_source_get_ref(source));
++pendingCount;
auto wi = std::make_unique<TransitionWaitItem>();
wi->sceneItem = item;
wi->expectedSource = source;
wi->show = !itemWasVisible;
wi->pendingCount = &pendingCount;
signalConnections.emplace_back(sh, "transition_stop",
onTransitionDone, wi.get());
waitItems.push_back(std::move(wi));
setSceneItemVisibility(item, _updateTransition, _transition,
_updateDuration, _duration, _action);
}
if (pendingCount == 0) {
return true;
}
waitForSceneItemTransitions(pendingCount, waitItems, GetMacro());
return !MacroWaitShouldAbort();
return true;
}
void MacroActionSceneVisibility::LogAction() const
@@ -386,8 +269,6 @@ bool MacroActionSceneVisibility::Save(obs_data_t *obj) const
obs_data_set_bool(obj, "updateDuration", _updateDuration);
_duration.Save(obj);
obs_data_set_int(obj, "action", static_cast<int>(_action));
obs_data_set_bool(obj, "blockUntilTransitionDone",
_blockUntilTransitionDone);
return true;
}
@@ -409,8 +290,6 @@ bool MacroActionSceneVisibility::Load(obs_data_t *obj)
_duration.Load(obj);
_action = static_cast<MacroActionSceneVisibility::Action>(
obs_data_get_int(obj, "action"));
_blockUntilTransitionDone =
obs_data_get_bool(obj, "blockUntilTransitionDone");
// TODO: Remove in future version
if (obs_data_get_int(obj, "sourceType") != 0) {
@@ -469,14 +348,10 @@ MacroActionSceneVisibilityEdit::MacroActionSceneVisibilityEdit(
},
SceneItemSelectionWidget::NameClashMode::ALL)),
_updateTransition(new QCheckBox(this)),
_transitions(new TransitionSelectionWidget(this, false, false)),
_transitions(new TransitionSelectionWidget(this, true, false, true)),
_updateDuration(new QCheckBox(this)),
_duration(new DurationSelection(this, false)),
_durationLayout(new QHBoxLayout),
_blockUntilTransitionDone(new QCheckBox(
obs_module_text(
"AdvSceneSwitcher.action.sceneVisibility.blockUntilTransitionDone"),
this)),
_actions(new QComboBox())
{
populateActionSelection(_actions);
@@ -502,8 +377,6 @@ MacroActionSceneVisibilityEdit::MacroActionSceneVisibilityEdit(
SLOT(UpdateDurationChanged(int)));
QWidget::connect(_duration, SIGNAL(DurationChanged(const Duration &)),
this, SLOT(DurationChanged(const Duration &)));
QWidget::connect(_blockUntilTransitionDone, SIGNAL(stateChanged(int)),
this, SLOT(BlockUntilTransitionDoneChanged(int)));
auto sceneItemLayout = new QHBoxLayout;
PlaceWidgets(obs_module_text(
@@ -532,7 +405,6 @@ MacroActionSceneVisibilityEdit::MacroActionSceneVisibilityEdit(
layout->addLayout(sceneItemLayout);
layout->addLayout(transitionLayout);
layout->addLayout(_durationLayout);
layout->addWidget(_blockUntilTransitionDone);
setLayout(layout);
_entryData = entryData;
@@ -554,8 +426,6 @@ void MacroActionSceneVisibilityEdit::UpdateEntryData()
_transitions->SetTransition(_entryData->_transition);
_updateDuration->setChecked(_entryData->_updateDuration);
_duration->SetDuration(_entryData->_duration);
_blockUntilTransitionDone->setChecked(
_entryData->_blockUntilTransitionDone);
}
void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
@@ -610,16 +480,13 @@ void MacroActionSceneVisibilityEdit::ActionChanged(int value)
static_cast<MacroActionSceneVisibility::Action>(value);
}
void MacroActionSceneVisibilityEdit::BlockUntilTransitionDoneChanged(int state)
{
GUARD_LOADING_AND_LOCK();
_entryData->_blockUntilTransitionDone = state;
}
void MacroActionSceneVisibilityEdit::SetWidgetVisibility()
{
const auto transitionType = _entryData->_transition.GetType();
const bool hideDurationSelection =
_entryData->_updateTransition &&
transitionType != TransitionSelection::Type::CURRENT &&
transitionType != TransitionSelection::Type::NONE &&
IsFixedLengthTransition(
_entryData->_transition.GetTransition());

View File

@@ -26,7 +26,6 @@ public:
TransitionSelection _transition;
bool _updateDuration = false;
Duration _duration;
bool _blockUntilTransitionDone = true;
enum class Action {
SHOW,
@@ -65,7 +64,6 @@ private slots:
void UpdateDurationChanged(int);
void DurationChanged(const Duration &seconds);
void ActionChanged(int value);
void BlockUntilTransitionDoneChanged(int state);
signals:
void HeaderInfoChanged(const QString &);
@@ -79,7 +77,6 @@ private:
QCheckBox *_updateDuration;
DurationSelection *_duration;
QHBoxLayout *_durationLayout;
QCheckBox *_blockUntilTransitionDone;
QComboBox *_actions;
std::shared_ptr<MacroActionSceneVisibility> _entryData;

View File

@@ -406,15 +406,17 @@ void MacroActionTransitionEdit::SetWidgetVisibility()
MacroActionTransition::Type::TBAR;
const bool isReleaseTbar = _entryData->_type ==
MacroActionTransition::Type::RELEASE_TBAR;
_sources->setVisible(
_entryData->_type == MacroActionTransition::Type::SOURCE_HIDE ||
_entryData->_type == MacroActionTransition::Type::SOURCE_SHOW);
const bool isSourceTransition =
_entryData->_type == MacroActionTransition::Type::SOURCE_SHOW ||
_entryData->_type == MacroActionTransition::Type::SOURCE_HIDE;
_sources->setVisible(isSourceTransition);
_scenes->setVisible(_entryData->_type !=
MacroActionTransition::Type::SCENE &&
!isTbar && !isReleaseTbar);
SetLayoutVisible(_transitionLayout, !isTbar && !isReleaseTbar);
SetLayoutVisible(_durationLayout, !isTbar && !isReleaseTbar);
SetLayoutVisible(_tbarLayout, isTbar);
_transitions->EnableNoneEntry(isSourceTransition);
adjustSize();
}

View File

@@ -19,21 +19,6 @@ static const std::map<MacroActionWait::Type, std::string> waitTypes = {
"AdvSceneSwitcher.action.wait.type.fixed"},
{MacroActionWait::Type::RANDOM,
"AdvSceneSwitcher.action.wait.type.random"},
{MacroActionWait::Type::VARIABLE_WAIT,
"AdvSceneSwitcher.action.wait.type.variableCondition"},
};
static const std::map<MacroActionWait::Condition, std::string> conditionTypes = {
{MacroActionWait::Condition::EQUALS,
"AdvSceneSwitcher.action.wait.condition.equals"},
{MacroActionWait::Condition::DOES_NOT_EQUAL,
"AdvSceneSwitcher.action.wait.condition.doesNotEqual"},
{MacroActionWait::Condition::IS_EMPTY,
"AdvSceneSwitcher.action.wait.condition.isEmpty"},
{MacroActionWait::Condition::LESS_THAN,
"AdvSceneSwitcher.action.wait.condition.lessThan"},
{MacroActionWait::Condition::GREATER_THAN,
"AdvSceneSwitcher.action.wait.condition.greaterThan"},
};
static std::random_device rd;
@@ -50,52 +35,7 @@ static void waitHelper(std::unique_lock<std::mutex> *lock, Macro *macro,
}
}
void MacroActionWait::SetupTempVars()
{
MacroAction::SetupTempVars();
if (_waitType != Type::VARIABLE_WAIT) {
return;
}
AddTempvar(
"timedOut",
obs_module_text("AdvSceneSwitcher.tempVar.wait.timedOut"),
obs_module_text(
"AdvSceneSwitcher.tempVar.wait.timedOut.description"));
}
bool MacroActionWait::ConditionIsMet() const
{
auto var = _variable.lock();
if (!var) {
return false;
}
switch (_condition) {
case Condition::EQUALS:
if (_regex.Enabled()) {
return _regex.Matches(var->Value(), _strValue);
}
return var->Value() == std::string(_strValue);
case Condition::DOES_NOT_EQUAL:
if (_regex.Enabled()) {
return !_regex.Matches(var->Value(), _strValue);
}
return var->Value() != std::string(_strValue);
case Condition::IS_EMPTY:
return var->Value().empty();
case Condition::LESS_THAN: {
auto val = var->DoubleValue();
return val.has_value() && *val < (double)_numValue;
}
case Condition::GREATER_THAN: {
auto val = var->DoubleValue();
return val.has_value() && *val > (double)_numValue;
}
}
return false;
}
bool MacroActionWait::PerformDurationWait()
bool MacroActionWait::PerformAction()
{
double sleepDuration;
if (_waitType == Type::FIXED) {
@@ -126,71 +66,20 @@ bool MacroActionWait::PerformDurationWait()
return !MacroWaitShouldAbort();
}
bool MacroActionWait::PerformVariableWait()
{
auto var = _variable.lock();
if (!var) {
return true;
}
auto deadline =
_useTimeout
? std::chrono::high_resolution_clock::now() +
std::chrono::milliseconds((
int)(_conditionTimeout.Milliseconds()))
: std::chrono::high_resolution_clock::time_point::max();
SetMacroAbortWait(false);
SuspendLock suspendLock(*this);
auto cvLock = var->GetCVLock();
while (!MacroWaitShouldAbort() && !MacroIsStopped(GetMacro())) {
if (ConditionIsMet()) {
SetTempVarValue("timedOut", false);
return true;
}
auto now = std::chrono::high_resolution_clock::now();
if (now >= deadline) {
SetTempVarValue("timedOut", true);
return true;
}
auto wakeAt =
std::min(now + std::chrono::milliseconds(50), deadline);
var->GetCV().wait_until(cvLock, wakeAt);
}
return !MacroWaitShouldAbort();
}
bool MacroActionWait::PerformAction()
{
if (_waitType == Type::VARIABLE_WAIT) {
return PerformVariableWait();
}
return PerformDurationWait();
}
bool MacroActionWait::Save(obs_data_t *obj) const
{
MacroAction::Save(obj);
obs_data_set_int(obj, "waitType", static_cast<int>(_waitType));
obs_data_set_int(obj, "version", 1);
_duration.Save(obj);
_duration2.Save(obj, "duration2");
obs_data_set_string(obj, "variableName",
GetWeakVariableName(_variable).c_str());
obs_data_set_int(obj, "condition", static_cast<int>(_condition));
_strValue.Save(obj, "strValue");
_numValue.Save(obj, "numValue");
_regex.Save(obj);
obs_data_set_bool(obj, "useTimeout", _useTimeout);
_conditionTimeout.Save(obj, "conditionTimeout");
obs_data_set_int(obj, "waitType", static_cast<int>(_waitType));
obs_data_set_int(obj, "version", 1);
return true;
}
bool MacroActionWait::Load(obs_data_t *obj)
{
MacroAction::Load(obj);
_waitType = static_cast<Type>(obs_data_get_int(obj, "waitType"));
_duration.Load(obj);
// TODO: remove this fallback
if (obs_data_get_int(obj, "version") == 1) {
_duration2.Load(obj, "duration2");
@@ -199,23 +88,12 @@ bool MacroActionWait::Load(obs_data_t *obj)
_duration2.SetUnit(static_cast<Duration::Unit>(
obs_data_get_int(obj, "displayUnit2")));
}
_duration.Load(obj);
_variable =
GetWeakVariableByName(obs_data_get_string(obj, "variableName"));
_condition = static_cast<Condition>(obs_data_get_int(obj, "condition"));
_strValue.Load(obj, "strValue");
_numValue.Load(obj, "numValue");
_regex.Load(obj);
_useTimeout = obs_data_get_bool(obj, "useTimeout");
_conditionTimeout.Load(obj, "conditionTimeout");
_waitType = static_cast<Type>(obs_data_get_int(obj, "waitType"));
return true;
}
std::string MacroActionWait::GetShortDesc() const
{
if (_waitType == Type::VARIABLE_WAIT) {
return GetWeakVariableName(_variable);
}
if (_waitType == Type::FIXED) {
return _duration.ToString();
}
@@ -236,18 +114,12 @@ void MacroActionWait::ResolveVariablesToFixedValues()
{
_duration.ResolveVariables();
_duration2.ResolveVariables();
_strValue.ResolveVariables();
_numValue.ResolveVariables();
_conditionTimeout.ResolveVariables();
}
template<typename T>
static inline void populateSelection(QComboBox *list,
const std::map<T, std::string> &options)
static inline void populateTypeSelection(QComboBox *list)
{
for (const auto &[value, name] : options) {
list->addItem(obs_module_text(name.c_str()),
static_cast<int>(value));
for (const auto &[_, name] : waitTypes) {
list->addItem(obs_module_text(name.c_str()));
}
}
@@ -256,21 +128,10 @@ MacroActionWaitEdit::MacroActionWaitEdit(
: QWidget(parent),
_duration(new DurationSelection()),
_duration2(new DurationSelection()),
_variable(new VariableSelection(this)),
_variableCondition(new QComboBox()),
_strValue(new VariableTextEdit(this, 5, 1, 1)),
_numValue(new VariableDoubleSpinBox()),
_regex(new RegexConfigWidget(parent)),
_useTimeout(new QCheckBox()),
_conditionTimeout(new DurationSelection()),
_waitType(new QComboBox()),
_mainLayout(new QHBoxLayout()),
_timeoutLayout(new QHBoxLayout())
_mainLayout(new QHBoxLayout())
{
_numValue->setMinimum(-9999999999);
_numValue->setMaximum(9999999999);
populateSelection(_waitType, waitTypes);
populateSelection(_variableCondition, conditionTypes);
populateTypeSelection(_waitType);
QWidget::connect(_duration, SIGNAL(DurationChanged(const Duration &)),
this, SLOT(DurationChanged(const Duration &)));
@@ -278,37 +139,8 @@ MacroActionWaitEdit::MacroActionWaitEdit(
this, SLOT(Duration2Changed(const Duration &)));
QWidget::connect(_waitType, SIGNAL(currentIndexChanged(int)), this,
SLOT(TypeChanged(int)));
QWidget::connect(_variable, SIGNAL(SelectionChanged(const QString &)),
this, SLOT(VariableChanged(const QString &)));
QWidget::connect(_variableCondition, SIGNAL(currentIndexChanged(int)),
this, SLOT(ConditionChanged(int)));
QWidget::connect(_strValue, SIGNAL(textChanged()), this,
SLOT(StrValueChanged()));
QWidget::connect(
_numValue,
SIGNAL(NumberVariableChanged(const NumberVariable<double> &)),
this, SLOT(NumValueChanged(const NumberVariable<double> &)));
QWidget::connect(_regex,
SIGNAL(RegexConfigChanged(const RegexConfig &)), this,
SLOT(RegexChanged(const RegexConfig &)));
QWidget::connect(_useTimeout, SIGNAL(stateChanged(int)), this,
SLOT(UseTimeoutChanged(int)));
QWidget::connect(_conditionTimeout,
SIGNAL(DurationChanged(const Duration &)), this,
SLOT(ConditionTimeoutChanged(const Duration &)));
PlaceWidgets(
obs_module_text("AdvSceneSwitcher.action.wait.layout.timeout"),
_timeoutLayout,
{
{"{{useTimeout}}", _useTimeout},
{"{{conditionTimeout}}", _conditionTimeout},
});
auto *outerLayout = new QVBoxLayout();
outerLayout->addLayout(_mainLayout);
outerLayout->addLayout(_timeoutLayout);
setLayout(outerLayout);
setLayout(_mainLayout);
_entryData = entryData;
UpdateEntryData();
@@ -321,30 +153,15 @@ void MacroActionWaitEdit::UpdateEntryData()
return;
}
_waitType->setCurrentIndex(static_cast<int>(_entryData->_waitType));
switch (_entryData->_waitType) {
case MacroActionWait::Type::FIXED:
if (_entryData->_waitType == MacroActionWait::Type::FIXED) {
SetupFixedDurationEdit();
break;
case MacroActionWait::Type::RANDOM:
} else {
SetupRandomDurationEdit();
break;
case MacroActionWait::Type::VARIABLE_WAIT:
SetupVariableWaitEdit();
break;
}
_duration->SetDuration(_entryData->_duration);
_duration2->SetDuration(_entryData->_duration2);
_variable->SetVariable(_entryData->_variable);
_variableCondition->setCurrentIndex(
static_cast<int>(_entryData->_condition));
_strValue->setPlainText(_entryData->_strValue);
_numValue->SetValue(_entryData->_numValue);
_regex->SetRegexConfig(_entryData->_regex);
_useTimeout->setChecked(_entryData->_useTimeout);
_conditionTimeout->SetDuration(_entryData->_conditionTimeout);
_waitType->setCurrentIndex(static_cast<int>(_entryData->_waitType));
}
void MacroActionWaitEdit::SetupFixedDurationEdit()
@@ -352,24 +169,15 @@ void MacroActionWaitEdit::SetupFixedDurationEdit()
_mainLayout->removeWidget(_duration);
_mainLayout->removeWidget(_duration2);
_mainLayout->removeWidget(_waitType);
_mainLayout->removeWidget(_variable);
_mainLayout->removeWidget(_variableCondition);
_mainLayout->removeWidget(_strValue);
_mainLayout->removeWidget(_numValue);
_mainLayout->removeWidget(_regex);
ClearLayout(_mainLayout);
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
{"{{duration}}", _duration},
{"{{waitType}}", _waitType},
};
PlaceWidgets(
obs_module_text("AdvSceneSwitcher.action.wait.layout.fixed"),
_mainLayout,
{{"{{duration}}", _duration}, {"{{waitType}}", _waitType}});
_duration->show();
obs_module_text("AdvSceneSwitcher.action.wait.entry.fixed"),
_mainLayout, widgetPlaceholders);
_duration2->hide();
_variable->hide();
_variableCondition->hide();
_strValue->hide();
_numValue->hide();
_regex->hide();
SetLayoutVisible(_timeoutLayout, false);
}
void MacroActionWaitEdit::SetupRandomDurationEdit()
@@ -377,99 +185,30 @@ void MacroActionWaitEdit::SetupRandomDurationEdit()
_mainLayout->removeWidget(_duration);
_mainLayout->removeWidget(_duration2);
_mainLayout->removeWidget(_waitType);
_mainLayout->removeWidget(_variable);
_mainLayout->removeWidget(_variableCondition);
_mainLayout->removeWidget(_strValue);
_mainLayout->removeWidget(_numValue);
_mainLayout->removeWidget(_regex);
ClearLayout(_mainLayout);
PlaceWidgets(
obs_module_text("AdvSceneSwitcher.action.wait.layout.random"),
_mainLayout,
{{"{{duration}}", _duration},
{"{{duration2}}", _duration2},
{"{{waitType}}", _waitType}});
_duration->show();
_duration2->show();
_variable->hide();
_variableCondition->hide();
_strValue->hide();
_numValue->hide();
_regex->hide();
SetLayoutVisible(_timeoutLayout, false);
}
void MacroActionWaitEdit::SetupVariableWaitEdit()
{
_mainLayout->removeWidget(_duration);
_mainLayout->removeWidget(_duration2);
_mainLayout->removeWidget(_waitType);
_mainLayout->removeWidget(_variable);
_mainLayout->removeWidget(_variableCondition);
_mainLayout->removeWidget(_strValue);
_mainLayout->removeWidget(_numValue);
_mainLayout->removeWidget(_regex);
ClearLayout(_mainLayout);
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
{"{{duration}}", _duration},
{"{{duration2}}", _duration2},
{"{{waitType}}", _waitType},
{"{{variable}}", _variable},
{"{{condition}}", _variableCondition},
{"{{strValue}}", _strValue},
{"{{numValue}}", _numValue},
{"{{regex}}", _regex},
};
PlaceWidgets(
obs_module_text(
"AdvSceneSwitcher.action.wait.layout.variableCondition"),
obs_module_text("AdvSceneSwitcher.action.wait.entry.random"),
_mainLayout, widgetPlaceholders);
_duration->hide();
_duration2->hide();
_variable->show();
_variableCondition->show();
SetLayoutVisible(_timeoutLayout, true);
SetVariableWaitWidgetVisibility();
_duration2->show();
}
void MacroActionWaitEdit::SetVariableWaitWidgetVisibility()
{
if (!_entryData) {
return;
}
const auto cond = _entryData->_condition;
const bool isStringComparison =
cond == MacroActionWait::Condition::EQUALS ||
cond == MacroActionWait::Condition::DOES_NOT_EQUAL;
_strValue->setVisible(isStringComparison);
_regex->setVisible(isStringComparison);
_numValue->setVisible(cond == MacroActionWait::Condition::LESS_THAN ||
cond == MacroActionWait::Condition::GREATER_THAN);
_conditionTimeout->setVisible(_entryData->_useTimeout);
adjustSize();
updateGeometry();
}
void MacroActionWaitEdit::TypeChanged(int idx)
void MacroActionWaitEdit::TypeChanged(int value)
{
GUARD_LOADING_AND_LOCK();
auto type = static_cast<MacroActionWait::Type>(
_waitType->itemData(idx).toInt());
auto type = static_cast<MacroActionWait::Type>(value);
switch (type) {
case MacroActionWait::Type::FIXED:
if (type == MacroActionWait::Type::FIXED) {
SetupFixedDurationEdit();
break;
case MacroActionWait::Type::RANDOM:
} else {
SetupRandomDurationEdit();
break;
case MacroActionWait::Type::VARIABLE_WAIT:
SetupVariableWaitEdit();
break;
}
_entryData->_waitType = type;
_entryData->SetupTempVars();
emit HeaderInfoChanged(
QString::fromStdString(_entryData->GetShortDesc()));
}
@@ -490,55 +229,4 @@ void MacroActionWaitEdit::Duration2Changed(const Duration &dur)
QString::fromStdString(_entryData->GetShortDesc()));
}
void MacroActionWaitEdit::VariableChanged(const QString &text)
{
GUARD_LOADING_AND_LOCK();
_entryData->_variable = GetWeakVariableByQString(text);
emit HeaderInfoChanged(
QString::fromStdString(_entryData->GetShortDesc()));
}
void MacroActionWaitEdit::ConditionChanged(int idx)
{
GUARD_LOADING_AND_LOCK();
_entryData->_condition = static_cast<MacroActionWait::Condition>(
_variableCondition->itemData(idx).toInt());
SetVariableWaitWidgetVisibility();
}
void MacroActionWaitEdit::StrValueChanged()
{
GUARD_LOADING_AND_LOCK();
_entryData->_strValue = _strValue->toPlainText().toStdString();
adjustSize();
updateGeometry();
}
void MacroActionWaitEdit::NumValueChanged(const NumberVariable<double> &val)
{
GUARD_LOADING_AND_LOCK();
_entryData->_numValue = val;
}
void MacroActionWaitEdit::RegexChanged(const RegexConfig &conf)
{
GUARD_LOADING_AND_LOCK();
_entryData->_regex = conf;
adjustSize();
updateGeometry();
}
void MacroActionWaitEdit::UseTimeoutChanged(int state)
{
GUARD_LOADING_AND_LOCK();
_entryData->_useTimeout = state != Qt::Unchecked;
SetVariableWaitWidgetVisibility();
}
void MacroActionWaitEdit::ConditionTimeoutChanged(const Duration &dur)
{
GUARD_LOADING_AND_LOCK();
_entryData->_conditionTimeout = dur;
}
} // namespace advss

View File

@@ -1,14 +1,8 @@
#pragma once
#include "macro-action-edit.hpp"
#include "duration-control.hpp"
#include "regex-config.hpp"
#include "variable-spinbox.hpp"
#include "variable-text-edit.hpp"
#include "variable.hpp"
#include <QCheckBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
namespace advss {
@@ -23,40 +17,17 @@ public:
static std::shared_ptr<MacroAction> Create(Macro *m);
std::shared_ptr<MacroAction> Copy() const;
void ResolveVariablesToFixedValues();
void SetupTempVars();
Duration _duration;
Duration _duration2;
enum class Type {
FIXED,
RANDOM,
VARIABLE_WAIT,
};
Type _waitType = Type::FIXED;
// FIXED / RANDOM
Duration _duration;
Duration _duration2;
// VARIABLE_WAIT
enum class Condition {
EQUALS,
DOES_NOT_EQUAL,
IS_EMPTY,
LESS_THAN,
GREATER_THAN,
};
std::weak_ptr<Variable> _variable;
Condition _condition = Condition::EQUALS;
StringVariable _strValue = "";
DoubleVariable _numValue = 0.0;
RegexConfig _regex;
bool _useTimeout = false;
Duration _conditionTimeout;
private:
bool PerformDurationWait();
bool PerformVariableWait();
bool ConditionIsMet() const;
static bool _registered;
static const std::string id;
};
@@ -71,7 +42,6 @@ public:
void UpdateEntryData();
void SetupFixedDurationEdit();
void SetupRandomDurationEdit();
void SetupVariableWaitEdit();
static QWidget *Create(QWidget *parent,
std::shared_ptr<MacroAction> action)
{
@@ -84,36 +54,15 @@ private slots:
void DurationChanged(const Duration &value);
void Duration2Changed(const Duration &value);
void TypeChanged(int value);
void VariableChanged(const QString &);
void ConditionChanged(int);
void StrValueChanged();
void NumValueChanged(const NumberVariable<double> &);
void RegexChanged(const RegexConfig &);
void UseTimeoutChanged(int);
void ConditionTimeoutChanged(const Duration &);
signals:
void HeaderInfoChanged(const QString &);
private:
void SetVariableWaitWidgetVisibility();
// Duration widgets (FIXED / RANDOM)
DurationSelection *_duration;
DurationSelection *_duration2;
// Variable condition widgets (VARIABLE_WAIT)
VariableSelection *_variable;
QComboBox *_variableCondition;
VariableTextEdit *_strValue;
VariableDoubleSpinBox *_numValue;
RegexConfigWidget *_regex;
QCheckBox *_useTimeout;
DurationSelection *_conditionTimeout;
QComboBox *_waitType;
QHBoxLayout *_mainLayout;
QHBoxLayout *_timeoutLayout;
std::shared_ptr<MacroActionWait> _entryData;
bool _loading = true;

View File

@@ -15,9 +15,6 @@ bool MacroConditionProfile::_registered = MacroConditionFactory::Register(
bool MacroConditionProfile::CheckCondition()
{
auto currentProfile = obs_frontend_get_current_profile();
if (!currentProfile) {
return false;
}
const bool match = _profile == currentProfile;
bfree(currentProfile);
return match;

View File

@@ -48,6 +48,8 @@ OBSWeakSource TransitionSelection::GetTransition() const
obs_source_release(source);
return weakSource;
}
case Type::NONE:
return nullptr;
default:
break;
}
@@ -63,6 +65,8 @@ std::string TransitionSelection::ToString() const
return obs_module_text("AdvSceneSwitcher.currentTransition");
case Type::ANY:
return obs_module_text("AdvSceneSwitcher.anyTransition");
case Type::NONE:
return obs_module_text("AdvSceneSwitcher.noneTransition");
default:
break;
}
@@ -70,14 +74,16 @@ std::string TransitionSelection::ToString() const
}
TransitionSelectionWidget::TransitionSelectionWidget(QWidget *parent,
bool current, bool any)
bool current, bool any,
bool none)
: FilterComboBox(parent,
obs_module_text("AdvSceneSwitcher.selectTransition")),
_addCurrent(current),
_addAny(any)
_addAny(any),
_addNone(none)
{
setDuplicatesEnabled(true);
PopulateTransitionSelection(this, current, any, false);
PopulateTransitionSelection(this, current, any, false, none);
QWidget::connect(this, SIGNAL(currentTextChanged(const QString &)),
this, SLOT(SelectionChanged(const QString &)));
@@ -86,8 +92,9 @@ TransitionSelectionWidget::TransitionSelectionWidget(QWidget *parent,
void TransitionSelectionWidget::SetTransition(const TransitionSelection &t)
{
// Order of entries
// 1. Any transition
// 2. Current transition
// 1. None transition
// 2. Any transition
// 3. Current transition
// 4. Transitions
switch (t.GetType()) {
@@ -102,6 +109,10 @@ void TransitionSelectionWidget::SetTransition(const TransitionSelection &t)
setCurrentIndex(findText(QString::fromStdString(
obs_module_text("AdvSceneSwitcher.anyTransition"))));
break;
case TransitionSelection::Type::NONE:
setCurrentIndex(findText(QString::fromStdString(
obs_module_text("AdvSceneSwitcher.noneTransition"))));
break;
default:
setCurrentIndex(-1);
break;
@@ -120,6 +131,17 @@ void TransitionSelectionWidget::EnableAnyEntry(bool enable)
Populate();
}
void TransitionSelectionWidget::EnableNoneEntry(bool enable)
{
if (_addNone == enable) {
return;
}
const auto selection = GetCurrentSelection();
_addNone = enable;
Populate();
SetTransition(selection);
}
void TransitionSelectionWidget::showEvent(QShowEvent *event)
{
FilterComboBox::showEvent(event);
@@ -133,7 +155,7 @@ void TransitionSelectionWidget::Populate()
{
const QSignalBlocker blocker(this);
clear();
PopulateTransitionSelection(this, _addCurrent, _addAny);
PopulateTransitionSelection(this, _addCurrent, _addAny, true, _addNone);
}
static bool isFirstEntry(const QComboBox *l, QString name, int idx)
@@ -163,6 +185,9 @@ TransitionSelection TransitionSelectionWidget::GetCurrentSelection() const
if (IsAnyTransitionSelected(text)) {
result._type = TransitionSelection::Type::ANY;
}
if (IsNoneTransitionSelected(text)) {
result._type = TransitionSelection::Type::NONE;
}
}
return result;
}
@@ -187,6 +212,16 @@ bool TransitionSelectionWidget::IsAnyTransitionSelected(
return false;
}
bool TransitionSelectionWidget::IsNoneTransitionSelected(
const QString &name) const
{
if (name == QString::fromStdString((obs_module_text(
"AdvSceneSwitcher.noneTransition")))) {
return isFirstEntry(this, name, currentIndex());
}
return false;
}
void TransitionSelectionWidget::SelectionChanged(const QString &)
{
emit TransitionChanged(GetCurrentSelection());

View File

@@ -16,6 +16,7 @@ public:
TRANSITION,
CURRENT,
ANY,
NONE,
};
Type GetType() const { return _type; }
@@ -33,10 +34,11 @@ class TransitionSelectionWidget : public FilterComboBox {
public:
TransitionSelectionWidget(QWidget *parent, bool current = true,
bool any = false);
bool any = false, bool none = false);
void SetTransition(const TransitionSelection &);
void EnableCurrentEntry(bool enable);
void EnableAnyEntry(bool enable);
void EnableNoneEntry(bool enable);
protected:
void showEvent(QShowEvent *event) override;
@@ -52,9 +54,11 @@ private:
TransitionSelection GetCurrentSelection() const;
bool IsCurrentTransitionSelected(const QString &name) const;
bool IsAnyTransitionSelected(const QString &name) const;
bool IsNoneTransitionSelected(const QString &name) const;
bool _addCurrent;
bool _addAny;
bool _addNone;
};
} // namespace advss

View File

@@ -15,7 +15,7 @@ if(NOT TARGET httplib)
EXCLUDE_FROM_ALL)
endif()
if(OS_MACOS OR OS_WINDOWS)
if(OS_MACOS)
set(OPENSSL_USE_STATIC_LIBS
ON
CACHE BOOL "Use static OpenSSL" FORCE)
@@ -25,14 +25,6 @@ if(NOT OPENSSL_FOUND)
message(WARNING "OpenSSL not found!\n" "HTTP support will be disabled!\n\n")
return()
endif()
if(OS_WINDOWS AND NOT OPENSSL_CRYPTO_LIBRARY MATCHES "_static\\.lib$")
message(
WARNING
"Static OpenSSL libraries (libcrypto_static.lib / libssl_static.lib) not found!\n"
"HTTP support will be disabled to avoid DLL name collisions with other plugins.\n\n"
)
return()
endif()
find_package(ZLIB)
if(NOT ZLIB_FOUND)
@@ -73,7 +65,29 @@ set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_include_directories(${PROJECT_NAME} PRIVATE "${CPP_HTTPLIB_DIR}/"
"${OPENSSL_INCLUDE_DIR}")
target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENSSL_LIBRARIES} ZLIB::ZLIB)
if(OS_WINDOWS)
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 crypt32 bcrypt)
endif()
install_advss_plugin(${PROJECT_NAME})
if(OS_WINDOWS)
# Couldn't really find a better way to install runtime dependencies for
# Windows TODO: Clean this up at some point
function(FIND_FILES_WITH_PATTERN result pattern dir)
execute_process(
COMMAND
powershell -Command
"Get-ChildItem -Path '${dir}' -Recurse -Include ${pattern} |"
"Select-Object -First 1 |"
"ForEach-Object { $_.FullName -replace '\\\\', '\\\\' }"
OUTPUT_VARIABLE files
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(${result}
${files}
PARENT_SCOPE)
endfunction()
set(OPENSSL_DLL_SEARCH_DIR "${OPENSSL_INCLUDE_DIR}/..")
find_files_with_pattern(CRYPTO_DLL_FILES "libcrypto*.dll"
"${OPENSSL_DLL_SEARCH_DIR}")
find_files_with_pattern(SSL_DLL_FILES "libssl*.dll"
"${OPENSSL_DLL_SEARCH_DIR}")
install_advss_plugin_dependency(TARGET ${PROJECT_NAME} DEPENDENCIES
"${CRYPTO_DLL_FILES}" "${SSL_DLL_FILES}")
endif()

View File

@@ -3,21 +3,12 @@ project(advanced-scene-switcher-mqtt)
# --- Check paho.mqtt.cpp requirements ---
if(OS_MACOS OR OS_WINDOWS)
if(OS_MACOS)
set(OPENSSL_USE_STATIC_LIBS
ON
CACHE BOOL "Use static OpenSSL" FORCE)
endif()
find_package(OpenSSL)
if(OS_WINDOWS
AND OPENSSL_FOUND
AND NOT OPENSSL_CRYPTO_LIBRARY MATCHES "_static\\.lib$")
message(
WARNING
"Static OpenSSL libraries (libcrypto_static.lib / libssl_static.lib) not found!\n"
"MQTT may fail at runtime due to OpenSSL DLL name collisions with other plugins.\n\n"
)
endif()
find_package(PahoMqttCpp)
if(NOT PahoMqttCpp_FOUND)
@@ -60,7 +51,4 @@ else()
target_link_libraries(${PROJECT_NAME}
PRIVATE PahoMqttCpp::paho-mqttpp3-static)
endif()
if(OS_WINDOWS)
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 crypt32 bcrypt)
endif()
install_advss_plugin(${PROJECT_NAME})

Some files were not shown because too many files have changed in this diff Show More