diff --git a/client.pro b/client.pro index 7ce93c0f3..c4c546c1d 100644 --- a/client.pro +++ b/client.pro @@ -9,6 +9,10 @@ contains(BLACK_CONFIG, BlackSound) { SUBDIRS += src/blacksound } +contains(BLACK_CONFIG, BlackInput) { + SUBDIRS += src/blackinput +} + contains(BLACK_CONFIG, BlackSim) { SUBDIRS += src/blacksim } diff --git a/config.pri b/config.pri index 71536da03..f39c01056 100644 --- a/config.pri +++ b/config.pri @@ -23,6 +23,7 @@ DEFINES += BLACK_VERSION=$$BLACK_VERSION BLACK_CONFIG += BlackCore BLACK_CONFIG += BlackGui BLACK_CONFIG += BlackSound +BLACK_CONFIG += BlackInput BLACK_CONFIG += BlackSim BLACK_CONFIG += Samples BLACK_CONFIG += Unittests @@ -35,6 +36,7 @@ BLACK_CONFIG += FSX ################################ contains(BLACK_CONFIG, BlackSound) { DEFINES += WITH_BLACKSOUND } +contains(BLACK_CONFIG, BlackInput) { DEFINES += WITH_BLACKINPUT } contains(BLACK_CONFIG, BlackSim) { DEFINES += WITH_BLACKSIM } contains(BLACK_CONFIG, BlackCore) { DEFINES += WITH_BLACKCORE } contains(BLACK_CONFIG, BlackGui) { DEFINES += WITH_BLACKGUI } diff --git a/libraries.pri b/libraries.pri index cdabfbdd5..39df0342a 100644 --- a/libraries.pri +++ b/libraries.pri @@ -20,6 +20,10 @@ blacksound { LIBS += -lblacksound } +blackinput { + LIBS += -lblackinput +} + blacksim { LIBS += -lblacksim } diff --git a/samples/blackcore/sample_blackcore.pro b/samples/blackcore/sample_blackcore.pro index c5f85f50f..74157402f 100644 --- a/samples/blackcore/sample_blackcore.pro +++ b/samples/blackcore/sample_blackcore.pro @@ -10,7 +10,7 @@ TEMPLATE = app CONFIG += console CONFIG -= app_bundle -CONFIG += blackmisc blacksound blackcore blacksim +CONFIG += blackmisc blacksound blackinput blackcore blacksim DEPENDPATH += . ../../src/blackmisc ../../src/blacksound ../../src/blackcore ../../src/blacksim INCLUDEPATH += . ../../src diff --git a/samples/blackgui/mainwindow.h b/samples/blackgui/mainwindow.h index f1600c6a9..67635a158 100644 --- a/samples/blackgui/mainwindow.h +++ b/samples/blackgui/mainwindow.h @@ -12,7 +12,7 @@ #include "infowindow.h" #include "guimodeenums.h" -#include "blackcore/keyboard.h" +#include "blackinput/keyboard.h" #include "blackcore/context_audio.h" #include "blackcore/context_network.h" #include "blackcore/context_settings.h" @@ -132,7 +132,7 @@ private: QLabel *m_statusBarLabel; /*!< status bar label */ // Hotkeys - BlackCore::IKeyboard *m_keyboard; + BlackInput::IKeyboard *m_keyboard; //! GUI status update void updateGuiStatusInformation(); diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp index 31a0df1c9..248d04f0b 100644 --- a/samples/blackgui/mainwindow_init.cpp +++ b/samples/blackgui/mainwindow_init.cpp @@ -320,7 +320,7 @@ void MainWindow::setHotkeys() Q_ASSERT(this->getIContextSettings()); if (!this->m_keyboard) { - this->m_keyboard = BlackCore::IKeyboard::getInstance(); + this->m_keyboard = BlackInput::IKeyboard::getInstance(); } else { diff --git a/samples/blackgui/sample_blackgui.pro b/samples/blackgui/sample_blackgui.pro index 3c9f61aca..b8be66206 100644 --- a/samples/blackgui/sample_blackgui.pro +++ b/samples/blackgui/sample_blackgui.pro @@ -10,7 +10,7 @@ TEMPLATE = app SOURCES += *.cpp HEADERS += *.h FORMS += *.ui -CONFIG += blackmisc blacksound blackcore blackgui blacksim +CONFIG += blackmisc blacksound blackinput blackcore blackgui blacksim DEPENDPATH += . ../../src/blackmisc ../../src/blackgui ../../src/blacksound ../../src/blacksim ../../src/blackcore INCLUDEPATH += . ../../src diff --git a/samples/hotkey/hotkey.cpp b/samples/hotkey/hotkey.cpp index ece4ea548..ce30336b8 100644 --- a/samples/hotkey/hotkey.cpp +++ b/samples/hotkey/hotkey.cpp @@ -16,7 +16,7 @@ HotkeyDialog::HotkeyDialog(QWidget *parent) : m_lblHotkey(nullptr), m_led(nullptr) { - m_keyboard = BlackCore::IKeyboard::getInstance(); + m_keyboard = BlackInput::IKeyboard::getInstance(); setupUi(); setupConnections(); @@ -87,7 +87,7 @@ void HotkeyDialog::setupUi() } void HotkeyDialog::setupConnections() { - connect(m_keyboard, &BlackCore::IKeyboard::keySelectionChanged, this, &HotkeyDialog::keySelectionChanged); - connect(m_keyboard, &BlackCore::IKeyboard::keySelectionFinished, this, &HotkeyDialog::keySelectionFinished); + connect(m_keyboard, &BlackInput::IKeyboard::keySelectionChanged, this, &HotkeyDialog::keySelectionChanged); + connect(m_keyboard, &BlackInput::IKeyboard::keySelectionFinished, this, &HotkeyDialog::keySelectionFinished); connect(m_pbSelect, &QPushButton::clicked, this, &HotkeyDialog::selectHotKey); } diff --git a/samples/hotkey/hotkey.h b/samples/hotkey/hotkey.h index 81b84dd43..de6788b62 100644 --- a/samples/hotkey/hotkey.h +++ b/samples/hotkey/hotkey.h @@ -7,7 +7,7 @@ #define BLACKSAMPLE_HOTKEY_H #include "led.h" -#include "blackcore/keyboard.h" +#include "blackinput/keyboard.h" #include "blackmisc/hwkeyboardkey.h" #include @@ -57,7 +57,7 @@ private: void setupUi(); void setupConnections(); - BlackCore::IKeyboard *m_keyboard; + BlackInput::IKeyboard *m_keyboard; QPushButton *m_pbSelect; QLabel *m_lblHotkey; CLed *m_led; diff --git a/samples/hotkey/sample_hotkey.pro b/samples/hotkey/sample_hotkey.pro index 5ecc7bd78..db5f7fcd9 100644 --- a/samples/hotkey/sample_hotkey.pro +++ b/samples/hotkey/sample_hotkey.pro @@ -9,7 +9,7 @@ TARGET = sample_hotkey TEMPLATE = app CONFIG -= app_bundle -CONFIG += blackmisc blackcore +CONFIG += blackmisc blackinput blackcore DEPENDPATH += . ../../src INCLUDEPATH += . ../../src diff --git a/src/blackcore/blackcore.pro b/src/blackcore/blackcore.pro index 539590ce9..de017c417 100644 --- a/src/blackcore/blackcore.pro +++ b/src/blackcore/blackcore.pro @@ -8,7 +8,7 @@ QT += network dbus xml multimedia TARGET = blackcore TEMPLATE = lib CONFIG += staticlib -CONFIG += blackmisc blacksim +CONFIG += blackmisc blackinput blacksim INCLUDEPATH += .. DEPENDPATH += . .. @@ -25,21 +25,6 @@ DEFINES += LOG_IN_FILE HEADERS += *.h SOURCES += *.cpp -win32 { - HEADERS += $$PWD/win/*.h - SOURCES += $$PWD/win/*.cpp -} - -unix:!macx { - HEADERS += $$PWD/linux/*.h - SOURCES += $$PWD/linux/*.cpp -} - -macx { - HEADERS += $$PWD/mac/*.h - SOURCES += $$PWD/mac/*.cpp -} - win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib ../../lib/blacksound.lib ../../lib/blacksim.lib else: PRE_TARGETDEPS += ../../lib/libblackmisc.a ../../lib/libblacksound.a ../../lib/libblacksim.a diff --git a/src/blackcore/context_audio_impl.cpp b/src/blackcore/context_audio_impl.cpp index c651d860a..5fe830f06 100644 --- a/src/blackcore/context_audio_impl.cpp +++ b/src/blackcore/context_audio_impl.cpp @@ -34,8 +34,7 @@ namespace BlackCore m_voice->moveToThread(&m_threadVoice); m_threadVoice.start(); - // 2. Hotkeys - m_keyboard = IKeyboard::getInstance(); + m_keyboard = BlackInput::IKeyboard::getInstance(); // 3. own aircraft, if possible if (this->getIContextOwnAircraft()) m_voice->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign()); diff --git a/src/blackcore/context_audio_impl.h b/src/blackcore/context_audio_impl.h index fcfa35475..ace346f3e 100644 --- a/src/blackcore/context_audio_impl.h +++ b/src/blackcore/context_audio_impl.h @@ -11,7 +11,7 @@ #include "context_runtime.h" #include "dbus_server.h" #include "voice_vatlib.h" -#include "blackcore/keyboard.h" +#include "blackinput/keyboard.h" #include #include @@ -127,8 +127,8 @@ namespace BlackCore bool inTransitionState() const; CVoiceVatlib *m_voice; //!< underlying voice lib - IKeyboard *m_keyboard; - IKeyboard::RegistrationHandle m_handlePtt; + BlackInput::IKeyboard *m_keyboard; + BlackInput::IKeyboard::RegistrationHandle m_handlePtt; QThread m_threadVoice; }; } diff --git a/src/blackcore/context_settings.h b/src/blackcore/context_settings.h index e20fa8242..95423decb 100644 --- a/src/blackcore/context_settings.h +++ b/src/blackcore/context_settings.h @@ -8,7 +8,7 @@ #include "blackcore/context.h" #include "blackcore/dbus_server.h" -#include "blackcore/keyboard.h" +#include "blackinput/keyboard.h" #include "blackmisc/hwkeyboardkeylist.h" #include "blackmisc/statusmessagelist.h" #include "blackmisc/settingutilities.h" diff --git a/src/blackinput/blackinput.pro b/src/blackinput/blackinput.pro new file mode 100644 index 000000000..6e20501f8 --- /dev/null +++ b/src/blackinput/blackinput.pro @@ -0,0 +1,46 @@ +include (../../config.pri) +include (../../build.pri) + +QT += network dbus gui multimedia + +TARGET = blackinput +TEMPLATE = lib +CONFIG += staticlib +CONFIG += blackmisc + +INCLUDEPATH += .. +DEPENDPATH += . .. + +# PRECOMPILED_HEADER = stdpch.h +precompile_header:!isEmpty(PRECOMPILED_HEADER) { + DEFINES += USING_PCH +} + +DEFINES += LOG_IN_FILE + +win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib +else: PRE_TARGETDEPS += ../../lib/libblackmisc.a + +HEADERS += *.h +SOURCES += *.cpp + +win32 { + HEADERS += $$PWD/win/*.h + SOURCES += $$PWD/win/*.cpp +} + +unix:!macx { + HEADERS += $$PWD/linux/*.h + SOURCES += $$PWD/linux/*.cpp +} + +macx { + HEADERS += $$PWD/osx/*.h + SOURCES += $$PWD/osx/*.cpp +} + +DESTDIR = ../../lib +OTHER_FILES += +RESOURCES += + +include (../../libraries.pri) diff --git a/src/blackcore/keyboard.cpp b/src/blackinput/keyboard.cpp similarity index 87% rename from src/blackcore/keyboard.cpp rename to src/blackinput/keyboard.cpp index a5d118ef9..135125cbe 100644 --- a/src/blackcore/keyboard.cpp +++ b/src/blackinput/keyboard.cpp @@ -6,16 +6,16 @@ #include "keyboard.h" #if defined(Q_OS_WIN) - #include "blackcore/win/keyboard_windows.h" + #include "win/keyboard_windows.h" #elif defined(Q_OS_LINUX) - #include "blackcore/linux/keyboard_linux.h" + #include "linux/keyboard_linux.h" #elif defined(Q_OS_OSX) - #include "blackcore/mac/keyboard_mac.h" + #include "osx/keyboard_mac.h" #else #error "Platform is not supported!" #endif -namespace BlackCore +namespace BlackInput { IKeyboard *IKeyboard::m_instance = nullptr; @@ -49,4 +49,4 @@ namespace BlackCore return false; } -} // BlackCore +} // BlackInput diff --git a/src/blackcore/keyboard.h b/src/blackinput/keyboard.h similarity index 97% rename from src/blackcore/keyboard.h rename to src/blackinput/keyboard.h index 281f973d7..dd94c321b 100644 --- a/src/blackcore/keyboard.h +++ b/src/blackinput/keyboard.h @@ -7,8 +7,8 @@ \file */ -#ifndef BLACKCORE_KEYBOARD_H -#define BLACKCORE_KEYBOARD_H +#ifndef BLACKINPUT_KEYBOARD_H +#define BLACKINPUT_KEYBOARD_H #include "../blackmisc/hwkeyboardkey.h" #include @@ -16,7 +16,7 @@ #include #include -namespace BlackCore +namespace BlackInput { /*! * \brief Abstract interface for native keyboard handling. @@ -181,4 +181,4 @@ namespace BlackCore bool operator==(IKeyboard::RegistrationHandle const &lhs, IKeyboard::RegistrationHandle const &rhs); } -#endif // BLACKCORE_KEYBOARD_H +#endif // BLACKINPUT_KEYBOARD_H diff --git a/src/blackcore/linux/keyboard_linux.cpp b/src/blackinput/linux/keyboard_linux.cpp similarity index 99% rename from src/blackcore/linux/keyboard_linux.cpp rename to src/blackinput/linux/keyboard_linux.cpp index c12a86053..0eca67192 100644 --- a/src/blackcore/linux/keyboard_linux.cpp +++ b/src/blackinput/linux/keyboard_linux.cpp @@ -8,7 +8,7 @@ using namespace BlackMisc::Hardware; -namespace BlackCore +namespace BlackInput { CKeyboardLinux::CKeyboardLinux(QObject *parent) : IKeyboard(parent), diff --git a/src/blackcore/linux/keyboard_linux.h b/src/blackinput/linux/keyboard_linux.h similarity index 94% rename from src/blackcore/linux/keyboard_linux.h rename to src/blackinput/linux/keyboard_linux.h index dc9c73303..3f533cf1f 100644 --- a/src/blackcore/linux/keyboard_linux.h +++ b/src/blackinput/linux/keyboard_linux.h @@ -7,14 +7,14 @@ \file */ -#ifndef BLACKCORE_KEYBOARD_LINUX_H -#define BLACKCORE_KEYBOARD_LINUX_H +#ifndef BLACKINPUT_KEYBOARD_LINUX_H +#define BLACKINPUT_KEYBOARD_LINUX_H -#include "blackcore/keyboard.h" +#include "blackinput/keyboard.h" #include "blackmisc/hwkeyboardkey.h" #include -namespace BlackCore +namespace BlackInput { //! \brief Linux implemenation of IKeyboard using hook procedure //! \todo Change QHash to a CCollection object @@ -84,4 +84,4 @@ namespace BlackCore }; } -#endif // BLACKCORE_KEYBOARD_LINUX_H +#endif // BLACKINPUT_KEYBOARD_LINUX_H diff --git a/src/blackcore/mac/keyboard_mac.cpp b/src/blackinput/osx/keyboard_mac.cpp similarity index 99% rename from src/blackcore/mac/keyboard_mac.cpp rename to src/blackinput/osx/keyboard_mac.cpp index 81210f4c5..f8add041c 100644 --- a/src/blackcore/mac/keyboard_mac.cpp +++ b/src/blackinput/osx/keyboard_mac.cpp @@ -8,7 +8,7 @@ using namespace BlackMisc::Hardware; -namespace BlackCore +namespace BlackInput { CKeyboardMac::CKeyboardMac(QObject *parent) : IKeyboard(parent), diff --git a/src/blackcore/mac/keyboard_mac.h b/src/blackinput/osx/keyboard_mac.h similarity index 94% rename from src/blackcore/mac/keyboard_mac.h rename to src/blackinput/osx/keyboard_mac.h index ea4b8373f..f818525bd 100644 --- a/src/blackcore/mac/keyboard_mac.h +++ b/src/blackinput/osx/keyboard_mac.h @@ -7,14 +7,14 @@ \file */ -#ifndef BLACKCORE_KEYBOARD_MAC_H -#define BLACKCORE_KEYBOARD_MAC_H +#ifndef BLACKINPUT_KEYBOARD_MAC_H +#define BLACKINPUT_KEYBOARD_MAC_H -#include "blackcore/keyboard.h" +#include "blackinput/keyboard.h" #include "blackmisc/hwkeyboardkey.h" #include -namespace BlackCore +namespace BlackInput { //! \brief Linux implemenation of IKeyboard using hook procedure //! \todo Change QHash to a CCollection object @@ -84,4 +84,4 @@ namespace BlackCore }; } -#endif // BLACKCORE_KEYBOARD_MAC_H +#endif // BLACKINPUT_KEYBOARD_MAC_H diff --git a/src/blackcore/win/keyboard_windows.cpp b/src/blackinput/win/keyboard_windows.cpp similarity index 99% rename from src/blackcore/win/keyboard_windows.cpp rename to src/blackinput/win/keyboard_windows.cpp index c86670f8b..6324a3151 100644 --- a/src/blackcore/win/keyboard_windows.cpp +++ b/src/blackinput/win/keyboard_windows.cpp @@ -9,7 +9,7 @@ using namespace BlackMisc::Hardware; -namespace BlackCore +namespace BlackInput { CKeyboardWindows::CKeyboardWindows(QObject *parent) : IKeyboard(parent), diff --git a/src/blackcore/win/keyboard_windows.h b/src/blackinput/win/keyboard_windows.h similarity index 95% rename from src/blackcore/win/keyboard_windows.h rename to src/blackinput/win/keyboard_windows.h index 9577bf570..aa504f390 100644 --- a/src/blackcore/win/keyboard_windows.h +++ b/src/blackinput/win/keyboard_windows.h @@ -7,10 +7,10 @@ \file */ -#ifndef BLACKCORE_KEYBOARD_WINDOWS_H -#define BLACKCORE_KEYBOARD_WINDOWS_H +#ifndef BLACKINPUT_KEYBOARD_WINDOWS_H +#define BLACKINPUT_KEYBOARD_WINDOWS_H -#include "blackcore/keyboard.h" +#include "blackinput/keyboard.h" #include "blackmisc/hwkeyboardkey.h" #include #ifndef NOMINMAX @@ -18,7 +18,7 @@ #endif #include -namespace BlackCore +namespace BlackInput { //! \brief Windows implemenation of IKeyboard using hook procedure //! \todo Change QHash to a CCollection object @@ -107,4 +107,4 @@ namespace BlackCore }; } -#endif // BLACKCORE_KEYBOARD_WINDOWS_H +#endif // BLACKINPUT_KEYBOARD_WINDOWS_H diff --git a/src/blackcore/win/keymapping_windows.cpp b/src/blackinput/win/keymapping_windows.cpp similarity index 99% rename from src/blackcore/win/keymapping_windows.cpp rename to src/blackinput/win/keymapping_windows.cpp index 6ee827468..63f9028f1 100644 --- a/src/blackcore/win/keymapping_windows.cpp +++ b/src/blackinput/win/keymapping_windows.cpp @@ -13,7 +13,7 @@ using namespace BlackMisc::Hardware; -namespace BlackCore +namespace BlackInput { Qt::Key CKeyMappingWindows::convertToKey(WPARAM virtualKey) { diff --git a/src/blackcore/win/keymapping_windows.h b/src/blackinput/win/keymapping_windows.h similarity index 89% rename from src/blackcore/win/keymapping_windows.h rename to src/blackinput/win/keymapping_windows.h index 884367fe1..b406a9785 100644 --- a/src/blackcore/win/keymapping_windows.h +++ b/src/blackinput/win/keymapping_windows.h @@ -4,8 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef BLACKCORE_KEYMAPPING_WINDOWS_H -#define BLACKCORE_KEYMAPPING_WINDOWS_H +#ifndef BLACKINPUT_KEYMAPPING_WINDOWS_H +#define BLACKINPUT_KEYMAPPING_WINDOWS_H #include "blackmisc/hwkeyboardkey.h" #ifndef NOMINMAX @@ -13,7 +13,7 @@ #endif #include -namespace BlackCore +namespace BlackInput { //! \brief This class provides methods to map between windows virtual keys and CKeyboardKey class CKeyMappingWindows @@ -41,5 +41,5 @@ namespace BlackCore static bool isModifier(WPARAM vkcode); }; -} // namespace BlackCore +} // namespace BlackInput #endif // guard