Center Marker/ Chaperone Refactor/ IVROverlay/IVRSettings wrappers PT 1/? (#438)

* changed click noises to internal sounds

* udpated to ovr 1.11.11

* in prog added prototypes

* began wrapper for IVRSettings

* added getters for chaperone colors

* added setters for chaperone color

* fixed type conversion issue

* fixed linking issue, added additional settings chaperone page

* adjusted chaperone page qml

* added color chaperone UI

* refactor in prog

* updated ivrsettings wrapper, refactor in prog

* refactor in prog

* collision bound style add

* refactor

* cleaned up error logging

* fixed fade distance remember bug

* fixed sounds

* fixed brightness opacity bug setting to 0 when 0

* fixed sounds

* added wrapper for removing keys

* refactored reset

* added chaperone Styles to UI

* added chaperone floor always on

* fixed copy/paste error

* adjsuted ui chaperone color slider

* started adding chaperone floor marker

* fixeed naming error overlay

* finalized chaperone Ideas, added chaperone markers

* began ivroverlay wrapper

* center marker fully implemented

* added function prototypes for new settings

* added setting, and updated ui for New Center Marker Overlay

* adjsuted sound effect volume and formatting for chaperonecolorbox

* adjusted volume back

* fixed various issues aroudn new overlay

* removed artifact comment

* cleaned up settings wrapper

* cleaned up chaperone tab controller for namespace changes

* removed ide comment issue

* cleanup overlay wrapper

* cleaned up tab/space changed file name

* renamed files

* fixed include statements

* updated namespace in chaperonetabcontroller

* fixed tab/space issues

* re-activated boundbasisheight

* fixed bulgarian case

* changed chaperone warnings to only work in roomscale

* fix capitilization

* fixed tracking universe update

* direct text input change for brightness

* qml fixes

* fixed qml format issues

* fixed sound issue w/ sliders

* fixed super truely

* Add SDL libraries to CircleCI

* Remove -tidy from circleCI config

* flushed out error messages in overlaywrapper

* removed hungarian notation

* added get/set string to ovrsettings wrapper

* misc cleanup

* add reset orientation btn and new center marker to chaperone

* ui adjustments

* changed alarm audio

* adjusted sound effect volume slightly lower

* updated for 5.1.0 release

Co-authored-by: Vasily <vautkin@teknik.io>
This commit is contained in:
ykeara
2020-05-13 15:11:20 -05:00
committed by GitHub
co-authored by Vasily
parent 593b429641
commit a803ffaeac
50 changed files with 1824 additions and 429 deletions
+199
View File
@@ -0,0 +1,199 @@
#include "ovr_overlay_wrapper.h"
namespace ovr_overlay_wrapper
{
OverlayError createOverlay( const std::string overlayKey,
const std::string overlayName,
vr::VROverlayHandle_t* overlayHandle,
std::string customErrorMsg )
{
vr::VROverlayError oError = vr::VROverlay()->CreateOverlay(
overlayKey.c_str(), overlayName.c_str(), overlayHandle );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR ) << "Could not create overlay: " << overlayName
<< "because "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
OverlayError setOverlayColor( vr::VROverlayHandle_t overlayHandle,
float red,
float green,
float blue,
std::string customErrorMsg )
{
vr::VROverlayError oError
= vr::VROverlay()->SetOverlayColor( overlayHandle, red, green, blue );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR ) << "Error setting Overlay Color For "
<< getOverlayKey( overlayHandle ) << " with error: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
OverlayError setOverlayAlpha( vr::VROverlayHandle_t overlayHandle,
float alpha,
std::string customErrorMsg )
{
vr::VROverlayError oError
= vr::VROverlay()->SetOverlayAlpha( overlayHandle, alpha );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR ) << "Error setting Overlay Alpha For "
<< getOverlayKey( overlayHandle ) << " with error: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
OverlayError setOverlayWidthInMeters( vr::VROverlayHandle_t overlayHandle,
float widthInMeters,
std::string customErrorMsg )
{
vr::VROverlayError oError = vr::VROverlay()->SetOverlayWidthInMeters(
overlayHandle, widthInMeters );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR ) << "Error setting overlay width For "
<< getOverlayKey( overlayHandle ) << " with error: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
OverlayError setOverlayFromFile( vr::VROverlayHandle_t overlayHandle,
std::string fileName,
std::string customErrorMsg )
{
{
const auto overlayPath = paths::binaryDirectoryFindFile( fileName );
if ( overlayPath.has_value() )
{
vr::VROverlayError oError = vr::VROverlay()->SetOverlayFromFile(
overlayHandle, overlayPath->c_str() );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR )
<< "Error setting Overlay from file For "
<< getOverlayKey( overlayHandle ) << " with error: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
else
{
LOG( ERROR ) << "File not Found: " << fileName << customErrorMsg;
return OverlayError::UndefinedError;
}
}
}
OverlayError showOverlay( vr::VROverlayHandle_t overlayHandle,
std::string customErrorMsg )
{
vr::VROverlayError oError = vr::VROverlay()->ShowOverlay( overlayHandle );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR ) << "Error showing overlay For "
<< getOverlayKey( overlayHandle ) << " with error: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
OverlayError hideOverlay( vr::VROverlayHandle_t overlayHandle,
std::string customErrorMsg )
{
vr::VROverlayError oError = vr::VROverlay()->HideOverlay( overlayHandle );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR ) << "Error hiding overlay For "
<< getOverlayKey( overlayHandle ) << " with error: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
OverlayError setOverlayTransformAbsolute(
vr::VROverlayHandle_t overlayHandle,
vr::ETrackingUniverseOrigin trackingOrigin,
const vr::HmdMatrix34_t* trackingOriginToOverlayTransform,
std::string customErrorMsg )
{
vr::VROverlayError oError = vr::VROverlay()->SetOverlayTransformAbsolute(
overlayHandle, trackingOrigin, trackingOriginToOverlayTransform );
if ( oError == vr::VROverlayError_None )
{
return OverlayError::NoError;
}
else
{
LOG( ERROR ) << "Error setting Overlay Position For "
<< getOverlayKey( overlayHandle ) << " with error: "
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( oError )
<< " " << customErrorMsg;
return OverlayError::UndefinedError;
}
}
std::string getOverlayKey( vr::VROverlayHandle_t overlayHandle )
{
// max size as of ovr 1.11.11 128 bytes
const uint32_t bufferMax = vr::k_unVROverlayMaxKeyLength;
char cStringOut[bufferMax];
vr::EVROverlayError oErrorOut;
vr::VROverlay()->GetOverlayKey(
overlayHandle, cStringOut, bufferMax, &oErrorOut );
std::string output = cStringOut;
if ( oErrorOut == vr::VROverlayError_None )
{
return output;
}
else
{
std::string errorName
= vr::VROverlay()->GetOverlayErrorNameFromEnum( oErrorOut );
return ( "can't get name:" + errorName );
}
}
} // namespace ovr_overlay_wrapper
+58
View File
@@ -0,0 +1,58 @@
#pragma once
#include <openvr.h>
#include <iostream>
#include <string>
#include <easylogging++.h>
#include <utility>
#include <string>
#include "../utils/paths.h"
/* Wrapper For OpenVR's IVR settings class, allows us to do our error logging
* while also minimizing code
*
*/
namespace ovr_overlay_wrapper
{
// might make sense to mirror ovr's errors exactly, but for now this is more
// than sufficient
enum class OverlayError
{
NoError,
UndefinedError,
};
OverlayError createOverlay( const std::string overlayKey,
const std::string overlayName,
vr::VROverlayHandle_t* overlayHandle,
std::string customErrorMsg = "" );
OverlayError setOverlayColor( vr::VROverlayHandle_t overlayHandle,
float red,
float green,
float blue,
std::string customErrorMsg = "" );
OverlayError setOverlayAlpha( vr::VROverlayHandle_t overlayHandle,
float alpha,
std::string customErrorMsg = "" );
OverlayError setOverlayWidthInMeters( vr::VROverlayHandle_t overlayHandle,
float widthInMeters,
std::string customErrorMsg = "" );
OverlayError setOverlayFromFile( vr::VROverlayHandle_t overlayHandle,
std::string fileName,
std::string customErrorMsg = "" );
OverlayError showOverlay( vr::VROverlayHandle_t overlayHandle,
std::string customErrorMsg = "" );
OverlayError hideOverlay( vr::VROverlayHandle_t overlayHandle,
std::string customErrorMsg = "" );
OverlayError setOverlayTransformAbsolute(
vr::VROverlayHandle_t overlayHandle,
vr::ETrackingUniverseOrigin trackingOrigin,
const vr::HmdMatrix34_t* trackingOriginToOverlayTransform,
std::string customErrorMsg = "" );
std::string getOverlayKey( vr::VROverlayHandle_t overlayHandle );
} // namespace ovr_overlay_wrapper
+148
View File
@@ -0,0 +1,148 @@
#include "ovr_settings_wrapper.h"
namespace ovr_settings_wrapper
{
SettingsError handleErrors( std::string settingsKey,
vr::EVRSettingsError error,
std::string customErrorMsg )
{
if ( error != vr::VRSettingsError_None )
{
LOG( ERROR ) << "Could not access \"" << settingsKey << "\" setting: "
<< vr::VRSettings()->GetSettingsErrorNameFromEnum( error )
<< " " << customErrorMsg;
return SettingsError::UndefinedError;
}
return SettingsError::NoError;
}
std::pair<SettingsError, bool> getBool( std::string section,
std::string settingsKey,
std::string customErrorMsg )
{
bool value;
vr::EVRSettingsError error;
value = vr::VRSettings()->GetBool(
section.c_str(), settingsKey.c_str(), &error );
SettingsError e = handleErrors( settingsKey, error, customErrorMsg );
std::pair<SettingsError, bool> p( e, value );
return p;
}
std::pair<SettingsError, int> getInt32( std::string section,
std::string settingsKey,
std::string customErrorMsg )
{
int value;
vr::EVRSettingsError error;
value = static_cast<int>( vr::VRSettings()->GetInt32(
section.c_str(), settingsKey.c_str(), &error ) );
SettingsError e = handleErrors( settingsKey, error, customErrorMsg );
std::pair<SettingsError, int> p( e, value );
return p;
}
std::pair<SettingsError, float> getFloat( std::string section,
std::string settingsKey,
std::string customErrorMsg )
{
float value;
vr::EVRSettingsError error;
value = vr::VRSettings()->GetFloat(
section.c_str(), settingsKey.c_str(), &error );
handleErrors( settingsKey, error, customErrorMsg );
SettingsError e = handleErrors( settingsKey, error, customErrorMsg );
std::pair<SettingsError, float> p( e, value );
return p;
}
std::pair<SettingsError, std::string> getString( std::string section,
std::string settingsKey,
std::string customErrorMsg )
{
vr::EVRSettingsError error;
// This appears to be correct value as set in CVRSettingHelper as of
// ovr 1.11.11
const uint32_t bufferMax = 4096;
char cStringOut[bufferMax];
vr::VRSettings()->GetString(
section.c_str(), settingsKey.c_str(), cStringOut, bufferMax, &error );
handleErrors( settingsKey, error, customErrorMsg );
std::string value = cStringOut;
SettingsError e = handleErrors( settingsKey, error, customErrorMsg );
std::pair<SettingsError, std::string> p( e, value );
return p;
}
// Setters
SettingsError setBool( std::string section,
std::string settingsKey,
bool value,
std::string customErrorMsg )
{
vr::EVRSettingsError error;
vr::VRSettings()->SetBool(
section.c_str(), settingsKey.c_str(), value, &error );
return handleErrors( settingsKey, error, customErrorMsg );
}
SettingsError setInt32( std::string section,
std::string settingsKey,
int value,
std::string customErrorMsg )
{
vr::EVRSettingsError error;
vr::VRSettings()->SetInt32( section.c_str(),
settingsKey.c_str(),
static_cast<int32_t>( value ),
&error );
return handleErrors( settingsKey, error, customErrorMsg );
}
SettingsError setFloat( std::string section,
std::string settingsKey,
float value,
std::string customErrorMsg )
{
vr::EVRSettingsError error;
vr::VRSettings()->SetFloat(
section.c_str(), settingsKey.c_str(), value, &error );
return handleErrors( settingsKey, error, customErrorMsg );
}
SettingsError setString( std::string section,
std::string settingsKey,
char* value,
std::string customErrorMsg )
{
vr::EVRSettingsError error;
vr::VRSettings()->SetString(
section.c_str(), settingsKey.c_str(), value, &error );
return handleErrors( settingsKey, error, customErrorMsg );
}
SettingsError removeSection( std::string section, std::string customErrorMsg )
{
vr::EVRSettingsError error;
vr::VRSettings()->RemoveSection( section.c_str(), &error );
return handleErrors( "section", error, customErrorMsg );
}
SettingsError removeKeyInSection( std::string section,
std::string settingsKey,
std::string customErrorMsg )
{
vr::EVRSettingsError error;
vr::VRSettings()->RemoveKeyInSection(
section.c_str(), settingsKey.c_str(), &error );
return handleErrors( settingsKey, error, customErrorMsg );
}
} // namespace ovr_settings_wrapper
+66
View File
@@ -0,0 +1,66 @@
#pragma once
#include <openvr.h>
#include <iostream>
#include <string>
#include <easylogging++.h>
#include <utility>
/* Wrapper For OpenVR's IVR settings class, allows us to do our error logging
* while also minimizing code
*
*/
namespace ovr_settings_wrapper
{
// might make sense to mirror ovr's errors exactly, but for now this is more
// than sufficient
enum class SettingsError
{
NoError,
UndefinedError,
};
std::pair<SettingsError, bool> getBool( std::string section,
std::string settingsKey,
std::string customErrorMsg = "" );
std::pair<SettingsError, int> getInt32( std::string section,
std::string settingsKey,
std::string customErrorMsg = "" );
std::pair<SettingsError, float> getFloat( std::string section,
std::string settingsKey,
std::string customErrorMsg = "" );
std::pair<SettingsError, std::string> getString( std::string section,
std::string settingsKey,
std::string customErrorMsg
= "" );
SettingsError setBool( std::string section,
std::string settingsKey,
bool value,
std::string customErrorMsg = "" );
SettingsError setInt32( std::string section,
std::string settingsKey,
int value,
std::string customErrorMsg = "" );
SettingsError setFloat( std::string section,
std::string settingsKey,
float value,
std::string customErrorMsg = "" );
SettingsError setString( std::string section,
std::string settingsKey,
char* value,
std::string customErrorMsg = "" );
SettingsError removeSection( std::string section,
std::string customErrorMsg = "" );
SettingsError removeKeyInSection( std::string section,
std::string settingsKey,
std::string customErrorMsg = "" );
SettingsError handleErrors( std::string settingsKey,
vr::EVRSettingsError,
std::string customErrorMsg );
} // namespace ovr_settings_wrapper
+22 -21
View File
@@ -69,35 +69,35 @@ OverlayController::OverlayController( bool desktopMode,
m_runtimePathUrl = QUrl::fromLocalFile( tempRuntimePath );
LOG( INFO ) << "VR Runtime Path: " << m_runtimePathUrl.toLocalFile();
QString activationSoundFile = m_runtimePathUrl.toLocalFile().append(
"/content/panorama/sounds/activation.wav" );
QFileInfo activationSoundFileInfo( activationSoundFile );
if ( activationSoundFileInfo.exists() && activationSoundFileInfo.isFile() )
constexpr auto clickSoundURL = "res/sounds/click.wav";
const auto activationSoundFile
= paths::binaryDirectoryFindFile( clickSoundURL );
if ( activationSoundFile.has_value() )
{
m_activationSoundEffect.setSource(
QUrl::fromLocalFile( activationSoundFile ) );
m_activationSoundEffect.setVolume( 1.0 );
m_activationSoundEffect.setSource( QUrl::fromLocalFile(
QString::fromStdString( ( *activationSoundFile ) ) ) );
m_activationSoundEffect.setVolume( 0.7 );
}
else
{
LOG( ERROR ) << "Could not find activation sound file "
<< activationSoundFile;
<< clickSoundURL;
}
constexpr auto focusChangedSoundURL = "res/sounds/focus.wav";
const auto focusChangedSoundFile
= paths::binaryDirectoryFindFile( focusChangedSoundURL );
QString focusChangedSoundFile = m_runtimePathUrl.toLocalFile().append(
"/content/panorama/sounds/focus_change.wav" );
QFileInfo focusChangedSoundFileInfo( focusChangedSoundFile );
if ( focusChangedSoundFileInfo.exists()
&& focusChangedSoundFileInfo.isFile() )
if ( focusChangedSoundFile.has_value() )
{
m_focusChangedSoundEffect.setSource(
QUrl::fromLocalFile( focusChangedSoundFile ) );
m_focusChangedSoundEffect.setVolume( 1.0 );
m_focusChangedSoundEffect.setSource( QUrl::fromLocalFile(
QString::fromStdString( ( *focusChangedSoundFile ) ) ) );
m_focusChangedSoundEffect.setVolume( 0.7 );
}
else
{
LOG( ERROR ) << "Could not find focus changed sound file "
<< focusChangedSoundFile;
LOG( ERROR ) << "Could not find focus Changed sound file "
<< focusChangedSoundURL;
}
constexpr auto alarmFileName = "res/sounds/alarm01.wav";
@@ -1144,13 +1144,13 @@ void OverlayController::mainEventLoop()
rightSpeed
= std::sqrt( vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2] );
}
auto universe = vr::VRCompositor()->GetTrackingSpace();
m_moveCenterTabController.eventLoopTick(
vr::VRCompositor()->GetTrackingSpace(), devicePoses );
m_moveCenterTabController.eventLoopTick( universe, devicePoses );
m_utilitiesTabController.eventLoopTick();
m_statisticsTabController.eventLoopTick(
devicePoses, leftSpeed, rightSpeed );
m_chaperoneTabController.eventLoopTick( devicePoses );
m_chaperoneTabController.eventLoopTick( universe, devicePoses );
m_audioTabController.eventLoopTick();
m_rotationTabController.eventLoopTick( devicePoses );
@@ -1160,6 +1160,7 @@ void OverlayController::mainEventLoop()
m_steamVRTabController.dashboardLoopTick();
m_fixFloorTabController.dashboardLoopTick( devicePoses );
m_videoTabController.dashboardLoopTick();
m_chaperoneTabController.dashboardLoopTick();
}
if ( m_ulOverlayThumbnailHandle != vr::k_ulOverlayHandleInvalid )
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

