diff --git a/.gitignore b/.gitignore
index 27860a8..8cf1675 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,6 @@ Makefile*
*.stash
*.appxmanifest
*.user
+installer/AdvancedSettings-Installer.exe
+*.user*
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..98504bb
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,15 @@
+language: cpp
+dist: xenial
+compiler:
+ - clang
+ - gcc
+
+install:
+ - sudo add-apt-repository ppa:kubuntu-ppa/backports -y
+ - sudo apt-get update -qq
+ - sudo apt-get install build-essential qtbase5-dev qttools5-dev qtdeclarative5-dev qtmultimedia5-dev qt5-default qttools5-dev-tools
+
+script:
+ - mkdir build && cd build
+ - qmake ..
+ - make
diff --git a/Readme.md b/Readme.md
index 1b501ad..eb5a805 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,11 +1,41 @@
   [](https://ci.appveyor.com/project/icewind1991/openvr-advancedsettings/branch/master)
+
+ > * [Features](#features)
+ > * [Usage](#usage)
+ > * [Installer](#installer)
+ > * [Standalone](#standalone)
+ > * [Command Line Arguments](#command_line_arguments)
+ > * [Desktop mode](#desktop_mode)
+ > * [Preview Builds](#preview_builds)
+ > * [Documentation](#documentation)
+ > * [Top Page](#top_page)
+ > * [SteamVR Page](#steamvr_page)
+ > * [Chaperone Page](#chaperone_page)
+ > * [Chaperone Proximity Warning Settings Page](#chaperone_proximity_page)
+ > * [Play Space Page](#play_space_page)
+ > * [Playspace Fix Page](#playspace_fix_page)
+ > * [Audio Page](#audio_page)
+ > * [Revive Page](#revive_page)
+ > * [Utilities Page](#utilities_page)
+ > * [Accessibility Page](#accessibility_page)
+ > * [Statistics Page](#statistics_page)
+ > * [Settings Page](#settings_page)
+ > * [How To Compile](#how_to_compile)
+ > * [Building on Windows](#building_on_windows)
+ > * [Building on Linux](#building_on_linux)
+ > * [Notes](#notes)
+ > * [Known Bugs](#known_bugs)
+ > * [License](#license)
+
+
# OpenVR Advanced Settings Overlay
Adds an overlay to the OpenVR dashboard that allows access to advanced settings.

+
# Features
- Set supersampling values.
@@ -27,14 +57,17 @@ Adds an overlay to the OpenVR dashboard that allows access to advanced settings.
- Simple Alarm Clock
- Player height adjust toggle (Credits to mklim)
+
# Usage
+
## Installer
Download the newest installer from the [release section](https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/releases) and execute it.
If you have an older standalone version installed, delete the old application folder first.
+
## Standalone
I am not currently providing standalone Archives if you want a standalone version you can:
@@ -44,16 +77,35 @@ To install for the first time simply start AdvancedSettings.exe once while Steam
To upgrade an existing installation first stop SteamVR and delete the old application folder (or override it). Then start SteamVR and run AdvancedSettings.exe once.
+
+## Command Line Arguments
+
+The application (`AdvancedSettings.exe`) can be run with the following five optional arguments:
+
+`"-desktop"`: Creates a settings window on the desktop.
+
+`"-nosound"`: Forces sound effects off.
+
+`"-nomanifest"`: Forces not creating a `.vrmanifest`.
+
+`"-installmanifest"`: Force installs the `.vrmanifest`.
+
+`"-removemanifest"`: Force uninstalls the `.vrmanifest`.
+
+
## Desktop mode
Executing startdesktopmode.bat from the application folder shows a window on the desktop instead of a vr overlay. Desktop mode can be used alongside an already running vr overlay instance.
+
## Preview builds
If you want to try latest and greatest unreleased features, you can download latest changes in the alpha branches of the repository.
+
# Documentation
+
## Top Page:

@@ -63,6 +115,7 @@ If you want to try latest and greatest unreleased features, you can download lat
- **Microphone**: Allows to set the microphone volume and to mute/unmute it.
- **Push-to-Talk**: Enable/disable push-to-talk and allows to apply push-to-talk profiles. Profiles can be created on the Audio page.
+
## - SteamVR Page:

@@ -76,6 +129,7 @@ If you want to try latest and greatest unreleased features, you can download lat
- **Enable Always-on Reprojection**: Enable/disable forced reprojection.
- **Restart SteamVR**: Restart SteamVR (May crash the Steam overlay when SteamVR Home is running when you restart. Therefore I advice that you close SteamVR Home before restarting).
+
## - Chaperone Page:

@@ -91,7 +145,7 @@ If you want to try latest and greatest unreleased features, you can download lat
- **Flip Orientation**: Flips the orientation of the play space.
- **Reload from Disk**: Reloads the chaperone bounds geometry from disk.
-
+
## - Chaperone Proximity Warning Settings Page:

@@ -104,6 +158,7 @@ If you want to try latest and greatest unreleased features, you can download lat
- **Open dashboard**: Opens the dashboard when the user's distance to the chaperone falls below the configured activation distance. The idea is to pause the game (most single-player games auto-pause when the dashboard is shown) to give the user time for reorientation.
- **Velocity Dependent Fade/Activation Distance**: Dynamically modifies the chaperone's fade distance and the proximity warning's activation distance as a function of the player's speed. The used formula is: *distance = old_distance * ( 1 + distance_modifier * max(left_controller_speed, right_controller_speed, hmd_speed) )*
+
## - Play Space Page:

@@ -113,6 +168,7 @@ Allows to temporarily move and rotate the center of the playspace. This allows t
- **Virtual Move Shortcut**: Allows moving the placespace center by holding down the application menu shortcut and moving the controller.
- **Adjust Chaperone**: When enabled then the chaperone bounds stay in place when the playspace is moved or rotated (so noone gets hurt). Unfortunately this does not work when moving up/down.
+
## - Playspace Fix Page:

@@ -121,6 +177,7 @@ Allows to temporarily move and rotate the center of the playspace. This allows t
- **Fix Floor** Allows you to fix the height of your floor. Just place one controller on your floor and press the button.
- **Recenter Playspace** Besides fixing the floor height, also recenters the place space around the controller on the floor.
+
## - Audio Page:

@@ -137,6 +194,7 @@ Allows to temporarily move and rotate the center of the playspace. This allows t
- **PTT Profile**: Allows you to apply/define/delete push-to-talk profiles that save buttons, controller and notification settings.
- **Audio Profile**: Allows you to apply/define/delete audio profiles that save playback devices, mute state, and volume.
+
## - Revive Page:

@@ -159,6 +217,7 @@ Any changes to controller settings are immediately applied by Revive (Requires R
- **Z**: Allows to modify the touch controllers z-offset. (TouchZ setting the vrsettings file)
- **Controller Profile**: Allows to apply/define/delete controller profiles that save the controller settings (grip button mode, deadzone, sensitivity, pitch/yaw/roll and x/y/z-offsets).
+
## - Utilities Page:

@@ -169,12 +228,14 @@ Any changes to controller settings are immediately applied by Revive (Requires R
- **Steam Desktop Overlay Width:** Allows to increase the size of the Steam desktop overlay. Useful for multi-monitor setups.
+
## - Accessibility Page:

- **Adjust Player Height:** Offsets the player height to allows short or wheelchair-bound players to fully interact with height-limited applications by both boosting their height and being able to touch the in-game floor when necessary by pressing a configurable motion controller button.
+
## - Statistics Page:

@@ -189,6 +250,7 @@ Any changes to controller settings are immediately applied by Revive (Requires R
- **Timed Out**: Number of times the currently running application timed out.
- **Reprojection Ratio**: Ratio of presented frames to reprojected frames.
+
## - Settings Page:

@@ -196,21 +258,21 @@ Any changes to controller settings are immediately applied by Revive (Requires R
- **Autostart:** Allows you to enable/disable auto start.
- **Force Revive Page:** Force the Revive page button on the root page to be visible.
+
# How to Compile
-Building has been tested with Qt 5.10 and Visual Studio 2017 community.
-If both have been installed in their default paths than the project can be build using `build_windows.cmd`, this compiles the binary and copies all files necessary for execution into the output directory.
+
+## Building on Windows
-The following environment variables should be set for the build script to work
-
-- QT: `C:\Qt\5.10.1\msvc2017_64` or wherever you installed Qt.
-- PLATFORM: `amd64` only x64 builds have been tested atm.
+Full build instructions can be found [here](docs/building_for_windows.md).
+
## Building on Linux
If you want to run Advanced Settings on linux you can build it yourself using `qmake` and `make` or using Qt Creator, you'll have to copy the `res` folder from the `src` folder into folder that contains the binary
and copy `third-party/openvr/lib/linux64/libopenvr_api.so` into your systems library path.
+
# Notes:
- The center marker and the play space marker are provided by the chaperone subsystem, and therefore they will have the same color and visibility settings as the chaperone bounds.
@@ -219,10 +281,12 @@ and copy `third-party/openvr/lib/linux64/libopenvr_api.so` into your systems lib
- You can modify the shutdown wait time when restarting SteamVR by opening restartvrserver.bat and changing the number behind "timeout /t" (unit is seconds).
+
# Known Bugs
- None yet.
+
# License
This software is released under GPL 3.0.
diff --git a/advancedSettings.pro b/advancedSettings.pro
index dacff55..9458a0f 100644
--- a/advancedSettings.pro
+++ b/advancedSettings.pro
@@ -4,14 +4,38 @@
#
#-------------------------------------------------
-QT += core gui qml quick multimedia
+QT += core gui qml quick multimedia widgets
+CONFIG += c++11
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.6 or higher")
+lessThan(QT_MINOR_VERSION, 6): error("requires Qt 5.6 or higher")
TARGET = AdvancedSettings
TEMPLATE = app
+*msvc* {
+ #Removing -W3 from both FLAGS is necessary, otherwise compiler will give
+ #D9025: overriding '/W4' with '/W3'
+ QMAKE_CFLAGS_WARN_ON -= -W3
+ QMAKE_CXXFLAGS_WARN_ON -= -W3
+ QMAKE_CXXFLAGS += /W4 /wd4127
+
+ !*clang-msvc{
+ QMAKE_CXXFLAGS += /WX
+ }
+}
+*g++* {
+ QMAKE_CXXFLAGS += -Werror
+}
+
+#Look for anything clang that is not clang-msvc, since it does not
+#allow all the same switches as regular clang.
+*clang|*clang-g++|*clang-libc++ {
+ QMAKE_CXXFLAGS += -Werror
+ #All includes from the third-party directory will not warn.
+ QMAKE_CXXFLAGS += --system-header-prefix=third-party
+}
SOURCES += src/main.cpp\
src/overlaycontroller.cpp \
src/tabcontrollers/AudioTabController.cpp \
@@ -27,37 +51,7 @@ SOURCES += src/main.cpp\
src/tabcontrollers/AccessibilityTabController.cpp \
src/utils/ChaperoneUtils.cpp \
src/tabcontrollers/audiomanager/AudioManagerDummy.cpp \
- src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp \
- release/moc_AccessibilityTabController.cpp \
- release/moc_AudioTabController.cpp \
- release/moc_ChaperoneTabController.cpp \
- release/moc_FixFloorTabController.cpp \
- release/moc_MoveCenterTabController.cpp \
- release/moc_overlaycontroller.cpp \
- release/moc_PttController.cpp \
- release/moc_ReviveTabController.cpp \
- release/moc_SettingsTabController.cpp \
- release/moc_StatisticsTabController.cpp \
- release/moc_SteamVRTabController.cpp \
- release/moc_UtilitiesTabController.cpp \
- src/tabcontrollers/audiomanager/AudioManagerDummy.cpp \
- src/tabcontrollers/audiomanager/AudioManagerWindows.cpp \
- src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp \
- src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp \
- src/tabcontrollers/AccessibilityTabController.cpp \
- src/tabcontrollers/AudioTabController.cpp \
- src/tabcontrollers/ChaperoneTabController.cpp \
- src/tabcontrollers/FixFloorTabController.cpp \
- src/tabcontrollers/MoveCenterTabController.cpp \
- src/tabcontrollers/PttController.cpp \
- src/tabcontrollers/ReviveTabController.cpp \
- src/tabcontrollers/SettingsTabController.cpp \
- src/tabcontrollers/StatisticsTabController.cpp \
- src/tabcontrollers/SteamVRTabController.cpp \
- src/tabcontrollers/UtilitiesTabController.cpp \
- src/utils/ChaperoneUtils.cpp \
- src/main.cpp \
- src/overlaycontroller.cpp
+ src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp
HEADERS += src/overlaycontroller.h \
src/logging.h \
@@ -77,42 +71,13 @@ HEADERS += src/overlaycontroller.h \
src/utils/Matrix.h \
src/utils/ChaperoneUtils.h \
src/tabcontrollers/audiomanager/AudioManagerDummy.h \
- src/tabcontrollers/keyboardinput/KeyboardInputDummy.h \
- release/moc_predefs.h \
- src/tabcontrollers/audiomanager/AudioManagerDummy.h \
- src/tabcontrollers/audiomanager/AudioManagerWindows.h \
- src/tabcontrollers/audiomanager/IPolicyConfig.h \
- src/tabcontrollers/keyboardinput/KeyboardInputDummy.h \
- src/tabcontrollers/keyboardinput/KeyboardInputWindows.h \
- src/tabcontrollers/AccessibilityTabController.h \
- src/tabcontrollers/AudioManager.h \
- src/tabcontrollers/AudioTabController.h \
- src/tabcontrollers/ChaperoneTabController.h \
- src/tabcontrollers/FixFloorTabController.h \
- src/tabcontrollers/KeyboardInput.h \
- src/tabcontrollers/MoveCenterTabController.h \
- src/tabcontrollers/PttController.h \
- src/tabcontrollers/ReviveTabController.h \
- src/tabcontrollers/SettingsTabController.h \
- src/tabcontrollers/StatisticsTabController.h \
- src/tabcontrollers/SteamVRTabController.h \
- src/tabcontrollers/UtilitiesTabController.h \
- src/utils/ChaperoneUtils.h \
- src/utils/Matrix.h \
- src/logging.h \
- src/overlaycontroller.h \
- third-party/easylogging++/easylogging++.h \
- third-party/openvr/bin/osx64/OpenVR.framework/Versions/A/Headers/openvr.h \
- third-party/openvr/bin/osx64/OpenVR.framework/Versions/A/Headers/openvr_capi.h \
- third-party/openvr/bin/osx64/OpenVR.framework/Versions/A/Headers/openvr_driver.h \
- third-party/openvr/headers/openvr.h \
- third-party/openvr/headers/openvr_capi.h \
- third-party/openvr/headers/openvr_driver.h
+ src/tabcontrollers/keyboardinput/KeyboardInputDummy.h
win32 {
SOURCES += src/tabcontrollers/audiomanager/AudioManagerWindows.cpp \
src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
HEADERS += src/tabcontrollers/audiomanager/AudioManagerWindows.h \
+ src/tabcontrollers/audiomanager/IPolicyConfig.h \
src/tabcontrollers/keyboardinput/KeyboardInputWindows.h
}
diff --git a/advancedSettings.pro.user.e9f45e7 b/advancedSettings.pro.user.e9f45e7
deleted file mode 100644
index ab2fa5e..0000000
--- a/advancedSettings.pro.user.e9f45e7
+++ /dev/null
@@ -1,318 +0,0 @@
-
-
-
-
-
- EnvironmentId
- {e9f45e75-3f05-4ad6-a0dc-8a090aa48e0b}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- true
- false
- 0
- true
- true
- 0
- 8
- true
- 1
- true
- true
- true
- false
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
-
- ProjectExplorer.Project.Target.0
-
- Desktop Qt 5.10.1 MSVC2017 64bit
- Desktop Qt 5.10.1 MSVC2017 64bit
- qt.qt5.5101.win64_msvc2017_64_kit
- 0
- 0
- 0
-
- C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Debug
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- true
-
- false
- false
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Debug
-
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
- true
-
-
- C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Release
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
-
- false
- false
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Release
-
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
-
- C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Profile
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- true
-
- false
- true
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Profile
-
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
- 3
-
-
- 0
- Deploy
-
- ProjectExplorer.BuildSteps.Deploy
-
- 1
- Deploy locally
-
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
-
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
- 2
-
- advancedSettings
- advancedSettings2
- Qt4ProjectManager.Qt4RunConfiguration://192.168.1.165/win10/OpenVR-AdvancedSettings/advancedSettings.pro
- true
-
- advancedSettings.pro
- false
-
- C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Debug/bin/win64/AdvancedSettings
- 3768
- false
- true
- false
- false
- true
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 18
-
-
- Version
- 18
-
-
diff --git a/appveyor.yml b/appveyor.yml
index 3c215a3..2f9978d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,10 +2,14 @@ image: Visual Studio 2017
environment:
matrix:
- - QT: C:\Qt\5.10.1\msvc2017_64
- PLATFORM: amd64
+ - QT_LOC: '"C:\Qt\5.11.2\msvc2017_64\bin\"'
+ VS_LOC: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"'
+ JOM_LOC: '"C:\Qt\Tools\QtCreator\bin\jom.exe"'
+ NSIS_LOC: '"C:\Program Files (x86)\NSIS\"'
+ ZIP_LOC: 7z
COMPILER: msvc
VSVER: 14
+
clone_depth: 1
@@ -14,7 +18,6 @@ init:
build_script:
- call "build_windows.cmd"
- - call "package.cmd"
artifacts:
- path: bin\win64\AdvancedSettings.zip
diff --git a/build_scripts/win/build.cmd b/build_scripts/win/build.cmd
new file mode 100644
index 0000000..1118d41
--- /dev/null
+++ b/build_scripts/win/build.cmd
@@ -0,0 +1,115 @@
+@echo off
+REM Echo off to avoid spam.
+
+REM Non zero is failure, 0 is success.
+SET exit_code_success=0
+SET exit_code_failure_build_apps=1
+SET exit_code_failure_build_locations=2
+
+REM Used for echos.
+SET current_activity=BUILD
+
+REM If scripts are chain called the original dirs should not be overwritten.
+IF NOT DEFINED original_dir (
+ SET original_dir=%CD%
+)
+IF NOT DEFINED project_dir (
+ REM Arg 0 (called %0) is the full path to the file.
+ REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters
+ REM As per above link, %~dp0 expands the zeroth arg to a drive letter and path only.
+ REM Project dir is up two dirs from the file.
+ SET project_dir=%~dp0\..\..\
+)
+
+REM Change dir to the project dir, otherwise qmake doesn't know where it is.
+CD %project_dir%
+
+REM QT_LOC is a directory, it can't be in the path, no reason to check using WHERE.
+ECHO %current_activity%: Testing if all required build environment values are set:
+IF NOT DEFINED QT_LOC (
+ ECHO %current_activity%: QT_LOC not defined. Using default value.
+ SET QT_LOC="C:\Qt\5.11.1\msvc2017_64\bin\"
+)
+ECHO %current_activity%: QT_LOC set to '%QT_LOC%'.
+IF EXIST %QT_LOC% (
+ ECHO %current_activity%: QT_LOC exists.
+) ELSE (
+ ECHO %current_activity%: QT_LOC directory does not exist. Exiting.
+ EXIT /B %exit_code_failure_build_locations%
+)
+
+IF NOT DEFINED VS_LOC (
+ ECHO %current_activity%: VS_LOC not defined. Using default value.
+ SET VS_LOC="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
+)
+ECHO %current_activity%: VS_LOC set to '%VS_LOC%'.
+
+REM EXIST won't find items in the PATH. WHERE will.
+SET VS_VALID=0
+IF EXIST %VS_LOC% SET VS_VALID=1
+REM Prevents error message spam if it doesn't find it in PATH.
+IF NOT %VS_VALID% EQU 1 (
+ WHERE /Q %VS_LOC%
+ IF NOT ERRORLEVEL 1 SET VS_VALID=1
+)
+
+IF %VS_VALID% EQU 1 (
+ ECHO %current_activity%: VS_LOC exists.
+) ELSE (
+ ECHO %current_activity%: VS_LOC directory does not exist. Exiting.
+ EXIT /B %exit_code_failure_build_locations%
+)
+
+ECHO %current_activity%: All required build environment values are set.
+
+IF DEFINED BUILD_DEBUG (
+ ECHO %current_activity%: BUILD_DEBUG var set. Compiling for debug.
+ SET compile_level=debug
+) ELSE (
+ ECHO %current_activity%: BUILD_DEBUG var not set. Compiling for release.
+ SET compile_level=release
+)
+
+ECHO %current_activity%: Setting up environment with Visual Studio 'vcvarsall.bat'.
+REM Currently only this platform is supported.
+SET target_platform=AMD64
+REM Set up environment for qmake.
+CALL %VS_LOC% %target_platform%
+
+IF DEFINED BUILD_VSPROJ (
+ ECHO %current_activity%: BUILD_VSPROJ defined. Building Visual Studio project files.
+ %QT_LOC%\qmake -tp vc
+ ECHO %current_activity%: Building Visual Studio project files done.
+) ELSE (
+ ECHO %current_activity%: BUILD_VSPROJ not defined. Not building Visual Studio project files.
+)
+
+ECHO %current_activity%: Running qmake for %compile_level%:
+%QT_LOC%\qmake -spec win32-msvc CONFIG+=x86_64 CONFIG+=%compile_level%
+ECHO %current_activity%: qmake done.
+
+IF NOT DEFINED JOM_LOC (
+ ECHO %current_activity%: JOM_LOC not defined. Using default value.
+ SET JOM_LOC="C:\Qt\Tools\QtCreator\bin\jom.exe"
+)
+ECHO %current_activity%: JOM_LOC set to '%JOM_LOC%'.
+
+IF EXIST %JOM_LOC% (
+ ECHO %current_activity%: JOM_LOC exists.
+ ECHO %current_activity%: Running jom:
+ %JOM_LOC%
+ REM jom will not exit with an error code. Leading to a passing build even with errors.
+ IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+ ECHO %current_activity%: jom done.
+) ELSE (
+ ECHO JOM_LOC directory does not exist. Using nmake.
+ ECHO %current_activity%: Running nmake:
+ nmake
+ REM nmake will not exit with an error code. Leading to a passing build even with errors.
+ IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+ ECHO %current_activity%: nmake done.
+)
+
+CD %original_dir%
+
+ECHO %current_activity%: %current_activity% DONE.
\ No newline at end of file
diff --git a/build_scripts/win/deploy.cmd b/build_scripts/win/deploy.cmd
new file mode 100644
index 0000000..f19f1b9
--- /dev/null
+++ b/build_scripts/win/deploy.cmd
@@ -0,0 +1,119 @@
+@echo off
+REM Echo off to avoid spam.
+
+REM Non zero is failure, 0 is success.
+SET exit_code_success=0
+SET exit_code_failure_build_apps=1
+SET exit_code_failure_build_locations=2
+
+SET output_dir="\bin\win64\"
+
+REM Used for echos.
+SET current_activity=DEPLOY
+
+REM If scripts are chain called the original dirs should not be overwritten.
+IF NOT DEFINED original_dir (
+ SET original_dir=%CD%
+)
+IF NOT DEFINED project_dir (
+ REM Arg 0 (called %0) is the full path to the file.
+ REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters
+ REM As per above link, %~dp0 expands the zeroth arg to a drive letter and path only.
+ REM Project dir is up two dirs from the file.
+ SET project_dir=%~dp0\..\..\
+)
+
+ECHO %current_activity%: Testing if all required build environment values are set:
+IF NOT DEFINED QT_LOC (
+ ECHO %current_activity%: QT_LOC not defined. Using default value.
+ SET QT_LOC="C:\Qt\5.11.1\msvc2017_64\bin\"
+)
+REM QT_LOC is a directory, it can't be in the path, no reason to check using WHERE.
+ECHO %current_activity%: QT_LOC set to '%QT_LOC%'.
+IF EXIST %QT_LOC% (
+ ECHO %current_activity%: QT_LOC exists.
+) ELSE (
+ ECHO %current_activity%: QT_LOC directory does not exist. Exiting.
+ EXIT /B %exit_code_failure_build_locations%
+)
+
+ECHO %current_activity%: All required build environment values are set.
+
+IF NOT EXIST %project_dir%\%output_dir% (
+ ECHO %current_activity%: Output dir '%output_dir%' does not exist. Creating.
+ mkdir %project_dir%\%output_dir%
+ ECHO %current_activity%: Output dir created.
+)
+
+cd %project_dir%\%output_dir%
+
+IF DEFINED BUILD_DEBUG (
+ ECHO %current_activity%: BUILD_DEBUG var set. Compiling for debug.
+ SET compile_level=debug
+) ELSE (
+ ECHO %current_activity%: BUILD_DEBUG var not set. Compiling for release.
+ SET compile_level=release
+)
+
+ECHO %current_activity%: Running windeployqt:
+
+REM windeployqt requires the QT\bin location to be in the path.
+REM Changing the PATH var is not ideal, but windeployqt does not work otherwise.
+set original_path=%PATH%
+set PATH=%QT_LOC%;%PATH%
+
+REM Caret newline (^CFLR) splits a command over several lines.
+REM This is done to avoid one ultra long line.
+
+windeployqt --dir AdvancedSettings\qtdata ^
+--libdir AdvancedSettings ^
+--plugindir AdvancedSettings\qtdata\plugins ^
+--no-system-d3d-compiler ^
+--no-opengl-sw ^
+--%compile_level% ^
+--qmldir ..\..\src\res\qml\ ^
+AdvancedSettings\AdvancedSettings.exe
+
+REM windeployqt does not exit on error by itself.
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+REM Return the PATH to original as quickly as possible.
+set PATH=%original_path%
+ECHO %current_activity%: windeployqt done.
+
+REM Switches used for copy:
+REM /V Verifies that files have been copied correctly.
+REM /Q Suppresses xcopy spam.
+REM /Y Skips the overwrite yes prompt.
+REM /E Copies all subdirs, even if they are empty.
+REM /I "If Source is a directory or contains wildcards and Destination does not exist,
+REM xcopy assumes Destination specifies a directory name and creates a new directory.
+REM Then, xcopy copies all specified files into the new directory. By default,
+REM xcopy prompts you to specify whether Destination is a file or a directory."
+
+ECHO %current_activity%: Copying necessary files.
+copy /V /Y "%project_dir%\Readme.md" "%project_dir%\%output_dir%\AdvancedSettings\Readme.md"
+ECHO %current_activity%: README copied.
+
+REM All three licenses must be included in binary releases, as per the terms.
+copy /V /Y "%project_dir%\LICENSE" "%project_dir%\%output_dir%\AdvancedSettings\LICENSE-GPL.txt"
+copy /V /Y "%project_dir%\third-party\openvr\LICENSE" "%project_dir%\%output_dir%\AdvancedSettings\LICENSE-VALVE.txt"
+copy /V /Y "%project_dir%\third-party\easylogging++\LICENSE" "%project_dir%\%output_dir%\AdvancedSettings\LICENSE-MIT.txt"
+ECHO %current_activity%: LICENSE files copied.
+
+xcopy /Q /Y /E /I /V "%project_dir%\src\res" "%project_dir%\%output_dir%\AdvancedSettings\res\"
+ECHO %current_activity%: Resource files copied.
+
+copy /V /Y "%project_dir%\src\restartvrserver.bat" "%project_dir%\%output_dir%\AdvancedSettings\restartvrserver.bat"
+copy /V /Y "%project_dir%\src\startdesktopmode.bat" "%project_dir%\%output_dir%\AdvancedSettings\startdesktopmode.bat"
+ECHO %current_activity%: Extra batch files copied.
+
+copy /V /Y "%project_dir%\src\qt.conf" "%project_dir%\%output_dir%\AdvancedSettings\qt.conf"
+copy /V /Y "%project_dir%\src\manifest.vrmanifest" "%project_dir%\%output_dir%\AdvancedSettings\manifest.vrmanifest"
+ECHO %current_activity%: VR specific configuration files copied.
+
+copy /V /Y "%project_dir%\third-party\openvr\bin\win64\openvr_api.dll" "%project_dir%\%output_dir%\AdvancedSettings\openvr_api.dll"
+ECHO %current_activity%: OpenVR .dll copied.
+
+cd %original_dir%
+
+ECHO %current_activity%: %current_activity% DONE.
\ No newline at end of file
diff --git a/build_scripts/win/package.cmd b/build_scripts/win/package.cmd
new file mode 100644
index 0000000..b7b76ad
--- /dev/null
+++ b/build_scripts/win/package.cmd
@@ -0,0 +1,96 @@
+@echo off
+REM Echo off to avoid spam.
+
+REM Non zero is failure, 0 is success.
+SET exit_code_success=0
+SET exit_code_failure_build_apps=1
+SET exit_code_failure_build_locations=2
+
+SET output_dir="\bin\win64\"
+
+REM Used for echos.
+SET current_activity=PACKAGE
+
+REM If scripts are chain called the original dirs should not be overwritten.
+IF NOT DEFINED original_dir (
+ SET original_dir=%CD%
+)
+IF NOT DEFINED project_dir (
+ REM Arg 0 (called %0) is the full path to the file.
+ REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters
+ REM As per above link, %~dp0 expands the zeroth arg to a drive letter and path only.
+ REM Project dir is up two dirs from the file.
+ SET project_dir=%~dp0\..\..\
+)
+
+REM ZIP_LOC can't be called 7Z_LOC because of Windows limitations.
+ECHO %current_activity%: Testing if all required build environment values are set:
+
+IF NOT DEFINED ZIP_LOC (
+ ECHO %current_activity%: ZIP_LOC not defined. Using default value.
+ SET ZIP_LOC="C:\Program Files\7-Zip\7z.exe"
+)
+ECHO %current_activity%: ZIP_LOC set to '%ZIP_LOC%'.
+
+REM EXIST won't find items in the PATH. WHERE will.
+SET ZIP_VALID=0
+IF EXIST %ZIP_LOC% SET ZIP_VALID=1
+IF %ZIP_VALID% EQU 0 (
+ WHERE /Q %ZIP_LOC%
+ IF NOT ERRORLEVEL 1 SET ZIP_VALID=1
+)
+
+IF %ZIP_VALID% EQU 1 (
+ ECHO %current_activity%: ZIP_LOC exists.
+) ELSE (
+ ECHO %current_activity%: ZIP_LOC directory does not exist. Exiting.
+ EXIT /B %exit_code_failure_build_locations%
+)
+
+IF NOT DEFINED NSIS_LOC (
+ ECHO %current_activity%: NSIS_LOC not defined. Using default value.
+ SET NSIS_LOC="C:\Program Files (x86)\NSIS\"
+)
+ECHO %current_activity%: NSIS_LOC set to '%NSIS_LOC%'.
+
+REM EXIST won't find items in the PATH. WHERE will.
+SET NSIS_VALID=0
+IF EXIST %NSIS_LOC% SET NSIS_VALID=1
+REM Prevents error message spam if it doesn't find it in PATH.
+IF %NSIS_VALID% EQU 0 (
+ WHERE /Q %NSIS_LOC%
+ IF NOT ERRORLEVEL 1 SET NSIS_VALID=1
+)
+
+IF %NSIS_VALID% EQU 1 (
+ ECHO %current_activity%: NSIS_LOC exists.
+) ELSE (
+ ECHO %current_activity%: NSIS_LOC directory does not exist. Exiting.
+ EXIT /B %exit_code_failure_build_locations%
+)
+
+ECHO %current_activity%: All required build environment values are set.
+
+IF DEFINED BUILD_DEBUG (
+ ECHO %current_activity%: BUILD_DEBUG var set. NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
+ ECHO %current_activity%: NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
+ ECHO %current_activity%: NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
+ ECHO %current_activity%: NOT PACKAGING TO AVOID SHIPPING DEBUG BUILDS.
+ EXIT /B %exit_code_failure_build_apps%
+)
+
+ECHO %current_activity%: Running 7zip:
+%ZIP_LOC% a %project_dir%\%output_dir%\AdvancedSettings.zip %project_dir%\%output_dir%\AdvancedSettings\*
+ECHO %current_activity%: 7zip done.
+
+ECHO %current_activity%: Running NSIS:
+REM Trying to launch makensis without CD into the dir does not work for some reason.
+CD %NSIS_LOC%
+REM /V2 is show warnings and errors, /WX is treat warnings as errors.
+makensis /V2 /WX %project_dir%\installer\installer.nsi
+IF ERRORLEVEL 1 EXIT /B %exit_code_failure_build_apps%
+ECHO %current_activity%: NSIS done.
+
+CD %original_dir%
+
+ECHO %current_activity%: %current_activity% DONE.
\ No newline at end of file
diff --git a/build_windows.cmd b/build_windows.cmd
index ffa19e3..87afac4 100644
--- a/build_windows.cmd
+++ b/build_windows.cmd
@@ -1,25 +1,34 @@
-echo on
+@echo off
+REM Echo off to avoid spam.
-SET project_dir="%cd%"
+REM Used for echos.
+SET top_level_activity=MASTER
-echo Set up environment...
-set original_path=%PATH%
-set PATH=%QT%\bin\;C:\Qt\Tools\QtCreator\bin\;C:\Qt\QtIFW2.0.1\bin\;C:\Program Files (x86)\NSIS\;%PATH%
-call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM%
+REM If scripts are chain called the original dirs should not be overwritten.
-cd "%project_dir%
-echo Building AdvancedSettings...
-qmake -spec win32-msvc CONFIG+=x86_64 CONFIG-=debug CONFIG+=release
-nmake
+SET original_dir=%CD%
-echo Packaging...
-mkdir %project_dir%\bin\win64\
-cd %project_dir%\bin\win64\
-windeployqt --dir AdvancedSettings\qtdata --libdir AdvancedSettings --plugindir AdvancedSettings\qtdata\plugins --no-system-d3d-compiler --no-opengl-sw --release --qmldir ..\..\src\res\qml\ AdvancedSettings\AdvancedSettings.exe
-rd /s /q AdvancedSettings\moc\
-rd /s /q AdvancedSettings\obj\
-rd /s /q AdvancedSettings\qrc\
+REM Arg 0 (called %0) is the full path to the file.
+REM https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters
+REM As per above link, %~dp0 expands the zeroth arg to a drive letter and path only.
+SET folder_path=%~dp0
+REM Project dir is up two dirs from the file.
+SET project_dir=%folder_path%
-set PATH=%original_path%
-cd %project_dir%
+
+ECHO %top_level_activity%: Calling build script.
+CALL %project_dir%\build_scripts\win\build.cmd
+IF ERRORLEVEL 1 EXIT /B 1
+
+ECHO %top_level_activity%: Calling deployment script.
+CALL %project_dir%\build_scripts\win\deploy.cmd
+IF ERRORLEVEL 1 EXIT /B 1
+
+ECHO %top_level_activity%: Calling packaging script.
+CALL %project_dir%\build_scripts\win\package.cmd
+IF ERRORLEVEL 1 EXIT /B 1
+
+CD %original_dir%
+
+ECHO %top_level_activity%: MASTER DONE.
\ No newline at end of file
diff --git a/docs/building_for_windows.md b/docs/building_for_windows.md
new file mode 100644
index 0000000..960d5ba
--- /dev/null
+++ b/docs/building_for_windows.md
@@ -0,0 +1,79 @@
+# Building for Windows
+
+
+ > * [Requirements](#requirements)
+ > * [Locations and Environment Variables](#locs_and_envs)
+ > * [Building](#features)
+ > * [Using with QtCreator](#qt_creator)
+ > * [Using with Visual Studio](#visual_studio)
+
+
+## Requirements
+
+For compiling:
+
+1. Microsoft Visual Studio (tested on 2017 Community)
+2. Qt Framework (tested on 5.10 and 5.11)
+
+Additionally, for fully building portable and installer release versions:
+3. 7zip
+4. Nullsoft Scriptable Install System (NSIS)
+
+
+## Locations and Environment Variables
+
+The following environmental variables are relevant for building the project.
+
+| Environment Variable | Purpose |
+| -------------------- | ------------- |
+| `QT_LOC` | Path to your Qt `\bin\` folder. |
+| `VS_LOC` | Path to your Visual Studio `vcvarsall.bat` file. |
+| `JOM_LOC` | Path to an `.exe` of `jom.exe`. Usually installed with Qt. `jom` is a wrapper around `nmake` allowing more threads to be used. It is not required, but using `nmake`is slower. If `JOM_LOC` isn't defined, or the `.exe` can't be found `nmake` will be used by default. |
+| `ZIP_LOC` | Path to your 7zip `.exe`. Both portable and installer will work. |
+| `NSIS_LOC` | Path to your installation of NSIS containing the `makensis` file. Both portable and installer will work. |
+
+If an environment variable isn't set a default value will be provided. The default values are shown in the table below.
+
+| Environment Variable | Default Value |
+| -------------------- | ------------- |
+| `QT_LOC` | `"C:\Qt\5.11.1\msvc2017_64\bin\"` |
+| `VS_LOC` | `"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"` |
+| `JOM_LOC` | `"C:\Qt\Tools\QtCreator\bin\jom.exe"`|
+| `ZIP_LOC` | `"C:\Program Files\7-Zip\7z.exe"` |
+| `NSIS_LOC` | `"C:\Program Files (x86)\NSIS\"` |
+
+Additionally, these optional environment variables are supported.
+
+| Environment Variable | Purpose |
+| -------------------- | ------------- |
+| `BUILD_DEBUG` | If set, a debug version will be built. The packaging script will not run with this var set. |
+| `BUILD_VSPROJ` | If set, Visual Studio project files will be built. |
+
+Remember that there's a difference between an unset variable and a variable set to an empty string. `SET BUILD_DEBUG=""` does not unset the variable. You need to write `SET BUILD_DEBUG=`.
+
+The `.dll` files necessary for a release build differ from those needed by a debug build. Therefore you need to make sure you run all scripts with `BUILD_DEBUG` either defined or undefined, depending on your needs.
+
+
+## Building
+
+With the programs above installed and environment variables set, go into the root folder of the repository and run `build_windows.cmd`. Compiled binaries along with everything needed to run portable will output to `.\bin\win64\AdvancedSettings\`.
+
+
+## Using with QtCreator
+
+Run `build_windows.cmd` once and fully build (packaging not necessary) the application. Open the `.pro` file in Qt Creator. A build and toolchain option should be marked in Qt Creator, with all others unmarked. If it isn't, set the directory to be the root repo directory. You should now be able to compile and run in Qt Creator without issues.
+
+Notice that you may need to redeploy library files if you make large changes (run `build_scripts\win\deploy.cmd`).
+
+Additionally, you can set Qt Creator to run `build_scripts\win\deploy.cmd` on compilation in order to ensure that the correct libraries are present. Remember to set or unset `BUILD_DEBUG` depending on your needs.
+
+
+## Using with Visual Studio
+
+Run `build_windows.cmd` once and fully build (packaging not necessary) the application with the `BUILD_VSPROJ` environment variable set. Open the newly created project file. If you compiled a release build (`BUILD_DEBUG` not set) change the build type to release in Visual Studio. You should be able to compile and run with Visual Studio without issues.
+
+Notice that any new files you add or compiler settings you change will not be backported to the `.pro` file. Hence it is necessary to manually change the `.pro` file.
+
+Notice that you may need to redeploy library files if you make large changes (run `build_scripts\win\deploy.cmd`).
+
+Additionally, you can set Visual Studio to run `build_scripts\win\deploy.cmd` on compilation in order to ensure that the correct libraries are present. Remember to set or unset `BUILD_DEBUG` depending on your needs.
\ No newline at end of file
diff --git a/package.cmd b/package.cmd
deleted file mode 100644
index 19a7a58..0000000
--- a/package.cmd
+++ /dev/null
@@ -1,22 +0,0 @@
-echo on
-
-SET project_dir="%cd%"
-
-cd %project_dir%\bin\win64\
-
-echo Copying project files for archival...
-copy "%project_dir%\Readme.md" "AdvancedSettings\Readme.md"
-copy "%project_dir%\LICENSE" "AdvancedSettings\LICENSE.txt"
-xcopy /Y /E /I "%project_dir%\src\res" "AdvancedSettings\res\"
-copy "%project_dir%\src\restartvrserver.bat" "AdvancedSettings\restartvrserver.bat"
-copy "%project_dir%\src\startdesktopmode.bat" "AdvancedSettings\startdesktopmode.bat"
-copy "%project_dir%\src\qt.conf" "AdvancedSettings\qt.conf"
-copy "%project_dir%\src\manifest.vrmanifest" "AdvancedSettings\manifest.vrmanifest"
-copy "%project_dir%\third-party\openvr\bin\win64\openvr_api.dll" "AdvancedSettings\openvr_api.dll"
-
-echo Packaging portable archive...
-7z a AdvancedSettings.zip AdvancedSettings
-
-echo Creating installer...
-cd %project_dir%/installer
-makensis installer.nsi
diff --git a/src/main.cpp b/src/main.cpp
index 922bcc6..96bfff1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -10,21 +10,6 @@
#include
#include "logging.h"
-const char* logConfigFileName = "logging.conf";
-
-const char* logConfigDefault =
-"* GLOBAL:\n"
-" FORMAT = \"[%level] %datetime{%Y-%M-%d %H:%m:%s}: %msg\"\n"
-" FILENAME = \"AdvancedSettings.log\"\n"
-" ENABLED = true\n"
-" TO_FILE = true\n"
-" TO_STANDARD_OUTPUT = true\n"
-" MAX_LOG_FILE_SIZE = 2097152 ## 2MB\n"
-"* TRACE:\n"
-" ENABLED = false\n"
-"* DEBUG:\n"
-" ENABLED = false\n";
-
INITIALIZE_EASYLOGGINGPP
void myQtMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
@@ -73,8 +58,8 @@ void installManifest(bool cleaninstall = false) {
if (apperror != vr::VRApplicationError_None) {
throw std::runtime_error(std::string("Could not add application manifest: ") + std::string(vr::VRApplications()->GetApplicationsErrorNameFromEnum(apperror)));
} else if (!alreadyInstalled || cleaninstall) {
- auto apperror = vr::VRApplications()->SetApplicationAutoLaunch(advsettings::OverlayController::applicationKey, true);
- if (apperror != vr::VRApplicationError_None) {
+ auto app_error = vr::VRApplications()->SetApplicationAutoLaunch(advsettings::OverlayController::applicationKey, true);
+ if (app_error != vr::VRApplicationError_None) {
throw std::runtime_error(std::string("Could not set auto start: ") + std::string(vr::VRApplications()->GetApplicationsErrorNameFromEnum(apperror)));
}
}
@@ -141,6 +126,21 @@ enum ReturnErrorCode {
int main(int argc, char *argv[]) {
+ const char* logConfigFileName = "logging.conf";
+
+ const char* logConfigDefault =
+ "* GLOBAL:\n"
+ " FORMAT = \"[%level] %datetime{%Y-%M-%d %H:%m:%s}: %msg\"\n"
+ " FILENAME = \"AdvancedSettings.log\"\n"
+ " ENABLED = true\n"
+ " TO_FILE = true\n"
+ " TO_STANDARD_OUTPUT = true\n"
+ " MAX_LOG_FILE_SIZE = 2097152 ## 2MB\n"
+ "* TRACE:\n"
+ " ENABLED = false\n"
+ "* DEBUG:\n"
+ " ENABLED = false\n";
+
const bool desktop_mode = argument::CheckCommandLineArgument(argc, argv, argument::DESKTOP_MODE);
const bool no_sound = argument::CheckCommandLineArgument(argc, argv, argument::NO_SOUND);
const bool no_manifest = argument::CheckCommandLineArgument(argc, argv, argument::NO_MANIFEST);
@@ -256,5 +256,4 @@ int main(int argc, char *argv[]) {
LOG(FATAL) << e.what();
return ReturnErrorCode::GENERAL_FAILURE;
}
- return ReturnErrorCode::SUCCESS;
}
diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp
index f4ded03..c0195dc 100644
--- a/src/overlaycontroller.cpp
+++ b/src/overlaycontroller.cpp
@@ -301,8 +301,8 @@ void OverlayController::OnRenderRequest() {
void OverlayController::renderOverlay() {
if (!desktopMode) {
- // skip rendering if the overlay isn't visible
- if (!vr::VROverlay() || !vr::VROverlay()->IsOverlayVisible(m_ulOverlayHandle) && !vr::VROverlay()->IsOverlayVisible(m_ulOverlayThumbnailHandle))
+ // skip rendering if the overlay isn't visible
+ if (!vr::VROverlay() || (!vr::VROverlay()->IsOverlayVisible(m_ulOverlayHandle) && !vr::VROverlay()->IsOverlayVisible(m_ulOverlayThumbnailHandle)))
return;
m_pRenderControl->polishItems();
m_pRenderControl->sync();
@@ -593,7 +593,7 @@ void OverlayController::AddOffsetToCollisionBounds(float offset[3], bool commit)
}
}
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(collisionBounds, collisionBoundsCount);
- delete collisionBounds;
+ delete[] collisionBounds;
}
if (commit && collisionBoundsCount > 0) {
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
@@ -621,7 +621,7 @@ void OverlayController::RotateCollisionBounds(float angle, bool commit) {
}
}
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(collisionBounds, collisionBoundsCount);
- delete collisionBounds;
+ delete[] collisionBounds;
}
if (commit && collisionBoundsCount > 0) {
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h
index 257d0db..f47a4a9 100644
--- a/src/overlaycontroller.h
+++ b/src/overlaycontroller.h
@@ -64,7 +64,7 @@ private:
bool dashboardVisible = false;
QPoint m_ptLastMouse;
- Qt::MouseButtons m_lastMouseButtons = 0;
+ Qt::MouseButtons m_lastMouseButtons = 0;
bool desktopMode;
bool noSound;
@@ -112,7 +112,7 @@ public:
void AddOffsetToCollisionBounds(float offset[3], bool commit = true);
void RotateCollisionBounds(float angle, bool commit = true); // around y axis
- bool isDesktopMode() { return desktopMode; };
+ bool isDesktopMode() { return desktopMode; };
utils::ChaperoneUtils& chaperoneUtils() noexcept { return m_chaperoneUtils; }
diff --git a/src/res/qml/UtilitiesPage.qml b/src/res/qml/UtilitiesPage.qml
index 5a575ee..76841cf 100644
--- a/src/res/qml/UtilitiesPage.qml
+++ b/src/res/qml/UtilitiesPage.qml
@@ -45,7 +45,7 @@ MyStackViewPage {
MyPushButton {
text: "Keyboard Input"
- Layout.preferredWidth: 250
+ Layout.preferredWidth: 200
onClicked: {
OverlayController.showKeyboard("", 601)
}
@@ -61,15 +61,23 @@ MyStackViewPage {
MyPushButton {
text: "Enter"
- Layout.preferredWidth: 250
+ Layout.preferredWidth: 200
onClicked: {
UtilitiesTabController.sendKeyboardEnter()
}
}
+ MyPushButton {
+ text: "Alt-Tab"
+ Layout.preferredWidth: 200
+ onClicked: {
+ UtilitiesTabController.sendKeyboardAltTab()
+ }
+ }
+
MyPushButton {
text: "Backspace"
- Layout.preferredWidth: 250
+ Layout.preferredWidth: 200
onClicked: {
UtilitiesTabController.sendKeyboardBackspace(1)
}
@@ -77,7 +85,7 @@ MyStackViewPage {
MyPushButton {
text: "10x Backspace"
- Layout.preferredWidth: 250
+ Layout.preferredWidth: 200
onClicked: {
UtilitiesTabController.sendKeyboardBackspace(10)
}
diff --git a/src/tabcontrollers/AccessibilityTabController.cpp b/src/tabcontrollers/AccessibilityTabController.cpp
index 6c8e34b..c2dfa9c 100644
--- a/src/tabcontrollers/AccessibilityTabController.cpp
+++ b/src/tabcontrollers/AccessibilityTabController.cpp
@@ -19,9 +19,9 @@ void AccessibilityTabController::initStage1() {
reloadPttConfig();
}
-void AccessibilityTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+void AccessibilityTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
void AccessibilityTabController::setTrackingUniverse(int value) {
diff --git a/src/tabcontrollers/AudioTabController.cpp b/src/tabcontrollers/AudioTabController.cpp
index 788abdb..ab79030 100644
--- a/src/tabcontrollers/AudioTabController.cpp
+++ b/src/tabcontrollers/AudioTabController.cpp
@@ -44,9 +44,9 @@ namespace advsettings {
}
- void AudioTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+ void AudioTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
std::string notifKey = std::string(OverlayController::applicationKey) + ".pptnotification";
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(notifKey.c_str(), notifKey.c_str(), &m_ulNotificationOverlayHandle);
@@ -54,12 +54,12 @@ namespace advsettings {
std::string notifIconPath = QApplication::applicationDirPath().toStdString() + "/res/qml/ptt_notification.png";
if (QFile::exists(QString::fromStdString(notifIconPath))) {
vr::VROverlay()->SetOverlayFromFile(m_ulNotificationOverlayHandle, notifIconPath.c_str());
- vr::VROverlay()->SetOverlayWidthInMeters(m_ulNotificationOverlayHandle, 0.02f);
- vr::HmdMatrix34_t notificationTransform = {
- 1.0f, 0.0f, 0.0f, 0.12f,
- 0.0f, 1.0f, 0.0f, 0.08f,
- 0.0f, 0.0f, 1.0f, -0.3f
- };
+ vr::VROverlay()->SetOverlayWidthInMeters(m_ulNotificationOverlayHandle, 0.02f);
+ vr::HmdMatrix34_t notificationTransform = {{
+ {1.0f, 0.0f, 0.0f, 0.12f},
+ {0.0f, 1.0f, 0.0f, 0.08f},
+ {0.0f, 0.0f, 1.0f, -0.3f}
+ }};
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(m_ulNotificationOverlayHandle, vr::k_unTrackedDeviceIndex_Hmd, ¬ificationTransform);
} else {
LOG(ERROR) << "Could not find notification icon \"" << notifIconPath << "\"";
@@ -307,25 +307,25 @@ namespace advsettings {
emit recordingDeviceListChanged();
}
- int AudioTabController::getPlaybackDeviceCount() {
- return (int)m_playbackDevices.size();
+ int AudioTabController::getPlaybackDeviceCount() {
+ return static_cast(m_playbackDevices.size());
}
- QString AudioTabController::getPlaybackDeviceName(int index) {
- if (index < m_playbackDevices.size()) {
- return QString::fromStdString(m_playbackDevices[index].second);
+ QString AudioTabController::getPlaybackDeviceName(int index) {
+ if (index > 0 && static_cast(index) < m_playbackDevices.size()) {
+ return QString::fromStdString(m_playbackDevices[static_cast(index)].second);
} else {
return "";
}
}
- int AudioTabController::getRecordingDeviceCount() {
- return (int)m_recordingDevices.size();
+ int AudioTabController::getRecordingDeviceCount() {
+ return static_cast(m_recordingDevices.size());
}
QString AudioTabController::getRecordingDeviceName(int index) {
- if (index < m_recordingDevices.size()) {
- return QString::fromStdString(m_recordingDevices[index].second);
+ if (index > 0 && static_cast(index) < m_playbackDevices.size()) {
+ return QString::fromStdString(m_recordingDevices[static_cast(index)].second);
} else {
return "";
}
@@ -346,15 +346,18 @@ namespace advsettings {
void AudioTabController::setPlaybackDeviceIndex(int index, bool notify) {
if (index != m_playbackDeviceIndex) {
- if (index < m_playbackDevices.size() && index != m_mirrorDeviceIndex) {
+ if (index > 0 && static_cast(index) < m_playbackDevices.size() && index != m_mirrorDeviceIndex) {
vr::EVRSettingsError vrSettingsError;
//Applys Audio Switch IN VR
- vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnPlaybackDevice_String, m_playbackDevices[index].first.c_str(), &vrSettingsError);
+ vr::VRSettings()->SetString(vr::k_pch_audio_Section,
+ vr::k_pch_audio_OnPlaybackDevice_String,
+ m_playbackDevices[static_cast(index)].first.c_str(),
+ &vrSettingsError);
if (vrSettingsError != vr::VRSettingsError_None) {
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnPlaybackDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
} else {
- vr::VRSettings()->Sync();
- audioManager->setPlaybackDevice(m_playbackDevices[index].first, notify);
+ vr::VRSettings()->Sync();
+ audioManager->setPlaybackDevice(m_playbackDevices[static_cast(index)].first, notify);
}
} else if (notify) {
emit playbackDeviceIndexChanged(m_playbackDeviceIndex);
@@ -373,14 +376,17 @@ namespace advsettings {
vr::VRSettings()->Sync();
audioManager->setMirrorDevice("", notify);
}
- } else if (index < m_playbackDevices.size() && index != m_playbackDeviceIndex && index != m_mirrorDeviceIndex) {
- vr::EVRSettingsError vrSettingsError;
- vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnPlaybackMirrorDevice_String, m_playbackDevices[index].first.c_str(), &vrSettingsError);
+ } else if (index > 0 && static_cast(index) < m_playbackDevices.size() && index != m_playbackDeviceIndex && index != m_mirrorDeviceIndex) {
+ vr::EVRSettingsError vrSettingsError;
+ vr::VRSettings()->SetString(vr::k_pch_audio_Section,
+ vr::k_pch_audio_OnPlaybackMirrorDevice_String,
+ m_playbackDevices[static_cast(index)].first.c_str(),
+ &vrSettingsError);
if (vrSettingsError != vr::VRSettingsError_None) {
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnPlaybackMirrorDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
} else {
vr::VRSettings()->Sync();
- audioManager->setMirrorDevice(m_playbackDevices[index].first, notify);
+ audioManager->setMirrorDevice(m_playbackDevices[static_cast(index)].first, notify);
}
} else if (notify) {
emit mirrorDeviceIndexChanged(m_mirrorDeviceIndex);
@@ -390,14 +396,14 @@ namespace advsettings {
void AudioTabController::setMicDeviceIndex(int index, bool notify) {
if (index != m_recordingDeviceIndex) {
- if (index < m_recordingDevices.size()) {
- vr::EVRSettingsError vrSettingsError;
- vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnRecordDevice_String, m_recordingDevices[index].first.c_str(), &vrSettingsError);
+ if (index > 0 && static_cast(index) < m_recordingDevices.size()) {
+ vr::EVRSettingsError vrSettingsError;
+ vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnRecordDevice_String, m_recordingDevices[static_cast(index)].first.c_str(), &vrSettingsError);
if (vrSettingsError != vr::VRSettingsError_None) {
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnRecordDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
} else {
- vr::VRSettings()->Sync();
- audioManager->setMicDevice(m_recordingDevices[index].first, notify);
+ vr::VRSettings()->Sync();
+ audioManager->setMicDevice(m_recordingDevices[static_cast(index)].first, notify);
}
} else if (notify) {
emit micDeviceIndexChanged(m_recordingDeviceIndex);
@@ -496,8 +502,8 @@ namespace advsettings {
auto profileCount = settings->beginReadArray("audioProfiles");
for (int i = 0; i < profileCount; i++) {
settings->setArrayIndex(i);
- audioProfiles.emplace_back();
- auto& entry = audioProfiles[i];
+ audioProfiles.emplace_back();
+ auto& entry = audioProfiles[static_cast(i)];
entry.profileName = settings->value("profileName").toString().toStdString();
entry.playbackName = settings->value("playbackName").toString().toStdString();
entry.micName = settings->value("micName").toString().toStdString();
@@ -528,9 +534,9 @@ namespace advsettings {
auto settings = OverlayController::appSettings();
settings->beginGroup(getSettingsName());
settings->beginWriteArray("audioProfiles");
- unsigned i = 0;
- for (auto& p : audioProfiles) {
- settings->setArrayIndex(i);
+ int i = 0;
+ for (auto& p : audioProfiles) {
+ settings->setArrayIndex(i);
settings->setValue("profileName", QString::fromStdString(p.profileName));
settings->setValue("playbackName", QString::fromStdString(p.playbackName));
settings->setValue("micName", QString::fromStdString(p.micName));
@@ -657,9 +663,9 @@ namespace advsettings {
}
- unsigned AudioTabController::getAudioProfileCount() {
- return (unsigned)audioProfiles.size();
- }
+ unsigned AudioTabController::getAudioProfileCount() {
+ return static_cast(audioProfiles.size());
+ }
QString AudioTabController::getAudioProfileName(unsigned index) {
if (index < audioProfiles.size()) {
@@ -676,28 +682,31 @@ namespace advsettings {
description: Gets proper index value for selecting specific devices.
*/
- int AudioTabController::getPlaybackIndex(std::string str) {
- for (int i = 0; i < m_playbackDevices.size(); i++) {
- if (str.compare(m_playbackDevices[i].second)==0) {
- return i;
+ int AudioTabController::getPlaybackIndex(std::string str) {
+ //Unsigned to avoid two casts. i won't be negative because we only increment it.
+ for (unsigned int i = 0; i < m_playbackDevices.size(); i++) {
+ if (str.compare(m_playbackDevices[i].second)==0) {
+ return static_cast(i);
}
}
return m_playbackDeviceIndex;
}
- int AudioTabController::getRecordingIndex(std::string str) {
- for (int i = 0; i < m_recordingDevices.size(); i++) {
- if (str.compare(m_recordingDevices[i].second) == 0) {
- return i;
+ int AudioTabController::getRecordingIndex(std::string str) {
+ //Unsigned to avoid two casts. i won't be negative because we only increment it.
+ for (unsigned int i = 0; i < m_recordingDevices.size(); i++) {
+ if (str.compare(m_recordingDevices[i].second) == 0) {
+ return static_cast(i);
}
}
return m_recordingDeviceIndex;
}
int AudioTabController::getMirrorIndex(std::string str) {
- for (int i = 0; i < m_playbackDevices.size(); i++) {
- if (str.compare(m_playbackDevices[i].second) == 0) {
- return i;
+ //Unsigned to avoid two casts. i won't be negative because we only increment it.
+ for (unsigned int i = 0; i < m_playbackDevices.size(); i++) {
+ if (str.compare(m_playbackDevices[i].second) == 0) {
+ return static_cast(i);
}
}
return -1;
diff --git a/src/tabcontrollers/ChaperoneTabController.cpp b/src/tabcontrollers/ChaperoneTabController.cpp
index cbde2e2..f286cd9 100644
--- a/src/tabcontrollers/ChaperoneTabController.cpp
+++ b/src/tabcontrollers/ChaperoneTabController.cpp
@@ -1,7 +1,7 @@
#include "ChaperoneTabController.h"
#include
#include "../overlaycontroller.h"
-#include
+#include
// application namespace
namespace advsettings {
@@ -32,9 +32,9 @@ void ChaperoneTabController::initStage1() {
}
-void ChaperoneTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+void ChaperoneTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
@@ -361,7 +361,7 @@ void ChaperoneTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses,
poseHmd.mDeviceToAbsoluteTracking.m[1][3],
poseHmd.mDeviceToAbsoluteTracking.m[2][3]
});
- if (!isnan(distanceHmd)) {
+ if (!std::isnan(distanceHmd)) {
minDistance = distanceHmd;
}
}
@@ -374,7 +374,7 @@ void ChaperoneTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses,
poseLeft.mDeviceToAbsoluteTracking.m[1][3],
poseLeft.mDeviceToAbsoluteTracking.m[2][3]
});
- if (!isnan(distanceLeft) && (isnan(minDistance) || distanceLeft < minDistance)) {
+ if (!std::isnan(distanceLeft) && (std::isnan(minDistance) || distanceLeft < minDistance)) {
minDistance = distanceLeft;
}
}
@@ -388,12 +388,12 @@ void ChaperoneTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses,
poseRight.mDeviceToAbsoluteTracking.m[1][3],
poseRight.mDeviceToAbsoluteTracking.m[2][3]
});
- if (!isnan(distanceRight) && (isnan(minDistance) || distanceRight < minDistance)) {
+ if (!std::isnan(distanceRight) && (std::isnan(minDistance) || distanceRight < minDistance)) {
minDistance = distanceRight;
}
}
}
- if (!isnan(minDistance)) {
+ if (!std::isnan(minDistance)) {
handleChaperoneWarnings(minDistance);
}
}
@@ -486,7 +486,7 @@ void ChaperoneTabController::setHeight(float value, bool notify) {
}
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(collisionBounds, collisionBoundsCount);
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
- delete collisionBounds;
+ delete[] collisionBounds;
}
if (notify) {
emit heightChanged(m_fadeDistance);
@@ -1002,11 +1002,11 @@ float ChaperoneTabController::getBoundsMaxY() {
} else {
ci = 2;
}
- if (isnan(result) || result < collisionBounds[b].vCorners[ci].v[1]) {
+ if (std::isnan(result) || result < collisionBounds[b].vCorners[ci].v[1]) {
result = collisionBounds[b].vCorners[ci].v[1];
}
}
- delete collisionBounds;
+ delete[] collisionBounds;
}
return result;
}
diff --git a/src/tabcontrollers/FixFloorTabController.cpp b/src/tabcontrollers/FixFloorTabController.cpp
index 8ac480d..34d2e69 100644
--- a/src/tabcontrollers/FixFloorTabController.cpp
+++ b/src/tabcontrollers/FixFloorTabController.cpp
@@ -9,9 +9,9 @@ namespace advsettings {
void FixFloorTabController::initStage1() {
}
-void FixFloorTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+void FixFloorTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
void FixFloorTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses) {
diff --git a/src/tabcontrollers/KeyboardInput.h b/src/tabcontrollers/KeyboardInput.h
index 28c2468..05fcfc0 100644
--- a/src/tabcontrollers/KeyboardInput.h
+++ b/src/tabcontrollers/KeyboardInput.h
@@ -16,6 +16,7 @@ public:
virtual void sendKeyboardInput(QString input) = 0;
virtual void sendKeyboardEnter() = 0;
virtual void sendKeyboardBackspace(int count) = 0;
+ virtual void sendKeyboardAltTab() = 0;
};
}
diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp
index 8641185..1dec969 100644
--- a/src/tabcontrollers/MoveCenterTabController.cpp
+++ b/src/tabcontrollers/MoveCenterTabController.cpp
@@ -54,12 +54,12 @@ void MoveCenterTabController::initStage1() {
m_lockZToggle = value.toBool();
}
settings->endGroup();
- lastMoveButtonClick[0] = lastMoveButtonClick[0] = clock::now();
+ lastMoveButtonClick[0] = lastMoveButtonClick[1] = clock::now();
}
-void MoveCenterTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+void MoveCenterTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
diff --git a/src/tabcontrollers/ReviveTabController.cpp b/src/tabcontrollers/ReviveTabController.cpp
index 58994d8..78c7d80 100644
--- a/src/tabcontrollers/ReviveTabController.cpp
+++ b/src/tabcontrollers/ReviveTabController.cpp
@@ -167,9 +167,9 @@ namespace advsettings {
}
}
- void ReviveTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+ void ReviveTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
void ReviveTabController::eventLoopTick() {
diff --git a/src/tabcontrollers/SettingsTabController.cpp b/src/tabcontrollers/SettingsTabController.cpp
index 82bde48..ae747c5 100644
--- a/src/tabcontrollers/SettingsTabController.cpp
+++ b/src/tabcontrollers/SettingsTabController.cpp
@@ -17,9 +17,9 @@ void SettingsTabController::initStage1() {
}
}
-void SettingsTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+void SettingsTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
void SettingsTabController::eventLoopTick() {
diff --git a/src/tabcontrollers/StatisticsTabController.cpp b/src/tabcontrollers/StatisticsTabController.cpp
index 2195af5..6ee28d6 100644
--- a/src/tabcontrollers/StatisticsTabController.cpp
+++ b/src/tabcontrollers/StatisticsTabController.cpp
@@ -8,9 +8,9 @@ namespace advsettings {
void StatisticsTabController::initStage1() {
}
-void StatisticsTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+void StatisticsTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
void StatisticsTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses, float leftSpeed, float rightSpeed) {
diff --git a/src/tabcontrollers/SteamVRTabController.cpp b/src/tabcontrollers/SteamVRTabController.cpp
index e56603e..d3cfaba 100644
--- a/src/tabcontrollers/SteamVRTabController.cpp
+++ b/src/tabcontrollers/SteamVRTabController.cpp
@@ -10,6 +10,13 @@ namespace vr {
// application namespace
namespace advsettings {
+// openvr's github repo hasn't been updated yet to reflect changes in beta 1477423729.
+//static const char* vrsettings_steamvr_allowAsyncReprojection = "allowAsyncReprojection";
+//static const char* vrsettings_steamvr_allowInterleavedReprojection = "allowInterleavedReprojection";
+
+static const char* vrsettings_steamvr_supersampleScale = "supersampleScale";
+static const char* vrsettings_steamvr_allowSupersampleFiltering = "allowSupersampleFiltering";
+static const char* vrsettings_compositor_category = "compositor";
void SteamVRTabController::initStage1() {
eventLoopTick();
@@ -17,9 +24,9 @@ void SteamVRTabController::initStage1() {
}
-void SteamVRTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+void SteamVRTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
diff --git a/src/tabcontrollers/SteamVRTabController.h b/src/tabcontrollers/SteamVRTabController.h
index 79d5ba0..e644cb9 100644
--- a/src/tabcontrollers/SteamVRTabController.h
+++ b/src/tabcontrollers/SteamVRTabController.h
@@ -3,12 +3,6 @@
#include
-// openvr's github repo hasn't been updated yet to reflect changes in beta 1477423729.
-//static const char* vrsettings_steamvr_allowAsyncReprojection = "allowAsyncReprojection";
-//static const char* vrsettings_steamvr_allowInterleavedReprojection = "allowInterleavedReprojection";
-static const char* vrsettings_compositor_category = "compositor";
-static const char* vrsettings_steamvr_supersampleScale = "supersampleScale";
-static const char* vrsettings_steamvr_allowSupersampleFiltering = "allowSupersampleFiltering";
class QQuickWindow;
diff --git a/src/tabcontrollers/UtilitiesTabController.cpp b/src/tabcontrollers/UtilitiesTabController.cpp
index 0ca7744..c83cfd3 100644
--- a/src/tabcontrollers/UtilitiesTabController.cpp
+++ b/src/tabcontrollers/UtilitiesTabController.cpp
@@ -48,9 +48,9 @@ namespace advsettings {
}
- void UtilitiesTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
- this->parent = parent;
- this->widget = widget;
+ void UtilitiesTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
+ this->parent = var_parent;
+ this->widget = var_widget;
}
void UtilitiesTabController::sendKeyboardInput(QString input) {
@@ -61,6 +61,10 @@ namespace advsettings {
keyboardInput->sendKeyboardEnter();
}
+ void UtilitiesTabController::sendKeyboardAltTab() {
+ keyboardInput->sendKeyboardAltTab();
+ }
+
void UtilitiesTabController::sendKeyboardBackspace(int count) {
keyboardInput->sendKeyboardBackspace(count);
}
@@ -206,11 +210,11 @@ namespace advsettings {
if (QFile::exists(QString::fromStdString(batteryIconPath))) {
vr::VROverlay()->SetOverlayFromFile(handle, batteryIconPath.c_str());
vr::VROverlay()->SetOverlayWidthInMeters(handle, 0.05f);
- vr::HmdMatrix34_t notificationTransform = {
- 1.0f, 0.0f, 0.0f, 0.00f,
- 0.0f, -1.0f, 0.0f, 0.01f,
- 0.0f, 0.0f, -1.0f, -0.013f
- };
+ vr::HmdMatrix34_t notificationTransform = {{
+ {1.0f, 0.0f, 0.0f, 0.00f},
+ {0.0f, -1.0f, 0.0f, 0.01f},
+ {0.0f, 0.0f, -1.0f, -0.013f}
+ }};
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(handle, index, ¬ificationTransform);
LOG(INFO) << "Created battery overlay for device " << index;
} else {
diff --git a/src/tabcontrollers/UtilitiesTabController.h b/src/tabcontrollers/UtilitiesTabController.h
index 22e2f63..29d24e6 100644
--- a/src/tabcontrollers/UtilitiesTabController.h
+++ b/src/tabcontrollers/UtilitiesTabController.h
@@ -59,6 +59,7 @@ namespace advsettings {
public slots:
void sendKeyboardInput(QString input);
void sendKeyboardEnter();
+ void sendKeyboardAltTab();
void sendKeyboardBackspace(int count);
void setAlarmEnabled(bool enabled, bool notify = true);
diff --git a/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp b/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp
index 2c3a612..a36781b 100644
--- a/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp
+++ b/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp
@@ -1,16 +1,23 @@
#include "AudioManagerDummy.h"
+// Used to get the compiler to shut up about C4100: unreferenced formal parameter.
+// The cast is to get GCC to shut up about it.
+#define UNREFERENCED_PARAMETER(P) static_cast((P))
+
// application namespace
namespace advsettings {
void AudioManagerDummy::init(AudioTabController *controller)
{
// noop
+ UNREFERENCED_PARAMETER(controller);
}
void AudioManagerDummy::setPlaybackDevice(const std::string &id, bool notify)
{
// noop
+ UNREFERENCED_PARAMETER(id);
+ UNREFERENCED_PARAMETER(notify);
}
std::string AudioManagerDummy::getPlaybackDevName()
@@ -26,6 +33,8 @@ std::string AudioManagerDummy::getPlaybackDevId()
void AudioManagerDummy::setMirrorDevice(const std::string &id, bool notify)
{
// noop
+ UNREFERENCED_PARAMETER(id);
+ UNREFERENCED_PARAMETER(notify);
}
bool AudioManagerDummy::isMirrorValid()
@@ -50,6 +59,7 @@ float AudioManagerDummy::getMirrorVolume()
bool AudioManagerDummy::setMirrorVolume(float value)
{
+ UNREFERENCED_PARAMETER(value);
return false;
}
@@ -60,6 +70,7 @@ bool AudioManagerDummy::getMirrorMuted()
bool AudioManagerDummy::setMirrorMuted(bool value)
{
+ UNREFERENCED_PARAMETER(value);
return false;
}
@@ -71,6 +82,8 @@ bool AudioManagerDummy::isMicValid()
void AudioManagerDummy::setMicDevice(const std::string &id, bool notify)
{
// noop
+ UNREFERENCED_PARAMETER(id);
+ UNREFERENCED_PARAMETER(notify);
}
std::string AudioManagerDummy::getMicDevName()
@@ -90,6 +103,7 @@ float AudioManagerDummy::getMicVolume()
bool AudioManagerDummy::setMicVolume(float value)
{
+ UNREFERENCED_PARAMETER(value);
return false;
}
@@ -100,6 +114,7 @@ bool AudioManagerDummy::getMicMuted()
bool AudioManagerDummy::setMicMuted(bool value)
{
+ UNREFERENCED_PARAMETER(value);
return false;
}
diff --git a/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp b/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp
index 7e41a32..b05fcf5 100644
--- a/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp
+++ b/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp
@@ -31,7 +31,7 @@ AudioManagerWindows::~AudioManagerWindows() {
audioDeviceEnumerator->Release();
}
-void AudioManagerWindows::init(AudioTabController* controller) {
+void AudioManagerWindows::init(AudioTabController* var_controller) {
std::lock_guard lock(_mutex);
audioDeviceEnumerator = getAudioDeviceEnumerator();
if (!audioDeviceEnumerator) {
@@ -47,7 +47,7 @@ void AudioManagerWindows::init(AudioTabController* controller) {
} else {
LOG(WARNING) << "Could not find a default recording device.";
}
- this->controller = controller;
+ this->controller = var_controller;
audioDeviceEnumerator->RegisterEndpointNotificationCallback((IMMNotificationClient*)this);
policyConfig = getPolicyConfig();
if (!policyConfig) {
@@ -277,20 +277,20 @@ IMMDeviceEnumerator* AudioManagerWindows::getAudioDeviceEnumerator() {
}
IPolicyConfig * AudioManagerWindows::getPolicyConfig() {
- IPolicyConfig* policyConfig = nullptr;
+ IPolicyConfig* var_policyConfig = nullptr;
// for Win 10
- auto hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig2, (LPVOID *)&policyConfig);
+ auto hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig2, (LPVOID *)&var_policyConfig);
if (hr != S_OK) {
- hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig1, (LPVOID *)&policyConfig);
+ hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig1, (LPVOID *)&var_policyConfig);
}
// for Win Vista, 7, 8, 8.1
if (hr != S_OK) {
- hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig0, (LPVOID *)&policyConfig);
+ hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig0, (LPVOID *)&var_policyConfig);
}
if (hr != S_OK) {
return nullptr;
} else {
- return policyConfig;
+ return var_policyConfig;
}
}
diff --git a/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp b/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp
index f0ab55b..83cd526 100644
--- a/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp
+++ b/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp
@@ -1,10 +1,15 @@
#include "KeyboardInputDummy.h"
+// Used to get the compiler to shut up about C4100: unreferenced formal parameter.
+// The cast is to get GCC to shut up about it.
+#define UNREFERENCED_PARAMETER(P) static_cast((P))
+
namespace advsettings {
void KeyboardInputDummy::sendKeyboardInput(QString input)
{
// noop
+ UNREFERENCED_PARAMETER(input);
}
void KeyboardInputDummy::sendKeyboardEnter()
@@ -13,6 +18,12 @@ void KeyboardInputDummy::sendKeyboardEnter()
}
void KeyboardInputDummy::sendKeyboardBackspace(int count)
+{
+ // noop
+ UNREFERENCED_PARAMETER(count);
+}
+
+void KeyboardInputDummy::sendKeyboardAltTab()
{
// noop
}
diff --git a/src/tabcontrollers/keyboardinput/KeyboardInputDummy.h b/src/tabcontrollers/keyboardinput/KeyboardInputDummy.h
index 53b651c..f5ee302 100644
--- a/src/tabcontrollers/keyboardinput/KeyboardInputDummy.h
+++ b/src/tabcontrollers/keyboardinput/KeyboardInputDummy.h
@@ -12,6 +12,7 @@ public:
virtual void sendKeyboardInput(QString input) override;
virtual void sendKeyboardEnter() override;
virtual void sendKeyboardBackspace(int count) override;
+ virtual void sendKeyboardAltTab() override;
};
}
diff --git a/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp b/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
index dfa1518..471f27a 100644
--- a/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
+++ b/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
@@ -17,12 +17,30 @@ void fillKiStruct(INPUT& ip, WORD scanCode, bool keyup) {
ip.ki.time = 0;
};
+void sendKeyboardInputRaw(int inputCount, LPINPUT input) {
+ if ((inputCount > 0) && !SendInput(static_cast(inputCount), input, sizeof(INPUT))) {
+ char *err;
+ auto errCode = GetLastError();
+ if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ nullptr,
+ errCode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
+ reinterpret_cast(&err),
+ 0,
+ nullptr)){
+ LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
+ } else {
+ LOG(ERROR) << "Error calling SendInput(): " << err;
+ }
+ }
+}
+
void KeyboardInputWindows::sendKeyboardInput(QString input)
{
int len = input.length();
if (len > 0) {
- LPINPUT ips = new INPUT[len * 5 + 3];
- unsigned ii = 0;
+ LPINPUT ips = new INPUT[static_cast(len) * 5 + 3];
+ int ii = 0;
bool shiftPressed = false;
bool ctrlPressed = false;
bool altPressed = false;
@@ -69,22 +87,9 @@ void KeyboardInputWindows::sendKeyboardInput(QString input)
fillKiStruct(ips[ii++], VK_MENU, true);
altPressed = false;
}
- if (!SendInput(ii, ips, sizeof(INPUT))) {
- char *err;
- auto errCode = GetLastError();
- if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- errCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
- (LPTSTR)&err,
- 0,
- NULL)){
- LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
- } else {
- LOG(ERROR) << "Error calling SendInput(): " << err;
- }
- }
- delete ips;
+
+ sendKeyboardInputRaw(ii, ips);
+ delete[] ips;
}
}
@@ -93,49 +98,37 @@ void KeyboardInputWindows::sendKeyboardEnter()
LPINPUT ips = new INPUT[2];
fillKiStruct(ips[0], VK_RETURN, false);
fillKiStruct(ips[1], VK_RETURN, true);
- if (!SendInput(2, ips, sizeof(INPUT))) {
- char *err;
- auto errCode = GetLastError();
- if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- errCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
- (LPTSTR)&err,
- 0,
- NULL)) {
- LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
- } else {
- LOG(ERROR) << "Error calling SendInput(): " << err;
- }
- }
- delete ips;
+
+ sendKeyboardInputRaw(2, ips);
+ delete[] ips;
}
void KeyboardInputWindows::sendKeyboardBackspace(int count)
{
if (count > 0) {
- LPINPUT ips = new INPUT[count * 2];
+ // We ensure that count is nonnegative, therefore safe cast.
+ LPINPUT ips = new INPUT[static_cast(count) * 2];
for (int i = 0; i < count; i++) {
fillKiStruct(ips[2 * i], VK_BACK, false);
fillKiStruct(ips[2 * i + 1], VK_BACK, true);
}
- if (!SendInput(2 * count, ips, sizeof(INPUT))) {
- char *err;
- auto errCode = GetLastError();
- if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- errCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
- (LPTSTR)&err,
- 0,
- NULL)) {
- LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
- } else {
- LOG(ERROR) << "Error calling SendInput(): " << err;
- }
- }
- delete ips;
+
+ sendKeyboardInputRaw(count * 2, ips);
+ delete[] ips;
}
}
+void KeyboardInputWindows::sendKeyboardAltTab()
+{
+ LPINPUT ips = new INPUT[4];
+ // VK_MENU is alt
+ fillKiStruct(ips[0], VK_MENU, false);
+ fillKiStruct(ips[1], VK_TAB, false);
+ fillKiStruct(ips[2], VK_TAB, true);
+ fillKiStruct(ips[3], VK_MENU, true);
+
+ sendKeyboardInputRaw(4, ips);
+ delete[] ips;
+}
+
}
diff --git a/src/tabcontrollers/keyboardinput/KeyboardInputWindows.h b/src/tabcontrollers/keyboardinput/KeyboardInputWindows.h
index 70318a5..3292b72 100644
--- a/src/tabcontrollers/keyboardinput/KeyboardInputWindows.h
+++ b/src/tabcontrollers/keyboardinput/KeyboardInputWindows.h
@@ -12,6 +12,7 @@ public:
virtual void sendKeyboardInput(QString input) override;
virtual void sendKeyboardEnter() override;
virtual void sendKeyboardBackspace(int count) override;
+ virtual void sendKeyboardAltTab() override;
};
}
diff --git a/src/utils/ChaperoneUtils.cpp b/src/utils/ChaperoneUtils.cpp
index a0cbf6c..832593a 100644
--- a/src/utils/ChaperoneUtils.cpp
+++ b/src/utils/ChaperoneUtils.cpp
@@ -1,7 +1,6 @@
-
#include "ChaperoneUtils.h"
#include
-#include
+#include
namespace utils {
@@ -43,7 +42,7 @@ float ChaperoneUtils::_getDistanceToChaperone(const vr::HmdVector3_t & x, vr::Hm
float d_z = x1_z - x.v[2];
d = sqrt(d_x*d_x + d_z*d_z);
}
- if (isnan(distance) || d < distance) {
+ if (std::isnan(distance) || d < distance) {
distance = d;
if (projectedPoint) {
projectedPoint->v[0] = x1_x;