Add Ctrl-C and Ctrl-V buttons to utilities tab

This commit is contained in:
Kung-vr
2019-04-14 17:54:08 +09:00
parent c3e9d7afe4
commit ed8cc8ddf6
6 changed files with 94 additions and 0 deletions
@@ -49,6 +49,16 @@ void UtilitiesTabController::sendKeyboardAltTab()
keyboardinput::sendKeyboardAltTab();
}
void UtilitiesTabController::sendKeyboardCtrlC()
{
keyboardinput::sendKeyboardCtrlC();
}
void UtilitiesTabController::sendKeyboardCtrlV()
{
keyboardinput::sendKeyboardCtrlV();
}
void UtilitiesTabController::sendKeyboardBackspace( const int count )
{
keyboardinput::sendKeyboardBackspace( count );
@@ -58,6 +58,8 @@ public slots:
void sendKeyboardEnter();
void sendKeyboardAltTab();
void sendKeyboardAltEnter();
void sendKeyboardCtrlC();
void sendKeyboardCtrlV();
void sendKeyboardBackspace( const int count );
void sendMediaNextSong();
void sendMediaPreviousSong();
@@ -10,6 +10,8 @@ void sendKeyboardEnter();
void sendKeyboardBackspace( const int count );
void sendKeyboardAltTab();
void sendKeyboardAltEnter();
void sendKeyboardCtrlC();
void sendKeyboardCtrlV();
void sendMediaNextSong();
void sendMediaPreviousSong();
void sendMediaPausePlay();
@@ -33,6 +33,16 @@ void sendKeyboardAltEnter()
// noop
}
void sendKeyboardCtrlC()
{
// noop
}
void sendKeyboardCtrlV()
{
// noop
}
void sendMediaNextSong()
{
// noop
@@ -274,6 +274,52 @@ void sendKeyboardAltEnter()
sendKeyboardInputRaw( numberOfActions, actions );
}
/*!
Sends a Ctrl + C combination to Windows.
Used for copy in copy-paste operations.
*/
void sendKeyboardCtrlC()
{
constexpr auto ctrlKey = VK_CONTROL;
constexpr auto cKey = 0x43;
const auto pressCtrl = createInputStruct( ctrlKey, KeyStatus::Down );
const auto pressC = createInputStruct( cKey, KeyStatus::Down );
const auto releaseC = createInputStruct( cKey, KeyStatus::Up );
const auto releaseCtrl = createInputStruct( ctrlKey, KeyStatus::Up );
constexpr auto numberOfActions = 4;
INPUT actions[numberOfActions]
= { pressCtrl, pressC, releaseC, releaseCtrl };
sendKeyboardInputRaw( numberOfActions, actions );
}
/*!
Sends a Ctrl + V combination to Windows.
Used for paste in copy-paste operations.
*/
void sendKeyboardCtrlV()
{
constexpr auto ctrlKey = VK_CONTROL;
constexpr auto vKey = 0x56;
const auto pressCtrl = createInputStruct( ctrlKey, KeyStatus::Down );
const auto pressV = createInputStruct( vKey, KeyStatus::Down );
const auto releaseV = createInputStruct( vKey, KeyStatus::Up );
const auto releaseCtrl = createInputStruct( ctrlKey, KeyStatus::Up );
constexpr auto numberOfActions = 4;
INPUT actions[numberOfActions]
= { pressCtrl, pressV, releaseV, releaseCtrl };
sendKeyboardInputRaw( numberOfActions, actions );
}
/*!
Sends a media key Next Song button to Windows.
*/