Add Ctrl-C and Ctrl-V buttons to utilities tab
This commit is contained in:
@@ -93,6 +93,30 @@ GroupBox {
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
spacing: 18
|
||||
Layout.fillWidth: true
|
||||
|
||||
MyPushButton {
|
||||
text: "Ctrl-C"
|
||||
Layout.preferredWidth: 150
|
||||
onClicked: {
|
||||
UtilitiesTabController.sendKeyboardCtrlC()
|
||||
}
|
||||
}
|
||||
|
||||
MyPushButton {
|
||||
text: "Ctrl-V"
|
||||
Layout.preferredWidth: 150
|
||||
onClicked: {
|
||||
UtilitiesTabController.sendKeyboardCtrlV()
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
keyboardGroupBox.visible = !OverlayController.desktopMode
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user