diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b17955a05..cf4cffda6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory(config) add_subdirectory(blackcore) add_subdirectory(blackmisc) add_subdirectory(blackgui) -add_subdirectory(blackinput) +add_subdirectory(input) add_subdirectory(blacksound) add_subdirectory(swiftguistandard) diff --git a/src/blackcore/inputmanager.cpp b/src/blackcore/inputmanager.cpp index 8fc28d0f7..3d1775a7a 100644 --- a/src/blackcore/inputmanager.cpp +++ b/src/blackcore/inputmanager.cpp @@ -13,7 +13,7 @@ // clazy:excludeall=detaching-member -using namespace BlackInput; +using namespace swift::input; using namespace BlackMisc; using namespace BlackMisc::Input; diff --git a/src/blackcore/inputmanager.h b/src/blackcore/inputmanager.h index f621c9053..5a1bc36d3 100644 --- a/src/blackcore/inputmanager.h +++ b/src/blackcore/inputmanager.h @@ -8,8 +8,8 @@ #include "blackcore/blackcoreexport.h" #include "blackcore/application/applicationsettings.h" -#include "blackinput/joystick.h" -#include "blackinput/keyboard.h" +#include "input/joystick.h" +#include "input/keyboard.h" #include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/joystickbuttonlist.h" #include "blackmisc/settingscache.h" @@ -91,7 +91,7 @@ namespace BlackCore //! Releases all devices void releaseDevices(); - //! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() + //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons() BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const; signals: @@ -130,8 +130,8 @@ namespace BlackCore //! Process the hotkey combination void processCombination(const BlackMisc::Input::CHotkeyCombination &combination); - std::unique_ptr m_keyboard; //!< keyboard - std::unique_ptr m_joystick; //!< joystick + std::unique_ptr m_keyboard; //!< keyboard + std::unique_ptr m_joystick; //!< joystick QMap m_availableActions; QHash m_configuredActions; diff --git a/src/blackinput/CMakeLists.txt b/src/input/CMakeLists.txt similarity index 93% rename from src/blackinput/CMakeLists.txt rename to src/input/CMakeLists.txt index 3ffb9e13f..f44e94dc4 100644 --- a/src/blackinput/CMakeLists.txt +++ b/src/input/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 add_library(input SHARED - blackinputexport.h + swiftinputexport.h joystick.cpp joystick.h keyboard.cpp @@ -45,7 +45,7 @@ target_link_libraries(input misc ) -target_compile_definitions(input PRIVATE BUILD_BLACKINPUT_LIB) +target_compile_definitions(input PRIVATE BUILD_SWIFT_INPUT_LIB) install(TARGETS input LIBRARY DESTINATION lib diff --git a/src/blackinput/joystick.cpp b/src/input/joystick.cpp similarity index 95% rename from src/blackinput/joystick.cpp rename to src/input/joystick.cpp index a47c833d0..35a8c57f0 100644 --- a/src/blackinput/joystick.cpp +++ b/src/input/joystick.cpp @@ -13,7 +13,7 @@ # error "Platform is not supported!" #endif -namespace BlackInput +namespace swift::input { IJoystick::IJoystick(QObject *parent) : QObject(parent) @@ -32,4 +32,4 @@ namespace BlackInput return ptr; } -} // BlackInput +} // swift::input diff --git a/src/blackinput/joystick.h b/src/input/joystick.h similarity index 85% rename from src/blackinput/joystick.h rename to src/input/joystick.h index 3da8c7411..4a195de6a 100644 --- a/src/blackinput/joystick.h +++ b/src/input/joystick.h @@ -3,20 +3,20 @@ //! \file -#ifndef BLACKINPUT_JOYSTICK_H -#define BLACKINPUT_JOYSTICK_H +#ifndef SWIFT_INPUT_JOYSTICK_H +#define SWIFT_INPUT_JOYSTICK_H -#include "blackinput/blackinputexport.h" +#include "input/swiftinputexport.h" #include "blackmisc/input/hotkeycombination.h" #include #include -namespace BlackInput +namespace swift::input { /*! * Abstract interface for native joystick handling. */ - class BLACKINPUT_EXPORT IJoystick : public QObject + class SWIFT_INPUT_EXPORT IJoystick : public QObject { Q_OBJECT diff --git a/src/blackinput/keyboard.cpp b/src/input/keyboard.cpp similarity index 97% rename from src/blackinput/keyboard.cpp rename to src/input/keyboard.cpp index 3b40b3ac5..e0e4c39c9 100644 --- a/src/blackinput/keyboard.cpp +++ b/src/input/keyboard.cpp @@ -13,7 +13,7 @@ # error "Platform is not supported!" #endif -namespace BlackInput +namespace swift::input { IKeyboard::IKeyboard(QObject *parent) : QObject(parent) {} diff --git a/src/blackinput/keyboard.h b/src/input/keyboard.h similarity index 84% rename from src/blackinput/keyboard.h rename to src/input/keyboard.h index ff94199a4..070f94216 100644 --- a/src/blackinput/keyboard.h +++ b/src/input/keyboard.h @@ -3,21 +3,21 @@ //! \file -#ifndef BLACKINPUT_KEYBOARD_H -#define BLACKINPUT_KEYBOARD_H +#ifndef SWIFT_INPUT_KEYBOARD_H +#define SWIFT_INPUT_KEYBOARD_H -#include "blackinput/blackinputexport.h" +#include "input/swiftinputexport.h" #include "blackmisc/input/keyboardkeylist.h" #include "blackmisc/input/hotkeycombination.h" #include #include -namespace BlackInput +namespace swift::input { /*! * Abstract interface for native keyboard handling. */ - class BLACKINPUT_EXPORT IKeyboard : public QObject + class SWIFT_INPUT_EXPORT IKeyboard : public QObject { Q_OBJECT diff --git a/src/blackinput/linux/joysticklinux.cpp b/src/input/linux/joysticklinux.cpp similarity index 99% rename from src/blackinput/linux/joysticklinux.cpp rename to src/input/linux/joysticklinux.cpp index 0e823d1d1..8a1c18c23 100644 --- a/src/blackinput/linux/joysticklinux.cpp +++ b/src/input/linux/joysticklinux.cpp @@ -23,7 +23,7 @@ namespace } } -namespace BlackInput +namespace swift::input { CJoystickDevice::CJoystickDevice(const QString &path, QFile *fd, QObject *parent) : QObject(parent), m_path(path), m_fd(fd) diff --git a/src/blackinput/linux/joysticklinux.h b/src/input/linux/joysticklinux.h similarity index 90% rename from src/blackinput/linux/joysticklinux.h rename to src/input/linux/joysticklinux.h index 6fdfdcef9..3eee23c3f 100644 --- a/src/blackinput/linux/joysticklinux.h +++ b/src/input/linux/joysticklinux.h @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 -#ifndef BLACKINPUT_JOYSTICKLINUX_H -#define BLACKINPUT_JOYSTICKLINUX_H +#ifndef SWIFT_INPUT_JOYSTICKLINUX_H +#define SWIFT_INPUT_JOYSTICKLINUX_H //! \file -#include "blackinput/joystick.h" +#include "input/joystick.h" #include "blackmisc/input/joystickbutton.h" #include "blackmisc/collection.h" #include @@ -16,7 +16,7 @@ class QFile; class QFileSystemWatcher; class QSignalMapper; -namespace BlackInput +namespace swift::input { //! Linux Joystick device class CJoystickDevice : public QObject @@ -66,7 +66,7 @@ namespace BlackInput //! \brief Destructor virtual ~CJoystickLinux() = default; - //! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() + //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons() virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override; private: @@ -93,6 +93,6 @@ namespace BlackInput QFileSystemWatcher *m_inputWatcher = nullptr; }; -} // namespace BlackInput +} // namespace swift::input -#endif // BLACKINPUT_JOYSTICKLINUX_H +#endif // SWIFT_INPUT_JOYSTICKLINUX_H diff --git a/src/blackinput/linux/keyboardlinux.cpp b/src/input/linux/keyboardlinux.cpp similarity index 99% rename from src/blackinput/linux/keyboardlinux.cpp rename to src/input/linux/keyboardlinux.cpp index 62bcdbee1..3ab52d7c6 100644 --- a/src/blackinput/linux/keyboardlinux.cpp +++ b/src/input/linux/keyboardlinux.cpp @@ -14,7 +14,7 @@ using namespace BlackMisc; using namespace BlackMisc::Input; -namespace BlackInput +namespace swift::input { // https://www.cl.cam.ac.uk/~mgk25/ucs/keysymdef.h static QHash keyMapping { diff --git a/src/blackinput/linux/keyboardlinux.h b/src/input/linux/keyboardlinux.h similarity index 93% rename from src/blackinput/linux/keyboardlinux.h rename to src/input/linux/keyboardlinux.h index b41848cde..f600a280c 100644 --- a/src/blackinput/linux/keyboardlinux.h +++ b/src/input/linux/keyboardlinux.h @@ -3,10 +3,10 @@ //! \file -#ifndef BLACKINPUT_KEYBOARD_LINUX_H -#define BLACKINPUT_KEYBOARD_LINUX_H +#ifndef SWIFT_INPUT_KEYBOARD_LINUX_H +#define SWIFT_INPUT_KEYBOARD_LINUX_H -#include "blackinput/keyboard.h" +#include "input/keyboard.h" #include "blackmisc/input/hotkeycombination.h" #include #include @@ -15,7 +15,7 @@ #include #include -namespace BlackInput +namespace swift::input { //! \brief Linux implemenation of IKeyboard using hook procedure class CKeyboardLinux : public IKeyboard diff --git a/src/blackinput/macos/joystickmacos.h b/src/input/macos/joystickmacos.h similarity index 91% rename from src/blackinput/macos/joystickmacos.h rename to src/input/macos/joystickmacos.h index 37ce5f1e5..bada696b3 100644 --- a/src/blackinput/macos/joystickmacos.h +++ b/src/input/macos/joystickmacos.h @@ -1,18 +1,18 @@ // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 -#ifndef BLACKINPUT_JOYSTICKMACOS_H -#define BLACKINPUT_JOYSTICKMACOS_H +#ifndef SWIFT_INPUT_JOYSTICKMACOS_H +#define SWIFT_INPUT_JOYSTICKMACOS_H //! \file -#include "blackinput/joystick.h" +#include "input/joystick.h" #include "blackmisc/input/joystickbutton.h" #include #include -namespace BlackInput +namespace swift::input { //! Joystick device @@ -66,7 +66,7 @@ namespace BlackInput //! Destructor virtual ~CJoystickMacOS() override; - //! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() + //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons() virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override; protected: @@ -95,6 +95,6 @@ namespace BlackInput BlackMisc::Input::CHotkeyCombination m_buttonCombination; }; -} // namespace BlackInput +} // namespace swift::input -#endif // BLACKINPUT_JOYSTICKMACOS_H +#endif // SWIFT_INPUT_JOYSTICKMACOS_H diff --git a/src/blackinput/macos/joystickmacos.mm b/src/input/macos/joystickmacos.mm similarity index 99% rename from src/blackinput/macos/joystickmacos.mm rename to src/input/macos/joystickmacos.mm index 5135f7668..3688a1b6d 100644 --- a/src/blackinput/macos/joystickmacos.mm +++ b/src/input/macos/joystickmacos.mm @@ -13,7 +13,7 @@ using namespace BlackMisc; using namespace BlackMisc::Input; -namespace BlackInput +namespace swift::input { CJoystickDevice::CJoystickDevice(QObject *parent) : QObject(parent) @@ -224,4 +224,4 @@ namespace BlackInput obj->removeJoystickDevice(device); } -} // namespace BlackInput +} // namespace swift::input diff --git a/src/blackinput/macos/keyboardmacos.h b/src/input/macos/keyboardmacos.h similarity index 91% rename from src/blackinput/macos/keyboardmacos.h rename to src/input/macos/keyboardmacos.h index 770da208a..85139917c 100644 --- a/src/blackinput/macos/keyboardmacos.h +++ b/src/input/macos/keyboardmacos.h @@ -3,10 +3,10 @@ //! \file -#ifndef BLACKINPUT_KEYBOARDMACOS_H -#define BLACKINPUT_KEYBOARDMACOS_H +#ifndef SWIFT_INPUT_KEYBOARDMACOS_H +#define SWIFT_INPUT_KEYBOARDMACOS_H -#include "blackinput/keyboard.h" +#include "input/keyboard.h" #include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/keycodes.h" @@ -15,7 +15,7 @@ #include #include -namespace BlackInput +namespace swift::input { //! MacOS implemenation of IKeyboard using hook procedure class CKeyboardMacOS : public IKeyboard diff --git a/src/blackinput/macos/keyboardmacos.mm b/src/input/macos/keyboardmacos.mm similarity index 99% rename from src/blackinput/macos/keyboardmacos.mm rename to src/input/macos/keyboardmacos.mm index cf5e06ce5..0fe84a9a4 100644 --- a/src/blackinput/macos/keyboardmacos.mm +++ b/src/input/macos/keyboardmacos.mm @@ -11,7 +11,7 @@ using namespace BlackMisc; using namespace BlackMisc::Input; -namespace BlackInput +namespace swift::input { // https://developer.apple.com/documentation/iokit/1592915-anonymous?language=objc static QHash keyMapping diff --git a/src/blackinput/macos/macosinpututils.h b/src/input/macos/macosinpututils.h similarity index 88% rename from src/blackinput/macos/macosinpututils.h rename to src/input/macos/macosinpututils.h index d863983bb..bbc8f2e94 100644 --- a/src/blackinput/macos/macosinpututils.h +++ b/src/input/macos/macosinpututils.h @@ -1,14 +1,14 @@ // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 -#ifndef BLACKINPUT_MACOSINPUTUTILS_H -#define BLACKINPUT_MACOSINPUTUTILS_H +#ifndef SWIFT_INPUT_MACOSINPUTUTILS_H +#define SWIFT_INPUT_MACOSINPUTUTILS_H //! \file #include -namespace BlackInput +namespace swift::input { //! Common MacOS input utilities class CMacOSInputUtils diff --git a/src/blackinput/macos/macosinpututils.mm b/src/input/macos/macosinpututils.mm similarity index 98% rename from src/blackinput/macos/macosinpututils.mm rename to src/input/macos/macosinpututils.mm index 7fdf3a99d..4cc270e66 100644 --- a/src/blackinput/macos/macosinpututils.mm +++ b/src/input/macos/macosinpututils.mm @@ -6,7 +6,7 @@ #include #include -namespace BlackInput +namespace swift::input { bool CMacOSInputUtils::hasAccess() diff --git a/src/blackinput/blackinputexport.h b/src/input/swiftinputexport.h similarity index 54% rename from src/blackinput/blackinputexport.h rename to src/input/swiftinputexport.h index a6ae5c6c7..9cc669180 100644 --- a/src/blackinput/blackinputexport.h +++ b/src/input/swiftinputexport.h @@ -3,24 +3,24 @@ //! \file -#ifndef BLACKINPUT_BLACKINPUTEXPORT_H -#define BLACKINPUT_BLACKINPUTEXPORT_H +#ifndef SWIFT_INPUT_SWIFT_INPUTEXPORT_H +#define SWIFT_INPUT_SWIFT_INPUTEXPORT_H #include /*! - * \def BLACKINPUT_EXPORT + * \def SWIFT_INPUT_EXPORT * Export a class or function from the library */ #ifndef WITH_STATIC -# if defined(BUILD_BLACKINPUT_LIB) -# define BLACKINPUT_EXPORT Q_DECL_EXPORT +# if defined(BUILD_SWIFT_INPUT_LIB) +# define SWIFT_INPUT_EXPORT Q_DECL_EXPORT # else -# define BLACKINPUT_EXPORT Q_DECL_IMPORT +# define SWIFT_INPUT_EXPORT Q_DECL_IMPORT # endif #else -# define BLACKINPUT_EXPORT +# define SWIFT_INPUT_EXPORT #endif #endif // guard diff --git a/src/blackinput/win/joystickwindows.cpp b/src/input/win/joystickwindows.cpp similarity index 99% rename from src/blackinput/win/joystickwindows.cpp rename to src/input/win/joystickwindows.cpp index b5f44b7f9..0d1cf89d7 100644 --- a/src/blackinput/win/joystickwindows.cpp +++ b/src/input/win/joystickwindows.cpp @@ -16,7 +16,7 @@ using namespace BlackMisc; using namespace BlackMisc::Input; -namespace BlackInput +namespace swift::input { CJoystickDevice::CJoystickDevice(DirectInput8Ptr directInputPtr, const DIDEVICEINSTANCE *pdidInstance, QObject *parent) : QObject(parent), m_guidDevice(pdidInstance->guidInstance), diff --git a/src/blackinput/win/joystickwindows.h b/src/input/win/joystickwindows.h similarity index 94% rename from src/blackinput/win/joystickwindows.h rename to src/input/win/joystickwindows.h index 3a0cc8246..4833feeb4 100644 --- a/src/blackinput/win/joystickwindows.h +++ b/src/input/win/joystickwindows.h @@ -1,13 +1,13 @@ // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 -#ifndef BLACKINPUT_JOYSTICKWINDOWS_H -#define BLACKINPUT_JOYSTICKWINDOWS_H +#ifndef SWIFT_INPUT_JOYSTICKWINDOWS_H +#define SWIFT_INPUT_JOYSTICKWINDOWS_H //! \file -#include "blackinput/blackinputexport.h" -#include "blackinput/joystick.h" +#include "input/swiftinputexport.h" +#include "input/joystick.h" #include "blackmisc/input/joystickbutton.h" #include "blackmisc/collection.h" #include @@ -19,7 +19,7 @@ #include -namespace BlackInput +namespace swift::input { //! Shared IDirectInput8 ptr using DirectInput8Ptr = std::shared_ptr; @@ -99,7 +99,7 @@ namespace BlackInput bool operator==(CJoystickDevice const &lhs, CJoystickDevice const &rhs); //! Windows implemenation of IJoystick with DirectInput - class BLACKINPUT_EXPORT CJoystickWindows : public IJoystick + class SWIFT_INPUT_EXPORT CJoystickWindows : public IJoystick { Q_OBJECT @@ -113,7 +113,7 @@ namespace BlackInput //! \brief Destructor virtual ~CJoystickWindows() override; - //! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() + //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons() virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override; private: diff --git a/src/blackinput/win/keyboardwindows.cpp b/src/input/win/keyboardwindows.cpp similarity index 99% rename from src/blackinput/win/keyboardwindows.cpp rename to src/input/win/keyboardwindows.cpp index 154c8738b..d4e883417 100644 --- a/src/blackinput/win/keyboardwindows.cpp +++ b/src/input/win/keyboardwindows.cpp @@ -5,7 +5,7 @@ using namespace BlackMisc::Input; -namespace BlackInput +namespace swift::input { static const auto &keyMapping() { diff --git a/src/blackinput/win/keyboardwindows.h b/src/input/win/keyboardwindows.h similarity index 86% rename from src/blackinput/win/keyboardwindows.h rename to src/input/win/keyboardwindows.h index f67daf126..4cc68e4fd 100644 --- a/src/blackinput/win/keyboardwindows.h +++ b/src/input/win/keyboardwindows.h @@ -3,11 +3,11 @@ //! \file -#ifndef BLACKINPUT_KEYBOARD_WINDOWS_H -#define BLACKINPUT_KEYBOARD_WINDOWS_H +#ifndef SWIFT_INPUT_KEYBOARD_WINDOWS_H +#define SWIFT_INPUT_KEYBOARD_WINDOWS_H -#include "blackinput/blackinputexport.h" -#include "blackinput/keyboard.h" +#include "input/swiftinputexport.h" +#include "input/keyboard.h" #include "blackmisc/input/keyboardkey.h" #include "blackmisc/input/keyboardkeylist.h" #include @@ -17,10 +17,10 @@ #endif #include -namespace BlackInput +namespace swift::input { //! Windows implemenation of IKeyboard using hook procedure - class BLACKINPUT_EXPORT CKeyboardWindows : public IKeyboard + class SWIFT_INPUT_EXPORT CKeyboardWindows : public IKeyboard { Q_OBJECT diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index 32058c824..804cf6ae5 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -27,7 +27,7 @@ #include "config/buildconfig.h" #if defined(Q_OS_MACOS) -# include "blackinput/macos/macosinpututils.h" +# include "input/macos/macosinpututils.h" #endif #include "swiftguistd.h" @@ -455,7 +455,7 @@ void SwiftGuiStd::verifyPrerequisites() } #if defined(Q_OS_MACOS) - if (!BlackInput::CMacOSInputUtils::hasAccess()) + if (!swift::input::CMacOSInputUtils::hasAccess()) { // A log message about missing permissions is already emitted when initializing the keyboard. // But this happens way before initializing the GUI. Hence do the check here again to show an error message