From 48738c87abb78a29dcda4b7c9a2c6c306989f3e1 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 21 Aug 2018 23:11:40 +0200 Subject: [PATCH] Keyboard and input manager cleanup/style --- src/blackcore/inputmanager.cpp | 2 +- src/blackcore/inputmanager.h | 19 ++++++++++--------- src/blackinput/keyboard.cpp | 1 - src/blackinput/keyboard.h | 4 +--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/blackcore/inputmanager.cpp b/src/blackcore/inputmanager.cpp index 235e8013a..fafabfac5 100644 --- a/src/blackcore/inputmanager.cpp +++ b/src/blackcore/inputmanager.cpp @@ -69,7 +69,7 @@ namespace BlackCore } } - void CInputManager::ps_changeHotkeySettings() + void CInputManager::onChangedHotkeySettings() { m_configuredActions.clear(); for (const CActionHotkey &actionHotkey : m_actionHotkeys.getThreadLocal()) diff --git a/src/blackcore/inputmanager.h b/src/blackcore/inputmanager.h index d0a77bb79..04647d2a2 100644 --- a/src/blackcore/inputmanager.h +++ b/src/blackcore/inputmanager.h @@ -111,9 +111,6 @@ namespace BlackCore void ps_processKeyCombinationChanged(const BlackMisc::Input::CHotkeyCombination &combination); void ps_processButtonCombinationChanged(const BlackMisc::Input::CHotkeyCombination &combination); - //! Change hotkey settings - void ps_changeHotkeySettings(); - private: //! Handle to a bound action struct BindInfo @@ -125,13 +122,17 @@ namespace BlackCore std::function m_function; }; + //! Change hotkey settings + void onChangedHotkeySettings(); + + //! Bind action int bindImpl(const QString &action, QObject *receiver, std::function function); + + //! Process the hotkey combination void processCombination(const BlackMisc::Input::CHotkeyCombination &combination); - static CInputManager *m_instance; - - std::unique_ptr m_keyboard; - std::unique_ptr m_joystick; + std::unique_ptr m_keyboard; //!< keyboard + std::unique_ptr m_joystick; //!< joystick QMap m_availableActions; QHash m_configuredActions; @@ -142,8 +143,8 @@ namespace BlackCore BlackMisc::Input::CHotkeyCombination m_lastCombination; BlackMisc::Input::CHotkeyCombination m_capturedCombination; - BlackMisc::CSetting m_actionHotkeys { this, &CInputManager::ps_changeHotkeySettings }; + BlackMisc::CSetting m_actionHotkeys { this, &CInputManager::onChangedHotkeySettings }; }; -} +} // ns #endif //guard diff --git a/src/blackinput/keyboard.cpp b/src/blackinput/keyboard.cpp index 198791996..446963291 100644 --- a/src/blackinput/keyboard.cpp +++ b/src/blackinput/keyboard.cpp @@ -35,5 +35,4 @@ namespace BlackInput ptr->init(); return ptr; } - } // ns diff --git a/src/blackinput/keyboard.h b/src/blackinput/keyboard.h index d13ff1237..48878873c 100644 --- a/src/blackinput/keyboard.h +++ b/src/blackinput/keyboard.h @@ -26,6 +26,7 @@ namespace BlackInput class BLACKINPUT_EXPORT IKeyboard : public QObject { Q_OBJECT + public: //! Constructor IKeyboard(QObject *parent = nullptr); @@ -43,9 +44,6 @@ namespace BlackInput protected: //! Initializes the platform keyboard device virtual bool init() = 0; - - private: - static IKeyboard *m_instance; }; } // ns