default profile + display ptt/audio profile

This commit is contained in:
ykeara
2018-12-28 13:45:21 -06:00
36 changed files with 789 additions and 618 deletions
+3
View File
@@ -9,3 +9,6 @@ Makefile*
*.stash
*.appxmanifest
*.user
installer/AdvancedSettings-Installer.exe
*.user*
+15
View File
@@ -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
+71 -7
View File
@@ -1,11 +1,41 @@
![language](https://img.shields.io/badge/Language-C%2B%2B11%2C%20QML-green.svg) ![dependencies](https://img.shields.io/badge/Dependencies-OpenVR%2C%20Qt5-green.svg) ![license_gpl3](https://img.shields.io/badge/License-GPL%203.0-green.svg) [![Build status](https://ci.appveyor.com/api/projects/status/8oivf5xws6vsq2x3/branch/master?svg=true)](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)
<a name="top"></a>
# OpenVR Advanced Settings Overlay
Adds an overlay to the OpenVR dashboard that allows access to advanced settings.
![Example Screenshot](docs/screenshots/InVRScreenshot.png)
<a name="features"></a>
# 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)
<a name="usage"></a>
# Usage
<a name="installer"></a>
## 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.
<a name="standalone"></a>
## 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.
<a name="command_line_arguments"></a>
## 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`.
<a name="desktop_mode"></a>
## 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.
<a name="preview_builds"></a>
## Preview builds
If you want to try latest and greatest unreleased features, you can download latest changes in the alpha branches of the repository.
<a name="documentation"></a>
# Documentation
<a name="top_page"></a>
## Top Page:
![Root Page](docs/screenshots/RootPage.png)
@@ -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.
<a name="steamvr_page"></a>
## - SteamVR Page:
![SteamVR Page](docs/screenshots/SteamVRPage.png)
@@ -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).
<a name="chaperone_page"></a>
## - Chaperone Page:
![Chaperone Page](docs/screenshots/ChaperonePage.png)
@@ -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.
<a name="chaperone_proximity_page"></a>
## - Chaperone Proximity Warning Settings Page:
![Chaperone Proximity Warning Settings Page](docs/screenshots/ChaperoneWarningPage.png)
@@ -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) )*
<a name="play_space_page"></a>
## - Play Space Page:
![Play Space Page](docs/screenshots/PlayspacePage.png)
@@ -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.
<a name="playspace_fix_page"></a>
## - Playspace Fix Page:
![Playspace Fix Page](docs/screenshots/FloorFixPage.png)
@@ -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.
<a name="audio_page"></a>
## - Audio Page:
![Audio Page](docs/screenshots/AudioPage.png)
@@ -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.
<a name="revive_page"></a>
## - Revive Page:
![Revive Page](docs/screenshots/RevivePage.png)
@@ -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).
<a name="utilities_page"></a>
## - Utilities Page:
![Utilities Page](docs/screenshots/UtilitiesPage.png)
@@ -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.
<a name="accessibility_page"></a>
## - Accessibility Page:
![Accessibility Page](docs/screenshots/AccessibilityPage.png)
- **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.
<a name="statistics_page"></a>
## - Statistics Page:
![Statistics Page](docs/screenshots/StatisticsPage.png)
@@ -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.
<a name="settings_page"></a>
## - Settings Page:
![Settings Page](docs/screenshots/SettingsPage.png)
@@ -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.
<a name="how_to_compile"></a>
# 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.
<a name="building_on_windows"></a>
## 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).
<a name="building_on_linux"></a>
## 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.
<a name="notes"></a>
# 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).
<a name="known_bugs"></a>
# Known Bugs
- None yet.
<a name="license"></a>
# License
This software is released under GPL 3.0.
+29 -64
View File
@@ -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
}
-318
View File
@@ -1,318 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.7.2, 2018-11-08T17:22:36. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{e9f45e75-3f05-4ad6-a0dc-8a090aa48e0b}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.10.1 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.10.1 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5101.win64_msvc2017_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">advancedSettings</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">advancedSettings2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration://192.168.1.165/win10/OpenVR-AdvancedSettings/advancedSettings.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">advancedSettings.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/Users/robin/Documents/build-advancedSettings-Desktop_Qt_5_10_1_MSVC2017_64bit-Debug/bin/win64/AdvancedSettings</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>
+6 -3
View File
@@ -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
+115
View File
@@ -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.
+119
View File
@@ -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.
+96
View File
@@ -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.
+28 -19
View File
@@ -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.
+79
View File
@@ -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)
<a name="requirements"></a>
## 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)
<a name="locs_and_envs"></a>
## 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.
<a name="building"></a>
## 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\`.
<a name="qt_creator"></a>
## 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.
<a name="visual_studio"></a>
## 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.
-22
View File
@@ -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
+17 -18
View File
@@ -10,21 +10,6 @@
#include <iostream>
#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;
}
+4 -4
View File
@@ -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);
+2 -2
View File
@@ -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; }
+12 -4
View File
@@ -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)
}
@@ -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) {
+58 -49
View File
@@ -47,9 +47,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";
@@ -58,12 +58,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, &notificationTransform);
} else {
LOG(ERROR) << "Could not find notification icon \"" << notifIconPath << "\"";
@@ -327,25 +327,25 @@ namespace advsettings {
emit recordingDeviceListChanged();
}
int AudioTabController::getPlaybackDeviceCount() {
return (int)m_playbackDevices.size();
int AudioTabController::getPlaybackDeviceCount() {
return static_cast<int>(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<size_t>(index) < m_playbackDevices.size()) {
return QString::fromStdString(m_playbackDevices[static_cast<size_t>(index)].second);
} else {
return "<ERROR>";
}
}
int AudioTabController::getRecordingDeviceCount() {
return (int)m_recordingDevices.size();
int AudioTabController::getRecordingDeviceCount() {
return static_cast<int>(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<size_t>(index) < m_playbackDevices.size()) {
return QString::fromStdString(m_recordingDevices[static_cast<size_t>(index)].second);
} else {
return "<ERROR>";
}
@@ -366,12 +366,16 @@ 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<size_t>(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<size_t>(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();
@@ -395,14 +399,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<size_t>(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<size_t>(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<size_t>(index)].first, notify);
}
} else if (notify) {
emit mirrorDeviceIndexChanged(m_mirrorDeviceIndex);
@@ -412,14 +419,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<size_t>(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<size_t>(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<size_t>(index)].first, notify);
}
} else if (notify) {
emit micDeviceIndexChanged(m_recordingDeviceIndex);
@@ -518,8 +525,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<size_t>(i)];
entry.profileName = settings->value("profileName").toString().toStdString();
entry.playbackName = settings->value("playbackName").toString().toStdString();
entry.micName = settings->value("micName").toString().toStdString();
@@ -551,9 +558,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));
@@ -693,9 +700,9 @@ namespace advsettings {
}
unsigned AudioTabController::getAudioProfileCount() {
return (unsigned)audioProfiles.size();
}
unsigned AudioTabController::getAudioProfileCount() {
return static_cast<unsigned int>(audioProfiles.size());
}
QString AudioTabController::getAudioProfileName(unsigned index) {
if (index < audioProfiles.size()) {
@@ -712,29 +719,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<int>(i);
}
}
return m_playbackDeviceIndex;
}
int AudioTabController::getRecordingIndex(std::string str) {
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
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<int>(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<int>(i);
}
}
return -1;
+11 -11
View File
@@ -1,7 +1,7 @@
#include "ChaperoneTabController.h"
#include <QQuickWindow>
#include "../overlaycontroller.h"
#include <math.h>
#include <cmath>
// 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;
}
+3 -3
View File
@@ -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) {
+1
View File
@@ -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;
};
}
@@ -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;
}
+3 -3
View File
@@ -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() {
+3 -3
View File
@@ -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() {
@@ -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) {
+10 -3
View File
@@ -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;
}
@@ -3,12 +3,6 @@
#include <QObject>
// 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;
+12 -8
View File
@@ -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, &notificationTransform);
LOG(INFO) << "Created battery overlay for device " << index;
} else {
@@ -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);
@@ -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<void>((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;
}
@@ -31,7 +31,7 @@ AudioManagerWindows::~AudioManagerWindows() {
audioDeviceEnumerator->Release();
}
void AudioManagerWindows::init(AudioTabController* controller) {
void AudioManagerWindows::init(AudioTabController* var_controller) {
std::lock_guard<std::recursive_mutex> 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;
}
}
@@ -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<void>((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
}
@@ -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;
};
}
@@ -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<UINT>(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<LPTSTR>(&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<unsigned int>(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<unsigned int>(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;
}
}
@@ -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;
};
}
+2 -3
View File
@@ -1,7 +1,6 @@
#include "ChaperoneUtils.h"
#include <iostream>
#include <math.h>
#include <cmath>
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;