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:
@@ -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
|
||||
Reference in New Issue
Block a user