+26 -11
View File
@@ -443,7 +443,7 @@ MyStackViewPage {
text: "Center Marker"
Layout.fillWidth: false
onCheckedChanged: {
ChaperoneTabController.setCenterMarker(this.checked, false)
ChaperoneTabController.setCenterMarkerNew(this.checked, false)
}
}
@@ -485,16 +485,31 @@ MyStackViewPage {
Item { Layout.fillWidth: true }
}
RowLayout {
Layout.fillWidth: true
MyPushButton {
id: chaperoneWarningsConfigButton
text: "Proximity Warning Settings"
Layout.preferredWidth: 350
onClicked: {
MyResources.playFocusChangedSound()
mainView.push(chaperoneWarningsPage)
}
}
Item {Layout.fillWidth: true}
MyPushButton {
id: chaperoneWarningsConfigButton
text: "Proximity Warning Settings"
Layout.preferredWidth: 350
onClicked: {
MyResources.playFocusChangedSound()
mainView.push(chaperoneWarningsPage)
MyPushButton {
id: chaperoneAdditionalButton
text: "Additional Chaperone Settings"
Layout.preferredWidth: 400
onClicked: {
MyResources.playFocusChangedSound()
mainView.push(chaperoneAdditionalPage)
}
}
}
ChangeOrientationGroupBox { }
@@ -540,7 +555,7 @@ MyStackViewPage {
chaperoneHeightSlider.value = h
}
chaperoneHeightText.text = h
chaperoneCenterMarkerToggle.checked = ChaperoneTabController.centerMarker
chaperoneCenterMarkerToggle.checked = ChaperoneTabController.centerMarkerNew
chaperonePlaySpaceToggle.checked = ChaperoneTabController.playSpaceMarker
chaperoneForceBoundsToggle.checked = ChaperoneTabController.forceBounds
chaperoneDisableChaperone.checked = ChaperoneTabController.disableChaperone
@@ -581,8 +596,8 @@ MyStackViewPage {
chaperoneHeightText.text = h
}
onCenterMarkerChanged: {
chaperoneCenterMarkerToggle.checked = ChaperoneTabController.centerMarker
onCenterMarkerNewChanged: {
chaperoneCenterMarkerToggle.checked = ChaperoneTabController.centerMarkerNew
}
onPlaySpaceMarkerChanged: {
chaperonePlaySpaceToggle.checked = ChaperoneTabController.playSpaceMarker
@@ -42,7 +42,7 @@ GroupBox {
val = -180;
}
spaceRotationSlider.value = val
spaceRotationText.text = val
spaceRotationText.text = val.toFixed(2) + "°"
}
}
@@ -55,7 +55,7 @@ GroupBox {
Layout.fillWidth: true
onValueChanged: {
var val = this.value
spaceRotationText.text = val
spaceRotationText.text = val.toFixed(2) + "°"
}
}
@@ -69,7 +69,7 @@ GroupBox {
val = 180;
}
spaceRotationSlider.value = val
spaceRotationText.text = val
spaceRotationText.text = val.toFixed(2) + "°"
}
}
@@ -83,7 +83,7 @@ GroupBox {
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val)) {
spaceRotationText.text = val + "°"
spaceRotationText.text = val.toFixed(2) + "°"
spaceRotationSlider.value = val
}
}
@@ -0,0 +1,39 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import ovras.advsettings 1.0
import "." // QTBUG-34418, singletons require explicit import to load qmldir file
import "../../common"
import "chaperoneboundscolor"
import "chaperonetype"
import "chaperonemisc"
MyStackViewPage {
headerText: "Additional Chaperone Settings"
content: ColumnLayout {
spacing: 10
ChaperoneBoundsColorGroupBox{
id: chaperoneBoundsColorGroupBox
}
ChaperoneTypeGroupBox{
id:chaperoneTypeGroupBox
}
ChaperoneMiscGroupBox{
id:chaperoneMiscGroupBox
}
Item {
Layout.fillHeight: true
}
}
}
//TODO content
@@ -0,0 +1,199 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import ovras.advsettings 1.0
import "../../../common"
import "." // QTBUG-34418, singletons require explicit import to load qmldir file
GroupBox {
id: chaperoneBoundsColorGroupBox
Layout.fillWidth: true
label: MyText {
leftPadding: 10
text: "Chaperone Color"
bottomPadding: -10
}
background: Rectangle {
color: "transparent"
border.color: "#ffffff"
radius: 8
}
ColumnLayout {
anchors.fill: parent
Rectangle {
color: "#ffffff"
height: 1
Layout.fillWidth: true
Layout.bottomMargin: 5
}
RowLayout{
MyText {
text: "Red:"
horizontalAlignment: Text.AlignRight
Layout.preferredWidth: 75
}
MySlider {
id: chaperoneColorRedSlider
from: 0
to: 255
stepSize: 5
value: 0
Layout.fillWidth: true
onPositionChanged: {
var val = (this.value).toFixed(0)
colorRedText.text = val
ChaperoneTabController.setChaperoneColorR(val, true)
}
}
MyTextField {
id: colorRedText
text: "0"
keyBoardUID: 320
Layout.preferredWidth: 100
Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseInt(input)
if (!isNaN(val)) {
if (val < 0) {
val = 0
} else if (val > 255) {
val = 255
}
ChaperoneTabController.setChaperoneColorR(val, true)
chaperoneColorRedSlider.value = val
}
text = val
}
}
Item{
Layout.preferredWidth: 200
}
MyText {
text: "Green:"
horizontalAlignment: Text.AlignRight
Layout.preferredWidth: 75
}
MySlider {
id: chaperoneColorGreenSlider
from: 0
to: 255
stepSize: 5
value: 255
Layout.fillWidth: true
onPositionChanged: {
var val = (this.value).toFixed(0)
colorGreenText.text = val
ChaperoneTabController.setChaperoneColorG(val, true)
}
}
MyTextField {
id: colorGreenText
text: "255"
keyBoardUID: 321
Layout.preferredWidth: 100
Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseInt(input)
if (!isNaN(val)) {
if (val < 0) {
val = 0
} else if (val > 255) {
val = 255
}
ChaperoneTabController.setChaperoneColorG(val, true)
chaperoneColorGreenSlider.value = val
}
text = val
}
}
}
RowLayout{
MyText {
text: "Blue:"
horizontalAlignment: Text.AlignRight
Layout.preferredWidth: 75
}
MySlider {
id: chaperoneColorBlueSlider
from: 0
to: 255
stepSize: 5
value: 255
Layout.preferredWidth: 250
onPositionChanged: {
var val = (this.value).toFixed(0)
colorBlueText.text = val
ChaperoneTabController.setChaperoneColorB(val, true)
}
}
MyTextField {
id: colorBlueText
text: "255"
keyBoardUID: 322
Layout.preferredWidth: 100
Layout.leftMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseInt(input)
if (!isNaN(val)) {
if (val < 0) {
val = 0
} else if (val > 255) {
val = 255
}
ChaperoneTabController.setChaperoneColorB(val, true)
chaperoneColorBlueSlider.value = val
}
text = val
}
}
}
}
Component.onCompleted: {
// set up var here to prevent double call to c++ from qml
var redValue = ChaperoneTabController.chaperoneColorR
var greenValue = ChaperoneTabController.chaperoneColorG
var blueValue = ChaperoneTabController.chaperoneColorB
colorRedText.text = redValue
colorGreenText.text = greenValue
colorBlueText.text = blueValue
chaperoneColorRedSlider.value = redValue
chaperoneColorGreenSlider.value = greenValue
chaperoneColorBlueSlider.value = blueValue
}
Connections {
target: ChaperoneTabController
onChaperoneColorRChanged:{
var redValue = ChaperoneTabController.chaperoneColorR
colorRedText.text = redValue
chaperoneColorRedSlider.value = redValue
}
onChaperoneColorGChanged:{
var greenValue = ChaperoneTabController.chaperoneColorG
colorGreenText.text = greenValue
chaperoneColorGreenSlider.value = greenValue
}
onChaperoneColorBChanged:{
var blueValue = ChaperoneTabController.chaperoneColorB
colorBlueText.text = blueValue
chaperoneColorBlueSlider.value = blueValue
}
}
}
@@ -0,0 +1,80 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import ovras.advsettings 1.0
import "../../../common"
import "." // QTBUG-34418, singletons require explicit import to load qmldir file
GroupBox {
id: chaperoneMiscGroupBox
Layout.fillWidth: true
label: MyText {
leftPadding: 10
text: "Misc:"
bottomPadding: -10
}
background: Rectangle {
color: "transparent"
border.color: "#ffffff"
radius: 8
}
ColumnLayout {
anchors.fill: parent
Rectangle {
color: "#ffffff"
height: 1
Layout.fillWidth: true
Layout.bottomMargin: 5
}
RowLayout {
spacing: 16
MyToggleButton {
id: chaperoneFloorToggleBtn
text: "Floor Bounds Always On"
Layout.preferredWidth: 375
onCheckedChanged: {
ChaperoneTabController.setChaperoneFloorToggle(this.checked, false)
}
}
MyToggleButton {
id: legacyCenterMarkerbtn
text: "Legacy Center Marker"
Layout.preferredWidth: 375
onCheckedChanged: {
ChaperoneTabController.setCenterMarker(this.checked, false)
}
}
MyPushButton{
id:btnResetOrientation
text: "Reset Turn Counter"
onClicked: {
StatisticsTabController.statsRotationResetClicked()
}
}
}
}
Component.onCompleted: {
chaperoneFloorToggleBtn.checked = ChaperoneTabController.chaperoneFloorToggle
legacyCenterMarkerbtn.checked = ChaperoneTabController.centerMarker
}
Connections {
target: ChaperoneTabController
onChaperoneFloorToggleChanged:{
chaperoneFloorToggleBtn.checked = ChaperoneTabController.chaperoneFloorToggle
}
onCenterMarkerChanged:{
legacyCenterMarkerbtn.checked = ChaperoneTabController.centermarker
}
}
}
@@ -0,0 +1,127 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import ovras.advsettings 1.0
import "../../../common"
import "." // QTBUG-34418, singletons require explicit import to load qmldir file
GroupBox {
id: chaperoneTypeGroupBox
Layout.fillWidth: true
label: MyText {
leftPadding: 10
text: "Chaperone Style"
bottomPadding: -10
}
background: Rectangle {
color: "transparent"
border.color: "#ffffff"
radius: 8
}
ColumnLayout {
anchors.fill: parent
Rectangle {
color: "#ffffff"
height: 1
Layout.fillWidth: true
Layout.bottomMargin: 5
}
RowLayout{
ButtonGroup { id: chaperoneTypeExclGroup
exclusive: true}
MyRadioButton {
id: denseRadio
text: qsTr("Dense")
ButtonGroup.group: chaperoneTypeExclGroup
Layout.preferredWidth: 200
onCheckedChanged: {
if(checked){
MyResources.playActivationSound()
ChaperoneTabController.setCollisionBoundStyle(0)
}
}
}
MyRadioButton {
id: medRadio
text: qsTr("Med")
ButtonGroup.group: chaperoneTypeExclGroup
Layout.preferredWidth: 200
onCheckedChanged: {
if(checked){
MyResources.playActivationSound()
ChaperoneTabController.setCollisionBoundStyle(1)
}
}
}
MyRadioButton {
id: squaresRadio
text: qsTr("Squares")
ButtonGroup.group: chaperoneTypeExclGroup
Layout.preferredWidth: 200
onCheckedChanged: {
if(checked){
MyResources.playActivationSound()
ChaperoneTabController.setCollisionBoundStyle(2)
}
}
}
MyRadioButton {
id: sparseRadio
text: qsTr("Sparse")
ButtonGroup.group: chaperoneTypeExclGroup
Layout.preferredWidth: 200
onCheckedChanged: {
if(checked){
MyResources.playActivationSound()
ChaperoneTabController.setCollisionBoundStyle(3)
}
}
}
MyRadioButton {
id: floorRadio
text: qsTr("Floor Only")
ButtonGroup.group: chaperoneTypeExclGroup
Layout.preferredWidth: 200
onCheckedChanged: {
if(checked){
MyResources.playActivationSound()
ChaperoneTabController.setCollisionBoundStyle(4)
}
}
}
}
}
Component.onCompleted: {
// set up var here to prevent double call to c++ from qml
var collisiontype = ChaperoneTabController.collisionBoundStyle
switch(collisiontype){
case 0: denseRadio.checked = true; break;
case 1: medRadio.checked = true; break;
case 2: squaresRadio.checked = true; break;
case 3: sparseRadio.checked = true; break
case 4: floorRadio.checked = true; break;
}
}
Connections {
target: ChaperoneTabController
onCollisionBoundStyleChanged:{
var collisiontype = ChaperoneTabController.collisionBoundStyle
switch(collisiontype){
case 0: denseRadio.checked = true; break;
case 1: medRadio.checked = true; break;
case 2: squaresRadio.checked = true; break;
case 3: sparseRadio.checked = true; break
case 4: floorRadio.checked = true; break;
}
}
}
}
+24
View File
@@ -0,0 +1,24 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import "." // QTBUG-34418, singletons require explicit import to load qmldir file
RadioButton {
hoverEnabled: true
contentItem: MyText {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: parent.text
color: parent.enabled ? "#ffffff" : "#909090"
}
onHoveredChanged: {
if (hovered) {
forceActiveFocus()
} else {
focus = false
}
}
onClicked: {
MyResources.playActivationSound()
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ Slider {
onValueChanged: {
if (activeFocus) {
MyResources.playActivationSound()
//MyResources.playActivationSound()
}
}
}
+6
View File
@@ -9,6 +9,7 @@ import "../video_page"
import "../chaperone_page"
import "../steamvr_page"
import "../rotation_page"
import "../chaperone_page/chaperone_additional"
Rectangle {
id: root
@@ -35,6 +36,11 @@ Rectangle {
visible: false
}
property ChaperoneAdditionalPage chaperoneAdditionalPage: ChaperoneAdditionalPage{
stackView: mainView
visible: false
}
property PlayspacePage playspacePage: PlayspacePage {
stackView: mainView
visible: false
@@ -59,9 +59,6 @@ GroupBox {
onPositionChanged: {
var val = (this.value * 100)
brightnessValueText.text = Math.round(val) + "%"
}
onValueChanged: {
VideoTabController.setBrightnessOpacityValue(value.toFixed(2), true)
}
}
@@ -76,12 +73,13 @@ GroupBox {
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val)) {
if (val < 10) {
val = 10
if (val < 3.0) {
val = 3.0
} else if (val > 100.0) {
val = 100.0
}
var v = (val/100).toFixed(2)
var v = (val/100)
VideoTabController.setBrightnessOpacityValue(v.toFixed(2), true)
brightnessSlider.value = v
}
text = Math.round(VideoTabController.brightnessOpacityValue * 100) + "%"
@@ -91,7 +89,9 @@ GroupBox {
}
Component.onCompleted: {
brightnessSlider.value = VideoTabController.brightnessOpacityValue
var brightvalue = VideoTabController.brightnessOpacityValue
brightnessSlider.value = brightvalue
brightnessValueText.text = Math.round(brightvalue*100)+ "%"
brightnessToggle.checked = VideoTabController.brightnessEnabled
}
@@ -99,7 +99,9 @@ GroupBox {
target: VideoTabController
onBrightnessOpacityValueChanged: {
brightnessSlider.value = VideoTabController.brightnessOpacityValue
var brightvalue = VideoTabController.brightnessOpacityValue
brightnessSlider.value = brightvalue
brightnessValueText.text = Math.round(brightvalue*100)+ "%"
}
onBrightnessEnabledChanged: {
brightnessToggle.checked = VideoTabController.brightnessEnabled
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -370,6 +370,11 @@ private:
SettingCategory::Chaperone,
QtInfo{ "disableChaperone" },
false },
BoolSettingValue{ BoolSetting::CHAPERONE_centerMarkerNew,
SettingCategory::Chaperone,
QtInfo{ "centerMarkerNew" },
false },
BoolSettingValue{ BoolSetting::ROTATION_autoturnEnabled,
SettingCategory::Rotation,
QtInfo{ "autoturnEnabled" },
+1
View File
@@ -49,6 +49,7 @@ enum class BoolSetting
CHAPERONE_chaperoneAlarmSoundAdjustVolume,
CHAPERONE_chaperoneShowDashboardEnabled,
CHAPERONE_disableChaperone,
CHAPERONE_centerMarkerNew,
ROTATION_autoturnEnabled,
ROTATION_autoturnUseCornerAngle,
File diff suppressed because it is too large Load Diff
+84 -6
View File
@@ -11,9 +11,13 @@
#include "../utils/ChaperoneUtils.h"
#include "../settings/settings_object.h"
#include "MoveCenterTabController.h"
#include "../openvr/ovr_overlay_wrapper.h"
#include "../openvr/ovr_settings_wrapper.h"
#include <utility>
class QQuickWindow;
// application namespace
namespace advsettings
{
// forward declaration
@@ -65,6 +69,7 @@ struct ChaperoneProfile : settings::ISettingsObject
float chaperoneAlarmSoundDistance = 0.0f;
bool enableChaperoneShowDashboard = false;
float chaperoneShowDashboardDistance = 0.0f;
bool centerMarkerNew = false;
virtual settings::SettingsObjectData saveSettings() const override
{
@@ -139,6 +144,7 @@ struct ChaperoneProfile : settings::ISettingsObject
o.addValue( static_cast<double>( chaperoneAlarmSoundDistance ) );
o.addValue( enableChaperoneShowDashboard );
o.addValue( static_cast<double>( chaperoneShowDashboardDistance ) );
o.addValue( centerMarkerNew );
return o;
}
@@ -230,6 +236,7 @@ struct ChaperoneProfile : settings::ISettingsObject
enableChaperoneShowDashboard = obj.getNextValueOrDefault( false );
chaperoneShowDashboardDistance
= static_cast<float>( obj.getNextValueOrDefault( 0.0 ) );
centerMarkerNew = obj.getNextValueOrDefault( false );
}
virtual std::string settingsName() const override
@@ -298,7 +305,20 @@ class ChaperoneTabController : public QObject
float chaperoneShowDashboardDistance READ chaperoneShowDashboardDistance
WRITE setChaperoneShowDashboardDistance NOTIFY
chaperoneShowDashboardDistanceChanged )
Q_PROPERTY( int chaperoneColorR READ chaperoneColorR WRITE
setChaperoneColorR NOTIFY chaperoneColorRChanged )
Q_PROPERTY( int chaperoneColorG READ chaperoneColorG WRITE
setChaperoneColorG NOTIFY chaperoneColorGChanged )
Q_PROPERTY( int chaperoneColorB READ chaperoneColorB WRITE
setChaperoneColorB NOTIFY chaperoneColorBChanged )
Q_PROPERTY( int chaperoneColorA READ chaperoneColorA WRITE
setChaperoneColorA NOTIFY chaperoneColorAChanged )
Q_PROPERTY( int collisionBoundStyle READ collisionBoundStyle WRITE
setCollisionBoundStyle NOTIFY collisionBoundStyleChanged )
Q_PROPERTY( bool chaperoneFloorToggle READ chaperoneFloorToggle WRITE
setChaperoneFloorToggle NOTIFY chaperoneFloorToggleChanged )
Q_PROPERTY( bool centerMarkerNew READ centerMarkerNew WRITE
setCenterMarkerNew NOTIFY centerMarkerNewChanged )
private:
OverlayController* parent;
@@ -329,6 +349,14 @@ private:
bool m_leftHapticClickActivated = false;
bool m_rightHapticClickActivated = false;
int m_chaperoneColorR = 0;
int m_chaperoneColorG = 255;
int m_chaperoneColorB = 255;
int m_collisionBoundStyle = 0;
bool m_chaperoneFloorToggle = false;
bool m_autosaveComplete = false;
int m_updateTicksChaperoneReload = 0;
@@ -340,25 +368,53 @@ private:
vr::VRInputValueHandle_t m_leftInputHandle;
vr::VRInputValueHandle_t m_rightInputHandle;
vr::VROverlayHandle_t m_chaperoneFloorOverlayHandle
= vr::k_ulOverlayHandleInvalid;
std::vector<ChaperoneProfile> chaperoneProfiles;
std::string m_floorMarkerFN = "/res/img/chaperone/centermark.png";
void initFloorOverlay();
void updateOverlay();
void updateOverlayColor();
void checkOverlayRotation();
int m_rotationUpdateCounter = 0;
int m_rotationCurrent = 0;
bool m_overlayNeedsUpdate = false;
vr::ETrackingUniverseOrigin m_trackingUniverse
= vr::TrackingUniverseRawAndUncalibrated;
public:
~ChaperoneTabController();
void initStage1();
void initStage2( OverlayController* parent );
void eventLoopTick( vr::TrackedDevicePose_t* devicePoses );
void eventLoopTick( vr::ETrackingUniverseOrigin universe,
vr::TrackedDevicePose_t* devicePoses );
void dashboardLoopTick();
void handleChaperoneWarnings( float distance );
float boundsVisibility() const;
float fadeDistance() const;
float height() const;
bool centerMarker() const;
bool playSpaceMarker() const;
float fadeDistance();
float height();
bool centerMarker();
bool playSpaceMarker();
bool forceBounds() const;
bool disableChaperone() const;
int chaperoneColorR();
int chaperoneColorG();
int chaperoneColorB();
int chaperoneColorA() const;
bool centerMarkerNew();
bool chaperoneFloorToggle();
int collisionBoundStyle();
void setRightHapticActionHandle( vr::VRActionHandle_t handle );
void setLeftHapticActionHandle( vr::VRActionHandle_t handle );
void setRightInputHandle( vr::VRInputValueHandle_t handle );
@@ -419,6 +475,18 @@ public slots:
void setChaperoneShowDashboardEnabled( bool value, bool notify = true );
void setChaperoneShowDashboardDistance( float value, bool notify = true );
void setChaperoneColorR( int value, bool notify = true );
void setChaperoneColorG( int value, bool notify = true );
void setChaperoneColorB( int value, bool notify = true );
void setChaperoneColorA( int value, bool notify = true );
void setCenterMarkerNew( bool value, bool notify = true );
void setCollisionBoundStyle( int value,
bool notify = true,
bool isTemp = false );
void setChaperoneFloorToggle( bool value, bool notify = true );
void flipOrientation( double degrees = 180 );
void reloadFromDisk();
@@ -464,6 +532,16 @@ signals:
void chaperoneShowDashboardEnabledChanged( bool value );
void chaperoneShowDashboardDistanceChanged( float value );
void chaperoneColorRChanged( int value );
void chaperoneColorGChanged( int value );
void chaperoneColorBChanged( int value );
void chaperoneColorAChanged( int value );
void collisionBoundStyleChanged( int value );
void chaperoneFloorToggleChanged( bool value );
void centerMarkerNewChanged( bool value );
void chaperoneProfilesUpdated();
};
+1 -1
View File
@@ -319,7 +319,7 @@ void VideoTabController::setBrightnessOpacityValue( float percvalue,
settings::setSetting( settings::DoubleSetting::VIDEO_brightnessOpacityValue,
static_cast<double>( percvalue ) );
if ( realvalue >= 0.97f || realvalue <= 0.00f )
if ( realvalue >= 0.9999f || realvalue < 0.00f )
{
LOG( WARNING ) << "alpha value is invalid setting to 1.0";
settings::setSetting(