mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
refs #453 Refactor CInputManger and low level input handlers
This commit is contained in:
committed by
Mathew Sutcliffe
parent
63c7c6be0d
commit
199a1e5fcb
@@ -11,11 +11,10 @@
|
||||
#define BLACKINPUT_KEYBOARD_H
|
||||
|
||||
#include "blackinputexport.h"
|
||||
#include "blackmisc/hardware/keyboardkeylist.h"
|
||||
#include <QMultiMap>
|
||||
#include "blackmisc/input/keyboardkeylist.h"
|
||||
#include "blackmisc/input/hotkeycombination.h"
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace BlackInput
|
||||
{
|
||||
@@ -27,62 +26,18 @@ namespace BlackInput
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
//! Operation mode
|
||||
enum Mode
|
||||
{
|
||||
Mode_Nominal,
|
||||
Mode_Capture
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
IKeyboard(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~IKeyboard() {}
|
||||
|
||||
//! Set the list of keys to monitor
|
||||
virtual void setKeysToMonitor(const BlackMisc::Hardware::CKeyboardKeyList &keylist) = 0;
|
||||
|
||||
/*!
|
||||
* Select a key combination as hotkey. This method returns immediatly.
|
||||
* Listen for signals keySelectionChanged and keySelectionFinished
|
||||
* to retrieve the user input.
|
||||
* \param ignoreNextKey
|
||||
* Set to true, if you want to ignore the first key,
|
||||
* e.g. [ENTER] in case you are running from command line.
|
||||
*/
|
||||
virtual void startCapture(bool ignoreNextKey) = 0;
|
||||
|
||||
/*!
|
||||
* Triggers a key event manually and calls the registered functions.
|
||||
* \param key
|
||||
* \param isPressed
|
||||
*/
|
||||
virtual void triggerKey(const BlackMisc::Hardware::CKeyboardKey &key, bool isPressed) = 0;
|
||||
|
||||
//! Creates a native keyboard handler object
|
||||
static IKeyboard *getInstance();
|
||||
static std::unique_ptr<IKeyboard> create(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
/*!
|
||||
* Key selection has changed, but is not finished yet.
|
||||
* \param key
|
||||
*/
|
||||
void keySelectionChanged(BlackMisc::Hardware::CKeyboardKey key);
|
||||
|
||||
/*!
|
||||
* Key selection has finished.
|
||||
* \param key
|
||||
*/
|
||||
void keySelectionFinished(BlackMisc::Hardware::CKeyboardKey key);
|
||||
|
||||
//! Key down
|
||||
void keyDown(const BlackMisc::Hardware::CKeyboardKey &);
|
||||
|
||||
//! Key up
|
||||
void keyUp(const BlackMisc::Hardware::CKeyboardKey &);
|
||||
//! Key combination changed
|
||||
void keyCombinationChanged(const BlackMisc::Input::CHotkeyCombination &);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -92,7 +47,6 @@ namespace BlackInput
|
||||
virtual bool init() = 0;
|
||||
|
||||
private:
|
||||
|
||||
static IKeyboard *m_instance;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user