Merge branch 'master' into alpha-kung

This commit is contained in:
Kung-vr
2019-03-03 00:27:35 +09:00
53 changed files with 978 additions and 764 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ image: Visual Studio 2017
environment: environment:
matrix: 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"' 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"' JOM_LOC: '"C:\Qt\Tools\QtCreator\bin\jom.exe"'
NSIS_LOC: '"C:\Program Files (x86)\NSIS\"' NSIS_LOC: '"C:\Program Files (x86)\NSIS\"'
@@ -11,7 +11,7 @@ environment:
PYTHON_LOC: '"C:\Python37\"' PYTHON_LOC: '"C:\Python37\"'
BUILD_PACKAGE: "1" 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"' 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"' JOM_LOC: '"C:\Qt\Tools\QtCreator\bin\jom.exe"'
NSIS_LOC: '"C:\Program Files (x86)\NSIS\"' NSIS_LOC: '"C:\Program Files (x86)\NSIS\"'
+353
View File
@@ -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'
...
+3 -1
View File
@@ -89,7 +89,9 @@
#Qt Specific #Qt Specific
*.qml text *.qml text
*.pri text
*.pro text
#Linux Shell Scripts #Linux Shell Scripts
#Windows Subsystem for Linux will not run CLRF files. #Windows Subsystem for Linux will not run CLRF files.
*.sh text eof=lf *.sh text eol=lf
+9 -3
View File
@@ -12,10 +12,17 @@ matrix:
- g++-7 - g++-7
env: env:
- QMAKE_SPEC=linux-g++ - QMAKE_SPEC=linux-g++
compiler: gcc
- os: linux - os: linux
env: env:
- QMAKE_SPEC=linux-clang - QMAKE_SPEC=linux-clang
compiler: clang
- os: linux
env:
- USE_TIDY=TRUE
compiler: clang
before_install: before_install:
- python ./build_scripts/run-clang-format.py ./src -r --color always - 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 add-apt-repository ppa:kubuntu-ppa/backports -y
- sudo apt-get update -qq - 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 build-essential qtbase5-dev qttools5-dev qtdeclarative5-dev qtmultimedia5-dev qt5-default qttools5-dev-tools
- sudo apt-get install bear clang-tidy
script: script:
- mkdir build && cd build - ./build_scripts/linux/build_linux.sh
- qmake .. -spec $QMAKE_SPEC
- make
+4 -10
View File
@@ -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 - **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 - **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. - **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.
<a name="steamvr_page"></a> <a name="steamvr_page"></a>
## - SteamVR Page: ## - 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. - **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. - **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. - **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. - **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.
- **Left Controller**: Configure the left controller for push-to-talk. - **Show Notification**: Shows a notification icon in the headset when the Push To Talk action is activated.
- **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-Mute**: Inverse push-to-talk. The Microphone is unmuted by default and muted when any of the configured buttons is pressed. - **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. - **Audio Profile**: Allows you to apply/define/delete audio profiles that save playback devices, mute state, and volume.
<a name="revive_page"></a> <a name="revive_page"></a>
@@ -294,10 +291,7 @@ Full build instructions can be found [here](docs/building_for_windows.md).
<a name="building_on_linux"></a> <a name="building_on_linux"></a>
## Building on Linux ## 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 Full build instructions can be found [here](docs/building_for_linux.md).
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.
<a name="notes"></a> <a name="notes"></a>
# Notes: # Notes:
+19 -139
View File
@@ -1,9 +1,3 @@
#-------------------------------------------------
#
# Project created by QtCreator 2015-06-10T16:57:45
#
#-------------------------------------------------
QT += core gui qml quick multimedia widgets QT += core gui qml quick multimedia widgets
CONFIG += c++1z CONFIG += c++1z
@@ -15,140 +9,26 @@ lessThan(QT_MINOR_VERSION, 6): error("requires Qt 5.6 or higher")
TARGET = AdvancedSettings TARGET = AdvancedSettings
TEMPLATE = app 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 <Windows.h>
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 win32:DESTDIR = bin/win64/AdvancedSettings
unix:DESTDIR = bin/linux/AdvancedSettings unix:DESTDIR = bin/linux/AdvancedSettings
DISTFILES += \ include_dir = $$PWD/build_scripts/qt/
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/* \
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)
+26
View File
@@ -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
+1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
clang-format --version clang-format --version
+15
View File
@@ -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
+1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
clang-format --version; clang-format --version;
@@ -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
+18
View File
@@ -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.
+14
View File
@@ -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
@@ -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 <Windows.h>
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
+16
View File
@@ -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
+10
View File
@@ -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-
+36
View File
@@ -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/* \
+69
View File
@@ -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
+43
View File
@@ -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).
+1 -1
View File
@@ -14,7 +14,7 @@
For compiling: For compiling:
1. [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/) (tested on 2017 Community) 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) 3. [Python 3](https://www.python.org/downloads/) (must be in `PATH` environment variable)
For pushing changes to the repo: For pushing changes to the repo:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 58 KiB

+1 -1
View File
@@ -114,7 +114,7 @@ Section "Install" SecInstall
;Any action manifests ;Any action manifests
File "${BASEDIR}\*.json" File "${BASEDIR}\*.json"
;And their defaults ;And their defaults
File "${BASEDIR}\default_action_manifests\*.json" File /r "${BASEDIR}\default_action_manifests"
File "${THIRDDIR}\openvr\bin\win64\*.dll" File "${THIRDDIR}\openvr\bin\win64\*.dll"
File "${BASEDIR}\*.dll" File "${BASEDIR}\*.dll"
+7 -1
View File
@@ -165,7 +165,8 @@ SteamIVRInput::SteamIVRInput()
m_snapTurnLeft( input_strings::k_actionSnapTurnLeft, m_snapTurnLeft( input_strings::k_actionSnapTurnLeft,
ActionType::Digital ), ActionType::Digital ),
m_snapTurnRight( input_strings::k_actionSnapTurnRight, 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.ulActionSet = m_mainSet.handle();
m_activeActionSet.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle; m_activeActionSet.ulRestrictedToDevice = vr::k_ulInvalidInputValueHandle;
@@ -295,6 +296,11 @@ bool SteamIVRInput::snapTurnRight()
return isDigitalActionActivatedOnce( m_snapTurnRight ); return isDigitalActionActivatedOnce( m_snapTurnRight );
} }
bool SteamIVRInput::pushToTalk()
{
return isDigitalActionActivatedConstant( m_pushToTalk );
}
/*! /*!
Updates the active action set(s). Updates the active action set(s).
Should be called every frame, or however often you want the input system to Should be called every frame, or however often you want the input system to
+8
View File
@@ -36,6 +36,7 @@ public:
SteamIVRInput(); SteamIVRInput();
void UpdateStates(); void UpdateStates();
bool nextSong(); bool nextSong();
bool previousSong(); bool previousSong();
bool pausePlaySong(); bool pausePlaySong();
@@ -56,6 +57,8 @@ public:
bool snapTurnLeft(); bool snapTurnLeft();
bool snapTurnRight(); bool snapTurnRight();
bool pushToTalk();
// Destructor. There are no terminating calls for the IVRInput API, so it // Destructor. There are no terminating calls for the IVRInput API, so it
// is left blank. // is left blank.
~SteamIVRInput() {} ~SteamIVRInput() {}
@@ -101,6 +104,9 @@ private:
Action m_resetOffsets; Action m_resetOffsets;
Action m_snapTurnLeft; Action m_snapTurnLeft;
Action m_snapTurnRight; 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_actionSnapTurnLeft = "/actions/main/in/SnapTurnLeft";
constexpr auto k_actionSnapTurnRight = "/actions/main/in/SnapTurnRight"; constexpr auto k_actionSnapTurnRight = "/actions/main/in/SnapTurnRight";
constexpr auto k_actionPushToTalk = "/actions/main/in/PushToTalk";
constexpr auto k_setMain = "/actions/main"; constexpr auto k_setMain = "/actions/main";
} // namespace input_strings } // namespace input_strings
+67 -25
View File
@@ -351,17 +351,23 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
QOpenGLFramebufferObject::CombinedDepthStencil ); QOpenGLFramebufferObject::CombinedDepthStencil );
fboFormat.setTextureTarget( GL_TEXTURE_2D ); fboFormat.setTextureTarget( GL_TEXTURE_2D );
m_pFbo.reset( new QOpenGLFramebufferObject( m_pFbo.reset( new QOpenGLFramebufferObject(
quickItem->width(), quickItem->height(), fboFormat ) ); static_cast<int>( quickItem->width() ),
static_cast<int>( quickItem->height() ),
fboFormat ) );
m_pRenderControl.reset( new QQuickRenderControl() ); m_pRenderControl.reset( new QQuickRenderControl() );
m_pWindow.reset( new QQuickWindow( m_pRenderControl.get() ) ); m_pWindow.reset( new QQuickWindow( m_pRenderControl.get() ) );
m_pWindow->setRenderTarget( m_pFbo.get() ); m_pWindow->setRenderTarget( m_pFbo.get() );
quickItem->setParentItem( m_pWindow->contentItem() ); quickItem->setParentItem( m_pWindow->contentItem() );
m_pWindow->setGeometry( 0, 0, quickItem->width(), quickItem->height() ); m_pWindow->setGeometry( 0,
0,
static_cast<int>( quickItem->width() ),
static_cast<int>( quickItem->height() ) );
m_pRenderControl->initialize( m_pOpenGLContext.get() ); m_pRenderControl->initialize( m_pOpenGLContext.get() );
vr::HmdVector2_t vecWindowSize vr::HmdVector2_t vecWindowSize
= { ( float ) quickItem->width(), ( float ) quickItem->height() }; = { static_cast<float>( quickItem->width() ),
static_cast<float>( quickItem->height() ) };
vr::VROverlay()->SetOverlayMouseScale( m_ulOverlayHandle, vr::VROverlay()->SetOverlayMouseScale( m_ulOverlayHandle,
&vecWindowSize ); &vecWindowSize );
@@ -425,11 +431,12 @@ void OverlayController::renderOverlay()
#if defined _WIN64 || defined _LP64 #if defined _WIN64 || defined _LP64
// To avoid any compiler warning because of cast to a larger pointer // To avoid any compiler warning because of cast to a larger pointer
// type (warning C4312 on VC) // type (warning C4312 on VC)
vr::Texture_t texture = { ( void* ) ( ( uint64_t ) unTexture ), vr::Texture_t texture = { reinterpret_cast<void*>(
static_cast<uint64_t>( unTexture ) ),
vr::TextureType_OpenGL, vr::TextureType_OpenGL,
vr::ColorSpace_Auto }; vr::ColorSpace_Auto };
#else #else
vr::Texture_t texture = { ( void* ) unTexture, vr::Texture_t texture = { reinterpret_cast<void*>( unTexture ),
vr::TextureType_OpenGL, vr::TextureType_OpenGL,
vr::ColorSpace_Auto }; vr::ColorSpace_Auto };
#endif #endif
@@ -458,20 +465,13 @@ QPoint OverlayController::getMousePositionForEvent( vr::VREvent_Mouse_t mouse )
{ {
float y = mouse.y; float y = mouse.y;
#ifdef __linux__ #ifdef __linux__
float h = ( float ) m_pWindow->height(); float h = static_cast<float>( m_pWindow->height() );
y = h - y; y = h - y;
#endif #endif
return QPoint( mouse.x, y ); return QPoint( static_cast<int>( mouse.x ), static_cast<int>( y ) );
} }
/*! void OverlayController::processMediaKeyBindings()
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()
{ {
if ( m_actions.nextSong() ) if ( m_actions.nextSong() )
{ {
@@ -489,6 +489,10 @@ void OverlayController::processInputBindings()
{ {
m_utilitiesTabController.sendMediaStopSong(); m_utilitiesTabController.sendMediaStopSong();
} }
}
void OverlayController::processRoomBindings()
{
// Execution order for moveCenterTabController actions is important. Don't // Execution order for moveCenterTabController actions is important. Don't
// reorder these. Override actions must always come after normal because // reorder these. Override actions must always come after normal because
// active priority is set based on which action is "newest" // active priority is set based on which action is "newest"
@@ -522,6 +526,39 @@ void OverlayController::processInputBindings()
m_actions.swapSpaceDragToRightHandOverride() ); 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: // vsync implementation:
// (this function triggers every 1ms) // (this function triggers every 1ms)
void OverlayController::OnTimeoutPumpEvents() void OverlayController::OnTimeoutPumpEvents()
@@ -578,7 +615,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ), m_pWindow->mapToGlobal( ptNewMouse ),
Qt::NoButton, Qt::NoButton,
m_lastMouseButtons, m_lastMouseButtons,
0 ); nullptr );
m_ptLastMouse = ptNewMouse; m_ptLastMouse = ptNewMouse;
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent ); QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
OnRenderRequest(); OnRenderRequest();
@@ -599,7 +636,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ), m_pWindow->mapToGlobal( ptNewMouse ),
button, button,
m_lastMouseButtons, m_lastMouseButtons,
0 ); nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent ); QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
} }
break; break;
@@ -617,7 +654,7 @@ void OverlayController::mainEventLoop()
m_pWindow->mapToGlobal( ptNewMouse ), m_pWindow->mapToGlobal( ptNewMouse ),
button, button,
m_lastMouseButtons, m_lastMouseButtons,
0 ); nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent ); QCoreApplication::sendEvent( m_pWindow.get(), &mouseEvent );
} }
break; break;
@@ -629,12 +666,14 @@ void OverlayController::mainEventLoop()
m_ptLastMouse, m_ptLastMouse,
m_pWindow->mapToGlobal( m_ptLastMouse ), m_pWindow->mapToGlobal( m_ptLastMouse ),
QPoint(), QPoint(),
QPoint( vrEvent.data.scroll.xdelta * 360.0f * 8.0f, QPoint( static_cast<int>( vrEvent.data.scroll.xdelta
vrEvent.data.scroll.ydelta * 360.0f * 8.0f ), * ( 360.0f * 8.0f ) ),
static_cast<int>( vrEvent.data.scroll.ydelta
* ( 360.0f * 8.0f ) ) ),
0, 0,
Qt::Vertical, Qt::Vertical,
m_lastMouseButtons, m_lastMouseButtons,
0 ); nullptr );
QCoreApplication::sendEvent( m_pWindow.get(), &wheelEvent ); QCoreApplication::sendEvent( m_pWindow.get(), &wheelEvent );
} }
break; break;
@@ -654,9 +693,11 @@ void OverlayController::mainEventLoop()
m_chaperoneTabController.shutdown(); m_chaperoneTabController.shutdown();
Shutdown(); Shutdown();
QApplication::exit(); QApplication::exit();
return;
LOG( INFO ) << "All systems exited.";
exit( EXIT_SUCCESS );
// Does not fallthrough
} }
break;
case vr::VREvent_DashboardActivated: case vr::VREvent_DashboardActivated:
{ {
@@ -677,7 +718,8 @@ void OverlayController::mainEventLoop()
char keyboardBuffer[1024]; char keyboardBuffer[1024];
vr::VROverlay()->GetKeyboardText( keyboardBuffer, 1024 ); vr::VROverlay()->GetKeyboardText( keyboardBuffer, 1024 );
emit keyBoardInputSignal( QString( keyboardBuffer ), emit keyBoardInputSignal( QString( keyboardBuffer ),
vrEvent.data.keyboard.uUserValue ); static_cast<unsigned long>(
vrEvent.data.keyboard.uUserValue ) );
} }
break; break;
@@ -1065,7 +1107,7 @@ void OverlayController::playAlarm01Sound( bool loop )
void OverlayController::setAlarm01SoundVolume( float vol ) void OverlayController::setAlarm01SoundVolume( float vol )
{ {
m_alarm01SoundEffect.setVolume( vol ); m_alarm01SoundEffect.setVolume( static_cast<double>( vol ) );
} }
void OverlayController::cancelAlarm01Sound() void OverlayController::cancelAlarm01Sound()
+5 -2
View File
@@ -89,7 +89,7 @@ private:
bool m_dashboardVisible = false; bool m_dashboardVisible = false;
QPoint m_ptLastMouse; QPoint m_ptLastMouse;
Qt::MouseButtons m_lastMouseButtons = 0; Qt::MouseButtons m_lastMouseButtons = nullptr;
bool m_desktopMode; bool m_desktopMode;
bool m_noSound; bool m_noSound;
@@ -128,6 +128,9 @@ public: // I know it's an ugly hack to make them public to enable external
private: private:
QPoint getMousePositionForEvent( vr::VREvent_Mouse_t mouse ); QPoint getMousePositionForEvent( vr::VREvent_Mouse_t mouse );
void processInputBindings(); void processInputBindings();
void processMediaKeyBindings();
void processRoomBindings();
void processPushToTalkBindings();
public: public:
OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine ); OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine );
@@ -167,7 +170,7 @@ public:
bool isDesktopMode() bool isDesktopMode()
{ {
return m_desktopMode; return m_desktopMode;
}; }
utils::ChaperoneUtils& chaperoneUtils() noexcept utils::ChaperoneUtils& chaperoneUtils() noexcept
{ {
+8 -1
View File
@@ -100,6 +100,11 @@
"name": "/actions/main/in/SnapTurnRight", "name": "/actions/main/in/SnapTurnRight",
"requirement": "optional", "requirement": "optional",
"type": "boolean" "type": "boolean"
},
{
"name": "/actions/main/in/PushToTalk",
"requirement": "optional",
"type": "boolean"
} }
], ],
"action_sets": [ "action_sets": [
@@ -132,7 +137,9 @@
"/actions/main/in/HeightToggle" : "Height Toggle", "/actions/main/in/HeightToggle" : "Height Toggle",
"/actions/main/in/ResetOffsets" : "Reset Offsets", "/actions/main/in/ResetOffsets" : "Reset Offsets",
"/actions/main/in/SnapTurnLeft" : "Snap-Turn Left", "/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"
} }
] ]
} }
-47
View File
@@ -362,39 +362,6 @@ MyStackViewPage {
AudioTabController.pttEnabled = checked 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 { Item {
@@ -417,7 +384,6 @@ MyStackViewPage {
Component.onCompleted: { Component.onCompleted: {
reloadChaperoneProfiles() reloadChaperoneProfiles()
reloadSteamVRProfiles() reloadSteamVRProfiles()
reloadPttProfiles()
summaryVersionText.text = applicationVersion summaryVersionText.text = applicationVersion
@@ -454,9 +420,6 @@ MyStackViewPage {
Connections { Connections {
target: AudioTabController target: AudioTabController
onPttProfilesUpdated: {
reloadPttProfiles()
}
onMicVolumeChanged: { onMicVolumeChanged: {
summaryMicVolumeSlider.value = AudioTabController.micVolume summaryMicVolumeSlider.value = AudioTabController.micVolume
} }
@@ -540,14 +503,4 @@ MyStackViewPage {
summarySteamVRProfileComboBox.currentIndex = 0 summarySteamVRProfileComboBox.currentIndex = 0
summarySteamVRProfileComboBox.model = profiles 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
}
} }
@@ -45,7 +45,7 @@ RowLayout {
setShownAudioDevice(index) setShownAudioDevice(index)
} }
onPlaybackDeviceListChanged: { onPlaybackDeviceListChanged: {
audioPlaybackNameCombo.devices = getAudioDeviceList() audioMirrorNameCombo.devices = getAudioDeviceList()
setShownAudioDevice(AudioTabController.playbackDeviceIndex) setShownAudioDevice(AudioTabController.playbackDeviceIndex)
} }
} }
@@ -10,18 +10,10 @@ ColumnLayout {
id: audioMessageDialog id: audioMessageDialog
} }
PttDeleteProfileDialog {
id: pttDeleteProfileDialog
}
AudioDeleteProfileDialog { AudioDeleteProfileDialog {
id: audioDeleteProfileDialog id: audioDeleteProfileDialog
} }
PttNewProfileDialog {
id: pttNewProfileDialog
}
AudioNewProfileDialog { AudioNewProfileDialog {
id: audioNewProfileDialog id: audioNewProfileDialog
} }
@@ -61,38 +53,9 @@ ColumnLayout {
} }
} }
} }
MyText { MyText {
text: "PTT Profile:" // Text continues in next RowLayout.
Layout.preferredWidth: 150 text: "Change the Push To Talk settings"
}
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)
}
}
} }
} }
RowLayout { RowLayout {
@@ -117,62 +80,27 @@ ColumnLayout {
audioNewProfileDialog.openPopup() audioNewProfileDialog.openPopup()
} }
} }
Item { MyText {
Layout.fillWidth: true // Text continues from RowLayout above.
} text: "\t\tin the SteamVR bindings menu."
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()
}
} }
} }
Component.onCompleted: { Component.onCompleted: {
reloadPttProfiles()
reloadAudioProfiles() reloadAudioProfiles()
} }
Connections { Connections {
target: AudioTabController target: AudioTabController
onPttProfilesUpdated: {
reloadPttProfiles()
}
onAudioProfilesUpdated: { onAudioProfilesUpdated: {
reloadAudioProfiles() reloadAudioProfiles()
} }
onAudioProfileAdded: { onAudioProfileAdded: {
audioProfileComboBox.currentIndex = AudioTabController.getAudioProfileCount() audioProfileComboBox.currentIndex = AudioTabController.getAudioProfileCount()
} }
onPttProfileAdded: {
pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
}
onDefaultProfileDisplay: { onDefaultProfileDisplay: {
audioProfileComboBox.currentIndex = AudioTabController.getDefaultAudioProfileIndex( audioProfileComboBox.currentIndex = AudioTabController.getDefaultAudioProfileIndex(
) + 1 ) + 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() { function reloadAudioProfiles() {
var profiles = [""] var profiles = [""]
var profileCount = AudioTabController.getAudioProfileCount() var profileCount = AudioTabController.getAudioProfileCount()
@@ -6,54 +6,17 @@ import "../../common"
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
PttControllerConfigDialog {
id: pttControllerConfigDialog
pttControllerConfigClass: AudioTabController
}
MyToggleButton { MyToggleButton {
id: audioPttEnabledToggle id: audioPttEnabledToggle
Layout.preferredWidth: 260 Layout.fillWidth: true
text: "Push-to-Talk:" text: "Push-to-Talk:"
onClicked: { onClicked: {
AudioTabController.pttEnabled = checked 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 { MyToggleButton {
id: audioPttShowNotificationToggle id: audioPttShowNotificationToggle
Layout.leftMargin: 350 Layout.fillWidth: true
text: "Show notification in HMD" text: "Show notification in HMD"
onCheckedChanged: { onCheckedChanged: {
AudioTabController.setPttShowNotification(checked, false) AudioTabController.setPttShowNotification(checked, false)
@@ -61,7 +24,7 @@ ColumnLayout {
} }
MyToggleButton { MyToggleButton {
id: audioPttReverseToggle id: audioPttReverseToggle
Layout.leftMargin: 118 Layout.fillWidth: true
text: "Push-to-Mute" text: "Push-to-Mute"
onClicked: { onClicked: {
AudioTabController.setMicReversePtt(checked, false) AudioTabController.setMicReversePtt(checked, false)
@@ -71,8 +34,6 @@ ColumnLayout {
Component.onCompleted: { Component.onCompleted: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled audioPttEnabledToggle.checked = AudioTabController.pttEnabled
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification audioPttShowNotificationToggle.checked = AudioTabController.pttShowNotification
audioPttReverseToggle.checked = AudioTabController.micReversePtt audioPttReverseToggle.checked = AudioTabController.micReversePtt
} }
@@ -81,12 +42,6 @@ ColumnLayout {
onPttEnabledChanged: { onPttEnabledChanged: {
audioPttEnabledToggle.checked = AudioTabController.pttEnabled audioPttEnabledToggle.checked = AudioTabController.pttEnabled
} }
onPttLeftControllerEnabledChanged: {
audioPttLeftControllerToggle.checked = AudioTabController.pttLeftControllerEnabled
}
onPttRightControllerEnabledChanged: {
audioPttRightControllerToggle.checked = AudioTabController.pttRightControllerEnabled
}
onMicReversePttChanged: { onMicReversePttChanged: {
audioPttReverseToggle.checked = AudioTabController.micReversePtt audioPttReverseToggle.checked = AudioTabController.micReversePtt
} }
@@ -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()
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ class AudioTabController;
class AudioManager class AudioManager
{ {
public: public:
virtual ~AudioManager(){}; virtual ~AudioManager() {}
virtual void init( AudioTabController* controller ) = 0; virtual void init( AudioTabController* controller ) = 0;
+2 -2
View File
@@ -750,7 +750,7 @@ void AudioTabController::reloadAudioProfiles()
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( i );
audioProfiles.emplace_back(); audioProfiles.emplace_back();
auto& entry = audioProfiles[i]; auto& entry = audioProfiles[static_cast<size_t>( i )];
entry.profileName entry.profileName
= settings->value( "profileName" ).toString().toStdString(); = settings->value( "profileName" ).toString().toStdString();
entry.playbackName entry.playbackName
@@ -1044,7 +1044,7 @@ void AudioTabController::applyDefaultProfile()
if ( profile.defaultProfile ) if ( profile.defaultProfile )
{ {
applyAudioProfile( i ); applyAudioProfile( i );
m_defaultProfileIndex = i; m_defaultProfileIndex = static_cast<int>( i );
break; break;
} }
} }
+3 -1
View File
@@ -87,7 +87,7 @@ private:
void onPttStop() override; void onPttStop() override;
void onPttEnabled() override; void onPttEnabled() override;
void onPttDisabled() override; void onPttDisabled() override;
bool pttChangeValid() override;
virtual vr::VROverlayHandle_t getNotificationOverlayHandle() override virtual vr::VROverlayHandle_t getNotificationOverlayHandle() override
{ {
return m_ulNotificationOverlayHandle; return m_ulNotificationOverlayHandle;
@@ -114,6 +114,8 @@ public:
void eventLoopTick(); void eventLoopTick();
bool pttChangeValid() override;
int playbackDeviceIndex() const; int playbackDeviceIndex() const;
int mirrorDeviceIndex() const; int mirrorDeviceIndex() const;
+11 -10
View File
@@ -70,7 +70,7 @@ void ChaperoneTabController::reloadChaperoneProfiles()
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( i );
chaperoneProfiles.emplace_back(); chaperoneProfiles.emplace_back();
auto& entry = chaperoneProfiles[i]; auto& entry = chaperoneProfiles[static_cast<size_t>( i )];
entry.profileName entry.profileName
= settings->value( "profileName" ).toString().toStdString(); = settings->value( "profileName" ).toString().toStdString();
entry.includesChaperoneGeometry entry.includesChaperoneGeometry
@@ -229,7 +229,7 @@ void ChaperoneTabController::saveChaperoneProfiles()
unsigned i = 0; unsigned i = 0;
for ( auto& p : chaperoneProfiles ) for ( auto& p : chaperoneProfiles )
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName", settings->setValue( "profileName",
QString::fromStdString( p.profileName ) ); QString::fromStdString( p.profileName ) );
settings->setValue( "includesChaperoneGeometry", settings->setValue( "includesChaperoneGeometry",
@@ -564,7 +564,7 @@ void ChaperoneTabController::eventLoopTick(
{ {
float mod = m_chaperoneVelocityModifier float mod = m_chaperoneVelocityModifier
* std::max( { leftSpeed, rightSpeed, hmdSpeed } ); * std::max( { leftSpeed, rightSpeed, hmdSpeed } );
if ( mod > 0.02 ) if ( mod > 0.02f )
{ {
m_chaperoneVelocityModifierCurrent += mod; m_chaperoneVelocityModifierCurrent += mod;
} }
@@ -654,10 +654,10 @@ void ChaperoneTabController::eventLoopTick(
if ( parent->isDashboardVisible() ) if ( parent->isDashboardVisible() )
{ {
vr::EVRSettingsError vrSettingsError; vr::EVRSettingsError vrSettingsError;
float vis = vr::VRSettings()->GetInt32( float vis = static_cast<float>( vr::VRSettings()->GetInt32(
vr::k_pch_CollisionBounds_Section, vr::k_pch_CollisionBounds_Section,
vr::k_pch_CollisionBounds_ColorGammaA_Int32, vr::k_pch_CollisionBounds_ColorGammaA_Int32,
&vrSettingsError ); &vrSettingsError ) );
if ( vrSettingsError != vr::VRSettingsError_None ) if ( vrSettingsError != vr::VRSettingsError_None )
{ {
LOG( WARNING ) LOG( WARNING )
@@ -733,9 +733,10 @@ void ChaperoneTabController::setBoundsVisibility( float value, bool notify )
if ( m_visibility != value ) if ( m_visibility != value )
{ {
m_visibility = value; m_visibility = value;
vr::VRSettings()->SetInt32( vr::k_pch_CollisionBounds_Section, vr::VRSettings()->SetInt32(
vr::k_pch_CollisionBounds_ColorGammaA_Int32, vr::k_pch_CollisionBounds_Section,
255 * m_visibility ); vr::k_pch_CollisionBounds_ColorGammaA_Int32,
static_cast<int32_t>( 255 * m_visibility ) );
vr::VRSettings()->Sync(); vr::VRSettings()->Sync();
if ( notify ) if ( notify )
{ {
@@ -928,7 +929,7 @@ float ChaperoneTabController::chaperoneVelocityModifier() const
Q_INVOKABLE unsigned ChaperoneTabController::getChaperoneProfileCount() Q_INVOKABLE unsigned ChaperoneTabController::getChaperoneProfileCount()
{ {
return ( unsigned ) chaperoneProfiles.size(); return static_cast<unsigned int>( chaperoneProfiles.size() );
} }
Q_INVOKABLE QString Q_INVOKABLE QString
@@ -1244,7 +1245,7 @@ void ChaperoneTabController::flipOrientation()
{ {
parent->m_moveCenterTabController.reset(); parent->m_moveCenterTabController.reset();
parent->RotateUniverseCenter( vr::TrackingUniverseStanding, parent->RotateUniverseCenter( vr::TrackingUniverseStanding,
( float ) M_PI ); static_cast<float>( M_PI ) );
} }
void ChaperoneTabController::reloadFromDisk() void ChaperoneTabController::reloadFromDisk()
+15 -12
View File
@@ -86,9 +86,9 @@ void FixFloorTabController::eventLoopTick(
auto& m = devicePoses[referenceController] auto& m = devicePoses[referenceController]
.mDeviceToAbsoluteTracking.m; .mDeviceToAbsoluteTracking.m;
tempOffsetX = ( double ) m[0][3]; tempOffsetX = static_cast<double>( m[0][3] );
tempOffsetY = ( double ) m[1][3]; tempOffsetY = static_cast<double>( m[1][3] );
tempOffsetZ = ( double ) m[2][3]; tempOffsetZ = static_cast<double>( m[2][3] );
/* /*
| Intrinsic y-x'-z" rotation matrix: | Intrinsic y-x'-z" rotation matrix:
| cr*cy+sp*sr*sy | cr*sp*sy-cy*sr | cp*sy | | 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] pitch = -asin(-sp) [pi/2, -pi/2]
roll = atan2(cp*sr, cp*cr) [pi, -pi], CW 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<double>( m[1][0] ),
static_cast<double>( m[1][1] ) );
measurementCount = 1; measurementCount = 1;
} }
} }
@@ -109,9 +110,9 @@ void FixFloorTabController::eventLoopTick(
auto& m auto& m
= devicePoses[referenceController].mDeviceToAbsoluteTracking.m; = devicePoses[referenceController].mDeviceToAbsoluteTracking.m;
double rollDiff double rollDiff = std::atan2( static_cast<double>( m[1][0] ),
= std::atan2( ( double ) m[1][0], ( double ) m[1][1] ) static_cast<double>( m[1][1] ) )
- tempRoll; - tempRoll;
if ( rollDiff > M_PI ) if ( rollDiff > M_PI )
{ {
rollDiff -= 2.0 * M_PI; rollDiff -= 2.0 * M_PI;
@@ -120,7 +121,7 @@ void FixFloorTabController::eventLoopTick(
{ {
rollDiff += 2.0 * M_PI; rollDiff += 2.0 * M_PI;
} }
tempRoll += rollDiff / ( double ) measurementCount; tempRoll += rollDiff / static_cast<double>( measurementCount );
if ( tempRoll > M_PI ) if ( tempRoll > M_PI )
{ {
tempRoll -= 2.0 * M_PI; tempRoll -= 2.0 * M_PI;
@@ -134,15 +135,17 @@ void FixFloorTabController::eventLoopTick(
{ {
if ( std::abs( tempRoll ) <= M_PI_2 ) if ( std::abs( tempRoll ) <= M_PI_2 )
{ {
floorOffsetY = tempOffsetY - controllerUpOffsetCorrection; floorOffsetY = static_cast<float>( tempOffsetY )
- controllerUpOffsetCorrection;
} }
else else
{ {
floorOffsetY = tempOffsetY - controllerDownOffsetCorrection; floorOffsetY = static_cast<float>( tempOffsetY )
- controllerDownOffsetCorrection;
} }
floorOffsetX = tempOffsetX; floorOffsetX = static_cast<float>( tempOffsetX );
floorOffsetZ = tempOffsetZ; floorOffsetZ = static_cast<float>( tempOffsetZ );
LOG( INFO ) LOG( INFO )
<< "Fix Floor and adjust space center: Floor Offset = [" << "Fix Floor and adjust space center: Floor Offset = ["
+1 -1
View File
@@ -11,7 +11,7 @@ class AudioTabController;
class KeyboardInput class KeyboardInput
{ {
public: public:
virtual ~KeyboardInput(){}; virtual ~KeyboardInput() {}
virtual void sendKeyboardInput( QString input ) = 0; virtual void sendKeyboardInput( QString input ) = 0;
virtual void sendKeyboardEnter() = 0; virtual void sendKeyboardEnter() = 0;
+1 -1
View File
@@ -60,7 +60,7 @@ private:
OverlayController* parent; OverlayController* parent;
QQuickWindow* widget; QQuickWindow* widget;
int m_trackingUniverse = ( int ) vr::TrackingUniverseStanding; int m_trackingUniverse = static_cast<int>( vr::TrackingUniverseStanding );
float m_offsetX = 0.0f; float m_offsetX = 0.0f;
float m_offsetY = 0.0f; float m_offsetY = 0.0f;
float m_offsetZ = 0.0f; float m_offsetZ = 0.0f;
+17 -121
View File
@@ -43,7 +43,8 @@ void PttController::setPttControllerConfig( unsigned controller,
uint64_t buttonMask = 0; uint64_t buttonMask = 0;
for ( auto b : buttons ) for ( auto b : buttons )
{ {
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() ); buttonMask |= vr::ButtonMaskFromId(
( static_cast<vr::EVRButtonId>( b.toInt() ) ) );
} }
m_pttControllerConfigs[controller].digitalButtons = buttons; m_pttControllerConfigs[controller].digitalButtons = buttons;
m_pttControllerConfigs[controller].digitalButtonMask = buttonMask; m_pttControllerConfigs[controller].digitalButtonMask = buttonMask;
@@ -64,7 +65,7 @@ void PttController::reloadPttProfiles()
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( i );
pttProfiles.emplace_back(); pttProfiles.emplace_back();
auto& entry = pttProfiles[i]; auto& entry = pttProfiles[static_cast<size_t>( i )];
entry.profileName entry.profileName
= settings->value( "profileName" ).toString().toStdString(); = settings->value( "profileName" ).toString().toStdString();
entry.showNotification entry.showNotification
@@ -78,7 +79,8 @@ void PttController::reloadPttProfiles()
uint64_t buttonMask = 0; uint64_t buttonMask = 0;
for ( auto b : entry.controllerConfigs[0].digitalButtons ) for ( auto b : entry.controllerConfigs[0].digitalButtons )
{ {
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() ); buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
} }
entry.controllerConfigs[0].digitalButtonMask = buttonMask; entry.controllerConfigs[0].digitalButtonMask = buttonMask;
entry.controllerConfigs[0].triggerMode entry.controllerConfigs[0].triggerMode
@@ -92,7 +94,8 @@ void PttController::reloadPttProfiles()
buttonMask = 0; buttonMask = 0;
for ( auto b : entry.controllerConfigs[1].digitalButtons ) for ( auto b : entry.controllerConfigs[1].digitalButtons )
{ {
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() ); buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
} }
entry.controllerConfigs[1].digitalButtonMask = buttonMask; entry.controllerConfigs[1].digitalButtonMask = buttonMask;
entry.controllerConfigs[1].triggerMode entry.controllerConfigs[1].triggerMode
@@ -114,7 +117,7 @@ void PttController::savePttProfiles()
unsigned i = 0; unsigned i = 0;
for ( auto& p : pttProfiles ) for ( auto& p : pttProfiles )
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName", settings->setValue( "profileName",
QString::fromStdString( p.profileName ) ); QString::fromStdString( p.profileName ) );
settings->setValue( "showNotification", p.showNotification ); settings->setValue( "showNotification", p.showNotification );
@@ -165,7 +168,8 @@ void PttController::reloadPttConfig()
uint64_t buttonMask = 0; uint64_t buttonMask = 0;
for ( auto b : m_pttControllerConfigs[0].digitalButtons ) for ( auto b : m_pttControllerConfigs[0].digitalButtons )
{ {
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() ); buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
} }
m_pttControllerConfigs[0].digitalButtonMask = buttonMask; m_pttControllerConfigs[0].digitalButtonMask = buttonMask;
m_pttControllerConfigs[0].triggerMode m_pttControllerConfigs[0].triggerMode
@@ -179,7 +183,8 @@ void PttController::reloadPttConfig()
buttonMask = 0; buttonMask = 0;
for ( auto b : m_pttControllerConfigs[0].digitalButtons ) for ( auto b : m_pttControllerConfigs[0].digitalButtons )
{ {
buttonMask |= vr::ButtonMaskFromId( ( vr::EVRButtonId ) b.toInt() ); buttonMask |= vr::ButtonMaskFromId(
static_cast<vr::EVRButtonId>( b.toInt() ) );
} }
m_pttControllerConfigs[1].digitalButtonMask = buttonMask; m_pttControllerConfigs[1].digitalButtonMask = buttonMask;
m_pttControllerConfigs[1].triggerMode m_pttControllerConfigs[1].triggerMode
@@ -222,118 +227,8 @@ void PttController::savePttConfig()
void PttController::checkPttStatus() void PttController::checkPttStatus()
{ {
static auto handleControllerState // PTT Controls are now handled in the overlaycontroller using public
= []( const vr::VRControllerState_t& state, // functions.
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();
}
}
} }
void PttController::startPtt() void PttController::startPtt()
@@ -464,7 +359,8 @@ unsigned long PttController::pttDigitalButtonMask( unsigned controller )
{ {
if ( controller < 2 ) if ( controller < 2 )
{ {
return m_pttControllerConfigs[controller].digitalButtonMask; return static_cast<unsigned long>(
m_pttControllerConfigs[controller].digitalButtonMask );
} }
return 0; return 0;
} }
@@ -498,7 +394,7 @@ unsigned PttController::pttTouchpadArea( unsigned controller )
unsigned PttController::getPttProfileCount() unsigned PttController::getPttProfileCount()
{ {
return ( unsigned ) pttProfiles.size(); return static_cast<unsigned int>( pttProfiles.size() );
} }
QString PttController::getPttProfileName( unsigned index ) QString PttController::getPttProfileName( unsigned index )
+10 -8
View File
@@ -71,14 +71,11 @@ protected:
protected: protected:
void checkPttStatus(); void checkPttStatus();
virtual QString getSettingsName() = 0; virtual QString getSettingsName() = 0;
virtual void onPttStart(){}; virtual void onPttStart() {}
virtual void onPttStop(){}; virtual void onPttStop() {}
virtual void onPttEnabled(){}; virtual void onPttEnabled() {}
virtual void onPttDisabled(){}; virtual void onPttDisabled() {}
virtual bool pttChangeValid()
{
return true;
}
virtual vr::VROverlayHandle_t getNotificationOverlayHandle() virtual vr::VROverlayHandle_t getNotificationOverlayHandle()
{ {
return vr::k_ulOverlayHandleInvalid; return vr::k_ulOverlayHandleInvalid;
@@ -100,6 +97,11 @@ public:
void savePttProfiles(); void savePttProfiles();
void savePttConfig(); void savePttConfig();
virtual bool pttChangeValid()
{
return true;
}
Q_INVOKABLE QVariantList pttDigitalButtons( unsigned controller ); Q_INVOKABLE QVariantList pttDigitalButtons( unsigned controller );
Q_INVOKABLE unsigned long pttDigitalButtonMask( unsigned controller ); Q_INVOKABLE unsigned long pttDigitalButtonMask( unsigned controller );
Q_INVOKABLE unsigned pttTouchpadMode( unsigned controller ); Q_INVOKABLE unsigned pttTouchpadMode( unsigned controller );
+28 -28
View File
@@ -5,25 +5,25 @@
// application namespace // application namespace
namespace advsettings namespace advsettings
{ {
const char* appkey_overlay = "revive.dashboard.overlay"; constexpr auto appkey_overlay = "revive.dashboard.overlay";
const char* section_revive = "revive"; constexpr auto section_revive = "revive";
const char* key_pixelsPerDisplayPixel = "pixelsPerDisplayPixel"; constexpr auto key_pixelsPerDisplayPixel = "pixelsPerDisplayPixel";
const char* key_toggleGrip = "ToggleGrip"; constexpr auto key_toggleGrip = "ToggleGrip";
const char* key_triggerAsGrip = "TriggerAsGrip"; constexpr auto key_triggerAsGrip = "TriggerAsGrip";
const char* key_toggleDelay = "ToggleDelay"; constexpr auto key_toggleDelay = "ToggleDelay";
const char* key_thumbDeadzone = "ThumbDeadzone"; constexpr auto key_thumbDeadzone = "ThumbDeadzone";
const char* key_thumbSensitivity = "ThumbSensitivity"; constexpr auto key_thumbSensitivity = "ThumbSensitivity";
const char* key_touchPitch = "TouchPitch"; constexpr auto key_touchPitch = "TouchPitch";
const char* key_touchYaw = "TouchYaw"; constexpr auto key_touchYaw = "TouchYaw";
const char* key_touchRoll = "TouchRoll"; constexpr auto key_touchRoll = "TouchRoll";
const char* key_touchX = "TouchX"; constexpr auto key_touchX = "TouchX";
const char* key_touchY = "TouchY"; constexpr auto key_touchY = "TouchY";
const char* key_touchZ = "TouchZ"; constexpr auto key_touchZ = "TouchZ";
const char* key_playerHeight = "PlayerHeight"; constexpr auto key_playerHeight = "PlayerHeight";
const char* key_eyeHeight = "EyeHeight"; constexpr auto key_eyeHeight = "EyeHeight";
const char* key_piUser = "User"; constexpr auto key_piUser = "User";
const char* key_piName = "Name"; constexpr auto key_piName = "Name";
const char* key_piGender = "Gender"; constexpr auto key_piGender = "Gender";
void ReviveTabController::initStage1( bool forceRevivePage ) void ReviveTabController::initStage1( bool forceRevivePage )
{ {
@@ -44,7 +44,7 @@ void ReviveTabController::initStage1( bool forceRevivePage )
} }
else else
{ {
if ( valuef == 0.0 ) if ( valuef == 0.0f )
{ {
m_pixelsPerDisplayPixelOverrideEnabled = false; m_pixelsPerDisplayPixelOverrideEnabled = false;
m_pixelsPerDisplayPixelOverride = 1.0; m_pixelsPerDisplayPixelOverride = 1.0;
@@ -321,7 +321,7 @@ void ReviveTabController::eventLoopTick()
&vrSettingsError ); &vrSettingsError );
if ( vrSettingsError == vr::VRSettingsError_None ) if ( vrSettingsError == vr::VRSettingsError_None )
{ {
if ( valuef == 0.0 ) if ( valuef == 0.0f )
{ {
setPixelsPerDisplayPixelOverrideEnabled( false ); setPixelsPerDisplayPixelOverrideEnabled( false );
} }
@@ -1015,17 +1015,17 @@ void ReviveTabController::setPiGender( int value, bool notify )
{ {
m_piGender = value; m_piGender = value;
vr::EVRSettingsError vrSettingsError; vr::EVRSettingsError vrSettingsError;
char* txt; const char* txt;
switch ( value ) switch ( value )
{ {
case 1: case 1:
txt = ( char* ) "Male"; txt = static_cast<const char*>( "Male" );
break; break;
case 2: case 2:
txt = ( char* ) "Female"; txt = static_cast<const char*>( "Female" );
break; break;
default: default:
txt = ( char* ) "Unknown"; txt = static_cast<const char*>( "Unknown" );
break; break;
} }
vr::VRSettings()->SetString( vr::VRSettings()->SetString(
@@ -1207,7 +1207,7 @@ void ReviveTabController::reloadControllerProfiles()
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( i );
controllerProfiles.emplace_back(); controllerProfiles.emplace_back();
auto& entry = controllerProfiles[i]; auto& entry = controllerProfiles[static_cast<size_t>( i )];
entry.profileName entry.profileName
= settings->value( "profileName" ).toString().toStdString(); = settings->value( "profileName" ).toString().toStdString();
entry.gripButtonMode = settings->value( "gripButtonMode", 0 ).toInt(); entry.gripButtonMode = settings->value( "gripButtonMode", 0 ).toInt();
@@ -1234,7 +1234,7 @@ void ReviveTabController::saveControllerProfiles()
unsigned i = 0; unsigned i = 0;
for ( auto& p : controllerProfiles ) for ( auto& p : controllerProfiles )
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName", settings->setValue( "profileName",
QString::fromStdString( p.profileName ) ); QString::fromStdString( p.profileName ) );
settings->setValue( "gripButtonMode", p.gripButtonMode ); settings->setValue( "gripButtonMode", p.gripButtonMode );
@@ -1255,7 +1255,7 @@ void ReviveTabController::saveControllerProfiles()
Q_INVOKABLE unsigned ReviveTabController::getControllerProfileCount() Q_INVOKABLE unsigned ReviveTabController::getControllerProfileCount()
{ {
return ( unsigned ) controllerProfiles.size(); return static_cast<unsigned int>( controllerProfiles.size() );
} }
Q_INVOKABLE QString Q_INVOKABLE QString
+10 -10
View File
@@ -48,13 +48,13 @@ void StatisticsTabController::eventLoopTick(
} }
else else
{ {
auto delta = std::sqrt( float delta = static_cast<float>( std::sqrt(
std::pow( m[0][3] - lastHmdPos[0], std::pow( m[0][3] - lastHmdPos[0],
2 ) /*+ std::pow(m[1][3] - lastHmdPos[1], 2)*/ 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 ) if ( delta >= 0.01f )
{ {
m_hmdDistanceMoved += delta; m_hmdDistanceMoved += static_cast<double>( delta );
} }
} }
lastHmdPos[0] = m[0][3]; lastHmdPos[0] = m[0][3];
@@ -93,7 +93,7 @@ void StatisticsTabController::eventLoopTick(
float StatisticsTabController::hmdDistanceMoved() const float StatisticsTabController::hmdDistanceMoved() const
{ {
return m_hmdDistanceMoved; return static_cast<float>( m_hmdDistanceMoved );
} }
float StatisticsTabController::hmdRotations() const float StatisticsTabController::hmdRotations() const
@@ -133,10 +133,10 @@ unsigned StatisticsTabController::timedOut() const
float StatisticsTabController::totalReprojectedRatio() const float StatisticsTabController::totalReprojectedRatio() const
{ {
float totalFrames = ( float ) ( m_cumStats.m_nNumFramePresents float totalFrames = static_cast<float>(
- m_totalRatioPresentedOffset ); ( m_cumStats.m_nNumFramePresents - m_totalRatioPresentedOffset ) );
float reprojectedFrames = ( float ) ( m_cumStats.m_nNumReprojectedFrames float reprojectedFrames = static_cast<float>( (
- m_totalRatioReprojectedOffset ); m_cumStats.m_nNumReprojectedFrames - m_totalRatioReprojectedOffset ) );
if ( totalFrames != 0.0f ) if ( totalFrames != 0.0f )
{ {
return reprojectedFrames / totalFrames; return reprojectedFrames / totalFrames;
@@ -164,7 +164,7 @@ void StatisticsTabController::statsRotationResetClicked()
void StatisticsTabController::statsLeftControllerSpeedResetClicked() void StatisticsTabController::statsLeftControllerSpeedResetClicked()
{ {
if ( m_leftControllerMaxSpeed != 0.0 ) if ( m_leftControllerMaxSpeed != 0.0f )
{ {
m_leftControllerMaxSpeed = 0.0; m_leftControllerMaxSpeed = 0.0;
} }
@@ -172,7 +172,7 @@ void StatisticsTabController::statsLeftControllerSpeedResetClicked()
void StatisticsTabController::statsRightControllerSpeedResetClicked() void StatisticsTabController::statsRightControllerSpeedResetClicked()
{ {
if ( m_rightControllerMaxSpeed != 0.0 ) if ( m_rightControllerMaxSpeed != 0.0f )
{ {
m_rightControllerMaxSpeed = 0.0; m_rightControllerMaxSpeed = 0.0;
} }
+3 -3
View File
@@ -56,7 +56,7 @@ void SteamVRTabController::eventLoopTick()
<< "\" setting: " << "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum( << vr::VRSettings()->GetSettingsErrorNameFromEnum(
vrSettingsError ); vrSettingsError );
if ( m_superSampling != 1.0 ) if ( m_superSampling != 1.0f )
{ {
LOG( DEBUG ) LOG( DEBUG )
<< "OpenVR returns an error and we have a custom " << "OpenVR returns an error and we have a custom "
@@ -204,7 +204,7 @@ void SteamVRTabController::reloadSteamVRProfiles()
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( i );
steamvrProfiles.emplace_back(); steamvrProfiles.emplace_back();
auto& entry = steamvrProfiles[i]; auto& entry = steamvrProfiles[static_cast<size_t>( i )];
entry.profileName entry.profileName
= settings->value( "profileName" ).toString().toStdString(); = settings->value( "profileName" ).toString().toStdString();
entry.includesSupersampling entry.includesSupersampling
@@ -243,7 +243,7 @@ void SteamVRTabController::saveSteamVRProfiles()
unsigned i = 0; unsigned i = 0;
for ( auto& p : steamvrProfiles ) for ( auto& p : steamvrProfiles )
{ {
settings->setArrayIndex( i ); settings->setArrayIndex( static_cast<int>( i ) );
settings->setValue( "profileName", settings->setValue( "profileName",
QString::fromStdString( p.profileName ) ); QString::fromStdString( p.profileName ) );
settings->setValue( "includesSupersampling", p.includesSupersampling ); settings->setValue( "includesSupersampling", p.includesSupersampling );
+10 -8
View File
@@ -12,7 +12,7 @@
// application namespace // application namespace
namespace advsettings namespace advsettings
{ {
const char* steamDesktopOverlaykey = "valve.steam.desktop"; constexpr auto steamDesktopOverlaykey = "valve.steam.desktop";
void UtilitiesTabController::initStage1() void UtilitiesTabController::initStage1()
{ {
@@ -64,8 +64,8 @@ void UtilitiesTabController::initStage1()
void UtilitiesTabController::initStage2( OverlayController* var_parent, void UtilitiesTabController::initStage2( OverlayController* var_parent,
QQuickWindow* var_widget ) QQuickWindow* var_widget )
{ {
this->parent = var_parent; this->m_parent = var_parent;
this->widget = var_widget; this->m_widget = var_widget;
} }
void UtilitiesTabController::sendKeyboardInput( QString input ) void UtilitiesTabController::sendKeyboardInput( QString input )
@@ -422,8 +422,9 @@ void UtilitiesTabController::eventLoopTick()
vr::VRNotificationId notificationId; vr::VRNotificationId notificationId;
vr::EVRInitError eError; vr::EVRInitError eError;
vr::IVRNotifications* vrnotification vr::IVRNotifications* vrnotification
= ( vr::IVRNotifications* ) vr::VR_GetGenericInterface( = static_cast<vr::IVRNotifications*>(
vr::IVRNotifications_Version, &eError ); vr::VR_GetGenericInterface(
vr::IVRNotifications_Version, &eError ) );
if ( eError != vr::VRInitError_None ) if ( eError != vr::VRInitError_None )
{ {
LOG( ERROR ) LOG( ERROR )
@@ -467,7 +468,7 @@ void UtilitiesTabController::eventLoopTick()
} }
*/ */
auto nError = vrnotification->CreateNotification( auto nError = vrnotification->CreateNotification(
parent->overlayHandle(), m_parent->overlayHandle(),
666, 666,
vr::EVRNotificationType_Transient, vr::EVRNotificationType_Transient,
alarmMessageBuffer, alarmMessageBuffer,
@@ -533,7 +534,8 @@ void UtilitiesTabController::eventLoopTick()
i, i,
vr::ETrackedDeviceProperty:: vr::ETrackedDeviceProperty::
Prop_DeviceBatteryPercentage_Float ); Prop_DeviceBatteryPercentage_Float );
int batteryState = ceil( battery * 5 ); int batteryState = static_cast<int>(
ceil( static_cast<double>( battery * 5 ) ) );
if ( batteryState != m_batteryState[i] ) if ( batteryState != m_batteryState[i] )
{ {
@@ -582,7 +584,7 @@ void UtilitiesTabController::setSteamDesktopOverlayWidth( float width,
bool notify, bool notify,
bool notifyOpenVr ) bool notifyOpenVr )
{ {
if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01 ) if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01f )
{ {
m_steamDesktopOverlayWidth = width; m_steamDesktopOverlayWidth = width;
if ( notifyOpenVr ) if ( notifyOpenVr )
+3 -3
View File
@@ -33,8 +33,8 @@ class UtilitiesTabController : public QObject
setSteamDesktopOverlayWidth NOTIFY steamDesktopOverlayWidthChanged ) setSteamDesktopOverlayWidth NOTIFY steamDesktopOverlayWidthChanged )
private: private:
OverlayController* parent; OverlayController* m_parent;
QQuickWindow* widget; QQuickWindow* m_widget;
unsigned settingsUpdateCounter = 0; unsigned settingsUpdateCounter = 0;
@@ -53,7 +53,7 @@ private:
public: public:
void initStage1(); void initStage1();
void initStage2( OverlayController* parent, QQuickWindow* widget ); void initStage2( OverlayController* var_parent, QQuickWindow* var_widget );
void eventLoopTick(); void eventLoopTick();
@@ -13,7 +13,7 @@ AudioManagerWindows::~AudioManagerWindows()
{ {
std::lock_guard<std::recursive_mutex> lock( _mutex ); std::lock_guard<std::recursive_mutex> lock( _mutex );
audioDeviceEnumerator->UnregisterEndpointNotificationCallback( audioDeviceEnumerator->UnregisterEndpointNotificationCallback(
( IMMNotificationClient* ) this ); static_cast<IMMNotificationClient*>( this ) );
if ( mirrorAudioEndpointVolume ) if ( mirrorAudioEndpointVolume )
{ {
mirrorAudioEndpointVolume->Release(); mirrorAudioEndpointVolume->Release();
@@ -61,7 +61,7 @@ void AudioManagerWindows::init( AudioTabController* var_controller )
} }
this->controller = var_controller; this->controller = var_controller;
audioDeviceEnumerator->RegisterEndpointNotificationCallback( audioDeviceEnumerator->RegisterEndpointNotificationCallback(
( IMMNotificationClient* ) this ); static_cast<IMMNotificationClient*>( this ) );
policyConfig = getPolicyConfig(); policyConfig = getPolicyConfig();
if ( !policyConfig ) if ( !policyConfig )
{ {
@@ -370,10 +370,10 @@ IMMDeviceEnumerator* AudioManagerWindows::getAudioDeviceEnumerator()
{ {
IMMDeviceEnumerator* pEnumerator; IMMDeviceEnumerator* pEnumerator;
if ( CoCreateInstance( __uuidof( MMDeviceEnumerator ), if ( CoCreateInstance( __uuidof( MMDeviceEnumerator ),
NULL, nullptr,
CLSCTX_ALL, CLSCTX_ALL,
__uuidof( IMMDeviceEnumerator ), __uuidof( IMMDeviceEnumerator ),
( void** ) &pEnumerator ) reinterpret_cast<void**>( &pEnumerator ) )
< 0 ) < 0 )
{ {
return nullptr; return nullptr;
@@ -385,27 +385,28 @@ IPolicyConfig* AudioManagerWindows::getPolicyConfig()
{ {
IPolicyConfig* var_policyConfig = nullptr; IPolicyConfig* var_policyConfig = nullptr;
// for Win 10 // for Win 10
auto hr = CoCreateInstance( __uuidof( CPolicyConfigClient ), auto hr
NULL, = CoCreateInstance( __uuidof( CPolicyConfigClient ),
CLSCTX_INPROC, nullptr,
IID_IPolicyConfig2, CLSCTX_INPROC,
( LPVOID* ) &var_policyConfig ); IID_IPolicyConfig2,
reinterpret_cast<LPVOID*>( &var_policyConfig ) );
if ( hr != S_OK ) if ( hr != S_OK )
{ {
hr = CoCreateInstance( __uuidof( CPolicyConfigClient ), hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
NULL, nullptr,
CLSCTX_INPROC, CLSCTX_INPROC,
IID_IPolicyConfig1, IID_IPolicyConfig1,
( LPVOID* ) &var_policyConfig ); reinterpret_cast<LPVOID*>( &var_policyConfig ) );
} }
// for Win Vista, 7, 8, 8.1 // for Win Vista, 7, 8, 8.1
if ( hr != S_OK ) if ( hr != S_OK )
{ {
hr = CoCreateInstance( __uuidof( CPolicyConfigClient ), hr = CoCreateInstance( __uuidof( CPolicyConfigClient ),
NULL, nullptr,
CLSCTX_INPROC, CLSCTX_INPROC,
IID_IPolicyConfig0, IID_IPolicyConfig0,
( LPVOID* ) &var_policyConfig ); reinterpret_cast<LPVOID*>( &var_policyConfig ) );
} }
if ( hr != S_OK ) if ( hr != S_OK )
{ {
@@ -470,8 +471,8 @@ IAudioEndpointVolume*
IAudioEndpointVolume* pEndpointVolume; IAudioEndpointVolume* pEndpointVolume;
if ( device->Activate( __uuidof( IAudioEndpointVolume ), if ( device->Activate( __uuidof( IAudioEndpointVolume ),
CLSCTX_INPROC_SERVER, CLSCTX_INPROC_SERVER,
NULL, nullptr,
( void** ) &pEndpointVolume ) reinterpret_cast<void**>( &pEndpointVolume ) )
< 0 ) < 0 )
{ {
return nullptr; return nullptr;
@@ -536,16 +537,16 @@ HRESULT AudioManagerWindows::QueryInterface( REFIID riid, void** ppvObject )
if ( IID_IUnknown == riid ) if ( IID_IUnknown == riid )
{ {
AddRef(); AddRef();
*ppvObject = ( IUnknown* ) this; *ppvObject = static_cast<IUnknown*>( this );
} }
else if ( __uuidof( IMMNotificationClient ) == riid ) else if ( __uuidof( IMMNotificationClient ) == riid )
{ {
AddRef(); AddRef();
*ppvObject = ( IMMNotificationClient* ) this; *ppvObject = static_cast<IMMNotificationClient*>( this );
} }
else else
{ {
*ppvObject = NULL; *ppvObject = nullptr;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
return S_OK; return S_OK;
@@ -5,7 +5,7 @@
#include <mmdeviceapi.h> #include <mmdeviceapi.h>
#include <functiondiscoverykeys_devpkey.h> #include <functiondiscoverykeys_devpkey.h>
#include <endpointvolume.h> #include <endpointvolume.h>
#include "IPolicyConfig.h" #include <IPolicyConfig.h>
#include <mutex> #include <mutex>
// application namespace // application namespace
@@ -33,7 +33,7 @@ void fillKiStruct( INPUT& ip, WORD scanCode, bool keyup )
ip.ki.wScan = 0; ip.ki.wScan = 0;
ip.ki.dwExtraInfo = 0; ip.ki.dwExtraInfo = 0;
ip.ki.time = 0; ip.ki.time = 0;
}; }
/*! /*!
Calls SendInput on an INPUT struct and has associated error handling. Calls SendInput on an INPUT struct and has associated error handling.
+11 -4
View File
@@ -29,10 +29,14 @@ float ChaperoneUtils::_getDistanceToChaperone(
{ // projected point outside of segment { // projected point outside of segment
float d_x = r0.v[0] - x.v[0]; float d_x = r0.v[0] - x.v[0];
float d_z = r0.v[2] - x.v[2]; 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<float>(
sqrt( static_cast<double>( d_x * d_x + d_z * d_z ) ) );
d_x = r1.v[0] - x.v[0]; d_x = r1.v[0] - x.v[0];
d_z = r1.v[2] - x.v[2]; 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<float>(
sqrt( static_cast<double>( d_x * d_x + d_z * d_z ) ) );
if ( d1 < d2 ) if ( d1 < d2 )
{ {
d = d1; d = d1;
@@ -52,7 +56,9 @@ float ChaperoneUtils::_getDistanceToChaperone(
x1_z = r0.v[2] + r * u_z; x1_z = r0.v[2] + r * u_z;
float d_x = x1_x - x.v[0]; float d_x = x1_x - x.v[0];
float d_z = x1_z - x.v[2]; 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<float>(
sqrt( static_cast<double>( d_x * d_x + d_z * d_z ) ) );
} }
if ( std::isnan( distance ) || d < distance ) if ( std::isnan( distance ) || d < distance )
{ {
@@ -77,7 +83,8 @@ void ChaperoneUtils::loadChaperoneData()
std::unique_ptr<vr::HmdQuad_t> quadsBuffer( std::unique_ptr<vr::HmdQuad_t> quadsBuffer(
new vr::HmdQuad_t[_quadsCount] ); new vr::HmdQuad_t[_quadsCount] );
vr::HmdQuad_t* quadsBufferPtr = quadsBuffer.get(); vr::HmdQuad_t* quadsBufferPtr = quadsBuffer.get();
_corners.reset( ( vr::HmdVector3_t* ) new vr::HmdQuad_t[_quadsCount] ); _corners.reset( reinterpret_cast<vr::HmdVector3_t*>(
new vr::HmdQuad_t[_quadsCount] ) );
vr::HmdVector3_t* _cornersPtr = _corners.get(); vr::HmdVector3_t* _cornersPtr = _corners.get();
vr::VRChaperoneSetup()->GetLiveCollisionBoundsInfo( quadsBufferPtr, vr::VRChaperoneSetup()->GetLiveCollisionBoundsInfo( quadsBufferPtr,
&_quadsCount ); &_quadsCount );
+24 -24
View File
@@ -14,7 +14,7 @@
// http://muflihun.com // http://muflihun.com
// //
#include "easylogging++.h" #include <easylogging++.h>
#if defined(AUTO_INITIALIZE_EASYLOGGINGPP) #if defined(AUTO_INITIALIZE_EASYLOGGINGPP)
INITIALIZE_EASYLOGGINGPP INITIALIZE_EASYLOGGINGPP
@@ -1190,7 +1190,7 @@ std::string DateTime::timevalToString(struct timeval tval, const char* format,
buildTimeInfo(&tval, &timeInfo); buildTimeInfo(&tval, &timeInfo);
const int kBuffSize = 30; const int kBuffSize = 30;
char buff_[kBuffSize] = ""; char buff_[kBuffSize] = "";
parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast<std::size_t>(tval.tv_usec / ssPrec->m_offset), parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast<size_t>(static_cast<unsigned long>(tval.tv_usec) / ssPrec->m_offset),
ssPrec); ssPrec);
return std::string(buff_); 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<base::type::EnumType>(timestampUnit); base::type::EnumType start = static_cast<base::type::EnumType>(timestampUnit);
const base::type::char_t* unit = base::consts::kTimeFormats[start].unit; const base::type::char_t* unit = base::consts::kTimeFormats[start].unit;
for (base::type::EnumType i = start; i < base::consts::kTimeFormatsCount - 1; ++i) { for (base::type::EnumType i = start; i < base::consts::kTimeFormatsCount - 1; ++i) {
if (time <= base::consts::kTimeFormats[i].value) { if (static_cast<double>(time) <= base::consts::kTimeFormats[i].value) {
break; break;
} }
if (base::consts::kTimeFormats[i].value == 1000.0f && time / 1000.0f < 1.9f) { if (base::consts::kTimeFormats[i].value == 1000.0 && static_cast<float>(time) / 1000.0f < 1.9f) {
break; break;
} }
time /= static_cast<decltype(time)>(base::consts::kTimeFormats[i].value); time /= static_cast<decltype(time)>(base::consts::kTimeFormats[i].value);
@@ -1264,7 +1264,7 @@ char* DateTime::parseFormat(char* buf, std::size_t bufSz, const char* format, co
--format; --format;
break; break;
case 'd': // Day case 'd': // Day
buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mday, 2, buf, bufLim); buf = base::utils::Str::convertAndAddToBuff(static_cast<size_t>(tInfo->tm_mday), 2, buf, bufLim);
continue; continue;
case 'a': // Day of week (short) case 'a': // Day of week (short)
buf = base::utils::Str::addToBuff(base::consts::kDaysAbbrev[tInfo->tm_wday], buf, bufLim); 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); buf = base::utils::Str::addToBuff(base::consts::kDays[tInfo->tm_wday], buf, bufLim);
continue; continue;
case 'M': // month case 'M': // month
buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mon + 1, 2, buf, bufLim); buf = base::utils::Str::convertAndAddToBuff(static_cast<size_t>(tInfo->tm_mon + 1), 2, buf, bufLim);
continue; continue;
case 'b': // month (short) case 'b': // month (short)
buf = base::utils::Str::addToBuff(base::consts::kMonthsAbbrev[tInfo->tm_mon], buf, bufLim); 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); buf = base::utils::Str::addToBuff(base::consts::kMonths[tInfo->tm_mon], buf, bufLim);
continue; continue;
case 'y': // year (two digits) 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<size_t>(tInfo->tm_year + base::consts::kYearBase), 2, buf, bufLim);
continue; continue;
case 'Y': // year (four digits) 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<size_t>(tInfo->tm_year + base::consts::kYearBase), 4, buf, bufLim);
continue; continue;
case 'h': // hour (12-hour) case 'h': // hour (12-hour)
buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour % 12, 2, buf, bufLim); buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour % 12, 2, buf, bufLim);
continue; continue;
case 'H': // hour (24-hour) case 'H': // hour (24-hour)
buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour, 2, buf, bufLim); buf = base::utils::Str::convertAndAddToBuff(static_cast<size_t>(tInfo->tm_hour), 2, buf, bufLim);
continue; continue;
case 'm': // minute case 'm': // minute
buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_min, 2, buf, bufLim); buf = base::utils::Str::convertAndAddToBuff(static_cast<size_t>(tInfo->tm_min), 2, buf, bufLim);
continue; continue;
case 's': // second case 's': // second
buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_sec, 2, buf, bufLim); buf = base::utils::Str::convertAndAddToBuff(static_cast<size_t>(tInfo->tm_sec), 2, buf, bufLim);
continue; continue;
case 'z': // subsecond part case 'z': // subsecond part
case 'g': case 'g':
@@ -1553,7 +1553,7 @@ void LogFormat::updateDateFormat(std::size_t index, base::type::string_t& currFo
} }
ss << static_cast<char>(*ptr); ss << static_cast<char>(*ptr);
} }
currFormat.erase(index, count); currFormat.erase(index, static_cast<size_t>(count));
m_dateTimeFormat = ss.str(); m_dateTimeFormat = ss.str();
} else { } else {
// No format provided, use default // 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 << "]"); ELPP_ASSERT(valid, "Configuration value not a valid integer [" << confVal << "]");
return 0; return 0;
} }
return atol(confVal.c_str()); return static_cast<unsigned long>(atol(confVal.c_str()));
} }
std::string TypedConfigurations::resolveFilename(const std::string& filename) { std::string TypedConfigurations::resolveFilename(const std::string& filename) {
@@ -1765,7 +1765,7 @@ std::string TypedConfigurations::resolveFilename(const std::string& filename) {
} }
ss << *ptr; ss << *ptr;
} }
resultingFilename.erase(dateIndex + dateTimeFormatSpecifierStr.size(), count); resultingFilename.erase(dateIndex + dateTimeFormatSpecifierStr.size(), static_cast<size_t>(count));
fmt = ss.str(); fmt = ss.str();
} else { } else {
fmt = std::string(base::consts::kDefaultDateTimeFormatInFilename); fmt = std::string(base::consts::kDefaultDateTimeFormatInFilename);
@@ -1789,26 +1789,26 @@ void TypedConfigurations::insertFile(Level level, const std::string& fullFilenam
if (filePath.size() < resolvedFilename.size()) { if (filePath.size() < resolvedFilename.size()) {
base::utils::File::createPath(filePath); base::utils::File::createPath(filePath);
} }
auto create = [&](Level level) { auto create = [&](Level level_var) {
base::LogStreamsReferenceMap::iterator filestreamIter = m_logStreamsReference->find(resolvedFilename); base::LogStreamsReferenceMap::iterator filestreamIter = m_logStreamsReference->find(resolvedFilename);
base::type::fstream_t* fs = nullptr; base::type::fstream_t* fs = nullptr;
if (filestreamIter == m_logStreamsReference->end()) { if (filestreamIter == m_logStreamsReference->end()) {
// We need a completely new stream, nothing to share with // We need a completely new stream, nothing to share with
fs = base::utils::File::newFileStream(resolvedFilename); fs = base::utils::File::newFileStream(resolvedFilename);
m_filenameMap.insert(std::make_pair(level, resolvedFilename)); m_filenameMap.insert(std::make_pair(level_var, resolvedFilename));
m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(fs))); m_fileStreamMap.insert(std::make_pair(level_var, base::FileStreamPtr(fs)));
m_logStreamsReference->insert(std::make_pair(resolvedFilename, base::FileStreamPtr(m_fileStreamMap.at(level)))); m_logStreamsReference->insert(std::make_pair(resolvedFilename, base::FileStreamPtr(m_fileStreamMap.at(level_var))));
} else { } else {
// Woops! we have an existing one, share it! // Woops! we have an existing one, share it!
m_filenameMap.insert(std::make_pair(level, filestreamIter->first)); m_filenameMap.insert(std::make_pair(level_var, filestreamIter->first));
m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(filestreamIter->second))); m_fileStreamMap.insert(std::make_pair(level_var, base::FileStreamPtr(filestreamIter->second)));
fs = filestreamIter->second.get(); fs = filestreamIter->second.get();
} }
if (fs == nullptr) { if (fs == nullptr) {
// We display bad file error from newFileStream() // We display bad file error from newFileStream()
ELPP_INTERNAL_ERROR("Setting [TO_FILE] of [" ELPP_INTERNAL_ERROR("Setting [TO_FILE] of ["
<< LevelHelper::convertToString(level) << "] to FALSE", false); << LevelHelper::convertToString(level_var) << "] to FALSE", false);
setValue(level, false, &m_toFileMap); setValue(level_var, false, &m_toFileMap);
} }
}; };
// If we dont have file conf for any level, create it for Level::Global first // 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( base::type::fstream_t* fs = m_data->logMessage()->logger()->m_typedConfigurations->fileStream(
m_data->logMessage()->level()); m_data->logMessage()->level());
if (fs != nullptr) { if (fs != nullptr) {
fs->write(logLine.c_str(), logLine.size()); fs->write(logLine.c_str(), static_cast<std::streamsize>(logLine.size()));
if (fs->fail()) { if (fs->fail()) {
ELPP_INTERNAL_ERROR("Unable to write log to file [" ELPP_INTERNAL_ERROR("Unable to write log to file ["
<< m_data->logMessage()->logger()->m_typedConfigurations->filename(m_data->logMessage()->level()) << "].\n" << 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_list loggersList;
va_start(loggersList, loggerIds); va_start(loggersList, loggerIds);
const char* id = loggerIds; const char* id = loggerIds;
m_loggerIds.reserve(count); m_loggerIds.reserve(static_cast<size_t>(count));
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
m_loggerIds.push_back(std::string(id)); m_loggerIds.push_back(std::string(id));
id = va_arg(loggersList, const char*); id = va_arg(loggersList, const char*);