Fix default Brightness value/behavior adds shutdown button (#412)
* added exit button * fixed visible state * added shutdown button fixed default brightness issues * fixed compiler warning
This commit is contained in:
+21
-13
@@ -327,6 +327,24 @@ OverlayController::~OverlayController()
|
|||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverlayController::exitApp()
|
||||||
|
{
|
||||||
|
settings::saveAllSettings();
|
||||||
|
|
||||||
|
m_moveCenterTabController.shutdown();
|
||||||
|
// Un-mute mic before Exiting VR, as it is set at system level Not
|
||||||
|
// Vr level.
|
||||||
|
// m_audioTabController.setMicMuted( false, false );
|
||||||
|
m_audioTabController.shutdown();
|
||||||
|
m_chaperoneTabController.shutdown();
|
||||||
|
Shutdown();
|
||||||
|
QApplication::exit();
|
||||||
|
|
||||||
|
LOG( INFO ) << "All systems exited.";
|
||||||
|
exit( EXIT_SUCCESS );
|
||||||
|
// Does not fallthrough
|
||||||
|
}
|
||||||
|
|
||||||
void OverlayController::Shutdown()
|
void OverlayController::Shutdown()
|
||||||
{
|
{
|
||||||
disconnect( &m_pumpEventsTimer,
|
disconnect( &m_pumpEventsTimer,
|
||||||
@@ -1004,20 +1022,10 @@ void OverlayController::mainEventLoop()
|
|||||||
vr::VRSystem()->AcknowledgeQuit_Exiting(); // Let us buy some
|
vr::VRSystem()->AcknowledgeQuit_Exiting(); // Let us buy some
|
||||||
// time just in case
|
// time just in case
|
||||||
|
|
||||||
settings::saveAllSettings();
|
exitApp();
|
||||||
|
// Won't fallthrough, but also exitApp() wont, but QT won't
|
||||||
m_moveCenterTabController.shutdown();
|
// acknowledge
|
||||||
// Un-mute mic before Exiting VR, as it is set at system level Not
|
|
||||||
// Vr level.
|
|
||||||
// m_audioTabController.setMicMuted( false, false );
|
|
||||||
m_audioTabController.shutdown();
|
|
||||||
m_chaperoneTabController.shutdown();
|
|
||||||
Shutdown();
|
|
||||||
QApplication::exit();
|
|
||||||
|
|
||||||
LOG( INFO ) << "All systems exited.";
|
|
||||||
exit( EXIT_SUCCESS );
|
exit( EXIT_SUCCESS );
|
||||||
// Does not fallthrough
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case vr::VREvent_DashboardActivated:
|
case vr::VREvent_DashboardActivated:
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ public:
|
|||||||
virtual ~OverlayController();
|
virtual ~OverlayController();
|
||||||
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
Q_INVOKABLE void exitApp();
|
||||||
|
|
||||||
bool isDashboardVisible()
|
bool isDashboardVisible()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,17 +156,32 @@ MyStackViewPage {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RowLayout{
|
||||||
|
|
||||||
MyText {
|
MyText {
|
||||||
id: seatedOldExternalWarning
|
id: seatedOldExternalWarning
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
font.pointSize: 20
|
font.pointSize: 20
|
||||||
color: "#FFA500"
|
color: "#FFA500"
|
||||||
text: "WARNING: 'Allow External App Chaperone Edits' + 'Old-Style Motion' + 'Enable Motion Features When in Seated Mode' active together may cause space center misalignment. Load the «Autosaved Profile» in the 'Chaperone' tab to fix."
|
text: "WARNING: 'Allow External App Chaperone Edits' + 'Old-Style Motion' + 'Enable Motion Features When in Seated Mode' active together may cause space center misalignment. Load the «Autosaved Profile» in the 'Chaperone' tab to fix."
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
Layout.rightMargin: 20
|
Layout.rightMargin: 20
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RowLayout{
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
MyPushButton {
|
||||||
|
id: shutdownButton
|
||||||
|
Layout.preferredWidth: 250
|
||||||
|
text: "Shutdown OVRAS"
|
||||||
|
onClicked: {
|
||||||
|
OverlayController.exitApp()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -175,14 +190,15 @@ MyStackViewPage {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
// set visible to true here in builds when we need a debug toggle checkbox, otherwise false when on master branch.
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
MyToggleButton {
|
MyToggleButton {
|
||||||
|
// set visible to true here in builds when we need a debug toggle checkbox, otherwise false when on master branch.
|
||||||
|
visible: false
|
||||||
id: debugToggle
|
id: debugToggle
|
||||||
text: "Debug"
|
text: "Debug"
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ GroupBox {
|
|||||||
|
|
||||||
MySlider {
|
MySlider {
|
||||||
id: brightnessSlider
|
id: brightnessSlider
|
||||||
from: 0.01
|
from: 0.10
|
||||||
to: 1.0
|
to: 1.0
|
||||||
stepSize: 0.01
|
stepSize: 0.01
|
||||||
value: 1.0
|
value: 1.0
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ void VideoTabController::initBrightnessOverlay()
|
|||||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||||
overlayError );
|
overlayError );
|
||||||
}
|
}
|
||||||
|
setBrightnessOpacityValue( brightnessOpacityValue(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoTabController::initColorOverlay()
|
void VideoTabController::initColorOverlay()
|
||||||
@@ -286,6 +287,7 @@ void VideoTabController::setBrightnessEnabled( bool value,
|
|||||||
{
|
{
|
||||||
if ( overlayHandle != vr::k_ulOverlayHandleInvalid )
|
if ( overlayHandle != vr::k_ulOverlayHandleInvalid )
|
||||||
{
|
{
|
||||||
|
setBrightnessOpacityValue( brightnessOpacityValue(), false );
|
||||||
vr::VROverlay()->ShowOverlay( getBrightnessOverlayHandle() );
|
vr::VROverlay()->ShowOverlay( getBrightnessOverlayHandle() );
|
||||||
LOG( INFO ) << "Brightness Overlay toggled on";
|
LOG( INFO ) << "Brightness Overlay toggled on";
|
||||||
}
|
}
|
||||||
@@ -314,35 +316,28 @@ void VideoTabController::setBrightnessOpacityValue( float percvalue,
|
|||||||
float realvalue = static_cast<float>(
|
float realvalue = static_cast<float>(
|
||||||
std::pow( static_cast<double>( 1.0f - percvalue ), 1 / 3. ) );
|
std::pow( static_cast<double>( 1.0f - percvalue ), 1 / 3. ) );
|
||||||
|
|
||||||
if ( fabs( static_cast<double>( percvalue - brightnessOpacityValue() ) )
|
settings::setSetting( settings::DoubleSetting::VIDEO_brightnessOpacityValue,
|
||||||
> .005 )
|
static_cast<double>( percvalue ) );
|
||||||
|
|
||||||
|
if ( realvalue >= 0.97f || realvalue <= 0.00f )
|
||||||
{
|
{
|
||||||
|
LOG( WARNING ) << "alpha value is invalid setting to 1.0";
|
||||||
settings::setSetting(
|
settings::setSetting(
|
||||||
settings::DoubleSetting::VIDEO_brightnessOpacityValue,
|
settings::DoubleSetting::VIDEO_brightnessOpacityValue, 1.0 );
|
||||||
static_cast<double>( percvalue ) );
|
realvalue = 0;
|
||||||
|
}
|
||||||
|
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayAlpha(
|
||||||
|
m_brightnessOverlayHandle, realvalue );
|
||||||
|
if ( overlayError != vr::VROverlayError_None )
|
||||||
|
{
|
||||||
|
LOG( ERROR ) << "Could not set alpha for brightness overlay: "
|
||||||
|
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||||
|
overlayError );
|
||||||
|
}
|
||||||
|
|
||||||
if ( realvalue <= 1.0f && realvalue >= 0.00f )
|
if ( notify )
|
||||||
{
|
{
|
||||||
vr::VROverlayError overlayError = vr::VROverlay()->SetOverlayAlpha(
|
emit brightnessOpacityValueChanged( percvalue );
|
||||||
m_brightnessOverlayHandle, realvalue );
|
|
||||||
if ( overlayError != vr::VROverlayError_None )
|
|
||||||
{
|
|
||||||
LOG( ERROR ) << "Could not set alpha for brightness overlay: "
|
|
||||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
|
||||||
overlayError );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG( WARNING ) << "alpha value is invalid setting to 1.0";
|
|
||||||
settings::setSetting(
|
|
||||||
settings::DoubleSetting::VIDEO_brightnessOpacityValue, 0.0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( notify )
|
|
||||||
{
|
|
||||||
emit brightnessOpacityValueChanged( percvalue );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user