gui: Remove HotkeyList 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:44 +02:00
parent ac60e620ba
commit 384dbffce4
4 changed files with 6 additions and 8 deletions

View File

@ -56,8 +56,6 @@ class Hotkey
std::vector<Action> m_Actions; std::vector<Action> m_Actions;
}; };
typedef QList<Hotkey> HotkeyList;
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey); QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey);
#endif #endif

View File

@ -183,7 +183,7 @@ void ServerConfig::loadSettings()
settings().setArrayIndex(i); settings().setArrayIndex(i);
Hotkey h; Hotkey h;
h.loadSettings(settings()); h.loadSettings(settings());
hotkeys().append(h); hotkeys().push_back(h);
} }
settings().endArray(); settings().endArray();

View File

@ -59,7 +59,7 @@ class ServerConfig : public BaseConfig
bool switchCorner(SwitchCorner c) const { return m_SwitchCorners[static_cast<int>(c)]; } bool switchCorner(SwitchCorner c) const { return m_SwitchCorners[static_cast<int>(c)]; }
int switchCornerSize() const { return m_SwitchCornerSize; } int switchCornerSize() const { return m_SwitchCornerSize; }
const QList<bool>& switchCorners() const { return m_SwitchCorners; } const QList<bool>& switchCorners() const { return m_SwitchCorners; }
const HotkeyList& hotkeys() const { return m_Hotkeys; } const std::vector<Hotkey>& hotkeys() const { return m_Hotkeys; }
bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; } bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; }
bool enableDragAndDrop() const { return m_EnableDragAndDrop; } bool enableDragAndDrop() const { return m_EnableDragAndDrop; }
bool clipboardSharing() const { return m_ClipboardSharing; } bool clipboardSharing() const { return m_ClipboardSharing; }
@ -93,7 +93,7 @@ class ServerConfig : public BaseConfig
void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; } void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; }
void setClipboardSharing(bool on) { m_ClipboardSharing = on; } void setClipboardSharing(bool on) { m_ClipboardSharing = on; }
QList<bool>& switchCorners() { return m_SwitchCorners; } QList<bool>& switchCorners() { return m_SwitchCorners; }
HotkeyList& hotkeys() { return m_Hotkeys; } std::vector<Hotkey>& hotkeys() { return m_Hotkeys; }
void init(); void init();
int adjacentScreenIndex(int idx, int deltaColumn, int deltaRow) const; int adjacentScreenIndex(int idx, int deltaColumn, int deltaRow) const;
@ -120,7 +120,7 @@ class ServerConfig : public BaseConfig
int m_SwitchDoubleTap; int m_SwitchDoubleTap;
int m_SwitchCornerSize; int m_SwitchCornerSize;
QList<bool> m_SwitchCorners; QList<bool> m_SwitchCorners;
HotkeyList m_Hotkeys; std::vector<Hotkey> m_Hotkeys;
QString m_ServerName; QString m_ServerName;
bool m_IgnoreAutoConfigClient; bool m_IgnoreAutoConfigClient;
bool m_EnableDragAndDrop; bool m_EnableDragAndDrop;

View File

@ -121,7 +121,7 @@ void ServerConfigDialog::on_m_pButtonNewHotkey_clicked()
HotkeyDialog dlg(this, hotkey); HotkeyDialog dlg(this, hotkey);
if (dlg.exec() == QDialog::Accepted) if (dlg.exec() == QDialog::Accepted)
{ {
serverConfig().hotkeys().append(hotkey); serverConfig().hotkeys().push_back(hotkey);
m_pListHotkeys->addItem(hotkey.text()); m_pListHotkeys->addItem(hotkey.text());
} }
} }
@ -140,7 +140,7 @@ void ServerConfigDialog::on_m_pButtonRemoveHotkey_clicked()
{ {
int idx = m_pListHotkeys->currentRow(); int idx = m_pListHotkeys->currentRow();
Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size()); Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size());
serverConfig().hotkeys().removeAt(idx); serverConfig().hotkeys().erase(serverConfig().hotkeys().begin() + idx);
m_pListActions->clear(); m_pListActions->clear();
delete m_pListHotkeys->item(idx); delete m_pListHotkeys->item(idx);
} }