From ac60e620ba1cdf0504592b763d9b9599c1dd9ca4 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 10 Jan 2021 14:13:43 +0200 Subject: [PATCH] gui: Remove ActionList typedef This typedef just introduces an additional layer of indirection to understand code. --- src/gui/src/Action.h | 2 -- src/gui/src/Hotkey.cpp | 2 +- src/gui/src/Hotkey.h | 10 ++++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/src/Action.h b/src/gui/src/Action.h index e9f4176a..c260badc 100644 --- a/src/gui/src/Action.h +++ b/src/gui/src/Action.h @@ -87,8 +87,6 @@ class Action static const char* m_LockCursorModeNames[]; }; -typedef QList ActionList; - QTextStream& operator<<(QTextStream& outStream, const Action& action); #endif diff --git a/src/gui/src/Hotkey.cpp b/src/gui/src/Hotkey.cpp index 43a8faa2..2f018420 100644 --- a/src/gui/src/Hotkey.cpp +++ b/src/gui/src/Hotkey.cpp @@ -47,7 +47,7 @@ void Hotkey::loadSettings(QSettings& settings) settings.setArrayIndex(i); Action a; a.loadSettings(settings); - m_Actions.append(a); + m_Actions.push_back(a); } settings.endArray(); diff --git a/src/gui/src/Hotkey.h b/src/gui/src/Hotkey.h index 1a26d089..7722b075 100644 --- a/src/gui/src/Hotkey.h +++ b/src/gui/src/Hotkey.h @@ -27,6 +27,8 @@ #include "Action.h" #include "KeySequence.h" +#include + class HotkeyDialog; class ServerConfigDialog; class QSettings; @@ -40,10 +42,10 @@ class Hotkey const KeySequence& keySequence() const { return m_KeySequence; } void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; } - const ActionList& actions() const { return m_Actions; } - void appendAction(const Action& action) { m_Actions.append(action); } + const std::vector& actions() const { return m_Actions; } + void appendAction(const Action& action) { m_Actions.push_back(action); } void setAction(int index, const Action& action) { m_Actions[index] = action; } - void removeAction(int index) { m_Actions.removeAt(index); } + void removeAction(int index) { m_Actions.erase(m_Actions.begin() + index); } void loadSettings(QSettings& settings); void saveSettings(QSettings& settings) const; @@ -51,7 +53,7 @@ class Hotkey private: KeySequence m_KeySequence; - ActionList m_Actions; + std::vector m_Actions; }; typedef QList HotkeyList;