Color overlay adjustment feature (#208)
* perf graph overlay/checkbox added * added toggle Chaperone action * toggle chaperone non-functional * fixed chaperone toggle action const to once * Added Proximity Sensor Action back-end, not implemented via logic Until fixed by valve * added default WMR controller profile * formated * formated steamvrtabcontroller.h * fixed un-intended change * fixed audio profile Bug w/ changed devices * fixed name being used as param instead of ID * fixed loop logic in saveAudioProfile * audio profile fix WIP defaults OVR integration * fixed profile Saves, delete logic and mirror logic needed * fixed QML format, added TODO message * Fixed Audio Profile Behavior * fixed qml reference error * audiodeviceselector changed qml * Removed some comments * changed Visibility slider Minimum to 30% (steamVR minimum allowed) * fixed mirror/playback same issue * fixed Audio device refresh bug, removed currently un-used proximity logic (commented out) * removed dead code * fixed Manifest install/un-install behavior * removed un-used param * color overlay in prog * video overlay basic functions added * fixed qml errors * fixed init order error and chaperone min init error * fixed duplicate button id issue, init issue * fixed log call w/ manifest * removed commented log lines
This commit is contained in:
@@ -39,8 +39,9 @@ DISTFILES += \
|
||||
src/res/qml/audio_page/proximity/* \
|
||||
src/res/qml/audio_page/push_to_talk/* \
|
||||
src/res/qml/audio_page/profiles/* \
|
||||
src/res/qml/video_page/* \
|
||||
src/res/qml/video_page/brightness/* \
|
||||
src/res/qml/video_page/* \
|
||||
src/res/qml/video_page/brightness/* \
|
||||
src/res/qml/video_page/color/* \
|
||||
src/res/qml/common/* \
|
||||
src/res/qml/desktop_overlay_page/* \
|
||||
src/res/qml/desktop_overlay_page/translation_left_right/SteamDesktopTranslationLeftRight.qml \
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -527,8 +527,8 @@ MyStackViewPage {
|
||||
|
||||
Component.onCompleted: {
|
||||
chaperoneVisibilitySlider.value = ChaperoneTabController.boundsVisibility
|
||||
if(chaperoneVisibilitySlider.value < 0.5){
|
||||
chaperoneVisibilitySlider.value = 0.5
|
||||
if(chaperoneVisibilitySlider.value < 0.3){
|
||||
chaperoneVisibilitySlider.value = 0.3
|
||||
}
|
||||
|
||||
var d = ChaperoneTabController.fadeDistance.toFixed(1)
|
||||
|
||||
@@ -449,7 +449,7 @@ MyStackViewPage {
|
||||
MyTextField {
|
||||
id: velModifierText
|
||||
text: "0.00"
|
||||
keyBoardUID: 803
|
||||
keyBoardUID: 804
|
||||
Layout.preferredWidth: 100
|
||||
Layout.leftMargin: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
|
||||
import ovras.advsettings 1.0
|
||||
import "../common"
|
||||
import "brightness"
|
||||
import "color"
|
||||
|
||||
MyStackViewPage {
|
||||
width: 1200
|
||||
@@ -12,7 +13,10 @@ MyStackViewPage {
|
||||
content: ColumnLayout {
|
||||
spacing: 18
|
||||
|
||||
BrightnessGroupBox { }
|
||||
BrightnessGroupBox {
|
||||
id: brightnessGroupBox}
|
||||
ColorGroupBox {
|
||||
id: colorGroupBox}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
|
||||
@@ -69,7 +69,7 @@ GroupBox {
|
||||
MyTextField {
|
||||
id: brightnessValueText
|
||||
text: "100%"
|
||||
keyBoardUID: 301
|
||||
keyBoardUID: 901
|
||||
Layout.preferredWidth: 100
|
||||
Layout.leftMargin: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import ovras.advsettings 1.0
|
||||
import "../../common"
|
||||
|
||||
GroupBox {
|
||||
id: brightnessGroupBox
|
||||
Layout.fillWidth: true
|
||||
|
||||
label: MyText {
|
||||
leftPadding: 10
|
||||
text: "Color Adjustment"
|
||||
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 {
|
||||
Layout.fillWidth: true
|
||||
|
||||
MyToggleButton {
|
||||
id: colorToggle
|
||||
text: "Toggle On/Off"
|
||||
onCheckedChanged: {
|
||||
VideoTabController.setColorEnabled(this.checked, false) }
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 150
|
||||
}
|
||||
|
||||
MyText {
|
||||
text: "Opacity:"
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.rightMargin: 10
|
||||
}
|
||||
|
||||
MySlider {
|
||||
id: colorOpacitySlider
|
||||
from: 0.5
|
||||
to: 1.0
|
||||
stepSize: 0.01
|
||||
value: 1.0
|
||||
Layout.fillWidth: true
|
||||
onPositionChanged: {
|
||||
var val = ((this.position * 100)/2 + 50)
|
||||
colorOpacityText.text = Math.round(val) + "%"
|
||||
}
|
||||
onValueChanged: {
|
||||
|
||||
VideoTabController.setColorOpacityPerc(value.toFixed(2), false)
|
||||
}
|
||||
}
|
||||
|
||||
MyTextField {
|
||||
id: colorOpacityText
|
||||
text: "100%"
|
||||
keyBoardUID: 911
|
||||
Layout.preferredWidth: 100
|
||||
Layout.leftMargin: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
function onInputEvent(input) {
|
||||
var val = parseFloat(input)
|
||||
if (!isNaN(val)) {
|
||||
if (val < 50) {
|
||||
val = 50
|
||||
} else if (val > 100.0) {
|
||||
val = 100.0
|
||||
}
|
||||
var v = (val/100).toFixed(2)
|
||||
colorOpacitySlider.value = v
|
||||
}
|
||||
text = Math.round(VideoTabController.colorOpacityPerc * 100) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
MyText {
|
||||
text: "Red:"
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.preferredWidth: 200
|
||||
}
|
||||
|
||||
MySlider {
|
||||
id: colorRedSlider
|
||||
from: 0.01
|
||||
to: 1.0
|
||||
stepSize: 0.01
|
||||
value: 1.0
|
||||
Layout.fillWidth: true
|
||||
onPositionChanged: {
|
||||
var val = (this.position * 100)
|
||||
colorRedText.text = Math.round(val) + "%"
|
||||
}
|
||||
onValueChanged: {
|
||||
|
||||
VideoTabController.setColorRed(value.toFixed(2), false)
|
||||
}
|
||||
}
|
||||
|
||||
MyTextField {
|
||||
id: colorRedText
|
||||
text: "100%"
|
||||
keyBoardUID: 912
|
||||
Layout.preferredWidth: 100
|
||||
Layout.leftMargin: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
function onInputEvent(input) {
|
||||
var val = parseFloat(input)
|
||||
if (!isNaN(val)) {
|
||||
if (val < 5) {
|
||||
val = 5
|
||||
} else if (val > 100.0) {
|
||||
val = 100.0
|
||||
}
|
||||
var v = (val/100).toFixed(2)
|
||||
colorRedSlider.value = v
|
||||
}
|
||||
text = Math.round(VideoTabController.colorRed * 100) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
MyText {
|
||||
text: "Green:"
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.preferredWidth: 200
|
||||
}
|
||||
|
||||
MySlider {
|
||||
id: colorGreenSlider
|
||||
from: 0.01
|
||||
to: 1.0
|
||||
stepSize: 0.01
|
||||
value: 1.0
|
||||
Layout.fillWidth: true
|
||||
onPositionChanged: {
|
||||
var val = (this.position * 100)
|
||||
colorGreenText.text = Math.round(val) + "%"
|
||||
}
|
||||
onValueChanged: {
|
||||
|
||||
VideoTabController.setColorGreen(value.toFixed(2), false)
|
||||
}
|
||||
}
|
||||
|
||||
MyTextField {
|
||||
id: colorGreenText
|
||||
text: "100%"
|
||||
keyBoardUID: 913
|
||||
Layout.preferredWidth: 100
|
||||
Layout.leftMargin: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
function onInputEvent(input) {
|
||||
var val = parseFloat(input)
|
||||
if (!isNaN(val)) {
|
||||
if (val < 5) {
|
||||
val = 5
|
||||
} else if (val > 100.0) {
|
||||
val = 100.0
|
||||
}
|
||||
var v = (val/100).toFixed(2)
|
||||
colorGreenSlider.value = v
|
||||
}
|
||||
text = Math.round(VideoTabController.colorGreen * 100) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
MyText {
|
||||
text: "Blue:"
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.preferredWidth: 200
|
||||
}
|
||||
|
||||
MySlider {
|
||||
id: colorBlueSlider
|
||||
from: 0.01
|
||||
to: 1.0
|
||||
stepSize: 0.01
|
||||
value: 1.0
|
||||
Layout.fillWidth: true
|
||||
onPositionChanged: {
|
||||
var val = (this.position * 100)
|
||||
colorBlueText.text = Math.round(val) + "%"
|
||||
}
|
||||
onValueChanged: {
|
||||
|
||||
VideoTabController.setColorBlue(value.toFixed(2), false)
|
||||
}
|
||||
}
|
||||
|
||||
MyTextField {
|
||||
id: colorBlueText
|
||||
text: "100%"
|
||||
keyBoardUID: 914
|
||||
Layout.preferredWidth: 100
|
||||
Layout.leftMargin: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
function onInputEvent(input) {
|
||||
var val = parseFloat(input)
|
||||
if (!isNaN(val)) {
|
||||
if (val < 5) {
|
||||
val = 5
|
||||
} else if (val > 100.0) {
|
||||
val = 100.0
|
||||
}
|
||||
var v = (val/100).toFixed(2)
|
||||
colorBlueSlider.value = v
|
||||
}
|
||||
text = Math.round(VideoTabController.colorBlue * 100) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
colorOpacitySlider.value = VideoTabController.colorOpacityPerc
|
||||
colorToggle.checked = VideoTabController.colorEnabled
|
||||
colorRedSlider.value = VideoTabController.colorRed
|
||||
colorGreenSlider.value = VideoTabController.colorGreen
|
||||
colorBlueSlider.value = VideoTabController.colorBlue
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: VideoTabController
|
||||
|
||||
onColorOpacityPercChanged: {
|
||||
colorOpacitySlider.value = VideoTabController.colorOpacityPerc
|
||||
}
|
||||
onColorEnabledChanged: {
|
||||
colorToggle.checked = VideoTabController.colorEnabled
|
||||
}
|
||||
onColorRedChanged:{
|
||||
colorRedSlider.value = VideoTabController.colorRed
|
||||
}
|
||||
onColorGreenChanged:{
|
||||
colorGreenSlider.value = VideoTabController.colorGreen
|
||||
}
|
||||
onColorBlueChanged:{
|
||||
colorBlueSlider.value = VideoTabController.colorBlue
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,25 @@
|
||||
|
||||
namespace advsettings
|
||||
{
|
||||
void VideoTabController::initStage1() {}
|
||||
void VideoTabController::initStage1()
|
||||
{
|
||||
initBrightnessOverlay();
|
||||
initColorOverlay();
|
||||
m_overlayInit = true;
|
||||
reloadVideoConfig();
|
||||
}
|
||||
|
||||
void VideoTabController::initStage2( OverlayController* var_parent,
|
||||
QQuickWindow* var_widget )
|
||||
{
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void VideoTabController::initBrightnessOverlay()
|
||||
{
|
||||
std::string notifKey = std::string( application_strings::applicationKey )
|
||||
+ ".dimnotification";
|
||||
+ ".brightnessoverlay";
|
||||
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(
|
||||
notifKey.c_str(), notifKey.c_str(), &m_brightnessOverlayHandle );
|
||||
@@ -40,18 +49,57 @@ void VideoTabController::initStage2( OverlayController* var_parent,
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( ERROR ) << "Could not find notification icon \""
|
||||
LOG( ERROR ) << "Could not find brightness overlay \""
|
||||
<< video_keys::k_brightnessOverlayFilename << "\"";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( ERROR ) << "Could not create dimmer notification overlay: "
|
||||
LOG( ERROR ) << "Could not create brightness overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
}
|
||||
void VideoTabController::initColorOverlay()
|
||||
{
|
||||
std::string notifKey
|
||||
= std::string( application_strings::applicationKey ) + ".coloroverlay";
|
||||
|
||||
reloadVideoConfig();
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay(
|
||||
notifKey.c_str(), notifKey.c_str(), &m_colorOverlayHandle );
|
||||
if ( overlayError == vr::VROverlayError_None )
|
||||
{
|
||||
const auto notifIconPath = paths::binaryDirectoryFindFile(
|
||||
video_keys::k_colorOverlayFilename );
|
||||
if ( notifIconPath.has_value() )
|
||||
{
|
||||
vr::VROverlay()->SetOverlayFromFile( m_colorOverlayHandle,
|
||||
notifIconPath->c_str() );
|
||||
vr::VROverlay()->SetOverlayWidthInMeters( m_colorOverlayHandle,
|
||||
k_overlayWidth );
|
||||
// position it just slightly further out so we don't have to worry
|
||||
// about render order.
|
||||
vr::HmdMatrix34_t notificationTransform
|
||||
= { { { 1.0f, 0.0f, 0.0f, 0.00f },
|
||||
{ 0.0f, 1.0f, 0.0f, 0.00f },
|
||||
{ 0.0f, 0.0f, 1.0f, ( k_hmdDistance - 0.01f ) } } };
|
||||
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(
|
||||
m_colorOverlayHandle,
|
||||
vr::k_unTrackedDeviceIndex_Hmd,
|
||||
¬ificationTransform );
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( ERROR ) << "Could not find Base color overlay: \""
|
||||
<< video_keys::k_colorOverlayFilename << "\"";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( ERROR ) << "Could not create color overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::eventLoopTick() {}
|
||||
@@ -62,10 +110,21 @@ void VideoTabController::reloadVideoConfig()
|
||||
settings->beginGroup( getSettingsName() );
|
||||
setBrightnessEnabled(
|
||||
settings->value( "brightnessEnabled", false ).toBool(), true );
|
||||
m_opacityValue = settings->value( "opacityValue", 0.0f ).toFloat();
|
||||
m_brightnessOpacityValue
|
||||
= settings->value( "brightnessOpacityValue", 0.0f ).toFloat();
|
||||
m_brightnessValue = settings->value( "brightnessValue", 1.0f ).toFloat();
|
||||
setColorEnabled( settings->value( "colorEnabled", false ).toBool(), true );
|
||||
m_colorOpacity = settings->value( "colorOpacity", 0.0f ).toFloat();
|
||||
m_colorOpacityPerc = settings->value( "colorOpacityPerc", 1.0f ).toFloat();
|
||||
setColorRed( settings->value( "colorRed", 0.0f ).toFloat() );
|
||||
setColorGreen( settings->value( "colorGreen", 0.0f ).toFloat() );
|
||||
setColorBlue( settings->value( "colorBlue", 0.0f ).toFloat() );
|
||||
settings->endGroup();
|
||||
setOpacityValue();
|
||||
LOG( INFO ) << "bright opacityValue: " << m_brightnessOpacityValue
|
||||
<< " REd value is: " << m_colorRed;
|
||||
setBrightnessOpacityValue();
|
||||
loadColorOverlay();
|
||||
settings->sync();
|
||||
}
|
||||
|
||||
void VideoTabController::saveVideoConfig()
|
||||
@@ -73,14 +132,21 @@ void VideoTabController::saveVideoConfig()
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( getSettingsName() );
|
||||
settings->setValue( "brightnessEnabled", brightnessEnabled() );
|
||||
settings->setValue( "opacityValue", opacityValue() );
|
||||
settings->setValue( "brightnessOpacityValue", brightnessOpacityValue() );
|
||||
settings->setValue( "brightnessValue", brightnessValue() );
|
||||
settings->setValue( "colorEnabled", colorEnabled() );
|
||||
settings->setValue( "colorOpacity", colorOpacity() );
|
||||
settings->setValue( "colorOpacityPerc", colorOpacityPerc() );
|
||||
settings->setValue( "colorRed", colorRed() );
|
||||
settings->setValue( "colorGreen", colorGreen() );
|
||||
settings->setValue( "colorBlue", colorBlue() );
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
}
|
||||
|
||||
float VideoTabController::opacityValue() const
|
||||
float VideoTabController::brightnessOpacityValue() const
|
||||
{
|
||||
return m_opacityValue;
|
||||
return m_brightnessOpacityValue;
|
||||
}
|
||||
|
||||
float VideoTabController::brightnessValue() const
|
||||
@@ -130,12 +196,12 @@ void VideoTabController::setBrightnessValue( float percvalue, bool notify )
|
||||
float realvalue = static_cast<float>(
|
||||
std::pow( static_cast<double>( 1.0f - percvalue ), 1 / 3. ) );
|
||||
|
||||
if ( realvalue != m_opacityValue )
|
||||
if ( realvalue != m_brightnessOpacityValue )
|
||||
{
|
||||
m_brightnessValue = percvalue;
|
||||
if ( realvalue <= 1.0f && realvalue >= 0.0f )
|
||||
{
|
||||
m_opacityValue = realvalue;
|
||||
m_brightnessOpacityValue = realvalue;
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayAlpha(
|
||||
m_brightnessOverlayHandle, realvalue );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
@@ -150,7 +216,7 @@ void VideoTabController::setBrightnessValue( float percvalue, bool notify )
|
||||
else
|
||||
{
|
||||
LOG( WARNING ) << "alpha value is invalid setting to 1.0";
|
||||
m_opacityValue = 0.0f;
|
||||
m_brightnessOpacityValue = 0.0f;
|
||||
}
|
||||
|
||||
if ( notify )
|
||||
@@ -160,10 +226,10 @@ void VideoTabController::setBrightnessValue( float percvalue, bool notify )
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::setOpacityValue()
|
||||
void VideoTabController::setBrightnessOpacityValue()
|
||||
{
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayAlpha(
|
||||
m_brightnessOverlayHandle, m_opacityValue );
|
||||
m_brightnessOverlayHandle, m_brightnessOpacityValue );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set alpha: "
|
||||
@@ -172,4 +238,221 @@ void VideoTabController::setOpacityValue()
|
||||
}
|
||||
emit brightnessValueChanged( m_brightnessValue );
|
||||
}
|
||||
|
||||
/*
|
||||
* -------------------------
|
||||
* Color Overlay
|
||||
* -------------------------
|
||||
*/
|
||||
|
||||
// getters
|
||||
bool VideoTabController::colorEnabled() const
|
||||
{
|
||||
return m_colorEnabled;
|
||||
}
|
||||
|
||||
float VideoTabController::colorOpacity() const
|
||||
{
|
||||
return m_colorOpacity;
|
||||
}
|
||||
|
||||
float VideoTabController::colorOpacityPerc() const
|
||||
{
|
||||
return m_colorOpacityPerc;
|
||||
}
|
||||
|
||||
float VideoTabController::colorRed() const
|
||||
{
|
||||
return m_colorRed;
|
||||
}
|
||||
|
||||
float VideoTabController::colorGreen() const
|
||||
{
|
||||
return m_colorGreen;
|
||||
}
|
||||
|
||||
float VideoTabController::colorBlue() const
|
||||
{
|
||||
return m_colorBlue;
|
||||
}
|
||||
|
||||
// setters
|
||||
void VideoTabController::setColorEnabled( bool value, bool notify )
|
||||
{
|
||||
if ( value != m_colorEnabled )
|
||||
{
|
||||
m_colorEnabled = value;
|
||||
auto overlayHandle = getColorOverlayHandle();
|
||||
if ( value )
|
||||
{
|
||||
if ( overlayHandle != vr::k_ulOverlayHandleInvalid )
|
||||
{
|
||||
vr::VROverlay()->ShowOverlay( getColorOverlayHandle() );
|
||||
LOG( INFO ) << "Color Overlay toggled on";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( overlayHandle != vr::k_ulOverlayHandleInvalid )
|
||||
{
|
||||
vr::VROverlay()->HideOverlay( getColorOverlayHandle() );
|
||||
LOG( INFO ) << "Color Overlay toggled off";
|
||||
}
|
||||
}
|
||||
saveVideoConfig();
|
||||
if ( notify )
|
||||
{
|
||||
emit colorEnabledChanged( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::setColorOpacity( float value, bool notify )
|
||||
{
|
||||
if ( value != m_colorOpacity )
|
||||
{
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayAlpha(
|
||||
m_colorOverlayHandle, m_colorOpacity );
|
||||
m_colorOpacity = value;
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set alpha for color overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
saveVideoConfig();
|
||||
if ( notify )
|
||||
{
|
||||
emit colorOpacityChanged( m_colorOpacity );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::setColorRed( float value, bool notify )
|
||||
{
|
||||
if ( value != m_colorRed )
|
||||
{
|
||||
m_colorRed = value;
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayColor(
|
||||
m_colorOverlayHandle, m_colorRed, m_colorGreen, m_colorBlue );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set Red for color overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
saveVideoConfig();
|
||||
if ( notify )
|
||||
{
|
||||
emit colorRedChanged( m_colorRed );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::setColorGreen( float value, bool notify )
|
||||
{
|
||||
if ( value != m_colorGreen )
|
||||
{
|
||||
m_colorGreen = value;
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayColor(
|
||||
m_colorOverlayHandle, m_colorRed, m_colorGreen, m_colorBlue );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set Green for color overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
saveVideoConfig();
|
||||
if ( notify )
|
||||
{
|
||||
emit colorGreenChanged( m_colorGreen );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::setColorBlue( float value, bool notify )
|
||||
{
|
||||
if ( value != m_colorBlue )
|
||||
{
|
||||
m_colorBlue = value;
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayColor(
|
||||
m_colorOverlayHandle, m_colorRed, m_colorGreen, m_colorBlue );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set Blue for color overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
saveVideoConfig();
|
||||
if ( notify )
|
||||
{
|
||||
emit colorBlueChanged( m_colorBlue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::loadColorOverlay()
|
||||
{
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayColor(
|
||||
m_colorOverlayHandle, m_colorRed, m_colorGreen, m_colorBlue );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set Colors for color overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
|
||||
overlayError = vr::VROverlay()->SetOverlayAlpha( m_colorOverlayHandle,
|
||||
m_colorOpacity );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set alpha: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
}
|
||||
|
||||
void VideoTabController::setColorOpacityPerc( float percvalue, bool notify )
|
||||
{
|
||||
// This takes the Perceived value, and converts it to allow more accurate
|
||||
// linear positioning. (human perception logarithmic)
|
||||
|
||||
// clamp the "percieved" value to 50% this is to ensure useability.
|
||||
if ( percvalue <= 0.5f )
|
||||
{
|
||||
percvalue = 0.5f;
|
||||
}
|
||||
float realvalue = static_cast<float>(
|
||||
std::pow( static_cast<double>( 1.0f - percvalue ), 0.5555f ) );
|
||||
|
||||
if ( realvalue != m_colorOpacity )
|
||||
{
|
||||
m_colorOpacityPerc = percvalue;
|
||||
if ( realvalue <= 1.0f && realvalue >= 0.0f )
|
||||
{
|
||||
m_colorOpacity = realvalue;
|
||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayAlpha(
|
||||
m_colorOverlayHandle, realvalue );
|
||||
if ( overlayError != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR ) << "Could not set alpha of color overlay: "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
overlayError );
|
||||
}
|
||||
// only saves if opacity Value is valid. [1-0]
|
||||
saveVideoConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( WARNING ) << "alpha value is invalid setting to 1.0";
|
||||
m_brightnessOpacityValue = 0.0f;
|
||||
}
|
||||
|
||||
if ( notify )
|
||||
{
|
||||
emit brightnessValueChanged( percvalue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
@@ -10,6 +10,7 @@ class QQuickWindow;
|
||||
namespace video_keys
|
||||
{
|
||||
constexpr auto k_brightnessOverlayFilename = "/res/img/video/dimmer.png";
|
||||
constexpr auto k_colorOverlayFilename = "/res/img/video/color.png";
|
||||
|
||||
} // namespace video_keys
|
||||
|
||||
@@ -25,24 +26,54 @@ class VideoTabController : public QObject
|
||||
setBrightnessEnabled NOTIFY brightnessEnabledChanged )
|
||||
Q_PROPERTY( float brightnessValue READ brightnessValue WRITE
|
||||
setBrightnessValue NOTIFY brightnessValueChanged )
|
||||
Q_PROPERTY( bool colorEnabled READ colorEnabled WRITE setColorEnabled NOTIFY
|
||||
colorEnabledChanged )
|
||||
Q_PROPERTY( float colorOpacity READ colorOpacity WRITE setColorOpacity
|
||||
NOTIFY colorOpacityChanged )
|
||||
Q_PROPERTY( float colorOpacityPerc READ colorOpacityPerc WRITE
|
||||
setColorOpacityPerc NOTIFY colorOpacityPercChanged )
|
||||
Q_PROPERTY(
|
||||
float colorRed READ colorRed WRITE setColorRed NOTIFY colorRedChanged )
|
||||
Q_PROPERTY( float colorGreen READ colorGreen WRITE setColorGreen NOTIFY
|
||||
colorGreenChanged )
|
||||
Q_PROPERTY( float colorBlue READ colorBlue WRITE setColorBlue NOTIFY
|
||||
colorBlueChanged )
|
||||
|
||||
private:
|
||||
// how far away the overlay is, any OVERLAY closer will not be dimmed.
|
||||
const float k_hmdDistance = -0.15f;
|
||||
// how wide overlay is, Increase this value if edges of view are not dimmed.
|
||||
// how wide overlay is, Increase this value if edges of view are not
|
||||
// dimmed.
|
||||
const float k_overlayWidth = 1.0f;
|
||||
OverlayController* parent;
|
||||
QQuickWindow* widget;
|
||||
|
||||
vr::VROverlayHandle_t m_brightnessOverlayHandle
|
||||
= vr::k_ulOverlayHandleInvalid;
|
||||
float m_opacityValue = 0.0f;
|
||||
|
||||
vr::VROverlayHandle_t m_colorOverlayHandle = vr::k_ulOverlayHandleInvalid;
|
||||
|
||||
float m_brightnessOpacityValue = 0.0f;
|
||||
float m_brightnessValue = 1.0f;
|
||||
bool m_brightnessEnabled = false;
|
||||
|
||||
// color member vars
|
||||
bool m_colorEnabled = false;
|
||||
float m_colorOpacity = 1.0f;
|
||||
float m_colorOpacityPerc = 0.0f;
|
||||
float m_colorRed = 0.0f;
|
||||
float m_colorBlue = 0.0f;
|
||||
float m_colorGreen = 0.0f;
|
||||
bool m_overlayInit = false;
|
||||
|
||||
void reloadVideoConfig();
|
||||
void saveVideoConfig();
|
||||
void setOpacityValue();
|
||||
void setBrightnessOpacityValue();
|
||||
|
||||
void initBrightnessOverlay();
|
||||
void initColorOverlay();
|
||||
|
||||
void loadColorOverlay();
|
||||
|
||||
QString getSettingsName()
|
||||
{
|
||||
@@ -54,12 +85,25 @@ private:
|
||||
return m_brightnessOverlayHandle;
|
||||
}
|
||||
|
||||
vr::VROverlayHandle_t getColorOverlayHandle()
|
||||
{
|
||||
return m_colorOverlayHandle;
|
||||
}
|
||||
|
||||
public:
|
||||
float opacityValue() const;
|
||||
float brightnessOpacityValue() const;
|
||||
// inverse of brightnessValue
|
||||
float brightnessValue() const;
|
||||
bool brightnessEnabled() const;
|
||||
|
||||
// Color overlay Getters
|
||||
bool colorEnabled() const;
|
||||
float colorOpacity() const;
|
||||
float colorRed() const;
|
||||
float colorGreen() const;
|
||||
float colorBlue() const;
|
||||
float colorOpacityPerc() const;
|
||||
|
||||
void initStage1();
|
||||
void initStage2( OverlayController* var_parent, QQuickWindow* var_widget );
|
||||
void eventLoopTick();
|
||||
@@ -68,9 +112,24 @@ public slots:
|
||||
void setBrightnessEnabled( bool value, bool notify = true );
|
||||
void setBrightnessValue( float percvalue, bool notify = true );
|
||||
|
||||
// Color overlay Setters
|
||||
void setColorEnabled( bool value, bool notify = true );
|
||||
void setColorOpacity( float value, bool notify = true );
|
||||
void setColorRed( float value, bool notify = true );
|
||||
void setColorGreen( float value, bool notify = true );
|
||||
void setColorBlue( float value, bool notify = true );
|
||||
void setColorOpacityPerc( float value, bool notify = true );
|
||||
|
||||
signals:
|
||||
void brightnessEnabledChanged( bool value );
|
||||
void brightnessValueChanged( float value );
|
||||
|
||||
void colorEnabledChanged( bool value );
|
||||
void colorOpacityChanged( float value );
|
||||
void colorRedChanged( float value );
|
||||
void colorGreenChanged( float value );
|
||||
void colorBlueChanged( float value );
|
||||
void colorOpacityPercChanged( float value );
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
} // namespace advsettings
|
||||
|
||||
+2
-6
@@ -120,12 +120,8 @@ void installApplicationManifest( const std::string manifestPath )
|
||||
if ( vr::VRApplications()->IsApplicationInstalled(
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
LOG( ERROR ) << "Manifest Is already Installed for Key "
|
||||
<< application_strings::applicationKey;
|
||||
LOG( ERROR ) << "You may have installed Advanced Settings in another "
|
||||
"directory please remove it OR"
|
||||
" manually delete the manifest install in in Steam "
|
||||
"install at Steam\\config\\appconfig.json";
|
||||
LOG( INFO ) << "Manifest Is already Installed for Key "
|
||||
<< application_strings::applicationKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user