Add bindings to keyboard shortcuts

The default binding for keyboardOne is the default combination
for muting on Discord. This was explicitly chosen as a use case, and it
    might make people not have to tangle with creating custom
    keybindings in the .ini file.
This commit is contained in:
Vasily
2019-05-25 18:49:42 +02:00
committed by username223
parent ef124ee225
commit 7d37ec9c0d
5 changed files with 88 additions and 1 deletions
+39
View File
@@ -21,6 +21,7 @@
#include <easylogging++.h>
#include "utils/Matrix.h"
#include "openvr/overlay_utils.h"
#include "keyboard_input/input_sender.h"
// application namespace
namespace advsettings
@@ -588,6 +589,42 @@ void OverlayController::processPushToTalkBindings()
}
}
void OverlayController::processKeyboardBindings()
{
constexpr auto settingsKeyboardName = "keyboardShortcuts";
if ( m_actions.keyboardOne() )
{
constexpr auto defaultDiscordMuteBinding = "^>m";
// run keyboard
appSettings()->beginGroup( settingsKeyboardName );
const auto commands
= appSettings()
->value( "keyboardOne", defaultDiscordMuteBinding )
.toString()
.toStdString();
appSettings()->endGroup();
sendStringAsInput( commands );
}
if ( m_actions.keyboardTwo() )
{
// run keyboard
appSettings()->beginGroup( settingsKeyboardName );
const auto commands
= appSettings()->value( "keyboardTwo" ).toString().toStdString();
appSettings()->endGroup();
sendStringAsInput( commands );
}
if ( m_actions.keyboardThree() )
{
// run keyboard
appSettings()->beginGroup( settingsKeyboardName );
const auto commands
= appSettings()->value( "keyboardThree" ).toString().toStdString();
appSettings()->endGroup();
sendStringAsInput( commands );
}
}
/*!
Checks if an action has been activated and dispatches the related action if it
has been.
@@ -601,6 +638,8 @@ void OverlayController::processInputBindings()
processPushToTalkBindings();
processChaperoneBindings();
processKeyboardBindings();
}
// vsync implementation: