Separate media keys from keyboard shortcuts
The media keys were only in the keyboard shortcuts file because their implementation was the same. With Linux support incoming their implementations are not necessarily the same.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
#include "input_sender.h"
|
||||
|
||||
void sendTokensAsInput( [[maybe_unused]] const std::vector<Token> tokens )
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#include "keyboard_input.h"
|
||||
#include "src/keyboard_input/input_sender.h"
|
||||
|
||||
namespace keyboardinput
|
||||
{
|
||||
void sendKeyboardInput( QString input )
|
||||
{
|
||||
sendStringAsInput( input.toStdString() );
|
||||
}
|
||||
|
||||
void sendKeyboardEnter()
|
||||
{
|
||||
const auto tokens = std::vector<Token>{ Token::KEY_ENTER };
|
||||
|
||||
sendTokensAsInput( tokens );
|
||||
}
|
||||
|
||||
void sendKeyboardBackspace( const int count )
|
||||
{
|
||||
const auto tokens = std::vector<Token>{ Token::KEY_BACKSPACE };
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
sendTokensAsInput( tokens );
|
||||
}
|
||||
}
|
||||
|
||||
void sendKeyboardAltTab()
|
||||
{
|
||||
const auto tokens
|
||||
= std::vector<Token>{ Token::MODIFIER_ALT, Token::KEY_TAB };
|
||||
|
||||
sendTokensAsInput( tokens );
|
||||
}
|
||||
|
||||
void sendKeyboardAltEnter()
|
||||
{
|
||||
const auto tokens
|
||||
= std::vector<Token>{ Token::MODIFIER_ALT, Token::KEY_ENTER };
|
||||
|
||||
sendTokensAsInput( tokens );
|
||||
}
|
||||
|
||||
void sendKeyboardCtrlC()
|
||||
{
|
||||
const auto tokens
|
||||
= std::vector<Token>{ Token::MODIFIER_CTRL, Token::KEY_c };
|
||||
|
||||
sendTokensAsInput( tokens );
|
||||
}
|
||||
|
||||
void sendKeyboardCtrlV()
|
||||
{
|
||||
const auto tokens
|
||||
= std::vector<Token>{ Token::MODIFIER_CTRL, Token::KEY_v };
|
||||
|
||||
sendTokensAsInput( tokens );
|
||||
}
|
||||
|
||||
} // namespace keyboardinput
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
|
||||
namespace keyboardinput
|
||||
{
|
||||
/*!
|
||||
Represents the state of a keyboard button press. Can be either Up or Down.
|
||||
|
||||
Implemented because neither Qt nor Windows.h included a sensible key state enum.
|
||||
*/
|
||||
enum class KeyStatus
|
||||
{
|
||||
Up,
|
||||
Down,
|
||||
};
|
||||
|
||||
void sendKeyboardInput( QString input );
|
||||
void sendKeyboardEnter();
|
||||
void sendKeyboardBackspace( const int count );
|
||||
void sendKeyboardAltTab();
|
||||
void sendKeyboardAltEnter();
|
||||
void sendKeyboardCtrlC();
|
||||
void sendKeyboardCtrlV();
|
||||
|
||||
} // namespace keyboardinput
|
||||
Reference in New Issue
Block a user