merged master to brightness
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
{
|
||||
class AudioTabController;
|
||||
|
||||
class KeyboardInput
|
||||
{
|
||||
public:
|
||||
virtual ~KeyboardInput() {}
|
||||
|
||||
virtual void sendKeyboardInput( QString input ) = 0;
|
||||
virtual void sendKeyboardEnter() = 0;
|
||||
virtual void sendKeyboardBackspace( const int count ) = 0;
|
||||
virtual void sendKeyboardAltTab() = 0;
|
||||
virtual void sendKeyboardAltEnter() = 0;
|
||||
virtual void sendMediaNextSong() = 0;
|
||||
virtual void sendMediaPreviousSong() = 0;
|
||||
virtual void sendMediaPausePlay() = 0;
|
||||
virtual void sendMediaStopSong() = 0;
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
@@ -118,6 +118,16 @@ void MoveCenterTabController::initStage1()
|
||||
{
|
||||
m_lockZToggle = value.toBool();
|
||||
}
|
||||
value = settings->value( "showLogMatricesButton", m_showLogMatricesButton );
|
||||
if ( value.isValid() && !value.isNull() )
|
||||
{
|
||||
m_showLogMatricesButton = value.toBool();
|
||||
}
|
||||
value = settings->value( "allowExternalEdits", m_allowExternalEdits );
|
||||
if ( value.isValid() && !value.isNull() )
|
||||
{
|
||||
m_allowExternalEdits = value.toBool();
|
||||
}
|
||||
settings->endGroup();
|
||||
m_lastDragUpdateTimePoint = std::chrono::steady_clock::now();
|
||||
m_lastGravityUpdateTimePoint = std::chrono::steady_clock::now();
|
||||
@@ -131,6 +141,109 @@ void MoveCenterTabController::initStage2( OverlayController* var_parent,
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void MoveCenterTabController::outputLogPoses()
|
||||
{
|
||||
vr::TrackedDevicePose_t devicePosesStanding[vr::k_unMaxTrackedDeviceCount];
|
||||
|
||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||
vr::TrackingUniverseStanding,
|
||||
0.0f,
|
||||
devicePosesStanding,
|
||||
vr::k_unMaxTrackedDeviceCount );
|
||||
|
||||
vr::HmdMatrix34_t hmdStanding
|
||||
= devicePosesStanding[0].mDeviceToAbsoluteTracking;
|
||||
|
||||
LOG( INFO ) << "HMD POSE (standing universe)";
|
||||
outputLogHmdMatrix( hmdStanding );
|
||||
|
||||
vr::TrackedDevicePose_t devicePosesSeated[vr::k_unMaxTrackedDeviceCount];
|
||||
|
||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||
vr::TrackingUniverseSeated,
|
||||
0.0f,
|
||||
devicePosesSeated,
|
||||
vr::k_unMaxTrackedDeviceCount );
|
||||
|
||||
vr::HmdMatrix34_t hmdSeated
|
||||
= devicePosesSeated[0].mDeviceToAbsoluteTracking;
|
||||
|
||||
LOG( INFO ) << "HMD POSE (seated universe)";
|
||||
outputLogHmdMatrix( hmdSeated );
|
||||
|
||||
auto leftHand = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||
vr::TrackedControllerRole_LeftHand );
|
||||
auto rightHand = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(
|
||||
vr::TrackedControllerRole_RightHand );
|
||||
|
||||
vr::HmdMatrix34_t leftHandMatrix
|
||||
= devicePosesStanding[leftHand].mDeviceToAbsoluteTracking;
|
||||
vr::HmdMatrix34_t rightHandMatrix
|
||||
= devicePosesStanding[rightHand].mDeviceToAbsoluteTracking;
|
||||
|
||||
LOG( INFO ) << "LEFT Hand Controller Pose (standing universe)";
|
||||
outputLogHmdMatrix( leftHandMatrix );
|
||||
|
||||
LOG( INFO ) << "RIGHT Hand Controller Pose (standing universe)";
|
||||
outputLogHmdMatrix( rightHandMatrix );
|
||||
|
||||
vr::HmdMatrix34_t standingZero;
|
||||
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
|
||||
&standingZero );
|
||||
LOG( INFO ) << "GetWorkingStandingZeroPoseToRawTrackingPose";
|
||||
outputLogHmdMatrix( standingZero );
|
||||
|
||||
vr::HmdMatrix34_t seatedZero;
|
||||
vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose(
|
||||
&seatedZero );
|
||||
LOG( INFO ) << "GetWorkingSeatedZeroPoseToRawTrackingPose";
|
||||
outputLogHmdMatrix( seatedZero );
|
||||
|
||||
vr::HmdMatrix34_t seatedZeroLive;
|
||||
vr::VRChaperoneSetup()->GetLiveSeatedZeroPoseToRawTrackingPose(
|
||||
&seatedZeroLive );
|
||||
LOG( INFO ) << "GetLiveSeatedZeroPoseToRawTrackingPose";
|
||||
outputLogHmdMatrix( seatedZeroLive );
|
||||
|
||||
vr::HmdMatrix34_t seatedToStandingAbsolute
|
||||
= vr::VRSystem()->GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
|
||||
LOG( INFO ) << "GetSeatedZeroPoseToStandingAbsoluteTrackingPose";
|
||||
outputLogHmdMatrix( seatedToStandingAbsolute );
|
||||
|
||||
LOG( INFO ) << "m_universeCenterForReset";
|
||||
outputLogHmdMatrix( m_universeCenterForReset );
|
||||
|
||||
LOG( INFO ) << "m_seatedCenterForReset";
|
||||
outputLogHmdMatrix( m_seatedCenterForReset );
|
||||
}
|
||||
|
||||
void MoveCenterTabController::outputLogHmdMatrix( vr::HmdMatrix34_t hmdMatrix )
|
||||
{
|
||||
LOG( INFO ) << hmdMatrix.m[0][0] << "\t\t\t" << hmdMatrix.m[0][1]
|
||||
<< "\t\t\t" << hmdMatrix.m[0][2] << "\t\t\t"
|
||||
<< hmdMatrix.m[0][3];
|
||||
LOG( INFO ) << hmdMatrix.m[1][0] << "\t\t\t" << hmdMatrix.m[1][1]
|
||||
<< "\t\t\t" << hmdMatrix.m[1][2] << "\t\t\t"
|
||||
<< hmdMatrix.m[1][3];
|
||||
LOG( INFO ) << hmdMatrix.m[2][0] << "\t\t\t" << hmdMatrix.m[2][1]
|
||||
<< "\t\t\t" << hmdMatrix.m[2][2] << "\t\t\t"
|
||||
<< hmdMatrix.m[2][3];
|
||||
|
||||
float atan2Yaw = std::atan2( hmdMatrix.m[0][2], hmdMatrix.m[2][2] );
|
||||
LOG( INFO ) << "atan2 Yaw Calculation: " << atan2Yaw << "radians "
|
||||
<< ( ( static_cast<double>( atan2Yaw )
|
||||
* k_radiansToCentidegrees )
|
||||
/ 100 )
|
||||
<< "degrees";
|
||||
|
||||
vr::HmdQuaternion_t hmdQuat = quaternion::fromHmdMatrix34( hmdMatrix );
|
||||
double hmdQuatYaw = quaternion::getYaw( hmdQuat );
|
||||
LOG( INFO ) << "Quaternion Yaw Calculation: " << hmdQuatYaw << "radians "
|
||||
<< ( ( hmdQuatYaw * k_radiansToCentidegrees ) / 100 )
|
||||
<< "degrees";
|
||||
LOG( INFO ) << "";
|
||||
}
|
||||
|
||||
int MoveCenterTabController::trackingUniverse() const
|
||||
{
|
||||
return static_cast<int>( m_trackingUniverse );
|
||||
@@ -140,7 +253,12 @@ void MoveCenterTabController::setTrackingUniverse( int value, bool notify )
|
||||
{
|
||||
if ( m_trackingUniverse != value )
|
||||
{
|
||||
reset();
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
if ( !m_roomSetupModeDetected && value == vr::TrackingUniverseStanding )
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
m_trackingUniverse = value;
|
||||
if ( notify )
|
||||
{
|
||||
@@ -207,11 +325,25 @@ void MoveCenterTabController::setRotation( int value, bool notify )
|
||||
// Get hmd pose matrix.
|
||||
vr::TrackedDevicePose_t
|
||||
devicePosesForRot[vr::k_unMaxTrackedDeviceCount];
|
||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||
vr::TrackingUniverseStanding,
|
||||
0.0f,
|
||||
devicePosesForRot,
|
||||
vr::k_unMaxTrackedDeviceCount );
|
||||
|
||||
// source must be current universe
|
||||
if ( m_trackingUniverse == vr::TrackingUniverseSeated )
|
||||
{
|
||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||
vr::TrackingUniverseSeated,
|
||||
0.0f,
|
||||
devicePosesForRot,
|
||||
vr::k_unMaxTrackedDeviceCount );
|
||||
}
|
||||
else
|
||||
{
|
||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||
vr::TrackingUniverseStanding,
|
||||
0.0f,
|
||||
devicePosesForRot,
|
||||
vr::k_unMaxTrackedDeviceCount );
|
||||
}
|
||||
|
||||
vr::HmdMatrix34_t oldHmdPos
|
||||
= devicePosesForRot[0].mDeviceToAbsoluteTracking;
|
||||
|
||||
@@ -626,6 +758,45 @@ void MoveCenterTabController::setLockZ( bool value, bool notify )
|
||||
}
|
||||
}
|
||||
|
||||
bool MoveCenterTabController::showLogMatricesButton() const
|
||||
{
|
||||
return m_showLogMatricesButton;
|
||||
}
|
||||
|
||||
void MoveCenterTabController::setShowLogMatricesButton( bool value,
|
||||
bool notify )
|
||||
{
|
||||
m_showLogMatricesButton = value;
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( "playspaceSettings" );
|
||||
settings->setValue( "showLogMatricesButton", m_showLogMatricesButton );
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
if ( notify )
|
||||
{
|
||||
emit showLogMatricesButtonChanged( m_showLogMatricesButton );
|
||||
}
|
||||
}
|
||||
|
||||
bool MoveCenterTabController::allowExternalEdits() const
|
||||
{
|
||||
return m_allowExternalEdits;
|
||||
}
|
||||
|
||||
void MoveCenterTabController::setAllowExternalEdits( bool value, bool notify )
|
||||
{
|
||||
m_allowExternalEdits = value;
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( "playspaceSettings" );
|
||||
settings->setValue( "allowExternalEdits", m_allowExternalEdits );
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
if ( notify )
|
||||
{
|
||||
emit allowExternalEditsChanged( m_allowExternalEdits );
|
||||
}
|
||||
}
|
||||
|
||||
void MoveCenterTabController::modOffsetX( float value, bool notify )
|
||||
{
|
||||
if ( !m_lockXToggle )
|
||||
@@ -662,11 +833,22 @@ void MoveCenterTabController::modOffsetZ( float value, bool notify )
|
||||
}
|
||||
}
|
||||
|
||||
void MoveCenterTabController::shutdown()
|
||||
{
|
||||
reset();
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
}
|
||||
|
||||
void MoveCenterTabController::incomingSeatedReset()
|
||||
{
|
||||
updateSeatedResetData();
|
||||
}
|
||||
|
||||
void MoveCenterTabController::reset()
|
||||
{
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
m_heightToggle = false;
|
||||
emit heightToggleChanged( m_heightToggle );
|
||||
applyChaperoneResetData();
|
||||
m_oldOffsetX = 0.0f;
|
||||
m_oldOffsetY = 0.0f;
|
||||
m_oldOffsetZ = 0.0f;
|
||||
@@ -675,6 +857,7 @@ void MoveCenterTabController::reset()
|
||||
m_offsetY = 0.0f;
|
||||
m_offsetZ = 0.0f;
|
||||
m_rotation = 0;
|
||||
applyChaperoneResetData();
|
||||
emit offsetXChanged( m_offsetX );
|
||||
emit offsetYChanged( m_offsetY );
|
||||
emit offsetZChanged( m_offsetZ );
|
||||
@@ -700,9 +883,20 @@ void MoveCenterTabController::zeroOffsets()
|
||||
emit rotationChanged( m_rotation );
|
||||
updateChaperoneResetData();
|
||||
m_pendingZeroOffsets = false;
|
||||
if ( m_roomSetupModeDetected )
|
||||
{
|
||||
LOG( INFO ) << "room setup EXIT detected";
|
||||
m_roomSetupModeDetected = false;
|
||||
}
|
||||
|
||||
LOG( INFO ) << "SUCCESS: Chaperone Data Updated and Offsets zeroed out";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_pendingZeroOffsets )
|
||||
{
|
||||
LOG( INFO ) << "PENDING: Chaperone Data Update and Offsets zeroing";
|
||||
}
|
||||
m_pendingZeroOffsets = true;
|
||||
}
|
||||
}
|
||||
@@ -729,6 +923,46 @@ void MoveCenterTabController::clampVelocity( double* velocity )
|
||||
}
|
||||
}
|
||||
|
||||
void MoveCenterTabController::updateSeatedResetData()
|
||||
{
|
||||
reset();
|
||||
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
||||
vr::TrackedDevicePose_t devicePosesStanding[vr::k_unMaxTrackedDeviceCount];
|
||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||
vr::TrackingUniverseStanding,
|
||||
0.0f,
|
||||
devicePosesStanding,
|
||||
vr::k_unMaxTrackedDeviceCount );
|
||||
vr::HmdMatrix34_t hmdMatrix
|
||||
= devicePosesStanding[0].mDeviceToAbsoluteTracking;
|
||||
|
||||
vr::HmdQuaternion_t hmdQuat = quaternion::fromHmdMatrix34( hmdMatrix );
|
||||
double hmdYaw = quaternion::getYaw( hmdQuat );
|
||||
int hmdYawCentideg = static_cast<int>( hmdYaw * k_radiansToCentidegrees );
|
||||
// Keep angle within -18000 ~ 18000 centidegrees
|
||||
if ( hmdYawCentideg > 18000 )
|
||||
{
|
||||
hmdYawCentideg -= 36000;
|
||||
}
|
||||
else if ( hmdYawCentideg < -18000 )
|
||||
{
|
||||
hmdYawCentideg += 36000;
|
||||
}
|
||||
|
||||
m_seatedCenterForReset = m_universeCenterForReset;
|
||||
m_seatedHeight = hmdMatrix.m[1][3];
|
||||
m_seatedCenterForReset.m[1][3] += m_seatedHeight;
|
||||
|
||||
m_offsetX = hmdMatrix.m[0][3];
|
||||
m_offsetY = 0.0f;
|
||||
m_offsetZ = hmdMatrix.m[2][3];
|
||||
m_rotation = hmdYawCentideg;
|
||||
emit offsetXChanged( m_offsetX );
|
||||
emit offsetYChanged( m_offsetY );
|
||||
emit offsetZChanged( m_offsetZ );
|
||||
emit rotationChanged( m_rotation );
|
||||
}
|
||||
|
||||
void MoveCenterTabController::updateChaperoneResetData()
|
||||
{
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
@@ -741,50 +975,76 @@ void MoveCenterTabController::updateChaperoneResetData()
|
||||
m_collisionBoundsCountForReset = currentQuadCount;
|
||||
vr::VRChaperoneSetup()->GetWorkingCollisionBoundsInfo(
|
||||
m_collisionBoundsForReset, ¤tQuadCount );
|
||||
|
||||
vr::VRChaperoneSetup()->GetWorkingStandingZeroPoseToRawTrackingPose(
|
||||
&m_universeCenterForReset );
|
||||
float universeCenterForResetYaw = std::atan2(
|
||||
m_universeCenterForReset.m[0][2], m_universeCenterForReset.m[2][2] );
|
||||
|
||||
// we want to store m_collisionBoundsForOffset as spacially relative to
|
||||
// m_universeCenterForReset, so:
|
||||
// update seated center to standing offset by current hmd Y value.
|
||||
m_seatedCenterForReset = m_universeCenterForReset;
|
||||
vr::TrackedDevicePose_t devicePosesStanding[vr::k_unMaxTrackedDeviceCount];
|
||||
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(
|
||||
vr::TrackingUniverseStanding,
|
||||
0.0f,
|
||||
devicePosesStanding,
|
||||
vr::k_unMaxTrackedDeviceCount );
|
||||
vr::HmdMatrix34_t hmdMatrix
|
||||
= devicePosesStanding[0].mDeviceToAbsoluteTracking;
|
||||
m_seatedHeight = hmdMatrix.m[1][3];
|
||||
m_seatedCenterForReset.m[1][3] += m_seatedHeight;
|
||||
|
||||
// for every quad in the chaperone bounds...
|
||||
for ( unsigned quad = 0; quad < m_collisionBoundsCountForReset; quad++ )
|
||||
if ( m_collisionBoundsCountForReset > 0 )
|
||||
{
|
||||
// at every corner in that quad...
|
||||
for ( unsigned corner = 0; corner < 4; corner++ )
|
||||
{
|
||||
// copy from m_collisionBoundsForReset
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v[0]
|
||||
= m_collisionBoundsForReset[quad].vCorners[corner].v[0];
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v[1]
|
||||
= m_collisionBoundsForReset[quad].vCorners[corner].v[1];
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v[2]
|
||||
= m_collisionBoundsForReset[quad].vCorners[corner].v[2];
|
||||
float universeCenterForResetYaw
|
||||
= std::atan2( m_universeCenterForReset.m[0][2],
|
||||
m_universeCenterForReset.m[2][2] );
|
||||
|
||||
// unrotate by universe center's yaw
|
||||
rotateFloatCoordinates(
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v,
|
||||
-universeCenterForResetYaw );
|
||||
// we want to store m_collisionBoundsForOffset as spacially relative to
|
||||
// m_universeCenterForReset, so:
|
||||
|
||||
// for every quad in the chaperone bounds...
|
||||
for ( unsigned quad = 0; quad < m_collisionBoundsCountForReset; quad++ )
|
||||
{
|
||||
// at every corner in that quad...
|
||||
for ( unsigned corner = 0; corner < 4; corner++ )
|
||||
{
|
||||
// copy from m_collisionBoundsForReset
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v[0]
|
||||
= m_collisionBoundsForReset[quad].vCorners[corner].v[0];
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v[1]
|
||||
= m_collisionBoundsForReset[quad].vCorners[corner].v[1];
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v[2]
|
||||
= m_collisionBoundsForReset[quad].vCorners[corner].v[2];
|
||||
|
||||
// unrotate by universe center's yaw
|
||||
rotateFloatCoordinates(
|
||||
m_collisionBoundsForOffset[quad].vCorners[corner].v,
|
||||
-universeCenterForResetYaw );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the working set preview for potential Oculus and WMR issues
|
||||
vr::VRChaperoneSetup()->ShowWorkingSetPreview();
|
||||
// vr::VRChaperoneSetup()->ShowWorkingSetPreview();
|
||||
}
|
||||
|
||||
void MoveCenterTabController::applyChaperoneResetData()
|
||||
{
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
||||
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(
|
||||
m_collisionBoundsForReset, m_collisionBoundsCountForReset );
|
||||
if ( m_collisionBoundsCountForReset > 0 )
|
||||
{
|
||||
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(
|
||||
m_collisionBoundsForReset, m_collisionBoundsCountForReset );
|
||||
}
|
||||
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(
|
||||
&m_universeCenterForReset );
|
||||
vr::VRChaperoneSetup()->SetWorkingSeatedZeroPoseToRawTrackingPose(
|
||||
&m_seatedCenterForReset );
|
||||
|
||||
vr::VRChaperoneSetup()->CommitWorkingCopy( vr::EChaperoneConfigFile_Live );
|
||||
// update the working set preview otherwise Oculus and WMR users may not see
|
||||
// results of the reset
|
||||
vr::VRChaperoneSetup()->ShowWorkingSetPreview();
|
||||
// vr::VRChaperoneSetup()->ShowWorkingSetPreview();
|
||||
}
|
||||
|
||||
// START of drag bindings:
|
||||
@@ -1492,10 +1752,14 @@ void MoveCenterTabController::saveUncommittedChaperone()
|
||||
{
|
||||
if ( !m_chaperoneCommitted )
|
||||
{
|
||||
// double commit... once to ensure before we HideWorkingSetPreview the
|
||||
// working set is synced. Commit a second time as a workaround for WMR
|
||||
// and Rift not getting the commit during active ShowWorkingSetPreview
|
||||
vr::VRChaperoneSetup()->CommitWorkingCopy(
|
||||
vr::EChaperoneConfigFile_Live );
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
vr::VRChaperoneSetup()->CommitWorkingCopy(
|
||||
vr::EChaperoneConfigFile_Live );
|
||||
// test removal for oculus and WMR users
|
||||
// vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
m_chaperoneCommitted = true;
|
||||
}
|
||||
}
|
||||
@@ -1855,6 +2119,15 @@ void MoveCenterTabController::updateSpace()
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_allowExternalEdits && m_oldOffsetX == 0.0f && m_oldOffsetY == 0.0f
|
||||
&& m_oldOffsetZ == 0.0f && m_oldRotation == 0 )
|
||||
{
|
||||
vr::VRChaperoneSetup()->ReloadFromDisk( vr::EChaperoneConfigFile_Live );
|
||||
vr::VRChaperoneSetup()->CommitWorkingCopy(
|
||||
vr::EChaperoneConfigFile_Live );
|
||||
updateChaperoneResetData();
|
||||
}
|
||||
|
||||
vr::HmdMatrix34_t offsetUniverseCenter;
|
||||
|
||||
// set offsetUniverseCenter to the current angle
|
||||
@@ -1892,6 +2165,17 @@ void MoveCenterTabController::updateSpace()
|
||||
offsetUniverseCenter.m[2][3]
|
||||
+= m_universeCenterForReset.m[2][2] * m_offsetZ;
|
||||
|
||||
// keep the seated origin synced with offsets if in seated mode
|
||||
if ( m_trackingUniverse == vr::TrackingUniverseSeated )
|
||||
{
|
||||
vr::HmdMatrix34_t offsetSeatedCenter = offsetUniverseCenter;
|
||||
|
||||
offsetSeatedCenter.m[1][3] += m_seatedHeight;
|
||||
|
||||
vr::VRChaperoneSetup()->SetWorkingSeatedZeroPoseToRawTrackingPose(
|
||||
&offsetSeatedCenter );
|
||||
}
|
||||
|
||||
if ( m_adjustChaperone )
|
||||
{
|
||||
// make a copy of our bounds and
|
||||
@@ -1950,9 +2234,14 @@ void MoveCenterTabController::updateSpace()
|
||||
}
|
||||
vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(
|
||||
&offsetUniverseCenter );
|
||||
|
||||
vr::VRChaperoneSetup()->ShowWorkingSetPreview();
|
||||
m_chaperoneCommitted = false;
|
||||
|
||||
// loadChaperoneData( false ), false so that we don't load live data, and
|
||||
// reference the working set instead.
|
||||
parent->chaperoneUtils().loadChaperoneData( false );
|
||||
|
||||
m_oldOffsetX = m_offsetX;
|
||||
m_oldOffsetY = m_offsetY;
|
||||
m_oldOffsetZ = m_offsetZ;
|
||||
@@ -1964,28 +2253,58 @@ void MoveCenterTabController::eventLoopTick(
|
||||
vr::TrackedDevicePose_t* devicePoses )
|
||||
|
||||
{
|
||||
if ( settingsUpdateCounter >= k_moveCenterSettingsUpdateCounter )
|
||||
// detect if room setup is running
|
||||
if ( universe == vr::TrackingUniverseRawAndUncalibrated )
|
||||
{
|
||||
if ( parent->isDashboardVisible() )
|
||||
if ( !m_roomSetupModeDetected )
|
||||
{
|
||||
setTrackingUniverse( int( universe ) );
|
||||
m_roomSetupModeDetected = true;
|
||||
|
||||
// give up on any pending zero offsets so they aren't applied in the
|
||||
// middle of room setup.
|
||||
m_pendingZeroOffsets = false;
|
||||
|
||||
LOG( INFO ) << "room setup ENTRY detected";
|
||||
vr::VRChaperoneSetup()->HideWorkingSetPreview();
|
||||
reset();
|
||||
vr::VRChaperoneSetup()->RevertWorkingCopy();
|
||||
}
|
||||
settingsUpdateCounter = 0;
|
||||
setTrackingUniverse( int( universe ) );
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
// detect entering seated mode
|
||||
if ( universe == vr::TrackingUniverseSeated && !m_seatedModeDetected )
|
||||
{
|
||||
settingsUpdateCounter++;
|
||||
m_seatedModeDetected = true;
|
||||
LOG( INFO ) << "seated mode ENTRY detected";
|
||||
}
|
||||
|
||||
// detect exiting seated mode
|
||||
if ( universe == vr::TrackingUniverseStanding && m_seatedModeDetected )
|
||||
{
|
||||
m_seatedModeDetected = false;
|
||||
reset();
|
||||
LOG( INFO ) << "seated mode EXIT detected";
|
||||
}
|
||||
|
||||
// If we're trying to redifine the origin point, but can't becaues of bad
|
||||
// chaperone calibration, we keep trying and hold off on motion features
|
||||
// until we get ChaperoneCalibrationState_OK
|
||||
if ( m_pendingZeroOffsets )
|
||||
|
||||
// if we were in room setup, but got this far in the loop, universe is no
|
||||
// longer raw mode and we detect room setup exit and zeroOffsets() to apply
|
||||
// new setup.
|
||||
if ( m_pendingZeroOffsets || m_roomSetupModeDetected )
|
||||
{
|
||||
zeroOffsets();
|
||||
// m_roomSetupModeDetected is set to false in zeroOffsets() if it's
|
||||
// successful.
|
||||
}
|
||||
else
|
||||
{
|
||||
setTrackingUniverse( int( universe ) );
|
||||
|
||||
// get current space rotation in radians
|
||||
double angle = m_rotation * k_centidegreesToRadians;
|
||||
|
||||
|
||||
@@ -68,6 +68,11 @@ class MoveCenterTabController : public QObject
|
||||
requireLockYChanged )
|
||||
Q_PROPERTY( bool lockZToggle READ lockZToggle WRITE setLockZ NOTIFY
|
||||
requireLockZChanged )
|
||||
Q_PROPERTY(
|
||||
bool showLogMatricesButton READ showLogMatricesButton WRITE
|
||||
setShowLogMatricesButton NOTIFY showLogMatricesButtonChanged )
|
||||
Q_PROPERTY( bool allowExternalEdits READ allowExternalEdits WRITE
|
||||
setAllowExternalEdits NOTIFY allowExternalEditsChanged )
|
||||
|
||||
private:
|
||||
OverlayController* parent;
|
||||
@@ -100,6 +105,7 @@ private:
|
||||
float m_gravityFloor = 0.0f;
|
||||
float m_gravityStrength = 9.8f;
|
||||
float m_flingStrength = 1.0f;
|
||||
float m_seatedHeight = 1.0f;
|
||||
bool m_momentumSave = false;
|
||||
bool m_lockXToggle = false;
|
||||
bool m_lockYToggle = false;
|
||||
@@ -138,6 +144,10 @@ private:
|
||||
bool m_chaperoneCommitted = true;
|
||||
bool m_pendingZeroOffsets = true;
|
||||
bool m_dashWasOpenPreviousFrame = false;
|
||||
bool m_roomSetupModeDetected = false;
|
||||
bool m_seatedModeDetected = false;
|
||||
bool m_showLogMatricesButton = false;
|
||||
bool m_allowExternalEdits = false;
|
||||
unsigned settingsUpdateCounter = 0;
|
||||
int m_hmdRotationStatsUpdateCounter = 0;
|
||||
unsigned m_dragComfortFrameSkipCounter = 0;
|
||||
@@ -148,6 +158,7 @@ private:
|
||||
vr::HmdQuad_t* m_collisionBoundsForReset;
|
||||
uint32_t m_collisionBoundsCountForReset = 0;
|
||||
vr::HmdMatrix34_t m_universeCenterForReset;
|
||||
vr::HmdMatrix34_t m_seatedCenterForReset;
|
||||
vr::HmdQuad_t* m_collisionBoundsForOffset;
|
||||
|
||||
void updateHmdRotationCounter( vr::TrackedDevicePose_t hmdPose,
|
||||
@@ -160,6 +171,7 @@ private:
|
||||
void updateChaperoneResetData();
|
||||
void applyChaperoneResetData();
|
||||
void saveUncommittedChaperone();
|
||||
void outputLogHmdMatrix( vr::HmdMatrix34_t hmdMatrix );
|
||||
|
||||
public:
|
||||
void initStage1();
|
||||
@@ -190,8 +202,11 @@ public:
|
||||
bool lockXToggle() const;
|
||||
bool lockYToggle() const;
|
||||
bool lockZToggle() const;
|
||||
bool showLogMatricesButton() const;
|
||||
bool allowExternalEdits() const;
|
||||
double getHmdYawTotal();
|
||||
void resetHmdYawTotal();
|
||||
void incomingSeatedReset();
|
||||
|
||||
// actions:
|
||||
void leftHandSpaceDrag( bool leftHandDragActive );
|
||||
@@ -247,8 +262,13 @@ public slots:
|
||||
void setLockX( bool value, bool notify = true );
|
||||
void setLockY( bool value, bool notify = true );
|
||||
void setLockZ( bool value, bool notify = true );
|
||||
void setShowLogMatricesButton( bool value, bool notify = true );
|
||||
void setAllowExternalEdits( bool value, bool notify = true );
|
||||
|
||||
void shutdown();
|
||||
void reset();
|
||||
void updateSeatedResetData();
|
||||
void outputLogPoses();
|
||||
void zeroOffsets();
|
||||
|
||||
signals:
|
||||
@@ -275,6 +295,8 @@ signals:
|
||||
void requireLockXChanged( bool value );
|
||||
void requireLockYChanged( bool value );
|
||||
void requireLockZChanged( bool value );
|
||||
void showLogMatricesButtonChanged( bool value );
|
||||
void allowExternalEditsChanged( bool value );
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
@@ -4,37 +4,22 @@
|
||||
#include "../overlaycontroller.h"
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#ifdef _WIN32
|
||||
# include "keyboardinput/KeyboardInputWindows.h"
|
||||
#else
|
||||
# include "keyboardinput/KeyboardInputDummy.h"
|
||||
#endif
|
||||
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
{
|
||||
constexpr auto steamDesktopOverlaykey = "valve.steam.desktop";
|
||||
|
||||
void UtilitiesTabController::initStage1()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
keyboardInput.reset( new KeyboardInputWindows() );
|
||||
#else
|
||||
keyboardInput.reset( new KeyboardInputDummy() );
|
||||
#endif
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( "utilitiesSettings" );
|
||||
auto qAlarmEnabled = settings->value( "alarmEnabled", m_alarmEnabled );
|
||||
auto qAlarmIsModal = settings->value( "alarmIsModal", m_alarmIsModal );
|
||||
auto qAlarmHour = settings->value( "alarmHour", 0 );
|
||||
auto qAlarmMinute = settings->value( "alarmMinute", 0 );
|
||||
auto qDesktopWidth = settings->value( "desktopWidth", 4.0 );
|
||||
settings->endGroup();
|
||||
m_alarmEnabled = qAlarmEnabled.toBool();
|
||||
m_alarmIsModal = qAlarmIsModal.toBool();
|
||||
m_alarmTime = QTime( qAlarmHour.toInt(), qAlarmMinute.toInt() );
|
||||
|
||||
setUpDesktopOverlay( qDesktopWidth.toFloat() );
|
||||
}
|
||||
|
||||
void UtilitiesTabController::initStage2( OverlayController* var_parent,
|
||||
@@ -46,44 +31,44 @@ void UtilitiesTabController::initStage2( OverlayController* var_parent,
|
||||
|
||||
void UtilitiesTabController::sendKeyboardInput( QString input )
|
||||
{
|
||||
keyboardInput->sendKeyboardInput( input );
|
||||
keyboardinput::sendKeyboardInput( input );
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardEnter()
|
||||
{
|
||||
keyboardInput->sendKeyboardEnter();
|
||||
keyboardinput::sendKeyboardEnter();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardAltEnter()
|
||||
{
|
||||
keyboardInput->sendKeyboardAltEnter();
|
||||
keyboardinput::sendKeyboardAltEnter();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardAltTab()
|
||||
{
|
||||
keyboardInput->sendKeyboardAltTab();
|
||||
keyboardinput::sendKeyboardAltTab();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardBackspace( const int count )
|
||||
{
|
||||
keyboardInput->sendKeyboardBackspace( count );
|
||||
keyboardinput::sendKeyboardBackspace( count );
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendMediaNextSong()
|
||||
{
|
||||
keyboardInput->sendMediaNextSong();
|
||||
keyboardinput::sendMediaNextSong();
|
||||
}
|
||||
void UtilitiesTabController::sendMediaPreviousSong()
|
||||
{
|
||||
keyboardInput->sendMediaPreviousSong();
|
||||
keyboardinput::sendMediaPreviousSong();
|
||||
}
|
||||
void UtilitiesTabController::sendMediaPausePlay()
|
||||
{
|
||||
keyboardInput->sendMediaPausePlay();
|
||||
keyboardinput::sendMediaPausePlay();
|
||||
}
|
||||
void UtilitiesTabController::sendMediaStopSong()
|
||||
{
|
||||
keyboardInput->sendMediaStopSong();
|
||||
keyboardinput::sendMediaStopSong();
|
||||
}
|
||||
|
||||
bool UtilitiesTabController::alarmEnabled() const
|
||||
@@ -311,42 +296,6 @@ void UtilitiesTabController::eventLoopTick()
|
||||
{
|
||||
if ( settingsUpdateCounter >= k_utilitiesSettingsUpdateCounter )
|
||||
{
|
||||
vr::VROverlayHandle_t pOverlayHandle;
|
||||
auto error = vr::VROverlay()->FindOverlay( steamDesktopOverlaykey,
|
||||
&pOverlayHandle );
|
||||
if ( error == vr::VROverlayError_None )
|
||||
{
|
||||
if ( !m_steamDesktopOverlayAvailable )
|
||||
{
|
||||
m_steamDesktopOverlayAvailable = true;
|
||||
emit steamDesktopOverlayAvailableChanged(
|
||||
m_steamDesktopOverlayAvailable );
|
||||
}
|
||||
float width;
|
||||
error = vr::VROverlay()->GetOverlayWidthInMeters( pOverlayHandle,
|
||||
&width );
|
||||
if ( error != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR )
|
||||
<< "Could not read overlay width of \""
|
||||
<< steamDesktopOverlaykey << "\": "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( error );
|
||||
}
|
||||
else
|
||||
{
|
||||
setSteamDesktopOverlayWidth( width, true, false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_steamDesktopOverlayAvailable )
|
||||
{
|
||||
m_steamDesktopOverlayAvailable = false;
|
||||
emit steamDesktopOverlayAvailableChanged(
|
||||
m_steamDesktopOverlayAvailable );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_alarmEnabled && m_alarmTime.isValid() )
|
||||
{
|
||||
auto now = QTime::currentTime();
|
||||
@@ -558,104 +507,4 @@ void UtilitiesTabController::eventLoopTick()
|
||||
}
|
||||
}
|
||||
|
||||
bool steamDesktopOverlayExists()
|
||||
{
|
||||
vr::VROverlayHandle_t pOverlayHandle = 0;
|
||||
auto error = vr::VROverlay()->FindOverlay( steamDesktopOverlaykey,
|
||||
&pOverlayHandle );
|
||||
if ( error != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( DEBUG ) << "Could not find overlay \"" << steamDesktopOverlaykey
|
||||
<< "\": "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( error );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void UtilitiesTabController::setUpDesktopOverlay( float desktopWidthInMeters )
|
||||
{
|
||||
auto setOverlayVariablesSuccess = [this, desktopWidthInMeters]() {
|
||||
m_steamDesktopOverlayAvailable = true;
|
||||
setSteamDesktopOverlayWidth( desktopWidthInMeters, true, true );
|
||||
LOG( INFO ) << "Found overlay \"" << steamDesktopOverlaykey << "\".";
|
||||
};
|
||||
|
||||
if ( steamDesktopOverlayExists() )
|
||||
{
|
||||
setOverlayVariablesSuccess();
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr auto timeBetweenAdditionalAttempts = std::chrono::seconds( 1 );
|
||||
constexpr auto maxAttempts = 7;
|
||||
for ( int attempts = 0; attempts < maxAttempts; ++attempts )
|
||||
{
|
||||
std::this_thread::sleep_for( timeBetweenAdditionalAttempts );
|
||||
if ( steamDesktopOverlayExists() )
|
||||
{
|
||||
setOverlayVariablesSuccess();
|
||||
return;
|
||||
}
|
||||
}
|
||||
LOG( INFO ) << "Could not find overlay \"" << steamDesktopOverlaykey
|
||||
<< "\" after " << maxAttempts << " extra attempts.";
|
||||
}
|
||||
|
||||
bool UtilitiesTabController::steamDesktopOverlayAvailable() const
|
||||
{
|
||||
return m_steamDesktopOverlayAvailable;
|
||||
}
|
||||
|
||||
float UtilitiesTabController::steamDesktopOverlayWidth() const
|
||||
{
|
||||
return m_steamDesktopOverlayWidth;
|
||||
}
|
||||
|
||||
void UtilitiesTabController::setSteamDesktopOverlayWidth( float width,
|
||||
bool notify,
|
||||
bool notifyOpenVr )
|
||||
{
|
||||
if ( std::abs( m_steamDesktopOverlayWidth - width ) > 0.01f )
|
||||
{
|
||||
m_steamDesktopOverlayWidth = width;
|
||||
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( "utilitiesSettings" );
|
||||
settings->setValue( "desktopWidth", m_steamDesktopOverlayWidth );
|
||||
settings->endGroup();
|
||||
|
||||
if ( notifyOpenVr )
|
||||
{
|
||||
vr::VROverlayHandle_t pOverlayHandle;
|
||||
auto error = vr::VROverlay()->FindOverlay( steamDesktopOverlaykey,
|
||||
&pOverlayHandle );
|
||||
if ( error != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR )
|
||||
<< "Could not find overlay \"" << steamDesktopOverlaykey
|
||||
<< "\": "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum( error );
|
||||
}
|
||||
else
|
||||
{
|
||||
error = vr::VROverlay()->SetOverlayWidthInMeters(
|
||||
pOverlayHandle, m_steamDesktopOverlayWidth );
|
||||
if ( error != vr::VROverlayError_None )
|
||||
{
|
||||
LOG( ERROR )
|
||||
<< "Could not modify overlay width of \""
|
||||
<< steamDesktopOverlaykey << "\": "
|
||||
<< vr::VROverlay()->GetOverlayErrorNameFromEnum(
|
||||
error );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( notify )
|
||||
{
|
||||
emit steamDesktopOverlayWidthChanged( m_steamDesktopOverlayWidth );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QTime>
|
||||
#include <openvr.h>
|
||||
#include <memory>
|
||||
#include "KeyboardInput.h"
|
||||
#include "keyboardinput/KeyboardInput.h"
|
||||
|
||||
class QQuickWindow;
|
||||
// application namespace
|
||||
@@ -25,16 +25,8 @@ class UtilitiesTabController : public QObject
|
||||
NOTIFY alarmTimeHourChanged )
|
||||
Q_PROPERTY( int alarmTimeMinute READ alarmTimeMinute WRITE
|
||||
setAlarmTimeMinute NOTIFY alarmTimeMinuteChanged )
|
||||
Q_PROPERTY(
|
||||
bool steamDesktopOverlayAvailable READ steamDesktopOverlayAvailable
|
||||
NOTIFY steamDesktopOverlayAvailableChanged )
|
||||
Q_PROPERTY(
|
||||
float steamDesktopOverlayWidth READ steamDesktopOverlayWidth WRITE
|
||||
setSteamDesktopOverlayWidth NOTIFY steamDesktopOverlayWidthChanged )
|
||||
|
||||
private:
|
||||
void setUpDesktopOverlay( float desktopWidthInMeters );
|
||||
|
||||
OverlayController* m_parent;
|
||||
QQuickWindow* m_widget;
|
||||
|
||||
@@ -44,15 +36,12 @@ private:
|
||||
bool m_alarmIsModal = true;
|
||||
QTime m_alarmTime;
|
||||
QTime m_alarmLastCheckTime;
|
||||
bool m_steamDesktopOverlayAvailable = false;
|
||||
float m_steamDesktopOverlayWidth = 4.0f;
|
||||
|
||||
vr::VROverlayHandle_t m_batteryOverlayHandles[vr::k_unMaxTrackedDeviceCount]
|
||||
= { 0 };
|
||||
int m_batteryState[vr::k_unMaxTrackedDeviceCount];
|
||||
bool m_batteryVisible[vr::k_unMaxTrackedDeviceCount];
|
||||
|
||||
std::unique_ptr<KeyboardInput> keyboardInput;
|
||||
|
||||
public:
|
||||
void initStage1();
|
||||
void initStage2( OverlayController* var_parent, QQuickWindow* var_widget );
|
||||
@@ -64,9 +53,6 @@ public:
|
||||
int alarmTimeHour() const;
|
||||
int alarmTimeMinute() const;
|
||||
|
||||
bool steamDesktopOverlayAvailable() const;
|
||||
float steamDesktopOverlayWidth() const;
|
||||
|
||||
public slots:
|
||||
void sendKeyboardInput( QString input );
|
||||
void sendKeyboardEnter();
|
||||
@@ -86,18 +72,11 @@ public slots:
|
||||
void modAlarmTimeHour( int value, bool notify = true );
|
||||
void modAlarmTimeMinute( int value, bool notify = true );
|
||||
|
||||
void setSteamDesktopOverlayWidth( float width,
|
||||
bool notify = true,
|
||||
bool notifyOpenVr = true );
|
||||
|
||||
signals:
|
||||
void alarmEnabledChanged( bool enabled );
|
||||
void alarmIsModalChanged( bool modal );
|
||||
void alarmTimeHourChanged( int hour );
|
||||
void alarmTimeMinuteChanged( int min );
|
||||
|
||||
void steamDesktopOverlayAvailableChanged( bool available );
|
||||
void steamDesktopOverlayWidthChanged( float width );
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
|
||||
namespace keyboardinput
|
||||
{
|
||||
void sendKeyboardInput( QString input );
|
||||
void sendKeyboardEnter();
|
||||
void sendKeyboardBackspace( const int count );
|
||||
void sendKeyboardAltTab();
|
||||
void sendKeyboardAltEnter();
|
||||
void sendMediaNextSong();
|
||||
void sendMediaPreviousSong();
|
||||
void sendMediaPausePlay();
|
||||
void sendMediaStopSong();
|
||||
|
||||
} // namespace keyboardinput
|
||||
@@ -1,56 +1,56 @@
|
||||
#include "KeyboardInputDummy.h"
|
||||
#include "KeyboardInput.h"
|
||||
|
||||
// Used to get the compiler to shut up about C4100: unreferenced formal
|
||||
// parameter. The cast is to get GCC to shut up about it.
|
||||
#define UNREFERENCED_PARAMETER( P ) static_cast<void>( ( P ) )
|
||||
|
||||
namespace advsettings
|
||||
namespace keyboardinput
|
||||
{
|
||||
void KeyboardInputDummy::sendKeyboardInput( QString input )
|
||||
void sendKeyboardInput( QString input )
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER( input );
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardEnter()
|
||||
void sendKeyboardEnter()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardBackspace( const int count )
|
||||
void sendKeyboardBackspace( const int count )
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER( count );
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardAltTab()
|
||||
void sendKeyboardAltTab()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardAltEnter()
|
||||
void sendKeyboardAltEnter()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaNextSong()
|
||||
void sendMediaNextSong()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaPreviousSong()
|
||||
void sendMediaPreviousSong()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaPausePlay()
|
||||
void sendMediaPausePlay()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaStopSong()
|
||||
void sendMediaStopSong()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
} // namespace advsettings
|
||||
} // namespace keyboardinput
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef KEYBOARDINPUTDUMMY_H
|
||||
#define KEYBOARDINPUTDUMMY_H
|
||||
|
||||
#include "../KeyboardInput.h"
|
||||
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
{
|
||||
class KeyboardInputDummy : public KeyboardInput
|
||||
{
|
||||
public:
|
||||
virtual void sendKeyboardInput( QString input ) override;
|
||||
virtual void sendKeyboardEnter() override;
|
||||
virtual void sendKeyboardBackspace( const int count ) override;
|
||||
virtual void sendKeyboardAltTab() override;
|
||||
virtual void sendKeyboardAltEnter() override;
|
||||
virtual void sendMediaNextSong() override;
|
||||
virtual void sendMediaPreviousSong() override;
|
||||
virtual void sendMediaPausePlay() override;
|
||||
virtual void sendMediaStopSong() override;
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
#endif // KEYBOARDINPUTDUMMY_H
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "KeyboardInputWindows.h"
|
||||
#include "KeyboardInput.h"
|
||||
#include <Windows.h>
|
||||
#include "easylogging++.h"
|
||||
|
||||
namespace advsettings
|
||||
namespace keyboardinput
|
||||
{
|
||||
/*!
|
||||
Represents the state of a keyboard button press. Can be either Up or Down.
|
||||
@@ -127,7 +127,7 @@ void sendKeyPressAndRelease( const WORD virtualKeyCode )
|
||||
sendKeyboardInputRaw( numberOfActions, actions );
|
||||
}
|
||||
|
||||
void KeyboardInputWindows::sendKeyboardInput( QString input )
|
||||
void sendKeyboardInput( QString input )
|
||||
{
|
||||
int len = input.length();
|
||||
if ( len > 0 )
|
||||
@@ -202,7 +202,7 @@ void KeyboardInputWindows::sendKeyboardInput( QString input )
|
||||
/*!
|
||||
Sends a single Enter keypress to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardEnter()
|
||||
void sendKeyboardEnter()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_RETURN );
|
||||
}
|
||||
@@ -211,7 +211,7 @@ void KeyboardInputWindows::sendKeyboardEnter()
|
||||
Sends count amount of backspaces to Windows. count of 0 or below will do
|
||||
nothing.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardBackspace( const int count )
|
||||
void sendKeyboardBackspace( const int count )
|
||||
{
|
||||
// We can only send a positive amount of key presses.
|
||||
if ( count <= 0 )
|
||||
@@ -232,7 +232,7 @@ Used for tabbing out of game windows blocking other programs on desktop while in
|
||||
VR. At least one use case was tabbing out of a fullscreen game to be able to use
|
||||
a music player.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardAltTab()
|
||||
void sendKeyboardAltTab()
|
||||
{
|
||||
constexpr auto altKey = VK_MENU;
|
||||
constexpr auto tabKey = VK_TAB;
|
||||
@@ -256,7 +256,7 @@ Sends an Alt + Tab combination to Windows.
|
||||
Used for toggling full screen on games and various applications that appear on
|
||||
the desktop.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardAltEnter()
|
||||
void sendKeyboardAltEnter()
|
||||
{
|
||||
constexpr auto altKey = VK_MENU;
|
||||
constexpr auto enterKey = VK_RETURN;
|
||||
@@ -277,7 +277,7 @@ void KeyboardInputWindows::sendKeyboardAltEnter()
|
||||
/*!
|
||||
Sends a media key Next Song button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaNextSong()
|
||||
void sendMediaNextSong()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_NEXT_TRACK );
|
||||
}
|
||||
@@ -285,7 +285,7 @@ void KeyboardInputWindows::sendMediaNextSong()
|
||||
/*!
|
||||
Sends a media key Previous Song button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaPreviousSong()
|
||||
void sendMediaPreviousSong()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_PREV_TRACK );
|
||||
}
|
||||
@@ -293,7 +293,7 @@ void KeyboardInputWindows::sendMediaPreviousSong()
|
||||
/*!
|
||||
Sends a media key Play/Pause button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaPausePlay()
|
||||
void sendMediaPausePlay()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_PLAY_PAUSE );
|
||||
}
|
||||
@@ -301,9 +301,9 @@ void KeyboardInputWindows::sendMediaPausePlay()
|
||||
/*!
|
||||
Sends a media key Stop button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaStopSong()
|
||||
void sendMediaStopSong()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_STOP );
|
||||
}
|
||||
|
||||
} // namespace advsettings
|
||||
} // namespace keyboardinput
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef KEYBOARDINPUTWINDOWS_H
|
||||
#define KEYBOARDINPUTWINDOWS_H
|
||||
|
||||
#include "../KeyboardInput.h"
|
||||
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
{
|
||||
class KeyboardInputWindows : public KeyboardInput
|
||||
{
|
||||
public:
|
||||
virtual void sendKeyboardInput( QString input ) override;
|
||||
virtual void sendKeyboardEnter() override;
|
||||
virtual void sendKeyboardBackspace( const int count ) override;
|
||||
virtual void sendKeyboardAltTab() override;
|
||||
virtual void sendKeyboardAltEnter() override;
|
||||
virtual void sendMediaNextSong() override;
|
||||
virtual void sendMediaPreviousSong() override;
|
||||
virtual void sendMediaPausePlay() override;
|
||||
virtual void sendMediaStopSong() override;
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
#endif // KEYBOARDINPUTWINDOWS_H
|
||||
Reference in New Issue
Block a user