mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
refs #937 Resolved clazy warnings: pass-by-value/reference.
This commit is contained in:
@@ -20,27 +20,27 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
CHotkeyCombination::CHotkeyCombination(const CKeyboardKey &key) : CHotkeyCombination(CKeyboardKeyList(key))
|
||||
CHotkeyCombination::CHotkeyCombination(CKeyboardKey key) : CHotkeyCombination(CKeyboardKeyList(key))
|
||||
{ }
|
||||
|
||||
CHotkeyCombination::CHotkeyCombination(const CKeyboardKeyList &keys) : m_keyboardKeys(keys)
|
||||
{ }
|
||||
|
||||
void CHotkeyCombination::addKeyboardKey(const CKeyboardKey &key)
|
||||
void CHotkeyCombination::addKeyboardKey(CKeyboardKey key)
|
||||
{
|
||||
if (m_keyboardKeys.contains(key)) { return; }
|
||||
m_keyboardKeys.push_back(key);
|
||||
m_keyboardKeys.sortBy(&CKeyboardKey::getKey);
|
||||
}
|
||||
|
||||
void CHotkeyCombination::addJoystickButton(const CJoystickButton &button)
|
||||
void CHotkeyCombination::addJoystickButton(CJoystickButton button)
|
||||
{
|
||||
if (m_joystickButtons.contains(button)) { return; }
|
||||
m_joystickButtons.push_back(button);
|
||||
m_joystickButtons.sortBy(&CJoystickButton::getButtonIndex);
|
||||
}
|
||||
|
||||
void CHotkeyCombination::replaceKey(const CKeyboardKey &oldKey, const CKeyboardKey &newKey)
|
||||
void CHotkeyCombination::replaceKey(CKeyboardKey oldKey, CKeyboardKey newKey)
|
||||
{
|
||||
Q_ASSERT(!oldKey.isUnknown());
|
||||
m_keyboardKeys.remove(oldKey);
|
||||
@@ -48,19 +48,19 @@ namespace BlackMisc
|
||||
m_keyboardKeys.sortBy(&CKeyboardKey::getKey);
|
||||
}
|
||||
|
||||
void CHotkeyCombination::replaceButton(const CJoystickButton &oldButton, const CJoystickButton &newButton)
|
||||
void CHotkeyCombination::replaceButton(CJoystickButton oldButton, CJoystickButton newButton)
|
||||
{
|
||||
m_joystickButtons.remove(oldButton);
|
||||
if (newButton.isValid()) { m_joystickButtons.push_back(newButton); }
|
||||
m_joystickButtons.sortBy(&CJoystickButton::getButtonIndex);
|
||||
}
|
||||
|
||||
void CHotkeyCombination::removeKeyboardKey(const CKeyboardKey &key)
|
||||
void CHotkeyCombination::removeKeyboardKey(CKeyboardKey key)
|
||||
{
|
||||
replaceKey(key, CKeyboardKey());
|
||||
}
|
||||
|
||||
void CHotkeyCombination::removeJoystickButton(const CJoystickButton &button)
|
||||
void CHotkeyCombination::removeJoystickButton(CJoystickButton button)
|
||||
{
|
||||
replaceButton(button, CJoystickButton());
|
||||
}
|
||||
@@ -75,6 +75,7 @@ namespace BlackMisc
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QStringList sl;
|
||||
sl.reserve(m_keyboardKeys.size() + m_joystickButtons.size());
|
||||
for (const auto &key : m_keyboardKeys)
|
||||
{
|
||||
sl << key.toQString();
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
CHotkeyCombination() = default;
|
||||
|
||||
//! Init with key
|
||||
CHotkeyCombination(const CKeyboardKey &key);
|
||||
CHotkeyCombination(CKeyboardKey key);
|
||||
|
||||
//! Init with list of keys
|
||||
CHotkeyCombination(const CKeyboardKeyList &keys);
|
||||
@@ -53,22 +53,22 @@ namespace BlackMisc
|
||||
CJoystickButtonList getJoystickButtons() const { return m_joystickButtons; }
|
||||
|
||||
//! Add keyboard key
|
||||
void addKeyboardKey(const CKeyboardKey &key);
|
||||
void addKeyboardKey(CKeyboardKey key);
|
||||
|
||||
//! Add joystick button
|
||||
void addJoystickButton(const CJoystickButton &button);
|
||||
void addJoystickButton(CJoystickButton button);
|
||||
|
||||
//! Replace oldKey with newKey
|
||||
void replaceKey(const CKeyboardKey &oldKey, const CKeyboardKey &newKey);
|
||||
void replaceKey(CKeyboardKey oldKey, CKeyboardKey newKey);
|
||||
|
||||
//! Replace oldButton with newButton
|
||||
void replaceButton(const CJoystickButton &oldButton, const CJoystickButton &newButton);
|
||||
void replaceButton(CJoystickButton oldButton, CJoystickButton newButton);
|
||||
|
||||
//! Remove keyboard key
|
||||
void removeKeyboardKey(const CKeyboardKey &key);
|
||||
void removeKeyboardKey(CKeyboardKey key);
|
||||
|
||||
//! Remove joystick button
|
||||
void removeJoystickButton(const CJoystickButton &button);
|
||||
void removeJoystickButton(CJoystickButton button);
|
||||
|
||||
//! Is sequence empty?
|
||||
bool isEmpty() const { return m_keyboardKeys.isEmpty() && m_joystickButtons.isEmpty(); }
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackMisc
|
||||
m_buttonIndex = buttonIndex;
|
||||
}
|
||||
|
||||
void CJoystickButton::setButtonObject(const CJoystickButton &button)
|
||||
void CJoystickButton::setButtonObject(CJoystickButton button)
|
||||
{
|
||||
this->m_buttonIndex = button.m_buttonIndex;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace BlackMisc
|
||||
bool isValid() const { return m_buttonIndex >= 0 ? true : false; }
|
||||
|
||||
//! Set button object
|
||||
void setButtonObject(const CJoystickButton &button);
|
||||
void setButtonObject(CJoystickButton button);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace BlackMisc
|
||||
return getKeyAsString();
|
||||
}
|
||||
|
||||
void CKeyboardKey::setKeyObject(const CKeyboardKey &key)
|
||||
void CKeyboardKey::setKeyObject(CKeyboardKey key)
|
||||
{
|
||||
this->m_keyCode = key.m_keyCode;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace BlackMisc
|
||||
QString getKeyAsString() const;
|
||||
|
||||
//! Set key code
|
||||
void setKey(const KeyCode key) { this->m_keyCode = key; }
|
||||
void setKey(KeyCode key) { this->m_keyCode = key; }
|
||||
|
||||
//! Set key code
|
||||
void setKey(int key) { this->m_keyCode = static_cast<KeyCode>(key); }
|
||||
@@ -76,7 +76,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Set key object
|
||||
void setKeyObject(const CKeyboardKey &key);
|
||||
void setKeyObject(CKeyboardKey key);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace BlackMisc
|
||||
{
|
||||
CKeyboardKeyList::CKeyboardKeyList() { }
|
||||
|
||||
CKeyboardKeyList::CKeyboardKeyList(const CKeyboardKey &key)
|
||||
CKeyboardKeyList::CKeyboardKeyList(CKeyboardKey key)
|
||||
{
|
||||
this->push_back(key);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace BlackMisc
|
||||
CKeyboardKeyList();
|
||||
|
||||
//! Init by single key
|
||||
CKeyboardKeyList(const CKeyboardKey &key);
|
||||
CKeyboardKeyList(CKeyboardKey key);
|
||||
|
||||
//! Construct from a base class object.
|
||||
CKeyboardKeyList(const CSequence<CKeyboardKey> &baseClass);
|
||||
|
||||
Reference in New Issue
Block a user