gui: Remove ActionList typedef

This typedef just introduces an additional layer of indirection to
understand code.
This commit is contained in:
Povilas Kanapickas 2021-01-10 14:13:43 +02:00
parent 5cc18ac595
commit ac60e620ba
3 changed files with 7 additions and 7 deletions

View File

@ -87,8 +87,6 @@ class Action
static const char* m_LockCursorModeNames[]; static const char* m_LockCursorModeNames[];
}; };
typedef QList<Action> ActionList;
QTextStream& operator<<(QTextStream& outStream, const Action& action); QTextStream& operator<<(QTextStream& outStream, const Action& action);
#endif #endif

View File

@ -47,7 +47,7 @@ void Hotkey::loadSettings(QSettings& settings)
settings.setArrayIndex(i); settings.setArrayIndex(i);
Action a; Action a;
a.loadSettings(settings); a.loadSettings(settings);
m_Actions.append(a); m_Actions.push_back(a);
} }
settings.endArray(); settings.endArray();

View File

@ -27,6 +27,8 @@
#include "Action.h" #include "Action.h"
#include "KeySequence.h" #include "KeySequence.h"
#include <vector>
class HotkeyDialog; class HotkeyDialog;
class ServerConfigDialog; class ServerConfigDialog;
class QSettings; class QSettings;
@ -40,10 +42,10 @@ class Hotkey
const KeySequence& keySequence() const { return m_KeySequence; } const KeySequence& keySequence() const { return m_KeySequence; }
void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; } void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; }
const ActionList& actions() const { return m_Actions; } const std::vector<Action>& actions() const { return m_Actions; }
void appendAction(const Action& action) { m_Actions.append(action); } void appendAction(const Action& action) { m_Actions.push_back(action); }
void setAction(int index, const Action& action) { m_Actions[index] = 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 loadSettings(QSettings& settings);
void saveSettings(QSettings& settings) const; void saveSettings(QSettings& settings) const;
@ -51,7 +53,7 @@ class Hotkey
private: private:
KeySequence m_KeySequence; KeySequence m_KeySequence;
ActionList m_Actions; std::vector<Action> m_Actions;
}; };
typedef QList<Hotkey> HotkeyList; typedef QList<Hotkey> HotkeyList;