mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
refactor: Rename BlackInput to swift::input
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// clazy:excludeall=detaching-member
|
||||
|
||||
using namespace BlackInput;
|
||||
using namespace swift::input;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Input;
|
||||
|
||||
|
||||
@@ -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<BlackInput::IKeyboard> m_keyboard; //!< keyboard
|
||||
std::unique_ptr<BlackInput::IJoystick> m_joystick; //!< joystick
|
||||
std::unique_ptr<swift::input::IKeyboard> m_keyboard; //!< keyboard
|
||||
std::unique_ptr<swift::input::IJoystick> m_joystick; //!< joystick
|
||||
|
||||
QMap<QString, BlackMisc::CIcons::IconIndex> m_availableActions;
|
||||
QHash<BlackMisc::Input::CHotkeyCombination, QString> m_configuredActions;
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 <QObject>
|
||||
#include <memory>
|
||||
|
||||
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
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# error "Platform is not supported!"
|
||||
#endif
|
||||
|
||||
namespace BlackInput
|
||||
namespace swift::input
|
||||
{
|
||||
IKeyboard::IKeyboard(QObject *parent) : QObject(parent) {}
|
||||
|
||||
@@ -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 <QObject>
|
||||
#include <memory>
|
||||
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
@@ -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 <QMap>
|
||||
@@ -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
|
||||
@@ -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<int, Input::KeyCode> keyMapping {
|
||||
@@ -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 <QHash>
|
||||
#include <QDir>
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
namespace BlackInput
|
||||
namespace swift::input
|
||||
{
|
||||
//! \brief Linux implemenation of IKeyboard using hook procedure
|
||||
class CKeyboardLinux : public IKeyboard
|
||||
@@ -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 <QHash>
|
||||
#include <IOKit/hid/IOHIDManager.h>
|
||||
|
||||
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
|
||||
@@ -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
|
||||
@@ -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 <ApplicationServices/ApplicationServices.h>
|
||||
#include <QHash>
|
||||
|
||||
namespace BlackInput
|
||||
namespace swift::input
|
||||
{
|
||||
//! MacOS implemenation of IKeyboard using hook procedure
|
||||
class CKeyboardMacOS : public IKeyboard
|
||||
@@ -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<quint32, KeyCode> keyMapping
|
||||
@@ -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 <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
namespace BlackInput
|
||||
namespace swift::input
|
||||
{
|
||||
//! Common MacOS input utilities
|
||||
class CMacOSInputUtils
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
#include <IOKit/hidsystem/IOHIDLib.h>
|
||||
|
||||
namespace BlackInput
|
||||
namespace swift::input
|
||||
{
|
||||
|
||||
bool CMacOSInputUtils::hasAccess()
|
||||
@@ -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 <QtGlobal>
|
||||
|
||||
/*!
|
||||
* \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
|
||||
@@ -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),
|
||||
@@ -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 <QVector>
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
namespace BlackInput
|
||||
namespace swift::input
|
||||
{
|
||||
//! Shared IDirectInput8 ptr
|
||||
using DirectInput8Ptr = std::shared_ptr<IDirectInput8>;
|
||||
@@ -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:
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
using namespace BlackMisc::Input;
|
||||
|
||||
namespace BlackInput
|
||||
namespace swift::input
|
||||
{
|
||||
static const auto &keyMapping()
|
||||
{
|
||||
@@ -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 <QHash>
|
||||
@@ -17,10 +17,10 @@
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user