mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
[AFV] CInputManager stores icon indexes instead of QPixmap instances
The GUI converts icon indexes to QPixmap indexes when needed. This fixes the context unittest that was broken by audio context changes.
This commit is contained in:
@@ -10,13 +10,13 @@
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
CActionBind::CActionBind(const QString &action, const QPixmap &icon, QObject *parent)
|
||||
CActionBind::CActionBind(const QString &action, BlackMisc::CIcons::IconIndex icon, QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
CActionBind::registerAction(action, icon);
|
||||
}
|
||||
|
||||
QString CActionBind::registerAction(const QString &action, const QPixmap &icon)
|
||||
QString CActionBind::registerAction(const QString &action, BlackMisc::CIcons::IconIndex icon)
|
||||
{
|
||||
if (!sApp || sApp->isShuttingDown()) { return {}; }
|
||||
if (sApp->getApplicationInfo().isUnitTest()) { return {}; }
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace BlackCore
|
||||
|
||||
//! Constructor
|
||||
template <typename Receiver>
|
||||
CActionBind(const QString &action, const QPixmap &icon, Receiver *receiver,
|
||||
CActionBind(const QString &action, BlackMisc::CIcons::IconIndex icon, Receiver *receiver,
|
||||
MembFunc<Receiver> slot = nullptr,
|
||||
const std::function<void()> &deleteCallback = {},
|
||||
QObject *parent = nullptr) :
|
||||
@@ -48,7 +48,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
//! Signature just to set an icon for an action
|
||||
CActionBind(const QString &action, const QPixmap &icon, QObject *parent = nullptr);
|
||||
CActionBind(const QString &action, BlackMisc::CIcons::IconIndex icon, QObject *parent = nullptr);
|
||||
|
||||
//! Not copyable
|
||||
//! @{
|
||||
@@ -75,7 +75,7 @@ namespace BlackCore
|
||||
static QString normalizeAction(const QString &action);
|
||||
|
||||
//! Register action
|
||||
static QString registerAction(const QString &action, const QPixmap &icon);
|
||||
static QString registerAction(const QString &action, BlackMisc::CIcons::IconIndex icon);
|
||||
|
||||
int m_index = -1; //!< action index (unique)
|
||||
std::function<void()> m_deleteCallback; //!< called when deleted
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackCore
|
||||
reloadHotkeySettings();
|
||||
}
|
||||
|
||||
void CInputManager::registerAction(const QString &action, const QPixmap &icon)
|
||||
void CInputManager::registerAction(const QString &action, BlackMisc::CIcons::IconIndex icon)
|
||||
{
|
||||
if (!m_availableActions.contains(action))
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackCore
|
||||
CInputManager(QObject *parent = nullptr);
|
||||
|
||||
//! Register new action
|
||||
void registerAction(const QString &action, const QPixmap &icon = BlackMisc::CIcons::empty16());
|
||||
void registerAction(const QString &action, BlackMisc::CIcons::IconIndex icon = BlackMisc::CIcons::StandardIconEmpty16);
|
||||
|
||||
//! Register remote actions
|
||||
void registerRemoteActions(const QStringList &actions);
|
||||
@@ -79,7 +79,7 @@ namespace BlackCore
|
||||
QStringList allAvailableActions() const { return m_availableActions.keys(); }
|
||||
|
||||
//! All actions and their icons (if any)
|
||||
QMap<QString, QPixmap> allAvailableActionsAndIcons() const { return m_availableActions; }
|
||||
QMap<QString, BlackMisc::CIcons::IconIndex> allAvailableActionsAndIcons() const { return m_availableActions; }
|
||||
|
||||
//! Enable event forwarding to core
|
||||
void setForwarding(bool enabled) { m_actionRelayingEnabled = enabled; }
|
||||
@@ -138,7 +138,7 @@ namespace BlackCore
|
||||
std::unique_ptr<BlackInput::IKeyboard> m_keyboard; //!< keyboard
|
||||
std::unique_ptr<BlackInput::IJoystick> m_joystick; //!< joystick
|
||||
|
||||
QMap<QString, QPixmap> m_availableActions;
|
||||
QMap<QString, BlackMisc::CIcons::IconIndex> m_availableActions;
|
||||
QHash<BlackMisc::Input::CHotkeyCombination, QString> m_configuredActions;
|
||||
QSet<QString> m_activeActions;
|
||||
QVector<BindInfo> m_boundActions;
|
||||
|
||||
Reference in New Issue
Block a user