mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-29 12:45:28 -05:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5156c66b26 | ||
|
|
346240473a | ||
|
|
17c4fefb37 | ||
|
|
2b90493ae9 | ||
|
|
bf97975fa8 | ||
|
|
4e971f59a9 | ||
|
|
2f0b900745 | ||
|
|
c6a25f9d85 | ||
|
|
e78383d3ed | ||
|
|
281e9325dd | ||
|
|
caa2833272 | ||
|
|
fae50024ea | ||
|
|
a05e38d3cb | ||
|
|
d73749fc3a | ||
|
|
d20cdac5e4 | ||
|
|
e377be3999 | ||
|
|
80e2b3dd14 | ||
|
|
3a05e61814 | ||
|
|
dda44a2931 | ||
|
|
8ba78b12c1 | ||
|
|
07b95cb8ae | ||
|
|
faca5f8863 | ||
|
|
084c263260 | ||
|
|
a1c592f1ec | ||
|
|
41f34f8f40 | ||
|
|
9711390aac | ||
|
|
25f28b9796 | ||
|
|
a1484f9621 | ||
|
|
b54506c5ee | ||
|
|
4af7540497 | ||
|
|
ba15e6812f | ||
|
|
22a90c7d64 | ||
|
|
f6c3c65e26 | ||
|
|
4f6275619a | ||
|
|
d461342835 | ||
|
|
16c4a2d5a9 | ||
|
|
45a880d8f8 | ||
|
|
bcf132685b | ||
|
|
e5c1e81d81 | ||
|
|
2ae97cd90e | ||
|
|
e5fffa0b82 | ||
|
|
a0119426d6 | ||
|
|
45e5738d2c | ||
|
|
cdd1259f12 | ||
|
|
e5d6f2eef0 | ||
|
|
e026bd7420 | ||
|
|
4cc1a53244 | ||
|
|
8eb99a3fde | ||
|
|
bf30a058ee | ||
|
|
0c6a7b140e | ||
|
|
d279b35086 | ||
|
|
8e26148255 | ||
|
|
1a3ed0d09c |
174
.github/workflows/build.yml
vendored
174
.github/workflows/build.yml
vendored
@@ -15,16 +15,16 @@ jobs:
|
||||
name: "macOS 64-bit"
|
||||
runs-on: [macos-latest]
|
||||
env:
|
||||
QT_VERSION: 5.14.1
|
||||
MACOS_DEPS_VERSION: '2020-08-30'
|
||||
QT_VERSION: '5.15.2'
|
||||
MACOS_DEPS_VERSION: '2020-12-11'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
repository: obsproject/obs-studio
|
||||
submodules: 'recursive'
|
||||
- name: "Checkout plugin"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
path: UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
||||
- name: Fetch Git Tags
|
||||
@@ -34,12 +34,15 @@ jobs:
|
||||
- name: 'Install prerequisites (Homebrew)'
|
||||
shell: bash
|
||||
run: |
|
||||
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}/CI/macos
|
||||
brew untap local/openssl
|
||||
brew untap local/python2
|
||||
brew update
|
||||
brew bundle
|
||||
cd -
|
||||
if [ -d /usr/local/opt/openssl@1.0.2t ]; then
|
||||
brew uninstall openssl@1.0.2t
|
||||
brew untap local/openssl
|
||||
fi
|
||||
if [ -d /usr/local/opt/python@2.7.17 ]; then
|
||||
brew uninstall python@2.7.17
|
||||
brew untap local/python2
|
||||
fi
|
||||
brew bundle --file ./CI/scripts/macos/Brewfile
|
||||
- name: 'Install prerequisite: Pre-built dependencies'
|
||||
if: steps.deps-cache.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
@@ -59,7 +62,7 @@ jobs:
|
||||
echo "add_subdirectory(${{ env.PLUGIN_NAME }})" >> UI/frontend-plugins/CMakeLists.txt
|
||||
mkdir ./build
|
||||
cd ./build
|
||||
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DDISABLE_PYTHON=ON -DDepsPath="/tmp/obsdeps" -DQTDIR="/tmp/obsdeps" ..
|
||||
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DDISABLE_PYTHON=ON -DDepsPath="/tmp/obsdeps" -DQTDIR="/tmp/obsdeps" ..
|
||||
cd -
|
||||
- name: Build
|
||||
shell: bash
|
||||
@@ -86,14 +89,14 @@ jobs:
|
||||
install_name_tool -change /tmp/obsdeps/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ../../../build/UI/frontend-plugins/SceneSwitcher/advanced-scene-switcher.so
|
||||
FILE_DATE=$(date +%Y-%m-%d)
|
||||
FILE_NAME=${{ env.PLUGIN_NAME }}-$FILE_DATE-${{ github.sha }}-macos.pkg
|
||||
echo "::set-env name=FILE_NAME::${FILE_NAME}"
|
||||
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
|
||||
packagesbuild ./CI/macos/${{ env.PLUGIN_NAME }}.pkgproj
|
||||
cd -
|
||||
mkdir ./nightly
|
||||
mv UI/frontend-plugins/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NAME }}.pkg ./nightly/${FILE_NAME}
|
||||
- name: Publish
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v2-preview
|
||||
uses: actions/upload-artifact@v2.2.1
|
||||
with:
|
||||
name: '${{ env.FILE_NAME }}'
|
||||
path: ./nightly/*.pkg
|
||||
@@ -102,12 +105,12 @@ jobs:
|
||||
runs-on: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
repository: obsproject/obs-studio
|
||||
submodules: 'recursive'
|
||||
- name: "Checkout plugin"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
path: UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
||||
- name: Add plugin to obs cmake
|
||||
@@ -166,7 +169,7 @@ jobs:
|
||||
run: |
|
||||
mkdir ./build
|
||||
cd ./build
|
||||
cmake -DUNIX_STRUCTURE=0 -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/obs-studio-portable" -DBUILD_CAPTIONS=OFF -DWITH_RTMPS=OFF -DBUILD_BROWSER=OFF ..
|
||||
cmake -DUNIX_STRUCTURE=0 -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/obs-studio-portable" -DWITH_RTMPS=OFF -DBUILD_BROWSER=OFF ..
|
||||
- name: 'Build'
|
||||
shell: bash
|
||||
working-directory: ${{ github.workspace }}/build
|
||||
@@ -176,32 +179,34 @@ jobs:
|
||||
run: |
|
||||
FILE_DATE=$(date +%Y-%m-%d)
|
||||
FILE_NAME=${{ env.PLUGIN_NAME }}-$FILE_DATE-${{ github.sha }}-linux64.tar.gz
|
||||
echo "::set-env name=FILE_NAME::${FILE_NAME}"
|
||||
mkdir -p ./${{ env.PLUGIN_NAME }}/bin/64bit/
|
||||
mv ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/${{ env.LIB_NAME }}.so ./${{ env.PLUGIN_NAME }}/bin/64bit/${{ env.LIB_NAME }}.so
|
||||
tar -cvzf "${FILE_NAME}" ${{ env.PLUGIN_NAME }}
|
||||
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
|
||||
mkdir -p ./${{ env.LIB_NAME }}/bin/64bit/
|
||||
mv ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/${{ env.LIB_NAME }}.so ./${{ env.LIB_NAME }}/bin/64bit/${{ env.LIB_NAME }}.so
|
||||
mv ./UI/frontend-plugins/${{ env.PLUGIN_NAME }}/data ./${{ env.LIB_NAME }}/data
|
||||
tar -cvzf "${FILE_NAME}" ${{ env.LIB_NAME }}
|
||||
- name: 'Publish'
|
||||
uses: actions/upload-artifact@v2-preview
|
||||
uses: actions/upload-artifact@v2.2.1
|
||||
with:
|
||||
name: '${{ env.FILE_NAME }}'
|
||||
path: '*.tar.gz'
|
||||
win64:
|
||||
name: Windows 64-bit
|
||||
windows:
|
||||
name: Windows
|
||||
runs-on: [windows-latest]
|
||||
env:
|
||||
QT_VERSION: 5.10.1
|
||||
CMAKE_GENERATOR: "Visual Studio 16 2019"
|
||||
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
|
||||
WINDOWS_DEPS_VERSION: '2017'
|
||||
steps:
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.0
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
- name: Checkout obs
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
repository: obsproject/obs-studio
|
||||
submodules: 'recursive'
|
||||
- name: Checkout plugin
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
path: UI/frontend-plugins/${{ env.PLUGIN_NAME}}
|
||||
- name: Add plugin to obs cmake
|
||||
@@ -215,81 +220,82 @@ jobs:
|
||||
7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}/cmbuild/QT"
|
||||
- name: 'Install prerequisite: Pre-built dependencies'
|
||||
run: |
|
||||
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies2017.zip -f --retry 5 -C -
|
||||
7z x dependencies2017.zip -o"${{ github.workspace }}/cmbuild/deps"
|
||||
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -f --retry 5 -C -
|
||||
7z x dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -o"${{ github.workspace }}/cmbuild/deps"
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir ./build
|
||||
mkdir ./package
|
||||
mkdir ./build32
|
||||
cd ./build32
|
||||
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"Win32" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DBUILD_CAPTIONS=false -DCOMPILE_D3D12_HOOK=false -DDepsPath="${{ github.workspace }}/cmbuild/deps/win32" -DQTDIR="${{ github.workspace }}/cmbuild/QT/${{ env.QT_VERSION }}/msvc2017" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
|
||||
cd ..
|
||||
mkdir ./build64
|
||||
cd ./build64
|
||||
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"x64" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DBUILD_CAPTIONS=false -DCOMPILE_D3D12_HOOK=false -DDepsPath="${{ github.workspace }}/cmbuild/deps/win64" -DQTDIR="${{ github.workspace }}/cmbuild/QT/${{ env.QT_VERSION }}/msvc2017_64" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
|
||||
- name: Build
|
||||
run: msbuild /m /p:Configuration=RelWithDebInfo .\build64\obs-studio.sln
|
||||
run: |
|
||||
msbuild /m /p:Configuration=RelWithDebInfo .\build32\obs-studio.sln
|
||||
msbuild /m /p:Configuration=RelWithDebInfo .\build64\obs-studio.sln
|
||||
- name: Package
|
||||
if: success()
|
||||
run: |
|
||||
$env:FILE_DATE=(Get-Date -UFormat "%F")
|
||||
$env:FILE_NAME="${{ env.PLUGIN_NAME }}-${env:FILE_DATE}-${{ github.sha }}-win64.zip"
|
||||
echo "::set-env name=FILE_NAME::${env:FILE_NAME}"
|
||||
robocopy .\build64\rundir\RelWithDebInfo\obs-plugins\64bit\ .\build\obs-plugins\64bit ${{ env.LIB_NAME }}.* /E /XF .gitignore
|
||||
7z a ${env:FILE_NAME} .\build\*
|
||||
- name: Publish
|
||||
$env:FILE_NAME="${{ env.PLUGIN_NAME }}-${env:FILE_DATE}-${{ github.sha }}-windows"
|
||||
echo "FILE_NAME=${env:FILE_NAME}" >> ${env:GITHUB_ENV}
|
||||
robocopy .\build32\rundir\RelWithDebInfo\obs-plugins\32bit\ .\package\obs-plugins\32bit ${{ env.LIB_NAME }}.* /E /XF .gitignore
|
||||
robocopy .\build64\rundir\RelWithDebInfo\obs-plugins\64bit\ .\package\obs-plugins\64bit ${{ env.LIB_NAME }}.* /E /XF .gitignore
|
||||
robocopy .\build64\rundir\RelWithDebInfo\data\obs-plugins\${{ env.LIB_NAME }}\ .\package\data\obs-plugins\${{ env.LIB_NAME }}\ /E /XF .gitignore
|
||||
exit 0
|
||||
- name: Publish zip
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v2-preview
|
||||
uses: actions/upload-artifact@v2.2.1
|
||||
with:
|
||||
name: '${{ env.FILE_NAME }}'
|
||||
path: '*-win64.zip'
|
||||
win32:
|
||||
name: Windows 32-bit
|
||||
runs-on: [windows-latest]
|
||||
env:
|
||||
QT_VERSION: 5.10.1
|
||||
CMAKE_GENERATOR: "Visual Studio 16 2019"
|
||||
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
|
||||
path: package/*
|
||||
- name: "Package Installer (Prereqs)"
|
||||
run: |
|
||||
curl "-kL" "https://github.com/Xaymar/msvc-redist-helper/releases/download/0.1/msvc-redist-helper-64.exe" "-f" "--retry" "5" "-o" "msvc-redist-helper-64.exe"
|
||||
curl "-kL" "https://github.com/Xaymar/msvc-redist-helper/releases/download/0.1/msvc-redist-helper-32.exe" "-f" "--retry" "5" "-o" "msvc-redist-helper-32.exe"
|
||||
curl "-kL" "https://files.jrsoftware.org/is/6/innosetup-6.0.3.exe" "-f" "--retry" "5" "-o" "inno.exe"
|
||||
.\inno.exe /VERYSILENT /SP- /SUPPRESSMSGBOXES /NORESTART
|
||||
- name: "Package Installer (Compile)"
|
||||
run: |
|
||||
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /Qp ".\build64\UI\frontend-plugins\${{ env.PLUGIN_NAME }}\CI\windows\setup.iss"
|
||||
- name: Publish installer
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v2.2.0
|
||||
with:
|
||||
name: '${{ env.FILE_NAME }}-installer'
|
||||
path: build64/UI/frontend-plugins/SceneSwitcher/CI/windows/Output/*.exe
|
||||
release:
|
||||
needs: [macos64, ubuntu64, windows]
|
||||
name: 'Create Release'
|
||||
runs-on: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.0
|
||||
- name: Checkout obs
|
||||
uses: actions/checkout@v2
|
||||
- name: "Checkout plugin"
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
repository: obsproject/obs-studio
|
||||
submodules: 'recursive'
|
||||
- name: Checkout plugin
|
||||
uses: actions/checkout@v2
|
||||
path: plugin/${{ env.PLUGIN_NAME }}
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
||||
- name: Add plugin to obs cmake
|
||||
shell: cmd
|
||||
run: echo add_subdirectory(${{ env.PLUGIN_NAME }}) >> UI/frontend-plugins/CMakeLists.txt
|
||||
- name: Fetch Git Tags
|
||||
run: git fetch --prune --tags --unshallow
|
||||
- name: 'Install prerequisite: QT'
|
||||
path: artifacts
|
||||
- name: 'Package'
|
||||
shell: bash
|
||||
run: |
|
||||
curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_${{ env.QT_VERSION }}.7z -f --retry 5 -C -
|
||||
7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}/cmbuild/QT"
|
||||
- name: 'Install prerequisite: Pre-built dependencies'
|
||||
run: |
|
||||
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies2017.zip -f --retry 5 -C -
|
||||
7z x dependencies2017.zip -o"${{ github.workspace }}/cmbuild/deps"
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir ./build
|
||||
mkdir ./build32
|
||||
cd ./build32
|
||||
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"Win32" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DBUILD_CAPTIONS=false -DCOMPILE_D3D12_HOOK=false -DDepsPath="${{ github.workspace }}/cmbuild/deps/win32" -DQTDIR="${{ github.workspace }}/cmbuild/QT/${{ env.QT_VERSION }}/msvc2017" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
|
||||
- name: Build
|
||||
run: msbuild /m /p:Configuration=RelWithDebInfo .\build32\obs-studio.sln
|
||||
- name: Package
|
||||
if: success()
|
||||
run: |
|
||||
$env:FILE_DATE=(Get-Date -UFormat "%F")
|
||||
$env:FILE_NAME="${{ env.PLUGIN_NAME }}-${env:FILE_DATE}-${{ github.sha }}-win32.zip"
|
||||
echo "::set-env name=FILE_NAME::${env:FILE_NAME}"
|
||||
robocopy .\build32\rundir\RelWithDebInfo\obs-plugins\32bit\ .\build\obs-plugins\32bit ${{ env.LIB_NAME }}.* /E /XF .gitignore
|
||||
7z a ${env:FILE_NAME} .\build\*
|
||||
mkdir -p ${{ env.PLUGIN_NAME }}/Linux ${{ env.PLUGIN_NAME }}/MacOs ${{ env.PLUGIN_NAME }}/Windows
|
||||
tar xf artifacts/${{ env.PLUGIN_NAME }}*-linux64.tar.gz/${{ env.PLUGIN_NAME }}*-linux64.tar.gz -C ${{ env.PLUGIN_NAME }}/Linux/
|
||||
mv artifacts/${{ env.PLUGIN_NAME }}*-macos.pkg/${{ env.PLUGIN_NAME }}*-macos.pkg ${{ env.PLUGIN_NAME }}/MacOs/${{ env.PLUGIN_NAME }}.pkg
|
||||
mv ./artifacts/${{ env.PLUGIN_NAME }}*-windows/* ${{ env.PLUGIN_NAME }}/Windows/
|
||||
mv ./artifacts/${{ env.PLUGIN_NAME }}*-windows-installer/*.exe ${{ env.PLUGIN_NAME }}/Windows/
|
||||
rm ${{ env.PLUGIN_NAME }}/Windows/obs-plugins/32bit/advanced-scene-switcher.pdb
|
||||
rm ${{ env.PLUGIN_NAME }}/Windows/obs-plugins/64bit/advanced-scene-switcher.pdb
|
||||
cp plugin/${{ env.PLUGIN_NAME }}/CI/release/README.txt ${{ env.PLUGIN_NAME }}/
|
||||
FILE_NAME=${{ env.PLUGIN_NAME }}.zip
|
||||
zip -r ${FILE_NAME} ${{ env.PLUGIN_NAME }}/
|
||||
- name: Publish
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v2-preview
|
||||
uses: actions/upload-artifact@v2.2.1
|
||||
with:
|
||||
name: '${{ env.FILE_NAME }}'
|
||||
path: '*-win32.zip'
|
||||
name: "Release"
|
||||
path: '*.zip'
|
||||
|
||||
32
.github/workflows/clang-format.yml
vendored
Normal file
32
.github/workflows/clang-format.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Clang Format Check
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
ubuntu64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Install clang format
|
||||
run: |
|
||||
# gets us newer clang
|
||||
sudo bash -c "cat >> /etc/apt/sources.list" << LLVMAPT
|
||||
# 3.8
|
||||
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main
|
||||
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main
|
||||
LLVMAPT
|
||||
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
|
||||
sudo apt-get -qq update
|
||||
|
||||
sudo apt-get install -y clang-format-8
|
||||
|
||||
- name: Check the Formatting
|
||||
run: |
|
||||
./CI/formatcode.sh
|
||||
./CI/check-format.sh
|
||||
11
CI/check-format.sh
Executable file
11
CI/check-format.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
dirty=$(git ls-files --modified)
|
||||
|
||||
set +x
|
||||
if [[ $dirty ]]; then
|
||||
echo "================================="
|
||||
echo "Files were not formatted properly"
|
||||
echo "$dirty"
|
||||
echo "================================="
|
||||
exit 1
|
||||
fi
|
||||
31
CI/formatcode.sh
Executable file
31
CI/formatcode.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Original source https://github.com/Project-OSRM/osrm-backend/blob/master/scripts/format.sh
|
||||
|
||||
set +x
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
# Runs the Clang Formatter in parallel on the code base.
|
||||
# Return codes:
|
||||
# - 1 there are files to be formatted
|
||||
# - 0 everything looks fine
|
||||
|
||||
# Get CPU count
|
||||
OS=$(uname)
|
||||
NPROC=1
|
||||
if [[ $OS = "Linux" || $OS = "Darwin" ]] ; then
|
||||
NPROC=$(getconf _NPROCESSORS_ONLN)
|
||||
fi
|
||||
|
||||
# Discover clang-format
|
||||
if type clang-format-8 2> /dev/null ; then
|
||||
CLANG_FORMAT=clang-format-8
|
||||
else
|
||||
CLANG_FORMAT=clang-format
|
||||
fi
|
||||
|
||||
find .. -type d \( -path ./deps \
|
||||
-o -path ./cmake \
|
||||
-o -path ./build \) -prune -type f -o -name '*.h' -or -name '*.hpp' -or -name '*.m' -or -name '*.mm' -or -name '*.c' -or -name '*.cpp' \
|
||||
| xargs -L100 -P${NPROC} ${CLANG_FORMAT} -i -style=file -fallback-style=none
|
||||
@@ -60,6 +60,22 @@
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>../../data</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>3</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
|
||||
31
CI/release/README.txt
Normal file
31
CI/release/README.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
Note that you will have to use OBS version 25 or newer!
|
||||
|
||||
--- WINDOWS ---
|
||||
Recommended: Run the provided installer. (You might have to click 'More info' and select 'Run anyway' if it is blocked by Windows)
|
||||
|
||||
Alternatively manually copy the 'obs-plugins' and 'data' folders in the respective OBS Studio installation directory.
|
||||
It is usually located at 'C:\Program Files (x86)\obs-studio\'.
|
||||
Remember to install the Visual C++ Redistributable for Visual Studio 2019, if you have not done so already. (See plugin overview page)
|
||||
|
||||
--- MAC OS ---
|
||||
Recommended: Run the provided installer. (You might have to right click and select 'open' if it is blocked)
|
||||
|
||||
Alternatively extract the *so file and data folder and either ...
|
||||
|
||||
... right click the OBS app inside your Applications folder and choose 'Show Package Contents'.
|
||||
Copy the advanced-scene-switcher.so file to 'Contents/Plugins' and the 'data' folder to 'Contents/Resources'.
|
||||
|
||||
... or copy the advanced-scene-switcher.so file to Library/Application Support/obs-studio/plugins/advanced-scene-switcher/bin/ .
|
||||
And the 'data' folder to 'Library/Application Support/obs-studio/plugins/advanced-scene-switcher/'.
|
||||
|
||||
--- Linux ---
|
||||
Copy the advanced-scene-switcher.so file and data folder into the OBS Studio plugin folder.
|
||||
The location of this folder can vary so you might have to look around a bit.
|
||||
|
||||
Examples are ...
|
||||
/usr/lib/obs-plugins/
|
||||
/usr/lib/x86_64-linux-gnu/obs-plugins/
|
||||
~/.config/obs-studio/plugins/advanced-scene-switcher/bin/64bit/
|
||||
|
||||
The data folder usually should be copied to:
|
||||
~/.config/obs-studio/plugins/advanced-scene-switcher/
|
||||
64
CI/windows/setup.iss.in
Normal file
64
CI/windows/setup.iss.in
Normal file
@@ -0,0 +1,64 @@
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "Advanced Scene Switcher"
|
||||
#define MyAppVersion "@GIT_SHA1@"
|
||||
#define MyAppURL "https://github.com/WarmUpTill/SceneSwitcher"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{A4ADDF26-4426-4D2E-B26A-C7C878DA8FC9}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={code:GetDirName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
AllowNoIcons=yes
|
||||
; Uncomment the following line to run in non administrative install mode (install for current user only.)
|
||||
;PrivilegesRequired=lowest
|
||||
OutputBaseFilename=AdvancedSceneSwitcherSetup
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Files]
|
||||
Source: "@ISS_MSVC_REDIST_HELPER_DIR@\msvc-redist-helper-64.exe"; DestDir: "{app}"; DestName: "msvc-redist-helper.exe"; Flags: ignoreversion dontcopy; Check: Is64BitInstallMode
|
||||
Source: "@ISS_MSVC_REDIST_HELPER_DIR@\msvc-redist-helper-32.exe"; DestDir: "{app}"; DestName: "msvc-redist-helper.exe"; Flags: ignoreversion dontcopy; Check: not Is64BitInstallMode
|
||||
Source: "@ISS_PLUGIN_FILES_DIR@\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||
|
||||
[Code]
|
||||
// credit where it's due:
|
||||
// following function comes from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45
|
||||
function GetDirName(Value: string): string;
|
||||
var
|
||||
InstallPath: string;
|
||||
begin
|
||||
// initialize default path, which will be returned when the following registry
|
||||
// key queries fail due to missing keys or for some different reason
|
||||
Result := ExpandConstant('{pf}\obs-studio');
|
||||
// query the first registry value; if this succeeds, return the obtained value
|
||||
if RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', InstallPath) then
|
||||
Result := InstallPath
|
||||
end;
|
||||
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
var
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
if (CurStep=ssPostInstall) then
|
||||
begin
|
||||
ExtractTemporaryFile('msvc-redist-helper.exe');
|
||||
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||
end;
|
||||
end;
|
||||
285
CMakeLists.txt
285
CMakeLists.txt
@@ -2,9 +2,21 @@ cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(advanced-scene-switcher)
|
||||
|
||||
# generate version info
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp" @ONLY)
|
||||
|
||||
if(WIN32)
|
||||
get_filename_component(ISS_PLUGIN_FILES_DIR "${CMAKE_BINARY_DIR}\\..\\package" ABSOLUTE)
|
||||
file(TO_NATIVE_PATH "${ISS_PLUGIN_FILES_DIR}" ISS_PLUGIN_FILES_DIR)
|
||||
get_filename_component(ISS_MSVC_REDIST_HELPER_DIR "${CMAKE_PACKAGE_PREFIX}\\.." ABSOLUTE)
|
||||
file(TO_NATIVE_PATH "${ISS_MSVC_REDIST_HELPER_DIR}" ISS_MSVC_REDIST_HELPER_DIR)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CI/windows/setup.iss.in" "${CMAKE_CURRENT_BINARY_DIR}/CI/windows/setup.iss" @ONLY)
|
||||
endif()
|
||||
|
||||
if(BUILD_OUT_OF_TREE)
|
||||
# out of tree builds
|
||||
# credits to c3r1c3
|
||||
set(CMAKE_PREFIX_PATH "${QTDIR}")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external")
|
||||
@@ -16,101 +28,107 @@ if(BUILD_OUT_OF_TREE)
|
||||
find_package(Libcurl REQUIRED)
|
||||
find_path(LIBOBS_FRONTEND_INCLUDE_DIR HINTS ${LIBOBS_INCLUDE_DIRS})
|
||||
find_file(LIBOBS_FRONTEND_API_LIB NAMES libobs-frontend-api.* HINTS ${LIBOBS_LIB} )
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
find_library(COCOA Cocoa)
|
||||
if(APPLE)
|
||||
find_library(COCOA Cocoa)
|
||||
if(BUILD_OUT_OF_TREE)
|
||||
find_package(Qt5MacExtras REQUIRED)
|
||||
include_directories(${COCOA})
|
||||
add_link_options("-v")
|
||||
endif()
|
||||
include_directories(${COCOA})
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
link_libraries(${X11_LIBRARIES})
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(advanced-scene-switcher_HEADERS
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
src/headers/advanced-scene-switcher.hpp
|
||||
src/headers/switcher-data-structs.hpp
|
||||
src/headers/utility.hpp
|
||||
src/headers/curl-helper.hpp
|
||||
src/headers/switch-audio.hpp
|
||||
src/headers/switch-executable.hpp
|
||||
src/headers/switch-file.hpp
|
||||
src/headers/switch-idle.hpp
|
||||
src/headers/switch-media.hpp
|
||||
src/headers/switch-random.hpp
|
||||
src/headers/switch-screen-region.hpp
|
||||
src/headers/switch-time.hpp
|
||||
src/headers/switch-transitions.hpp
|
||||
src/headers/switch-window.hpp
|
||||
src/headers/switch-sequence.hpp
|
||||
src/headers/switch-generic.hpp
|
||||
)
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
link_libraries(${X11_LIBRARIES})
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(advanced-scene-switcher_SOURCES
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
src/advanced-scene-switcher.cpp
|
||||
src/advanced-scene-switcher-module.c
|
||||
src/switcher-data-structs.cpp
|
||||
src/switch-transitions.cpp
|
||||
src/switch-screen-region.cpp
|
||||
src/switch-priority.cpp
|
||||
src/switch-executable.cpp
|
||||
src/switch-idle.cpp
|
||||
src/switch-sequence.cpp
|
||||
src/switch-file.cpp
|
||||
src/switch-window.cpp
|
||||
src/switch-media.cpp
|
||||
src/hotkey.cpp
|
||||
src/general.cpp
|
||||
src/switch-pause.cpp
|
||||
src/switch-random.cpp
|
||||
src/switch-time.cpp
|
||||
src/switch-audio.cpp
|
||||
src/switch-generic.cpp
|
||||
src/curl-helper.cpp
|
||||
src/volume-control.cpp
|
||||
)
|
||||
set(advanced-scene-switcher_HEADERS
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
src/headers/advanced-scene-switcher.hpp
|
||||
src/headers/switcher-data-structs.hpp
|
||||
src/headers/utility.hpp
|
||||
src/headers/curl-helper.hpp
|
||||
src/headers/volume-control.hpp
|
||||
src/headers/switch-audio.hpp
|
||||
src/headers/switch-executable.hpp
|
||||
src/headers/switch-file.hpp
|
||||
src/headers/switch-idle.hpp
|
||||
src/headers/switch-media.hpp
|
||||
src/headers/switch-pause.hpp
|
||||
src/headers/switch-random.hpp
|
||||
src/headers/switch-screen-region.hpp
|
||||
src/headers/switch-time.hpp
|
||||
src/headers/switch-transitions.hpp
|
||||
src/headers/switch-window.hpp
|
||||
src/headers/switch-sequence.hpp
|
||||
src/headers/switch-generic.hpp
|
||||
src/headers/version.h
|
||||
)
|
||||
|
||||
set(advanced-scene-switcher_UI
|
||||
${advanced-scene-switcher_UI}
|
||||
forms/advanced-scene-switcher.ui
|
||||
)
|
||||
set(advanced-scene-switcher_SOURCES
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
src/advanced-scene-switcher.cpp
|
||||
src/advanced-scene-switcher-module.c
|
||||
src/switcher-data-structs.cpp
|
||||
src/switch-transitions.cpp
|
||||
src/switch-screen-region.cpp
|
||||
src/switch-priority.cpp
|
||||
src/switch-executable.cpp
|
||||
src/switch-idle.cpp
|
||||
src/switch-sequence.cpp
|
||||
src/switch-file.cpp
|
||||
src/switch-window.cpp
|
||||
src/switch-media.cpp
|
||||
src/hotkey.cpp
|
||||
src/general.cpp
|
||||
src/switch-pause.cpp
|
||||
src/switch-random.cpp
|
||||
src/switch-time.cpp
|
||||
src/switch-audio.cpp
|
||||
src/switch-generic.cpp
|
||||
src/curl-helper.cpp
|
||||
src/volume-control.cpp
|
||||
src/version.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/win/advanced-scene-switcher-win.cpp)
|
||||
set(advanced-scene-switcher_UI
|
||||
${advanced-scene-switcher_UI}
|
||||
forms/advanced-scene-switcher.ui
|
||||
)
|
||||
|
||||
elseif(APPLE)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/osx/advanced-scene-switcher-osx.mm)
|
||||
set_source_files_properties(advanced-scene-switcher-osx.mm
|
||||
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
${COCOA})
|
||||
if(WIN32)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/win/advanced-scene-switcher-win.cpp)
|
||||
elseif(APPLE)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/osx/advanced-scene-switcher-osx.mm)
|
||||
set_source_files_properties(advanced-scene-switcher-osx.mm
|
||||
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
${COCOA})
|
||||
else()
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/linux/advanced-scene-switcher-nix.cpp)
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
Xss)
|
||||
endif()
|
||||
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/linux/advanced-scene-switcher-nix.cpp)
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
Xss)
|
||||
endif()
|
||||
qt5_wrap_ui(advanced-scene-switcher_UI_HEADERS
|
||||
${advanced-scene-switcher_UI}
|
||||
${advanced-scene-switcher_PLATFORM_UI})
|
||||
|
||||
qt5_wrap_ui(advanced-scene-switcher_UI_HEADERS
|
||||
${advanced-scene-switcher_UI}
|
||||
${advanced-scene-switcher_PLATFORM_UI})
|
||||
|
||||
add_library(advanced-scene-switcher MODULE
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
${advanced-scene-switcher_UI_HEADERS}
|
||||
${advanced-scene-switcher_PLATFORM_SOURCES}
|
||||
${advanced-scene-switcher_PLATFORM_HEADERS}
|
||||
)
|
||||
add_library(advanced-scene-switcher MODULE
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
${advanced-scene-switcher_UI_HEADERS}
|
||||
${advanced-scene-switcher_PLATFORM_SOURCES}
|
||||
${advanced-scene-switcher_PLATFORM_HEADERS}
|
||||
)
|
||||
|
||||
if(BUILD_OUT_OF_TREE)
|
||||
include_directories(
|
||||
"${LIBOBS_INCLUDE_DIRS}"
|
||||
"${LIBOBS_FRONTEND_INCLUDE_DIR}"
|
||||
@@ -146,7 +164,6 @@ if(BUILD_OUT_OF_TREE)
|
||||
# OSX
|
||||
if(APPLE)
|
||||
set_target_properties(advanced-scene-switcher PROPERTIES PREFIX "")
|
||||
|
||||
endif()
|
||||
|
||||
# Linux
|
||||
@@ -166,104 +183,12 @@ if(BUILD_OUT_OF_TREE)
|
||||
install(FILES ${ASS_TRANSLATION_FILES}
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/obs/obs-plugins/advanced-scene-switcher/locale")
|
||||
endif()
|
||||
else ()
|
||||
# in-tree build
|
||||
if(APPLE)
|
||||
find_library(COCOA Cocoa)
|
||||
include_directories(${COCOA})
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
link_libraries(${X11_LIBRARIES})
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(advanced-scene-switcher_HEADERS
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
src/headers/advanced-scene-switcher.hpp
|
||||
src/headers/switcher-data-structs.hpp
|
||||
src/headers/utility.hpp
|
||||
src/headers/curl-helper.hpp
|
||||
src/headers/volume-control.hpp
|
||||
src/headers/switch-audio.hpp
|
||||
src/headers/switch-executable.hpp
|
||||
src/headers/switch-file.hpp
|
||||
src/headers/switch-idle.hpp
|
||||
src/headers/switch-media.hpp
|
||||
src/headers/switch-random.hpp
|
||||
src/headers/switch-screen-region.hpp
|
||||
src/headers/switch-time.hpp
|
||||
src/headers/switch-transitions.hpp
|
||||
src/headers/switch-window.hpp
|
||||
src/headers/switch-sequence.hpp
|
||||
src/headers/switch-generic.hpp
|
||||
)
|
||||
|
||||
set(advanced-scene-switcher_SOURCES
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
src/advanced-scene-switcher.cpp
|
||||
src/advanced-scene-switcher-module.c
|
||||
src/switcher-data-structs.cpp
|
||||
src/switch-transitions.cpp
|
||||
src/switch-screen-region.cpp
|
||||
src/switch-priority.cpp
|
||||
src/switch-executable.cpp
|
||||
src/switch-idle.cpp
|
||||
src/switch-sequence.cpp
|
||||
src/switch-file.cpp
|
||||
src/switch-window.cpp
|
||||
src/switch-media.cpp
|
||||
src/hotkey.cpp
|
||||
src/general.cpp
|
||||
src/switch-pause.cpp
|
||||
src/switch-random.cpp
|
||||
src/switch-time.cpp
|
||||
src/switch-audio.cpp
|
||||
src/switch-generic.cpp
|
||||
src/curl-helper.cpp
|
||||
src/volume-control.cpp
|
||||
)
|
||||
|
||||
set(advanced-scene-switcher_UI
|
||||
${advanced-scene-switcher_UI}
|
||||
forms/advanced-scene-switcher.ui
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/win/advanced-scene-switcher-win.cpp)
|
||||
elseif(APPLE)
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/osx/advanced-scene-switcher-osx.mm)
|
||||
set_source_files_properties(advanced-scene-switcher-osx.mm
|
||||
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
${COCOA})
|
||||
else()
|
||||
set(advanced-scene-switcher_PLATFORM_SOURCES
|
||||
src/linux/advanced-scene-switcher-nix.cpp)
|
||||
set(advanced-scene-switcher_PLATFORM_LIBS
|
||||
Xss)
|
||||
endif()
|
||||
|
||||
qt5_wrap_ui(advanced-scene-switcher_UI_HEADERS
|
||||
${advanced-scene-switcher_UI}
|
||||
${advanced-scene-switcher_PLATFORM_UI})
|
||||
|
||||
add_library(advanced-scene-switcher MODULE
|
||||
${advanced-scene-switcher_HEADERS}
|
||||
${advanced-scene-switcher_SOURCES}
|
||||
${advanced-scene-switcher_UI_HEADERS}
|
||||
${advanced-scene-switcher_PLATFORM_SOURCES}
|
||||
${advanced-scene-switcher_PLATFORM_HEADERS}
|
||||
)
|
||||
|
||||
else()
|
||||
target_link_libraries(advanced-scene-switcher
|
||||
${advanced-scene-switcher_PLATFORM_LIBS}
|
||||
obs-frontend-api
|
||||
Qt5::Widgets
|
||||
libobs)
|
||||
|
||||
install_obs_plugin(advanced-scene-switcher data)
|
||||
install_obs_plugin_with_data(advanced-scene-switcher data)
|
||||
endif()
|
||||
|
||||
@@ -3,7 +3,7 @@ An automated scene switcher for OBS Studio
|
||||
|
||||
More information can be found on https://obsproject.com/forum/resources/automatic-scene-switching.395/
|
||||
|
||||
## Compiling in tree
|
||||
## Compiling in tree (recommended)
|
||||
Add the "SceneSwitcher" source directory to your obs-studio source directory under obs-studio/UI/frontend-plugins/:
|
||||
```
|
||||
cd obs-studio/UI/frontend-plugins/
|
||||
@@ -49,9 +49,10 @@ Most versions of Linux you can use cmake-gui or the command line.
|
||||
|
||||
**For the command line:**
|
||||
```
|
||||
cmake -DBUILD_OUT_OF_TREE=1 -DLIBOBS_INCLUDE_DIR="<path to the libobs/ sub-folder in obs-studio's source code>"
|
||||
-DLIBOBS_FRONTEND_INCLUDE_DIR="<path to the UI/obs-frontend-api/ sub-folder in obs-studio's source code>"
|
||||
-DLIBOBS_FRONTEND_API_LIB="< path to the libobs-frontend-api.so file (usually in the same place as LIBOBS_LIB)>"
|
||||
cmake -DBUILD_OUT_OF_TREE=1 -DLIBOBS_INCLUDE_DIR="<path to the libobs/ sub-folder in obs-studio's source code>" \
|
||||
-DLIBOBS_FRONTEND_INCLUDE_DIR="<path to the UI/obs-frontend-api/ sub-folder in obs-studio's source code>" \
|
||||
-DLIBOBS_LIB="<path to the libobs.so file>" \
|
||||
-DLIBOBS_FRONTEND_API_LIB="<path to the libobs-frontend-api.so file (usually in the same place as LIBOBS_LIB)>" \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr ..
|
||||
make -j4
|
||||
sudo make install
|
||||
|
||||
279
cmake/GetGitRevisionDescription.cmake
Normal file
279
cmake/GetGitRevisionDescription.cmake
Normal file
@@ -0,0 +1,279 @@
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the working tree (--dirty option),
|
||||
# and adjusting the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# git_local_changes(<var>)
|
||||
#
|
||||
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||
# Does not regard untracked files.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
#
|
||||
# Copyright 2009-2013, Iowa State University.
|
||||
# Copyright 2013-2020, Ryan Pavlik
|
||||
# Copyright 2013-2020, Contributors
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
# Function _git_find_closest_git_dir finds the next closest .git directory
|
||||
# that is part of any directory in the path defined by _start_dir.
|
||||
# The result is returned in the parent scope variable whose name is passed
|
||||
# as variable _git_dir_var. If no .git directory can be found, the
|
||||
# function returns an empty string via _git_dir_var.
|
||||
#
|
||||
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
|
||||
# neither foo nor bar contain a file/directory .git. This wil return
|
||||
# C:/bla/.git
|
||||
#
|
||||
function(_git_find_closest_git_dir _start_dir _git_dir_var)
|
||||
set(cur_dir "${_start_dir}")
|
||||
set(git_dir "${_start_dir}/.git")
|
||||
while(NOT EXISTS "${git_dir}")
|
||||
# .git dir not found, search parent directories
|
||||
set(git_previous_parent "${cur_dir}")
|
||||
get_filename_component(cur_dir ${cur_dir} DIRECTORY)
|
||||
if(cur_dir STREQUAL git_previous_parent)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_git_dir_var}
|
||||
""
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(git_dir "${cur_dir}/.git")
|
||||
endwhile()
|
||||
set(${_git_dir_var}
|
||||
"${git_dir}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
|
||||
|
||||
if(NOT "${GIT_DIR}" STREQUAL "")
|
||||
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
|
||||
"${GIT_DIR}")
|
||||
if("${_relative_to_source_dir}" MATCHES "[.][.]")
|
||||
# We've gone above the CMake root dir.
|
||||
set(GIT_DIR "")
|
||||
endif()
|
||||
endif()
|
||||
if("${GIT_DIR}" STREQUAL "")
|
||||
set(${_refspecvar}
|
||||
"GITDIR-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
set(${_hashvar}
|
||||
"GITDIR-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check if the current source dir is a git submodule or a worktree.
|
||||
# In both cases .git is a file instead of a directory.
|
||||
#
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
# The following git command will return a non empty string that
|
||||
# points to the super project working tree if the current
|
||||
# source dir is inside a git submodule.
|
||||
# Otherwise the command will return an empty string.
|
||||
#
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse
|
||||
--show-superproject-working-tree
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT "${out}" STREQUAL "")
|
||||
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
|
||||
${submodule})
|
||||
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
|
||||
ABSOLUTE)
|
||||
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||
else()
|
||||
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
|
||||
file(READ ${GIT_DIR} worktree_ref)
|
||||
# The .git directory contains a path to the worktree information directory
|
||||
# inside the parent git repo of the worktree.
|
||||
#
|
||||
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
||||
${worktree_ref})
|
||||
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
||||
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
||||
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
||||
endif()
|
||||
else()
|
||||
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake" @ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar}
|
||||
"${HEAD_REF}"
|
||||
PARENT_SCOPE)
|
||||
set(${_hashvar}
|
||||
"${HEAD_HASH}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var}
|
||||
"HEAD-HASH-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe_working_tree _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_local_changes _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var}
|
||||
"HEAD-HASH-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var}
|
||||
"CLEAN"
|
||||
PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var}
|
||||
"DIRTY"
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
41
cmake/GetGitRevisionDescription.cmake.in
Normal file
41
cmake/GetGitRevisionDescription.cmake.in
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
else()
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
||||
3
cmake/version.cpp.in
Normal file
3
cmake/version.cpp.in
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "src/headers/version.h"
|
||||
#define GIT_SHA1 "@GIT_SHA1@"
|
||||
const char g_GIT_SHA1[] = GIT_SHA1;
|
||||
218
data/locale/de-DE.ini
Normal file
218
data/locale/de-DE.ini
Normal file
@@ -0,0 +1,218 @@
|
||||
AdvSceneSwitcher.pluginName="Erweiterter Automatischer Szenenwechsler"
|
||||
AdvSceneSwitcher.windowTitle="Erweiterter Automatischer Szenenwechsler"
|
||||
|
||||
; General Tab
|
||||
AdvSceneSwitcher.generalTab.title="Allgemein"
|
||||
AdvSceneSwitcher.generalTab.status="Status"
|
||||
AdvSceneSwitcher.generalTab.status.hotkeytips="Hotkeys können in den OBS Einstellungen konfiguriert werden"
|
||||
AdvSceneSwitcher.generalTab.status.currentStatus="Erweiterter Automatischer Szenenwechsler ist:"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup="Beim Start:"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.asLastRun="Aktiviere den Szenenwechsler wenn er aktiv war"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.alwaysStart="Aktiviere den Szenenwechsler"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.doNotStart="Aktiviere den Szenenwechsler nicht"
|
||||
AdvSceneSwitcher.generalTab.status.start="Start"
|
||||
AdvSceneSwitcher.generalTab.status.stop="Stop"
|
||||
AdvSceneSwitcher.generalTab.status.checkInterval="Teste Bedingungen alle"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior="Allgemeines Verhalten"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recording="Aufnehmen"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.streaming="Streamen"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recordingAndStreaming="Aufnehmen und Streamen"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart1="Starte"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart2=" auf Szene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet="Wenn keine Bedingung erfüllt ist für "
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMetDelayTooltip="Kann nur so genau sein wie das eingestellte Interval zum Testen der Bedingungen."
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.dontSwitch="Nicht wechseln"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchToRandom="Wechsle zu einer Szene auf dem Zufall-Tab"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchTo="Wechsle zu:"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.cooldown="Nach einem automatisierten Szenenwechsel wechsle nicht mehr für"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.cooldownHint="In diesem Zeitraum werden potentielle erfüllte Bedingungen ignoriert!"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.verboseLogging="Ausführliches Logging"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop="Stoppe Streamen/Aufnehmen auf Szene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints="Deaktiviere UI Tipps"
|
||||
AdvSceneSwitcher.generalTab.priority="Priorität"
|
||||
AdvSceneSwitcher.generalTab.priority.description="Szenenwechselmethoden sortiert nach Priorität"
|
||||
AdvSceneSwitcher.generalTab.priority.threadPriority="Benutze Thread Priorität"
|
||||
AdvSceneSwitcher.generalTab.priority.threadPriorityNotice="(Erhöhen der Priorität über \"Normal\" ist nicht empfohlen)"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings="Speichern / Laden der Einstellungen"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.export="Exportieren"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.import="Importieren"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.exportWindowTitle="Exportiere Erweiterter Automatischer Szenenwechsler Einstellungen zu Datei ..."
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.importWindowTitle="Exportiere Erweiterter Automatischer Szenenwechsler Einstellungen von Datei ..."
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.textType="Text Dateien (*.txt)"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadFail="Importieren der Einstellungen ist fehlgeschlagen"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadSuccess="Einstellungen wurden erfolgreich importiert"
|
||||
AdvSceneSwitcher.generalTab.priority.fileContent="Datei Inhalt"
|
||||
AdvSceneSwitcher.generalTab.priority.sceneSequence="Szenenfolge"
|
||||
AdvSceneSwitcher.generalTab.priority.idleDetection="Inaktivitätserkennung"
|
||||
AdvSceneSwitcher.generalTab.priority.executable="Prozess"
|
||||
AdvSceneSwitcher.generalTab.priority.screenRegion="Bildschrimbereich"
|
||||
AdvSceneSwitcher.generalTab.priority.windowTitle="Fenstername"
|
||||
AdvSceneSwitcher.generalTab.priority.media="Medien"
|
||||
AdvSceneSwitcher.generalTab.priority.time="Zeit"
|
||||
AdvSceneSwitcher.generalTab.priority.audio="Audio"
|
||||
|
||||
; Transition Tab
|
||||
AdvSceneSwitcher.transitionTab.title="Szenenübergänge"
|
||||
AdvSceneSwitcher.transitionTab.transitionOverride="Szenenübergänge, die im Szenenwechsler konfiguriert werden, haben Vorrang vor Übergangsüberschreibung"
|
||||
AdvSceneSwitcher.transitionTab.transitionForAToB="Szenenübergänge für automatisierte Szenenwechsel von Szene A zu Szene B"
|
||||
AdvSceneSwitcher.transitionTab.transitionForAToB.description="<html><head/><body><p>Diese Einstellungen beeinflussen <span style=\"font-style:italic;\">nur</span> vom Szenenwechsler ausgelöste Szenenübergänge - Siehe <a href=\"https://obsproject.com/forum/resources/transition-table.1174/\"><span style=\" text-decoration: underline; color:#268bd2;\">Transition Table</span></a> um auch manuelle Szenenübergänge zu konfigurieren.<br/>Einstellungen auf diesem Tab haben Vorrang vor denen welche auf den übrigen Tabs konfiguriert wurden.</p></body></html>"
|
||||
AdvSceneSwitcher.transitionTab.defaultTransition="Ändere den Szenenübergang wenn eine Szene aktiv ist"
|
||||
AdvSceneSwitcher.transitionTab.entry="Wechsle von {{scenes}} zu {{scenes2}} mit {{transitions}}"
|
||||
AdvSceneSwitcher.transitionTab.defaultTransitionEntry="Wenn {{scenes}} aktiv ist ändere den Szenenübergang zu {{transitions}}"
|
||||
|
||||
; Pause Scenes Tab
|
||||
AdvSceneSwitcher.pauseTab.title="Pause"
|
||||
AdvSceneSwitcher.pauseTab.pauseOnScene="Pausiere den Szenenwechsler auf einer Szene"
|
||||
AdvSceneSwitcher.pauseTab.pauseInFocus1="Pausiere den Szenenwechsler wenn "
|
||||
AdvSceneSwitcher.pauseTab.pauseInFocus2="im Fokus ist"
|
||||
AdvSceneSwitcher.pauseTab.pauseTypeScene="Szene aktiv ist"
|
||||
AdvSceneSwitcher.pauseTab.pauseTypeWindow="Fenster im Fokus ist"
|
||||
AdvSceneSwitcher.pauseTab.pauseTargetAll="alle"
|
||||
AdvSceneSwitcher.pauseTab.pauseEntry="Pausiere {{pauseTargets}} Überprüfungen wenn {{scenes}} {{windows}} {{pauseTypes}}"
|
||||
|
||||
; Window Title Tab
|
||||
AdvSceneSwitcher.windowTitleTab.title="Fenstername"
|
||||
AdvSceneSwitcher.windowTitleTab.regexrDescription="<html><head/><body><p>Gib entweder den gesamten Fensternamen ein oder eine gültigen regulären Ausdruck. Die Syntax für regulärer Ausdrücke (regex) kann hier überprüft werden: <a href=\"https://regexr.com\"><span style=\" text-decoration: underline; color:#268bd2;\">RegExr</span></a></p></body></html>"
|
||||
AdvSceneSwitcher.windowTitleTab.stayInFocus1="Ignoriere diesen Fensternamen"
|
||||
AdvSceneSwitcher.windowTitleTab.stayInFocus2=" "
|
||||
AdvSceneSwitcher.windowTitleTab.fullscreen="wenn Vollbild"
|
||||
AdvSceneSwitcher.windowTitleTab.maximized="wenn maximiert"
|
||||
AdvSceneSwitcher.windowTitleTab.focused="wenn fokussiert"
|
||||
AdvSceneSwitcher.windowTitleTab.entry="{{windows}} {{scenes}} {{transitions}} {{fullscreen}} {{maximized}} {{focused}}"
|
||||
|
||||
; Executable Tab
|
||||
AdvSceneSwitcher.executableTab.title="Prozess"
|
||||
AdvSceneSwitcher.executableTab.implemented="Implementiert von dasOven"
|
||||
AdvSceneSwitcher.executableTab.requiresFocus="nur wenn dieser fokussiert ist"
|
||||
AdvSceneSwitcher.executableTab.entry="Wenn {{processes}} läuft wechsle zu {{scenes}} mit {{transitions}} {{requiresFocus}}"
|
||||
|
||||
; Screen Region Tab
|
||||
AdvSceneSwitcher.screenRegionTab.title="Bildschrimbereich"
|
||||
AdvSceneSwitcher.screenRegionTab.currentPosition="Mauszeiger ist bei:"
|
||||
AdvSceneSwitcher.screenRegionTab.showGuideFrames="Hilfsrahmen einblenden"
|
||||
AdvSceneSwitcher.screenRegionTab.hideGuideFrames="Hilfsrahmen ausblenden"
|
||||
AdvSceneSwitcher.screenRegionTab.entry="Wenn der Mauszeiger in {{minX}} {{minY}} x {{maxX}} {{maxY}} ist wechsle zu {{scenes}} mit {{transitions}}"
|
||||
|
||||
; Media Tab
|
||||
AdvSceneSwitcher.mediaTab.title="Medien"
|
||||
AdvSceneSwitcher.mediaTab.implemented="Implementiert von Exeldro"
|
||||
AdvSceneSwitcher.mediaTab.states.none="Keine Auswahl"
|
||||
AdvSceneSwitcher.mediaTab.states.playing="Abspielen"
|
||||
AdvSceneSwitcher.mediaTab.states.opening="Öffnen"
|
||||
AdvSceneSwitcher.mediaTab.states.buffering="Buffern"
|
||||
AdvSceneSwitcher.mediaTab.states.Paused="Pausiert"
|
||||
AdvSceneSwitcher.mediaTab.states.stopped="Gestoppt"
|
||||
AdvSceneSwitcher.mediaTab.states.ended="Beendet"
|
||||
AdvSceneSwitcher.mediaTab.states.error="Fehler"
|
||||
AdvSceneSwitcher.mediaTab.states.playedToEnd="Zu Ende gespielt"
|
||||
AdvSceneSwitcher.mediaTab.states.any="Beliebig"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.none="Keine Auswahl"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.shorter="Dauer kürzer"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.longer="Dauer länger"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.remainShorter="übrige Zeit kürzer"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.remainLonger="übrige Zeit länger"
|
||||
AdvSceneSwitcher.mediaTab.entry="Wenn {{mediaSources}} im Status {{states}} ist und{{timeRestrictions}} {{time}} ist wechsle zu {{scenes}} mit {{transitions}}"
|
||||
|
||||
; File Tab
|
||||
AdvSceneSwitcher.fileTab.title="Datei Inhalt"
|
||||
AdvSceneSwitcher.fileTab.readWriteSceneFile="Lese / schreibe Szene von / zu Datei"
|
||||
AdvSceneSwitcher.fileTab.currentSceneOutputFile="Schreibe den Namen der aktiven Szene in folgende Datei:"
|
||||
AdvSceneSwitcher.fileTab.switchSceneBaseOnFile="Aktiviere Lesen der Szene aus Datei"
|
||||
AdvSceneSwitcher.fileTab.switchSceneNameInputFile="Lies den Namen der Scene zu der gewechselt werden soll von folgender Datei:"
|
||||
AdvSceneSwitcher.fileTab.switchSceneBaseOnFileContent="Wechsle Scene basierend auf Datei Inhalt"
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning="Vorsicht: Der Szenenwechsler wird versuchen den angegebenen Pfad alle x ms zu öffnen!"
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning1="Vorsicht: Der Szenenwechsler öffnet den angegebenen Pfad alle "
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning2="ms"
|
||||
AdvSceneSwitcher.fileTab.libcurlWarning="Laden von libcurl fehlgeschlagen! Erreichen von remote Dateien wird nicht möglich sein!"
|
||||
AdvSceneSwitcher.fileTab.selectWrite=Datei auswählen in die geschrieben werden soll ..."
|
||||
AdvSceneSwitcher.fileTab.selectRead="Datei auswählen die gelesen werden soll ..."
|
||||
AdvSceneSwitcher.fileTab.textFileType="Text Dateien (*.txt)"
|
||||
AdvSceneSwitcher.fileTab.anyFileType="Beliebige Dateien (*.*)"
|
||||
AdvSceneSwitcher.fileTab.remote="remote Datei"
|
||||
AdvSceneSwitcher.fileTab.local="lokale Datei"
|
||||
AdvSceneSwitcher.fileTab.useRegExp="verwende reguläre Ausdrücke"
|
||||
AdvSceneSwitcher.fileTab.checkfileContentTime="nur wenn sich das Änderungsdatum geändert"
|
||||
AdvSceneSwitcher.fileTab.checkfileContent="nur wenn sich der Inhalt geänder hat"
|
||||
AdvSceneSwitcher.fileTab.entry="Wechsle zu {{scenes}} mit {{transitions}} wenn der Inhalt von {{fileType}} {{filePath}} {{browseButton}} passt zu:"
|
||||
AdvSceneSwitcher.fileTab.entry2="{{matchText}}"
|
||||
AdvSceneSwitcher.fileTab.entry3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
||||
|
||||
; Random Tab
|
||||
AdvSceneSwitcher.randomTab.title="Zufall"
|
||||
AdvSceneSwitcher.randomTab.randomDisabledWarning="Funktionalität deaktiviert - Um diese zu aktivieren wähle \"Wenn keine Bedingung erfüllt ist wechsle zu einer Szene auf dem Zufall-Tab\" auf dem Allgemein-Tab aus"
|
||||
AdvSceneSwitcher.randomTab.entry="Wenn keine Bedingung erfüllt ist wechsle zu {{scenes}} mit {{transitions}} für {{delay}}"
|
||||
|
||||
; Time Tab
|
||||
AdvSceneSwitcher.timeTab.title="Zeit"
|
||||
AdvSceneSwitcher.timeTab.anyDay="An allen Tagen"
|
||||
AdvSceneSwitcher.timeTab.mondays="Montags"
|
||||
AdvSceneSwitcher.timeTab.tuesdays="Dienstags"
|
||||
AdvSceneSwitcher.timeTab.wednesdays="Mittwochs"
|
||||
AdvSceneSwitcher.timeTab.thursdays="Donnerstags"
|
||||
AdvSceneSwitcher.timeTab.fridays="Freitags"
|
||||
AdvSceneSwitcher.timeTab.saturdays="Samstags"
|
||||
AdvSceneSwitcher.timeTab.sundays="Sonntags"
|
||||
AdvSceneSwitcher.timeTab.afterstart="Nach Streamen-/Aufnehmenstart"
|
||||
AdvSceneSwitcher.timeTab.afterstart.tip="Hier wird die Zeit relativ zum Starten des Streamen/Aufnehmen gemessen"
|
||||
AdvSceneSwitcher.timeTab.entry="{{triggers}} um {{time}} wechsle zu {{scenes}} mit {{transitions}}"
|
||||
|
||||
; Idle Tab
|
||||
AdvSceneSwitcher.idleTab.title="Inaktivitätserkennung"
|
||||
AdvSceneSwitcher.idleTab.enable="Aktiviere Inaktivitätserkennung"
|
||||
AdvSceneSwitcher.idleTab.condition1="Nach "
|
||||
AdvSceneSwitcher.idleTab.condition2="ohne Keyboard- oder Mauseingaben"
|
||||
AdvSceneSwitcher.idleTab.switchToScene="wechsle zu Szene"
|
||||
AdvSceneSwitcher.idleTab.usingTransition1="mit"
|
||||
AdvSceneSwitcher.idleTab.usingTransition2=" "
|
||||
AdvSceneSwitcher.idleTab.dontSwitchIfFocus1="Wechsle nicht wenn"
|
||||
AdvSceneSwitcher.idleTab.dontSwitchIfFocus2="im Fokus ist"
|
||||
|
||||
; Scene Sequence Tab
|
||||
AdvSceneSwitcher.sceneSequenceTab.title="Szenenfolge"
|
||||
AdvSceneSwitcher.sceneSequenceTab.description="Eine Szenenfolge kann durch Pausieren, Stoppen des Szenenwechslers oder manuelle Szenenwechsel abgebrochen werden"
|
||||
AdvSceneSwitcher.sceneSequenceTab.save="Speichere Szenenfolgen in eine Datei"
|
||||
AdvSceneSwitcher.sceneSequenceTab.load="Lade Szenenfolgen von einer Datei"
|
||||
AdvSceneSwitcher.sceneSequenceTab.saveTitle="Speichere Szenenfolgen in eine Datei ..."
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadTitle="Wähle eine Datei aus von der Szenenfolgen gelesen werden sollen ..."
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadFail="Laden der Einstellungen ist fehlgeschlagen!"
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadSuccess="Laden der Einstellungen war erfolgreich!"
|
||||
AdvSceneSwitcher.sceneSequenceTab.fileType="Text Dateien (*.txt)"
|
||||
AdvSceneSwitcher.sceneSequenceTab.interruptible="kann unterbrochen werden"
|
||||
AdvSceneSwitcher.sceneSequenceTab.interruptibleHint="Andere Szenenwechselmethoden können diese Sequenz unterbrechen"
|
||||
AdvSceneSwitcher.sceneSequenceTab.entry="Wenn {{startScenes}} aktiv ist wechsle zu {{scenes}} nach {{delay}} {{delayUnits}} mit {{transitions}} {{interruptible}}"
|
||||
|
||||
; Audio Tab
|
||||
AdvSceneSwitcher.audioTab.title="Audio"
|
||||
AdvSceneSwitcher.audioTab.condition.above="über"
|
||||
AdvSceneSwitcher.audioTab.condition.below="unter"
|
||||
AdvSceneSwitcher.audioTab.entry="Wenn die Lautstärke von {{audioSources}} {{condition}} {{volumeWidget}} ist für {{duration}} wechsle zu {{scenes}} mit {{transitions}}"
|
||||
AdvSceneSwitcher.audioTab.multiMatchfallbackCondition="Wenn mehrere Einträge zutreffen ..."
|
||||
AdvSceneSwitcher.audioTab.multiMatchfallback="... für {{duration}} wechsle zu {{scenes}} mit {{transitions}}"
|
||||
|
||||
; Hotkey
|
||||
AdvSceneSwitcher.hotkey.startSwitcherHotkey="Starte den Erweiteren Szenenwechsler"
|
||||
AdvSceneSwitcher.hotkey.stopSwitcherHotkey="Stoppe den Erweiteren Szenenwechsler"
|
||||
AdvSceneSwitcher.hotkey.startStopToggleSwitcherHotkey="Starte/Stoppe den Erweiteren Szenenwechsler"
|
||||
|
||||
AdvSceneSwitcher.close="Schließen"
|
||||
AdvSceneSwitcher.browse="Öffnen"
|
||||
|
||||
AdvSceneSwitcher.selectScene="--Szene auswählen--"
|
||||
AdvSceneSwitcher.selectPreviousScene="Vorhergehende Szene"
|
||||
AdvSceneSwitcher.selectTransition="--Szenenübergang auswählen--"
|
||||
AdvSceneSwitcher.selectWindow="--Fenster auswählen--"
|
||||
AdvSceneSwitcher.selectAudioSource="--Audio Quelle auswählen--"
|
||||
AdvSceneSwitcher.selectMediaSource="--Medien Quelle auswählen--"
|
||||
AdvSceneSwitcher.selectProcess="--Prozess auswählen--"
|
||||
AdvSceneSwitcher.enterPath="--Pfad eingeben--"
|
||||
AdvSceneSwitcher.enterText="--Text eingeben--"
|
||||
AdvSceneSwitcher.invaildEntriesWillNotBeSaved="Ungültige Einträge werden nicht gespeichert"
|
||||
AdvSceneSwitcher.selectWindowTip="Benutze \"OBS\" um das OBS-Studio Fenster auszuwählen\nBenutze\"Task Switching\"um die ALT + TAB Tastenkombination auszuwählen"
|
||||
|
||||
AdvSceneSwitcher.status.active="Aktiv"
|
||||
AdvSceneSwitcher.status.inactive="Inaktiv"
|
||||
|
||||
AdvSceneSwitcher.unit.milliseconds="Millisekunden"
|
||||
AdvSceneSwitcher.unit.secends="Sekunden"
|
||||
AdvSceneSwitcher.unit.minutes="Minuten"
|
||||
AdvSceneSwitcher.unit.hours="Stunden"
|
||||
218
data/locale/en-US.ini
Normal file
218
data/locale/en-US.ini
Normal file
@@ -0,0 +1,218 @@
|
||||
AdvSceneSwitcher.pluginName="Advanced Scene Switcher"
|
||||
AdvSceneSwitcher.windowTitle="Advanced Scene Switcher"
|
||||
|
||||
; General Tab
|
||||
AdvSceneSwitcher.generalTab.title="General"
|
||||
AdvSceneSwitcher.generalTab.status="Status"
|
||||
AdvSceneSwitcher.generalTab.status.hotkeytips="Hotkeys can be defined in the OBS settings"
|
||||
AdvSceneSwitcher.generalTab.status.currentStatus="Advanced Scene Switcher is:"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup="On startup:"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.asLastRun="Start the scene switcher if it was running"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.alwaysStart="Always start the scene switcher"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.doNotStart="Do not start the scene switcher"
|
||||
AdvSceneSwitcher.generalTab.status.start="Start"
|
||||
AdvSceneSwitcher.generalTab.status.stop="Stop"
|
||||
AdvSceneSwitcher.generalTab.status.checkInterval="Check switch conditions every"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior="General behavior"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recording="Recording"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.streaming="Streaming"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recordingAndStreaming="Recording and Streaming"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart1="Automatically start"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart2="on scene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet="If no switch condition is met for"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMetDelayTooltip="Will only ever be as accurate as the configured check interval."
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.dontSwitch="Don't switch"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchToRandom="Switch to any scene in Random tab"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchTo="Switch to:"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.cooldown="After a match do not switch scenes for"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.cooldownHint="During this time potential matches will be ignored!"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.verboseLogging="Enable verbose logging"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop="Automatically stop streaming/recording on scene"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints="Disable UI hints"
|
||||
AdvSceneSwitcher.generalTab.priority="Priority"
|
||||
AdvSceneSwitcher.generalTab.priority.description="Switching methods priority (Highest priority is at the top)"
|
||||
AdvSceneSwitcher.generalTab.priority.threadPriority="Use thread priority"
|
||||
AdvSceneSwitcher.generalTab.priority.threadPriorityNotice="(Raising the priority above \"Normal\" is not recommended)"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings="Save / load settings"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.export="Export"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.import="Import"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.exportWindowTitle="Export Advanced Scene Switcher settings to file ..."
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.importWindowTitle="Import Advanced Scene Switcher settings from file ..."
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.textType="Text files (*.txt)"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadFail="Advanced Scene Switcher failed to import settings"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadSuccess="Advanced Scene Switcher settings imported successfully"
|
||||
AdvSceneSwitcher.generalTab.priority.fileContent="File Content"
|
||||
AdvSceneSwitcher.generalTab.priority.sceneSequence="Scene Sequence"
|
||||
AdvSceneSwitcher.generalTab.priority.idleDetection="Idle Detection"
|
||||
AdvSceneSwitcher.generalTab.priority.executable="Executable"
|
||||
AdvSceneSwitcher.generalTab.priority.screenRegion="Screen Region"
|
||||
AdvSceneSwitcher.generalTab.priority.windowTitle="Window Title"
|
||||
AdvSceneSwitcher.generalTab.priority.media="Media"
|
||||
AdvSceneSwitcher.generalTab.priority.time="Time"
|
||||
AdvSceneSwitcher.generalTab.priority.audio="Audio"
|
||||
|
||||
; Transition Tab
|
||||
AdvSceneSwitcher.transitionTab.title="Transition"
|
||||
AdvSceneSwitcher.transitionTab.transitionOverride="Scene transitions defined in the scene switcher take priority over Transition Overrides defined per scene"
|
||||
AdvSceneSwitcher.transitionTab.transitionForAToB="Use transition for automated scene switch from scene A to scene B"
|
||||
AdvSceneSwitcher.transitionTab.transitionForAToB.description="<html><head/><body><p>These settings <span style=\"font-style:italic;\">only</span> affect transitions caused by the scene switcher - Check out <a href=\"https://obsproject.com/forum/resources/transition-table.1174/\"><span style=\" text-decoration: underline; color:#268bd2;\">Transition Table</span></a> if you want to configure this for manual scene changes.<br/>Settings defined here take priority over transition settings configured elsewhere in the scene switcher.</p></body></html>"
|
||||
AdvSceneSwitcher.transitionTab.defaultTransition="Change transition if scene is active"
|
||||
AdvSceneSwitcher.transitionTab.entry="Switch from {{scenes}} to {{scenes2}} using {{transitions}}"
|
||||
AdvSceneSwitcher.transitionTab.defaultTransitionEntry="When scene {{scenes}} is active change default scene transition to {{transitions}}"
|
||||
|
||||
; Pause Scenes Tab
|
||||
AdvSceneSwitcher.pauseTab.title="Pause"
|
||||
AdvSceneSwitcher.pauseTab.pauseOnScene="Pause the Scene Switcher on scene"
|
||||
AdvSceneSwitcher.pauseTab.pauseInFocus1="Pause the Scene Switcher when "
|
||||
AdvSceneSwitcher.pauseTab.pauseInFocus2="is in focus"
|
||||
AdvSceneSwitcher.pauseTab.pauseTypeScene="scene is active"
|
||||
AdvSceneSwitcher.pauseTab.pauseTypeWindow="window is in focus"
|
||||
AdvSceneSwitcher.pauseTab.pauseTargetAll="all"
|
||||
AdvSceneSwitcher.pauseTab.pauseEntry="Pause {{pauseTargets}} checks when {{pauseTypes}} {{scenes}} {{windows}}"
|
||||
|
||||
; Window Title Tab
|
||||
AdvSceneSwitcher.windowTitleTab.title="Title"
|
||||
AdvSceneSwitcher.windowTitleTab.regexrDescription="<html><head/><body><p>Enter either direct window titles or valid regex. You can check syntax and matches for regular expressions using <a href=\"https://regexr.com\"><span style=\" text-decoration: underline; color:#268bd2;\">RegExr</span></a></p></body></html>"
|
||||
AdvSceneSwitcher.windowTitleTab.stayInFocus1="Ignore this window name"
|
||||
AdvSceneSwitcher.windowTitleTab.stayInFocus2=" "
|
||||
AdvSceneSwitcher.windowTitleTab.fullscreen="if fullscreen"
|
||||
AdvSceneSwitcher.windowTitleTab.maximized="if maximized"
|
||||
AdvSceneSwitcher.windowTitleTab.focused="if focused"
|
||||
AdvSceneSwitcher.windowTitleTab.entry="{{windows}} {{scenes}} {{transitions}} {{fullscreen}} {{maximized}} {{focused}}"
|
||||
|
||||
; Executable Tab
|
||||
AdvSceneSwitcher.executableTab.title="Executable"
|
||||
AdvSceneSwitcher.executableTab.implemented="Implemented by dasOven"
|
||||
AdvSceneSwitcher.executableTab.requiresFocus="only if focused"
|
||||
AdvSceneSwitcher.executableTab.entry="When {{processes}} is running switch to {{scenes}} using {{transitions}} {{requiresFocus}}"
|
||||
|
||||
; Screen Region Tab
|
||||
AdvSceneSwitcher.screenRegionTab.title="Region"
|
||||
AdvSceneSwitcher.screenRegionTab.currentPosition="Cursor is currently at:"
|
||||
AdvSceneSwitcher.screenRegionTab.showGuideFrames="Show guide frames"
|
||||
AdvSceneSwitcher.screenRegionTab.hideGuideFrames="Hide guide frames"
|
||||
AdvSceneSwitcher.screenRegionTab.entry="If cursor is in {{minX}} {{minY}} x {{maxX}} {{maxY}} switch to {{scenes}} using {{transitions}}"
|
||||
|
||||
; Media Tab
|
||||
AdvSceneSwitcher.mediaTab.title="Media"
|
||||
AdvSceneSwitcher.mediaTab.implemented="Implemented by Exeldro"
|
||||
AdvSceneSwitcher.mediaTab.states.none="None"
|
||||
AdvSceneSwitcher.mediaTab.states.playing="Playing"
|
||||
AdvSceneSwitcher.mediaTab.states.opening="Opening"
|
||||
AdvSceneSwitcher.mediaTab.states.buffering="Buffering"
|
||||
AdvSceneSwitcher.mediaTab.states.Paused="Paused"
|
||||
AdvSceneSwitcher.mediaTab.states.stopped="Stopped"
|
||||
AdvSceneSwitcher.mediaTab.states.ended="Ended"
|
||||
AdvSceneSwitcher.mediaTab.states.error="Error"
|
||||
AdvSceneSwitcher.mediaTab.states.playedToEnd="Played to end"
|
||||
AdvSceneSwitcher.mediaTab.states.any="Any"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.none="None"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.shorter="Time shorter"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.longer="Time longer"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.remainShorter="Time remaining shorter"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.remainLonger="Time remaining longer"
|
||||
AdvSceneSwitcher.mediaTab.entry="When {{mediaSources}} state is {{states}} and {{timeRestrictions}} {{time}} switch to {{scenes}} using {{transitions}}"
|
||||
|
||||
; File Tab
|
||||
AdvSceneSwitcher.fileTab.title="File"
|
||||
AdvSceneSwitcher.fileTab.readWriteSceneFile="Read / write scene from / to file"
|
||||
AdvSceneSwitcher.fileTab.currentSceneOutputFile="Write the name of the current scene to this file:"
|
||||
AdvSceneSwitcher.fileTab.switchSceneBaseOnFile="Enable switching of scenes based on file input"
|
||||
AdvSceneSwitcher.fileTab.switchSceneNameInputFile="Read scene name to be switched to from this file:"
|
||||
AdvSceneSwitcher.fileTab.switchSceneBaseOnFileContent="Switch scene based on file contents"
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning="Please note that if you choose the remote option the scene switcher will try to access the remote location every x ms as specified on the General tab!"
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning1="Note that the scene switcher will try to access the remote location every "
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning2="ms"
|
||||
AdvSceneSwitcher.fileTab.libcurlWarning="Failed to load libcurl! Accessing remote files will not be possible!"
|
||||
AdvSceneSwitcher.fileTab.selectWrite="Select a file to write to ..."
|
||||
AdvSceneSwitcher.fileTab.selectRead="Select a file to read from ..."
|
||||
AdvSceneSwitcher.fileTab.textFileType="Text files (*.txt)"
|
||||
AdvSceneSwitcher.fileTab.anyFileType="Any files (*.*)"
|
||||
AdvSceneSwitcher.fileTab.remote="remote file"
|
||||
AdvSceneSwitcher.fileTab.local="local file"
|
||||
AdvSceneSwitcher.fileTab.useRegExp="use regular expressions (pattern matching)"
|
||||
AdvSceneSwitcher.fileTab.checkfileContentTime="if modification date changed"
|
||||
AdvSceneSwitcher.fileTab.checkfileContent="if content changed"
|
||||
AdvSceneSwitcher.fileTab.entry="Switch to {{scenes}} using {{transitions}} if content of {{fileType}} {{filePath}} {{browseButton}} matches:"
|
||||
AdvSceneSwitcher.fileTab.entry2="{{matchText}}"
|
||||
AdvSceneSwitcher.fileTab.entry3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
||||
|
||||
; Random Tab
|
||||
AdvSceneSwitcher.randomTab.title="Random"
|
||||
AdvSceneSwitcher.randomTab.randomDisabledWarning="Functionality disabled - To activate select \"If no switch condition is met switch to any scene in Random tab\" on General tab"
|
||||
AdvSceneSwitcher.randomTab.entry="If no switch condition is met switch to {{scenes}} using {{transitions}} for {{delay}}"
|
||||
|
||||
; Time Tab
|
||||
AdvSceneSwitcher.timeTab.title="Time"
|
||||
AdvSceneSwitcher.timeTab.anyDay="On any day"
|
||||
AdvSceneSwitcher.timeTab.mondays="Mondays"
|
||||
AdvSceneSwitcher.timeTab.tuesdays="Tuesdays"
|
||||
AdvSceneSwitcher.timeTab.wednesdays="Wednesdays"
|
||||
AdvSceneSwitcher.timeTab.thursdays="Thursdays"
|
||||
AdvSceneSwitcher.timeTab.fridays="Fridays"
|
||||
AdvSceneSwitcher.timeTab.saturdays="Saturdays"
|
||||
AdvSceneSwitcher.timeTab.sundays="Sundays"
|
||||
AdvSceneSwitcher.timeTab.afterstart="After streaming/recording start"
|
||||
AdvSceneSwitcher.timeTab.afterstart.tip="The time relative to the start of streaming / recording will be used"
|
||||
AdvSceneSwitcher.timeTab.entry="{{triggers}} at {{time}} switch to {{scenes}} using {{transitions}}"
|
||||
|
||||
; Idle Tab
|
||||
AdvSceneSwitcher.idleTab.title="Idle"
|
||||
AdvSceneSwitcher.idleTab.enable="Enable Idle Detection"
|
||||
AdvSceneSwitcher.idleTab.condition1="After "
|
||||
AdvSceneSwitcher.idleTab.condition2="of no keyboard or mouse inputs "
|
||||
AdvSceneSwitcher.idleTab.switchToScene="switch to scene"
|
||||
AdvSceneSwitcher.idleTab.usingTransition1="using the"
|
||||
AdvSceneSwitcher.idleTab.usingTransition2="transition"
|
||||
AdvSceneSwitcher.idleTab.dontSwitchIfFocus1="Do not switch if"
|
||||
AdvSceneSwitcher.idleTab.dontSwitchIfFocus2="is in focus"
|
||||
|
||||
; Scene Sequence Tab
|
||||
AdvSceneSwitcher.sceneSequenceTab.title="Sequence"
|
||||
AdvSceneSwitcher.sceneSequenceTab.description="A sequence of automatic scene switches can be cancelled by either pausing/stopping the scene switcher or manually switching to a different scene"
|
||||
AdvSceneSwitcher.sceneSequenceTab.save="Save scene sequences to file"
|
||||
AdvSceneSwitcher.sceneSequenceTab.load="Load scene sequences from file"
|
||||
AdvSceneSwitcher.sceneSequenceTab.saveTitle="Save Scene Sequence to file ..."
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadTitle="Select a file to read Scene Sequence from ..."
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadFail="Advanced Scene Switcher failed to import settings!"
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadSuccess="Advanced Scene Switcher settings imported successfully!"
|
||||
AdvSceneSwitcher.sceneSequenceTab.fileType="Text files (*.txt)"
|
||||
AdvSceneSwitcher.sceneSequenceTab.interruptible="interruptible"
|
||||
AdvSceneSwitcher.sceneSequenceTab.interruptibleHint="Other switching methods are allowed to interrupt this scene sequence"
|
||||
AdvSceneSwitcher.sceneSequenceTab.entry="When {{startScenes}} is active switch to {{scenes}} after {{delay}} {{delayUnits}} using {{transitions}} {{interruptible}}"
|
||||
|
||||
; Audio Tab
|
||||
AdvSceneSwitcher.audioTab.title="Audio"
|
||||
AdvSceneSwitcher.audioTab.condition.above="above"
|
||||
AdvSceneSwitcher.audioTab.condition.below="below"
|
||||
AdvSceneSwitcher.audioTab.entry="When the volume of {{audioSources}} is {{condition}} {{volumeWidget}} for {{duration}} switch to {{scenes}} using {{transitions}}"
|
||||
AdvSceneSwitcher.audioTab.multiMatchfallbackCondition="If multiple entries match ..."
|
||||
AdvSceneSwitcher.audioTab.multiMatchfallback="... for {{duration}} switch to {{scenes}} using {{transitions}}"
|
||||
|
||||
; Hotkey
|
||||
AdvSceneSwitcher.hotkey.startSwitcherHotkey="Start the Advanced Scene Switcher"
|
||||
AdvSceneSwitcher.hotkey.stopSwitcherHotkey="Stop the Advanced Scene Switcher"
|
||||
AdvSceneSwitcher.hotkey.startStopToggleSwitcherHotkey="Toggle Start/Stop for the Advanced Scene Switcher"
|
||||
|
||||
AdvSceneSwitcher.close="Close"
|
||||
AdvSceneSwitcher.browse="Browse"
|
||||
|
||||
AdvSceneSwitcher.selectScene="--select scene--"
|
||||
AdvSceneSwitcher.selectPreviousScene="Previous Scene"
|
||||
AdvSceneSwitcher.selectTransition="--select transition--"
|
||||
AdvSceneSwitcher.selectWindow="--select window--"
|
||||
AdvSceneSwitcher.selectAudioSource="--select audio source--"
|
||||
AdvSceneSwitcher.selectMediaSource="--select media source--"
|
||||
AdvSceneSwitcher.selectProcess="--select process--"
|
||||
AdvSceneSwitcher.enterPath="--enter path--"
|
||||
AdvSceneSwitcher.enterText="--enter text--"
|
||||
AdvSceneSwitcher.invaildEntriesWillNotBeSaved="invalid entries will not be saved"
|
||||
AdvSceneSwitcher.selectWindowTip="Use \"OBS\" to specify OBS window\nUse \"Task Switching\"to specify ALT + TAB"
|
||||
|
||||
AdvSceneSwitcher.status.active="Active"
|
||||
AdvSceneSwitcher.status.inactive="Inactive"
|
||||
|
||||
AdvSceneSwitcher.unit.milliseconds="milliseconds"
|
||||
AdvSceneSwitcher.unit.secends="seconds"
|
||||
AdvSceneSwitcher.unit.minutes="minutes"
|
||||
AdvSceneSwitcher.unit.hours="hours"
|
||||
206
data/locale/zh-CN.ini
Normal file
206
data/locale/zh-CN.ini
Normal file
@@ -0,0 +1,206 @@
|
||||
AdvSceneSwitcher.pluginName="高级场景切换器"
|
||||
AdvSceneSwitcher.windowTitle="高级场景切换器"
|
||||
|
||||
; General Tab
|
||||
AdvSceneSwitcher.generalTab.title="通用"
|
||||
AdvSceneSwitcher.generalTab.status="状态"
|
||||
AdvSceneSwitcher.generalTab.status.hotkeytips="快捷键可在OBS设置中设置"
|
||||
AdvSceneSwitcher.generalTab.status.currentStatus="当前状态:"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup="在OBS启动时"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.asLastRun="按照最后运行时的状态"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.alwaysStart="总是自动启动"
|
||||
AdvSceneSwitcher.generalTab.status.onStartup.doNotStart="不要启动"
|
||||
AdvSceneSwitcher.generalTab.status.start="启动"
|
||||
AdvSceneSwitcher.generalTab.status.stop="停止"
|
||||
AdvSceneSwitcher.generalTab.status.checkInterval="检查切换条件时间间隔"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior="一般表现"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recording="录制"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.streaming="推流"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recordingAndStreaming="录制和推流"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart1="自动开始"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart2="当切换到场景时"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet="如果不符合任何切换条件"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMetDelayTooltip="时间精度最高只能达到配置的轮询间隔"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.dontSwitch="不切换"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchToRandom="切换到随机场景列表中任意随机场景"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.onNoMet.switchTo="切换到"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.verboseLogging="详细日志输出"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStop="当切换到场景时自动停止推流和录制"
|
||||
AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints="禁用UI提示"
|
||||
AdvSceneSwitcher.generalTab.priority="优先级"
|
||||
AdvSceneSwitcher.generalTab.priority.description="切换场景优先级 (最上方的项优先级最高)"
|
||||
AdvSceneSwitcher.generalTab.priority.threadPriority="使用线程优先级"
|
||||
AdvSceneSwitcher.generalTab.priority.threadPriorityNotice="(不推荐使用高于 \"Normal\" 的优先级)"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings="导出或导入设置"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.export="导出设置"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.import="导入设置"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.exportWindowTitle="导出高级场景切换器到文件..."
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.importWindowTitle="导入高级场景切换器到文件..."
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.textType="文本文件 (*.txt)"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadFail="高级场景切换器导入设置失败"
|
||||
AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadSuccess="高级场景切换器导入设置成功"
|
||||
AdvSceneSwitcher.generalTab.priority.fileContent="文件内容"
|
||||
AdvSceneSwitcher.generalTab.priority.sceneSequence="场景序列"
|
||||
AdvSceneSwitcher.generalTab.priority.idleDetection="闲置检测"
|
||||
AdvSceneSwitcher.generalTab.priority.executable="程序"
|
||||
AdvSceneSwitcher.generalTab.priority.screenRegion="屏幕区域"
|
||||
AdvSceneSwitcher.generalTab.priority.windowTitle="窗口标题"
|
||||
AdvSceneSwitcher.generalTab.priority.media="媒体"
|
||||
AdvSceneSwitcher.generalTab.priority.time="时间"
|
||||
AdvSceneSwitcher.generalTab.priority.audio="音频"
|
||||
|
||||
; Transition Tab
|
||||
AdvSceneSwitcher.transitionTab.title="转场特效"
|
||||
AdvSceneSwitcher.transitionTab.transitionOverride="在场景切换器中设定的转场特效优先级高于场景设定的转场特效"
|
||||
AdvSceneSwitcher.transitionTab.transitionForAToB="当自动从场景A切换到场景B时使用的转场特效"
|
||||
AdvSceneSwitcher.transitionTab.transitionForAToB.description="<html><head/><body><p>这里的设定<span style=\"font-style:bold;\">只影响由场景切换器引起的转场有效</span>,不影响你手动的引起的转场。<br/>在这里设定的转场特效优先级高于场景切换器其他地方设置的</p></body></html>"
|
||||
AdvSceneSwitcher.transitionTab.defaultTransition="当切换到这个场景时修改默认转场特效"
|
||||
AdvSceneSwitcher.transitionTab.switchDefaultLabel="活跃时切换默认转场特效为"
|
||||
AdvSceneSwitcher.transitionTab.entry="从场景 {{scenes}} 切换到场景 {{scenes2}} 时使用转场特效 {{transitions}}"
|
||||
AdvSceneSwitcher.transitionTab.defaultTransitionEntry="当场景 {{scenes}} 被激活时更改默认转场特效为 {{transitions}}"
|
||||
|
||||
; Pause Scenes Tab
|
||||
AdvSceneSwitcher.pauseTab.title="暂停"
|
||||
AdvSceneSwitcher.pauseTab.pauseOnScene="当切换到这个场景时暂停场景切换器"
|
||||
AdvSceneSwitcher.pauseTab.pauseInFocus1="当窗口"
|
||||
AdvSceneSwitcher.pauseTab.pauseInFocus2="获得焦点时暂停场景切换器"
|
||||
|
||||
; Window Title Tab
|
||||
AdvSceneSwitcher.windowTitleTab.title="窗口标题"
|
||||
AdvSceneSwitcher.windowTitleTab.regexrDescription="<html><head/><body><p>你可以直接输入窗口标题或正则表达式. 你可以使用<a href=\"https://regexr.com\"><span style=\" text-decoration: underline; color:#268bd2;\">RegExr</span></a>来检查验证你的正则表达式</p></body></html>"
|
||||
AdvSceneSwitcher.windowTitleTab.stayInFocus1="当前焦点窗口标题为"
|
||||
AdvSceneSwitcher.windowTitleTab.stayInFocus2="时保持当前场景"
|
||||
AdvSceneSwitcher.windowTitleTab.fullscreen="全屏时"
|
||||
AdvSceneSwitcher.windowTitleTab.maximized="最大化时"
|
||||
AdvSceneSwitcher.windowTitleTab.focused="窗口聚集时"
|
||||
AdvSceneSwitcher.windowTitleTab.entry="{{windows}} {{scenes}} {{transitions}} {{fullscreen}} {{maximized}} {{focused}}"
|
||||
|
||||
; Executable Tab
|
||||
AdvSceneSwitcher.executableTab.title="程序"
|
||||
AdvSceneSwitcher.executableTab.implemented="感谢dasOven的实现"
|
||||
AdvSceneSwitcher.executableTab.requiresFocus="仅获得焦点时"
|
||||
AdvSceneSwitcher.executableTab.entry="当 {{processes}} 正在运行时使用 {{transitions}} 切换到 {{scenes}} {{requiresFocus}}"
|
||||
|
||||
; Screen Region Tab
|
||||
AdvSceneSwitcher.screenRegionTab.title="屏幕区域"
|
||||
AdvSceneSwitcher.screenRegionTab.currentPosition="鼠标当前位置:"
|
||||
AdvSceneSwitcher.screenRegionTab.showGuideFrames="显示区域边界"
|
||||
AdvSceneSwitcher.screenRegionTab.hideGuideFrames="隐藏区域边界"
|
||||
AdvSceneSwitcher.screenRegionTab.entry="如果鼠标在 {{minX}} {{minY}} x {{maxX}} {{maxY}} 使用转场特效 {{transitions}} 切换到场景 {{scenes}}"
|
||||
|
||||
; Media Tab
|
||||
AdvSceneSwitcher.mediaTab.title="媒体"
|
||||
AdvSceneSwitcher.mediaTab.implemented="感谢Exeldro的实现"
|
||||
AdvSceneSwitcher.mediaTab.states.none="空"
|
||||
AdvSceneSwitcher.mediaTab.states.playing="播放中"
|
||||
AdvSceneSwitcher.mediaTab.states.opening="正在打开"
|
||||
AdvSceneSwitcher.mediaTab.states.buffering="缓冲中"
|
||||
AdvSceneSwitcher.mediaTab.states.Paused="暂停"
|
||||
AdvSceneSwitcher.mediaTab.states.stopped="停止"
|
||||
AdvSceneSwitcher.mediaTab.states.ended="结束"
|
||||
AdvSceneSwitcher.mediaTab.states.error="错误"
|
||||
AdvSceneSwitcher.mediaTab.states.any="任意"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.none="无"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.shorter="播放时间小于"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.longer="播放时间大于"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.remainShorter="剩余时间少于"
|
||||
AdvSceneSwitcher.mediaTab.timeRestriction.remainLonger="剩余时间多于"
|
||||
AdvSceneSwitcher.mediaTab.entry="当 {{mediaSources}} 状态为 {{states}} 并且 {{timeRestrictions}} {{time}} 时使用转场特效 {{transitions}} 切换到场景 {{scenes}}"
|
||||
|
||||
; File Tab
|
||||
AdvSceneSwitcher.fileTab.title="文件"
|
||||
AdvSceneSwitcher.fileTab.readWriteSceneFile="从文件加载或保存当前场景名"
|
||||
AdvSceneSwitcher.fileTab.currentSceneOutputFile="将当前场景写入到这个文件:"
|
||||
AdvSceneSwitcher.fileTab.switchSceneBaseOnFile="启用从文件读取应切换到的场景名"
|
||||
AdvSceneSwitcher.fileTab.switchSceneNameInputFile="从这个文件读取应切换到的场景名:"
|
||||
AdvSceneSwitcher.fileTab.switchSceneBaseOnFileContent="根据文件内容切换场景"
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning="请注意 如果你使用网络文件,场景切换器会按照你在通用页设置的间隔时间尝试访问网络文件!"
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning1="注意,场景切换器会每 "
|
||||
AdvSceneSwitcher.fileTab.remoteFileWarning2="毫秒尝试访问网络文件"
|
||||
AdvSceneSwitcher.fileTab.libcurlWarning="无法加载 libcurl 库! 访问网络文件功能将不可用!"
|
||||
AdvSceneSwitcher.fileTab.selectWrite="写入到文件..."
|
||||
AdvSceneSwitcher.fileTab.selectRead="从文件读取..."
|
||||
AdvSceneSwitcher.fileTab.textFileType="文本文件 (*.txt)"
|
||||
AdvSceneSwitcher.fileTab.anyFileType="任意文件 (*.*)"
|
||||
AdvSceneSwitcher.fileTab.remote="网络"
|
||||
AdvSceneSwitcher.fileTab.local="本地"
|
||||
AdvSceneSwitcher.fileTab.useRegExp="使用正则表达式(模式匹配)"
|
||||
AdvSceneSwitcher.fileTab.checkfileContentTime="仅当文件修改时间改变时检查文件内容"
|
||||
AdvSceneSwitcher.fileTab.checkfileContent="仅当文件发生修改时"
|
||||
AdvSceneSwitcher.fileTab.entry="如果 {{fileType}} 文件 {{filePath}} {{browseButton}} 匹配下列规则,使用转场特效 {{transitions}} 切换到场景 {{scenes}}"
|
||||
AdvSceneSwitcher.fileTab.entry2="{{matchText}}"
|
||||
AdvSceneSwitcher.fileTab.entry3="{{useRegex}} {{checkModificationDate}} {{checkFileContent}}"
|
||||
|
||||
; Random Tab
|
||||
AdvSceneSwitcher.randomTab.title="随机场景列表"
|
||||
AdvSceneSwitcher.randomTab.randomDisabledWarning="功能已被禁用 - 可通过在通用页设置\"如果不符合任何切换条件切换到随机场景列表中任意随机场景\"启用"
|
||||
AdvSceneSwitcher.randomTab.entry="如果没有切换器条件满足,使用转场特效 {{transitions}} 切换到场景 {{scenes}} 并停留 {{delay}}"
|
||||
|
||||
; Time Tab
|
||||
AdvSceneSwitcher.timeTab.title="时间"
|
||||
AdvSceneSwitcher.timeTab.anyDay="每天"
|
||||
AdvSceneSwitcher.timeTab.mondays="每周一"
|
||||
AdvSceneSwitcher.timeTab.tuesdays="每周二"
|
||||
AdvSceneSwitcher.timeTab.wednesdays="每周三"
|
||||
AdvSceneSwitcher.timeTab.thursdays="每周四"
|
||||
AdvSceneSwitcher.timeTab.fridays="每周五"
|
||||
AdvSceneSwitcher.timeTab.saturdays="每周六"
|
||||
AdvSceneSwitcher.timeTab.sundays="每周日"
|
||||
AdvSceneSwitcher.timeTab.afterstart="推流或录制开始后"
|
||||
AdvSceneSwitcher.timeTab.afterstart.tip="相对于直播或录制开始之后的时间点"
|
||||
AdvSceneSwitcher.timeTab.entry="{{triggers}} 的 {{time}} 使用转场特效 {{transitions}} 切换到场景 {{scenes}}"
|
||||
|
||||
; Idle Tab
|
||||
AdvSceneSwitcher.idleTab.title="闲置检测"
|
||||
AdvSceneSwitcher.idleTab.enable="启用闲置检测"
|
||||
AdvSceneSwitcher.idleTab.condition1="超过"
|
||||
AdvSceneSwitcher.idleTab.condition2="没有鼠标或键盘操作"
|
||||
AdvSceneSwitcher.idleTab.switchToScene="切换到场景"
|
||||
AdvSceneSwitcher.idleTab.usingTransition1="使用"
|
||||
AdvSceneSwitcher.idleTab.usingTransition2="转场特效"
|
||||
AdvSceneSwitcher.idleTab.dontSwitchIfFocus1="如果当前窗口焦点在"
|
||||
AdvSceneSwitcher.idleTab.dontSwitchIfFocus2="时不切换"
|
||||
|
||||
; Scene Sequence Tab
|
||||
AdvSceneSwitcher.sceneSequenceTab.title="场景序列"
|
||||
AdvSceneSwitcher.sceneSequenceTab.description="自动场景序列可以通过暂停或停止场景切换器或者手动切换到其他场景来取消"
|
||||
AdvSceneSwitcher.sceneSequenceTab.save="保存当前序列到文件"
|
||||
AdvSceneSwitcher.sceneSequenceTab.load="从文件加载序列"
|
||||
AdvSceneSwitcher.sceneSequenceTab.saveTitle="保存当前序列到文件 ..."
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadTitle="从文件加载序列 ..."
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadFail="导入失败"
|
||||
AdvSceneSwitcher.sceneSequenceTab.loadSuccess="导入失败成功"
|
||||
AdvSceneSwitcher.sceneSequenceTab.fileType="文本文件 (*.txt)"
|
||||
AdvSceneSwitcher.sceneSequenceTab.entry="当场景 {{startScenes}} 被激活 {{delay}} {{delayUnits}}后使用转场特效 {{transitions}} 切换到场景 {{scenes}} {{interruptible}}"
|
||||
|
||||
; Audio Tab
|
||||
AdvSceneSwitcher.audioTab.title="音频"
|
||||
AdvSceneSwitcher.audioTab.entry="当{{audioSources}} is {{condition}} {{volumeWidget}} for {{duration}} 使用转场特效 {{transitions}} 切换到场景 {{scenes}}"
|
||||
|
||||
; Hotkey
|
||||
AdvSceneSwitcher.hotkey.startSwitcherHotkey="启动高级场景切换器"
|
||||
AdvSceneSwitcher.hotkey.stopSwitcherHotkey="停止高级场景切换器"
|
||||
AdvSceneSwitcher.hotkey.startStopToggleSwitcherHotkey="切换(启动/停止)高级场景切换器"
|
||||
|
||||
AdvSceneSwitcher.close="关闭"
|
||||
AdvSceneSwitcher.browse="浏览文件"
|
||||
|
||||
AdvSceneSwitcher.selectScene="--选择场景--"
|
||||
AdvSceneSwitcher.selectTransition="--选择转场特效--"
|
||||
AdvSceneSwitcher.selectWindow="--选择窗口--"
|
||||
AdvSceneSwitcher.selectAudioSource="--选择音频源--"
|
||||
AdvSceneSwitcher.selectMediaSource="--选择媒体源--"
|
||||
AdvSceneSwitcher.selectProcess="--选择进程--"
|
||||
AdvSceneSwitcher.enterPath="--输入路径--"
|
||||
AdvSceneSwitcher.enterText="--输入文本--"
|
||||
AdvSceneSwitcher.invaildEntriesWillNotBeSaved="无效项将不会被保存"
|
||||
AdvSceneSwitcher.selectWindowTip="使用 \"OBS\" 来指定OBS窗口\n使用 \"Task Switching\" 来指定 Alt + Tab"
|
||||
|
||||
AdvSceneSwitcher.status.active="运行中"
|
||||
AdvSceneSwitcher.status.inactive="已停止"
|
||||
|
||||
AdvSceneSwitcher.unit.milliseconds="毫秒"
|
||||
AdvSceneSwitcher.unit.secends="秒"
|
||||
AdvSceneSwitcher.unit.minutes="分钟"
|
||||
AdvSceneSwitcher.unit.hours="小时"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,15 @@
|
||||
#include <obs-module.h>
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
OBS_DECLARE_MODULE()
|
||||
OBS_MODULE_USE_DEFAULT_LOCALE("advanced-scene-switcher", "en-US")
|
||||
|
||||
void InitSceneSwitcher();
|
||||
void FreeSceneSwitcher();
|
||||
|
||||
bool obs_module_load(void)
|
||||
{
|
||||
obs_frontend_push_ui_translation(obs_module_get_string);
|
||||
InitSceneSwitcher();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,15 @@
|
||||
#include <QtGui/qstandarditemmodel.h>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <obs-module.h>
|
||||
#include <obs-frontend-api.h>
|
||||
#include <util/util.hpp>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/curl-helper.hpp"
|
||||
#include "headers/version.h"
|
||||
|
||||
SwitcherData *switcher = nullptr;
|
||||
|
||||
@@ -26,8 +29,19 @@ AdvSceneSwitcher::AdvSceneSwitcher(QWidget *parent)
|
||||
loadUI();
|
||||
}
|
||||
|
||||
bool translationAvailable()
|
||||
{
|
||||
return !!strcmp(obs_module_text("AdvSceneSwitcher.pluginName"),
|
||||
"AdvSceneSwitcher.pluginName");
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::loadUI()
|
||||
{
|
||||
if (!translationAvailable()) {
|
||||
DisplayMessage("Failed to find plug-in's 'data' directory.\n"
|
||||
"Please check installation instructions!");
|
||||
}
|
||||
|
||||
#if __APPLE__
|
||||
setMinimumHeight(700);
|
||||
#endif
|
||||
@@ -53,6 +67,13 @@ void AdvSceneSwitcher::loadUI()
|
||||
/********************************************************************************
|
||||
* UI helpers
|
||||
********************************************************************************/
|
||||
void AdvSceneSwitcher::DisplayMessage(QString msg)
|
||||
{
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setWindowTitle("Advanced Scene Switcher");
|
||||
Msgbox.setText(msg);
|
||||
Msgbox.exec();
|
||||
}
|
||||
|
||||
void addSelectionEntry(QComboBox *sel, const char *description,
|
||||
const char *tooltip = "")
|
||||
@@ -76,8 +97,10 @@ void AdvSceneSwitcher::populateSceneSelection(QComboBox *sel, bool addPrevious,
|
||||
bool addSelect)
|
||||
{
|
||||
if (addSelect)
|
||||
addSelectionEntry(sel, "--select scene--",
|
||||
"invalid entries will not be saved");
|
||||
addSelectionEntry(
|
||||
sel, obs_module_text("AdvSceneSwitcher.selectScene"),
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
|
||||
|
||||
BPtr<char *> scenes = obs_frontend_get_scene_names();
|
||||
char **temp = scenes;
|
||||
@@ -88,14 +111,17 @@ void AdvSceneSwitcher::populateSceneSelection(QComboBox *sel, bool addPrevious,
|
||||
}
|
||||
|
||||
if (addPrevious)
|
||||
sel->addItem(previous_scene_name);
|
||||
sel->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.selectPreviousScene"));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::populateTransitionSelection(QComboBox *sel,
|
||||
bool addSelect)
|
||||
{
|
||||
if (addSelect)
|
||||
addSelectionEntry(sel, "--select transition--");
|
||||
addSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectTransition"));
|
||||
|
||||
obs_frontend_source_list *transitions = new obs_frontend_source_list();
|
||||
obs_frontend_get_transitions(transitions);
|
||||
@@ -112,7 +138,8 @@ void AdvSceneSwitcher::populateTransitionSelection(QComboBox *sel,
|
||||
void AdvSceneSwitcher::populateWindowSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
if (addSelect)
|
||||
addSelectionEntry(sel, "--select window--");
|
||||
addSelectionEntry(
|
||||
sel, obs_module_text("AdvSceneSwitcher.selectWindow"));
|
||||
|
||||
std::vector<std::string> windows;
|
||||
GetWindowList(windows);
|
||||
@@ -123,66 +150,105 @@ void AdvSceneSwitcher::populateWindowSelection(QComboBox *sel, bool addSelect)
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
sel->setItemData(
|
||||
0,
|
||||
"Use \"OBS\" to specify OBS window\nUse \"Task Switching\"to specify ALT + TAB",
|
||||
Qt::ToolTipRole);
|
||||
sel->setItemData(0, obs_module_text("AdvSceneSwitcher.selectWindowTip"),
|
||||
Qt::ToolTipRole);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::populateAudioSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
if (addSelect)
|
||||
addSelectionEntry(sel, "--select audio source--",
|
||||
"invalid entries will not be saved");
|
||||
addSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectAudioSource"),
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
|
||||
|
||||
auto sourceEnum = [](void *data, obs_source_t *source) -> bool /* -- */
|
||||
{
|
||||
QComboBox *combo = reinterpret_cast<QComboBox *>(data);
|
||||
std::vector<std::string> *list =
|
||||
reinterpret_cast<std::vector<std::string> *>(data);
|
||||
uint32_t flags = obs_source_get_output_flags(source);
|
||||
|
||||
if ((flags & OBS_SOURCE_AUDIO) != 0) {
|
||||
const char *name = obs_source_get_name(source);
|
||||
combo->addItem(name);
|
||||
list->push_back(obs_source_get_name(source));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
obs_enum_sources(sourceEnum, sel);
|
||||
std::vector<std::string> audioSources;
|
||||
obs_enum_sources(sourceEnum, &audioSources);
|
||||
sort(audioSources.begin(), audioSources.end());
|
||||
for (std::string &source : audioSources) {
|
||||
sel->addItem(source.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::populateMediaSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
if (addSelect)
|
||||
addSelectionEntry(sel, "--select media source--",
|
||||
"invalid entries will not be saved");
|
||||
addSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectMediaSource"),
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
|
||||
|
||||
auto sourceEnum = [](void *data, obs_source_t *source) -> bool /* -- */
|
||||
{
|
||||
QComboBox *combo = reinterpret_cast<QComboBox *>(data);
|
||||
std::vector<std::string> *list =
|
||||
reinterpret_cast<std::vector<std::string> *>(data);
|
||||
std::string sourceId = obs_source_get_id(source);
|
||||
if (sourceId.compare("ffmpeg_source") == 0 ||
|
||||
sourceId.compare("vlc_source") == 0) {
|
||||
const char *name = obs_source_get_name(source);
|
||||
combo->addItem(name);
|
||||
list->push_back(obs_source_get_name(source));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
obs_enum_sources(sourceEnum, sel);
|
||||
std::vector<std::string> mediaSources;
|
||||
obs_enum_sources(sourceEnum, &mediaSources);
|
||||
sort(mediaSources.begin(), mediaSources.end());
|
||||
for (std::string &source : mediaSources) {
|
||||
sel->addItem(source.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::populateProcessSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
if (addSelect)
|
||||
addSelectionEntry(sel, "--select process--");
|
||||
addSelectionEntry(
|
||||
sel, obs_module_text("AdvSceneSwitcher.selectProcess"));
|
||||
|
||||
QStringList processes;
|
||||
GetProcessList(processes);
|
||||
processes.sort();
|
||||
for (QString &process : processes)
|
||||
sel->addItem(process);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::listAddClicked(QListWidget *list,
|
||||
SwitchWidget *newWidget,
|
||||
QPushButton *addButton,
|
||||
QMetaObject::Connection *addHighlight)
|
||||
{
|
||||
if (!list || !newWidget) {
|
||||
blog(LOG_WARNING,
|
||||
"listAddClicked called without valid list or widget");
|
||||
return;
|
||||
}
|
||||
|
||||
if (addButton && addHighlight)
|
||||
addButton->disconnect(*addHighlight);
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(list);
|
||||
list->addItem(item);
|
||||
item->setSizeHint(newWidget->minimumSizeHint());
|
||||
list->setItemWidget(item, newWidget);
|
||||
|
||||
list->scrollToItem(item);
|
||||
}
|
||||
|
||||
bool AdvSceneSwitcher::listMoveUp(QListWidget *list)
|
||||
{
|
||||
int index = list->currentRow();
|
||||
@@ -328,34 +394,52 @@ void SwitcherData::Thread()
|
||||
{
|
||||
blog(LOG_INFO, "started");
|
||||
int sleep = 0;
|
||||
std::chrono::milliseconds duration;
|
||||
auto startTime = std::chrono::high_resolution_clock::now();
|
||||
auto endTime = std::chrono::high_resolution_clock::now();
|
||||
|
||||
while (true) {
|
||||
startLoop:
|
||||
std::unique_lock<std::mutex> lock(m);
|
||||
|
||||
bool match = false;
|
||||
OBSWeakSource scene;
|
||||
OBSWeakSource transition;
|
||||
std::chrono::milliseconds duration;
|
||||
if (sleep > interval) {
|
||||
|
||||
bool defTransitionMatch = false;
|
||||
OBSWeakSource defTransition;
|
||||
|
||||
endTime = std::chrono::high_resolution_clock::now();
|
||||
|
||||
auto runTime =
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
endTime - startTime);
|
||||
|
||||
if (sleep) {
|
||||
duration = std::chrono::milliseconds(sleep);
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "sleep for %d", sleep);
|
||||
} else {
|
||||
duration = std::chrono::milliseconds(interval);
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "sleep for %d", interval);
|
||||
duration =
|
||||
std::chrono::milliseconds(interval) - runTime;
|
||||
if (duration.count() < 1) {
|
||||
blog(LOG_INFO,
|
||||
"detected busy loop - refusing to sleep less than 1ms");
|
||||
duration = std::chrono::milliseconds(50);
|
||||
}
|
||||
}
|
||||
sleep = 0;
|
||||
switcher->Prune();
|
||||
writeSceneInfoToFile();
|
||||
|
||||
//sleep for a bit
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "sleep for %ld", duration.count());
|
||||
cv.wait_for(lock, duration);
|
||||
|
||||
startTime = std::chrono::high_resolution_clock::now();
|
||||
sleep = 0;
|
||||
|
||||
switcher->Prune();
|
||||
|
||||
if (switcher->stop) {
|
||||
break;
|
||||
}
|
||||
|
||||
setDefaultSceneTransitions();
|
||||
|
||||
if (autoStopEnable) {
|
||||
autoStopStreamAndRecording();
|
||||
}
|
||||
@@ -368,6 +452,8 @@ void SwitcherData::Thread()
|
||||
continue;
|
||||
}
|
||||
|
||||
checkDefaultSceneTransitions(defTransitionMatch, defTransition);
|
||||
|
||||
for (int switchFuncName : functionNamesByPriority) {
|
||||
switch (switchFuncName) {
|
||||
case read_file_func:
|
||||
@@ -381,7 +467,6 @@ void SwitcherData::Thread()
|
||||
case exe_func:
|
||||
checkExeSwitch(match, scene, transition);
|
||||
break;
|
||||
|
||||
case screen_region_func:
|
||||
checkScreenRegionSwitch(match, scene,
|
||||
transition);
|
||||
@@ -393,10 +478,6 @@ void SwitcherData::Thread()
|
||||
case round_trip_func:
|
||||
checkSceneSequence(match, scene, transition,
|
||||
lock);
|
||||
if (sceneChangedDuringWait()) //scene might have changed during the sleep
|
||||
{
|
||||
goto startLoop;
|
||||
}
|
||||
break;
|
||||
case media_func:
|
||||
checkMediaSwitch(match, scene, transition);
|
||||
@@ -417,44 +498,46 @@ void SwitcherData::Thread()
|
||||
}
|
||||
}
|
||||
|
||||
if (!match && switchIfNotMatching == SWITCH &&
|
||||
nonMatchingScene) {
|
||||
match = true;
|
||||
scene = nonMatchingScene;
|
||||
transition = nullptr;
|
||||
}
|
||||
if (!match && switchIfNotMatching == RANDOM_SWITCH) {
|
||||
checkRandom(match, scene, transition, sleep);
|
||||
checkNoMatchSwitch(match, scene, transition, sleep);
|
||||
|
||||
checkSwitchCooldown(match);
|
||||
|
||||
// After this point we will call frontend functions
|
||||
// obs_frontend_set_current_scene() and
|
||||
// obs_frontend_set_current_transition()
|
||||
//
|
||||
// During this time SaveSceneSwitcher() could be called
|
||||
// leading to a deadlock, so we have to unlock()
|
||||
lock.unlock();
|
||||
|
||||
if (!match && defTransitionMatch) {
|
||||
setCurrentDefTransition(defTransition);
|
||||
}
|
||||
|
||||
if (match) {
|
||||
switchScene(scene, transition,
|
||||
tansitionOverrideOverride, lock);
|
||||
tansitionOverrideOverride);
|
||||
}
|
||||
|
||||
writeSceneInfoToFile();
|
||||
}
|
||||
endLoop:
|
||||
blog(LOG_INFO, "stopped");
|
||||
}
|
||||
|
||||
void switchScene(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||
bool &transitionOverrideOverride,
|
||||
std::unique_lock<std::mutex> &lock)
|
||||
bool &transitionOverrideOverride)
|
||||
{
|
||||
obs_source_t *source = obs_weak_source_get_source(scene);
|
||||
obs_source_t *currentSource = obs_frontend_get_current_scene();
|
||||
|
||||
if (source && source != currentSource) {
|
||||
|
||||
// this call might block when OBS_FRONTEND_EVENT_SCENE_CHANGED is active and mutex is held
|
||||
// thus unlock mutex to avoid deadlock
|
||||
lock.unlock();
|
||||
|
||||
transitionData td;
|
||||
setNextTransition(scene, currentSource, transition,
|
||||
transitionOverrideOverride, td);
|
||||
obs_frontend_set_current_scene(source);
|
||||
if (transitionOverrideOverride)
|
||||
restoreTransitionOverride(source, td);
|
||||
lock.lock();
|
||||
|
||||
if (switcher->verbose)
|
||||
blog(LOG_INFO, "switched scene");
|
||||
@@ -463,18 +546,6 @@ void switchScene(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||
obs_source_release(source);
|
||||
}
|
||||
|
||||
bool SwitcherData::sceneChangedDuringWait()
|
||||
{
|
||||
bool r = false;
|
||||
obs_source_t *currentSource = obs_frontend_get_current_scene();
|
||||
if (!currentSource)
|
||||
return true;
|
||||
obs_source_release(currentSource);
|
||||
if (waitScene && currentSource != waitScene)
|
||||
r = true;
|
||||
return r;
|
||||
}
|
||||
|
||||
void SwitcherData::Start()
|
||||
{
|
||||
if (!(th && th->isRunning())) {
|
||||
@@ -482,6 +553,9 @@ void SwitcherData::Start()
|
||||
switcher->th = new SwitcherThread();
|
||||
switcher->th->start(
|
||||
(QThread::Priority)switcher->threadPriority);
|
||||
|
||||
// Will be overwritten quickly but might be useful
|
||||
writeToStatusFile("Advanced Scene Switcher running");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,9 +568,20 @@ void SwitcherData::Stop()
|
||||
th->wait();
|
||||
delete th;
|
||||
th = nullptr;
|
||||
|
||||
writeToStatusFile("Advanced Scene Switcher stopped");
|
||||
}
|
||||
}
|
||||
|
||||
bool SwitcherData::sceneChangedDuringWait()
|
||||
{
|
||||
obs_source_t *currentSource = obs_frontend_get_current_scene();
|
||||
if (!currentSource)
|
||||
return true;
|
||||
obs_source_release(currentSource);
|
||||
return (waitScene && currentSource != waitScene);
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* OBS module setup
|
||||
********************************************************************************/
|
||||
@@ -515,7 +600,6 @@ extern "C" void FreeSceneSwitcher()
|
||||
|
||||
void handleSceneChange(SwitcherData *s)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s->m);
|
||||
//stop waiting if scene was manually changed
|
||||
if (s->sceneChangedDuringWait())
|
||||
s->cv.notify_one();
|
||||
@@ -525,14 +609,18 @@ void handleSceneChange(SwitcherData *s)
|
||||
obs_weak_source_t *ws = obs_source_get_weak_source(source);
|
||||
obs_source_release(source);
|
||||
obs_weak_source_release(ws);
|
||||
if (source && s->PreviousScene2 != ws) {
|
||||
s->previousScene = s->PreviousScene2;
|
||||
s->PreviousScene2 = ws;
|
||||
if (source && s->previousScene2 != ws) {
|
||||
s->previousScene = s->previousScene2;
|
||||
s->previousScene2 = ws;
|
||||
}
|
||||
|
||||
//reset events only hanled on scene change
|
||||
s->autoStartedRecently = false;
|
||||
s->changedDefTransitionRecently = false;
|
||||
}
|
||||
|
||||
void handleTransitionStop(SwitcherData *s)
|
||||
{
|
||||
s->checkedDefTransition = false;
|
||||
}
|
||||
|
||||
void setLiveTime(SwitcherData *s)
|
||||
@@ -545,6 +633,9 @@ void resetLiveTime(SwitcherData *s)
|
||||
s->liveTime = QDateTime();
|
||||
}
|
||||
|
||||
// Note to future self:
|
||||
// be careful using switcher->m here as there is potential for deadlocks when using
|
||||
// frontend functions such as obs_frontend_set_current_scene()
|
||||
static void OBSEvent(enum obs_frontend_event event, void *switcher)
|
||||
{
|
||||
switch (event) {
|
||||
@@ -554,6 +645,9 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher)
|
||||
case OBS_FRONTEND_EVENT_SCENE_CHANGED:
|
||||
handleSceneChange((SwitcherData *)switcher);
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_TRANSITION_STOPPED:
|
||||
handleTransitionStop((SwitcherData *)switcher);
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_RECORDING_STARTED:
|
||||
case OBS_FRONTEND_EVENT_STREAMING_STARTED:
|
||||
setLiveTime((SwitcherData *)switcher);
|
||||
@@ -569,8 +663,10 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher)
|
||||
|
||||
extern "C" void InitSceneSwitcher()
|
||||
{
|
||||
blog(LOG_INFO, "version: %s", g_GIT_SHA1);
|
||||
|
||||
QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction(
|
||||
"Advanced Scene Switcher");
|
||||
obs_module_text("AdvSceneSwitcher.pluginName"));
|
||||
|
||||
switcher = new SwitcherData;
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ bool loadCurl()
|
||||
#endif
|
||||
|
||||
for (QString path : locations) {
|
||||
blog(LOG_INFO, "[adv-ss] trying '%s'", path.toUtf8().constData());
|
||||
blog(LOG_INFO, "[adv-ss] trying '%s'",
|
||||
path.toUtf8().constData());
|
||||
QFileInfo libPath(
|
||||
QDir(path).absoluteFilePath(curl_library_name));
|
||||
|
||||
|
||||
237
src/general.cpp
237
src/general.cpp
@@ -1,5 +1,4 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
@@ -56,6 +55,14 @@ void AdvSceneSwitcher::on_noMatchRandomSwitch_clicked()
|
||||
ui->randomDisabledWarning->setVisible(false);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_noMatchDelay_valueChanged(double i)
|
||||
{
|
||||
if (loading)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->noMatchDelay = i;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_startupBehavior_currentIndexChanged(int index)
|
||||
{
|
||||
if (loading)
|
||||
@@ -75,6 +82,14 @@ void AdvSceneSwitcher::on_noMatchSwitchScene_currentTextChanged(
|
||||
UpdateNonMatchingScene(text);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_cooldownTime_valueChanged(double i)
|
||||
{
|
||||
if (loading)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->cooldown = i;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_checkInterval_valueChanged(int value)
|
||||
{
|
||||
if (loading)
|
||||
@@ -86,15 +101,19 @@ void AdvSceneSwitcher::on_checkInterval_valueChanged(int value)
|
||||
|
||||
void AdvSceneSwitcher::SetStarted()
|
||||
{
|
||||
ui->toggleStartButton->setText("Stop");
|
||||
ui->pluginRunningText->setText("Active");
|
||||
ui->toggleStartButton->setText(
|
||||
obs_module_text("AdvSceneSwitcher.generalTab.status.stop"));
|
||||
ui->pluginRunningText->setText(
|
||||
obs_module_text("AdvSceneSwitcher.status.active"));
|
||||
ui->pluginRunningText->disconnect(inactivePluse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::SetStopped()
|
||||
{
|
||||
ui->toggleStartButton->setText("Start");
|
||||
ui->pluginRunningText->setText("Inactive");
|
||||
ui->toggleStartButton->setText(
|
||||
obs_module_text("AdvSceneSwitcher.generalTab.status.start"));
|
||||
ui->pluginRunningText->setText(
|
||||
obs_module_text("AdvSceneSwitcher.status.inactive"));
|
||||
inactivePluse = PulseWidget(ui->pluginRunningText, QColor(Qt::red),
|
||||
QColor(0, 0, 0, 0), "QLabel ");
|
||||
}
|
||||
@@ -158,10 +177,18 @@ void SwitcherData::autoStopStreamAndRecording()
|
||||
obs_weak_source_t *ws = obs_source_get_weak_source(currentSource);
|
||||
|
||||
if (ws && autoStopScene == ws) {
|
||||
if (obs_frontend_streaming_active())
|
||||
if (obs_frontend_streaming_active()) {
|
||||
blog(LOG_INFO,
|
||||
"Stopping stream because scene '%s' is active",
|
||||
obs_source_get_name(currentSource));
|
||||
obs_frontend_streaming_stop();
|
||||
if (obs_frontend_recording_active())
|
||||
}
|
||||
if (obs_frontend_recording_active()) {
|
||||
blog(LOG_INFO,
|
||||
"Stopping record because scene '%s' is active",
|
||||
obs_source_get_name(currentSource));
|
||||
obs_frontend_recording_stop();
|
||||
}
|
||||
}
|
||||
obs_source_release(currentSource);
|
||||
obs_weak_source_release(ws);
|
||||
@@ -226,12 +253,20 @@ void SwitcherData::autoStartStreamRecording()
|
||||
if (ws && autoStartScene == ws) {
|
||||
if ((switcher->autoStartType == STREAMING ||
|
||||
switcher->autoStartType == RECORINDGSTREAMING) &&
|
||||
!obs_frontend_streaming_active())
|
||||
!obs_frontend_streaming_active()) {
|
||||
blog(LOG_INFO,
|
||||
"Starting stream because scene '%s' is active",
|
||||
obs_source_get_name(currentSource));
|
||||
obs_frontend_streaming_start();
|
||||
}
|
||||
if ((switcher->autoStartType == RECORDING ||
|
||||
switcher->autoStartType == RECORINDGSTREAMING) &&
|
||||
!obs_frontend_recording_active())
|
||||
!obs_frontend_recording_active()) {
|
||||
blog(LOG_INFO,
|
||||
"Starting record because scene '%s' is active",
|
||||
obs_source_get_name(currentSource));
|
||||
obs_frontend_recording_start();
|
||||
}
|
||||
}
|
||||
obs_source_release(currentSource);
|
||||
obs_weak_source_release(ws);
|
||||
@@ -256,8 +291,12 @@ void AdvSceneSwitcher::on_uiHintsDisable_stateChanged(int state)
|
||||
void AdvSceneSwitcher::on_exportSettings_clicked()
|
||||
{
|
||||
QString directory = QFileDialog::getSaveFileName(
|
||||
this, tr("Export Advanced Scene Switcher settings to file ..."),
|
||||
QDir::currentPath(), tr("Text files (*.txt)"));
|
||||
this,
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.importWindowTitle")),
|
||||
QDir::currentPath(),
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.textType")));
|
||||
if (directory.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -293,8 +332,11 @@ void AdvSceneSwitcher::on_importSettings_clicked()
|
||||
|
||||
QString directory = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Import Advanced Scene Switcher settings from file ..."),
|
||||
QDir::currentPath(), tr("Text files (*.txt)"));
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.importWindowTitle")),
|
||||
QDir::currentPath(),
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.textType")));
|
||||
if (directory.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -306,10 +348,8 @@ void AdvSceneSwitcher::on_importSettings_clicked()
|
||||
file.fileName().toUtf8().constData());
|
||||
|
||||
if (!obj) {
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(
|
||||
"Advanced Scene Switcher failed to import settings");
|
||||
Msgbox.exec();
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadFail"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -330,65 +370,61 @@ void AdvSceneSwitcher::on_importSettings_clicked()
|
||||
|
||||
obs_data_release(obj);
|
||||
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(
|
||||
"Advanced Scene Switcher settings imported successfully");
|
||||
Msgbox.exec();
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadSuccess"));
|
||||
close();
|
||||
}
|
||||
|
||||
int findTabIndex(QTabBar *bar, int pos)
|
||||
int findTabIndex(QTabWidget *tabWidget, int pos)
|
||||
{
|
||||
int at = -1;
|
||||
|
||||
QString tabName = "";
|
||||
switch (pos) {
|
||||
case 0:
|
||||
tabName = "General";
|
||||
tabName = "generalTab";
|
||||
break;
|
||||
case 1:
|
||||
tabName = "Transition";
|
||||
tabName = "transitionsTab";
|
||||
break;
|
||||
case 2:
|
||||
tabName = "Pause";
|
||||
tabName = "pauseTab";
|
||||
break;
|
||||
case 3:
|
||||
tabName = "Title";
|
||||
tabName = "windowTitleTab";
|
||||
break;
|
||||
case 4:
|
||||
tabName = "Executable";
|
||||
tabName = "executableTab";
|
||||
break;
|
||||
case 5:
|
||||
tabName = "Region";
|
||||
tabName = "screenRegionTab";
|
||||
break;
|
||||
case 6:
|
||||
tabName = "Media";
|
||||
tabName = "mediaTab";
|
||||
break;
|
||||
case 7:
|
||||
tabName = "File";
|
||||
tabName = "fileTab";
|
||||
break;
|
||||
case 8:
|
||||
tabName = "Random";
|
||||
tabName = "randomTab";
|
||||
break;
|
||||
case 9:
|
||||
tabName = "Time";
|
||||
tabName = "timeTab";
|
||||
break;
|
||||
case 10:
|
||||
tabName = "Idle";
|
||||
tabName = "idleTab";
|
||||
break;
|
||||
case 11:
|
||||
tabName = "Sequence";
|
||||
tabName = "sceneSequenceTab";
|
||||
break;
|
||||
case 12:
|
||||
tabName = "Audio";
|
||||
tabName = "audioTab";
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < bar->count(); ++i) {
|
||||
if (bar->tabText(i).compare(tabName) == 0) {
|
||||
at = i;
|
||||
break;
|
||||
}
|
||||
QWidget *page = tabWidget->findChild<QWidget *>(tabName);
|
||||
if (page) {
|
||||
at = tabWidget->indexOf(page);
|
||||
}
|
||||
if (at == -1)
|
||||
blog(LOG_INFO, "failed to find tab %s",
|
||||
@@ -401,7 +437,7 @@ void AdvSceneSwitcher::setTabOrder()
|
||||
{
|
||||
QTabBar *bar = ui->tabWidget->tabBar();
|
||||
for (int i = 0; i < bar->count(); ++i) {
|
||||
int curPos = findTabIndex(bar, switcher->tabOrder[i]);
|
||||
int curPos = findTabIndex(ui->tabWidget, switcher->tabOrder[i]);
|
||||
|
||||
if (i != curPos && curPos != -1)
|
||||
bar->moveTab(curPos, i);
|
||||
@@ -417,6 +453,15 @@ void AdvSceneSwitcher::on_tabMoved(int from, int to)
|
||||
std::swap(switcher->tabOrder[from], switcher->tabOrder[to]);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_tabWidget_currentChanged(int index)
|
||||
{
|
||||
UNUSED_PARAMETER(index);
|
||||
|
||||
switcher->showFrame = false;
|
||||
clearFrames(ui->screenRegionSwitches);
|
||||
SetShowFrames();
|
||||
}
|
||||
|
||||
void SwitcherData::saveGeneralSettings(obs_data_t *obj)
|
||||
{
|
||||
obs_data_set_int(obj, "interval", switcher->interval);
|
||||
@@ -427,6 +472,9 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
|
||||
nonMatchingSceneName.c_str());
|
||||
obs_data_set_int(obj, "switch_if_not_matching",
|
||||
switcher->switchIfNotMatching);
|
||||
obs_data_set_double(obj, "noMatchDelay", switcher->noMatchDelay);
|
||||
|
||||
obs_data_set_double(obj, "cooldown", switcher->cooldown);
|
||||
|
||||
obs_data_set_bool(obj, "active", !switcher->stop);
|
||||
obs_data_set_int(obj, "startup_behavior", switcher->startupBehavior);
|
||||
@@ -468,6 +516,14 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
|
||||
|
||||
obs_data_set_int(obj, "threadPriority", switcher->threadPriority);
|
||||
|
||||
// After fresh install of OBS the vector can be empty
|
||||
// as save() might be called before first load()
|
||||
if (switcher->tabOrder.size() < 13) {
|
||||
switcher->tabOrder = std::vector<int>(13);
|
||||
std::iota(switcher->tabOrder.begin(), switcher->tabOrder.end(),
|
||||
0);
|
||||
}
|
||||
|
||||
obs_data_set_int(obj, "generalTabPos", switcher->tabOrder[0]);
|
||||
obs_data_set_int(obj, "transitionTabPos", switcher->tabOrder[1]);
|
||||
obs_data_set_int(obj, "pauseTabPos", switcher->tabOrder[2]);
|
||||
@@ -495,6 +551,9 @@ void SwitcherData::loadGeneralSettings(obs_data_t *obj)
|
||||
obs_data_get_string(obj, "non_matching_scene");
|
||||
switcher->nonMatchingScene =
|
||||
GetWeakSourceByName(nonMatchingScene.c_str());
|
||||
switcher->noMatchDelay = obs_data_get_double(obj, "noMatchDelay");
|
||||
|
||||
switcher->cooldown = obs_data_get_double(obj, "cooldown");
|
||||
|
||||
switcher->stop = !obs_data_get_bool(obj, "active");
|
||||
switcher->startupBehavior =
|
||||
@@ -605,6 +664,49 @@ void SwitcherData::loadGeneralSettings(obs_data_t *obj)
|
||||
(int)(obs_data_get_int(obj, "audioTabPos")));
|
||||
}
|
||||
|
||||
void SwitcherData::checkNoMatchSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition, int &sleep)
|
||||
{
|
||||
if (match) {
|
||||
noMatchCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((noMatchCount * interval) / 1000.0 < noMatchDelay) {
|
||||
noMatchCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
if (switchIfNotMatching == SWITCH && nonMatchingScene) {
|
||||
match = true;
|
||||
scene = nonMatchingScene;
|
||||
transition = nullptr;
|
||||
}
|
||||
if (switchIfNotMatching == RANDOM_SWITCH) {
|
||||
checkRandom(match, scene, transition, sleep);
|
||||
}
|
||||
}
|
||||
|
||||
void SwitcherData::checkSwitchCooldown(bool &match)
|
||||
{
|
||||
if (!match || cooldown == 0.) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto now = std::chrono::high_resolution_clock::now();
|
||||
auto timePassed = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
now - lastMatchTime);
|
||||
|
||||
if (timePassed.count() > cooldown * 1000) {
|
||||
lastMatchTime = now;
|
||||
return;
|
||||
}
|
||||
|
||||
match = false;
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "cooldown active - ignoring match");
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::setupGeneralTab()
|
||||
{
|
||||
populateSceneSelection(ui->noMatchSwitchScene, false);
|
||||
@@ -623,8 +725,15 @@ void AdvSceneSwitcher::setupGeneralTab()
|
||||
}
|
||||
ui->noMatchSwitchScene->setCurrentText(
|
||||
GetWeakSourceName(switcher->nonMatchingScene).c_str());
|
||||
ui->noMatchDelay->setValue(switcher->noMatchDelay);
|
||||
ui->noMatchDelay->setToolTip(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.onNoMetDelayTooltip"));
|
||||
ui->checkInterval->setValue(switcher->interval);
|
||||
|
||||
ui->cooldownTime->setValue(switcher->cooldown);
|
||||
ui->cooldownTime->setToolTip(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.cooldownHint"));
|
||||
|
||||
ui->autoStopSceneCheckBox->setChecked(switcher->autoStopEnable);
|
||||
ui->autoStopScenes->setCurrentText(
|
||||
GetWeakSourceName(switcher->autoStopScene).c_str());
|
||||
@@ -635,9 +744,12 @@ void AdvSceneSwitcher::setupGeneralTab()
|
||||
ui->autoStopScenes->setDisabled(true);
|
||||
}
|
||||
|
||||
ui->autoStartType->addItem("Recording");
|
||||
ui->autoStartType->addItem("Streaming");
|
||||
ui->autoStartType->addItem("Recording and Streaming");
|
||||
ui->autoStartType->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recording"));
|
||||
ui->autoStartType->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.streaming"));
|
||||
ui->autoStartType->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.generalBehavior.automaticallyStart.recordingAndStreaming"));
|
||||
|
||||
ui->autoStartSceneCheckBox->setChecked(switcher->autoStartEnable);
|
||||
ui->autoStartScenes->setCurrentText(
|
||||
@@ -659,31 +771,40 @@ void AdvSceneSwitcher::setupGeneralTab()
|
||||
std::string s = "";
|
||||
switch (p) {
|
||||
case read_file_func:
|
||||
s = "File Content";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.fileContent");
|
||||
break;
|
||||
case round_trip_func:
|
||||
s = "Scene Sequence";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.sceneSequence");
|
||||
break;
|
||||
case idle_func:
|
||||
s = "Idle Detection";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.idleDetection");
|
||||
break;
|
||||
case exe_func:
|
||||
s = "Executable";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.executable");
|
||||
break;
|
||||
case screen_region_func:
|
||||
s = "Screen Region";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.screenRegion");
|
||||
break;
|
||||
case window_title_func:
|
||||
s = "Window Title";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.windowTitle");
|
||||
break;
|
||||
case media_func:
|
||||
s = "Media";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.media");
|
||||
break;
|
||||
case time_func:
|
||||
s = "Time";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.time");
|
||||
break;
|
||||
case audio_func:
|
||||
s = "Audio";
|
||||
s = obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.priority.audio");
|
||||
break;
|
||||
}
|
||||
QString text(s.c_str());
|
||||
@@ -705,10 +826,12 @@ void AdvSceneSwitcher::setupGeneralTab()
|
||||
}
|
||||
}
|
||||
|
||||
ui->startupBehavior->addItem(
|
||||
"Start the scene switcher if it was running");
|
||||
ui->startupBehavior->addItem("Always start the scene switcher");
|
||||
ui->startupBehavior->addItem("Do not start the scene switcher");
|
||||
ui->startupBehavior->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.status.onStartup.asLastRun"));
|
||||
ui->startupBehavior->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.status.onStartup.alwaysStart"));
|
||||
ui->startupBehavior->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.status.onStartup.doNotStart"));
|
||||
|
||||
ui->startupBehavior->setCurrentIndex(switcher->startupBehavior);
|
||||
|
||||
|
||||
@@ -27,8 +27,10 @@ public:
|
||||
void SetStarted();
|
||||
void SetStopped();
|
||||
|
||||
int PauseScenesFindByData(const QString &scene);
|
||||
int PauseWindowsFindByData(const QString &window);
|
||||
void SetShowFrames();
|
||||
void SetHideFrames();
|
||||
void clearFrames(QListWidget *list);
|
||||
|
||||
int IgnoreWindowsFindByData(const QString &window);
|
||||
int IgnoreIdleWindowsFindByData(const QString &window);
|
||||
|
||||
@@ -54,6 +56,7 @@ public:
|
||||
void setupAudioTab();
|
||||
void setTabOrder();
|
||||
|
||||
void DisplayMessage(QString msg);
|
||||
static void populateSceneSelection(QComboBox *sel,
|
||||
bool addPrevious = false,
|
||||
bool addSelect = true);
|
||||
@@ -71,6 +74,9 @@ public:
|
||||
QColor = QColor(0, 0, 0, 0),
|
||||
QString specifier = "QLabel ");
|
||||
|
||||
void listAddClicked(QListWidget *list, SwitchWidget *newWidget,
|
||||
QPushButton *addButton = nullptr,
|
||||
QMetaObject::Connection *addHighlight = nullptr);
|
||||
bool listMoveUp(QListWidget *list);
|
||||
bool listMoveDown(QListWidget *list);
|
||||
|
||||
@@ -82,11 +88,14 @@ public slots:
|
||||
void on_noMatchDontSwitch_clicked();
|
||||
void on_noMatchSwitch_clicked();
|
||||
void on_noMatchRandomSwitch_clicked();
|
||||
void on_noMatchDelay_valueChanged(double i);
|
||||
void on_cooldownTime_valueChanged(double i);
|
||||
void on_startupBehavior_currentIndexChanged(int index);
|
||||
void on_noMatchSwitchScene_currentTextChanged(const QString &text);
|
||||
void on_checkInterval_valueChanged(int value);
|
||||
void on_toggleStartButton_clicked();
|
||||
void on_tabMoved(int from, int to);
|
||||
void on_tabWidget_currentChanged(int index);
|
||||
|
||||
void on_screenRegionSwitches_currentRowChanged(int idx);
|
||||
void on_showFrame_clicked();
|
||||
@@ -95,13 +104,10 @@ public slots:
|
||||
void on_screenRegionUp_clicked();
|
||||
void on_screenRegionDown_clicked();
|
||||
|
||||
void on_pauseScenes_currentRowChanged(int idx);
|
||||
void on_pauseScenesAdd_clicked();
|
||||
void on_pauseScenesRemove_clicked();
|
||||
|
||||
void on_pauseWindows_currentRowChanged(int idx);
|
||||
void on_pauseWindowsAdd_clicked();
|
||||
void on_pauseWindowsRemove_clicked();
|
||||
void on_pauseUp_clicked();
|
||||
void on_pauseDown_clicked();
|
||||
void on_pauseAdd_clicked();
|
||||
void on_pauseRemove_clicked();
|
||||
|
||||
void on_ignoreWindows_currentRowChanged(int idx);
|
||||
void on_ignoreWindowsAdd_clicked();
|
||||
@@ -139,7 +145,6 @@ public slots:
|
||||
|
||||
void on_browseButton_clicked();
|
||||
void on_readFileCheckBox_stateChanged(int state);
|
||||
void on_fileType_currentIndexChanged(int idx);
|
||||
void on_readPathLineEdit_textChanged(const QString &text);
|
||||
void on_writePathLineEdit_textChanged(const QString &text);
|
||||
void on_browseButton_2_clicked();
|
||||
@@ -162,8 +167,7 @@ public slots:
|
||||
|
||||
void on_fileAdd_clicked();
|
||||
void on_fileRemove_clicked();
|
||||
void on_fileScenesList_currentRowChanged(int idx);
|
||||
void on_browseButton_3_clicked();
|
||||
void on_fileSwitches_currentRowChanged(int idx);
|
||||
void on_fileUp_clicked();
|
||||
void on_fileDown_clicked();
|
||||
|
||||
@@ -181,6 +185,7 @@ public slots:
|
||||
void on_audioRemove_clicked();
|
||||
void on_audioUp_clicked();
|
||||
void on_audioDown_clicked();
|
||||
void on_audioFallback_toggled(bool on);
|
||||
|
||||
void on_priorityUp_clicked();
|
||||
void on_priorityDown_clicked();
|
||||
@@ -228,10 +233,8 @@ void setNextTransition(OBSWeakSource &targetScene, obs_source_t *currentSource,
|
||||
void overwriteTransitionOverride(obs_weak_source_t *sceneWs,
|
||||
obs_source_t *transition, transitionData &td);
|
||||
void restoreTransitionOverride(obs_source_t *scene, transitionData td);
|
||||
|
||||
void switchScene(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||
bool &transitionOverrideOverride,
|
||||
std::unique_lock<std::mutex> &lock);
|
||||
bool &transitionOverrideOverride);
|
||||
|
||||
/********************************************************************************
|
||||
* Main SwitcherData
|
||||
|
||||
@@ -7,9 +7,18 @@
|
||||
constexpr auto audio_func = 8;
|
||||
constexpr auto default_priority_8 = audio_func;
|
||||
|
||||
typedef enum {
|
||||
ABOVE,
|
||||
BELOW,
|
||||
} audioCondition;
|
||||
|
||||
struct AudioSwitch : virtual SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
OBSWeakSource audioSource = nullptr;
|
||||
int volumeThreshold = 0;
|
||||
audioCondition condition = ABOVE;
|
||||
double duration = 0;
|
||||
unsigned int matchCount = 0;
|
||||
float peak = -1;
|
||||
obs_volmeter_t *volmeter = nullptr;
|
||||
|
||||
@@ -25,6 +34,7 @@ struct AudioSwitch : virtual SceneSwitcherEntry {
|
||||
AudioSwitch(){};
|
||||
AudioSwitch(OBSWeakSource scene_, OBSWeakSource transition_,
|
||||
OBSWeakSource audioSource_, int volumeThreshold_,
|
||||
audioCondition condition_, double duration_,
|
||||
bool usePreviousScene_);
|
||||
AudioSwitch(const AudioSwitch &other);
|
||||
AudioSwitch(AudioSwitch &&other);
|
||||
@@ -34,6 +44,13 @@ struct AudioSwitch : virtual SceneSwitcherEntry {
|
||||
friend void swap(AudioSwitch &first, AudioSwitch &second);
|
||||
};
|
||||
|
||||
struct AudioSwitchFallback : virtual SceneSwitcherEntry {
|
||||
const char *getType() { return "audio_fallback"; }
|
||||
bool enable = false;
|
||||
double duration = 0;
|
||||
unsigned int matchCount = 0;
|
||||
};
|
||||
|
||||
class AudioSwitchWidget : public SwitchWidget {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -49,17 +66,30 @@ public:
|
||||
private slots:
|
||||
void SourceChanged(const QString &text);
|
||||
void VolumeThresholdChanged(int vol);
|
||||
void ConditionChanged(int cond);
|
||||
void DurationChanged(double dur);
|
||||
|
||||
private:
|
||||
QComboBox *audioSources;
|
||||
QComboBox *condition;
|
||||
QSpinBox *audioVolumeThreshold;
|
||||
|
||||
QDoubleSpinBox *duration;
|
||||
VolControl *volMeter;
|
||||
|
||||
QLabel *whenLabel;
|
||||
QLabel *aboveLabel;
|
||||
QLabel *switchLabel;
|
||||
QLabel *usingLabel;
|
||||
|
||||
AudioSwitch *switchData;
|
||||
};
|
||||
|
||||
class AudioSwitchFallbackWidget : public SwitchWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AudioSwitchFallbackWidget(AudioSwitchFallback *s);
|
||||
|
||||
private slots:
|
||||
void DurationChanged(double dur);
|
||||
|
||||
private:
|
||||
QDoubleSpinBox *duration;
|
||||
|
||||
AudioSwitchFallback *switchData;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ constexpr auto exe_func = 3;
|
||||
constexpr auto default_priority_3 = exe_func;
|
||||
|
||||
struct ExecutableSwitch : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
QString exe = "";
|
||||
bool inFocus = false;
|
||||
|
||||
@@ -40,9 +41,5 @@ private:
|
||||
QComboBox *processes;
|
||||
QCheckBox *requiresFocus;
|
||||
|
||||
QLabel *whenLabel;
|
||||
QLabel *switchLabel;
|
||||
QLabel *usingLabel;
|
||||
|
||||
ExecutableSwitch *switchData;
|
||||
};
|
||||
|
||||
@@ -1,33 +1,78 @@
|
||||
#pragma once
|
||||
#include "switch-generic.hpp"
|
||||
#include <QPlainTextEdit>
|
||||
#include <obs-module.h>
|
||||
|
||||
constexpr auto read_file_func = 0;
|
||||
constexpr auto default_priority_0 = read_file_func;
|
||||
|
||||
typedef enum {
|
||||
LOCAL,
|
||||
REMOTE,
|
||||
} file_type;
|
||||
|
||||
struct FileSwitch : SceneSwitcherEntry {
|
||||
std::string file;
|
||||
std::string text;
|
||||
static bool pause;
|
||||
std::string file = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||
std::string text = obs_module_text("AdvSceneSwitcher.enterText");
|
||||
bool remote = false;
|
||||
bool useRegex = false;
|
||||
bool useTime = false;
|
||||
bool onlyMatchIfChanged = false;
|
||||
QDateTime lastMod;
|
||||
size_t lastHash = 0;
|
||||
|
||||
const char *getType() { return "file"; }
|
||||
|
||||
inline FileSwitch(){};
|
||||
inline FileSwitch(OBSWeakSource scene_, OBSWeakSource transition_,
|
||||
const char *file_, const char *text_, bool remote_,
|
||||
bool useRegex_, bool useTime_)
|
||||
bool useRegex_, bool useTime_,
|
||||
bool onlyMatchIfChanged_)
|
||||
: SceneSwitcherEntry(scene_, transition_),
|
||||
file(file_),
|
||||
text(text_),
|
||||
remote(remote_),
|
||||
useRegex(useRegex_),
|
||||
useTime(useTime_),
|
||||
onlyMatchIfChanged(onlyMatchIfChanged_),
|
||||
lastMod()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class FileSwitchWidget : public SwitchWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileSwitchWidget(FileSwitch *s);
|
||||
FileSwitch *getSwitchData();
|
||||
void setSwitchData(FileSwitch *s);
|
||||
|
||||
static void swapSwitchData(FileSwitchWidget *as1,
|
||||
FileSwitchWidget *as2);
|
||||
|
||||
private slots:
|
||||
void FileTypeChanged(int index);
|
||||
void FilePathChanged();
|
||||
void MatchTextChanged();
|
||||
void UseRegexChanged(int state);
|
||||
void CheckModificationDateChanged(int state);
|
||||
void CheckFileContentChanged(int state);
|
||||
void BrowseButtonClicked();
|
||||
|
||||
private:
|
||||
QComboBox *fileType;
|
||||
QLineEdit *filePath;
|
||||
QPushButton *browseButton;
|
||||
QPlainTextEdit *matchText;
|
||||
QCheckBox *useRegex;
|
||||
QCheckBox *checkModificationDate;
|
||||
QCheckBox *checkFileContent;
|
||||
|
||||
FileSwitch *switchData;
|
||||
};
|
||||
|
||||
struct FileIOData {
|
||||
bool readEnabled = false;
|
||||
std::string readPath;
|
||||
@@ -39,4 +84,4 @@ static inline QString MakeFileSwitchName(const QString &scene,
|
||||
const QString &transition,
|
||||
const QString &fileName,
|
||||
const QString &text, bool useRegex,
|
||||
bool useTime);
|
||||
bool useTime, bool onlyMatchIfChanged);
|
||||
|
||||
@@ -6,6 +6,7 @@ constexpr auto idle_func = 2;
|
||||
constexpr auto default_priority_2 = idle_func;
|
||||
|
||||
struct IdleData : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
bool idleEnable = false;
|
||||
int time = default_idle_time;
|
||||
bool alreadySwitched = false;
|
||||
|
||||
@@ -13,17 +13,24 @@ typedef enum {
|
||||
} time_restriction;
|
||||
|
||||
struct MediaSwitch : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
OBSWeakSource source = nullptr;
|
||||
obs_media_state state = OBS_MEDIA_STATE_NONE;
|
||||
bool anyState = false;
|
||||
time_restriction restriction = TIME_RESTRICTION_NONE;
|
||||
int64_t time = 0;
|
||||
std::atomic<bool> stopped = false;
|
||||
std::atomic<bool> ended = false;
|
||||
|
||||
// trigger scene change only once even if media state might trigger repeatedly
|
||||
bool matched = false;
|
||||
|
||||
std::atomic_bool stopped = {false};
|
||||
std::atomic_bool ended = {false};
|
||||
|
||||
// workaround to enable use of "ended" to specify end of VLC playlist
|
||||
bool previousStateEnded = false;
|
||||
|
||||
bool playedToEnd = false;
|
||||
|
||||
const char *getType() { return "media"; }
|
||||
bool initialized();
|
||||
bool valid();
|
||||
@@ -64,16 +71,10 @@ private slots:
|
||||
void TimeChanged(int time);
|
||||
|
||||
private:
|
||||
QComboBox *meidaSources;
|
||||
QComboBox *mediaSources;
|
||||
QComboBox *states;
|
||||
QComboBox *timeRestrictions;
|
||||
QSpinBox *time;
|
||||
|
||||
QLabel *whenLabel;
|
||||
QLabel *stateLabel;
|
||||
QLabel *andLabel;
|
||||
QLabel *switchLabel;
|
||||
QLabel *usingLabel;
|
||||
|
||||
MediaSwitch *switchData;
|
||||
};
|
||||
|
||||
64
src/headers/switch-pause.hpp
Normal file
64
src/headers/switch-pause.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include "switch-generic.hpp"
|
||||
|
||||
enum class PauseType {
|
||||
Scene,
|
||||
Window,
|
||||
};
|
||||
|
||||
enum class PauseTarget {
|
||||
All,
|
||||
Transition,
|
||||
Window,
|
||||
Executable,
|
||||
Region,
|
||||
Media,
|
||||
File,
|
||||
Random,
|
||||
Time,
|
||||
Idle,
|
||||
Sequence,
|
||||
Audio,
|
||||
};
|
||||
|
||||
struct PauseEntry : SceneSwitcherEntry {
|
||||
PauseType pauseType = PauseType::Scene;
|
||||
PauseTarget pauseTarget = PauseTarget::All;
|
||||
std::string window = "";
|
||||
|
||||
const char *getType() { return "pause"; }
|
||||
bool valid();
|
||||
|
||||
inline PauseEntry(){};
|
||||
inline PauseEntry(OBSWeakSource scene_, PauseType pauseType_,
|
||||
PauseTarget pauseTarget_, const std::string &window_)
|
||||
: SceneSwitcherEntry(scene_, nullptr),
|
||||
pauseType(pauseType_),
|
||||
pauseTarget(pauseTarget_),
|
||||
window(window_)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class PauseEntryWidget : public SwitchWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PauseEntryWidget(PauseEntry *s);
|
||||
PauseEntry *getSwitchData();
|
||||
void setSwitchData(PauseEntry *s);
|
||||
|
||||
static void swapSwitchData(PauseEntryWidget *s1, PauseEntryWidget *s2);
|
||||
|
||||
private slots:
|
||||
void PauseTypeChanged(int index);
|
||||
void PauseTargetChanged(int index);
|
||||
void WindowChanged(const QString &text);
|
||||
|
||||
private:
|
||||
QComboBox *pauseTypes;
|
||||
QComboBox *pauseTargets;
|
||||
QComboBox *windows;
|
||||
|
||||
PauseEntry *switchData;
|
||||
};
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "switch-generic.hpp"
|
||||
|
||||
struct RandomSwitch : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
double delay = 0.0;
|
||||
|
||||
const char *getType() { return "random"; }
|
||||
@@ -31,9 +32,5 @@ private slots:
|
||||
private:
|
||||
QDoubleSpinBox *delay;
|
||||
|
||||
QLabel *switchLabel;
|
||||
QLabel *usingLabel;
|
||||
QLabel *forLabel;
|
||||
|
||||
RandomSwitch *switchData;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ constexpr auto screen_region_func = 4;
|
||||
constexpr auto default_priority_4 = screen_region_func;
|
||||
|
||||
struct ScreenRegionSwitch : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
int minX = 0, minY = 0, maxX = 0, maxY = 0;
|
||||
|
||||
const char *getType() { return "region"; }
|
||||
@@ -51,11 +52,6 @@ private:
|
||||
|
||||
QFrame helperFrame;
|
||||
|
||||
QLabel *cursorLabel;
|
||||
QLabel *xLabel;
|
||||
QLabel *switchLabel;
|
||||
QLabel *usingLabel;
|
||||
|
||||
ScreenRegionSwitch *switchData;
|
||||
|
||||
void drawFrame();
|
||||
|
||||
@@ -11,9 +11,12 @@ typedef enum {
|
||||
} delay_units;
|
||||
|
||||
struct SceneSequenceSwitch : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
OBSWeakSource startScene = nullptr;
|
||||
double delay = 0;
|
||||
int delayMultiplier = 1;
|
||||
bool interruptible = false;
|
||||
unsigned int matchCount = 0;
|
||||
|
||||
const char *getType() { return "sequence"; }
|
||||
bool initialized();
|
||||
@@ -24,11 +27,13 @@ struct SceneSequenceSwitch : SceneSwitcherEntry {
|
||||
inline SceneSequenceSwitch(OBSWeakSource startScene_,
|
||||
OBSWeakSource scene_,
|
||||
OBSWeakSource transition_, double delay_,
|
||||
int delayMultiplier_, bool usePreviousScene_)
|
||||
int delayMultiplier_, bool interruptible_,
|
||||
bool usePreviousScene_)
|
||||
: SceneSwitcherEntry(scene_, transition_, usePreviousScene_),
|
||||
startScene(startScene_),
|
||||
delay(delay_),
|
||||
delayMultiplier(delayMultiplier_)
|
||||
delayMultiplier(delayMultiplier_),
|
||||
interruptible(interruptible_)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -49,16 +54,13 @@ private slots:
|
||||
void DelayChanged(double delay);
|
||||
void DelayUnitsChanged(int idx);
|
||||
void StartSceneChanged(const QString &text);
|
||||
void InterruptibleChanged(int state);
|
||||
|
||||
private:
|
||||
QDoubleSpinBox *delay;
|
||||
QComboBox *delayUnits;
|
||||
QComboBox *startScenes;
|
||||
|
||||
QLabel *whenLabel;
|
||||
QLabel *switchLabel;
|
||||
QLabel *afterLabel;
|
||||
QLabel *usingLabel;
|
||||
QCheckBox *interruptible;
|
||||
|
||||
SceneSequenceSwitch *switchData;
|
||||
};
|
||||
|
||||
@@ -19,8 +19,9 @@ typedef enum {
|
||||
} timeTrigger;
|
||||
|
||||
struct TimeSwitch : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
timeTrigger trigger = ANY_DAY;
|
||||
QTime time = QTime();
|
||||
QTime time = QTime(0, 0);
|
||||
|
||||
const char *getType() { return "time"; }
|
||||
|
||||
@@ -53,9 +54,5 @@ private:
|
||||
QComboBox *triggers;
|
||||
QTimeEdit *time;
|
||||
|
||||
QLabel *atLabel;
|
||||
QLabel *switchLabel;
|
||||
QLabel *usingLabel;
|
||||
|
||||
TimeSwitch *switchData;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@ struct SceneTransition : SceneSwitcherEntry {
|
||||
};
|
||||
|
||||
struct DefaultSceneTransition : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
|
||||
const char *getType() { return "def_transition"; }
|
||||
|
||||
@@ -45,10 +46,6 @@ private slots:
|
||||
private:
|
||||
QComboBox *scenes2;
|
||||
|
||||
QLabel *switchLabel;
|
||||
QLabel *toLabel;
|
||||
QLabel *usingLabel;
|
||||
|
||||
SceneTransition *switchData;
|
||||
};
|
||||
|
||||
@@ -64,8 +61,5 @@ public:
|
||||
DefTransitionSwitchWidget *s2);
|
||||
|
||||
private:
|
||||
QLabel *whenLabel;
|
||||
QLabel *switchLabel;
|
||||
|
||||
DefaultSceneTransition *switchData;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ constexpr auto window_title_func = 5;
|
||||
constexpr auto default_priority_5 = window_title_func;
|
||||
|
||||
struct WindowSwitch : SceneSwitcherEntry {
|
||||
static bool pause;
|
||||
std::string window = "";
|
||||
bool fullscreen = false;
|
||||
bool maximized = false;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "switch-file.hpp"
|
||||
#include "switch-idle.hpp"
|
||||
#include "switch-media.hpp"
|
||||
#include "switch-pause.hpp"
|
||||
#include "switch-random.hpp"
|
||||
#include "switch-screen-region.hpp"
|
||||
#include "switch-time.hpp"
|
||||
@@ -57,24 +58,25 @@ struct SwitcherData {
|
||||
|
||||
int interval = default_interval;
|
||||
|
||||
obs_source_t *waitScene = NULL;
|
||||
OBSWeakSource previousScene = NULL;
|
||||
OBSWeakSource PreviousScene2 = NULL;
|
||||
obs_source_t *waitScene = nullptr;
|
||||
OBSWeakSource previousScene = nullptr;
|
||||
OBSWeakSource previousScene2 = nullptr;
|
||||
OBSWeakSource lastRandomScene;
|
||||
OBSWeakSource nonMatchingScene;
|
||||
NoMatch switchIfNotMatching = NO_SWITCH;
|
||||
double noMatchDelay;
|
||||
double noMatchCount = 0;
|
||||
StartupBehavior startupBehavior = PERSIST;
|
||||
|
||||
double cooldown = 0.;
|
||||
std::chrono::high_resolution_clock::time_point lastMatchTime;
|
||||
|
||||
std::deque<WindowSwitch> windowSwitches;
|
||||
std::vector<std::string> ignoreIdleWindows;
|
||||
std::string lastTitle;
|
||||
|
||||
std::deque<ScreenRegionSwitch> screenRegionSwitches;
|
||||
|
||||
std::vector<OBSWeakSource> pauseScenesSwitches;
|
||||
|
||||
std::vector<std::string> pauseWindowsSwitches;
|
||||
|
||||
std::vector<std::string> ignoreWindowsSwitches;
|
||||
|
||||
std::deque<SceneSequenceSwitch> sceneSequenceSwitches;
|
||||
@@ -84,7 +86,7 @@ struct SwitcherData {
|
||||
IdleData idleData;
|
||||
|
||||
FileIOData fileIO;
|
||||
std::vector<FileSwitch> fileSwitches;
|
||||
std::deque<FileSwitch> fileSwitches;
|
||||
CURL *curl = nullptr;
|
||||
|
||||
std::deque<ExecutableSwitch> executableSwitches;
|
||||
@@ -99,14 +101,17 @@ struct SwitcherData {
|
||||
|
||||
std::deque<SceneTransition> sceneTransitions;
|
||||
std::deque<DefaultSceneTransition> defaultSceneTransitions;
|
||||
bool changedDefTransitionRecently = false;
|
||||
bool checkedDefTransition = false;
|
||||
|
||||
std::deque<MediaSwitch> mediaSwitches;
|
||||
|
||||
std::deque<PauseEntry> pauseEntries;
|
||||
|
||||
std::deque<TimeSwitch> timeSwitches;
|
||||
QDateTime liveTime;
|
||||
|
||||
std::deque<AudioSwitch> audioSwitches;
|
||||
AudioSwitchFallback audioFallback;
|
||||
|
||||
std::vector<int> functionNamesByPriority = std::vector<int>{
|
||||
default_priority_0, default_priority_1, default_priority_2,
|
||||
@@ -143,9 +148,9 @@ struct SwitcherData {
|
||||
std::vector<int> tabOrder;
|
||||
|
||||
bool hotkeysRegistered = false;
|
||||
obs_hotkey_id startHotkey;
|
||||
obs_hotkey_id stopHotkey;
|
||||
obs_hotkey_id toggleHotkey;
|
||||
obs_hotkey_id startHotkey = 0;
|
||||
obs_hotkey_id stopHotkey = 0;
|
||||
obs_hotkey_id toggleHotkey = 0;
|
||||
|
||||
void Thread();
|
||||
void Start();
|
||||
@@ -154,10 +159,13 @@ struct SwitcherData {
|
||||
bool sceneChangedDuringWait();
|
||||
bool prioFuncsValid();
|
||||
void writeSceneInfoToFile();
|
||||
void setDefaultSceneTransitions();
|
||||
void writeToStatusFile(QString status);
|
||||
void autoStopStreamAndRecording();
|
||||
void autoStartStreamRecording();
|
||||
bool checkPause();
|
||||
void checkDefaultSceneTransitions(bool &match,
|
||||
OBSWeakSource &transition);
|
||||
void setCurrentDefTransition(OBSWeakSource &transition);
|
||||
void checkSceneSequence(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition,
|
||||
std::unique_lock<std::mutex> &lock);
|
||||
@@ -181,6 +189,11 @@ struct SwitcherData {
|
||||
OBSWeakSource &transition);
|
||||
void checkAudioSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition);
|
||||
void checkAudioSwitchFallback(OBSWeakSource &scene,
|
||||
OBSWeakSource &transition);
|
||||
void checkNoMatchSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition, int &sleep);
|
||||
void checkSwitchCooldown(bool &match);
|
||||
|
||||
void saveWindowTitleSwitches(obs_data_t *obj);
|
||||
void saveScreenRegionSwitches(obs_data_t *obj);
|
||||
@@ -200,6 +213,7 @@ struct SwitcherData {
|
||||
void loadWindowTitleSwitches(obs_data_t *obj);
|
||||
void loadScreenRegionSwitches(obs_data_t *obj);
|
||||
void loadPauseSwitches(obs_data_t *obj);
|
||||
void loadOldPauseSwitches(obs_data_t *obj);
|
||||
void loadSceneSequenceSwitches(obs_data_t *obj);
|
||||
void loadSceneTransitions(obs_data_t *obj);
|
||||
void loadIdleSwitches(obs_data_t *obj);
|
||||
@@ -213,6 +227,7 @@ struct SwitcherData {
|
||||
void loadHotkeys(obs_data_t *obj);
|
||||
|
||||
void Prune();
|
||||
|
||||
inline ~SwitcherData() { Stop(); }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
#pragma once
|
||||
#include <obs.hpp>
|
||||
|
||||
#include <QString>
|
||||
#include <QLayout>
|
||||
#include <QLabel>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <obs.hpp>
|
||||
#include <obs-module.h>
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
static inline bool WeakSourceValid(obs_weak_source_t *ws)
|
||||
@@ -82,3 +88,64 @@ static inline OBSWeakSource GetWeakTransitionByQString(const QString &name)
|
||||
{
|
||||
return GetWeakTransitionByName(name.toUtf8().constData());
|
||||
}
|
||||
|
||||
static inline std::string
|
||||
getNextDelim(std::string text,
|
||||
std::unordered_map<std::string, QWidget *> placeholders)
|
||||
{
|
||||
size_t pos = std::string::npos;
|
||||
std::string res = "";
|
||||
|
||||
for (const auto &ph : placeholders) {
|
||||
size_t newPos = text.find(ph.first);
|
||||
if (newPos <= pos) {
|
||||
pos = newPos;
|
||||
res = ph.first;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos == std::string::npos)
|
||||
return "";
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate layout with labels and widgets based on provided text
|
||||
*
|
||||
* @param text Text based on which labels are generated and widgets are placed.
|
||||
* @param layout Layout in which the widgets and labels will be placed.
|
||||
* @param placeholders Map containing a mapping of placeholder strings to widgets.
|
||||
* @param addStretch Add addStretch() to layout.
|
||||
*/
|
||||
static inline void
|
||||
placeWidgets(std::string text, QBoxLayout *layout,
|
||||
std::unordered_map<std::string, QWidget *> placeholders,
|
||||
bool addStretch = true)
|
||||
{
|
||||
std::vector<std::pair<std::string, QWidget *>> labelsWidgetsPairs;
|
||||
|
||||
std::string delim = getNextDelim(text, placeholders);
|
||||
while (delim != "") {
|
||||
size_t pos = text.find(delim);
|
||||
if (pos != std::string::npos) {
|
||||
labelsWidgetsPairs.emplace_back(text.substr(0, pos),
|
||||
placeholders[delim]);
|
||||
text.erase(0, pos + delim.length());
|
||||
}
|
||||
delim = getNextDelim(text, placeholders);
|
||||
}
|
||||
|
||||
if (text != "") {
|
||||
labelsWidgetsPairs.emplace_back(text, nullptr);
|
||||
}
|
||||
|
||||
for (auto &lw : labelsWidgetsPairs) {
|
||||
if (lw.first != "")
|
||||
layout->addWidget(new QLabel(lw.first.c_str()));
|
||||
if (lw.second)
|
||||
layout->addWidget(lw.second);
|
||||
}
|
||||
if (addStretch)
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
1
src/headers/version.h
Normal file
1
src/headers/version.h
Normal file
@@ -0,0 +1 @@
|
||||
extern const char g_GIT_SHA1[];
|
||||
@@ -47,14 +47,17 @@ void startStopToggleHotkeyFunc(void *data, obs_hotkey_id id,
|
||||
void registerHotkeys()
|
||||
{
|
||||
switcher->startHotkey = obs_hotkey_register_frontend(
|
||||
"startSwitcherHotkey", "Start the Advanced Scene Switcher",
|
||||
"startSwitcherHotkey",
|
||||
obs_module_text("AdvSceneSwitcher.hotkey.startSwitcherHotkey"),
|
||||
startHotkeyFunc, NULL);
|
||||
switcher->stopHotkey = obs_hotkey_register_frontend(
|
||||
"stopSwitcherHotkey", "Stop the Advanced Scene Switcher",
|
||||
"stopSwitcherHotkey",
|
||||
obs_module_text("AdvSceneSwitcher.hotkey.stopSwitcherHotkey"),
|
||||
stopHotkeyFunc, NULL);
|
||||
switcher->toggleHotkey = obs_hotkey_register_frontend(
|
||||
"startStopToggleSwitcherHotkey",
|
||||
"Toggle Start/Stop for the Advanced Scene Switcher",
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.hotkey.startStopToggleSwitcherHotkey"),
|
||||
startStopToggleHotkeyFunc, NULL);
|
||||
|
||||
switcher->hotkeysRegistered = true;
|
||||
|
||||
@@ -17,15 +17,16 @@ void GetWindowList(std::vector<std::string> &windows)
|
||||
for (NSDictionary *app in apps) {
|
||||
// Construct string from NSString accounting for nil
|
||||
std::string name([[app objectForKey:@"kCGWindowName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
std::string owner([[app objectForKey:@"kCGWindowOwnerName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
std::string owner(
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
|
||||
// Check if name exists
|
||||
if (!name.empty() &&
|
||||
@@ -53,15 +54,16 @@ void GetWindowList(QStringList &windows)
|
||||
for (NSDictionary *app in apps) {
|
||||
// Construct string from NSString accounting for nil
|
||||
std::string name([[app objectForKey:@"kCGWindowName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
std::string owner([[app objectForKey:@"kCGWindowOwnerName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
std::string owner(
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
|
||||
// Check if name exists
|
||||
if (!name.empty() &&
|
||||
@@ -144,15 +146,16 @@ bool isFullscreen(std::string &title)
|
||||
for (NSDictionary *app in apps) {
|
||||
// Construct string from NSString accounting for nil
|
||||
std::string name([[app objectForKey:@"kCGWindowName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
std::string owner([[app objectForKey:@"kCGWindowOwnerName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
std::string owner(
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
UTF8String],
|
||||
[[app objectForKey:@"kCGWindowOwnerName"]
|
||||
lengthOfBytesUsingEncoding:
|
||||
NSUTF8StringEncoding]);
|
||||
|
||||
// True if switch equals app
|
||||
bool equals = (title == name || title == owner);
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
#include <float.h>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/volume-control.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool AudioSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void AdvSceneSwitcher::on_audioAdd_clicked()
|
||||
{
|
||||
ui->audioAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->audioSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->audioSwitches);
|
||||
ui->audioSwitches->addItem(item);
|
||||
AudioSwitchWidget *sw =
|
||||
new AudioSwitchWidget(&switcher->audioSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->audioSwitches->setItemWidget(item, sw);
|
||||
listAddClicked(ui->audioSwitches,
|
||||
new AudioSwitchWidget(&switcher->audioSwitches.back()),
|
||||
ui->audioAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_audioRemove_clicked()
|
||||
@@ -77,12 +74,43 @@ void AdvSceneSwitcher::on_audioDown_clicked()
|
||||
switcher->audioSwitches[index + 1]);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_audioFallback_toggled(bool on)
|
||||
{
|
||||
if (loading || !switcher)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->audioFallback.enable = on;
|
||||
}
|
||||
|
||||
void SwitcherData::checkAudioSwitchFallback(OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
bool durationReached =
|
||||
((unsigned long long)audioFallback.matchCount * interval) /
|
||||
1000.0 >=
|
||||
audioFallback.duration;
|
||||
|
||||
if (durationReached) {
|
||||
|
||||
scene = (audioFallback.usePreviousScene) ? previousScene
|
||||
: audioFallback.scene;
|
||||
transition = audioFallback.transition;
|
||||
|
||||
if (verbose)
|
||||
audioFallback.logMatch();
|
||||
}
|
||||
|
||||
audioFallback.matchCount++;
|
||||
}
|
||||
|
||||
void SwitcherData::checkAudioSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (audioSwitches.size() == 0)
|
||||
if (AudioSwitch::pause)
|
||||
return;
|
||||
|
||||
bool fallbackChecked = false; // false if one or no match
|
||||
|
||||
for (AudioSwitch &s : audioSwitches) {
|
||||
if (!s.initialized())
|
||||
continue;
|
||||
@@ -92,19 +120,75 @@ void SwitcherData::checkAudioSwitch(bool &match, OBSWeakSource &scene,
|
||||
obs_source_release(as);
|
||||
|
||||
// peak will have a value from -60 db to 0 db
|
||||
bool volumeThresholdreached = ((double)s.peak + 60) * 1.7 >
|
||||
s.volumeThreshold;
|
||||
bool volumeThresholdreached = false;
|
||||
|
||||
if (s.condition == ABOVE)
|
||||
volumeThresholdreached = ((double)s.peak + 60) * 1.7 >
|
||||
s.volumeThreshold;
|
||||
else
|
||||
volumeThresholdreached = ((double)s.peak + 60) * 1.7 <
|
||||
s.volumeThreshold;
|
||||
|
||||
// reset for next check
|
||||
s.peak = -FLT_MAX;
|
||||
|
||||
if (volumeThresholdreached) {
|
||||
s.matchCount++;
|
||||
} else {
|
||||
s.matchCount = 0;
|
||||
}
|
||||
|
||||
bool durationReached =
|
||||
((unsigned long long)s.matchCount * interval) /
|
||||
1000.0 >=
|
||||
s.duration;
|
||||
|
||||
if (volumeThresholdreached && durationReached && audioActive) {
|
||||
if (match) {
|
||||
checkAudioSwitchFallback(scene, transition);
|
||||
fallbackChecked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (volumeThresholdreached && audioActive) {
|
||||
scene = (s.usePreviousScene) ? previousScene : s.scene;
|
||||
transition = s.transition;
|
||||
match = true;
|
||||
|
||||
if (verbose)
|
||||
s.logMatch();
|
||||
break;
|
||||
|
||||
if (!audioFallback.enable)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fallbackChecked)
|
||||
audioFallback.matchCount = 0;
|
||||
}
|
||||
|
||||
void saveAudioFallback(obs_data_t *obj, AudioSwitchFallback &audioFallback)
|
||||
{
|
||||
obs_source_t *fallbackSceneSource =
|
||||
obs_weak_source_get_source(audioFallback.scene);
|
||||
obs_source_t *fallbackTransition =
|
||||
obs_weak_source_get_source(audioFallback.transition);
|
||||
|
||||
const char *fallbackSceneName =
|
||||
obs_source_get_name(fallbackSceneSource);
|
||||
const char *fallbackTransitionName =
|
||||
obs_source_get_name(fallbackTransition);
|
||||
|
||||
obs_data_set_bool(obj, "audioFallbackEnable", audioFallback.enable);
|
||||
obs_data_set_string(obj, "audioFallbackScene",
|
||||
audioFallback.usePreviousScene ? previous_scene_name
|
||||
: fallbackSceneName);
|
||||
obs_data_set_string(obj, "audioFallbackTransition",
|
||||
fallbackTransitionName);
|
||||
obs_data_set_double(obj, "audioFallbackDuration",
|
||||
audioFallback.duration);
|
||||
|
||||
obs_source_release(fallbackSceneSource);
|
||||
obs_source_release(fallbackTransition);
|
||||
}
|
||||
|
||||
void SwitcherData::saveAudioSwitches(obs_data_t *obj)
|
||||
@@ -136,6 +220,8 @@ void SwitcherData::saveAudioSwitches(obs_data_t *obj)
|
||||
audioSourceName);
|
||||
obs_data_set_int(array_obj, "volume",
|
||||
s.volumeThreshold);
|
||||
obs_data_set_int(array_obj, "condition", s.condition);
|
||||
obs_data_set_double(array_obj, "duration", s.duration);
|
||||
obs_data_array_push_back(audioArray, array_obj);
|
||||
}
|
||||
obs_source_release(sceneSource);
|
||||
@@ -146,6 +232,25 @@ void SwitcherData::saveAudioSwitches(obs_data_t *obj)
|
||||
}
|
||||
obs_data_set_array(obj, "audioSwitches", audioArray);
|
||||
obs_data_array_release(audioArray);
|
||||
|
||||
saveAudioFallback(obj, audioFallback);
|
||||
}
|
||||
|
||||
void loadAudioFallback(obs_data_t *obj, AudioSwitchFallback &audioFallback)
|
||||
{
|
||||
const char *fallbackSceneName =
|
||||
obs_data_get_string(obj, "audioFallbackScene");
|
||||
const char *fallbackTransitionName =
|
||||
obs_data_get_string(obj, "audioFallbackTransition");
|
||||
|
||||
audioFallback.enable = obs_data_get_bool(obj, "audioFallbackEnable");
|
||||
audioFallback.duration =
|
||||
obs_data_get_double(obj, "audioFallbackDuration");
|
||||
audioFallback.scene = GetWeakSourceByName(fallbackSceneName);
|
||||
audioFallback.transition =
|
||||
GetWeakTransitionByName(fallbackTransitionName);
|
||||
audioFallback.usePreviousScene =
|
||||
strcmp(fallbackSceneName, previous_scene_name) == 0;
|
||||
}
|
||||
|
||||
void SwitcherData::loadAudioSwitches(obs_data_t *obj)
|
||||
@@ -164,16 +269,21 @@ void SwitcherData::loadAudioSwitches(obs_data_t *obj)
|
||||
const char *audioSource =
|
||||
obs_data_get_string(array_obj, "audioSource");
|
||||
int vol = obs_data_get_int(array_obj, "volume");
|
||||
audioCondition condition = (audioCondition)obs_data_get_int(
|
||||
array_obj, "condition");
|
||||
double duration = obs_data_get_double(array_obj, "duration");
|
||||
|
||||
switcher->audioSwitches.emplace_back(
|
||||
GetWeakSourceByName(scene),
|
||||
GetWeakTransitionByName(transition),
|
||||
GetWeakSourceByName(audioSource), vol,
|
||||
(strcmp(scene, previous_scene_name) == 0));
|
||||
GetWeakSourceByName(audioSource), vol, condition,
|
||||
duration, (strcmp(scene, previous_scene_name) == 0));
|
||||
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_array_release(audioArray);
|
||||
|
||||
loadAudioFallback(obj, audioFallback);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::setupAudioTab()
|
||||
@@ -189,6 +299,11 @@ void AdvSceneSwitcher::setupAudioTab()
|
||||
|
||||
if (switcher->audioSwitches.size() == 0)
|
||||
addPulse = PulseWidget(ui->audioAdd, QColor(Qt::green));
|
||||
|
||||
AudioSwitchFallbackWidget *fb =
|
||||
new AudioSwitchFallbackWidget(&switcher->audioFallback);
|
||||
ui->audioFallbackLayout->addWidget(fb);
|
||||
ui->audioFallback->setChecked(switcher->audioFallback.enable);
|
||||
}
|
||||
|
||||
void AudioSwitch::setVolumeLevel(void *data,
|
||||
@@ -200,26 +315,32 @@ void AudioSwitch::setVolumeLevel(void *data,
|
||||
UNUSED_PARAMETER(inputPeak);
|
||||
AudioSwitch *s = static_cast<AudioSwitch *>(data);
|
||||
|
||||
s->peak = peak[0];
|
||||
for (int i = 1; i < MAX_AUDIO_CHANNELS; i++)
|
||||
if (peak[i] > s->peak)
|
||||
s->peak = peak[i];
|
||||
}
|
||||
|
||||
obs_volmeter_t *AddVolmeterToSource(AudioSwitch *entry, obs_weak_source *source)
|
||||
{
|
||||
obs_volmeter_t *volmeter = obs_volmeter_create(OBS_FADER_LOG);
|
||||
obs_volmeter_add_callback(volmeter, AudioSwitch::setVolumeLevel, entry);
|
||||
obs_source_t *as = obs_weak_source_get_source(source);
|
||||
if (!obs_volmeter_attach_source(volmeter, as)) {
|
||||
const char *name = obs_source_get_name(as);
|
||||
blog(LOG_WARNING, "failed to attach volmeter to source %s",
|
||||
name);
|
||||
}
|
||||
obs_source_release(as);
|
||||
|
||||
return volmeter;
|
||||
}
|
||||
|
||||
void AudioSwitch::resetVolmeter()
|
||||
{
|
||||
obs_volmeter_remove_callback(volmeter, setVolumeLevel, this);
|
||||
obs_volmeter_destroy(volmeter);
|
||||
|
||||
volmeter = obs_volmeter_create(OBS_FADER_LOG);
|
||||
obs_volmeter_add_callback(volmeter, setVolumeLevel, this);
|
||||
obs_source_t *as = obs_weak_source_get_source(audioSource);
|
||||
if (!obs_volmeter_attach_source(volmeter, as)) {
|
||||
const char *name = obs_source_get_name(as);
|
||||
blog(LOG_WARNING, "failed to attach volmeter to source %s",
|
||||
name);
|
||||
}
|
||||
obs_source_release(as);
|
||||
volmeter = AddVolmeterToSource(this, audioSource);
|
||||
}
|
||||
|
||||
bool AudioSwitch::initialized()
|
||||
@@ -235,37 +356,26 @@ bool AudioSwitch::valid()
|
||||
|
||||
AudioSwitch::AudioSwitch(OBSWeakSource scene_, OBSWeakSource transition_,
|
||||
OBSWeakSource audioSource_, int volumeThreshold_,
|
||||
audioCondition condition_, double duration_,
|
||||
bool usePreviousScene_)
|
||||
: SceneSwitcherEntry(scene_, transition_, usePreviousScene_),
|
||||
audioSource(audioSource_),
|
||||
volumeThreshold(volumeThreshold_)
|
||||
volumeThreshold(volumeThreshold_),
|
||||
condition(condition_),
|
||||
duration(duration_)
|
||||
{
|
||||
volmeter = obs_volmeter_create(OBS_FADER_LOG);
|
||||
obs_volmeter_add_callback(volmeter, setVolumeLevel, this);
|
||||
obs_source_t *as = obs_weak_source_get_source(audioSource);
|
||||
if (!obs_volmeter_attach_source(volmeter, as)) {
|
||||
const char *name = obs_source_get_name(as);
|
||||
blog(LOG_WARNING, "failed to attach volmeter to source %s",
|
||||
name);
|
||||
}
|
||||
obs_source_release(as);
|
||||
volmeter = AddVolmeterToSource(this, audioSource);
|
||||
}
|
||||
|
||||
AudioSwitch::AudioSwitch(const AudioSwitch &other)
|
||||
: SceneSwitcherEntry(other.scene, other.transition,
|
||||
other.usePreviousScene),
|
||||
audioSource(other.audioSource),
|
||||
volumeThreshold(other.volumeThreshold)
|
||||
volumeThreshold(other.volumeThreshold),
|
||||
condition(other.condition),
|
||||
duration(other.duration)
|
||||
{
|
||||
volmeter = obs_volmeter_create(OBS_FADER_LOG);
|
||||
obs_volmeter_add_callback(volmeter, setVolumeLevel, this);
|
||||
obs_source_t *as = obs_weak_source_get_source(other.audioSource);
|
||||
if (!obs_volmeter_attach_source(volmeter, as)) {
|
||||
const char *name = obs_source_get_name(as);
|
||||
blog(LOG_WARNING, "failed to attach volmeter to source %s",
|
||||
name);
|
||||
}
|
||||
obs_source_release(as);
|
||||
volmeter = AddVolmeterToSource(this, other.audioSource);
|
||||
}
|
||||
|
||||
AudioSwitch::AudioSwitch(AudioSwitch &&other)
|
||||
@@ -273,6 +383,8 @@ AudioSwitch::AudioSwitch(AudioSwitch &&other)
|
||||
other.usePreviousScene),
|
||||
audioSource(other.audioSource),
|
||||
volumeThreshold(other.volumeThreshold),
|
||||
condition(other.condition),
|
||||
duration(other.duration),
|
||||
volmeter(other.volmeter)
|
||||
{
|
||||
other.volmeter = nullptr;
|
||||
@@ -313,16 +425,28 @@ void swap(AudioSwitch &first, AudioSwitch &second)
|
||||
std::swap(first.usePreviousScene, second.usePreviousScene);
|
||||
std::swap(first.audioSource, second.audioSource);
|
||||
std::swap(first.volumeThreshold, second.volumeThreshold);
|
||||
std::swap(first.condition, second.condition);
|
||||
std::swap(first.duration, second.duration);
|
||||
std::swap(first.peak, second.peak);
|
||||
std::swap(first.volmeter, second.volmeter);
|
||||
first.resetVolmeter();
|
||||
second.resetVolmeter();
|
||||
}
|
||||
|
||||
void populateConditionSelection(QComboBox *list)
|
||||
{
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.audioTab.condition.above"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.audioTab.condition.below"));
|
||||
}
|
||||
|
||||
AudioSwitchWidget::AudioSwitchWidget(AudioSwitch *s) : SwitchWidget(s)
|
||||
{
|
||||
audioSources = new QComboBox();
|
||||
condition = new QComboBox();
|
||||
audioVolumeThreshold = new QSpinBox();
|
||||
duration = new QDoubleSpinBox();
|
||||
|
||||
obs_source_t *soruce = nullptr;
|
||||
if (s)
|
||||
@@ -330,46 +454,49 @@ AudioSwitchWidget::AudioSwitchWidget(AudioSwitch *s) : SwitchWidget(s)
|
||||
volMeter = new VolControl(soruce);
|
||||
obs_source_release(soruce);
|
||||
|
||||
whenLabel = new QLabel("When the volume of");
|
||||
aboveLabel = new QLabel("is above");
|
||||
switchLabel = new QLabel("switch to");
|
||||
usingLabel = new QLabel("using");
|
||||
|
||||
audioVolumeThreshold->setSuffix("%");
|
||||
audioVolumeThreshold->setMaximum(100);
|
||||
audioVolumeThreshold->setMinimum(0);
|
||||
|
||||
duration->setMinimum(0.0);
|
||||
duration->setMaximum(99.000000);
|
||||
duration->setSuffix("s");
|
||||
|
||||
QWidget::connect(volMeter->GetSlider(), SIGNAL(valueChanged(int)),
|
||||
audioVolumeThreshold, SLOT(setValue(int)));
|
||||
QWidget::connect(audioVolumeThreshold, SIGNAL(valueChanged(int)),
|
||||
volMeter->GetSlider(), SLOT(setValue(int)));
|
||||
QWidget::connect(audioVolumeThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(VolumeThresholdChanged(int)));
|
||||
QWidget::connect(condition, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(ConditionChanged(int)));
|
||||
QWidget::connect(duration, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(DurationChanged(double)));
|
||||
QWidget::connect(audioSources,
|
||||
SIGNAL(currentTextChanged(const QString &)), this,
|
||||
SLOT(SourceChanged(const QString &)));
|
||||
|
||||
AdvSceneSwitcher::populateAudioSelection(audioSources);
|
||||
populateConditionSelection(condition);
|
||||
|
||||
if (s) {
|
||||
audioSources->setCurrentText(
|
||||
GetWeakSourceName(s->audioSource).c_str());
|
||||
audioVolumeThreshold->setValue(s->volumeThreshold);
|
||||
condition->setCurrentIndex(s->condition);
|
||||
duration->setValue(s->duration);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *switchLayout = new QHBoxLayout;
|
||||
|
||||
switchLayout->addWidget(whenLabel);
|
||||
switchLayout->addWidget(audioSources);
|
||||
switchLayout->addWidget(aboveLabel);
|
||||
switchLayout->addWidget(audioVolumeThreshold);
|
||||
switchLayout->addWidget(switchLabel);
|
||||
switchLayout->addWidget(scenes);
|
||||
switchLayout->addWidget(usingLabel);
|
||||
switchLayout->addWidget(transitions);
|
||||
switchLayout->addStretch();
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{audioSources}}", audioSources},
|
||||
{"{{volumeWidget}}", audioVolumeThreshold},
|
||||
{"{{condition}}", condition},
|
||||
{"{{duration}}", duration},
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{transitions}}", transitions}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.audioTab.entry"),
|
||||
switchLayout, widgetPlaceholders);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
|
||||
@@ -440,3 +567,58 @@ void AudioSwitchWidget::VolumeThresholdChanged(int vol)
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->volumeThreshold = vol;
|
||||
}
|
||||
|
||||
void AudioSwitchWidget::ConditionChanged(int cond)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->condition = (audioCondition)cond;
|
||||
}
|
||||
|
||||
void AudioSwitchWidget::DurationChanged(double dur)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->duration = dur;
|
||||
}
|
||||
|
||||
AudioSwitchFallbackWidget::AudioSwitchFallbackWidget(AudioSwitchFallback *s)
|
||||
: SwitchWidget(s)
|
||||
{
|
||||
duration = new QDoubleSpinBox();
|
||||
|
||||
duration->setMinimum(0.0);
|
||||
duration->setMaximum(99.000000);
|
||||
duration->setSuffix("s");
|
||||
|
||||
QWidget::connect(duration, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(DurationChanged(double)));
|
||||
|
||||
if (s) {
|
||||
duration->setValue(s->duration);
|
||||
}
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{duration}}", duration},
|
||||
{"{{transitions}}", transitions}};
|
||||
placeWidgets(
|
||||
obs_module_text("AdvSceneSwitcher.audioTab.multiMatchfallback"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
loading = false;
|
||||
}
|
||||
|
||||
void AudioSwitchFallbackWidget::DurationChanged(double dur)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->duration = dur;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool ExecutableSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void AdvSceneSwitcher::on_executableAdd_clicked()
|
||||
{
|
||||
ui->executableAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->executableSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->executables);
|
||||
ui->executables->addItem(item);
|
||||
ExecutableSwitchWidget *sw = new ExecutableSwitchWidget(
|
||||
&switcher->executableSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->executables->setItemWidget(item, sw);
|
||||
listAddClicked(ui->executables,
|
||||
new ExecutableSwitchWidget(
|
||||
&switcher->executableSwitches.back()),
|
||||
ui->executableAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_executableRemove_clicked()
|
||||
@@ -79,6 +75,9 @@ void AdvSceneSwitcher::on_executableDown_clicked()
|
||||
void SwitcherData::checkExeSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (executableSwitches.size() == 0 || ExecutableSwitch::pause)
|
||||
return;
|
||||
|
||||
std::string title;
|
||||
QStringList runningProcesses;
|
||||
bool ignored = false;
|
||||
@@ -206,11 +205,8 @@ ExecutableSwitchWidget::ExecutableSwitchWidget(ExecutableSwitch *s)
|
||||
: SwitchWidget(s, false)
|
||||
{
|
||||
processes = new QComboBox();
|
||||
requiresFocus = new QCheckBox("only if focused");
|
||||
|
||||
whenLabel = new QLabel("When");
|
||||
switchLabel = new QLabel("is running switch to");
|
||||
usingLabel = new QLabel("using");
|
||||
requiresFocus = new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.executableTab.requiresFocus"));
|
||||
|
||||
QWidget::connect(processes, SIGNAL(currentTextChanged(const QString &)),
|
||||
this, SLOT(ProcessChanged(const QString &)));
|
||||
@@ -227,19 +223,14 @@ ExecutableSwitchWidget::ExecutableSwitchWidget(ExecutableSwitch *s)
|
||||
requiresFocus->setChecked(s->inFocus);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(whenLabel);
|
||||
mainLayout->addWidget(processes);
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(usingLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addWidget(requiresFocus);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{processes}}", processes},
|
||||
{"{{requiresFocus}}", requiresFocus},
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{transitions}}", transitions}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.executableTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QDateTime>
|
||||
#include <functional>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/curl-helper.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
#define LOCAL_FILE_IDX 0
|
||||
#define REMOTE_FILE_IDX 1
|
||||
bool FileSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
static std::hash<std::string> strHash;
|
||||
|
||||
void AdvSceneSwitcher::on_browseButton_clicked()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
this, tr("Select a file to write to ..."), QDir::currentPath(),
|
||||
tr("Text files (*.txt)"));
|
||||
this,
|
||||
tr(obs_module_text("AdvSceneSwitcher.fileTab.selectWrite")),
|
||||
QDir::currentPath(),
|
||||
tr(obs_module_text("AdvSceneSwitcher.fileTab.textFileType")));
|
||||
if (!path.isEmpty())
|
||||
ui->writePathLineEdit->setText(path);
|
||||
}
|
||||
@@ -67,8 +71,10 @@ void AdvSceneSwitcher::on_writePathLineEdit_textChanged(const QString &text)
|
||||
void AdvSceneSwitcher::on_browseButton_2_clicked()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
this, tr("Select a file to read from ..."), QDir::currentPath(),
|
||||
tr("Any files (*.*)"));
|
||||
this,
|
||||
tr(obs_module_text("AdvSceneSwitcher.fileTab.selectRead")),
|
||||
QDir::currentPath(),
|
||||
tr(obs_module_text("AdvSceneSwitcher.fileTab.anyFileType")));
|
||||
if (!path.isEmpty())
|
||||
ui->readPathLineEdit->setText(path);
|
||||
}
|
||||
@@ -89,6 +95,19 @@ void SwitcherData::writeSceneInfoToFile()
|
||||
obs_source_release(currentSource);
|
||||
}
|
||||
|
||||
void SwitcherData::writeToStatusFile(QString msg)
|
||||
{
|
||||
if (!fileIO.writeEnabled || fileIO.writePath.empty())
|
||||
return;
|
||||
|
||||
QFile file(QString::fromStdString(fileIO.writePath));
|
||||
if (file.open(QIODevice::ReadWrite)) {
|
||||
QTextStream stream(&file);
|
||||
stream << msg << endl;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
void SwitcherData::checkSwitchInfoFromFile(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
@@ -148,37 +167,50 @@ bool compareIgnoringLineEnding(QString &s1, QString &s2)
|
||||
QTextStream s1stream(&s1);
|
||||
QTextStream s2stream(&s2);
|
||||
|
||||
while (!s1stream.atEnd() && !s2stream.atEnd()) {
|
||||
while (!s1stream.atEnd() || !s2stream.atEnd()) {
|
||||
QString s1s = s1stream.readLine();
|
||||
QString s2s = s2stream.readLine();
|
||||
if (QString::compare(s1s, s2s, Qt::CaseSensitive) != 0) {
|
||||
if (s1s != s2s) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!s1stream.atEnd() && !s2stream.atEnd())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool matchFileContent(QString &filedata, FileSwitch &s)
|
||||
{
|
||||
if (s.onlyMatchIfChanged) {
|
||||
size_t newHash = strHash(filedata.toUtf8().constData());
|
||||
if (newHash == s.lastHash)
|
||||
return false;
|
||||
s.lastHash = newHash;
|
||||
}
|
||||
|
||||
if (s.useRegex) {
|
||||
QRegExp rx(QString::fromStdString(s.text));
|
||||
return rx.exactMatch(filedata);
|
||||
}
|
||||
|
||||
QString text = QString::fromStdString(s.text);
|
||||
return compareIgnoringLineEnding(text, filedata);
|
||||
}
|
||||
|
||||
bool checkRemoteFileContent(FileSwitch &s)
|
||||
{
|
||||
std::string data = getRemoteData(s.file);
|
||||
bool ret = false;
|
||||
if (s.useRegex) {
|
||||
ret = QString::fromStdString(data).contains(
|
||||
QRegularExpression(QString::fromStdString(s.text)));
|
||||
return ret;
|
||||
}
|
||||
QString t = QString::fromStdString(s.text);
|
||||
QString d = QString::fromStdString(data);
|
||||
|
||||
return compareIgnoringLineEnding(t, d);
|
||||
QString qdata = QString::fromStdString(data);
|
||||
return matchFileContent(qdata, s);
|
||||
}
|
||||
|
||||
bool checkLocalFileContent(FileSwitch &s)
|
||||
{
|
||||
bool equal = false;
|
||||
QString t = QString::fromStdString(s.text);
|
||||
QFile file(QString::fromStdString(s.file));
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
if (s.file.empty() || !file.open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
|
||||
if (s.useTime) {
|
||||
@@ -188,23 +220,23 @@ bool checkLocalFileContent(FileSwitch &s)
|
||||
s.lastMod = newLastMod;
|
||||
}
|
||||
|
||||
if (s.useRegex) {
|
||||
QTextStream in(&file);
|
||||
QRegExp rx(t);
|
||||
equal = rx.exactMatch(in.readAll());
|
||||
} else {
|
||||
QTextStream in(&file);
|
||||
QString filedata = in.readAll();
|
||||
equal = compareIgnoringLineEnding(filedata, t);
|
||||
}
|
||||
QString filedata = QTextStream(&file).readAll();
|
||||
bool match = matchFileContent(filedata, s);
|
||||
|
||||
file.close();
|
||||
return equal;
|
||||
return match;
|
||||
}
|
||||
|
||||
void SwitcherData::checkFileContent(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (FileSwitch::pause)
|
||||
return;
|
||||
|
||||
for (FileSwitch &s : fileSwitches) {
|
||||
if (!s.initialized())
|
||||
continue;
|
||||
|
||||
bool equal = false;
|
||||
if (s.remote) {
|
||||
equal = checkRemoteFileContent(s);
|
||||
@@ -224,83 +256,33 @@ void SwitcherData::checkFileContent(bool &match, OBSWeakSource &scene,
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_browseButton_3_clicked()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
this, tr("Select a file to read from ..."), QDir::currentPath(),
|
||||
tr("Any files (*.*)"));
|
||||
if (!path.isEmpty())
|
||||
ui->filePathLineEdit->setText(path);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_fileType_currentIndexChanged(int idx)
|
||||
{
|
||||
if (idx == -1)
|
||||
return;
|
||||
if (idx == LOCAL_FILE_IDX) {
|
||||
ui->browseButton_3->setDisabled(false);
|
||||
ui->fileContentTimeCheckBox->setDisabled(false);
|
||||
ui->remoteFileWarningLabel->hide();
|
||||
}
|
||||
if (idx == REMOTE_FILE_IDX) {
|
||||
ui->browseButton_3->setDisabled(true);
|
||||
ui->fileContentTimeCheckBox->setDisabled(true);
|
||||
ui->remoteFileWarningLabel->show();
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_fileAdd_clicked()
|
||||
{
|
||||
QString sceneName = ui->fileScenes->currentText();
|
||||
QString transitionName = ui->fileTransitions->currentText();
|
||||
QString fileName = ui->filePathLineEdit->text();
|
||||
QString text = ui->fileTextEdit->toPlainText();
|
||||
bool remote = (ui->fileType->currentIndex() == REMOTE_FILE_IDX);
|
||||
bool useRegex = ui->fileContentRegExCheckBox->isChecked();
|
||||
bool useTime = ui->fileContentTimeCheckBox->isChecked();
|
||||
|
||||
if (sceneName.isEmpty() || transitionName.isEmpty() ||
|
||||
fileName.isEmpty() || text.isEmpty())
|
||||
return;
|
||||
|
||||
OBSWeakSource source = GetWeakSourceByQString(sceneName);
|
||||
OBSWeakSource transition = GetWeakTransitionByQString(transitionName);
|
||||
|
||||
QString switchText = MakeFileSwitchName(
|
||||
sceneName, transitionName, fileName, text, useRegex, useTime);
|
||||
QVariant v = QVariant::fromValue(switchText);
|
||||
|
||||
QListWidgetItem *item =
|
||||
new QListWidgetItem(switchText, ui->fileScenesList);
|
||||
item->setData(Qt::UserRole, v);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->fileSwitches.emplace_back(source, transition,
|
||||
fileName.toUtf8().constData(),
|
||||
text.toUtf8().constData(), remote,
|
||||
useRegex, useTime);
|
||||
switcher->fileSwitches.emplace_back();
|
||||
|
||||
listAddClicked(ui->fileSwitches,
|
||||
new FileSwitchWidget(&switcher->fileSwitches.back()),
|
||||
ui->fileAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_fileRemove_clicked()
|
||||
{
|
||||
QListWidgetItem *item = ui->fileScenesList->currentItem();
|
||||
QListWidgetItem *item = ui->fileSwitches->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
int idx = ui->fileScenesList->currentRow();
|
||||
if (idx == -1)
|
||||
return;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
|
||||
int idx = ui->fileSwitches->currentRow();
|
||||
auto &switches = switcher->fileSwitches;
|
||||
switches.erase(switches.begin() + idx);
|
||||
}
|
||||
qDeleteAll(ui->fileScenesList->selectedItems());
|
||||
|
||||
delete item;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_fileScenesList_currentRowChanged(int idx)
|
||||
void AdvSceneSwitcher::on_fileSwitches_currentRowChanged(int idx)
|
||||
{
|
||||
if (loading)
|
||||
return;
|
||||
@@ -312,50 +294,47 @@ void AdvSceneSwitcher::on_fileScenesList_currentRowChanged(int idx)
|
||||
if ((int)switcher->fileSwitches.size() <= idx)
|
||||
return;
|
||||
FileSwitch s = switcher->fileSwitches[idx];
|
||||
|
||||
std::string sceneName = GetWeakSourceName(s.scene);
|
||||
std::string transitionName = GetWeakSourceName(s.transition);
|
||||
|
||||
ui->fileScenes->setCurrentText(sceneName.c_str());
|
||||
ui->fileTransitions->setCurrentText(transitionName.c_str());
|
||||
ui->fileTextEdit->setPlainText(s.text.c_str());
|
||||
ui->filePathLineEdit->setText(s.file.c_str());
|
||||
if (s.remote)
|
||||
ui->fileType->setCurrentIndex(REMOTE_FILE_IDX);
|
||||
ui->remoteFileWarningLabel->show();
|
||||
else
|
||||
ui->fileType->setCurrentIndex(LOCAL_FILE_IDX);
|
||||
ui->fileContentRegExCheckBox->setChecked(s.useRegex);
|
||||
ui->fileContentTimeCheckBox->setChecked(s.useTime);
|
||||
ui->remoteFileWarningLabel->hide();
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_fileUp_clicked()
|
||||
{
|
||||
int index = ui->fileScenesList->currentRow();
|
||||
if (index != -1 && index != 0) {
|
||||
ui->fileScenesList->insertItem(
|
||||
index - 1, ui->fileScenesList->takeItem(index));
|
||||
ui->fileScenesList->setCurrentRow(index - 1);
|
||||
int index = ui->fileSwitches->currentRow();
|
||||
if (!listMoveUp(ui->fileSwitches))
|
||||
return;
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
FileSwitchWidget *s1 = (FileSwitchWidget *)ui->fileSwitches->itemWidget(
|
||||
ui->fileSwitches->item(index));
|
||||
FileSwitchWidget *s2 = (FileSwitchWidget *)ui->fileSwitches->itemWidget(
|
||||
ui->fileSwitches->item(index - 1));
|
||||
FileSwitchWidget::swapSwitchData(s1, s2);
|
||||
|
||||
iter_swap(switcher->fileSwitches.begin() + index,
|
||||
switcher->fileSwitches.begin() + index - 1);
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
|
||||
std::swap(switcher->fileSwitches[index],
|
||||
switcher->fileSwitches[index - 1]);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_fileDown_clicked()
|
||||
{
|
||||
int index = ui->fileScenesList->currentRow();
|
||||
if (index != -1 && index != ui->fileScenesList->count() - 1) {
|
||||
ui->fileScenesList->insertItem(
|
||||
index + 1, ui->fileScenesList->takeItem(index));
|
||||
ui->fileScenesList->setCurrentRow(index + 1);
|
||||
int index = ui->fileSwitches->currentRow();
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
if (!listMoveDown(ui->fileSwitches))
|
||||
return;
|
||||
|
||||
iter_swap(switcher->fileSwitches.begin() + index,
|
||||
switcher->fileSwitches.begin() + index + 1);
|
||||
}
|
||||
FileSwitchWidget *s1 = (FileSwitchWidget *)ui->fileSwitches->itemWidget(
|
||||
ui->fileSwitches->item(index));
|
||||
FileSwitchWidget *s2 = (FileSwitchWidget *)ui->fileSwitches->itemWidget(
|
||||
ui->fileSwitches->item(index + 1));
|
||||
FileSwitchWidget::swapSwitchData(s1, s2);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
|
||||
std::swap(switcher->fileSwitches[index],
|
||||
switcher->fileSwitches[index + 1]);
|
||||
}
|
||||
|
||||
void SwitcherData::saveFileSwitches(obs_data_t *obj)
|
||||
@@ -380,6 +359,8 @@ void SwitcherData::saveFileSwitches(obs_data_t *obj)
|
||||
obs_data_set_bool(array_obj, "remote", s.remote);
|
||||
obs_data_set_bool(array_obj, "useRegex", s.useRegex);
|
||||
obs_data_set_bool(array_obj, "useTime", s.useTime);
|
||||
obs_data_set_bool(array_obj, "onlyMatchIfChanged",
|
||||
s.onlyMatchIfChanged);
|
||||
obs_data_array_push_back(fileArray, array_obj);
|
||||
}
|
||||
obs_source_release(source);
|
||||
@@ -413,11 +394,13 @@ void SwitcherData::loadFileSwitches(obs_data_t *obj)
|
||||
bool remote = obs_data_get_bool(array_obj, "remote");
|
||||
bool useRegex = obs_data_get_bool(array_obj, "useRegex");
|
||||
bool useTime = obs_data_get_bool(array_obj, "useTime");
|
||||
bool onlyMatchIfChanged =
|
||||
obs_data_get_bool(array_obj, "onlyMatchIfChanged");
|
||||
|
||||
switcher->fileSwitches.emplace_back(
|
||||
GetWeakSourceByName(scene),
|
||||
GetWeakTransitionByName(transition), file, text, remote,
|
||||
useRegex, useTime);
|
||||
useRegex, useTime, onlyMatchIfChanged);
|
||||
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
@@ -433,30 +416,27 @@ void SwitcherData::loadFileSwitches(obs_data_t *obj)
|
||||
|
||||
void AdvSceneSwitcher::setupFileTab()
|
||||
{
|
||||
populateSceneSelection(ui->fileScenes, false);
|
||||
populateTransitionSelection(ui->fileTransitions);
|
||||
|
||||
ui->fileType->addItem("local");
|
||||
ui->fileType->addItem("remote");
|
||||
ui->remoteFileWarningLabel->setText(
|
||||
"Note that the scene switcher will try to access the remote location every " +
|
||||
QString::number(switcher->interval) + "ms");
|
||||
obs_module_text("AdvSceneSwitcher.fileTab.remoteFileWarning1") +
|
||||
QString::number(switcher->interval) +
|
||||
obs_module_text("AdvSceneSwitcher.fileTab.remoteFileWarning2"));
|
||||
ui->remoteFileWarningLabel->hide();
|
||||
|
||||
if (switcher->curl)
|
||||
ui->libcurlWarning->setVisible(false);
|
||||
|
||||
for (auto &s : switcher->fileSwitches) {
|
||||
std::string sceneName = GetWeakSourceName(s.scene);
|
||||
std::string transitionName = GetWeakSourceName(s.transition);
|
||||
QString listText = MakeFileSwitchName(
|
||||
sceneName.c_str(), transitionName.c_str(),
|
||||
s.file.c_str(), s.text.c_str(), s.useRegex, s.useTime);
|
||||
|
||||
QListWidgetItem *item =
|
||||
new QListWidgetItem(listText, ui->fileScenesList);
|
||||
item->setData(Qt::UserRole, listText);
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->fileSwitches);
|
||||
ui->fileSwitches->addItem(item);
|
||||
FileSwitchWidget *sw = new FileSwitchWidget(&s);
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->fileSwitches->setItemWidget(item, sw);
|
||||
}
|
||||
|
||||
if (switcher->fileSwitches.size() == 0)
|
||||
addPulse = PulseWidget(ui->fileAdd, QColor(Qt::green));
|
||||
|
||||
ui->readPathLineEdit->setText(
|
||||
QString::fromStdString(switcher->fileIO.readPath.c_str()));
|
||||
ui->readFileCheckBox->setChecked(switcher->fileIO.readEnabled);
|
||||
@@ -472,26 +452,173 @@ void AdvSceneSwitcher::setupFileTab()
|
||||
}
|
||||
}
|
||||
|
||||
static inline QString MakeFileSwitchName(const QString &scene,
|
||||
const QString &transition,
|
||||
const QString &fileName,
|
||||
const QString &text, bool useRegex,
|
||||
bool useTime)
|
||||
FileSwitchWidget::FileSwitchWidget(FileSwitch *s) : SwitchWidget(s, false)
|
||||
{
|
||||
QString switchName = QStringLiteral("Switch to ") + scene +
|
||||
QStringLiteral(" using ") + transition +
|
||||
QStringLiteral(" if ") + fileName;
|
||||
if (useTime)
|
||||
switchName += QStringLiteral(" was modified and");
|
||||
switchName += QStringLiteral(" contains");
|
||||
if (useRegex)
|
||||
switchName += QStringLiteral(" (RegEx): \n\"");
|
||||
else
|
||||
switchName += QStringLiteral(": \n\"");
|
||||
if (text.length() > 30)
|
||||
switchName += text.left(27) + QStringLiteral("...\"");
|
||||
else
|
||||
switchName += text + QStringLiteral("\"");
|
||||
fileType = new QComboBox();
|
||||
filePath = new QLineEdit();
|
||||
browseButton =
|
||||
new QPushButton(obs_module_text("AdvSceneSwitcher.browse"));
|
||||
browseButton->setStyleSheet("border:1px solid gray;");
|
||||
matchText = new QPlainTextEdit();
|
||||
useRegex = new QCheckBox(
|
||||
obs_module_text("AdvSceneSwitcher.fileTab.useRegExp"));
|
||||
checkModificationDate = new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.fileTab.checkfileContentTime"));
|
||||
checkFileContent = new QCheckBox(
|
||||
obs_module_text("AdvSceneSwitcher.fileTab.checkfileContent"));
|
||||
|
||||
return switchName;
|
||||
QWidget::connect(fileType, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(FileTypeChanged(int)));
|
||||
QWidget::connect(filePath, SIGNAL(editingFinished()), this,
|
||||
SLOT(FilePathChanged()));
|
||||
QWidget::connect(browseButton, SIGNAL(clicked()), this,
|
||||
SLOT(BrowseButtonClicked()));
|
||||
QWidget::connect(matchText, SIGNAL(textChanged()), this,
|
||||
SLOT(MatchTextChanged()));
|
||||
QWidget::connect(useRegex, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(UseRegexChanged(int)));
|
||||
QWidget::connect(checkModificationDate, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(CheckModificationDateChanged(int)));
|
||||
QWidget::connect(checkFileContent, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(CheckFileContentChanged(int)));
|
||||
|
||||
fileType->addItem(obs_module_text("AdvSceneSwitcher.fileTab.local"));
|
||||
fileType->addItem(obs_module_text("AdvSceneSwitcher.fileTab.remote"));
|
||||
|
||||
if (s) {
|
||||
if (s->remote)
|
||||
fileType->setCurrentIndex(1);
|
||||
else
|
||||
fileType->setCurrentIndex(0);
|
||||
filePath->setText(QString::fromStdString(s->file));
|
||||
matchText->setPlainText(QString::fromStdString(s->text));
|
||||
useRegex->setChecked(s->useRegex);
|
||||
checkModificationDate->setChecked(s->useTime);
|
||||
checkFileContent->setChecked(s->onlyMatchIfChanged);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{fileType}}", fileType},
|
||||
{"{{filePath}}", filePath},
|
||||
{"{{browseButton}}", browseButton},
|
||||
{"{{matchText}}", matchText},
|
||||
{"{{useRegex}}", useRegex},
|
||||
{"{{checkModificationDate}}", checkModificationDate},
|
||||
{"{{checkFileContent}}", checkFileContent},
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{transitions}}", transitions}};
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
QHBoxLayout *line1Layout = new QHBoxLayout;
|
||||
QHBoxLayout *line2Layout = new QHBoxLayout;
|
||||
QHBoxLayout *line3Layout = new QHBoxLayout;
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.fileTab.entry"),
|
||||
line1Layout, widgetPlaceholders);
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.fileTab.entry2"),
|
||||
line2Layout, widgetPlaceholders, false);
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.fileTab.entry3"),
|
||||
line3Layout, widgetPlaceholders);
|
||||
mainLayout->addLayout(line1Layout);
|
||||
mainLayout->addLayout(line2Layout);
|
||||
mainLayout->addLayout(line3Layout);
|
||||
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
loading = false;
|
||||
}
|
||||
|
||||
FileSwitch *FileSwitchWidget::getSwitchData()
|
||||
{
|
||||
return switchData;
|
||||
}
|
||||
|
||||
void FileSwitchWidget::setSwitchData(FileSwitch *s)
|
||||
{
|
||||
switchData = s;
|
||||
}
|
||||
|
||||
void FileSwitchWidget::swapSwitchData(FileSwitchWidget *s1,
|
||||
FileSwitchWidget *s2)
|
||||
{
|
||||
SwitchWidget::swapSwitchData(s1, s2);
|
||||
|
||||
FileSwitch *t = s1->getSwitchData();
|
||||
s1->setSwitchData(s2->getSwitchData());
|
||||
s2->setSwitchData(t);
|
||||
}
|
||||
|
||||
void FileSwitchWidget::FileTypeChanged(int index)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
|
||||
if ((file_type)index == LOCAL) {
|
||||
browseButton->setDisabled(false);
|
||||
checkModificationDate->setDisabled(false);
|
||||
} else {
|
||||
browseButton->setDisabled(true);
|
||||
checkModificationDate->setDisabled(true);
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->remote = (file_type)index == REMOTE;
|
||||
}
|
||||
|
||||
void FileSwitchWidget::FilePathChanged()
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->file = filePath->text().toUtf8().constData();
|
||||
}
|
||||
|
||||
void FileSwitchWidget::BrowseButtonClicked()
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr(obs_module_text("AdvSceneSwitcher.fileTab.selectRead")),
|
||||
QDir::currentPath(),
|
||||
tr(obs_module_text("AdvSceneSwitcher.fileTab.anyFileType")));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
filePath->setText(path);
|
||||
FilePathChanged();
|
||||
}
|
||||
|
||||
void FileSwitchWidget::MatchTextChanged()
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->text = matchText->toPlainText().toUtf8().constData();
|
||||
}
|
||||
|
||||
void FileSwitchWidget::UseRegexChanged(int state)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->useRegex = state;
|
||||
}
|
||||
|
||||
void FileSwitchWidget::CheckModificationDateChanged(int state)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->useTime = state;
|
||||
}
|
||||
|
||||
void FileSwitchWidget::CheckFileContentChanged(int state)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->onlyMatchIfChanged = state;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,12 @@ SwitchWidget::SwitchWidget(SceneSwitcherEntry *s, bool usePreviousScene)
|
||||
scenes = new QComboBox();
|
||||
transitions = new QComboBox();
|
||||
|
||||
// Depending on selected OBS theme some widgets might have a different
|
||||
// background color than the listwidget and might look out of place
|
||||
setStyleSheet("QLabel { background-color: transparent; }\
|
||||
QSlider { background-color: transparent; }\
|
||||
QCheckBox { background-color: transparent; }");
|
||||
|
||||
QWidget::connect(scenes, SIGNAL(currentTextChanged(const QString &)),
|
||||
this, SLOT(SceneChanged(const QString &)));
|
||||
QWidget::connect(transitions,
|
||||
@@ -41,7 +47,8 @@ SwitchWidget::SwitchWidget(SceneSwitcherEntry *s, bool usePreviousScene)
|
||||
|
||||
if (s) {
|
||||
if (s->usePreviousScene)
|
||||
scenes->setCurrentText(previous_scene_name);
|
||||
scenes->setCurrentText(obs_module_text(
|
||||
"AdvSceneSwitcher.selectPreviousScene"));
|
||||
else
|
||||
scenes->setCurrentText(
|
||||
GetWeakSourceName(s->scene).c_str());
|
||||
@@ -69,12 +76,18 @@ void SwitchWidget::swapSwitchData(SwitchWidget *s1, SwitchWidget *s2)
|
||||
s2->setSwitchData(t);
|
||||
}
|
||||
|
||||
bool isPreviousScene(const QString &text)
|
||||
{
|
||||
return text.compare(obs_module_text(
|
||||
"AdvSceneSwitcher.selectPreviousScene")) == 0;
|
||||
}
|
||||
|
||||
void SwitchWidget::SceneChanged(const QString &text)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->usePreviousScene = text.compare(previous_scene_name) == 0;
|
||||
switchData->usePreviousScene = isPreviousScene(text);
|
||||
if (switchData->usePreviousScene)
|
||||
return;
|
||||
switchData->scene = GetWeakSourceByQString(text);
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool IdleData::pause = false;
|
||||
|
||||
void SwitcherData::checkIdleSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (!idleData.idleEnable)
|
||||
if (!idleData.idleEnable || IdleData::pause)
|
||||
return;
|
||||
|
||||
std::string title;
|
||||
@@ -83,7 +85,9 @@ void AdvSceneSwitcher::UpdateIdleDataTransition(const QString &name)
|
||||
|
||||
void AdvSceneSwitcher::UpdateIdleDataScene(const QString &name)
|
||||
{
|
||||
switcher->idleData.usePreviousScene = (name == previous_scene_name);
|
||||
switcher->idleData.usePreviousScene =
|
||||
(name ==
|
||||
obs_module_text("AdvSceneSwitcher.selectPreviousScene"));
|
||||
obs_source_t *scene = obs_get_source_by_name(name.toUtf8().constData());
|
||||
obs_weak_source_t *ws = obs_source_get_weak_source(scene);
|
||||
|
||||
@@ -280,10 +284,13 @@ void AdvSceneSwitcher::setupIdleTab()
|
||||
}
|
||||
|
||||
ui->idleCheckBox->setChecked(switcher->idleData.idleEnable);
|
||||
ui->idleScenes->setCurrentText(
|
||||
switcher->idleData.usePreviousScene
|
||||
? previous_scene_name
|
||||
: GetWeakSourceName(switcher->idleData.scene).c_str());
|
||||
if (switcher->idleData.usePreviousScene) {
|
||||
ui->idleScenes->setCurrentText(obs_module_text(
|
||||
"AdvSceneSwitcher.selectPreviousScene"));
|
||||
} else {
|
||||
ui->idleScenes->setCurrentText(
|
||||
GetWeakSourceName(switcher->idleData.scene).c_str());
|
||||
}
|
||||
ui->idleTransitions->setCurrentText(
|
||||
GetWeakSourceName(switcher->idleData.transition).c_str());
|
||||
ui->idleSpinBox->setValue(switcher->idleData.time);
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool MediaSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
constexpr auto media_played_to_end_idx = 8;
|
||||
constexpr auto media_any_idx = 9;
|
||||
|
||||
void AdvSceneSwitcher::on_mediaAdd_clicked()
|
||||
{
|
||||
ui->mediaAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->mediaSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->mediaSwitches);
|
||||
ui->mediaSwitches->addItem(item);
|
||||
MediaSwitchWidget *sw =
|
||||
new MediaSwitchWidget(&switcher->mediaSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->mediaSwitches->setItemWidget(item, sw);
|
||||
listAddClicked(ui->mediaSwitches,
|
||||
new MediaSwitchWidget(&switcher->mediaSwitches.back()),
|
||||
ui->mediaAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_mediaRemove_clicked()
|
||||
@@ -79,6 +77,9 @@ void AdvSceneSwitcher::on_mediaDown_clicked()
|
||||
void SwitcherData::checkMediaSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (MediaSwitch::pause)
|
||||
return;
|
||||
|
||||
for (MediaSwitch &mediaSwitch : mediaSwitches) {
|
||||
if (!mediaSwitch.initialized())
|
||||
continue;
|
||||
@@ -110,22 +111,41 @@ void SwitcherData::checkMediaSwitch(bool &match, OBSWeakSource &scene,
|
||||
// bool matchedEnded = mediaSwitch.state == OBS_MEDIA_STATE_ENDED &&
|
||||
// mediaSwitch.ended;
|
||||
|
||||
bool matchedEnded = false;
|
||||
bool ended = false;
|
||||
|
||||
if (state == OBS_MEDIA_STATE_ENDED) {
|
||||
matchedEnded = mediaSwitch.previousStateEnded;
|
||||
ended = mediaSwitch.previousStateEnded;
|
||||
mediaSwitch.previousStateEnded = true;
|
||||
} else {
|
||||
mediaSwitch.previousStateEnded = false;
|
||||
}
|
||||
|
||||
bool matchedEnded =
|
||||
ended && (mediaSwitch.state == OBS_MEDIA_STATE_ENDED);
|
||||
|
||||
// match if playedToEnd was true in last interval
|
||||
// and playback is currently ended
|
||||
bool matchedPlayedToEnd = mediaSwitch.state ==
|
||||
media_played_to_end_idx &&
|
||||
mediaSwitch.playedToEnd && ended;
|
||||
|
||||
// interval * 2 to make sure not to miss any state changes
|
||||
// which happened during check of the conditions
|
||||
mediaSwitch.playedToEnd = mediaSwitch.playedToEnd ||
|
||||
(duration - time <= interval * 2);
|
||||
|
||||
// reset
|
||||
if (ended)
|
||||
mediaSwitch.playedToEnd = false;
|
||||
|
||||
// reset for next check
|
||||
mediaSwitch.stopped = false;
|
||||
mediaSwitch.ended = false;
|
||||
|
||||
bool matchedState = ((state == mediaSwitch.state) ||
|
||||
mediaSwitch.anyState) ||
|
||||
matchedStopped || matchedEnded;
|
||||
matchedStopped || matchedEnded ||
|
||||
matchedPlayedToEnd;
|
||||
|
||||
bool matchedTimeNone =
|
||||
(mediaSwitch.restriction == TIME_RESTRICTION_NONE);
|
||||
@@ -151,7 +171,7 @@ void SwitcherData::checkMediaSwitch(bool &match, OBSWeakSource &scene,
|
||||
|
||||
bool matched = matchedState && matchedTime;
|
||||
|
||||
if (matched) {
|
||||
if (matched && !mediaSwitch.matched) {
|
||||
match = true;
|
||||
scene = (mediaSwitch.usePreviousScene)
|
||||
? previousScene
|
||||
@@ -160,8 +180,12 @@ void SwitcherData::checkMediaSwitch(bool &match, OBSWeakSource &scene,
|
||||
|
||||
if (verbose)
|
||||
mediaSwitch.logMatch();
|
||||
break;
|
||||
}
|
||||
|
||||
mediaSwitch.matched = matched;
|
||||
|
||||
if (match)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +328,7 @@ inline MediaSwitch::MediaSwitch(OBSWeakSource scene_, OBSWeakSource source_,
|
||||
restriction(restriction_),
|
||||
time(time_)
|
||||
{
|
||||
anyState = state > 7;
|
||||
anyState = state == media_any_idx;
|
||||
obs_source_t *mediasource = obs_weak_source_get_source(source);
|
||||
signal_handler_t *sh = obs_source_get_signal_handler(mediasource);
|
||||
signal_handler_connect(sh, "media_stopped", MediaStopped, this);
|
||||
@@ -320,7 +344,7 @@ MediaSwitch::MediaSwitch(const MediaSwitch &other)
|
||||
restriction(other.restriction),
|
||||
time(other.time)
|
||||
{
|
||||
anyState = state > 7;
|
||||
anyState = state == media_any_idx;
|
||||
obs_source_t *mediasource = obs_weak_source_get_source(source);
|
||||
signal_handler_t *sh = obs_source_get_signal_handler(mediasource);
|
||||
signal_handler_connect(sh, "media_stopped", MediaStopped, this);
|
||||
@@ -388,44 +412,52 @@ void swap(MediaSwitch &first, MediaSwitch &second)
|
||||
|
||||
void populateMediaStates(QComboBox *list)
|
||||
{
|
||||
list->addItem("None");
|
||||
list->addItem("Playing");
|
||||
list->addItem("Opening");
|
||||
list->addItem("Buffering");
|
||||
list->addItem("Paused");
|
||||
list->addItem("Stopped");
|
||||
list->addItem("Ended");
|
||||
list->addItem("Error");
|
||||
list->addItem("Any");
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.mediaTab.states.none"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.mediaTab.states.playing"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.mediaTab.states.opening"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.mediaTab.states.buffering"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.mediaTab.states.paused"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.mediaTab.states.stopped"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.mediaTab.states.ended"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.mediaTab.states.error"));
|
||||
list->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.mediaTab.states.playedToEnd"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.mediaTab.states.any"));
|
||||
}
|
||||
|
||||
void populateTimeRestrictions(QComboBox *list)
|
||||
{
|
||||
list->addItem("None");
|
||||
list->addItem("Time shorter");
|
||||
list->addItem("Time longer");
|
||||
list->addItem("Time remaining shorter");
|
||||
list->addItem("Time remaining longer");
|
||||
list->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.mediaTab.timeRestriction.none"));
|
||||
list->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.mediaTab.timeRestriction.shorter"));
|
||||
list->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.mediaTab.timeRestriction.longer"));
|
||||
list->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.mediaTab.timeRestriction.remainShorter"));
|
||||
list->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.mediaTab.timeRestriction.remainLonger"));
|
||||
}
|
||||
|
||||
MediaSwitchWidget::MediaSwitchWidget(MediaSwitch *s) : SwitchWidget(s)
|
||||
{
|
||||
meidaSources = new QComboBox();
|
||||
mediaSources = new QComboBox();
|
||||
states = new QComboBox();
|
||||
timeRestrictions = new QComboBox();
|
||||
time = new QSpinBox();
|
||||
|
||||
whenLabel = new QLabel("When");
|
||||
stateLabel = new QLabel("state is");
|
||||
andLabel = new QLabel("and");
|
||||
switchLabel = new QLabel("switch to");
|
||||
usingLabel = new QLabel("using");
|
||||
|
||||
time->setSuffix("ms");
|
||||
time->setMaximum(99999999);
|
||||
time->setMinimum(0);
|
||||
|
||||
QWidget::connect(meidaSources,
|
||||
QWidget::connect(mediaSources,
|
||||
SIGNAL(currentTextChanged(const QString &)), this,
|
||||
SLOT(SourceChanged(const QString &)));
|
||||
QWidget::connect(states, SIGNAL(currentIndexChanged(int)), this,
|
||||
@@ -435,12 +467,12 @@ MediaSwitchWidget::MediaSwitchWidget(MediaSwitch *s) : SwitchWidget(s)
|
||||
QWidget::connect(time, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(TimeChanged(int)));
|
||||
|
||||
AdvSceneSwitcher::populateMediaSelection(meidaSources);
|
||||
AdvSceneSwitcher::populateMediaSelection(mediaSources);
|
||||
populateMediaStates(states);
|
||||
populateTimeRestrictions(timeRestrictions);
|
||||
|
||||
if (s) {
|
||||
meidaSources->setCurrentText(
|
||||
mediaSources->setCurrentText(
|
||||
GetWeakSourceName(s->source).c_str());
|
||||
states->setCurrentIndex(s->state);
|
||||
timeRestrictions->setCurrentIndex(s->restriction);
|
||||
@@ -449,23 +481,16 @@ MediaSwitchWidget::MediaSwitchWidget(MediaSwitch *s) : SwitchWidget(s)
|
||||
time->setDisabled(true);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(whenLabel);
|
||||
mainLayout->addWidget(meidaSources);
|
||||
mainLayout->addWidget(stateLabel);
|
||||
mainLayout->addWidget(states);
|
||||
mainLayout->addWidget(andLabel);
|
||||
mainLayout->addWidget(timeRestrictions);
|
||||
mainLayout->addWidget(time);
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(usingLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{mediaSources}}", mediaSources},
|
||||
{"{{states}}", states},
|
||||
{"{{timeRestrictions}}", timeRestrictions},
|
||||
{"{{time}}", time},
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{transitions}}", transitions}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.mediaTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
@@ -509,7 +534,7 @@ void MediaSwitchWidget::StateChanged(int index)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->state = (obs_media_state)index;
|
||||
switchData->anyState = switchData->state > 7;
|
||||
switchData->anyState = switchData->state == media_any_idx;
|
||||
}
|
||||
|
||||
void MediaSwitchWidget::TimeRestrictionChanged(int index)
|
||||
|
||||
@@ -3,264 +3,265 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
void AdvSceneSwitcher::on_pauseScenesAdd_clicked()
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void AdvSceneSwitcher::on_pauseAdd_clicked()
|
||||
{
|
||||
QString sceneName = ui->pauseScenesScenes->currentText();
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->pauseEntries.emplace_back();
|
||||
|
||||
if (sceneName.isEmpty())
|
||||
return;
|
||||
|
||||
OBSWeakSource source = GetWeakSourceByQString(sceneName);
|
||||
QVariant v = QVariant::fromValue(sceneName);
|
||||
|
||||
QList<QListWidgetItem *> items =
|
||||
ui->pauseScenes->findItems(sceneName, Qt::MatchExactly);
|
||||
|
||||
if (items.size() == 0) {
|
||||
QListWidgetItem *item =
|
||||
new QListWidgetItem(sceneName, ui->pauseScenes);
|
||||
item->setData(Qt::UserRole, v);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->pauseScenesSwitches.emplace_back(source);
|
||||
ui->pauseScenes->sortItems();
|
||||
}
|
||||
listAddClicked(ui->pauseEntries,
|
||||
new PauseEntryWidget(&switcher->pauseEntries.back()),
|
||||
ui->pauseAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_pauseScenesRemove_clicked()
|
||||
void AdvSceneSwitcher::on_pauseRemove_clicked()
|
||||
{
|
||||
QListWidgetItem *item = ui->pauseScenes->currentItem();
|
||||
QListWidgetItem *item = ui->pauseEntries->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
QString pauseScene = item->data(Qt::UserRole).toString();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
auto &switches = switcher->pauseScenesSwitches;
|
||||
|
||||
for (auto it = switches.begin(); it != switches.end(); ++it) {
|
||||
auto &s = *it;
|
||||
|
||||
if (s == GetWeakSourceByQString(pauseScene)) {
|
||||
switches.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
int idx = ui->pauseEntries->currentRow();
|
||||
auto &switches = switcher->pauseEntries;
|
||||
switches.erase(switches.begin() + idx);
|
||||
}
|
||||
|
||||
delete item;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_pauseWindowsAdd_clicked()
|
||||
void AdvSceneSwitcher::on_pauseUp_clicked()
|
||||
{
|
||||
QString windowName = ui->pauseWindowsWindows->currentText();
|
||||
|
||||
if (windowName.isEmpty())
|
||||
int index = ui->pauseEntries->currentRow();
|
||||
if (!listMoveUp(ui->pauseEntries))
|
||||
return;
|
||||
|
||||
QVariant v = QVariant::fromValue(windowName);
|
||||
|
||||
QList<QListWidgetItem *> items =
|
||||
ui->pauseWindows->findItems(windowName, Qt::MatchExactly);
|
||||
|
||||
if (items.size() == 0) {
|
||||
QListWidgetItem *item =
|
||||
new QListWidgetItem(windowName, ui->pauseWindows);
|
||||
item->setData(Qt::UserRole, v);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->pauseWindowsSwitches.emplace_back(
|
||||
windowName.toUtf8().constData());
|
||||
ui->pauseWindows->sortItems();
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_pauseWindowsRemove_clicked()
|
||||
{
|
||||
QListWidgetItem *item = ui->pauseWindows->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
QString windowName = item->data(Qt::UserRole).toString();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
auto &switches = switcher->pauseWindowsSwitches;
|
||||
|
||||
for (auto it = switches.begin(); it != switches.end(); ++it) {
|
||||
auto &s = *it;
|
||||
|
||||
if (s == windowName.toUtf8().constData()) {
|
||||
switches.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete item;
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_pauseScenes_currentRowChanged(int idx)
|
||||
{
|
||||
if (loading)
|
||||
return;
|
||||
if (idx == -1)
|
||||
return;
|
||||
|
||||
QListWidgetItem *item = ui->pauseScenes->item(idx);
|
||||
|
||||
QString scene = item->data(Qt::UserRole).toString();
|
||||
PauseEntryWidget *s1 = (PauseEntryWidget *)ui->pauseEntries->itemWidget(
|
||||
ui->pauseEntries->item(index));
|
||||
PauseEntryWidget *s2 = (PauseEntryWidget *)ui->pauseEntries->itemWidget(
|
||||
ui->pauseEntries->item(index - 1));
|
||||
PauseEntryWidget::swapSwitchData(s1, s2);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
for (auto &s : switcher->pauseScenesSwitches) {
|
||||
std::string name = GetWeakSourceName(s);
|
||||
if (scene.compare(name.c_str()) == 0) {
|
||||
ui->pauseScenesScenes->setCurrentText(name.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::swap(switcher->pauseEntries[index],
|
||||
switcher->pauseEntries[index - 1]);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_pauseWindows_currentRowChanged(int idx)
|
||||
void AdvSceneSwitcher::on_pauseDown_clicked()
|
||||
{
|
||||
if (loading)
|
||||
return;
|
||||
if (idx == -1)
|
||||
int index = ui->pauseEntries->currentRow();
|
||||
|
||||
if (!listMoveDown(ui->pauseEntries))
|
||||
return;
|
||||
|
||||
QListWidgetItem *item = ui->pauseWindows->item(idx);
|
||||
|
||||
QString window = item->data(Qt::UserRole).toString();
|
||||
PauseEntryWidget *s1 = (PauseEntryWidget *)ui->pauseEntries->itemWidget(
|
||||
ui->pauseEntries->item(index));
|
||||
PauseEntryWidget *s2 = (PauseEntryWidget *)ui->pauseEntries->itemWidget(
|
||||
ui->pauseEntries->item(index + 1));
|
||||
PauseEntryWidget::swapSwitchData(s1, s2);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
for (auto &s : switcher->pauseWindowsSwitches) {
|
||||
if (window.compare(s.c_str()) == 0) {
|
||||
ui->pauseWindowsWindows->setCurrentText(s.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
std::swap(switcher->pauseEntries[index],
|
||||
switcher->pauseEntries[index + 1]);
|
||||
}
|
||||
|
||||
void resetPause()
|
||||
{
|
||||
DefaultSceneTransition::pause = false;
|
||||
WindowSwitch::pause = false;
|
||||
ExecutableSwitch::pause = false;
|
||||
ScreenRegionSwitch::pause = false;
|
||||
MediaSwitch::pause = false;
|
||||
FileSwitch::pause = false;
|
||||
RandomSwitch::pause = false;
|
||||
TimeSwitch::pause = false;
|
||||
IdleData::pause = false;
|
||||
SceneSequenceSwitch::pause = false;
|
||||
AudioSwitch::pause = false;
|
||||
}
|
||||
|
||||
void setPauseTarget(PauseTarget &target, bool &verbose)
|
||||
{
|
||||
switch (target) {
|
||||
case PauseTarget::All:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause all switching");
|
||||
break;
|
||||
case PauseTarget::Transition:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause def_transition switching");
|
||||
DefaultSceneTransition::pause = true;
|
||||
break;
|
||||
case PauseTarget::Window:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause window switching");
|
||||
WindowSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::Executable:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause exec switching");
|
||||
ExecutableSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::Region:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause region switching");
|
||||
ScreenRegionSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::Media:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause media switching");
|
||||
MediaSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::File:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause file switching");
|
||||
FileSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::Random:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause random switching");
|
||||
RandomSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::Time:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause time switching");
|
||||
TimeSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::Idle:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause idle switching");
|
||||
IdleData::pause = true;
|
||||
break;
|
||||
case PauseTarget::Sequence:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause sequence switching");
|
||||
SceneSequenceSwitch::pause = true;
|
||||
break;
|
||||
case PauseTarget::Audio:
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "pause audio switching");
|
||||
AudioSwitch::pause = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int AdvSceneSwitcher::PauseScenesFindByData(const QString &scene)
|
||||
bool checkPauseScene(obs_weak_source_t *currentScene, obs_weak_source_t *scene,
|
||||
PauseTarget &target, bool &verbose)
|
||||
{
|
||||
int count = ui->pauseScenes->count();
|
||||
int idx = -1;
|
||||
if (currentScene != scene)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
QListWidgetItem *item = ui->pauseScenes->item(i);
|
||||
QString itemRegion = item->data(Qt::UserRole).toString();
|
||||
|
||||
if (itemRegion == scene) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return idx;
|
||||
setPauseTarget(target, verbose);
|
||||
if (target == PauseTarget::All)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int AdvSceneSwitcher::PauseWindowsFindByData(const QString &window)
|
||||
bool checkPauseWindow(std::string ¤tTitle, std::string &title,
|
||||
PauseTarget &target, bool &verbose)
|
||||
{
|
||||
int count = ui->pauseWindows->count();
|
||||
int idx = -1;
|
||||
if (currentTitle != title)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
QListWidgetItem *item = ui->pauseWindows->item(i);
|
||||
QString itemRegion = item->data(Qt::UserRole).toString();
|
||||
|
||||
if (itemRegion == window) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return idx;
|
||||
setPauseTarget(target, verbose);
|
||||
if (target == PauseTarget::All)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SwitcherData::checkPause()
|
||||
{
|
||||
bool pause = false;
|
||||
bool pauseAll = false;
|
||||
|
||||
std::string title;
|
||||
GetCurrentWindowTitle(title);
|
||||
|
||||
resetPause();
|
||||
|
||||
obs_source_t *currentSource = obs_frontend_get_current_scene();
|
||||
obs_weak_source_t *ws = obs_source_get_weak_source(currentSource);
|
||||
|
||||
for (OBSWeakSource &s : pauseScenesSwitches) {
|
||||
if (s == ws) {
|
||||
pause = true;
|
||||
for (PauseEntry &s : pauseEntries) {
|
||||
if (s.pauseType == PauseType::Scene)
|
||||
pauseAll = checkPauseScene(ws, s.scene, s.pauseTarget,
|
||||
verbose);
|
||||
else
|
||||
pauseAll = checkPauseWindow(title, s.window,
|
||||
s.pauseTarget, verbose);
|
||||
if (pauseAll)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
obs_source_release(currentSource);
|
||||
obs_weak_source_release(ws);
|
||||
|
||||
std::string title;
|
||||
if (!pause) {
|
||||
//lock.unlock();
|
||||
GetCurrentWindowTitle(title);
|
||||
//lock.lock();
|
||||
for (std::string &window : pauseWindowsSwitches) {
|
||||
if (window == title) {
|
||||
pause = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!pause) {
|
||||
//lock.unlock();
|
||||
GetCurrentWindowTitle(title);
|
||||
//lock.lock();
|
||||
for (std::string &window : pauseWindowsSwitches) {
|
||||
try {
|
||||
bool matches = std::regex_match(
|
||||
title, std::regex(window));
|
||||
if (matches) {
|
||||
pause = true;
|
||||
break;
|
||||
}
|
||||
} catch (const std::regex_error &) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose && pause)
|
||||
blog(LOG_INFO, "pause match");
|
||||
|
||||
return pause;
|
||||
return pauseAll;
|
||||
}
|
||||
|
||||
void SwitcherData::savePauseSwitches(obs_data_t *obj)
|
||||
{
|
||||
obs_data_array_t *pauseScenesArray = obs_data_array_create();
|
||||
for (OBSWeakSource &scene : switcher->pauseScenesSwitches) {
|
||||
for (PauseEntry &s : switcher->pauseEntries) {
|
||||
obs_data_t *array_obj = obs_data_create();
|
||||
|
||||
obs_source_t *source = obs_weak_source_get_source(scene);
|
||||
obs_data_set_int(array_obj, "pauseType",
|
||||
static_cast<int>(s.pauseType));
|
||||
obs_data_set_int(array_obj, "pauseTarget",
|
||||
static_cast<int>(s.pauseTarget));
|
||||
obs_data_set_string(array_obj, "pauseWindow", s.window.c_str());
|
||||
|
||||
obs_source_t *source = obs_weak_source_get_source(s.scene);
|
||||
if (source) {
|
||||
const char *n = obs_source_get_name(source);
|
||||
obs_data_set_string(array_obj, "pauseScene", n);
|
||||
obs_data_array_push_back(pauseScenesArray, array_obj);
|
||||
}
|
||||
|
||||
obs_data_array_push_back(pauseScenesArray, array_obj);
|
||||
|
||||
obs_source_release(source);
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_set_array(obj, "pauseScenes", pauseScenesArray);
|
||||
obs_data_set_array(obj, "pauseEntries", pauseScenesArray);
|
||||
obs_data_set_int(obj, "oldPauseValuesImported", 1);
|
||||
obs_data_array_release(pauseScenesArray);
|
||||
|
||||
obs_data_array_t *pauseWindowsArray = obs_data_array_create();
|
||||
for (std::string &window : switcher->pauseWindowsSwitches) {
|
||||
obs_data_t *array_obj = obs_data_create();
|
||||
obs_data_set_string(array_obj, "pauseWindow", window.c_str());
|
||||
obs_data_array_push_back(pauseWindowsArray, array_obj);
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_set_array(obj, "pauseWindows", pauseWindowsArray);
|
||||
obs_data_array_release(pauseWindowsArray);
|
||||
}
|
||||
|
||||
void SwitcherData::loadPauseSwitches(obs_data_t *obj)
|
||||
{
|
||||
switcher->pauseScenesSwitches.clear();
|
||||
switcher->pauseEntries.clear();
|
||||
|
||||
// To be removed in future builds once most users have migrated
|
||||
loadOldPauseSwitches(obj);
|
||||
|
||||
obs_data_array_t *pauseArray = obs_data_get_array(obj, "pauseEntries");
|
||||
size_t count = obs_data_array_count(pauseArray);
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
obs_data_t *array_obj = obs_data_array_item(pauseArray, i);
|
||||
|
||||
PauseType type = static_cast<PauseType>(
|
||||
obs_data_get_int(array_obj, "pauseType"));
|
||||
PauseTarget target = static_cast<PauseTarget>(
|
||||
obs_data_get_int(array_obj, "pauseTarget"));
|
||||
const char *scene =
|
||||
obs_data_get_string(array_obj, "pauseScene");
|
||||
const char *window =
|
||||
obs_data_get_string(array_obj, "pauseWindow");
|
||||
|
||||
switcher->pauseEntries.emplace_back(GetWeakSourceByName(scene),
|
||||
type, target, window);
|
||||
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_array_release(pauseArray);
|
||||
}
|
||||
|
||||
void SwitcherData::loadOldPauseSwitches(obs_data_t *obj)
|
||||
{
|
||||
if (obs_data_get_int(obj, "oldPauseValuesImported"))
|
||||
return;
|
||||
|
||||
obs_data_array_t *pauseScenesArray =
|
||||
obs_data_get_array(obj, "pauseScenes");
|
||||
@@ -273,15 +274,14 @@ void SwitcherData::loadPauseSwitches(obs_data_t *obj)
|
||||
const char *scene =
|
||||
obs_data_get_string(array_obj, "pauseScene");
|
||||
|
||||
switcher->pauseScenesSwitches.emplace_back(
|
||||
GetWeakSourceByName(scene));
|
||||
switcher->pauseEntries.emplace_back(GetWeakSourceByName(scene),
|
||||
PauseType::Scene,
|
||||
PauseTarget::All, "");
|
||||
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_array_release(pauseScenesArray);
|
||||
|
||||
switcher->pauseWindowsSwitches.clear();
|
||||
|
||||
obs_data_array_t *pauseWindowsArray =
|
||||
obs_data_get_array(obj, "pauseWindows");
|
||||
count = obs_data_array_count(pauseWindowsArray);
|
||||
@@ -293,7 +293,8 @@ void SwitcherData::loadPauseSwitches(obs_data_t *obj)
|
||||
const char *window =
|
||||
obs_data_get_string(array_obj, "pauseWindow");
|
||||
|
||||
switcher->pauseWindowsSwitches.emplace_back(window);
|
||||
switcher->pauseEntries.emplace_back(nullptr, PauseType::Window,
|
||||
PauseTarget::All, window);
|
||||
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
@@ -302,23 +303,153 @@ void SwitcherData::loadPauseSwitches(obs_data_t *obj)
|
||||
|
||||
void AdvSceneSwitcher::setupPauseTab()
|
||||
{
|
||||
populateSceneSelection(ui->pauseScenesScenes, false);
|
||||
populateWindowSelection(ui->pauseWindowsWindows);
|
||||
|
||||
for (auto &scene : switcher->pauseScenesSwitches) {
|
||||
std::string sceneName = GetWeakSourceName(scene);
|
||||
QString text = QString::fromStdString(sceneName);
|
||||
|
||||
QListWidgetItem *item =
|
||||
new QListWidgetItem(text, ui->pauseScenes);
|
||||
item->setData(Qt::UserRole, text);
|
||||
for (auto &s : switcher->pauseEntries) {
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->pauseEntries);
|
||||
ui->pauseEntries->addItem(item);
|
||||
PauseEntryWidget *sw = new PauseEntryWidget(&s);
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->pauseEntries->setItemWidget(item, sw);
|
||||
}
|
||||
|
||||
for (auto &window : switcher->pauseWindowsSwitches) {
|
||||
QString text = QString::fromStdString(window);
|
||||
if (switcher->pauseEntries.size() == 0)
|
||||
addPulse = PulseWidget(ui->pauseAdd, QColor(Qt::green));
|
||||
}
|
||||
|
||||
QListWidgetItem *item =
|
||||
new QListWidgetItem(text, ui->pauseWindows);
|
||||
item->setData(Qt::UserRole, text);
|
||||
void populatePauseTypes(QComboBox *list)
|
||||
{
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.pauseTab.pauseTypeScene"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.pauseTab.pauseTypeWindow"));
|
||||
}
|
||||
|
||||
void populatePauseTargets(QComboBox *list)
|
||||
{
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.pauseTab.pauseTargetAll"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.transitionTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.windowTitleTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.executableTab.title"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.screenRegionTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.mediaTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.fileTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.randomTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.idleTab.title"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.sceneSequenceTab.title"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.audioTab.title"));
|
||||
}
|
||||
|
||||
PauseEntryWidget::PauseEntryWidget(PauseEntry *s) : SwitchWidget(s, false)
|
||||
{
|
||||
pauseTypes = new QComboBox();
|
||||
pauseTargets = new QComboBox();
|
||||
windows = new QComboBox();
|
||||
|
||||
QWidget::connect(pauseTypes, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(PauseTypeChanged(int)));
|
||||
QWidget::connect(pauseTargets, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(PauseTargetChanged(int)));
|
||||
QWidget::connect(windows, SIGNAL(currentTextChanged(const QString &)),
|
||||
this, SLOT(WindowChanged(const QString &)));
|
||||
|
||||
populatePauseTypes(pauseTypes);
|
||||
populatePauseTargets(pauseTargets);
|
||||
AdvSceneSwitcher::populateWindowSelection(windows);
|
||||
|
||||
windows->setEditable(true);
|
||||
windows->setMaxVisibleItems(20);
|
||||
|
||||
if (s) {
|
||||
scenes->setCurrentText(GetWeakSourceName(s->scene).c_str());
|
||||
pauseTypes->setCurrentIndex(static_cast<int>(s->pauseType));
|
||||
pauseTargets->setCurrentIndex(static_cast<int>(s->pauseTarget));
|
||||
windows->setCurrentText(s->window.c_str());
|
||||
if (s->pauseType == PauseType::Scene) {
|
||||
windows->setDisabled(true);
|
||||
windows->setVisible(false);
|
||||
} else {
|
||||
scenes->setDisabled(true);
|
||||
scenes->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{pauseTypes}}", pauseTypes},
|
||||
{"{{pauseTargets}}", pauseTargets},
|
||||
{"{{windows}}", windows}};
|
||||
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.pauseTab.pauseEntry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
loading = false;
|
||||
}
|
||||
|
||||
PauseEntry *PauseEntryWidget::getSwitchData()
|
||||
{
|
||||
return switchData;
|
||||
}
|
||||
|
||||
void PauseEntryWidget::setSwitchData(PauseEntry *s)
|
||||
{
|
||||
switchData = s;
|
||||
}
|
||||
|
||||
void PauseEntryWidget::swapSwitchData(PauseEntryWidget *s1,
|
||||
PauseEntryWidget *s2)
|
||||
{
|
||||
SwitchWidget::swapSwitchData(s1, s2);
|
||||
|
||||
PauseEntry *t = s1->getSwitchData();
|
||||
s1->setSwitchData(s2->getSwitchData());
|
||||
s2->setSwitchData(t);
|
||||
}
|
||||
|
||||
void PauseEntryWidget::PauseTypeChanged(int index)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->pauseType = static_cast<PauseType>(index);
|
||||
|
||||
if (switchData->pauseType == PauseType::Scene) {
|
||||
windows->setDisabled(true);
|
||||
windows->setVisible(false);
|
||||
scenes->setDisabled(false);
|
||||
scenes->setVisible(true);
|
||||
} else {
|
||||
scenes->setDisabled(true);
|
||||
scenes->setVisible(false);
|
||||
windows->setDisabled(false);
|
||||
windows->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
void PauseEntryWidget::PauseTargetChanged(int index)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->pauseTarget = static_cast<PauseTarget>(index);
|
||||
}
|
||||
|
||||
void PauseEntryWidget::WindowChanged(const QString &text)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->window = text.toStdString();
|
||||
}
|
||||
|
||||
bool PauseEntry::valid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,17 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool RandomSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void AdvSceneSwitcher::on_randomAdd_clicked()
|
||||
{
|
||||
ui->randomAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->randomSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->randomSwitches);
|
||||
ui->randomSwitches->addItem(item);
|
||||
RandomSwitchWidget *sw =
|
||||
new RandomSwitchWidget(&switcher->randomSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->randomSwitches->setItemWidget(item, sw);
|
||||
listAddClicked(ui->randomSwitches,
|
||||
new RandomSwitchWidget(&switcher->randomSwitches.back()),
|
||||
ui->randomAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_randomRemove_clicked()
|
||||
@@ -40,7 +35,7 @@ void AdvSceneSwitcher::on_randomRemove_clicked()
|
||||
void SwitcherData::checkRandom(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition, int &delay)
|
||||
{
|
||||
if (randomSwitches.size() == 0)
|
||||
if (randomSwitches.size() == 0 || RandomSwitch::pause)
|
||||
return;
|
||||
|
||||
std::deque<RandomSwitch> rs(randomSwitches);
|
||||
@@ -51,7 +46,7 @@ void SwitcherData::checkRandom(bool &match, OBSWeakSource &scene,
|
||||
if (!r.initialized())
|
||||
continue;
|
||||
|
||||
if (r.scene == lastRandomScene)
|
||||
if (r.scene == lastRandomScene && randomSwitches.size() != 1)
|
||||
continue;
|
||||
scene = r.scene;
|
||||
transition = r.transition;
|
||||
@@ -143,10 +138,6 @@ RandomSwitchWidget::RandomSwitchWidget(RandomSwitch *s) : SwitchWidget(s, false)
|
||||
{
|
||||
delay = new QDoubleSpinBox();
|
||||
|
||||
switchLabel = new QLabel("If no switch condition is met switch to ");
|
||||
usingLabel = new QLabel("using");
|
||||
forLabel = new QLabel("for");
|
||||
|
||||
QWidget::connect(delay, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(DelayChanged(double)));
|
||||
|
||||
@@ -157,18 +148,13 @@ RandomSwitchWidget::RandomSwitchWidget(RandomSwitch *s) : SwitchWidget(s, false)
|
||||
delay->setValue(s->delay);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(usingLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addWidget(forLabel);
|
||||
mainLayout->addWidget(delay);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{transitions}}", transitions},
|
||||
{"{{delay}}", delay}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.randomTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool ScreenRegionSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void clearFrames(QListWidget *list)
|
||||
void AdvSceneSwitcher::clearFrames(QListWidget *list)
|
||||
{
|
||||
for (int i = 0; i < list->count(); ++i) {
|
||||
ScreenRegionWidget *sw =
|
||||
@@ -25,23 +26,34 @@ void showCurrentFrame(QListWidget *list)
|
||||
sw->showFrame();
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::SetShowFrames()
|
||||
{
|
||||
ui->showFrame->setText(obs_module_text(
|
||||
"AdvSceneSwitcher.screenRegionTab.showGuideFrames"));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::SetHideFrames()
|
||||
{
|
||||
ui->showFrame->setText(obs_module_text(
|
||||
"AdvSceneSwitcher.screenRegionTab.hideGuideFrames"));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_showFrame_clicked()
|
||||
{
|
||||
switcher->showFrame = !switcher->showFrame;
|
||||
|
||||
if (switcher->showFrame) {
|
||||
ui->showFrame->setText("Hide guide frames");
|
||||
SetHideFrames();
|
||||
showCurrentFrame(ui->screenRegionSwitches);
|
||||
} else {
|
||||
ui->showFrame->setText("Show guide frames");
|
||||
SetShowFrames();
|
||||
clearFrames(ui->screenRegionSwitches);
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_screenRegionSwitches_currentRowChanged(int idx)
|
||||
{
|
||||
UNUSED_PARAMETER(idx);
|
||||
if (loading)
|
||||
if (loading || idx == -1)
|
||||
return;
|
||||
|
||||
if (switcher->showFrame) {
|
||||
@@ -52,18 +64,13 @@ void AdvSceneSwitcher::on_screenRegionSwitches_currentRowChanged(int idx)
|
||||
|
||||
void AdvSceneSwitcher::on_screenRegionAdd_clicked()
|
||||
{
|
||||
ui->screenRegionAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->screenRegionSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->screenRegionSwitches);
|
||||
ui->screenRegionSwitches->addItem(item);
|
||||
ScreenRegionWidget *sw =
|
||||
new ScreenRegionWidget(&switcher->screenRegionSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->screenRegionSwitches->setItemWidget(item, sw);
|
||||
listAddClicked(
|
||||
ui->screenRegionSwitches,
|
||||
new ScreenRegionWidget(&switcher->screenRegionSwitches.back()),
|
||||
ui->screenRegionAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_screenRegionRemove_clicked()
|
||||
@@ -126,6 +133,9 @@ void AdvSceneSwitcher::on_screenRegionDown_clicked()
|
||||
void SwitcherData::checkScreenRegionSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (ScreenRegionSwitch::pause)
|
||||
return;
|
||||
|
||||
std::pair<int, int> cursorPos = getCursorPos();
|
||||
int minRegionSize = 99999;
|
||||
|
||||
@@ -248,11 +258,6 @@ ScreenRegionWidget::ScreenRegionWidget(ScreenRegionSwitch *s)
|
||||
maxX = new QSpinBox();
|
||||
maxY = new QSpinBox();
|
||||
|
||||
cursorLabel = new QLabel("If cursor is in");
|
||||
xLabel = new QLabel("x");
|
||||
switchLabel = new QLabel("switch to");
|
||||
usingLabel = new QLabel("using");
|
||||
|
||||
minX->setPrefix("Min X: ");
|
||||
minY->setPrefix("Min Y: ");
|
||||
maxX->setPrefix("Max X: ");
|
||||
@@ -284,22 +289,13 @@ ScreenRegionWidget::ScreenRegionWidget(ScreenRegionSwitch *s)
|
||||
maxY->setValue(s->maxY);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(cursorLabel);
|
||||
mainLayout->addWidget(minX);
|
||||
mainLayout->addWidget(minY);
|
||||
mainLayout->addWidget(xLabel);
|
||||
mainLayout->addWidget(maxX);
|
||||
mainLayout->addWidget(maxY);
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(usingLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{minX}}", minX}, {"{{minY}}", minY},
|
||||
{"{{maxX}}", maxX}, {"{{maxY}}", maxY},
|
||||
{"{{scenes}}", scenes}, {"{{transitions}}", transitions}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.screenRegionTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
@@ -1,26 +1,21 @@
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool SceneSequenceSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void AdvSceneSwitcher::on_sceneSequenceAdd_clicked()
|
||||
{
|
||||
ui->sceneSequenceAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->sceneSequenceSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->sceneSequenceSwitches);
|
||||
ui->sceneSequenceSwitches->addItem(item);
|
||||
SequenceWidget *sw =
|
||||
new SequenceWidget(&switcher->sceneSequenceSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->sceneSequenceSwitches->setItemWidget(item, sw);
|
||||
listAddClicked(
|
||||
ui->sceneSequenceSwitches,
|
||||
new SequenceWidget(&switcher->sceneSequenceSwitches.back()),
|
||||
ui->sceneSequenceAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_sceneSequenceRemove_clicked()
|
||||
@@ -30,10 +25,19 @@ void AdvSceneSwitcher::on_sceneSequenceRemove_clicked()
|
||||
return;
|
||||
|
||||
{
|
||||
// might be in waiting state of sequence
|
||||
// causing invalid access after wakeup
|
||||
// thus we need to stop the main thread before delete
|
||||
bool wasRunning = !switcher->stop;
|
||||
switcher->Stop();
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
int idx = ui->sceneSequenceSwitches->currentRow();
|
||||
auto &switches = switcher->sceneSequenceSwitches;
|
||||
switches.erase(switches.begin() + idx);
|
||||
|
||||
if (wasRunning)
|
||||
switcher->Start();
|
||||
}
|
||||
|
||||
delete item;
|
||||
@@ -83,8 +87,12 @@ void AdvSceneSwitcher::on_sceneSequenceDown_clicked()
|
||||
void AdvSceneSwitcher::on_sceneSequenceSave_clicked()
|
||||
{
|
||||
QString directory = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Scene Sequence to file ..."),
|
||||
QDir::currentPath(), tr("Text files (*.txt)"));
|
||||
this,
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.saveTitle")),
|
||||
QDir::currentPath(),
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.fileType")));
|
||||
if (directory.isEmpty())
|
||||
return;
|
||||
QFile file(directory);
|
||||
@@ -99,11 +107,13 @@ void AdvSceneSwitcher::on_sceneSequenceSave_clicked()
|
||||
|
||||
void AdvSceneSwitcher::on_sceneSequenceLoad_clicked()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
|
||||
QString directory = QFileDialog::getOpenFileName(
|
||||
this, tr("Select a file to read Scene Sequence from ..."),
|
||||
QDir::currentPath(), tr("Text files (*.txt)"));
|
||||
this,
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.loadTitle")),
|
||||
QDir::currentPath(),
|
||||
tr(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.fileType")));
|
||||
if (directory.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -115,26 +125,88 @@ void AdvSceneSwitcher::on_sceneSequenceLoad_clicked()
|
||||
file.fileName().toUtf8().constData());
|
||||
|
||||
if (!obj) {
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(
|
||||
"Advanced Scene Switcher failed to import settings!");
|
||||
Msgbox.exec();
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.loadFail"));
|
||||
return;
|
||||
}
|
||||
|
||||
// might be in waiting state of sequence
|
||||
// causing invalid access after wakeup
|
||||
// thus we need to stop the main thread before delete
|
||||
bool wasRunning = !switcher->stop;
|
||||
switcher->Stop();
|
||||
|
||||
switcher->loadSceneSequenceSwitches(obj);
|
||||
|
||||
if (wasRunning)
|
||||
switcher->Start();
|
||||
|
||||
obs_data_release(obj);
|
||||
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(
|
||||
"Advanced Scene Switcher settings imported successfully!");
|
||||
Msgbox.exec();
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.loadSuccess"));
|
||||
close();
|
||||
}
|
||||
|
||||
void matchInterruptible(SwitcherData *switcher, SceneSequenceSwitch &s,
|
||||
bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
bool durationReached = s.matchCount * (switcher->interval / 1000.0) >=
|
||||
s.delay;
|
||||
|
||||
s.matchCount++;
|
||||
|
||||
if (durationReached) {
|
||||
match = true;
|
||||
scene = (s.usePreviousScene) ? switcher->previousScene
|
||||
: s.scene;
|
||||
transition = s.transition;
|
||||
if (switcher->verbose)
|
||||
s.logMatch();
|
||||
}
|
||||
}
|
||||
|
||||
void matchUninterruptible(SwitcherData *switcher, SceneSequenceSwitch &s,
|
||||
obs_source_t *currentSource,
|
||||
std::unique_lock<std::mutex> &lock, bool &match,
|
||||
OBSWeakSource &scene, OBSWeakSource &transition)
|
||||
{
|
||||
// scene was already active for the previous cycle so remove this time
|
||||
int dur = s.delay * 1000 - switcher->interval;
|
||||
if (dur > 0) {
|
||||
switcher->waitScene = currentSource;
|
||||
|
||||
if (switcher->verbose)
|
||||
s.logSleep(dur);
|
||||
|
||||
switcher->cv.wait_for(lock, std::chrono::milliseconds(dur));
|
||||
switcher->waitScene = nullptr;
|
||||
}
|
||||
obs_source_t *currentSource2 = obs_frontend_get_current_scene();
|
||||
|
||||
// only switch if user hasn't changed scene manually
|
||||
if (currentSource == currentSource2) {
|
||||
match = true;
|
||||
scene = (s.usePreviousScene) ? switcher->previousScene
|
||||
: s.scene;
|
||||
transition = s.transition;
|
||||
if (switcher->verbose)
|
||||
s.logMatch();
|
||||
} else if (switcher->verbose) {
|
||||
blog(LOG_INFO, "sequence canceled");
|
||||
}
|
||||
|
||||
obs_source_release(currentSource2);
|
||||
}
|
||||
|
||||
void SwitcherData::checkSceneSequence(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition,
|
||||
std::unique_lock<std::mutex> &lock)
|
||||
{
|
||||
if (SceneSequenceSwitch::pause)
|
||||
return;
|
||||
|
||||
obs_source_t *currentSource = obs_frontend_get_current_scene();
|
||||
obs_weak_source_t *ws = obs_source_get_weak_source(currentSource);
|
||||
|
||||
@@ -143,31 +215,19 @@ void SwitcherData::checkSceneSequence(bool &match, OBSWeakSource &scene,
|
||||
continue;
|
||||
|
||||
if (s.startScene == ws) {
|
||||
int dur = s.delay * 1000 - interval;
|
||||
if (dur > 0) {
|
||||
waitScene = currentSource;
|
||||
|
||||
if (verbose)
|
||||
s.logSleep(dur);
|
||||
|
||||
cv.wait_for(lock,
|
||||
std::chrono::milliseconds(dur));
|
||||
waitScene = nullptr;
|
||||
if (!match) {
|
||||
if (s.interruptible) {
|
||||
matchInterruptible(switcher, s, match,
|
||||
scene, transition);
|
||||
} else {
|
||||
matchUninterruptible(switcher, s,
|
||||
currentSource,
|
||||
lock, match, scene,
|
||||
transition);
|
||||
}
|
||||
}
|
||||
obs_source_t *currentSource2 =
|
||||
obs_frontend_get_current_scene();
|
||||
|
||||
// only switch if user hasn't changed scene manually
|
||||
if (currentSource == currentSource2) {
|
||||
match = true;
|
||||
scene = (s.usePreviousScene) ? previousScene
|
||||
: s.scene;
|
||||
transition = s.transition;
|
||||
if (verbose)
|
||||
s.logMatch();
|
||||
}
|
||||
obs_source_release(currentSource2);
|
||||
break;
|
||||
} else {
|
||||
s.matchCount = 0;
|
||||
}
|
||||
}
|
||||
obs_source_release(currentSource);
|
||||
@@ -201,6 +261,8 @@ void SwitcherData::saveSceneSequenceSwitches(obs_data_t *obj)
|
||||
obs_data_set_double(array_obj, "delay", s.delay);
|
||||
obs_data_set_int(array_obj, "delayMultiplier",
|
||||
s.delayMultiplier);
|
||||
obs_data_set_bool(array_obj, "interruptible",
|
||||
s.interruptible);
|
||||
obs_data_array_push_back(sceneSequenceArray, array_obj);
|
||||
}
|
||||
|
||||
@@ -237,12 +299,14 @@ void SwitcherData::loadSceneSequenceSwitches(obs_data_t *obj)
|
||||
if (delayMultiplier == 0 ||
|
||||
(delayMultiplier != 1 && delayMultiplier % 60 != 0))
|
||||
delayMultiplier = 1;
|
||||
bool interruptible =
|
||||
obs_data_get_bool(array_obj, "interruptible");
|
||||
|
||||
switcher->sceneSequenceSwitches.emplace_back(
|
||||
GetWeakSourceByName(scene1),
|
||||
GetWeakSourceByName(scene2),
|
||||
GetWeakTransitionByName(transition), delay,
|
||||
delayMultiplier,
|
||||
delayMultiplier, interruptible,
|
||||
(strcmp(scene2, previous_scene_name) == 0));
|
||||
|
||||
obs_data_release(array_obj);
|
||||
@@ -283,9 +347,9 @@ void SceneSequenceSwitch::logSleep(int dur)
|
||||
|
||||
void populateDelayUnits(QComboBox *list)
|
||||
{
|
||||
list->addItem("seconds");
|
||||
list->addItem("minutes");
|
||||
list->addItem("hours");
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.unit.secends"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.unit.minutes"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.unit.hours"));
|
||||
}
|
||||
|
||||
SequenceWidget::SequenceWidget(SceneSequenceSwitch *s) : SwitchWidget(s)
|
||||
@@ -293,11 +357,8 @@ SequenceWidget::SequenceWidget(SceneSequenceSwitch *s) : SwitchWidget(s)
|
||||
delay = new QDoubleSpinBox();
|
||||
delayUnits = new QComboBox();
|
||||
startScenes = new QComboBox();
|
||||
|
||||
whenLabel = new QLabel("When");
|
||||
switchLabel = new QLabel("is active switch to");
|
||||
afterLabel = new QLabel("after");
|
||||
usingLabel = new QLabel("using");
|
||||
interruptible = new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.interruptible"));
|
||||
|
||||
QWidget::connect(delay, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(DelayChanged(double)));
|
||||
@@ -306,10 +367,14 @@ SequenceWidget::SequenceWidget(SceneSequenceSwitch *s) : SwitchWidget(s)
|
||||
QWidget::connect(startScenes,
|
||||
SIGNAL(currentTextChanged(const QString &)), this,
|
||||
SLOT(StartSceneChanged(const QString &)));
|
||||
QWidget::connect(interruptible, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(InterruptibleChanged(int)));
|
||||
|
||||
delay->setMaximum(99999.000000);
|
||||
AdvSceneSwitcher::populateSceneSelection(startScenes, false);
|
||||
populateDelayUnits(delayUnits);
|
||||
interruptible->setToolTip(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.interruptibleHint"));
|
||||
|
||||
if (s) {
|
||||
switch (s->delayMultiplier) {
|
||||
@@ -327,23 +392,19 @@ SequenceWidget::SequenceWidget(SceneSequenceSwitch *s) : SwitchWidget(s)
|
||||
}
|
||||
startScenes->setCurrentText(
|
||||
GetWeakSourceName(s->startScene).c_str());
|
||||
interruptible->setChecked(s->interruptible);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(whenLabel);
|
||||
mainLayout->addWidget(startScenes);
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(afterLabel);
|
||||
mainLayout->addWidget(delay);
|
||||
mainLayout->addWidget(delayUnits);
|
||||
mainLayout->addWidget(usingLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{startScenes}}", startScenes},
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{delay}}", delay},
|
||||
{"{{delayUnits}}", delayUnits},
|
||||
{"{{transitions}}", transitions},
|
||||
{"{{interruptible}}", interruptible}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.sceneSequenceTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
@@ -417,3 +478,11 @@ void SequenceWidget::StartSceneChanged(const QString &text)
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->startScene = GetWeakSourceByQString(text);
|
||||
}
|
||||
|
||||
void SequenceWidget::InterruptibleChanged(int state)
|
||||
{
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->interruptible = state;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool TimeSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void AdvSceneSwitcher::on_timeAdd_clicked()
|
||||
{
|
||||
ui->timeAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->timeSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->timeSwitches);
|
||||
ui->timeSwitches->addItem(item);
|
||||
TimeSwitchWidget *sw =
|
||||
new TimeSwitchWidget(&switcher->timeSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->timeSwitches->setItemWidget(item, sw);
|
||||
listAddClicked(ui->timeSwitches,
|
||||
new TimeSwitchWidget(&switcher->timeSwitches.back()),
|
||||
ui->timeAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_timeRemove_clicked()
|
||||
@@ -74,6 +69,9 @@ void AdvSceneSwitcher::on_timeDown_clicked()
|
||||
|
||||
bool timesAreInInterval(QTime &time1, QTime &time2, int &interval)
|
||||
{
|
||||
if (time1.isNull() || time2.isNull())
|
||||
return false;
|
||||
|
||||
bool ret = false;
|
||||
QTime validSwitchTimeWindow = time1.addMSecs(interval);
|
||||
|
||||
@@ -110,7 +108,7 @@ bool checkRegularTime(TimeSwitch &s, int &interval)
|
||||
void SwitcherData::checkTimeSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (timeSwitches.size() == 0)
|
||||
if (TimeSwitch::pause)
|
||||
return;
|
||||
|
||||
for (TimeSwitch &s : timeSwitches) {
|
||||
@@ -214,19 +212,18 @@ void AdvSceneSwitcher::setupTimeTab()
|
||||
|
||||
void populateTriggers(QComboBox *list)
|
||||
{
|
||||
list->addItem("On any day");
|
||||
list->addItem("Mondays");
|
||||
list->addItem("Tuesdays");
|
||||
list->addItem("Wednesdays");
|
||||
list->addItem("Thursdays");
|
||||
list->addItem("Fridays");
|
||||
list->addItem("Saturdays");
|
||||
list->addItem("Sundays");
|
||||
list->addItem("Atfer streaming/recording start");
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.anyDay"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.mondays"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.tuesdays"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.wednesdays"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.thursdays"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.fridays"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.saturdays"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.sundays"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.timeTab.afterstart"));
|
||||
|
||||
list->setItemData(
|
||||
8,
|
||||
"The time relative to the start of streaming / recording will be used",
|
||||
8, obs_module_text("AdvSceneSwitcher.timeTab.afterstart.tip"),
|
||||
Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
@@ -235,10 +232,6 @@ TimeSwitchWidget::TimeSwitchWidget(TimeSwitch *s) : SwitchWidget(s)
|
||||
triggers = new QComboBox();
|
||||
time = new QTimeEdit();
|
||||
|
||||
atLabel = new QLabel("at");
|
||||
switchLabel = new QLabel("switch to");
|
||||
usingLabel = new QLabel("using");
|
||||
|
||||
QWidget::connect(triggers, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(TriggerChanged(int)));
|
||||
QWidget::connect(time, SIGNAL(timeChanged(const QTime &)), this,
|
||||
@@ -252,19 +245,14 @@ TimeSwitchWidget::TimeSwitchWidget(TimeSwitch *s) : SwitchWidget(s)
|
||||
time->setTime(s->time);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(triggers);
|
||||
mainLayout->addWidget(atLabel);
|
||||
mainLayout->addWidget(time);
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(usingLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{triggers}}", triggers},
|
||||
{"{{time}}", time},
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{transitions}}", transitions}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.timeTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool DefaultSceneTransition::pause = false;
|
||||
|
||||
void AdvSceneSwitcher::on_transitionsAdd_clicked()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->sceneTransitions.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->sceneTransitions);
|
||||
ui->sceneTransitions->addItem(item);
|
||||
TransitionSwitchWidget *sw =
|
||||
new TransitionSwitchWidget(&switcher->sceneTransitions.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->sceneTransitions->setItemWidget(item, sw);
|
||||
listAddClicked(
|
||||
ui->sceneTransitions,
|
||||
new TransitionSwitchWidget(&switcher->sceneTransitions.back()));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_transitionsRemove_clicked()
|
||||
@@ -77,13 +75,9 @@ void AdvSceneSwitcher::on_defaultTransitionsAdd_clicked()
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->defaultSceneTransitions.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->defaultTransitions);
|
||||
ui->defaultTransitions->addItem(item);
|
||||
DefTransitionSwitchWidget *sw = new DefTransitionSwitchWidget(
|
||||
&switcher->defaultSceneTransitions.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->defaultTransitions->setItemWidget(item, sw);
|
||||
listAddClicked(ui->defaultTransitions,
|
||||
new DefTransitionSwitchWidget(
|
||||
&switcher->defaultSceneTransitions.back()));
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_defaultTransitionsRemove_clicked()
|
||||
@@ -143,9 +137,10 @@ void AdvSceneSwitcher::on_defaultTransitionsDown_clicked()
|
||||
switcher->defaultSceneTransitions[index + 1]);
|
||||
}
|
||||
|
||||
void SwitcherData::setDefaultSceneTransitions()
|
||||
void SwitcherData::checkDefaultSceneTransitions(bool &match,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (changedDefTransitionRecently)
|
||||
if (checkedDefTransition || DefaultSceneTransition::pause)
|
||||
return;
|
||||
|
||||
obs_source_t *currentSource = obs_frontend_get_current_scene();
|
||||
@@ -156,22 +151,25 @@ void SwitcherData::setDefaultSceneTransitions()
|
||||
if (!s.initialized())
|
||||
continue;
|
||||
|
||||
obs_source_t *transition =
|
||||
obs_weak_source_get_source(s.transition);
|
||||
//This might cancel the current transition
|
||||
//There is no way to be sure when the previous transition finished
|
||||
obs_frontend_set_current_transition(transition);
|
||||
match = true;
|
||||
transition = s.transition;
|
||||
|
||||
if (verbose)
|
||||
s.logMatch();
|
||||
|
||||
obs_source_release(transition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
obs_source_release(currentSource);
|
||||
obs_weak_source_release(ws);
|
||||
changedDefTransitionRecently = true;
|
||||
|
||||
checkedDefTransition = true;
|
||||
}
|
||||
|
||||
void SwitcherData::setCurrentDefTransition(OBSWeakSource &transition)
|
||||
{
|
||||
obs_source_t *transitionSource = obs_weak_source_get_source(transition);
|
||||
obs_frontend_set_current_transition(transitionSource);
|
||||
obs_source_release(transitionSource);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_transitionOverridecheckBox_stateChanged(int state)
|
||||
@@ -414,10 +412,6 @@ TransitionSwitchWidget::TransitionSwitchWidget(SceneTransition *s)
|
||||
{
|
||||
scenes2 = new QComboBox();
|
||||
|
||||
switchLabel = new QLabel("Switch from scene");
|
||||
toLabel = new QLabel("to scene");
|
||||
usingLabel = new QLabel("using transition");
|
||||
|
||||
QWidget::connect(scenes2, SIGNAL(currentTextChanged(const QString &)),
|
||||
this, SLOT(Scene2Changed(const QString &)));
|
||||
|
||||
@@ -427,18 +421,13 @@ TransitionSwitchWidget::TransitionSwitchWidget(SceneTransition *s)
|
||||
scenes2->setCurrentText(GetWeakSourceName(s->scene2).c_str());
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(toLabel);
|
||||
mainLayout->addWidget(scenes2);
|
||||
mainLayout->addWidget(usingLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{scenes2}}", scenes2},
|
||||
{"{{transitions}}", transitions}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.transitionTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
@@ -477,20 +466,13 @@ void TransitionSwitchWidget::Scene2Changed(const QString &text)
|
||||
DefTransitionSwitchWidget::DefTransitionSwitchWidget(DefaultSceneTransition *s)
|
||||
: SwitchWidget(s, false)
|
||||
{
|
||||
whenLabel = new QLabel("When scene");
|
||||
switchLabel =
|
||||
new QLabel("is active change default scene transition to ");
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(whenLabel);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(switchLabel);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{scenes}}", scenes}, {"{{transitions}}", transitions}};
|
||||
placeWidgets(
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.transitionTab.defaultTransitionEntry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
bool WindowSwitch::pause = false;
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
||||
void AdvSceneSwitcher::on_windowAdd_clicked()
|
||||
{
|
||||
ui->windowAdd->disconnect(addPulse);
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->windowSwitches.emplace_back();
|
||||
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem(ui->windowSwitches);
|
||||
ui->windowSwitches->addItem(item);
|
||||
WindowSwitchWidget *sw =
|
||||
new WindowSwitchWidget(&switcher->windowSwitches.back());
|
||||
item->setSizeHint(sw->minimumSizeHint());
|
||||
ui->windowSwitches->setItemWidget(item, sw);
|
||||
listAddClicked(ui->windowSwitches,
|
||||
new WindowSwitchWidget(&switcher->windowSwitches.back()),
|
||||
ui->windowAdd, &addPulse);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_windowRemove_clicked()
|
||||
@@ -193,6 +188,9 @@ bool isFocused(std::string &title)
|
||||
void SwitcherData::checkWindowTitleSwitch(bool &match, OBSWeakSource &scene,
|
||||
OBSWeakSource &transition)
|
||||
{
|
||||
if (WindowSwitch::pause)
|
||||
return;
|
||||
|
||||
std::string title;
|
||||
bool ignored = false;
|
||||
|
||||
@@ -373,9 +371,12 @@ void AdvSceneSwitcher::setupTitleTab()
|
||||
WindowSwitchWidget::WindowSwitchWidget(WindowSwitch *s) : SwitchWidget(s, false)
|
||||
{
|
||||
windows = new QComboBox();
|
||||
fullscreen = new QCheckBox("if fullscreen");
|
||||
maximized = new QCheckBox("if maximized");
|
||||
focused = new QCheckBox("if focused");
|
||||
fullscreen = new QCheckBox(
|
||||
obs_module_text("AdvSceneSwitcher.windowTitleTab.fullscreen"));
|
||||
maximized = new QCheckBox(
|
||||
obs_module_text("AdvSceneSwitcher.windowTitleTab.maximized"));
|
||||
focused = new QCheckBox(
|
||||
obs_module_text("AdvSceneSwitcher.windowTitleTab.focused"));
|
||||
|
||||
QWidget::connect(windows, SIGNAL(currentTextChanged(const QString &)),
|
||||
this, SLOT(WindowChanged(const QString &)));
|
||||
@@ -404,19 +405,16 @@ WindowSwitchWidget::WindowSwitchWidget(WindowSwitch *s) : SwitchWidget(s, false)
|
||||
focused->setChecked(s->focus);
|
||||
}
|
||||
|
||||
setStyleSheet("* { background-color: transparent; }");
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
|
||||
mainLayout->addWidget(windows);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(transitions);
|
||||
mainLayout->addWidget(scenes);
|
||||
mainLayout->addWidget(fullscreen);
|
||||
mainLayout->addWidget(maximized);
|
||||
mainLayout->addWidget(focused);
|
||||
mainLayout->addStretch();
|
||||
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
{"{{windows}}", windows},
|
||||
{"{{scenes}}", scenes},
|
||||
{"{{transitions}}", transitions},
|
||||
{"{{fullscreen}}", fullscreen},
|
||||
{"{{maximized}}", maximized},
|
||||
{"{{focused}}", focused}};
|
||||
placeWidgets(obs_module_text("AdvSceneSwitcher.windowTitleTab.entry"),
|
||||
mainLayout, widgetPlaceholders);
|
||||
setLayout(mainLayout);
|
||||
|
||||
switchData = s;
|
||||
|
||||
@@ -27,11 +27,10 @@ void SwitcherData::Prune()
|
||||
screenRegionSwitches.begin() + i--);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < pauseScenesSwitches.size(); i++) {
|
||||
OBSWeakSource &scene = pauseScenesSwitches[i];
|
||||
if (!WeakSourceValid(scene))
|
||||
pauseScenesSwitches.erase(pauseScenesSwitches.begin() +
|
||||
i--);
|
||||
for (size_t i = 0; i < pauseEntries.size(); i++) {
|
||||
PauseEntry &s = pauseEntries[i];
|
||||
if (!s.valid())
|
||||
pauseEntries.erase(pauseEntries.begin() + i--);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sceneSequenceSwitches.size(); i++) {
|
||||
|
||||
@@ -89,6 +89,9 @@ void GetWindowList(QStringList &windows)
|
||||
for (auto window : w) {
|
||||
windows << QString::fromStdString(window);
|
||||
}
|
||||
|
||||
// Add entry for OBS Studio itself, see GetCurrentWindowTitle
|
||||
windows << QString("OBS");
|
||||
}
|
||||
|
||||
void GetCurrentWindowTitle(std::string &title)
|
||||
@@ -97,10 +100,10 @@ void GetCurrentWindowTitle(std::string &title)
|
||||
DWORD pid;
|
||||
DWORD thid;
|
||||
thid = GetWindowThreadProcessId(window, &pid);
|
||||
/*GetWindowText will freeze if the control it is reading was created in another thread.
|
||||
It does not directly read the control.Instead,
|
||||
it waits for the thread that created the control to process a WM_GETTEXT message.
|
||||
So if that thread is frozen in a WaitFor... call you have a deadlock.*/
|
||||
// GetWindowText will freeze if the control it is reading was created in another thread.
|
||||
// It does not directly read the control.
|
||||
// Instead it waits for the thread that created the control to process a WM_GETTEXT message.
|
||||
// So if that thread is frozen in a WaitFor... call you have a deadlock.
|
||||
if (GetCurrentProcessId() == pid) {
|
||||
title = "OBS";
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user