Keyboard Press Feature and Version String Updated (#464)

* added two new keyboard press actions

* added todos to overlay controller for new actions

* added settings for keyboard press and default to f10

* added logic, fixed default value

* added action alias

* fixed center marker rotation count

* updated version strings

* fixed Trigger Condition

* removed literal limitation (character input)

* updated version string

* fixed white space issues
This commit is contained in:
ykeara
2020-06-04 11:17:58 -05:00
committed by GitHub
parent e1e4933fb3
commit 8c2af7477c
9 changed files with 97 additions and 3 deletions
+20
View File
@@ -75,6 +75,26 @@ inline void sendTokensAsInput( const std::vector<Token> tokens )
shutdownOsSystems();
}
inline void sendTokenPress( const Token token, KeyStatus event = KeyStatus::Up )
{
initOsSystems();
sendKeyPress( token, event );
shutdownOsSystems();
}
inline void sendFirstCharAsInput( const std::string inputstring,
KeyStatus event )
{
const auto tokens = ParseKeyboardInputsToTokens( inputstring );
const auto inputs = removeIncorrectTokens( tokens );
if ( !tokens.empty() )
{
sendTokenPress( inputs.front(), event );
}
}
inline void sendStringAsInput( const std::string input )
{
const auto tokens = ParseKeyboardInputsToTokens( input );
+11
View File
@@ -138,6 +138,8 @@ SteamIVRInput::SteamIVRInput()
m_keyboardOne( action_keys::keyboardOne ),
m_keyboardTwo( action_keys::keyboardTwo ),
m_keyboardThree( action_keys::keyboardThree ),
m_keyboardPressOne( action_keys::keyboardPressOne ),
m_keyboardPressTwo( action_keys::keyboardPressTwo ),
m_chaperoneToggle( action_keys::chaperoneToggle ),
m_pushToTalk( action_keys::pushToTalk ),
m_leftHaptic( action_keys::hapticsLeft ),
@@ -349,6 +351,15 @@ bool SteamIVRInput::keyboardThree()
{
return isDigitalActionActivatedOnce( m_keyboardThree );
}
bool SteamIVRInput::keyboardPressOne()
{
return isDigitalActionActivatedConstant( m_keyboardPressOne );
}
bool SteamIVRInput::keyboardPressTwo()
{
return isDigitalActionActivatedConstant( m_keyboardPressTwo );
}
/*!
Returns the action handle of the Left Haptic Action
*/
+6
View File
@@ -55,6 +55,8 @@ namespace action_keys
constexpr auto keyboardOne = "/actions/misc/in/KeyboardOne";
constexpr auto keyboardTwo = "/actions/misc/in/KeyboardTwo";
constexpr auto keyboardThree = "/actions/misc/in/KeyboardThree";
constexpr auto keyboardPressOne = "/actions/misc/in/KeyboardPressOne";
constexpr auto keyboardPressTwo = "/actions/misc/in/KeyboardPressTwo";
constexpr auto hapticsLeft = "/actions/haptic/out/HapticsLeft";
constexpr auto hapticsRight = "/actions/haptic/out/HapticsRight";
@@ -158,6 +160,8 @@ public:
bool keyboardOne();
bool keyboardTwo();
bool keyboardThree();
bool keyboardPressOne();
bool keyboardPressTwo();
vr::VRActionHandle_t leftHapticActionHandle();
vr::VRActionHandle_t rightHapticActionHandle();
@@ -225,6 +229,8 @@ private:
DigitalAction m_keyboardOne;
DigitalAction m_keyboardTwo;
DigitalAction m_keyboardThree;
DigitalAction m_keyboardPressOne;
DigitalAction m_keyboardPressTwo;
// Misc Bindings
DigitalAction m_chaperoneToggle;
+31
View File
@@ -698,6 +698,37 @@ void OverlayController::processKeyboardBindings()
sendStringAsInput( commands );
}
// Press Key One
if ( m_actions.keyboardPressOne() && !m_keyPressOneState )
{
const auto commands = settings::getSetting(
settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressOne );
sendFirstCharAsInput( commands, KeyStatus::Down );
m_keyPressOneState = true;
}
if ( m_keyPressOneState && !m_actions.keyboardPressOne() )
{
const auto commands = settings::getSetting(
settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressOne );
sendFirstCharAsInput( commands, KeyStatus::Up );
m_keyPressOneState = false;
}
// Press Key Two
if ( m_actions.keyboardPressTwo() && !m_keyPressTwoState )
{
const auto commands = settings::getSetting(
settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressTwo );
sendFirstCharAsInput( commands, KeyStatus::Down );
m_keyPressTwoState = true;
}
if ( m_keyPressTwoState && !m_actions.keyboardPressTwo() )
{
const auto commands = settings::getSetting(
settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressTwo );
sendFirstCharAsInput( commands, KeyStatus::Up );
m_keyPressTwoState = false;
}
}
void OverlayController::processRotationBindings()
{
+3
View File
@@ -179,6 +179,9 @@ private:
void processKeyboardBindings();
void processRotationBindings();
bool m_keyPressOneState = false;
bool m_keyPressTwoState = false;
public:
OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine );
virtual ~OverlayController();
+13 -1
View File
@@ -204,6 +204,16 @@
"name": "/actions/misc/in/KeyboardThree",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/misc/in/KeyboardPressOne",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/misc/in/KeyboardPressTwo",
"requirement": "optional",
"type": "boolean"
}
],
@@ -278,7 +288,9 @@
"/actions/haptic/in/ProxSensor" : "Proximity Sensor",
"/actions/misc/in/KeyboardOne" : "Keyboard Shortcut One",
"/actions/misc/in/KeyboardTwo" : "Keyboard Shortcut Two",
"/actions/misc/in/KeyboardThree" : "Keyboard Shortcut Three"
"/actions/misc/in/KeyboardThree" : "Keyboard Shortcut Three",
"/actions/misc/in/KeyboardPressOne": "Keyboard Press One",
"/actions/misc/in/KeyboardPressTwo": "Keyboard Press Two"
}
]
}
@@ -481,6 +481,7 @@ private:
constexpr static auto stringSettingsSize
= static_cast<int>( StringSetting::LAST_ENUMERATOR ) + 1;
constexpr static auto discordDefaultMuteKeybinding = "^>m";
constexpr static auto pressDefaultOne = "F9";
std::array<StringSettingValue, stringSettingsSize> m_stringSettings{
StringSettingValue{ StringSetting::KEYBOARDSHORTCUT_keyboardOne,
SettingCategory::KeyboardShortcut,
@@ -494,6 +495,14 @@ private:
SettingCategory::KeyboardShortcut,
QtInfo{ "keyboardThree" },
discordDefaultMuteKeybinding },
StringSettingValue{ StringSetting::KEYBOARDSHORTCUT_keyboardPressOne,
SettingCategory::KeyboardShortcut,
QtInfo{ "keyboardPressOne" },
pressDefaultOne },
StringSettingValue{ StringSetting::KEYBOARDSHORTCUT_keyboardPressTwo,
SettingCategory::KeyboardShortcut,
QtInfo{ "keyboardPressTwo" },
pressDefaultOne },
};
constexpr static auto intSettingsSize
+3 -1
View File
@@ -90,8 +90,10 @@ enum class StringSetting
KEYBOARDSHORTCUT_keyboardOne,
KEYBOARDSHORTCUT_keyboardTwo,
KEYBOARDSHORTCUT_keyboardThree,
KEYBOARDSHORTCUT_keyboardPressOne,
KEYBOARDSHORTCUT_keyboardPressTwo,
// LAST_ENUMERATOR must always be set to the last value
LAST_ENUMERATOR = KEYBOARDSHORTCUT_keyboardThree,
LAST_ENUMERATOR = KEYBOARDSHORTCUT_keyboardPressTwo,
};
enum class IntSetting