diff --git a/.appveyor.yml b/.appveyor.yml
index b3c3408..2b84678 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -2,7 +2,7 @@ image: Visual Studio 2017
environment:
matrix:
- - QT_LOC: '"C:\Qt\5.11.2\msvc2017_64\bin\"'
+ - QT_LOC: '"C:\Qt\5.12\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\"'
@@ -11,7 +11,7 @@ environment:
PYTHON_LOC: '"C:\Python37\"'
BUILD_PACKAGE: "1"
- - QT_LOC: '"C:\Qt\5.11.2\msvc2017_64\bin\"'
+ - QT_LOC: '"C:\Qt\5.12\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\"'
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..3b4c7c5
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,353 @@
+---
+Checks: '*,
+ -cert-err58-cpp,
+ -cppcoreguidelines-owning-memory,
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+ -cppcoreguidelines-pro-bounds-constant-array-index,
+ -cppcoreguidelines-pro-bounds-pointer-arithmetic,
+ -cppcoreguidelines-pro-type-member-init,
+ -cppcoreguidelines-pro-type-reinterpret-cast,
+ -cppcoreguidelines-pro-type-vararg,
+ -cppcoreguidelines-special-member-functions,
+ -fuchsia-default-arguments,
+ -fuchsia-statically-constructed-objects,
+ -google-default-arguments,
+ -google-explicit-constructor,
+ -google-readability-braces-around-statements,
+ -google-readability-todo,
+ -google-runtime-int,
+ -google-runtime-references,
+ -hicpp-braces-around-statements,
+ -hicpp-explicit-conversions,
+ -hicpp-member-init,
+ -hicpp-no-array-decay,
+ -hicpp-signed-bitwise,
+ -hicpp-special-member-functions,
+ -hicpp-use-auto,
+ -hicpp-use-equals-default,
+ -hicpp-use-override,
+ -hicpp-vararg,
+ -llvm-header-guard,
+ -llvm-include-order,
+ -misc-string-compare,
+ -misc-unused-using-decls,
+ -modernize-loop-convert,
+ -modernize-make-unique,
+ -modernize-use-auto,
+ -modernize-use-equals-default,
+ -modernize-use-override,
+ -modernize-use-using,
+ -performance-for-range-copy,
+ -performance-unnecessary-value-param,
+ -readability-avoid-const-params-in-decls,
+ -readability-braces-around-statements,
+ -readability-else-after-return,
+ -readability-implicit-bool-conversion,
+ -readability-inconsistent-declaration-parameter-name,
+ -readability-non-const-parameter,
+ -readability-string-compare,
+ -readability-redundant-declaration,
+ -readability-redundant-member-init,
+ -readability-static-accessed-through-instance'
+WarningsAsErrors: '*,
+ -cert-err58-cpp,
+ -cppcoreguidelines-owning-memory,
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+ -cppcoreguidelines-pro-bounds-constant-array-index,
+ -cppcoreguidelines-pro-bounds-pointer-arithmetic,
+ -cppcoreguidelines-pro-type-member-init,
+ -cppcoreguidelines-pro-type-reinterpret-cast,
+ -cppcoreguidelines-pro-type-vararg,
+ -cppcoreguidelines-special-member-functions,
+ -fuchsia-default-arguments,
+ -google-default-arguments,
+ -google-explicit-constructor,
+ -google-readability-braces-around-statements,
+ -google-readability-todo,
+ -google-runtime-int,
+ -google-runtime-references,
+ -hicpp-braces-around-statements,
+ -hicpp-explicit-conversions,
+ -hicpp-member-init,
+ -hicpp-no-array-decay,
+ -hicpp-signed-bitwise,
+ -hicpp-special-member-functions,
+ -hicpp-use-auto,
+ -hicpp-use-equals-default,
+ -hicpp-use-override,
+ -hicpp-vararg,
+ -llvm-header-guard,
+ -llvm-include-order,
+ -misc-string-compare,
+ -misc-unused-using-decls,
+ -modernize-loop-convert,
+ -modernize-make-unique,
+ -modernize-use-auto,
+ -modernize-use-equals-default,
+ -modernize-use-override,
+ -modernize-use-using,
+ -performance-for-range-copy,
+ -performance-unnecessary-value-param,
+ -readability-avoid-const-params-in-decls,
+ -readability-braces-around-statements,
+ -readability-else-after-return,
+ -readability-implicit-bool-conversion,
+ -readability-inconsistent-declaration-parameter-name,
+ -readability-non-const-parameter,
+ -readability-redundant-declaration,
+ -readability-redundant-member-init,
+ -readability-static-accessed-through-instance'
+HeaderFilterRegex: '.*'
+AnalyzeTemporaryDtors: false
+FormatStyle: none
+CheckOptions:
+ - key: bugprone-argument-comment.StrictMode
+ value: '0'
+ - key: bugprone-assert-side-effect.AssertMacros
+ value: assert
+ - key: bugprone-assert-side-effect.CheckFunctionCalls
+ value: '0'
+ - key: bugprone-dangling-handle.HandleClasses
+ value: 'std::basic_string_view;std::experimental::basic_string_view'
+ - key: bugprone-string-constructor.LargeLengthThreshold
+ value: '8388608'
+ - key: bugprone-string-constructor.WarnOnLargeLength
+ value: '1'
+ - key: cert-dcl59-cpp.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: cert-err09-cpp.CheckThrowTemporaries
+ value: '1'
+ - key: cert-err61-cpp.CheckThrowTemporaries
+ value: '1'
+ - key: cert-oop11-cpp.IncludeStyle
+ value: llvm
+ - key: cppcoreguidelines-no-malloc.Allocations
+ value: '::malloc;::calloc'
+ - key: cppcoreguidelines-no-malloc.Deallocations
+ value: '::free'
+ - key: cppcoreguidelines-no-malloc.Reallocations
+ value: '::realloc'
+ - key: cppcoreguidelines-owning-memory.LegacyResourceConsumers
+ value: '::free;::realloc;::freopen;::fclose'
+ - key: cppcoreguidelines-owning-memory.LegacyResourceProducers
+ value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile'
+ - key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
+ value: ''
+ - key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
+ value: '0'
+ - key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
+ value: '0'
+ - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
+ value: '0'
+ - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
+ value: '0'
+ - key: google-build-namespaces.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: google-global-names-in-headers.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: google-readability-braces-around-statements.ShortStatementLines
+ value: '1'
+ - key: google-readability-function-size.BranchThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.LineThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.NestingThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.ParameterThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.StatementThreshold
+ value: '800'
+ - key: google-readability-namespace-comments.ShortNamespaceLines
+ value: '10'
+ - key: google-readability-namespace-comments.SpacesBeforeComments
+ value: '2'
+ - key: google-runtime-int.SignedTypePrefix
+ value: int
+ - key: google-runtime-int.TypeSuffix
+ value: ''
+ - key: google-runtime-int.UnsignedTypePrefix
+ value: uint
+ - key: google-runtime-references.WhiteListTypes
+ value: ''
+ - key: hicpp-braces-around-statements.ShortStatementLines
+ value: '0'
+ - key: hicpp-function-size.BranchThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.LineThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.NestingThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.ParameterThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.StatementThreshold
+ value: '800'
+ - key: hicpp-member-init.IgnoreArrays
+ value: '0'
+ - key: hicpp-move-const-arg.CheckTriviallyCopyableMove
+ value: '1'
+ - key: hicpp-named-parameter.IgnoreFailedSplit
+ value: '0'
+ - key: hicpp-no-malloc.Allocations
+ value: '::malloc;::calloc'
+ - key: hicpp-no-malloc.Deallocations
+ value: '::free'
+ - key: hicpp-no-malloc.Reallocations
+ value: '::realloc'
+ - key: hicpp-special-member-functions.AllowMissingMoveFunctions
+ value: '0'
+ - key: hicpp-special-member-functions.AllowSoleDefaultDtor
+ value: '0'
+ - key: hicpp-use-auto.RemoveStars
+ value: '0'
+ - key: hicpp-use-emplace.ContainersWithPushBack
+ value: '::std::vector;::std::list;::std::deque'
+ - key: hicpp-use-emplace.SmartPointers
+ value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
+ - key: hicpp-use-emplace.TupleMakeFunctions
+ value: '::std::make_pair;::std::make_tuple'
+ - key: hicpp-use-emplace.TupleTypes
+ value: '::std::pair;::std::tuple'
+ - key: hicpp-use-equals-default.IgnoreMacros
+ value: '1'
+ - key: hicpp-use-noexcept.ReplacementString
+ value: ''
+ - key: hicpp-use-noexcept.UseNoexceptFalse
+ value: '1'
+ - key: hicpp-use-nullptr.NullMacros
+ value: ''
+ - key: llvm-namespace-comment.ShortNamespaceLines
+ value: '1'
+ - key: llvm-namespace-comment.SpacesBeforeComments
+ value: '1'
+ - key: misc-definitions-in-headers.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: misc-definitions-in-headers.UseHeaderFileExtension
+ value: '1'
+ - key: misc-misplaced-widening-cast.CheckImplicitCasts
+ value: '0'
+ - key: misc-sizeof-expression.WarnOnSizeOfCompareToConstant
+ value: '1'
+ - key: misc-sizeof-expression.WarnOnSizeOfConstant
+ value: '1'
+ - key: misc-sizeof-expression.WarnOnSizeOfThis
+ value: '1'
+ - key: misc-suspicious-enum-usage.StrictMode
+ value: '0'
+ - key: misc-suspicious-missing-comma.MaxConcatenatedTokens
+ value: '5'
+ - key: misc-suspicious-missing-comma.RatioThreshold
+ value: '0.200000'
+ - key: misc-suspicious-missing-comma.SizeThreshold
+ value: '5'
+ - key: misc-suspicious-string-compare.StringCompareLikeFunctions
+ value: ''
+ - key: misc-suspicious-string-compare.WarnOnImplicitComparison
+ value: '1'
+ - key: misc-suspicious-string-compare.WarnOnLogicalNotComparison
+ value: '0'
+ - key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries
+ value: '1'
+ - key: modernize-loop-convert.MaxCopySize
+ value: '16'
+ - key: modernize-loop-convert.MinConfidence
+ value: reasonable
+ - key: modernize-loop-convert.NamingStyle
+ value: CamelCase
+ - key: modernize-make-shared.IgnoreMacros
+ value: '1'
+ - key: modernize-make-shared.IncludeStyle
+ value: '0'
+ - key: modernize-make-shared.MakeSmartPtrFunction
+ value: 'std::make_shared'
+ - key: modernize-make-shared.MakeSmartPtrFunctionHeader
+ value: memory
+ - key: modernize-make-unique.IgnoreMacros
+ value: '1'
+ - key: modernize-make-unique.IncludeStyle
+ value: '0'
+ - key: modernize-make-unique.MakeSmartPtrFunction
+ value: 'std::make_unique'
+ - key: modernize-make-unique.MakeSmartPtrFunctionHeader
+ value: memory
+ - key: modernize-pass-by-value.IncludeStyle
+ value: llvm
+ - key: modernize-pass-by-value.ValuesOnly
+ value: '0'
+ - key: modernize-raw-string-literal.ReplaceShorterLiterals
+ value: '0'
+ - key: modernize-replace-auto-ptr.IncludeStyle
+ value: llvm
+ - key: modernize-replace-random-shuffle.IncludeStyle
+ value: llvm
+ - key: modernize-use-auto.RemoveStars
+ value: '0'
+ - key: modernize-use-default-member-init.IgnoreMacros
+ value: '1'
+ - key: modernize-use-default-member-init.UseAssignment
+ value: '0'
+ - key: modernize-use-emplace.ContainersWithPushBack
+ value: '::std::vector;::std::list;::std::deque'
+ - key: modernize-use-emplace.SmartPointers
+ value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
+ - key: modernize-use-emplace.TupleMakeFunctions
+ value: '::std::make_pair;::std::make_tuple'
+ - key: modernize-use-emplace.TupleTypes
+ value: '::std::pair;::std::tuple'
+ - key: modernize-use-equals-default.IgnoreMacros
+ value: '1'
+ - key: modernize-use-noexcept.ReplacementString
+ value: ''
+ - key: modernize-use-noexcept.UseNoexceptFalse
+ value: '1'
+ - key: modernize-use-nullptr.NullMacros
+ value: 'NULL'
+ - key: modernize-use-transparent-functors.SafeMode
+ value: '0'
+ - key: modernize-use-using.IgnoreMacros
+ value: '1'
+ - key: objc-forbidden-subclassing.ForbiddenSuperClassNames
+ value: 'ABNewPersonViewController;ABPeoplePickerNavigationController;ABPersonViewController;ABUnknownPersonViewController;NSHashTable;NSMapTable;NSPointerArray;NSPointerFunctions;NSTimer;UIActionSheet;UIAlertView;UIImagePickerController;UITextInputMode;UIWebView'
+ - key: objc-property-declaration.Acronyms
+ value: 'ASCII;PDF;XML;HTML;URL;RTF;HTTP;TIFF;JPG;PNG;GIF;LZW;ROM;RGB;CMYK;MIDI;FTP'
+ - key: performance-faster-string-find.StringLikeClasses
+ value: 'std::basic_string'
+ - key: performance-for-range-copy.WarnOnAllAutoCopies
+ value: '0'
+ - key: performance-inefficient-string-concatenation.StrictMode
+ value: '0'
+ - key: performance-inefficient-vector-operation.VectorLikeClasses
+ value: '::std::vector'
+ - key: performance-move-const-arg.CheckTriviallyCopyableMove
+ value: '1'
+ - key: performance-move-constructor-init.IncludeStyle
+ value: llvm
+ - key: performance-type-promotion-in-math-fn.IncludeStyle
+ value: llvm
+ - key: performance-unnecessary-value-param.IncludeStyle
+ value: llvm
+ - key: readability-braces-around-statements.ShortStatementLines
+ value: '0'
+ - key: readability-function-size.BranchThreshold
+ value: '4294967295'
+ - key: readability-function-size.LineThreshold
+ value: '4294967295'
+ - key: readability-function-size.NestingThreshold
+ value: '4294967295'
+ - key: readability-function-size.ParameterThreshold
+ value: '4294967295'
+ - key: readability-function-size.StatementThreshold
+ value: '800'
+ - key: readability-identifier-naming.IgnoreFailedSplit
+ value: '0'
+ - key: readability-implicit-bool-conversion.AllowIntegerConditions
+ value: '0'
+ - key: readability-implicit-bool-conversion.AllowPointerConditions
+ value: '0'
+ - key: readability-simplify-boolean-expr.ChainedConditionalAssignment
+ value: '0'
+ - key: readability-simplify-boolean-expr.ChainedConditionalReturn
+ value: '0'
+ - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold
+ value: '3'
+...
+
diff --git a/.gitattributes b/.gitattributes
index 2c1b613..7b1ae8e 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -89,7 +89,9 @@
#Qt Specific
*.qml text
+*.pri text
+*.pro text
#Linux Shell Scripts
#Windows Subsystem for Linux will not run CLRF files.
-*.sh text eof=lf
+*.sh text eol=lf
diff --git a/.travis.yml b/.travis.yml
index ba22bb5..4e8e424 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,10 +12,17 @@ matrix:
- g++-7
env:
- QMAKE_SPEC=linux-g++
+ compiler: gcc
- os: linux
env:
- QMAKE_SPEC=linux-clang
+ compiler: clang
+
+ - os: linux
+ env:
+ - USE_TIDY=TRUE
+ compiler: clang
before_install:
- python ./build_scripts/run-clang-format.py ./src -r --color always
@@ -24,8 +31,7 @@ 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
+ - sudo apt-get install bear clang-tidy
script:
- - mkdir build && cd build
- - qmake .. -spec $QMAKE_SPEC
- - make
+ - ./build_scripts/linux/build_linux.sh
diff --git a/Readme.md b/Readme.md
index 827331d..0c06ee1 100644
--- a/Readme.md
+++ b/Readme.md
@@ -143,7 +143,7 @@ These version are not stable and this should be considered for advanced users on
- **Supersampling Profile**: Allows to apply supersampling profiles. Profiles can be created on the SteamVR page
- **Chaperone Profile**: Allows to apply chaperone profiles. Profiles can be created on the Chaperone page
- **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.
+- **Push-to-Talk**: Enable/disable push-to-talk.
## - SteamVR Page:
@@ -214,12 +214,9 @@ Allows to temporarily move and rotate the center of the playspace. This allows t
- **Mirror Device**: Allows to select the mirror device, set its volume and to mute/unmute it.
- **Microphone**: Allows to select the microphone device, set its volume and to mute/unmute it.
- **Proximity Sensor Mutes/Unmutes Microphone**: Allows the proximity sensor to mute the microphone when the user is not wearing the HMD, and to unmute it when the user is wearing the HMD.
-- **Push-to-Talk**: Enable/disable push-to-talk. When push-to-talk is activated the microphone gets muted unless one of the configured buttons is pressed on one of the configured controllers.
-- **Left Controller**: Configure the left controller for push-to-talk.
-- **Right Controller**: Configure the right controller for push-to-talk.
-- **Show Notification**: Shows a notification icon in the headset when push-to-talk is enabled a configured button is pressed.
+- **Push-to-Talk**: Enable/disable push-to-talk. When push-to-talk is activated the microphone gets muted unless the Push To Talk action is activated.
+- **Show Notification**: Shows a notification icon in the headset when the Push To Talk action is activated.
- **Push-to-Mute**: Inverse push-to-talk. The Microphone is unmuted by default and muted when any of the configured buttons is pressed.
-- **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.
@@ -294,10 +291,7 @@ 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.
-
-If you want to contribute changes running `clang-format` is necessary. More details are in the [CONTRIBUTING.md](docs/CONTRIBUTING.md) file.
+Full build instructions can be found [here](docs/building_for_linux.md).
# Notes:
diff --git a/advancedSettings.pro b/advancedSettings.pro
index a982d6e..918af1f 100644
--- a/advancedSettings.pro
+++ b/advancedSettings.pro
@@ -1,9 +1,3 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2015-06-10T16:57:45
-#
-#-------------------------------------------------
-
QT += core gui qml quick multimedia widgets
CONFIG += c++1z
@@ -15,140 +9,26 @@ 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
- #C4127 is a warning in qvarlengtharray.h that can not be turned off
- #on the current version of MSVC.
- QMAKE_CXXFLAGS += /W4 /wd4127
- # The codecvt header being used in AudioManagerWindows.cpp is deprecated by the standard,
- # but no suitable replacement has been standardized yet. It is possible to use the Windows
- # specific MultiByteToWideChar() and WideCharToMultiByte() from
- DEFINES += _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
- !*clang-msvc {
- #win32-clang-msvc is unable to correctly build the first time
- #with warnings as errors on. There seems to be an issue with the moc_predefs.h
- #file not being built correctly when /WX is on. Until the issue is fixed,
- #win32-clang-msvc is built without /WX.
- QMAKE_CXXFLAGS += /WX
- }
-}
-
-win32-clang-msvc{
- #clang-msvc does not enable the c++17 flag with qmake's c++1z flag.
- QMAKE_CXXFLAGS += /std:c++17
-}
-
-*g++* {
- #g++-7 is needed for C++17 features. travis does not supply this by default.
- QMAKE_CXX = g++-7
- 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 \
- src/tabcontrollers/ChaperoneTabController.cpp \
- src/tabcontrollers/FixFloorTabController.cpp \
- src/tabcontrollers/MoveCenterTabController.cpp \
- src/tabcontrollers/SettingsTabController.cpp \
- src/tabcontrollers/StatisticsTabController.cpp \
- src/tabcontrollers/SteamVRTabController.cpp \
- src/tabcontrollers/ReviveTabController.cpp \
- src/tabcontrollers/UtilitiesTabController.cpp \
- src/tabcontrollers/PttController.cpp \
- src/utils/ChaperoneUtils.cpp \
- src/tabcontrollers/audiomanager/AudioManagerDummy.cpp \
- src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp \
- src/overlaycontroller/openvr_init.cpp \
- src/ivrinput/ivrinput.cpp
-
-HEADERS += src/overlaycontroller.h \
- src/tabcontrollers/AudioTabController.h \
- src/tabcontrollers/ChaperoneTabController.h \
- src/tabcontrollers/FixFloorTabController.h \
- src/tabcontrollers/MoveCenterTabController.h \
- src/tabcontrollers/SettingsTabController.h \
- src/tabcontrollers/StatisticsTabController.h \
- src/tabcontrollers/SteamVRTabController.h \
- src/tabcontrollers/ReviveTabController.h \
- src/tabcontrollers/UtilitiesTabController.h \
- src/tabcontrollers/AudioManager.h \
- src/tabcontrollers/PttController.h \
- src/tabcontrollers/KeyboardInput.h \
- src/utils/Matrix.h \
- src/utils/ChaperoneUtils.h \
- src/tabcontrollers/audiomanager/AudioManagerDummy.h \
- src/tabcontrollers/keyboardinput/KeyboardInputDummy.h \
- src/overlaycontroller/openvr_init.h \
- src/ivrinput/ivrinput_action.h \
- src/ivrinput/ivrinput_manifest.h \
- src/ivrinput/ivrinput_action_set.h \
- src/ivrinput/ivrinput.h \
- src/utils/quaternion.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
-}
-
-INCLUDEPATH += third-party/openvr/headers \
- third-party/easylogging++
-#easylogging++ used to be a header only lib. Now requires easylogging++.cc
-SOURCES += third-party/easylogging++/easylogging++.cc
-win32:LIBS += -L"$$PWD/third-party/openvr/lib/win64" -luser32 -lole32
-unix:LIBS += -L"$$PWD/third-party/openvr/lib/linux64"
-LIBS += -lopenvr_api
-
win32:DESTDIR = bin/win64/AdvancedSettings
unix:DESTDIR = bin/linux/AdvancedSettings
-DISTFILES += \
- src/res/sounds/alarm01.wav \
- src/res/img/audio/microphone/ptt_notification.png \
- src/res/img/audio/microphone/ptt_notification.svg \
- src/res/img/battery/* \
- src/res/img/icons/* \
- src/res/qml/qmldir \
- src/res/qml/audio_page/* \
- src/res/qml/ChaperonePage.qml \
- src/res/qml/ChaperoneWarningsPage.qml \
- src/res/qml/FixFloorPage.qml \
- src/res/qml/PlayspacePage.qml \
- src/res/qml/motion_page/* \
- src/res/qml/motion_page/gravity/* \
- src/res/qml/motion_page/height_toggle/* \
- src/res/qml/motion_page/snap_turn/* \
- src/res/qml/motion_page/universe_drag/* \
- src/res/qml/motion_page/universe_turn/* \
- src/res/qml/PttControllerConfigDialog.qml \
- src/res/qml/RevivePage.qml \
- src/res/qml/RootPage.qml \
- src/res/qml/SettingsPage.qml \
- src/res/qml/StatisticsPage.qml \
- src/res/qml/SteamVRPage.qml \
- src/res/qml/utilities_page/* \
- src/res/qml/utilities_page/media_keys/* \
- src/res/qml/utilities_page/keyboard_utils/* \
- src/res/qml/utilities_page/desktop_size/* \
- src/res/qml/utilities_page/alarm_clock/* \
- src/res/qml/audio_page/dialog_boxes/* \
- src/res/qml/audio_page/device_selector/* \
- src/res/qml/audio_page/proximity/* \
- src/res/qml/audio_page/push_to_talk/* \
- src/res/qml/audio_page/profiles/* \
- src/res/qml/common/* \
+include_dir = $$PWD/build_scripts/qt/
-RESOURCES += src/res/resources.qrc
+win32-msvc {
+ include($$include_dir/compilers/msvc.pri)
+}
+win32-clang-msvc{
+ include($$include_dir/compilers/clang-msvc.pri)
+}
+*g++* {
+ include($$include_dir/compilers/gcc.pri)
+}
+#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++ {
+ include($$include_dir/compilers/clang.pri)
+}
+
+include($$include_dir/sources.pri)
+
+include($$include_dir/resources.pri)
diff --git a/build_scripts/linux/build_linux.sh b/build_scripts/linux/build_linux.sh
new file mode 100644
index 0000000..0505611
--- /dev/null
+++ b/build_scripts/linux/build_linux.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+set -e
+if [[ -z $QMAKE_SPEC ]]; then
+ QMAKE_SPEC='linux-g++'
+fi
+
+if [[ -z $USE_TIDY ]]; then
+ MAKE_COMMAND='make --jobs'
+ CLANG_TIDY=
+else
+ # Bear replaces the compile database, it does not update it.
+ # If you run 'bear make' and there is nothing to compile, you
+ # will get an empty database.
+ # Clean up the artifacts and run everything together in that case.
+ MAKE_COMMAND='bear make --jobs'
+ QMAKE_SPEC='linux-clang'
+ CLANG_TIDY='../build_scripts/linux/run-clang-tidy.sh'
+fi
+
+echo $MAKE_COMMAND
+mkdir -p build
+cd build
+qmake --version
+qmake -spec $QMAKE_SPEC ..
+$MAKE_COMMAND
+$CLANG_TIDY
diff --git a/build_scripts/linux/format.sh b/build_scripts/linux/format.sh
index 36f978c..8720bc7 100644
--- a/build_scripts/linux/format.sh
+++ b/build_scripts/linux/format.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+set -e
clang-format --version
diff --git a/build_scripts/linux/run-clang-tidy.sh b/build_scripts/linux/run-clang-tidy.sh
new file mode 100644
index 0000000..a0ac8fd
--- /dev/null
+++ b/build_scripts/linux/run-clang-tidy.sh
@@ -0,0 +1,15 @@
+set +e
+clang-tidy --version
+
+ERROR=0
+for file in $(find ../src -name "*.cpp"); do
+ echo $file
+ clang-tidy $file
+
+ EXIT=$?
+ if [[ $EXIT != 0 ]]; then
+ ERROR=1
+ fi
+done
+set -e
+exit $ERROR
diff --git a/build_scripts/linux/verify_formatting.sh b/build_scripts/linux/verify_formatting.sh
index 8ddd177..cdc4d05 100644
--- a/build_scripts/linux/verify_formatting.sh
+++ b/build_scripts/linux/verify_formatting.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+set -e
clang-format --version;
diff --git a/build_scripts/qt/compilers/clang-gcc-common-switches.pri b/build_scripts/qt/compilers/clang-gcc-common-switches.pri
new file mode 100644
index 0000000..fca9988
--- /dev/null
+++ b/build_scripts/qt/compilers/clang-gcc-common-switches.pri
@@ -0,0 +1,11 @@
+QMAKE_CXXFLAGS += -Wextra
+
+QMAKE_CXXFLAGS += -Wshadow
+
+QMAKE_CXXFLAGS += -Wold-style-cast
+
+QMAKE_CXXFLAGS += -Wnon-virtual-dtor
+
+QMAKE_CXXFLAGS += -Wcast-align -Wunused -Woverloaded-virtual -Wformat=2
+
+QMAKE_CXXFLAGS += -Wdouble-promotion
diff --git a/build_scripts/qt/compilers/clang-msvc.pri b/build_scripts/qt/compilers/clang-msvc.pri
new file mode 100644
index 0000000..bdd6f8a
--- /dev/null
+++ b/build_scripts/qt/compilers/clang-msvc.pri
@@ -0,0 +1,18 @@
+include(common-msvc.pri)
+
+#win32-clang-msvc is unable to correctly build the first time
+#with warnings as errors on. There seems to be an issue with the moc_predefs.h
+#file not being built correctly when /WX is on. Until the issue is fixed,
+#win32-clang-msvc is built without /WX.
+
+#clang-msvc does not enable the c++17 flag with qmake's c++1z flag.
+QMAKE_CXXFLAGS += /std:c++17
+
+include(clang-gcc-common-switches.pri)
+
+QMAKE_CXXFLAGS += -Wmost
+
+QMAKE_CXXFLAGS += -Weffc++ -Wmissing-variable-declarations
+
+#clang-msvc spams warnings on -Wconversion and -Wsign-conversion
+# from the moc .cpp files including Qt stuff.
diff --git a/build_scripts/qt/compilers/clang.pri b/build_scripts/qt/compilers/clang.pri
new file mode 100644
index 0000000..146318e
--- /dev/null
+++ b/build_scripts/qt/compilers/clang.pri
@@ -0,0 +1,14 @@
+include(clang-gcc-common-switches.pri)
+
+QMAKE_CXXFLAGS += -Wmost
+
+QMAKE_CXXFLAGS += -Wpedantic
+
+QMAKE_CXXFLAGS += -Werror
+#All includes from the third-party directory will not warn.
+QMAKE_CXXFLAGS += --system-header-prefix=third-party
+
+# Sign conversion warns on auto generated Qt MOC files.
+QMAKE_CXXFLAGS += -Weffc++ -Wconversion -Wno-sign-conversion
+
+QMAKE_CXXFLAGS += -Wextra-semi -Wzero-as-null-pointer-constant -Wmissing-variable-declarations
diff --git a/build_scripts/qt/compilers/common-msvc.pri b/build_scripts/qt/compilers/common-msvc.pri
new file mode 100644
index 0000000..188c50f
--- /dev/null
+++ b/build_scripts/qt/compilers/common-msvc.pri
@@ -0,0 +1,51 @@
+#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
+#C4127 is a warning in qvarlengtharray.h that can not be turned off
+#on the current version of MSVC.
+QMAKE_CXXFLAGS += /W4 /wd4127
+# The codecvt header being used in AudioManagerWindows.cpp is deprecated by the standard,
+# but no suitable replacement has been standardized yet. It is possible to use the Windows
+# specific MultiByteToWideChar() and WideCharToMultiByte() from
+DEFINES += _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
+
+# Enables Whole Program Optimization
+QMAKE_CXXFLAGS += /Gw
+
+# 'identfier': conversion from 'type1' to 'type1', possible loss of data
+QMAKE_CXXFLAGS += /w14242
+# 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
+QMAKE_CXXFLAGS += /w14254
+# 'function': member function does not override any base class virtual member function
+QMAKE_CXXFLAGS += /w14263
+# 'classname': class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly
+QMAKE_CXXFLAGS += /w14265
+# 'operator': unsigned/negative constant mismatch
+QMAKE_CXXFLAGS += /w14287
+# nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside the for-loop scope
+QMAKE_CXXFLAGS += /we4289
+# 'operator': expression is always 'boolean_value'
+QMAKE_CXXFLAGS += /w14296
+# 'variable': pointer truncation from 'type1' to 'type2'
+QMAKE_CXXFLAGS += /w14311
+# expression before comma evaluates to a function which is missing an argument list
+QMAKE_CXXFLAGS += /w14545
+# function call before comma missing argument list
+QMAKE_CXXFLAGS += /w14546
+# 'operator': operator before comma has no effect; expected operator with side-effect
+QMAKE_CXXFLAGS += /w14547
+# 'operator': operator before comma has no effect; did you intend 'operator'?
+QMAKE_CXXFLAGS += /w14549
+# expression has no effect; expected expression with side-effect
+QMAKE_CXXFLAGS += /w14555
+# Enable warning on thread un-safe static member initialization
+QMAKE_CXXFLAGS += /w14640
+# Conversion from 'type1' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
+QMAKE_CXXFLAGS += /w14826
+# wide string literal cast to 'LPSTR'
+QMAKE_CXXFLAGS += /w14905
+# string literal cast to 'LPWSTR'
+QMAKE_CXXFLAGS += /w14906
+# illegal copy-initialization; more than one user-defined conversion has been implicitly applied
+QMAKE_CXXFLAGS += /w14928
diff --git a/build_scripts/qt/compilers/gcc.pri b/build_scripts/qt/compilers/gcc.pri
new file mode 100644
index 0000000..70fada3
--- /dev/null
+++ b/build_scripts/qt/compilers/gcc.pri
@@ -0,0 +1,16 @@
+#g++-7 is needed for C++17 features. travis does not supply this by default.
+QMAKE_CXX = g++-7
+
+include(clang-gcc-common-switches.pri)
+
+QMAKE_CXXFLAGS += -Wpedantic
+
+QMAKE_CXXFLAGS += -Werror
+
+# GCC only switches
+QMAKE_CXXFLAGS += -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wrestrict -Wnull-dereference
+
+# Sign conversion warns on auto generated Qt MOC files.
+QMAKE_CXXFLAGS += -Wconversion -Wno-sign-conversion
+
+QMAKE_CXXFLAGS += -Wzero-as-null-pointer-constant
diff --git a/build_scripts/qt/compilers/msvc.pri b/build_scripts/qt/compilers/msvc.pri
new file mode 100644
index 0000000..6679151
--- /dev/null
+++ b/build_scripts/qt/compilers/msvc.pri
@@ -0,0 +1,10 @@
+include(common-msvc.pri)
+
+# Warnings as errors
+QMAKE_CXXFLAGS += /WX
+
+# Enables Link Time Optimization
+QMAKE_CXXFLAGS += /GL
+
+# Force standards-conformance
+QMAKE_CXXFLAGS += /permissive-
diff --git a/build_scripts/qt/resources.pri b/build_scripts/qt/resources.pri
new file mode 100644
index 0000000..19a288f
--- /dev/null
+++ b/build_scripts/qt/resources.pri
@@ -0,0 +1,36 @@
+project_dir = $$PWD/../../
+
+win32:LIBS += -L"$$project_dir/third-party/openvr/lib/win64" -luser32 -lole32
+unix:LIBS += -L"$$project_dir/third-party/openvr/lib/linux64"
+LIBS += -lopenvr_api
+
+RESOURCES += src/res/resources.qrc
+
+DISTFILES += \
+ src/res/sounds/alarm01.wav \
+ src/res/img/audio/microphone/ptt_notification.png \
+ src/res/img/audio/microphone/ptt_notification.svg \
+ src/res/img/battery/* \
+ src/res/img/icons/* \
+ src/res/qml/qmldir \
+ src/res/qml/audio_page/* \
+ src/res/qml/ChaperonePage.qml \
+ src/res/qml/ChaperoneWarningsPage.qml \
+ src/res/qml/FixFloorPage.qml \
+ src/res/qml/PlayspacePage.qml \
+ src/res/qml/RevivePage.qml \
+ src/res/qml/RootPage.qml \
+ src/res/qml/SettingsPage.qml \
+ src/res/qml/StatisticsPage.qml \
+ src/res/qml/SteamVRPage.qml \
+ src/res/qml/utilities_page/* \
+ src/res/qml/utilities_page/media_keys/* \
+ src/res/qml/utilities_page/keyboard_utils/* \
+ src/res/qml/utilities_page/desktop_size/* \
+ src/res/qml/utilities_page/alarm_clock/* \
+ src/res/qml/audio_page/dialog_boxes/* \
+ src/res/qml/audio_page/device_selector/* \
+ src/res/qml/audio_page/proximity/* \
+ src/res/qml/audio_page/push_to_talk/* \
+ src/res/qml/audio_page/profiles/* \
+ src/res/qml/common/* \
diff --git a/build_scripts/qt/sources.pri b/build_scripts/qt/sources.pri
new file mode 100644
index 0000000..1ade168
--- /dev/null
+++ b/build_scripts/qt/sources.pri
@@ -0,0 +1,69 @@
+SOURCES += src/main.cpp\
+ src/overlaycontroller.cpp \
+ src/tabcontrollers/AudioTabController.cpp \
+ src/tabcontrollers/ChaperoneTabController.cpp \
+ src/tabcontrollers/FixFloorTabController.cpp \
+ src/tabcontrollers/MoveCenterTabController.cpp \
+ src/tabcontrollers/SettingsTabController.cpp \
+ src/tabcontrollers/StatisticsTabController.cpp \
+ src/tabcontrollers/SteamVRTabController.cpp \
+ src/tabcontrollers/ReviveTabController.cpp \
+ src/tabcontrollers/UtilitiesTabController.cpp \
+ src/tabcontrollers/PttController.cpp \
+ src/utils/ChaperoneUtils.cpp \
+ src/tabcontrollers/audiomanager/AudioManagerDummy.cpp \
+ src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp \
+ src/overlaycontroller/openvr_init.cpp \
+ src/ivrinput/ivrinput.cpp
+
+HEADERS += src/overlaycontroller.h \
+ src/tabcontrollers/AudioTabController.h \
+ src/tabcontrollers/ChaperoneTabController.h \
+ src/tabcontrollers/FixFloorTabController.h \
+ src/tabcontrollers/MoveCenterTabController.h \
+ src/tabcontrollers/SettingsTabController.h \
+ src/tabcontrollers/StatisticsTabController.h \
+ src/tabcontrollers/SteamVRTabController.h \
+ src/tabcontrollers/ReviveTabController.h \
+ src/tabcontrollers/UtilitiesTabController.h \
+ src/tabcontrollers/AudioManager.h \
+ src/tabcontrollers/PttController.h \
+ src/tabcontrollers/KeyboardInput.h \
+ src/utils/Matrix.h \
+ src/utils/ChaperoneUtils.h \
+ src/tabcontrollers/audiomanager/AudioManagerDummy.h \
+ src/tabcontrollers/keyboardinput/KeyboardInputDummy.h \
+ src/overlaycontroller/openvr_init.h \
+ src/ivrinput/ivrinput_action.h \
+ src/ivrinput/ivrinput_manifest.h \
+ src/ivrinput/ivrinput_action_set.h \
+ src/ivrinput/ivrinput.h
+
+win32 {
+ SOURCES += src/tabcontrollers/audiomanager/AudioManagerWindows.cpp \
+ src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
+ HEADERS += src/tabcontrollers/audiomanager/AudioManagerWindows.h \
+ src/tabcontrollers/keyboardinput/KeyboardInputWindows.h
+}
+
+win32-msvc {
+ INCLUDEPATH += third-party/openvr/headers \
+ third-party/easylogging++ \
+ third-party/policyconfig
+}
+
+win32-clang-msvc {
+ QMAKE_CXXFLAGS += /imsvc "$$PWD/../../third-party/openvr/headers"
+ QMAKE_CXXFLAGS += /imsvc "$$PWD/../../third-party/easylogging++"
+ QMAKE_CXXFLAGS += /imsvc "$$PWD/../../third-party/policyconfig"
+}
+
+# Anything g++ or clang
+# In order to suppress warnings in third party headers
+*clang|*clang-g++|*clang-libc++|*g++* {
+ QMAKE_CXXFLAGS += -isystem ../third-party/openvr/headers
+ QMAKE_CXXFLAGS += -isystem ../third-party/easylogging++
+}
+
+# easylogging++ used to be a header only lib. Now requires easylogging++.cc
+SOURCES += third-party/easylogging++/easylogging++.cc
diff --git a/docs/building_for_linux.md b/docs/building_for_linux.md
new file mode 100644
index 0000000..3e987a1
--- /dev/null
+++ b/docs/building_for_linux.md
@@ -0,0 +1,43 @@
+# Building for Linux
+
+- [Requirements](#requirements)
+- [Locations and Environment Variables](#locations-and-environment-variables)
+- [Building](#building)
+- [Contributing](#contributing)
+
+## Requirements
+
+The following packages are necessary for compiling:
+
+`sudo apt install build-essential qtbase5-dev qttools5-dev qtdeclarative5-dev qtmultimedia5-dev qt5-default qttools5-dev-tools`
+
+If you install Qt 5.12 you should have the above packages.
+
+Along with either `clang` or `g++`. At least `g++-7` is required, due to C++17 support.
+
+For linting with `clang-tidy` the following are necessary:
+
+`sudo apt install bear clang-tidy`
+
+All applications are required to be in the `PATH`.
+
+## Locations and Environment Variables
+
+The following environmental variables are relevant for building the project.
+
+| Environment Variable | Purpose |
+| -------------------- | ------------- |
+| `QMAKE_SPEC` | The [mkspec](https://forum.qt.io/topic/70970/what-is-mkspecs-used-for-how-to-configure-for-my-hardware) to compile to. Either `linux-g++` or `linux-clang`. Defaults to `linux-g++`. |
+| `USE_TIDY` | If set a compilation database will be created and the project linted. Can only be used with `clang`. |
+
+If an environment variable isn't set a default value will be provided. The default values are shown in the table below.
+
+## Building
+
+With the programs above installed and environment variables set, go into the root folder of the repository and run `./build_scripts/linux/build_linux.sh`.
+
+You'll have to copy the `res` directory into the resulting binary location, and add `third-party/openvr/lib/linux64/libopenvr_api.so` to your systems library path.
+
+## Contributing
+
+For full details, see [CONTRIBUTING.md](CONTRIBUTING.md).
diff --git a/docs/building_for_windows.md b/docs/building_for_windows.md
index f23731b..7f45ec3 100644
--- a/docs/building_for_windows.md
+++ b/docs/building_for_windows.md
@@ -14,7 +14,7 @@
For compiling:
1. [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/) (tested on 2017 Community)
-2. [Qt Framework](https://www.qt.io/download) version later than 5.6 (tested on 5.10 and 5.11)
+2. [Qt Framework](https://www.qt.io/download) version later than 5.6 (Requires at least 5.6. 5.12 is recommended)
3. [Python 3](https://www.python.org/downloads/) (must be in `PATH` environment variable)
For pushing changes to the repo:
diff --git a/docs/screenshots/AudioPage.png b/docs/screenshots/AudioPage.png
index eedc31c..f0f5342 100644
Binary files a/docs/screenshots/AudioPage.png and b/docs/screenshots/AudioPage.png differ
diff --git a/docs/screenshots/RootPage.png b/docs/screenshots/RootPage.png
index e4e6c20..6298c6a 100644
Binary files a/docs/screenshots/RootPage.png and b/docs/screenshots/RootPage.png differ
diff --git a/installer/installer.nsi b/installer/installer.nsi
index aec2452..3f27c48 100644
--- a/installer/installer.nsi
+++ b/installer/installer.nsi
@@ -114,7 +114,7 @@ Section "Install" SecInstall
;Any action manifests
File "${BASEDIR}\*.json"
;And their defaults
- File "${BASEDIR}\default_action_manifests\*.json"
+ File /r "${BASEDIR}\default_action_manifests"
File "${THIRDDIR}\openvr\bin\win64\*.dll"
File "${BASEDIR}\*.dll"
diff --git a/src/ivrinput/ivrinput.cpp b/src/ivrinput/ivrinput.cpp
index 455ed31..a1ff66f 100644
--- a/src/ivrinput/ivrinput.cpp
+++ b/src/ivrinput/ivrinput.cpp
@@ -165,7 +165,8 @@ SteamIVRInput::SteamIVRInput()
m_snapTurnLeft( input_strings::k_actionSnapTurnLeft,
ActionType::Digital ),
m_snapTurnRight( input_strings::k_actionSnapTurnRight,
- ActionType::Digital )
+ ActionType::Digital ),
+ m_pushToTalk( input_strings::k_actionPushToTalk, ActionType::Digital )
{
m_activeActionSet.ulActionSet = m_mainSet.handle();
m_activeActionSet.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle;
@@ -295,6 +296,11 @@ bool SteamIVRInput::snapTurnRight()
return isDigitalActionActivatedOnce( m_snapTurnRight );
}
+bool SteamIVRInput::pushToTalk()
+{
+ return isDigitalActionActivatedConstant( m_pushToTalk );
+}
+
/*!
Updates the active action set(s).
Should be called every frame, or however often you want the input system to
diff --git a/src/ivrinput/ivrinput.h b/src/ivrinput/ivrinput.h
index 0c27cb6..9b36996 100644
--- a/src/ivrinput/ivrinput.h
+++ b/src/ivrinput/ivrinput.h
@@ -36,6 +36,7 @@ public:
SteamIVRInput();
void UpdateStates();
+
bool nextSong();
bool previousSong();
bool pausePlaySong();
@@ -56,6 +57,8 @@ public:
bool snapTurnLeft();
bool snapTurnRight();
+ bool pushToTalk();
+
// Destructor. There are no terminating calls for the IVRInput API, so it
// is left blank.
~SteamIVRInput() {}
@@ -101,6 +104,9 @@ private:
Action m_resetOffsets;
Action m_snapTurnLeft;
Action m_snapTurnRight;
+
+ // Push To Talk
+ Action m_pushToTalk;
};
/*!
@@ -141,6 +147,8 @@ namespace input_strings
constexpr auto k_actionSnapTurnLeft = "/actions/main/in/SnapTurnLeft";
constexpr auto k_actionSnapTurnRight = "/actions/main/in/SnapTurnRight";
+ constexpr auto k_actionPushToTalk = "/actions/main/in/PushToTalk";
+
constexpr auto k_setMain = "/actions/main";
} // namespace input_strings
diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp
index 27df1dc..0b29a81 100644
--- a/src/overlaycontroller.cpp
+++ b/src/overlaycontroller.cpp
@@ -351,17 +351,23 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
QOpenGLFramebufferObject::CombinedDepthStencil );
fboFormat.setTextureTarget( GL_TEXTURE_2D );
m_pFbo.reset( new QOpenGLFramebufferObject(
- quickItem->width(), quickItem->height(), fboFormat ) );
+ static_cast( quickItem->width() ),
+ static_cast( quickItem->height() ),
+ fboFormat ) );
m_pRenderControl.reset( new QQuickRenderControl() );
m_pWindow.reset( new QQuickWindow( m_pRenderControl.get() ) );
m_pWindow->setRenderTarget( m_pFbo.get() );
quickItem->setParentItem( m_pWindow->contentItem() );
- m_pWindow->setGeometry( 0, 0, quickItem->width(), quickItem->height() );
+ m_pWindow->setGeometry( 0,
+ 0,
+ static_cast( quickItem->width() ),
+ static_cast( quickItem->height() ) );
m_pRenderControl->initialize( m_pOpenGLContext.get() );
vr::HmdVector2_t vecWindowSize
- = { ( float ) quickItem->width(), ( float ) quickItem->height() };
+ = { static_cast( quickItem->width() ),
+ static_cast( quickItem->height() ) };
vr::VROverlay()->SetOverlayMouseScale( m_ulOverlayHandle,
&vecWindowSize );
@@ -425,11 +431,12 @@ void OverlayController::renderOverlay()
#if defined _WIN64 || defined _LP64
// To avoid any compiler warning because of cast to a larger pointer
// type (warning C4312 on VC)
- vr::Texture_t texture = { ( void* ) ( ( uint64_t ) unTexture ),
+ vr::Texture_t texture = { reinterpret_cast(
+ static_cast( unTexture ) ),
vr::TextureType_OpenGL,
vr::ColorSpace_Auto };
#else
- vr::Texture_t texture = { ( void* ) unTexture,
+ vr::Texture_t texture = { reinterpret_cast( unTexture ),
vr::TextureType_OpenGL,
vr::ColorSpace_Auto };
#endif
@@ -458,20 +465,13 @@ QPoint OverlayController::getMousePositionForEvent( vr::VREvent_Mouse_t mouse )
{
float y = mouse.y;
#ifdef __linux__
- float h = ( float ) m_pWindow->height();
+ float h = static_cast( m_pWindow->height() );
y = h - y;
#endif
- return QPoint( mouse.x, y );
+ return QPoint( static_cast( mouse.x ), static_cast( y ) );
}
-/*!
-Checks if an action has been activated and dispatches the related action if it
-has been.
-
-This function should probably be split into several functions that are specific
-to a binding type as the amount of actions grows.
-*/
-void OverlayController::processInputBindings()
+void OverlayController::processMediaKeyBindings()
{
if ( m_actions.nextSong() )
{
@@ -489,6 +489,10 @@ void OverlayController::processInputBindings()
{
m_utilitiesTabController.sendMediaStopSong();
}
+}
+
+void OverlayController::processRoomBindings()
+{
// Execution order for moveCenterTabController actions is important. Don't
// reorder these. Override actions must always come after normal because
// active priority is set based on which action is "newest"
@@ -522,6 +526,39 @@ void OverlayController::processInputBindings()
m_actions.swapSpaceDragToRightHandOverride() );
}
+void OverlayController::processPushToTalkBindings()
+{
+ const auto pushToTalkCannotChange = !m_audioTabController.pttChangeValid();
+ if ( pushToTalkCannotChange )
+ {
+ return;
+ }
+
+ const auto pushToTalkButtonActivated = m_actions.pushToTalk();
+ const auto pushToTalkCurrentlyActive = m_audioTabController.pttActive();
+ if ( pushToTalkButtonActivated && !pushToTalkCurrentlyActive )
+ {
+ m_audioTabController.startPtt();
+ }
+ else if ( !pushToTalkButtonActivated && pushToTalkCurrentlyActive )
+ {
+ m_audioTabController.stopPtt();
+ }
+}
+
+/*!
+Checks if an action has been activated and dispatches the related action if it
+has been.
+*/
+void OverlayController::processInputBindings()
+{
+ processMediaKeyBindings();
+
+ processRoomBindings();
+
+ processPushToTalkBindings();
+}
+
// vsync implementation:
// (this function triggers every 1ms)
void OverlayController::OnTimeoutPumpEvents()
@@ -578,7 +615,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ),
Qt::NoButton,
m_lastMouseButtons,
- 0 );
+ nullptr );
m_ptLastMouse = ptNewMouse;
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
OnRenderRequest();
@@ -599,7 +636,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ),
button,
m_lastMouseButtons,
- 0 );
+ nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
}
break;
@@ -617,7 +654,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ),
button,
m_lastMouseButtons,
- 0 );
+ nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
}
break;
@@ -629,12 +666,14 @@ void OverlayController::mainEventLoop()
m_ptLastMouse,
m_pWindow->mapToGlobal( m_ptLastMouse ),
QPoint(),
- QPoint( vrEvent.data.scroll.xdelta * 360.0f * 8.0f,
- vrEvent.data.scroll.ydelta * 360.0f * 8.0f ),
+ QPoint( static_cast( vrEvent.data.scroll.xdelta
+ * ( 360.0f * 8.0f ) ),
+ static_cast( vrEvent.data.scroll.ydelta
+ * ( 360.0f * 8.0f ) ) ),
0,
Qt::Vertical,
m_lastMouseButtons,
- 0 );
+ nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &wheelEvent );
}
break;
@@ -654,9 +693,11 @@ void OverlayController::mainEventLoop()
m_chaperoneTabController.shutdown();
Shutdown();
QApplication::exit();
- return;
+
+ LOG( INFO ) << "All systems exited.";
+ exit( EXIT_SUCCESS );
+ // Does not fallthrough
}
- break;
case vr::VREvent_DashboardActivated:
{
@@ -677,7 +718,8 @@ void OverlayController::mainEventLoop()
char keyboardBuffer[1024];
vr::VROverlay()->GetKeyboardText( keyboardBuffer, 1024 );
emit keyBoardInputSignal( QString( keyboardBuffer ),
- vrEvent.data.keyboard.uUserValue );
+ static_cast(
+ vrEvent.data.keyboard.uUserValue ) );
}
break;
@@ -1065,7 +1107,7 @@ void OverlayController::playAlarm01Sound( bool loop )
void OverlayController::setAlarm01SoundVolume( float vol )
{
- m_alarm01SoundEffect.setVolume( vol );
+ m_alarm01SoundEffect.setVolume( static_cast( vol ) );
}
void OverlayController::cancelAlarm01Sound()
diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h
index f9ef940..8839c0d 100644
--- a/src/overlaycontroller.h
+++ b/src/overlaycontroller.h
@@ -89,7 +89,7 @@ private:
bool m_dashboardVisible = false;
QPoint m_ptLastMouse;
- Qt::MouseButtons m_lastMouseButtons = 0;
+ Qt::MouseButtons m_lastMouseButtons = nullptr;
bool m_desktopMode;
bool m_noSound;
@@ -128,6 +128,9 @@ public: // I know it's an ugly hack to make them public to enable external
private:
QPoint getMousePositionForEvent( vr::VREvent_Mouse_t mouse );
void processInputBindings();
+ void processMediaKeyBindings();
+ void processRoomBindings();
+ void processPushToTalkBindings();
public:
OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine );
@@ -167,7 +170,7 @@ public:
bool isDesktopMode()
{
return m_desktopMode;
- };
+ }
utils::ChaperoneUtils& chaperoneUtils() noexcept
{
diff --git a/src/package_files/action_manifest.json b/src/package_files/action_manifest.json
index 1bee5fa..221631e 100644
--- a/src/package_files/action_manifest.json
+++ b/src/package_files/action_manifest.json
@@ -100,6 +100,11 @@
"name": "/actions/main/in/SnapTurnRight",
"requirement": "optional",
"type": "boolean"
+ },
+ {
+ "name": "/actions/main/in/PushToTalk",
+ "requirement": "optional",
+ "type": "boolean"
}
],
"action_sets": [
@@ -132,7 +137,9 @@
"/actions/main/in/HeightToggle" : "Height Toggle",
"/actions/main/in/ResetOffsets" : "Reset Offsets",
"/actions/main/in/SnapTurnLeft" : "Snap-Turn Left",
- "/actions/main/in/SnapTurnRight" : "Snap-Turn Right"
+ "/actions/main/in/SnapTurnRight" : "Snap-Turn Right",
+
+ "/actions/main/in/PushToTalk" : "Push To Talk"
}
]
}
\ No newline at end of file
diff --git a/src/res/qml/RootPage.qml b/src/res/qml/RootPage.qml
index 582d02b..52099fa 100644
--- a/src/res/qml/RootPage.qml
+++ b/src/res/qml/RootPage.qml
@@ -362,39 +362,6 @@ MyStackViewPage {
AudioTabController.pttEnabled = checked
}
}
- RowLayout {
- spacing: 18
-
- MyComboBox {
- Layout.leftMargin: 78
- id: summaryPttProfileComboBox
- Layout.maximumWidth: 378
- Layout.minimumWidth: 378
- Layout.preferredWidth: 378
- Layout.fillWidth: true
- model: [""]
- onCurrentIndexChanged: {
- if (currentIndex > 0) {
- summaryPttProfileApplyButton.enabled = true
- } else {
- summaryPttProfileApplyButton.enabled = false
- }
- }
- }
-
- MyPushButton {
- id: summaryPttProfileApplyButton
- enabled: false
- Layout.preferredWidth: 150
- text: "Apply"
- onClicked: {
- if (summaryPttProfileComboBox.currentIndex > 0) {
- AudioTabController.applyPttProfile(summaryPttProfileComboBox.currentIndex - 1)
- summaryPttProfileComboBox.currentIndex = 0
- }
- }
- }
- }
}
Item {
@@ -417,7 +384,6 @@ MyStackViewPage {
Component.onCompleted: {
reloadChaperoneProfiles()
reloadSteamVRProfiles()
- reloadPttProfiles()
summaryVersionText.text = applicationVersion
@@ -454,9 +420,6 @@ MyStackViewPage {
Connections {
target: AudioTabController
- onPttProfilesUpdated: {
- reloadPttProfiles()
- }
onMicVolumeChanged: {
summaryMicVolumeSlider.value = AudioTabController.micVolume
}
@@ -540,14 +503,4 @@ MyStackViewPage {
summarySteamVRProfileComboBox.currentIndex = 0
summarySteamVRProfileComboBox.model = profiles
}
-
- function reloadPttProfiles() {
- var profiles = [""]
- var profileCount = AudioTabController.getPttProfileCount()
- for (var i = 0; i < profileCount; i++) {
- profiles.push(AudioTabController.getPttProfileName(i))
- }
- summaryPttProfileComboBox.currentIndex = 0
- summaryPttProfileComboBox.model = profiles
- }
}
diff --git a/src/res/qml/audio_page/device_selector/MirrorDeviceSelector.qml b/src/res/qml/audio_page/device_selector/MirrorDeviceSelector.qml
index d27acde..72f51c0 100644
--- a/src/res/qml/audio_page/device_selector/MirrorDeviceSelector.qml
+++ b/src/res/qml/audio_page/device_selector/MirrorDeviceSelector.qml
@@ -45,7 +45,7 @@ RowLayout {
setShownAudioDevice(index)
}
onPlaybackDeviceListChanged: {
- audioPlaybackNameCombo.devices = getAudioDeviceList()
+ audioMirrorNameCombo.devices = getAudioDeviceList()
setShownAudioDevice(AudioTabController.playbackDeviceIndex)
}
}
diff --git a/src/res/qml/audio_page/profiles/ProfileButtons.qml b/src/res/qml/audio_page/profiles/ProfileButtons.qml
index b7c3d84..ca9c48d 100644
--- a/src/res/qml/audio_page/profiles/ProfileButtons.qml
+++ b/src/res/qml/audio_page/profiles/ProfileButtons.qml
@@ -10,18 +10,10 @@ ColumnLayout {
id: audioMessageDialog
}
- PttDeleteProfileDialog {
- id: pttDeleteProfileDialog
- }
-
AudioDeleteProfileDialog {
id: audioDeleteProfileDialog
}
- PttNewProfileDialog {
- id: pttNewProfileDialog
- }
-
AudioNewProfileDialog {
id: audioNewProfileDialog
}
@@ -61,38 +53,9 @@ ColumnLayout {
}
}
}
-
MyText {
- text: "PTT Profile:"
- Layout.preferredWidth: 150
- }
-
- MyComboBox {
- id: pttProfileComboBox
- Layout.preferredWidth: 250
- model: [""]
- onCurrentIndexChanged: {
- if (currentIndex > 0) {
- pttApplyProfileButton.enabled = true
- pttDeleteProfileButton.enabled = true
- } else {
- pttApplyProfileButton.enabled = false
- pttDeleteProfileButton.enabled = false
- }
- }
- }
-
- MyPushButton {
- id: pttApplyProfileButton
- enabled: true
- Layout.preferredWidth: 150
- text: "Apply"
- onClicked: {
- if (pttProfileComboBox.currentIndex > 0) {
- AudioTabController.applyPttProfile(
- pttProfileComboBox.currentIndex - 1)
- }
- }
+ // Text continues in next RowLayout.
+ text: "Change the Push To Talk settings"
}
}
RowLayout {
@@ -117,62 +80,27 @@ ColumnLayout {
audioNewProfileDialog.openPopup()
}
}
- Item {
- Layout.fillWidth: true
- }
- MyPushButton {
- id: pttDeleteProfileButton
- enabled: true
- Layout.preferredWidth: 200
- text: "Delete Profile"
- onClicked: {
- if (pttProfileComboBox.currentIndex > 0) {
- pttDeleteProfileDialog.profileIndex = pttProfileComboBox.currentIndex - 1
- pttDeleteProfileDialog.open()
- }
- }
- }
- MyPushButton {
- Layout.preferredWidth: 200
- text: "New Profile"
- onClicked: {
- pttNewProfileDialog.openPopup()
- }
+ MyText {
+ // Text continues from RowLayout above.
+ text: "\t\tin the SteamVR bindings menu."
}
}
Component.onCompleted: {
- reloadPttProfiles()
reloadAudioProfiles()
}
Connections {
target: AudioTabController
- onPttProfilesUpdated: {
- reloadPttProfiles()
- }
onAudioProfilesUpdated: {
reloadAudioProfiles()
}
onAudioProfileAdded: {
audioProfileComboBox.currentIndex = AudioTabController.getAudioProfileCount()
}
- onPttProfileAdded: {
- pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
- }
onDefaultProfileDisplay: {
audioProfileComboBox.currentIndex = AudioTabController.getDefaultAudioProfileIndex(
) + 1
}
}
- function reloadPttProfiles() {
- var profiles = [""]
- var profileCount = AudioTabController.getPttProfileCount()
- for (var i = 0; i < profileCount; i++) {
- profiles.push(AudioTabController.getPttProfileName(i))
- }
- pttProfileComboBox.currentIndex = 0
- pttProfileComboBox.model = profiles
- }
-
function reloadAudioProfiles() {
var profiles = [""]
var profileCount = AudioTabController.getAudioProfileCount()
diff --git a/src/res/qml/audio_page/push_to_talk/PttButtons.qml b/src/res/qml/audio_page/push_to_talk/PttButtons.qml
index 37e84e6..2014c51 100644
--- a/src/res/qml/audio_page/push_to_talk/PttButtons.qml
+++ b/src/res/qml/audio_page/push_to_talk/PttButtons.qml
@@ -6,54 +6,17 @@ import "../../common"
ColumnLayout {
RowLayout {
- PttControllerConfigDialog {
- id: pttControllerConfigDialog
- pttControllerConfigClass: AudioTabController
- }
-
MyToggleButton {
id: audioPttEnabledToggle
- Layout.preferredWidth: 260
+ Layout.fillWidth: true
text: "Push-to-Talk:"
onClicked: {
AudioTabController.pttEnabled = checked
}
}
- MyToggleButton {
- id: audioPttLeftControllerToggle
- text: "Left Controller"
- onClicked: {
- AudioTabController.setPttLeftControllerEnabled(checked, false)
- }
- }
- MyPushButton {
- text: "Configure"
- onClicked: {
- pttControllerConfigDialog.openPopup(0)
- }
- }
- Item {
- Layout.fillWidth: true
- }
- MyToggleButton {
- id: audioPttRightControllerToggle
- text: "Right Controller"
- onClicked: {
- AudioTabController.setPttRightControllerEnabled(checked, false)
- }
- }
- MyPushButton {
- text: "Configure"
- onClicked: {
- pttControllerConfigDialog.openPopup(1)
- }
- }
- }
- RowLayout {
-
MyToggleButton {
id: audioPttShowNotificationToggle
- Layout.leftMargin: 350
+ Layout.fillWidth: true
text: "Show notification in HMD"
onCheckedChanged: {
AudioTabController.setPttShowNotification(checked, false)
@@ -61,7 +24,7 @@ ColumnLayout {
}
MyToggleButton {
id: audioPttReverseToggle
- Layout.leftMargin: 118
+ Layout.fillWidth: true
text: "Push-to-Mute"
onClicked: {
AudioTabController.setMicReversePtt(checked, false)
@@ -71,8 +34,6 @@ ColumnLayout {
Component.onCompleted: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
- audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
- audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification
audioPttReverseToggle.checked = AudioTabController.micReversePtt
}
@@ -81,12 +42,6 @@ ColumnLayout {
onPttEnabledChanged: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled
}
- onPttLeftControllerEnabledChanged: {
- audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
- }
- onPttRightControllerEnabledChanged: {
- audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
- }
onMicReversePttChanged: {
audioPttReverseToggle.checked = AudioTabController.micReversePtt
}
diff --git a/src/res/qml/common/PttControllerConfigDialog.qml b/src/res/qml/common/PttControllerConfigDialog.qml
deleted file mode 100644
index c1d5ddd..0000000
--- a/src/res/qml/common/PttControllerConfigDialog.qml
+++ /dev/null
@@ -1,148 +0,0 @@
-import QtQuick 2.7
-import QtQuick.Controls 2.0
-import QtQuick.Layouts 1.3
-import matzman666.advsettings 1.0
-
-MyDialogOkCancelPopup {
- id: pttControllerConfigDialog
- property var pttControllerConfigClass
- property int controllerIndex: -1
- dialogTitle: "Controller Configuration"
- dialogWidth: 600
- dialogHeight: 620
- dialogContentItem: ColumnLayout {
- MyText {
- text: "Buttons"
- }
- Rectangle {
- color: "#cccccc"
- height: 1
- Layout.fillWidth: true
- }
- MyToggleButton {
- id: pttControllerConfigGripButtonToggle
- text: "Grip"
- }
- MyToggleButton {
- id: pttControllerConfigMenuButtonToggle
- text: "Menu"
- }
- MyToggleButton {
- id: pttControllerConfigTriggerButtonToggle
- text: "Trigger"
- }
-
- MyText {
- Layout.topMargin: 32
- text: "Touchpad"
- }
- Rectangle {
- color: "#cccccc"
- height: 1
- Layout.fillWidth: true
- }
- RowLayout {
- spacing: 64
- MyToggleButton {
- id: pttControllerConfigPadLeftToggle
- text: "Left"
- }
- MyToggleButton {
- id: pttControllerConfigPadRightToggle
- text: "Right"
- }
- }
- RowLayout {
- spacing: 64
- MyToggleButton {
- id: pttControllerConfigPadTopToggle
- text: "Top"
- }
- MyToggleButton {
- id: pttControllerConfigPadBottomToggle
- text: "Bottom"
- }
- }
- RowLayout {
- MyText {
- text: "Mode:"
- }
- MyComboBox {
- id: pttControllerConfigPadModeCombo
- Layout.preferredWidth: 250
- model: ["Disabled", "Touched", "Pressed"]
- }
- }
- }
- onClosed: {
- if (okClicked) {
- var buttons = []
- if (pttControllerConfigGripButtonToggle.checked) {
- buttons.push(2)
- }
- if (pttControllerConfigMenuButtonToggle.checked) {
- buttons.push(1)
- }
- var triggerMode = 0
- if (pttControllerConfigTriggerButtonToggle.checked) {
- triggerMode = 1
- }
- var padAreas = 0
- if (pttControllerConfigPadLeftToggle.checked) {
- padAreas |= (1 << 0)
- }
- if (pttControllerConfigPadTopToggle.checked) {
- padAreas |= (1 << 1)
- }
- if (pttControllerConfigPadRightToggle.checked) {
- padAreas |= (1 << 2)
- }
- if (pttControllerConfigPadBottomToggle.checked) {
- padAreas |= (1 << 3)
- }
- pttControllerConfigClass.setPttControllerConfig(controllerIndex, buttons, triggerMode, pttControllerConfigPadModeCombo.currentIndex, padAreas);
- }
- }
- function openPopup(controller) {
- if (controller === 0) {
- dialogTitle = "Left Controller Configuration"
- controllerIndex = 0
- } else {
- dialogTitle = "Right Controller Configuration"
- controllerIndex = 1
- }
- pttControllerConfigGripButtonToggle.checked = false
- pttControllerConfigMenuButtonToggle.checked = false
- pttControllerConfigTriggerButtonToggle.checked = false
- pttControllerConfigPadLeftToggle.checked = false
- pttControllerConfigPadTopToggle.checked = false
- pttControllerConfigPadRightToggle.checked = false
- pttControllerConfigPadBottomToggle.checked = false
- pttControllerConfigPadModeCombo.currentIndex = pttControllerConfigClass.pttTouchpadMode(controllerIndex)
- var buttons = pttControllerConfigClass.pttDigitalButtons(controllerIndex)
- for (var i = 0; i < buttons.length; i++) {
- if (buttons[i] == 1) {
- pttControllerConfigMenuButtonToggle.checked = true
- } else if (buttons[i] == 2) {
- pttControllerConfigGripButtonToggle.checked = true
- }
- }
- if (pttControllerConfigClass.pttTriggerMode(controllerIndex) > 0) {
- pttControllerConfigTriggerButtonToggle.checked = true
- }
- var padAreas = pttControllerConfigClass.pttTouchpadArea(controllerIndex)
- if (padAreas & (1 << 0)) {
- pttControllerConfigPadLeftToggle.checked = true
- }
- if (padAreas & (1 << 1)) {
- pttControllerConfigPadTopToggle.checked = true
- }
- if (padAreas & (1 << 2)) {
- pttControllerConfigPadRightToggle.checked = true
- }
- if (padAreas & (1 << 3)) {
- pttControllerConfigPadBottomToggle.checked = true
- }
- open()
- }
-}
diff --git a/src/tabcontrollers/AudioManager.h b/src/tabcontrollers/AudioManager.h
index a60bc15..db33cd5 100644
--- a/src/tabcontrollers/AudioManager.h
+++ b/src/tabcontrollers/AudioManager.h
@@ -11,7 +11,7 @@ class AudioTabController;
class AudioManager
{
public:
- virtual ~AudioManager(){};
+ virtual ~AudioManager() {}
virtual void init( AudioTabController* controller ) = 0;
diff --git a/src/tabcontrollers/AudioTabController.cpp b/src/tabcontrollers/AudioTabController.cpp
index 9dcfedf..f1faebe 100644
--- a/src/tabcontrollers/AudioTabController.cpp
+++ b/src/tabcontrollers/AudioTabController.cpp
@@ -750,7 +750,7 @@ void AudioTabController::reloadAudioProfiles()
{
settings->setArrayIndex( i );
audioProfiles.emplace_back();
- auto& entry = audioProfiles[i];
+ auto& entry = audioProfiles[static_cast( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.playbackName
@@ -1044,7 +1044,7 @@ void AudioTabController::applyDefaultProfile()
if ( profile.defaultProfile )
{
applyAudioProfile( i );
- m_defaultProfileIndex = i;
+ m_defaultProfileIndex = static_cast( i );
break;
}
}
diff --git a/src/tabcontrollers/AudioTabController.h b/src/tabcontrollers/AudioTabController.h
index c66f492..9c0f269 100644
--- a/src/tabcontrollers/AudioTabController.h
+++ b/src/tabcontrollers/AudioTabController.h
@@ -87,7 +87,7 @@ private:
void onPttStop() override;
void onPttEnabled() override;
void onPttDisabled() override;
- bool pttChangeValid() override;
+
virtual vr::VROverlayHandle_t getNotificationOverlayHandle() override
{
return m_ulNotificationOverlayHandle;
@@ -114,6 +114,8 @@ public:
void eventLoopTick();
+ bool pttChangeValid() override;
+
int playbackDeviceIndex() const;
int mirrorDeviceIndex() const;
diff --git a/src/tabcontrollers/ChaperoneTabController.cpp b/src/tabcontrollers/ChaperoneTabController.cpp
index f8d20e8..dfbac39 100644
--- a/src/tabcontrollers/ChaperoneTabController.cpp
+++ b/src/tabcontrollers/ChaperoneTabController.cpp
@@ -70,7 +70,7 @@ void ChaperoneTabController::reloadChaperoneProfiles()
{
settings->setArrayIndex( i );
chaperoneProfiles.emplace_back();
- auto& entry = chaperoneProfiles[i];
+ auto& entry = chaperoneProfiles[static_cast( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.includesChaperoneGeometry
@@ -229,7 +229,7 @@ void ChaperoneTabController::saveChaperoneProfiles()
unsigned i = 0;
for ( auto& p : chaperoneProfiles )
{
- settings->setArrayIndex( i );
+ settings->setArrayIndex( static_cast( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "includesChaperoneGeometry",
@@ -564,7 +564,7 @@ void ChaperoneTabController::eventLoopTick(
{
float mod = m_chaperoneVelocityModifier
* std::max( { leftSpeed, rightSpeed, hmdSpeed } );
- if ( mod > 0.02 )
+ if ( mod > 0.02f )
{
m_chaperoneVelocityModifierCurrent += mod;
}
@@ -654,10 +654,10 @@ void ChaperoneTabController::eventLoopTick(
if ( parent->isDashboardVisible() )
{
vr::EVRSettingsError vrSettingsError;
- float vis = vr::VRSettings()->GetInt32(
+ float vis = static_cast( vr::VRSettings()->GetInt32(
vr::k_pch_CollisionBounds_Section,
vr::k_pch_CollisionBounds_ColorGammaA_Int32,
- &vrSettingsError );
+ &vrSettingsError ) );
if ( vrSettingsError != vr::VRSettingsError_None )
{
LOG( WARNING )
@@ -733,9 +733,10 @@ void ChaperoneTabController::setBoundsVisibility( float value, bool notify )
if ( m_visibility != value )
{
m_visibility = value;
- vr::VRSettings()->SetInt32( vr::k_pch_CollisionBounds_Section,
- vr::k_pch_CollisionBounds_ColorGammaA_Int32,
- 255 * m_visibility );
+ vr::VRSettings()->SetInt32(
+ vr::k_pch_CollisionBounds_Section,
+ vr::k_pch_CollisionBounds_ColorGammaA_Int32,
+ static_cast( 255 * m_visibility ) );
vr::VRSettings()->Sync();
if ( notify )
{
@@ -928,7 +929,7 @@ float ChaperoneTabController::chaperoneVelocityModifier() const
Q_INVOKABLE unsigned ChaperoneTabController::getChaperoneProfileCount()
{
- return ( unsigned ) chaperoneProfiles.size();
+ return static_cast( chaperoneProfiles.size() );
}
Q_INVOKABLE QString
@@ -1244,7 +1245,7 @@ void ChaperoneTabController::flipOrientation()
{
parent->m_moveCenterTabController.reset();
parent->RotateUniverseCenter( vr::TrackingUniverseStanding,
- ( float ) M_PI );
+ static_cast( M_PI ) );
}
void ChaperoneTabController::reloadFromDisk()
diff --git a/src/tabcontrollers/FixFloorTabController.cpp b/src/tabcontrollers/FixFloorTabController.cpp
index 3d44396..57edbce 100644
--- a/src/tabcontrollers/FixFloorTabController.cpp
+++ b/src/tabcontrollers/FixFloorTabController.cpp
@@ -86,9 +86,9 @@ void FixFloorTabController::eventLoopTick(
auto& m = devicePoses[referenceController]
.mDeviceToAbsoluteTracking.m;
- tempOffsetX = ( double ) m[0][3];
- tempOffsetY = ( double ) m[1][3];
- tempOffsetZ = ( double ) m[2][3];
+ tempOffsetX = static_cast( m[0][3] );
+ tempOffsetY = static_cast( m[1][3] );
+ tempOffsetZ = static_cast( m[2][3] );
/*
| Intrinsic y-x'-z" rotation matrix:
| cr*cy+sp*sr*sy | cr*sp*sy-cy*sr | cp*sy |
@@ -99,7 +99,8 @@ void FixFloorTabController::eventLoopTick(
pitch = -asin(-sp) [pi/2, -pi/2]
roll = atan2(cp*sr, cp*cr) [pi, -pi], CW
*/
- tempRoll = std::atan2( ( double ) m[1][0], ( double ) m[1][1] );
+ tempRoll = std::atan2( static_cast( m[1][0] ),
+ static_cast( m[1][1] ) );
measurementCount = 1;
}
}
@@ -109,9 +110,9 @@ void FixFloorTabController::eventLoopTick(
auto& m
= devicePoses[referenceController].mDeviceToAbsoluteTracking.m;
- double rollDiff
- = std::atan2( ( double ) m[1][0], ( double ) m[1][1] )
- - tempRoll;
+ double rollDiff = std::atan2( static_cast( m[1][0] ),
+ static_cast( m[1][1] ) )
+ - tempRoll;
if ( rollDiff > M_PI )
{
rollDiff -= 2.0 * M_PI;
@@ -120,7 +121,7 @@ void FixFloorTabController::eventLoopTick(
{
rollDiff += 2.0 * M_PI;
}
- tempRoll += rollDiff / ( double ) measurementCount;
+ tempRoll += rollDiff / static_cast( measurementCount );
if ( tempRoll > M_PI )
{
tempRoll -= 2.0 * M_PI;
@@ -134,15 +135,17 @@ void FixFloorTabController::eventLoopTick(
{
if ( std::abs( tempRoll ) <= M_PI_2 )
{
- floorOffsetY = tempOffsetY - controllerUpOffsetCorrection;
+ floorOffsetY = static_cast( tempOffsetY )
+ - controllerUpOffsetCorrection;
}
else
{
- floorOffsetY = tempOffsetY - controllerDownOffsetCorrection;
+ floorOffsetY = static_cast( tempOffsetY )
+ - controllerDownOffsetCorrection;
}
- floorOffsetX = tempOffsetX;
- floorOffsetZ = tempOffsetZ;
+ floorOffsetX = static_cast( tempOffsetX );
+ floorOffsetZ = static_cast( tempOffsetZ );
LOG( INFO )
<< "Fix Floor and adjust space center: Floor Offset = ["
diff --git a/src/tabcontrollers/KeyboardInput.h b/src/tabcontrollers/KeyboardInput.h
index 8821552..a4e1ba7 100644
--- a/src/tabcontrollers/KeyboardInput.h
+++ b/src/tabcontrollers/KeyboardInput.h
@@ -11,7 +11,7 @@ class AudioTabController;
class KeyboardInput
{
public:
- virtual ~KeyboardInput(){};
+ virtual ~KeyboardInput() {}
virtual void sendKeyboardInput( QString input ) = 0;
virtual void sendKeyboardEnter() = 0;
diff --git a/src/tabcontrollers/MoveCenterTabController.h b/src/tabcontrollers/MoveCenterTabController.h
index 6ebf992..328962c 100644
--- a/src/tabcontrollers/MoveCenterTabController.h
+++ b/src/tabcontrollers/MoveCenterTabController.h
@@ -60,7 +60,7 @@ private:
OverlayController* parent;
QQuickWindow* widget;
- int m_trackingUniverse = ( int ) vr::TrackingUniverseStanding;
+ int m_trackingUniverse = static_cast( vr::TrackingUniverseStanding );
float m_offsetX = 0.0f;
float m_offsetY = 0.0f;
float m_offsetZ = 0.0f;
diff --git a/src/tabcontrollers/PttController.cpp b/src/tabcontrollers/PttController.cpp
index cf2bdda..5119cdf 100644
--- a/src/tabcontrollers/PttController.cpp
+++ b/src/tabcontrollers/PttController.cpp
@@ -43,7 +43,8 @@ void PttController::setPttControllerConfig( unsigned controller,
uint64_t buttonMask = 0;
for ( auto b : buttons )
{
- buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
+ buttonMask |= vr::ButtonMaskFromId(
+ ( static_cast( b.toInt() ) ) );
}
m_pttControllerConfigs[controller].digitalButtons = buttons;
m_pttControllerConfigs[controller].digitalButtonMask = buttonMask;
@@ -64,7 +65,7 @@ void PttController::reloadPttProfiles()
{
settings->setArrayIndex( i );
pttProfiles.emplace_back();
- auto& entry = pttProfiles[i];
+ auto& entry = pttProfiles[static_cast( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.showNotification
@@ -78,7 +79,8 @@ void PttController::reloadPttProfiles()
uint64_t buttonMask = 0;
for ( auto b : entry.controllerConfigs[0].digitalButtons )
{
- buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
+ buttonMask |= vr::ButtonMaskFromId(
+ static_cast( b.toInt() ) );
}
entry.controllerConfigs[0].digitalButtonMask = buttonMask;
entry.controllerConfigs[0].triggerMode
@@ -92,7 +94,8 @@ void PttController::reloadPttProfiles()
buttonMask = 0;
for ( auto b : entry.controllerConfigs[1].digitalButtons )
{
- buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
+ buttonMask |= vr::ButtonMaskFromId(
+ static_cast( b.toInt() ) );
}
entry.controllerConfigs[1].digitalButtonMask = buttonMask;
entry.controllerConfigs[1].triggerMode
@@ -114,7 +117,7 @@ void PttController::savePttProfiles()
unsigned i = 0;
for ( auto& p : pttProfiles )
{
- settings->setArrayIndex( i );
+ settings->setArrayIndex( static_cast( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "showNotification", p.showNotification );
@@ -165,7 +168,8 @@ void PttController::reloadPttConfig()
uint64_t buttonMask = 0;
for ( auto b : m_pttControllerConfigs[0].digitalButtons )
{
- buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
+ buttonMask |= vr::ButtonMaskFromId(
+ static_cast( b.toInt() ) );
}
m_pttControllerConfigs[0].digitalButtonMask = buttonMask;
m_pttControllerConfigs[0].triggerMode
@@ -179,7 +183,8 @@ void PttController::reloadPttConfig()
buttonMask = 0;
for ( auto b : m_pttControllerConfigs[0].digitalButtons )
{
- buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() );
+ buttonMask |= vr::ButtonMaskFromId(
+ static_cast( b.toInt() ) );
}
m_pttControllerConfigs[1].digitalButtonMask = buttonMask;
m_pttControllerConfigs[1].triggerMode
@@ -222,118 +227,8 @@ void PttController::savePttConfig()
void PttController::checkPttStatus()
{
- static auto handleControllerState
- = []( const vr::VRControllerState_t& state,
- PttControllerConfig* config ) -> bool {
- if ( state.ulButtonPressed & config->digitalButtonMask )
- {
- return true;
- }
- if ( config->triggerMode )
- {
- if ( state.ulButtonPressed
- & vr::ButtonMaskFromId( vr::k_EButton_SteamVR_Trigger ) )
- {
- return true;
- }
- }
- if ( config->touchpadMode )
- {
- if ( ( ( config->touchpadMode & 1 )
- && ( state.ulButtonTouched
- & vr::ButtonMaskFromId(
- vr::k_EButton_SteamVR_Touchpad ) ) )
- || ( ( config->touchpadMode & 2 )
- && ( state.ulButtonPressed
- & vr::ButtonMaskFromId(
- vr::k_EButton_SteamVR_Touchpad ) ) ) )
- {
- if ( config->touchpadAreas
- == ( PAD_AREA_LEFT + PAD_AREA_TOP + PAD_AREA_RIGHT
- + PAD_AREA_BOTTOM ) )
- {
- return true;
- }
- else
- {
- float x = state.rAxis[0].x;
- float y = state.rAxis[0].y;
- if ( std::abs( x ) >= 0.2 || std::abs( y ) >= 0.2 )
- { // deadzone in the middle
- if ( x < 0 && std::abs( y ) < -x
- && ( config->touchpadAreas & PAD_AREA_LEFT ) )
- {
- return true;
- }
- else if ( y > 0 && std::abs( x ) < y
- && ( config->touchpadAreas & PAD_AREA_TOP ) )
- {
- return true;
- }
- else if ( x > 0 && std::abs( y ) < x
- && ( config->touchpadAreas
- & PAD_AREA_RIGHT ) )
- {
- return true;
- }
- else if ( y < 0 && std::abs( x ) < -y
- && ( config->touchpadAreas
- & PAD_AREA_BOTTOM ) )
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- };
- if ( m_pttEnabled )
- {
- bool newState = false;
- if ( m_pttLeftControllerEnabled )
- {
- auto leftId
- = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
- vr::TrackedControllerRole_LeftHand );
- if ( leftId != vr::k_unTrackedDeviceIndexInvalid )
- {
- vr::VRControllerState_t state;
- if ( vr::VRSystem()->GetControllerState(
- leftId, &state, sizeof( vr::VRControllerState_t ) ) )
- {
- // logControllerState(state, "Left ");
- newState |= handleControllerState( state,
- m_pttControllerConfigs );
- }
- }
- }
- if ( m_pttRightControllerEnabled )
- {
- auto rightId
- = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
- vr::TrackedControllerRole_RightHand );
- if ( rightId != vr::k_unTrackedDeviceIndexInvalid )
- {
- vr::VRControllerState_t state;
- if ( vr::VRSystem()->GetControllerState(
- rightId, &state, sizeof( vr::VRControllerState_t ) ) )
- {
- // logControllerState(state, "Right ");
- newState |= handleControllerState(
- state, m_pttControllerConfigs + 1 );
- }
- }
- }
- if ( newState && !m_pttActive && pttChangeValid() )
- {
- startPtt();
- }
- else if ( !newState && m_pttActive && pttChangeValid() )
- {
- stopPtt();
- }
- }
+ // PTT Controls are now handled in the overlaycontroller using public
+ // functions.
}
void PttController::startPtt()
@@ -464,7 +359,8 @@ unsigned long PttController::pttDigitalButtonMask( unsigned controller )
{
if ( controller < 2 )
{
- return m_pttControllerConfigs[controller].digitalButtonMask;
+ return static_cast(
+ m_pttControllerConfigs[controller].digitalButtonMask );
}
return 0;
}
@@ -498,7 +394,7 @@ unsigned PttController::pttTouchpadArea( unsigned controller )
unsigned PttController::getPttProfileCount()
{
- return ( unsigned ) pttProfiles.size();
+ return static_cast( pttProfiles.size() );
}
QString PttController::getPttProfileName( unsigned index )
diff --git a/src/tabcontrollers/PttController.h b/src/tabcontrollers/PttController.h
index 3ffc980..2106697 100644
--- a/src/tabcontrollers/PttController.h
+++ b/src/tabcontrollers/PttController.h
@@ -71,14 +71,11 @@ protected:
protected:
void checkPttStatus();
virtual QString getSettingsName() = 0;
- virtual void onPttStart(){};
- virtual void onPttStop(){};
- virtual void onPttEnabled(){};
- virtual void onPttDisabled(){};
- virtual bool pttChangeValid()
- {
- return true;
- }
+ virtual void onPttStart() {}
+ virtual void onPttStop() {}
+ virtual void onPttEnabled() {}
+ virtual void onPttDisabled() {}
+
virtual vr::VROverlayHandle_t getNotificationOverlayHandle()
{
return vr::k_ulOverlayHandleInvalid;
@@ -100,6 +97,11 @@ public:
void savePttProfiles();
void savePttConfig();
+ virtual bool pttChangeValid()
+ {
+ return true;
+ }
+
Q_INVOKABLE QVariantList pttDigitalButtons( unsigned controller );
Q_INVOKABLE unsigned long pttDigitalButtonMask( unsigned controller );
Q_INVOKABLE unsigned pttTouchpadMode( unsigned controller );
diff --git a/src/tabcontrollers/ReviveTabController.cpp b/src/tabcontrollers/ReviveTabController.cpp
index 99126d9..8c8e5ae 100644
--- a/src/tabcontrollers/ReviveTabController.cpp
+++ b/src/tabcontrollers/ReviveTabController.cpp
@@ -5,25 +5,25 @@
// application namespace
namespace advsettings
{
-const char* appkey_overlay = "revive.dashboard.overlay";
-const char* section_revive = "revive";
-const char* key_pixelsPerDisplayPixel = "pixelsPerDisplayPixel";
-const char* key_toggleGrip = "ToggleGrip";
-const char* key_triggerAsGrip = "TriggerAsGrip";
-const char* key_toggleDelay = "ToggleDelay";
-const char* key_thumbDeadzone = "ThumbDeadzone";
-const char* key_thumbSensitivity = "ThumbSensitivity";
-const char* key_touchPitch = "TouchPitch";
-const char* key_touchYaw = "TouchYaw";
-const char* key_touchRoll = "TouchRoll";
-const char* key_touchX = "TouchX";
-const char* key_touchY = "TouchY";
-const char* key_touchZ = "TouchZ";
-const char* key_playerHeight = "PlayerHeight";
-const char* key_eyeHeight = "EyeHeight";
-const char* key_piUser = "User";
-const char* key_piName = "Name";
-const char* key_piGender = "Gender";
+constexpr auto appkey_overlay = "revive.dashboard.overlay";
+constexpr auto section_revive = "revive";
+constexpr auto key_pixelsPerDisplayPixel = "pixelsPerDisplayPixel";
+constexpr auto key_toggleGrip = "ToggleGrip";
+constexpr auto key_triggerAsGrip = "TriggerAsGrip";
+constexpr auto key_toggleDelay = "ToggleDelay";
+constexpr auto key_thumbDeadzone = "ThumbDeadzone";
+constexpr auto key_thumbSensitivity = "ThumbSensitivity";
+constexpr auto key_touchPitch = "TouchPitch";
+constexpr auto key_touchYaw = "TouchYaw";
+constexpr auto key_touchRoll = "TouchRoll";
+constexpr auto key_touchX = "TouchX";
+constexpr auto key_touchY = "TouchY";
+constexpr auto key_touchZ = "TouchZ";
+constexpr auto key_playerHeight = "PlayerHeight";
+constexpr auto key_eyeHeight = "EyeHeight";
+constexpr auto key_piUser = "User";
+constexpr auto key_piName = "Name";
+constexpr auto key_piGender = "Gender";
void ReviveTabController::initStage1( bool forceRevivePage )
{
@@ -44,7 +44,7 @@ void ReviveTabController::initStage1( bool forceRevivePage )
}
else
{
- if ( valuef == 0.0 )
+ if ( valuef == 0.0f )
{
m_pixelsPerDisplayPixelOverrideEnabled = false;
m_pixelsPerDisplayPixelOverride = 1.0;
@@ -321,7 +321,7 @@ void ReviveTabController::eventLoopTick()
&vrSettingsError );
if ( vrSettingsError == vr::VRSettingsError_None )
{
- if ( valuef == 0.0 )
+ if ( valuef == 0.0f )
{
setPixelsPerDisplayPixelOverrideEnabled( false );
}
@@ -1015,17 +1015,17 @@ void ReviveTabController::setPiGender( int value, bool notify )
{
m_piGender = value;
vr::EVRSettingsError vrSettingsError;
- char* txt;
+ const char* txt;
switch ( value )
{
case 1:
- txt = ( char* ) "Male";
+ txt = static_cast( "Male" );
break;
case 2:
- txt = ( char* ) "Female";
+ txt = static_cast( "Female" );
break;
default:
- txt = ( char* ) "Unknown";
+ txt = static_cast( "Unknown" );
break;
}
vr::VRSettings()->SetString(
@@ -1207,7 +1207,7 @@ void ReviveTabController::reloadControllerProfiles()
{
settings->setArrayIndex( i );
controllerProfiles.emplace_back();
- auto& entry = controllerProfiles[i];
+ auto& entry = controllerProfiles[static_cast( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.gripButtonMode = settings->value( "gripButtonMode", 0 ).toInt();
@@ -1234,7 +1234,7 @@ void ReviveTabController::saveControllerProfiles()
unsigned i = 0;
for ( auto& p : controllerProfiles )
{
- settings->setArrayIndex( i );
+ settings->setArrayIndex( static_cast( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "gripButtonMode", p.gripButtonMode );
@@ -1255,7 +1255,7 @@ void ReviveTabController::saveControllerProfiles()
Q_INVOKABLE unsigned ReviveTabController::getControllerProfileCount()
{
- return ( unsigned ) controllerProfiles.size();
+ return static_cast( controllerProfiles.size() );
}
Q_INVOKABLE QString
diff --git a/src/tabcontrollers/StatisticsTabController.cpp b/src/tabcontrollers/StatisticsTabController.cpp
index dc397c7..ae3df79 100644
--- a/src/tabcontrollers/StatisticsTabController.cpp
+++ b/src/tabcontrollers/StatisticsTabController.cpp
@@ -48,13 +48,13 @@ void StatisticsTabController::eventLoopTick(
}
else
{
- auto delta = std::sqrt(
+ float delta = static_cast( std::sqrt(
std::pow( m[0][3] - lastHmdPos[0],
2 ) /*+ std::pow(m[1][3] - lastHmdPos[1], 2)*/
- + std::pow( m[2][3] - lastHmdPos[2], 2 ) );
+ + std::pow( m[2][3] - lastHmdPos[2], 2 ) ) );
if ( delta >= 0.01f )
{
- m_hmdDistanceMoved += delta;
+ m_hmdDistanceMoved += static_cast( delta );
}
}
lastHmdPos[0] = m[0][3];
@@ -93,7 +93,7 @@ void StatisticsTabController::eventLoopTick(
float StatisticsTabController::hmdDistanceMoved() const
{
- return m_hmdDistanceMoved;
+ return static_cast( m_hmdDistanceMoved );
}
float StatisticsTabController::hmdRotations() const
@@ -133,10 +133,10 @@ unsigned StatisticsTabController::timedOut() const
float StatisticsTabController::totalReprojectedRatio() const
{
- float totalFrames = ( float ) ( m_cumStats.m_nNumFramePresents
- - m_totalRatioPresentedOffset );
- float reprojectedFrames = ( float ) ( m_cumStats.m_nNumReprojectedFrames
- - m_totalRatioReprojectedOffset );
+ float totalFrames = static_cast(
+ ( m_cumStats.m_nNumFramePresents - m_totalRatioPresentedOffset ) );
+ float reprojectedFrames = static_cast( (
+ m_cumStats.m_nNumReprojectedFrames - m_totalRatioReprojectedOffset ) );
if ( totalFrames != 0.0f )
{
return reprojectedFrames / totalFrames;
@@ -164,7 +164,7 @@ void StatisticsTabController::statsRotationResetClicked()
void StatisticsTabController::statsLeftControllerSpeedResetClicked()
{
- if ( m_leftControllerMaxSpeed != 0.0 )
+ if ( m_leftControllerMaxSpeed != 0.0f )
{
m_leftControllerMaxSpeed = 0.0;
}
@@ -172,7 +172,7 @@ void StatisticsTabController::statsLeftControllerSpeedResetClicked()
void StatisticsTabController::statsRightControllerSpeedResetClicked()
{
- if ( m_rightControllerMaxSpeed != 0.0 )
+ if ( m_rightControllerMaxSpeed != 0.0f )
{
m_rightControllerMaxSpeed = 0.0;
}
diff --git a/src/tabcontrollers/SteamVRTabController.cpp b/src/tabcontrollers/SteamVRTabController.cpp
index 04f771c..d7912de 100644
--- a/src/tabcontrollers/SteamVRTabController.cpp
+++ b/src/tabcontrollers/SteamVRTabController.cpp
@@ -56,7 +56,7 @@ void SteamVRTabController::eventLoopTick()
<< "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError );
- if ( m_superSampling != 1.0 )
+ if ( m_superSampling != 1.0f )
{
LOG( DEBUG )
<< "OpenVR returns an error and we have a custom "
@@ -204,7 +204,7 @@ void SteamVRTabController::reloadSteamVRProfiles()
{
settings->setArrayIndex( i );
steamvrProfiles.emplace_back();
- auto& entry = steamvrProfiles[i];
+ auto& entry = steamvrProfiles[static_cast( i )];
entry.profileName
= settings->value( "profileName" ).toString().toStdString();
entry.includesSupersampling
@@ -243,7 +243,7 @@ void SteamVRTabController::saveSteamVRProfiles()
unsigned i = 0;
for ( auto& p : steamvrProfiles )
{
- settings->setArrayIndex( i );
+ settings->setArrayIndex( static_cast( i ) );
settings->setValue( "profileName",
QString::fromStdString( p.profileName ) );
settings->setValue( "includesSupersampling", p.includesSupersampling );
diff --git a/src/tabcontrollers/UtilitiesTabController.cpp b/src/tabcontrollers/UtilitiesTabController.cpp
index f4effb0..9d9b305 100644
--- a/src/tabcontrollers/UtilitiesTabController.cpp
+++ b/src/tabcontrollers/UtilitiesTabController.cpp
@@ -12,7 +12,7 @@
// application namespace
namespace advsettings
{
-const char* steamDesktopOverlaykey = "valve.steam.desktop";
+constexpr auto steamDesktopOverlaykey = "valve.steam.desktop";
void UtilitiesTabController::initStage1()
{
@@ -64,8 +64,8 @@ void UtilitiesTabController::initStage1()
void UtilitiesTabController::initStage2( OverlayController* var_parent,
QQuickWindow* var_widget )
{
- this->parent = var_parent;
- this->widget = var_widget;
+ this->m_parent = var_parent;
+ this->m_widget = var_widget;
}
void UtilitiesTabController::sendKeyboardInput( QString input )
@@ -422,8 +422,9 @@ void UtilitiesTabController::eventLoopTick()
vr::VRNotificationId notificationId;
vr::EVRInitError eError;
vr::IVRNotifications* vrnotification
- = ( vr::IVRNotifications* ) vr::VR_GetGenericInterface(
- vr::IVRNotifications_Version, &eError );
+ = static_cast(
+ vr::VR_GetGenericInterface(
+ vr::IVRNotifications_Version, &eError ) );
if ( eError != vr::VRInitError_None )
{
LOG( ERROR )
@@ -467,7 +468,7 @@ void UtilitiesTabController::eventLoopTick()
}
*/
auto nError = vrnotification->CreateNotification(
- parent->overlayHandle(),
+ m_parent->overlayHandle(),
666,
vr::EVRNotificationType_Transient,
alarmMessageBuffer,
@@ -533,7 +534,8 @@ void UtilitiesTabController::eventLoopTick()
i,
vr::ETrackedDeviceProperty::
Prop_DeviceBatteryPercentage_Float );
- int batteryState = ceil( battery * 5 );
+ int batteryState = static_cast(
+ ceil( static_cast( battery * 5 ) ) );
if ( batteryState != m_batteryState[i] )
{
@@ -582,7 +584,7 @@ void UtilitiesTabController::setSteamDesktopOverlayWidth( float width,
bool notify,
bool notifyOpenVr )
{
- if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01 )
+ if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01f )
{
m_steamDesktopOverlayWidth = width;
if ( notifyOpenVr )
diff --git a/src/tabcontrollers/UtilitiesTabController.h b/src/tabcontrollers/UtilitiesTabController.h
index bf41f6b..10dc7ff 100644
--- a/src/tabcontrollers/UtilitiesTabController.h
+++ b/src/tabcontrollers/UtilitiesTabController.h
@@ -33,8 +33,8 @@ class UtilitiesTabController : public QObject
setSteamDesktopOverlayWidth NOTIFY steamDesktopOverlayWidthChanged )
private:
- OverlayController* parent;
- QQuickWindow* widget;
+ OverlayController* m_parent;
+ QQuickWindow* m_widget;
unsigned settingsUpdateCounter = 0;
@@ -53,7 +53,7 @@ private:
public:
void initStage1();
- void initStage2( OverlayController* parent, QQuickWindow* widget );
+ void initStage2( OverlayController* var_parent, QQuickWindow* var_widget );
void eventLoopTick();
diff --git a/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp b/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp
index fc3947f..5e1fa93 100644
--- a/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp
+++ b/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp
@@ -13,7 +13,7 @@ AudioManagerWindows::~AudioManagerWindows()
{
std::lock_guard lock( _mutex );
audioDeviceEnumerator->UnregisterEndpointNotificationCallback(
- ( IMMNotificationClient* ) this );
+ static_cast( this ) );
if ( mirrorAudioEndpointVolume )
{
mirrorAudioEndpointVolume->Release();
@@ -61,7 +61,7 @@ void AudioManagerWindows::init( AudioTabController* var_controller )
}
this->controller = var_controller;
audioDeviceEnumerator->RegisterEndpointNotificationCallback(
- ( IMMNotificationClient* ) this );
+ static_cast( this ) );
policyConfig = getPolicyConfig();
if ( !policyConfig )
{
@@ -370,10 +370,10 @@ IMMDeviceEnumerator* AudioManagerWindows::getAudioDeviceEnumerator()
{
IMMDeviceEnumerator* pEnumerator;
if ( CoCreateInstance( __uuidof( MMDeviceEnumerator ),
- NULL,
+ nullptr,
CLSCTX_ALL,
__uuidof( IMMDeviceEnumerator ),
- ( void** ) &pEnumerator )
+ reinterpret_cast( &pEnumerator ) )
< 0 )
{
return nullptr;
@@ -385,27 +385,28 @@ IPolicyConfig* AudioManagerWindows::getPolicyConfig()
{
IPolicyConfig* var_policyConfig = nullptr;
// for Win 10
- auto hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
- NULL,
- CLSCTX_INPROC,
- IID_IPolicyConfig2,
- ( LPVOID* ) &var_policyConfig );
+ auto hr
+ = CoCreateInstance( __uuidof( CPolicyConfigClient ),
+ nullptr,
+ CLSCTX_INPROC,
+ IID_IPolicyConfig2,
+ reinterpret_cast( &var_policyConfig ) );
if ( hr != S_OK )
{
hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
- NULL,
+ nullptr,
CLSCTX_INPROC,
IID_IPolicyConfig1,
- ( LPVOID* ) &var_policyConfig );
+ reinterpret_cast( &var_policyConfig ) );
}
// for Win Vista, 7, 8, 8.1
if ( hr != S_OK )
{
hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
- NULL,
+ nullptr,
CLSCTX_INPROC,
IID_IPolicyConfig0,
- ( LPVOID* ) &var_policyConfig );
+ reinterpret_cast( &var_policyConfig ) );
}
if ( hr != S_OK )
{
@@ -470,8 +471,8 @@ IAudioEndpointVolume*
IAudioEndpointVolume* pEndpointVolume;
if ( device->Activate( __uuidof( IAudioEndpointVolume ),
CLSCTX_INPROC_SERVER,
- NULL,
- ( void** ) &pEndpointVolume )
+ nullptr,
+ reinterpret_cast( &pEndpointVolume ) )
< 0 )
{
return nullptr;
@@ -536,16 +537,16 @@ HRESULT AudioManagerWindows::QueryInterface( REFIID riid, void** ppvObject )
if ( IID_IUnknown == riid )
{
AddRef();
- *ppvObject = ( IUnknown* ) this;
+ *ppvObject = static_cast( this );
}
else if ( __uuidof( IMMNotificationClient ) == riid )
{
AddRef();
- *ppvObject = ( IMMNotificationClient* ) this;
+ *ppvObject = static_cast( this );
}
else
{
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
return S_OK;
diff --git a/src/tabcontrollers/audiomanager/AudioManagerWindows.h b/src/tabcontrollers/audiomanager/AudioManagerWindows.h
index 7651b05..105da6f 100644
--- a/src/tabcontrollers/audiomanager/AudioManagerWindows.h
+++ b/src/tabcontrollers/audiomanager/AudioManagerWindows.h
@@ -5,7 +5,7 @@
#include
#include
#include
-#include "IPolicyConfig.h"
+#include
#include
// application namespace
diff --git a/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp b/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
index 4dd2585..b43d91e 100644
--- a/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
+++ b/src/tabcontrollers/keyboardinput/KeyboardInputWindows.cpp
@@ -33,7 +33,7 @@ void fillKiStruct( INPUT& ip, WORD scanCode, bool keyup )
ip.ki.wScan = 0;
ip.ki.dwExtraInfo = 0;
ip.ki.time = 0;
-};
+}
/*!
Calls SendInput on an INPUT struct and has associated error handling.
diff --git a/src/utils/ChaperoneUtils.cpp b/src/utils/ChaperoneUtils.cpp
index 1ae5723..3945694 100644
--- a/src/utils/ChaperoneUtils.cpp
+++ b/src/utils/ChaperoneUtils.cpp
@@ -29,10 +29,14 @@ float ChaperoneUtils::_getDistanceToChaperone(
{ // projected point outside of segment
float d_x = r0.v[0] - x.v[0];
float d_z = r0.v[2] - x.v[2];
- float d1 = sqrt( d_x * d_x + d_z * d_z );
+ // Crazy casts because clang sees the sqrt call as wanting a double.
+ float d1 = static_cast(
+ sqrt( static_cast( d_x * d_x + d_z * d_z ) ) );
d_x = r1.v[0] - x.v[0];
d_z = r1.v[2] - x.v[2];
- float d2 = sqrt( d_x * d_x + d_z * d_z );
+ // Crazy casts because clang sees the sqrt call as wanting a double.
+ float d2 = static_cast(
+ sqrt( static_cast( d_x * d_x + d_z * d_z ) ) );
if ( d1 < d2 )
{
d = d1;
@@ -52,7 +56,9 @@ float ChaperoneUtils::_getDistanceToChaperone(
x1_z = r0.v[2] + r * u_z;
float d_x = x1_x - x.v[0];
float d_z = x1_z - x.v[2];
- d = sqrt( d_x * d_x + d_z * d_z );
+ // Crazy casts because clang sees the sqrt call as wanting a double.
+ d = static_cast(
+ sqrt( static_cast( d_x * d_x + d_z * d_z ) ) );
}
if ( std::isnan( distance ) || d < distance )
{
@@ -77,7 +83,8 @@ void ChaperoneUtils::loadChaperoneData()
std::unique_ptr quadsBuffer(
new vr::HmdQuad_t[_quadsCount] );
vr::HmdQuad_t* quadsBufferPtr = quadsBuffer.get();
- _corners.reset( ( vr::HmdVector3_t* ) new vr::HmdQuad_t[_quadsCount] );
+ _corners.reset( reinterpret_cast(
+ new vr::HmdQuad_t[_quadsCount] ) );
vr::HmdVector3_t* _cornersPtr = _corners.get();
vr::VRChaperoneSetup()->GetLiveCollisionBoundsInfo( quadsBufferPtr,
&_quadsCount );
diff --git a/third-party/easylogging++/easylogging++.cc b/third-party/easylogging++/easylogging++.cc
index d763ee7..16ceda2 100644
--- a/third-party/easylogging++/easylogging++.cc
+++ b/third-party/easylogging++/easylogging++.cc
@@ -14,7 +14,7 @@
// http://muflihun.com
//
-#include "easylogging++.h"
+#include
#if defined(AUTO_INITIALIZE_EASYLOGGINGPP)
INITIALIZE_EASYLOGGINGPP
@@ -1190,7 +1190,7 @@ std::string DateTime::timevalToString(struct timeval tval, const char* format,
buildTimeInfo(&tval, &timeInfo);
const int kBuffSize = 30;
char buff_[kBuffSize] = "";
- parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast(tval.tv_usec / ssPrec->m_offset),
+ parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast(static_cast(tval.tv_usec) / ssPrec->m_offset),
ssPrec);
return std::string(buff_);
}
@@ -1199,10 +1199,10 @@ base::type::string_t DateTime::formatTime(unsigned long long time, base::Timesta
base::type::EnumType start = static_cast(timestampUnit);
const base::type::char_t* unit = base::consts::kTimeFormats[start].unit;
for (base::type::EnumType i = start; i < base::consts::kTimeFormatsCount - 1; ++i) {
- if (time <= base::consts::kTimeFormats[i].value) {
+ if (static_cast(time) <= base::consts::kTimeFormats[i].value) {
break;
}
- if (base::consts::kTimeFormats[i].value == 1000.0f && time / 1000.0f < 1.9f) {
+ if (base::consts::kTimeFormats[i].value == 1000.0 && static_cast(time) / 1000.0f < 1.9f) {
break;
}
time /= static_cast(base::consts::kTimeFormats[i].value);
@@ -1264,7 +1264,7 @@ char* DateTime::parseFormat(char* buf, std::size_t bufSz, const char* format, co
--format;
break;
case 'd': // Day
- buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mday, 2, buf, bufLim);
+ buf = base::utils::Str::convertAndAddToBuff(static_cast(tInfo->tm_mday), 2, buf, bufLim);
continue;
case 'a': // Day of week (short)
buf = base::utils::Str::addToBuff(base::consts::kDaysAbbrev[tInfo->tm_wday], buf, bufLim);
@@ -1273,7 +1273,7 @@ char* DateTime::parseFormat(char* buf, std::size_t bufSz, const char* format, co
buf = base::utils::Str::addToBuff(base::consts::kDays[tInfo->tm_wday], buf, bufLim);
continue;
case 'M': // month
- buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mon + 1, 2, buf, bufLim);
+ buf = base::utils::Str::convertAndAddToBuff(static_cast(tInfo->tm_mon + 1), 2, buf, bufLim);
continue;
case 'b': // month (short)
buf = base::utils::Str::addToBuff(base::consts::kMonthsAbbrev[tInfo->tm_mon], buf, bufLim);
@@ -1282,22 +1282,22 @@ char* DateTime::parseFormat(char* buf, std::size_t bufSz, const char* format, co
buf = base::utils::Str::addToBuff(base::consts::kMonths[tInfo->tm_mon], buf, bufLim);
continue;
case 'y': // year (two digits)
- buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_year + base::consts::kYearBase, 2, buf, bufLim);
+ buf = base::utils::Str::convertAndAddToBuff(static_cast(tInfo->tm_year + base::consts::kYearBase), 2, buf, bufLim);
continue;
case 'Y': // year (four digits)
- buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_year + base::consts::kYearBase, 4, buf, bufLim);
+ buf = base::utils::Str::convertAndAddToBuff(static_cast(tInfo->tm_year + base::consts::kYearBase), 4, buf, bufLim);
continue;
case 'h': // hour (12-hour)
buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour % 12, 2, buf, bufLim);
continue;
case 'H': // hour (24-hour)
- buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour, 2, buf, bufLim);
+ buf = base::utils::Str::convertAndAddToBuff(static_cast(tInfo->tm_hour), 2, buf, bufLim);
continue;
case 'm': // minute
- buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_min, 2, buf, bufLim);
+ buf = base::utils::Str::convertAndAddToBuff(static_cast(tInfo->tm_min), 2, buf, bufLim);
continue;
case 's': // second
- buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_sec, 2, buf, bufLim);
+ buf = base::utils::Str::convertAndAddToBuff(static_cast(tInfo->tm_sec), 2, buf, bufLim);
continue;
case 'z': // subsecond part
case 'g':
@@ -1553,7 +1553,7 @@ void LogFormat::updateDateFormat(std::size_t index, base::type::string_t& currFo
}
ss << static_cast(*ptr);
}
- currFormat.erase(index, count);
+ currFormat.erase(index, static_cast(count));
m_dateTimeFormat = ss.str();
} else {
// No format provided, use default
@@ -1737,7 +1737,7 @@ unsigned long TypedConfigurations::getULong(std::string confVal) {
ELPP_ASSERT(valid, "Configuration value not a valid integer [" << confVal << "]");
return 0;
}
- return atol(confVal.c_str());
+ return static_cast(atol(confVal.c_str()));
}
std::string TypedConfigurations::resolveFilename(const std::string& filename) {
@@ -1765,7 +1765,7 @@ std::string TypedConfigurations::resolveFilename(const std::string& filename) {
}
ss << *ptr;
}
- resultingFilename.erase(dateIndex + dateTimeFormatSpecifierStr.size(), count);
+ resultingFilename.erase(dateIndex + dateTimeFormatSpecifierStr.size(), static_cast(count));
fmt = ss.str();
} else {
fmt = std::string(base::consts::kDefaultDateTimeFormatInFilename);
@@ -1789,26 +1789,26 @@ void TypedConfigurations::insertFile(Level level, const std::string& fullFilenam
if (filePath.size() < resolvedFilename.size()) {
base::utils::File::createPath(filePath);
}
- auto create = [&](Level level) {
+ auto create = [&](Level level_var) {
base::LogStreamsReferenceMap::iterator filestreamIter = m_logStreamsReference->find(resolvedFilename);
base::type::fstream_t* fs = nullptr;
if (filestreamIter == m_logStreamsReference->end()) {
// We need a completely new stream, nothing to share with
fs = base::utils::File::newFileStream(resolvedFilename);
- m_filenameMap.insert(std::make_pair(level, resolvedFilename));
- m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(fs)));
- m_logStreamsReference->insert(std::make_pair(resolvedFilename, base::FileStreamPtr(m_fileStreamMap.at(level))));
+ m_filenameMap.insert(std::make_pair(level_var, resolvedFilename));
+ m_fileStreamMap.insert(std::make_pair(level_var, base::FileStreamPtr(fs)));
+ m_logStreamsReference->insert(std::make_pair(resolvedFilename, base::FileStreamPtr(m_fileStreamMap.at(level_var))));
} else {
// Woops! we have an existing one, share it!
- m_filenameMap.insert(std::make_pair(level, filestreamIter->first));
- m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(filestreamIter->second)));
+ m_filenameMap.insert(std::make_pair(level_var, filestreamIter->first));
+ m_fileStreamMap.insert(std::make_pair(level_var, base::FileStreamPtr(filestreamIter->second)));
fs = filestreamIter->second.get();
}
if (fs == nullptr) {
// We display bad file error from newFileStream()
ELPP_INTERNAL_ERROR("Setting [TO_FILE] of ["
- << LevelHelper::convertToString(level) << "] to FALSE", false);
- setValue(level, false, &m_toFileMap);
+ << LevelHelper::convertToString(level_var) << "] to FALSE", false);
+ setValue(level_var, false, &m_toFileMap);
}
};
// If we dont have file conf for any level, create it for Level::Global first
@@ -2219,7 +2219,7 @@ void DefaultLogDispatchCallback::dispatch(base::type::string_t&& logLine) {
base::type::fstream_t* fs = m_data->logMessage()->logger()->m_typedConfigurations->fileStream(
m_data->logMessage()->level());
if (fs != nullptr) {
- fs->write(logLine.c_str(), logLine.size());
+ fs->write(logLine.c_str(), static_cast(logLine.size()));
if (fs->fail()) {
ELPP_INTERNAL_ERROR("Unable to write log to file ["
<< m_data->logMessage()->logger()->m_typedConfigurations->filename(m_data->logMessage()->level()) << "].\n"
@@ -2541,7 +2541,7 @@ Writer& Writer::construct(int count, const char* loggerIds, ...) {
va_list loggersList;
va_start(loggersList, loggerIds);
const char* id = loggerIds;
- m_loggerIds.reserve(count);
+ m_loggerIds.reserve(static_cast(count));
for (int i = 0; i < count; ++i) {
m_loggerIds.push_back(std::string(id));
id = va_arg(loggersList, const char*);
diff --git a/src/tabcontrollers/audiomanager/IPolicyConfig.h b/third-party/policyconfig/IPolicyConfig.h
similarity index 100%
rename from src/tabcontrollers/audiomanager/IPolicyConfig.h
rename to third-party/policyconfig/IPolicyConfig.h