Remove unused PttProfile features from PttController
None of these features have been used since the introduction of the SteamVR IVRInput interface sometime around the start of 2019.
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import ovras.advsettings 1.0
|
||||
import "../../common"
|
||||
|
||||
MyDialogOkCancelPopup {
|
||||
id: pttDeleteProfileDialog
|
||||
property int profileIndex: -1
|
||||
dialogTitle: "Delete Profile"
|
||||
dialogWidth: 600
|
||||
dialogHeight: 300
|
||||
y: -300
|
||||
x: 100
|
||||
dialogText: "Do you really want to delete this ptt profile?"
|
||||
onClosed: {
|
||||
if (okClicked) {
|
||||
AudioTabController.deletePttProfile(profileIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import ovras.advsettings 1.0
|
||||
import "../../common"
|
||||
|
||||
MyDialogOkCancelPopup {
|
||||
id: pttNewProfileDialog
|
||||
dialogTitle: "Create New PTT Profile"
|
||||
dialogWidth: 600
|
||||
dialogHeight: 220
|
||||
dialogContentItem: ColumnLayout {
|
||||
RowLayout {
|
||||
Layout.topMargin: 16
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
MyText {
|
||||
text: "Name: "
|
||||
}
|
||||
MyTextField {
|
||||
id: pttNewProfileName
|
||||
keyBoardUID: 591
|
||||
color: "#cccccc"
|
||||
text: ""
|
||||
Layout.fillWidth: true
|
||||
font.pointSize: 20
|
||||
function onInputEvent(input) {
|
||||
pttNewProfileName.text = input
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onClosed: {
|
||||
if (okClicked) {
|
||||
if (pttNewProfileName.text != "") {
|
||||
AudioTabController.addPttProfile(pttNewProfileName.text)
|
||||
|
||||
} else {
|
||||
audioMessageDialog.showMessage("Create New Profile", "ERROR: No name given.")
|
||||
}
|
||||
}
|
||||
}
|
||||
function openPopup() {
|
||||
pttNewProfileName.text = ""
|
||||
open()
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,6 @@ void AudioTabController::initStage1()
|
||||
findMicDeviceIndex( audioManager->getMicDevId(), false );
|
||||
m_micVolume = audioManager->getMicVolume();
|
||||
m_micMuted = audioManager->getMicMuted();
|
||||
reloadPttProfiles();
|
||||
reloadPttConfig();
|
||||
// Temporarily disabled audio profiles for 1.8.19 until api is clear.
|
||||
// reloadAudioProfiles();
|
||||
@@ -200,7 +199,6 @@ void AudioTabController::eventLoopTick()
|
||||
{
|
||||
settingsUpdateCounter++;
|
||||
}
|
||||
checkPttStatus();
|
||||
eventLoopMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
|
||||
void eventLoopTick();
|
||||
|
||||
bool pttChangeValid() override;
|
||||
bool pttChangeValid();
|
||||
|
||||
int playbackDeviceIndex() const;
|
||||
|
||||
|
||||
@@ -21,131 +21,6 @@ bool PttController::pttShowNotification() const
|
||||
return m_pttShowNotification;
|
||||
}
|
||||
|
||||
bool PttController::pttLeftControllerEnabled() const
|
||||
{
|
||||
return m_pttLeftControllerEnabled;
|
||||
}
|
||||
|
||||
bool PttController::pttRightControllerEnabled() const
|
||||
{
|
||||
return m_pttRightControllerEnabled;
|
||||
}
|
||||
|
||||
void PttController::setPttControllerConfig( unsigned controller,
|
||||
QVariantList buttons,
|
||||
unsigned triggerMode,
|
||||
unsigned padMode,
|
||||
unsigned padAreas )
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||
if ( controller < 2 )
|
||||
{
|
||||
uint64_t buttonMask = 0;
|
||||
for ( auto b : buttons )
|
||||
{
|
||||
buttonMask |= vr::ButtonMaskFromId(
|
||||
( static_cast<vr::EVRButtonId>( b.toInt() ) ) );
|
||||
}
|
||||
m_pttControllerConfigs[controller].digitalButtons = buttons;
|
||||
m_pttControllerConfigs[controller].digitalButtonMask = buttonMask;
|
||||
m_pttControllerConfigs[controller].triggerMode = triggerMode;
|
||||
m_pttControllerConfigs[controller].touchpadMode = padMode;
|
||||
m_pttControllerConfigs[controller].touchpadAreas = padAreas;
|
||||
savePttConfig();
|
||||
}
|
||||
}
|
||||
|
||||
void PttController::reloadPttProfiles()
|
||||
{
|
||||
pttProfiles.clear();
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( getSettingsName() );
|
||||
auto profileCount = settings->beginReadArray( "pttProfiles" );
|
||||
for ( int i = 0; i < profileCount; i++ )
|
||||
{
|
||||
settings->setArrayIndex( i );
|
||||
pttProfiles.emplace_back();
|
||||
auto& entry = pttProfiles[static_cast<size_t>( i )];
|
||||
entry.profileName
|
||||
= settings->value( "profileName" ).toString().toStdString();
|
||||
entry.showNotification
|
||||
= settings->value( "showNotification", true ).toBool();
|
||||
entry.leftControllerEnabled
|
||||
= settings->value( "leftControllerEnabled", false ).toBool();
|
||||
entry.rightControllerEnabled
|
||||
= settings->value( "rightControllerEnabled", false ).toBool();
|
||||
entry.controllerConfigs[0].digitalButtons
|
||||
= settings->value( "digitalButtons_0" ).toList();
|
||||
uint64_t buttonMask = 0;
|
||||
for ( auto b : entry.controllerConfigs[0].digitalButtons )
|
||||
{
|
||||
buttonMask |= vr::ButtonMaskFromId(
|
||||
static_cast<vr::EVRButtonId>( b.toInt() ) );
|
||||
}
|
||||
entry.controllerConfigs[0].digitalButtonMask = buttonMask;
|
||||
entry.controllerConfigs[0].triggerMode
|
||||
= settings->value( "triggerMode_0", 0 ).toUInt();
|
||||
entry.controllerConfigs[0].touchpadMode
|
||||
= settings->value( "touchpadMode_0", 0 ).toUInt();
|
||||
entry.controllerConfigs[0].touchpadAreas
|
||||
= settings->value( "touchPadAreas_0", 0 ).toUInt();
|
||||
entry.controllerConfigs[1].digitalButtons
|
||||
= settings->value( "digitalButtons_1" ).toList();
|
||||
buttonMask = 0;
|
||||
for ( auto b : entry.controllerConfigs[1].digitalButtons )
|
||||
{
|
||||
buttonMask |= vr::ButtonMaskFromId(
|
||||
static_cast<vr::EVRButtonId>( b.toInt() ) );
|
||||
}
|
||||
entry.controllerConfigs[1].digitalButtonMask = buttonMask;
|
||||
entry.controllerConfigs[1].triggerMode
|
||||
= settings->value( "triggerMode_1", 0 ).toUInt();
|
||||
entry.controllerConfigs[1].touchpadMode
|
||||
= settings->value( "touchpadMode_1", 0 ).toUInt();
|
||||
entry.controllerConfigs[1].touchpadAreas
|
||||
= settings->value( "touchPadAreas_1", 0 ).toUInt();
|
||||
}
|
||||
settings->endArray();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void PttController::savePttProfiles()
|
||||
{
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( getSettingsName() );
|
||||
settings->beginWriteArray( "pttProfiles" );
|
||||
unsigned i = 0;
|
||||
for ( auto& p : pttProfiles )
|
||||
{
|
||||
settings->setArrayIndex( static_cast<int>( i ) );
|
||||
settings->setValue( "profileName",
|
||||
QString::fromStdString( p.profileName ) );
|
||||
settings->setValue( "showNotification", p.showNotification );
|
||||
settings->setValue( "leftControllerEnabled", p.leftControllerEnabled );
|
||||
settings->setValue( "rightControllerEnabled",
|
||||
p.rightControllerEnabled );
|
||||
settings->setValue( "digitalButtons_0",
|
||||
p.controllerConfigs[0].digitalButtons );
|
||||
settings->setValue( "triggerMode_0",
|
||||
p.controllerConfigs[0].triggerMode );
|
||||
settings->setValue( "touchpadMode_0",
|
||||
p.controllerConfigs[0].touchpadMode );
|
||||
settings->setValue( "touchPadAreas_0",
|
||||
p.controllerConfigs[0].touchpadAreas );
|
||||
settings->setValue( "digitalButtons_1",
|
||||
p.controllerConfigs[1].digitalButtons );
|
||||
settings->setValue( "triggerMode_1",
|
||||
p.controllerConfigs[1].triggerMode );
|
||||
settings->setValue( "touchpadMode_1",
|
||||
p.controllerConfigs[1].touchpadMode );
|
||||
settings->setValue( "touchPadAreas_1",
|
||||
p.controllerConfigs[1].touchpadAreas );
|
||||
i++;
|
||||
}
|
||||
settings->endArray();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void PttController::reloadPttConfig()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||
@@ -153,46 +28,8 @@ void PttController::reloadPttConfig()
|
||||
settings->beginGroup( getSettingsName() );
|
||||
setPttEnabled(
|
||||
settings->value( "pttEnabled", false ).toBool(), true, false );
|
||||
setPttLeftControllerEnabled(
|
||||
settings->value( "pttLeftControllerEnabled", false ).toBool(),
|
||||
true,
|
||||
false );
|
||||
setPttRightControllerEnabled(
|
||||
settings->value( "pttRightControllerEnabled", false ).toBool(),
|
||||
true,
|
||||
false );
|
||||
setPttShowNotification(
|
||||
settings->value( "pttShowNotification", true ).toBool(), true, false );
|
||||
m_pttControllerConfigs[0].digitalButtons
|
||||
= settings->value( "pttDigitalButtons_0" ).toList();
|
||||
uint64_t buttonMask = 0;
|
||||
for ( auto b : m_pttControllerConfigs[0].digitalButtons )
|
||||
{
|
||||
buttonMask |= vr::ButtonMaskFromId(
|
||||
static_cast<vr::EVRButtonId>( b.toInt() ) );
|
||||
}
|
||||
m_pttControllerConfigs[0].digitalButtonMask = buttonMask;
|
||||
m_pttControllerConfigs[0].triggerMode
|
||||
= settings->value( "pttTriggerMode_0", 0 ).toUInt();
|
||||
m_pttControllerConfigs[0].touchpadMode
|
||||
= settings->value( "pttTouchpadMode_0", 0 ).toUInt();
|
||||
m_pttControllerConfigs[0].touchpadAreas
|
||||
= settings->value( "pttTouchPadAreas_0", 0 ).toUInt();
|
||||
m_pttControllerConfigs[1].digitalButtons
|
||||
= settings->value( "pttDigitalButtons_1" ).toList();
|
||||
buttonMask = 0;
|
||||
for ( auto b : m_pttControllerConfigs[0].digitalButtons )
|
||||
{
|
||||
buttonMask |= vr::ButtonMaskFromId(
|
||||
static_cast<vr::EVRButtonId>( b.toInt() ) );
|
||||
}
|
||||
m_pttControllerConfigs[1].digitalButtonMask = buttonMask;
|
||||
m_pttControllerConfigs[1].triggerMode
|
||||
= settings->value( "pttTriggerMode_1", 0 ).toUInt();
|
||||
m_pttControllerConfigs[1].touchpadMode
|
||||
= settings->value( "pttTouchpadMode_1", 0 ).toUInt();
|
||||
m_pttControllerConfigs[1].touchpadAreas
|
||||
= settings->value( "pttTouchPadAreas_1", 0 ).toUInt();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
@@ -201,36 +38,10 @@ void PttController::savePttConfig()
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup( getSettingsName() );
|
||||
settings->setValue( "pttEnabled", pttEnabled() );
|
||||
settings->setValue( "pttLeftControllerEnabled",
|
||||
pttLeftControllerEnabled() );
|
||||
settings->setValue( "pttRightControllerEnabled",
|
||||
pttRightControllerEnabled() );
|
||||
settings->setValue( "pttShowNotification", pttShowNotification() );
|
||||
settings->setValue( "pttDigitalButtons_0",
|
||||
m_pttControllerConfigs[0].digitalButtons );
|
||||
settings->setValue( "pttTriggerMode_0",
|
||||
m_pttControllerConfigs[0].triggerMode );
|
||||
settings->setValue( "pttTouchpadMode_0",
|
||||
m_pttControllerConfigs[0].touchpadMode );
|
||||
settings->setValue( "pttTouchPadAreas_0",
|
||||
m_pttControllerConfigs[0].touchpadAreas );
|
||||
settings->setValue( "pttDigitalButtons_1",
|
||||
m_pttControllerConfigs[1].digitalButtons );
|
||||
settings->setValue( "pttTriggerMode_1",
|
||||
m_pttControllerConfigs[1].triggerMode );
|
||||
settings->setValue( "pttTouchpadMode_1",
|
||||
m_pttControllerConfigs[1].touchpadMode );
|
||||
settings->setValue( "pttTouchPadAreas_1",
|
||||
m_pttControllerConfigs[1].touchpadAreas );
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void PttController::checkPttStatus()
|
||||
{
|
||||
// PTT Controls are now handled in the overlaycontroller using public
|
||||
// functions.
|
||||
}
|
||||
|
||||
void PttController::startPtt()
|
||||
{
|
||||
m_pttActive = true;
|
||||
@@ -255,157 +66,6 @@ void PttController::stopPtt()
|
||||
emit pttActiveChanged( m_pttActive );
|
||||
}
|
||||
|
||||
void PttController::addPttProfile( QString name )
|
||||
{
|
||||
PttProfile* profile = nullptr;
|
||||
for ( auto& p : pttProfiles )
|
||||
{
|
||||
if ( p.profileName.compare( name.toStdString() ) == 0 )
|
||||
{
|
||||
profile = &p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !profile )
|
||||
{
|
||||
auto i = pttProfiles.size();
|
||||
pttProfiles.emplace_back();
|
||||
profile = &pttProfiles[i];
|
||||
}
|
||||
profile->profileName = name.toStdString();
|
||||
profile->showNotification = m_pttShowNotification;
|
||||
profile->leftControllerEnabled = m_pttLeftControllerEnabled;
|
||||
profile->rightControllerEnabled = m_pttRightControllerEnabled;
|
||||
profile->controllerConfigs[0].digitalButtons
|
||||
= m_pttControllerConfigs[0].digitalButtons;
|
||||
profile->controllerConfigs[0].digitalButtonMask
|
||||
= m_pttControllerConfigs[0].digitalButtonMask;
|
||||
profile->controllerConfigs[0].triggerMode
|
||||
= m_pttControllerConfigs[0].triggerMode;
|
||||
profile->controllerConfigs[0].touchpadMode
|
||||
= m_pttControllerConfigs[0].touchpadMode;
|
||||
profile->controllerConfigs[0].touchpadAreas
|
||||
= m_pttControllerConfigs[0].touchpadAreas;
|
||||
profile->controllerConfigs[1].digitalButtons
|
||||
= m_pttControllerConfigs[1].digitalButtons;
|
||||
profile->controllerConfigs[1].digitalButtonMask
|
||||
= m_pttControllerConfigs[1].digitalButtonMask;
|
||||
profile->controllerConfigs[1].triggerMode
|
||||
= m_pttControllerConfigs[1].triggerMode;
|
||||
profile->controllerConfigs[1].touchpadMode
|
||||
= m_pttControllerConfigs[1].touchpadMode;
|
||||
profile->controllerConfigs[1].touchpadAreas
|
||||
= m_pttControllerConfigs[1].touchpadAreas;
|
||||
savePttProfiles();
|
||||
OverlayController::appSettings()->sync();
|
||||
emit pttProfilesUpdated();
|
||||
emit pttProfileAdded();
|
||||
}
|
||||
|
||||
void PttController::applyPttProfile( unsigned index )
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||
if ( index < pttProfiles.size() )
|
||||
{
|
||||
auto& profile = pttProfiles[index];
|
||||
setPttShowNotification( profile.showNotification );
|
||||
setPttLeftControllerEnabled( profile.leftControllerEnabled );
|
||||
setPttRightControllerEnabled( profile.rightControllerEnabled );
|
||||
m_pttControllerConfigs[0].digitalButtons
|
||||
= profile.controllerConfigs[0].digitalButtons;
|
||||
m_pttControllerConfigs[0].digitalButtonMask
|
||||
= profile.controllerConfigs[0].digitalButtonMask;
|
||||
m_pttControllerConfigs[0].triggerMode
|
||||
= profile.controllerConfigs[0].triggerMode;
|
||||
m_pttControllerConfigs[0].touchpadMode
|
||||
= profile.controllerConfigs[0].touchpadMode;
|
||||
m_pttControllerConfigs[0].touchpadAreas
|
||||
= profile.controllerConfigs[0].touchpadAreas;
|
||||
m_pttControllerConfigs[1].digitalButtons
|
||||
= profile.controllerConfigs[1].digitalButtons;
|
||||
m_pttControllerConfigs[1].digitalButtonMask
|
||||
= profile.controllerConfigs[1].digitalButtonMask;
|
||||
m_pttControllerConfigs[1].triggerMode
|
||||
= profile.controllerConfigs[1].triggerMode;
|
||||
m_pttControllerConfigs[1].touchpadMode
|
||||
= profile.controllerConfigs[1].touchpadMode;
|
||||
m_pttControllerConfigs[1].touchpadAreas
|
||||
= profile.controllerConfigs[1].touchpadAreas;
|
||||
}
|
||||
}
|
||||
|
||||
void PttController::deletePttProfile( unsigned index )
|
||||
{
|
||||
if ( index < pttProfiles.size() )
|
||||
{
|
||||
auto pos = pttProfiles.begin() + index;
|
||||
pttProfiles.erase( pos );
|
||||
savePttProfiles();
|
||||
OverlayController::appSettings()->sync();
|
||||
emit pttProfilesUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
QVariantList PttController::pttDigitalButtons( unsigned controller )
|
||||
{
|
||||
if ( controller < 2 )
|
||||
{
|
||||
return m_pttControllerConfigs[controller].digitalButtons;
|
||||
}
|
||||
return QVariantList();
|
||||
}
|
||||
|
||||
unsigned long PttController::pttDigitalButtonMask( unsigned controller )
|
||||
{
|
||||
if ( controller < 2 )
|
||||
{
|
||||
return static_cast<unsigned long>(
|
||||
m_pttControllerConfigs[controller].digitalButtonMask );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned PttController::pttTouchpadMode( unsigned controller )
|
||||
{
|
||||
if ( controller < 2 )
|
||||
{
|
||||
return m_pttControllerConfigs[controller].touchpadMode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned PttController::pttTriggerMode( unsigned controller )
|
||||
{
|
||||
if ( controller < 2 )
|
||||
{
|
||||
return m_pttControllerConfigs[controller].triggerMode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned PttController::pttTouchpadArea( unsigned controller )
|
||||
{
|
||||
if ( controller < 2 )
|
||||
{
|
||||
return m_pttControllerConfigs[controller].touchpadAreas;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned PttController::getPttProfileCount()
|
||||
{
|
||||
return static_cast<unsigned int>( pttProfiles.size() );
|
||||
}
|
||||
|
||||
QString PttController::getPttProfileName( unsigned index )
|
||||
{
|
||||
if ( index < pttProfiles.size() )
|
||||
{
|
||||
return QString::fromStdString( pttProfiles[index].profileName );
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void PttController::setPttEnabled( bool value, bool notify, bool save )
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||
@@ -448,273 +108,4 @@ void PttController::setPttShowNotification( bool value, bool notify, bool save )
|
||||
}
|
||||
}
|
||||
|
||||
void PttController::setPttLeftControllerEnabled( bool value,
|
||||
bool notify,
|
||||
bool save )
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||
if ( value != m_pttLeftControllerEnabled )
|
||||
{
|
||||
m_pttLeftControllerEnabled = value;
|
||||
if ( notify )
|
||||
{
|
||||
emit pttLeftControllerEnabledChanged( value );
|
||||
}
|
||||
if ( save )
|
||||
{
|
||||
savePttConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PttController::setPttRightControllerEnabled( bool value,
|
||||
bool notify,
|
||||
bool save )
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
|
||||
if ( value != m_pttRightControllerEnabled )
|
||||
{
|
||||
m_pttRightControllerEnabled = value;
|
||||
if ( notify )
|
||||
{
|
||||
emit pttRightControllerEnabledChanged( value );
|
||||
}
|
||||
if ( save )
|
||||
{
|
||||
savePttConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void logControllerState( const vr::VRControllerState_t& state,
|
||||
const std::string& prefix )
|
||||
{
|
||||
if ( state.ulButtonPressed
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_ApplicationMenu ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_ApplicationMenu )
|
||||
<< " pressed";
|
||||
}
|
||||
if ( state.ulButtonTouched
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_ApplicationMenu ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_ApplicationMenu )
|
||||
<< " touched";
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_Grip ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Grip )
|
||||
<< " pressed";
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_Grip ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Grip )
|
||||
<< " touched";
|
||||
}
|
||||
if ( state.ulButtonPressed
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_DPad_Left ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Left )
|
||||
<< " pressed";
|
||||
}
|
||||
if ( state.ulButtonTouched
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_DPad_Left ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Left )
|
||||
<< " touched";
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_DPad_Up ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Up )
|
||||
<< " pressed";
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_DPad_Up ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Up )
|
||||
<< " touched";
|
||||
}
|
||||
if ( state.ulButtonPressed
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_DPad_Right ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Right )
|
||||
<< " pressed";
|
||||
}
|
||||
if ( state.ulButtonTouched
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_DPad_Right ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Right )
|
||||
<< " touched";
|
||||
}
|
||||
if ( state.ulButtonPressed
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_DPad_Down ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Down )
|
||||
<< " pressed";
|
||||
}
|
||||
if ( state.ulButtonTouched
|
||||
& vr::ButtonMaskFromId( vr::k_EButton_DPad_Down ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_DPad_Down )
|
||||
<< " touched";
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_A ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_A )
|
||||
<< " pressed";
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_A ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_A )
|
||||
<< " touched";
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_Axis0 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis0 )
|
||||
<< " pressed";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis0 )
|
||||
<< " x: " << state.rAxis[0].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_Axis0 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis0 )
|
||||
<< " touched";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis0 )
|
||||
<< " x: " << state.rAxis[0].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_Axis1 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis1 )
|
||||
<< " pressed";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis1 )
|
||||
<< " x: " << state.rAxis[1].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_Axis1 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis1 )
|
||||
<< " touched";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis1 )
|
||||
<< " x: " << state.rAxis[1].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_Axis2 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis2 )
|
||||
<< " pressed";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis2 )
|
||||
<< " x: " << state.rAxis[2].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_Axis2 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis2 )
|
||||
<< " touched";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis2 )
|
||||
<< " x: " << state.rAxis[2].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_Axis3 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis3 )
|
||||
<< " pressed";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis3 )
|
||||
<< " x: " << state.rAxis[3].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_Axis3 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis3 )
|
||||
<< " touched";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis3 )
|
||||
<< " x: " << state.rAxis[3].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonPressed & vr::ButtonMaskFromId( vr::k_EButton_Axis4 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis4 )
|
||||
<< " pressed";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis4 )
|
||||
<< " x: " << state.rAxis[4].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
if ( state.ulButtonTouched & vr::ButtonMaskFromId( vr::k_EButton_Axis4 ) )
|
||||
{
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis4 )
|
||||
<< " touched";
|
||||
LOG( INFO ) << prefix
|
||||
<< vr::VRSystem()->GetButtonIdNameFromEnum(
|
||||
vr::k_EButton_Axis4 )
|
||||
<< " x: " << state.rAxis[4].x
|
||||
<< " y: " << state.rAxis[0].y;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
@@ -15,34 +15,6 @@ namespace advsettings
|
||||
// forward declaration
|
||||
class OverlayController;
|
||||
|
||||
enum TouchPadArea
|
||||
{
|
||||
PAD_AREA_LEFT = ( 1 << 0 ),
|
||||
PAD_AREA_TOP = ( 1 << 1 ),
|
||||
PAD_AREA_RIGHT = ( 1 << 2 ),
|
||||
PAD_AREA_BOTTOM = ( 1 << 3 ),
|
||||
};
|
||||
|
||||
struct PttControllerConfig
|
||||
{
|
||||
QVariantList digitalButtons;
|
||||
uint64_t digitalButtonMask = 0;
|
||||
unsigned triggerMode = 0; // 0 .. disabled, 1 .. enabled
|
||||
unsigned touchpadMode
|
||||
= 0; // 0 .. disabled, 1 .. only touch, 2 .. only press, 3 .. both
|
||||
unsigned touchpadAreas = 0;
|
||||
};
|
||||
|
||||
struct PttProfile
|
||||
{
|
||||
std::string profileName;
|
||||
|
||||
bool showNotification = false;
|
||||
bool leftControllerEnabled = false;
|
||||
bool rightControllerEnabled = false;
|
||||
PttControllerConfig controllerConfigs[2];
|
||||
};
|
||||
|
||||
class PttController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -51,25 +23,13 @@ class PttController : public QObject
|
||||
Q_PROPERTY( bool pttActive READ pttActive NOTIFY pttActiveChanged )
|
||||
Q_PROPERTY( bool pttShowNotification READ pttShowNotification WRITE
|
||||
setPttShowNotification NOTIFY pttShowNotificationChanged )
|
||||
Q_PROPERTY(
|
||||
bool pttLeftControllerEnabled READ pttLeftControllerEnabled WRITE
|
||||
setPttLeftControllerEnabled NOTIFY pttLeftControllerEnabledChanged )
|
||||
Q_PROPERTY( bool pttRightControllerEnabled READ pttRightControllerEnabled
|
||||
WRITE setPttRightControllerEnabled NOTIFY
|
||||
pttRightControllerEnabledChanged )
|
||||
|
||||
protected:
|
||||
bool m_pttEnabled = false;
|
||||
bool m_pttActive = false;
|
||||
bool m_pttShowNotification = false;
|
||||
bool m_pttLeftControllerEnabled = false;
|
||||
bool m_pttRightControllerEnabled = false;
|
||||
PttControllerConfig m_pttControllerConfigs[2];
|
||||
|
||||
std::vector<PttProfile> pttProfiles;
|
||||
|
||||
protected:
|
||||
void checkPttStatus();
|
||||
virtual QString getSettingsName() = 0;
|
||||
virtual void onPttStart() {}
|
||||
virtual void onPttStop() {}
|
||||
@@ -86,62 +46,23 @@ public:
|
||||
bool pttEnabled() const;
|
||||
bool pttActive() const;
|
||||
bool pttShowNotification() const;
|
||||
bool pttLeftControllerEnabled() const;
|
||||
bool pttRightControllerEnabled() const;
|
||||
|
||||
void startPtt();
|
||||
void stopPtt();
|
||||
|
||||
void reloadPttProfiles();
|
||||
void reloadPttConfig();
|
||||
void savePttProfiles();
|
||||
void savePttConfig();
|
||||
|
||||
virtual bool pttChangeValid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Q_INVOKABLE QVariantList pttDigitalButtons( unsigned controller );
|
||||
Q_INVOKABLE unsigned long pttDigitalButtonMask( unsigned controller );
|
||||
Q_INVOKABLE unsigned pttTouchpadMode( unsigned controller );
|
||||
Q_INVOKABLE unsigned pttTriggerMode( unsigned controller );
|
||||
Q_INVOKABLE unsigned pttTouchpadArea( unsigned controller );
|
||||
|
||||
Q_INVOKABLE unsigned getPttProfileCount();
|
||||
Q_INVOKABLE QString getPttProfileName( unsigned index );
|
||||
|
||||
public slots:
|
||||
void setPttEnabled( bool value, bool notify = true, bool save = true );
|
||||
void setPttShowNotification( bool value,
|
||||
bool notify = true,
|
||||
bool save = true );
|
||||
void setPttLeftControllerEnabled( bool value,
|
||||
bool notify = true,
|
||||
bool save = true );
|
||||
void setPttRightControllerEnabled( bool value,
|
||||
bool notify = true,
|
||||
bool save = true );
|
||||
|
||||
void setPttControllerConfig( unsigned controller,
|
||||
QVariantList buttons,
|
||||
unsigned triggerMode,
|
||||
unsigned padMode,
|
||||
unsigned padAreas );
|
||||
|
||||
void addPttProfile( QString name );
|
||||
void applyPttProfile( unsigned index );
|
||||
void deletePttProfile( unsigned index );
|
||||
|
||||
signals:
|
||||
void pttEnabledChanged( bool value );
|
||||
void pttActiveChanged( bool value );
|
||||
void pttShowNotificationChanged( bool value );
|
||||
void pttLeftControllerEnabledChanged( bool value );
|
||||
void pttRightControllerEnabledChanged( bool value );
|
||||
|
||||
void pttProfilesUpdated();
|
||||
void pttProfileAdded();
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
Reference in New Issue
Block a user