refactor: Rename BlackInput to swift::input

This commit is contained in:
Lars Toenning
2024-11-10 13:15:25 +01:00
parent 9c879aea1c
commit 685f455eab
24 changed files with 77 additions and 77 deletions

View File

@@ -5,7 +5,7 @@ add_subdirectory(config)
add_subdirectory(blackcore) add_subdirectory(blackcore)
add_subdirectory(blackmisc) add_subdirectory(blackmisc)
add_subdirectory(blackgui) add_subdirectory(blackgui)
add_subdirectory(blackinput) add_subdirectory(input)
add_subdirectory(blacksound) add_subdirectory(blacksound)
add_subdirectory(swiftguistandard) add_subdirectory(swiftguistandard)

View File

@@ -13,7 +13,7 @@
// clazy:excludeall=detaching-member // clazy:excludeall=detaching-member
using namespace BlackInput; using namespace swift::input;
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Input; using namespace BlackMisc::Input;

View File

@@ -8,8 +8,8 @@
#include "blackcore/blackcoreexport.h" #include "blackcore/blackcoreexport.h"
#include "blackcore/application/applicationsettings.h" #include "blackcore/application/applicationsettings.h"
#include "blackinput/joystick.h" #include "input/joystick.h"
#include "blackinput/keyboard.h" #include "input/keyboard.h"
#include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/hotkeycombination.h"
#include "blackmisc/input/joystickbuttonlist.h" #include "blackmisc/input/joystickbuttonlist.h"
#include "blackmisc/settingscache.h" #include "blackmisc/settingscache.h"
@@ -91,7 +91,7 @@ namespace BlackCore
//! Releases all devices //! Releases all devices
void releaseDevices(); void releaseDevices();
//! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons()
BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const; BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const;
signals: signals:
@@ -130,8 +130,8 @@ namespace BlackCore
//! Process the hotkey combination //! Process the hotkey combination
void processCombination(const BlackMisc::Input::CHotkeyCombination &combination); void processCombination(const BlackMisc::Input::CHotkeyCombination &combination);
std::unique_ptr<BlackInput::IKeyboard> m_keyboard; //!< keyboard std::unique_ptr<swift::input::IKeyboard> m_keyboard; //!< keyboard
std::unique_ptr<BlackInput::IJoystick> m_joystick; //!< joystick std::unique_ptr<swift::input::IJoystick> m_joystick; //!< joystick
QMap<QString, BlackMisc::CIcons::IconIndex> m_availableActions; QMap<QString, BlackMisc::CIcons::IconIndex> m_availableActions;
QHash<BlackMisc::Input::CHotkeyCombination, QString> m_configuredActions; QHash<BlackMisc::Input::CHotkeyCombination, QString> m_configuredActions;

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 # SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
add_library(input SHARED add_library(input SHARED
blackinputexport.h swiftinputexport.h
joystick.cpp joystick.cpp
joystick.h joystick.h
keyboard.cpp keyboard.cpp
@@ -45,7 +45,7 @@ target_link_libraries(input
misc misc
) )
target_compile_definitions(input PRIVATE BUILD_BLACKINPUT_LIB) target_compile_definitions(input PRIVATE BUILD_SWIFT_INPUT_LIB)
install(TARGETS input install(TARGETS input
LIBRARY DESTINATION lib LIBRARY DESTINATION lib

View File

@@ -13,7 +13,7 @@
# error "Platform is not supported!" # error "Platform is not supported!"
#endif #endif
namespace BlackInput namespace swift::input
{ {
IJoystick::IJoystick(QObject *parent) : QObject(parent) IJoystick::IJoystick(QObject *parent) : QObject(parent)
@@ -32,4 +32,4 @@ namespace BlackInput
return ptr; return ptr;
} }
} // BlackInput } // swift::input

View File

@@ -3,20 +3,20 @@
//! \file //! \file
#ifndef BLACKINPUT_JOYSTICK_H #ifndef SWIFT_INPUT_JOYSTICK_H
#define BLACKINPUT_JOYSTICK_H #define SWIFT_INPUT_JOYSTICK_H
#include "blackinput/blackinputexport.h" #include "input/swiftinputexport.h"
#include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/hotkeycombination.h"
#include <QObject> #include <QObject>
#include <memory> #include <memory>
namespace BlackInput namespace swift::input
{ {
/*! /*!
* Abstract interface for native joystick handling. * Abstract interface for native joystick handling.
*/ */
class BLACKINPUT_EXPORT IJoystick : public QObject class SWIFT_INPUT_EXPORT IJoystick : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -13,7 +13,7 @@
# error "Platform is not supported!" # error "Platform is not supported!"
#endif #endif
namespace BlackInput namespace swift::input
{ {
IKeyboard::IKeyboard(QObject *parent) : QObject(parent) {} IKeyboard::IKeyboard(QObject *parent) : QObject(parent) {}

View File

@@ -3,21 +3,21 @@
//! \file //! \file
#ifndef BLACKINPUT_KEYBOARD_H #ifndef SWIFT_INPUT_KEYBOARD_H
#define BLACKINPUT_KEYBOARD_H #define SWIFT_INPUT_KEYBOARD_H
#include "blackinput/blackinputexport.h" #include "input/swiftinputexport.h"
#include "blackmisc/input/keyboardkeylist.h" #include "blackmisc/input/keyboardkeylist.h"
#include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/hotkeycombination.h"
#include <QObject> #include <QObject>
#include <memory> #include <memory>
namespace BlackInput namespace swift::input
{ {
/*! /*!
* Abstract interface for native keyboard handling. * Abstract interface for native keyboard handling.
*/ */
class BLACKINPUT_EXPORT IKeyboard : public QObject class SWIFT_INPUT_EXPORT IKeyboard : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -23,7 +23,7 @@ namespace
} }
} }
namespace BlackInput namespace swift::input
{ {
CJoystickDevice::CJoystickDevice(const QString &path, QFile *fd, QObject *parent) CJoystickDevice::CJoystickDevice(const QString &path, QFile *fd, QObject *parent)
: QObject(parent), m_path(path), m_fd(fd) : QObject(parent), m_path(path), m_fd(fd)

View File

@@ -1,12 +1,12 @@
// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#ifndef BLACKINPUT_JOYSTICKLINUX_H #ifndef SWIFT_INPUT_JOYSTICKLINUX_H
#define BLACKINPUT_JOYSTICKLINUX_H #define SWIFT_INPUT_JOYSTICKLINUX_H
//! \file //! \file
#include "blackinput/joystick.h" #include "input/joystick.h"
#include "blackmisc/input/joystickbutton.h" #include "blackmisc/input/joystickbutton.h"
#include "blackmisc/collection.h" #include "blackmisc/collection.h"
#include <QMap> #include <QMap>
@@ -16,7 +16,7 @@ class QFile;
class QFileSystemWatcher; class QFileSystemWatcher;
class QSignalMapper; class QSignalMapper;
namespace BlackInput namespace swift::input
{ {
//! Linux Joystick device //! Linux Joystick device
class CJoystickDevice : public QObject class CJoystickDevice : public QObject
@@ -66,7 +66,7 @@ namespace BlackInput
//! \brief Destructor //! \brief Destructor
virtual ~CJoystickLinux() = default; virtual ~CJoystickLinux() = default;
//! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons()
virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override; virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override;
private: private:
@@ -93,6 +93,6 @@ namespace BlackInput
QFileSystemWatcher *m_inputWatcher = nullptr; QFileSystemWatcher *m_inputWatcher = nullptr;
}; };
} // namespace BlackInput } // namespace swift::input
#endif // BLACKINPUT_JOYSTICKLINUX_H #endif // SWIFT_INPUT_JOYSTICKLINUX_H

View File

@@ -14,7 +14,7 @@
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Input; using namespace BlackMisc::Input;
namespace BlackInput namespace swift::input
{ {
// https://www.cl.cam.ac.uk/~mgk25/ucs/keysymdef.h // https://www.cl.cam.ac.uk/~mgk25/ucs/keysymdef.h
static QHash<int, Input::KeyCode> keyMapping { static QHash<int, Input::KeyCode> keyMapping {

View File

@@ -3,10 +3,10 @@
//! \file //! \file
#ifndef BLACKINPUT_KEYBOARD_LINUX_H #ifndef SWIFT_INPUT_KEYBOARD_LINUX_H
#define BLACKINPUT_KEYBOARD_LINUX_H #define SWIFT_INPUT_KEYBOARD_LINUX_H
#include "blackinput/keyboard.h" #include "input/keyboard.h"
#include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/hotkeycombination.h"
#include <QHash> #include <QHash>
#include <QDir> #include <QDir>
@@ -15,7 +15,7 @@
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
namespace BlackInput namespace swift::input
{ {
//! \brief Linux implemenation of IKeyboard using hook procedure //! \brief Linux implemenation of IKeyboard using hook procedure
class CKeyboardLinux : public IKeyboard class CKeyboardLinux : public IKeyboard

View File

@@ -1,18 +1,18 @@
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#ifndef BLACKINPUT_JOYSTICKMACOS_H #ifndef SWIFT_INPUT_JOYSTICKMACOS_H
#define BLACKINPUT_JOYSTICKMACOS_H #define SWIFT_INPUT_JOYSTICKMACOS_H
//! \file //! \file
#include "blackinput/joystick.h" #include "input/joystick.h"
#include "blackmisc/input/joystickbutton.h" #include "blackmisc/input/joystickbutton.h"
#include <QHash> #include <QHash>
#include <IOKit/hid/IOHIDManager.h> #include <IOKit/hid/IOHIDManager.h>
namespace BlackInput namespace swift::input
{ {
//! Joystick device //! Joystick device
@@ -66,7 +66,7 @@ namespace BlackInput
//! Destructor //! Destructor
virtual ~CJoystickMacOS() override; virtual ~CJoystickMacOS() override;
//! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons()
virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override; virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override;
protected: protected:
@@ -95,6 +95,6 @@ namespace BlackInput
BlackMisc::Input::CHotkeyCombination m_buttonCombination; BlackMisc::Input::CHotkeyCombination m_buttonCombination;
}; };
} // namespace BlackInput } // namespace swift::input
#endif // BLACKINPUT_JOYSTICKMACOS_H #endif // SWIFT_INPUT_JOYSTICKMACOS_H

View File

@@ -13,7 +13,7 @@
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Input; using namespace BlackMisc::Input;
namespace BlackInput namespace swift::input
{ {
CJoystickDevice::CJoystickDevice(QObject *parent) : CJoystickDevice::CJoystickDevice(QObject *parent) :
QObject(parent) QObject(parent)
@@ -224,4 +224,4 @@ namespace BlackInput
obj->removeJoystickDevice(device); obj->removeJoystickDevice(device);
} }
} // namespace BlackInput } // namespace swift::input

View File

@@ -3,10 +3,10 @@
//! \file //! \file
#ifndef BLACKINPUT_KEYBOARDMACOS_H #ifndef SWIFT_INPUT_KEYBOARDMACOS_H
#define BLACKINPUT_KEYBOARDMACOS_H #define SWIFT_INPUT_KEYBOARDMACOS_H
#include "blackinput/keyboard.h" #include "input/keyboard.h"
#include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/hotkeycombination.h"
#include "blackmisc/input/keycodes.h" #include "blackmisc/input/keycodes.h"
@@ -15,7 +15,7 @@
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#include <QHash> #include <QHash>
namespace BlackInput namespace swift::input
{ {
//! MacOS implemenation of IKeyboard using hook procedure //! MacOS implemenation of IKeyboard using hook procedure
class CKeyboardMacOS : public IKeyboard class CKeyboardMacOS : public IKeyboard

View File

@@ -11,7 +11,7 @@
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Input; using namespace BlackMisc::Input;
namespace BlackInput namespace swift::input
{ {
// https://developer.apple.com/documentation/iokit/1592915-anonymous?language=objc // https://developer.apple.com/documentation/iokit/1592915-anonymous?language=objc
static QHash<quint32, KeyCode> keyMapping static QHash<quint32, KeyCode> keyMapping

View File

@@ -1,14 +1,14 @@
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#ifndef BLACKINPUT_MACOSINPUTUTILS_H #ifndef SWIFT_INPUT_MACOSINPUTUTILS_H
#define BLACKINPUT_MACOSINPUTUTILS_H #define SWIFT_INPUT_MACOSINPUTUTILS_H
//! \file //! \file
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
namespace BlackInput namespace swift::input
{ {
//! Common MacOS input utilities //! Common MacOS input utilities
class CMacOSInputUtils class CMacOSInputUtils

View File

@@ -6,7 +6,7 @@
#include <IOKit/hid/IOHIDKeys.h> #include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/hidsystem/IOHIDLib.h> #include <IOKit/hidsystem/IOHIDLib.h>
namespace BlackInput namespace swift::input
{ {
bool CMacOSInputUtils::hasAccess() bool CMacOSInputUtils::hasAccess()

View File

@@ -3,24 +3,24 @@
//! \file //! \file
#ifndef BLACKINPUT_BLACKINPUTEXPORT_H #ifndef SWIFT_INPUT_SWIFT_INPUTEXPORT_H
#define BLACKINPUT_BLACKINPUTEXPORT_H #define SWIFT_INPUT_SWIFT_INPUTEXPORT_H
#include <QtGlobal> #include <QtGlobal>
/*! /*!
* \def BLACKINPUT_EXPORT * \def SWIFT_INPUT_EXPORT
* Export a class or function from the library * Export a class or function from the library
*/ */
#ifndef WITH_STATIC #ifndef WITH_STATIC
# if defined(BUILD_BLACKINPUT_LIB) # if defined(BUILD_SWIFT_INPUT_LIB)
# define BLACKINPUT_EXPORT Q_DECL_EXPORT # define SWIFT_INPUT_EXPORT Q_DECL_EXPORT
# else # else
# define BLACKINPUT_EXPORT Q_DECL_IMPORT # define SWIFT_INPUT_EXPORT Q_DECL_IMPORT
# endif # endif
#else #else
# define BLACKINPUT_EXPORT # define SWIFT_INPUT_EXPORT
#endif #endif
#endif // guard #endif // guard

View File

@@ -16,7 +16,7 @@
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Input; using namespace BlackMisc::Input;
namespace BlackInput namespace swift::input
{ {
CJoystickDevice::CJoystickDevice(DirectInput8Ptr directInputPtr, const DIDEVICEINSTANCE *pdidInstance, QObject *parent) : QObject(parent), CJoystickDevice::CJoystickDevice(DirectInput8Ptr directInputPtr, const DIDEVICEINSTANCE *pdidInstance, QObject *parent) : QObject(parent),
m_guidDevice(pdidInstance->guidInstance), m_guidDevice(pdidInstance->guidInstance),

View File

@@ -1,13 +1,13 @@
// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#ifndef BLACKINPUT_JOYSTICKWINDOWS_H #ifndef SWIFT_INPUT_JOYSTICKWINDOWS_H
#define BLACKINPUT_JOYSTICKWINDOWS_H #define SWIFT_INPUT_JOYSTICKWINDOWS_H
//! \file //! \file
#include "blackinput/blackinputexport.h" #include "input/swiftinputexport.h"
#include "blackinput/joystick.h" #include "input/joystick.h"
#include "blackmisc/input/joystickbutton.h" #include "blackmisc/input/joystickbutton.h"
#include "blackmisc/collection.h" #include "blackmisc/collection.h"
#include <QVector> #include <QVector>
@@ -19,7 +19,7 @@
#include <dinput.h> #include <dinput.h>
namespace BlackInput namespace swift::input
{ {
//! Shared IDirectInput8 ptr //! Shared IDirectInput8 ptr
using DirectInput8Ptr = std::shared_ptr<IDirectInput8>; using DirectInput8Ptr = std::shared_ptr<IDirectInput8>;
@@ -99,7 +99,7 @@ namespace BlackInput
bool operator==(CJoystickDevice const &lhs, CJoystickDevice const &rhs); bool operator==(CJoystickDevice const &lhs, CJoystickDevice const &rhs);
//! Windows implemenation of IJoystick with DirectInput //! Windows implemenation of IJoystick with DirectInput
class BLACKINPUT_EXPORT CJoystickWindows : public IJoystick class SWIFT_INPUT_EXPORT CJoystickWindows : public IJoystick
{ {
Q_OBJECT Q_OBJECT
@@ -113,7 +113,7 @@ namespace BlackInput
//! \brief Destructor //! \brief Destructor
virtual ~CJoystickWindows() override; virtual ~CJoystickWindows() override;
//! \copydoc BlackInput::IJoystick::getAllAvailableJoystickButtons() //! \copydoc swift::input::IJoystick::getAllAvailableJoystickButtons()
virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override; virtual BlackMisc::Input::CJoystickButtonList getAllAvailableJoystickButtons() const override;
private: private:

View File

@@ -5,7 +5,7 @@
using namespace BlackMisc::Input; using namespace BlackMisc::Input;
namespace BlackInput namespace swift::input
{ {
static const auto &keyMapping() static const auto &keyMapping()
{ {

View File

@@ -3,11 +3,11 @@
//! \file //! \file
#ifndef BLACKINPUT_KEYBOARD_WINDOWS_H #ifndef SWIFT_INPUT_KEYBOARD_WINDOWS_H
#define BLACKINPUT_KEYBOARD_WINDOWS_H #define SWIFT_INPUT_KEYBOARD_WINDOWS_H
#include "blackinput/blackinputexport.h" #include "input/swiftinputexport.h"
#include "blackinput/keyboard.h" #include "input/keyboard.h"
#include "blackmisc/input/keyboardkey.h" #include "blackmisc/input/keyboardkey.h"
#include "blackmisc/input/keyboardkeylist.h" #include "blackmisc/input/keyboardkeylist.h"
#include <QHash> #include <QHash>
@@ -17,10 +17,10 @@
#endif #endif
#include <Windows.h> #include <Windows.h>
namespace BlackInput namespace swift::input
{ {
//! Windows implemenation of IKeyboard using hook procedure //! Windows implemenation of IKeyboard using hook procedure
class BLACKINPUT_EXPORT CKeyboardWindows : public IKeyboard class SWIFT_INPUT_EXPORT CKeyboardWindows : public IKeyboard
{ {
Q_OBJECT Q_OBJECT

View File

@@ -27,7 +27,7 @@
#include "config/buildconfig.h" #include "config/buildconfig.h"
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
# include "blackinput/macos/macosinpututils.h" # include "input/macos/macosinpututils.h"
#endif #endif
#include "swiftguistd.h" #include "swiftguistd.h"
@@ -455,7 +455,7 @@ void SwiftGuiStd::verifyPrerequisites()
} }
#if defined(Q_OS_MACOS) #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. // 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 // But this happens way before initializing the GUI. Hence do the check here again to show an error message