From 384dbffce49483eb1753718055c09cee17accb1c Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 10 Jan 2021 14:13:44 +0200 Subject: [PATCH] gui: Remove HotkeyList typedef This typedef just introduces an additional layer of indirection to understand code. --- src/gui/src/Hotkey.h | 2 -- src/gui/src/ServerConfig.cpp | 2 +- src/gui/src/ServerConfig.h | 6 +++--- src/gui/src/ServerConfigDialog.cpp | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gui/src/Hotkey.h b/src/gui/src/Hotkey.h index 7722b075..5e6fc983 100644 --- a/src/gui/src/Hotkey.h +++ b/src/gui/src/Hotkey.h @@ -56,8 +56,6 @@ class Hotkey std::vector m_Actions; }; -typedef QList HotkeyList; - QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey); #endif diff --git a/src/gui/src/ServerConfig.cpp b/src/gui/src/ServerConfig.cpp index 6f02bc11..ed729bfb 100644 --- a/src/gui/src/ServerConfig.cpp +++ b/src/gui/src/ServerConfig.cpp @@ -183,7 +183,7 @@ void ServerConfig::loadSettings() settings().setArrayIndex(i); Hotkey h; h.loadSettings(settings()); - hotkeys().append(h); + hotkeys().push_back(h); } settings().endArray(); diff --git a/src/gui/src/ServerConfig.h b/src/gui/src/ServerConfig.h index 63e9c80f..02d99fb4 100644 --- a/src/gui/src/ServerConfig.h +++ b/src/gui/src/ServerConfig.h @@ -59,7 +59,7 @@ class ServerConfig : public BaseConfig bool switchCorner(SwitchCorner c) const { return m_SwitchCorners[static_cast(c)]; } int switchCornerSize() const { return m_SwitchCornerSize; } const QList& switchCorners() const { return m_SwitchCorners; } - const HotkeyList& hotkeys() const { return m_Hotkeys; } + const std::vector& hotkeys() const { return m_Hotkeys; } bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; } bool enableDragAndDrop() const { return m_EnableDragAndDrop; } bool clipboardSharing() const { return m_ClipboardSharing; } @@ -93,7 +93,7 @@ class ServerConfig : public BaseConfig void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; } void setClipboardSharing(bool on) { m_ClipboardSharing = on; } QList& switchCorners() { return m_SwitchCorners; } - HotkeyList& hotkeys() { return m_Hotkeys; } + std::vector& hotkeys() { return m_Hotkeys; } void init(); int adjacentScreenIndex(int idx, int deltaColumn, int deltaRow) const; @@ -120,7 +120,7 @@ class ServerConfig : public BaseConfig int m_SwitchDoubleTap; int m_SwitchCornerSize; QList m_SwitchCorners; - HotkeyList m_Hotkeys; + std::vector m_Hotkeys; QString m_ServerName; bool m_IgnoreAutoConfigClient; bool m_EnableDragAndDrop; diff --git a/src/gui/src/ServerConfigDialog.cpp b/src/gui/src/ServerConfigDialog.cpp index 9d789d4c..57b9395b 100644 --- a/src/gui/src/ServerConfigDialog.cpp +++ b/src/gui/src/ServerConfigDialog.cpp @@ -121,7 +121,7 @@ void ServerConfigDialog::on_m_pButtonNewHotkey_clicked() HotkeyDialog dlg(this, hotkey); if (dlg.exec() == QDialog::Accepted) { - serverConfig().hotkeys().append(hotkey); + serverConfig().hotkeys().push_back(hotkey); m_pListHotkeys->addItem(hotkey.text()); } } @@ -140,7 +140,7 @@ void ServerConfigDialog::on_m_pButtonRemoveHotkey_clicked() { int idx = m_pListHotkeys->currentRow(); Q_ASSERT(idx >= 0 && idx < serverConfig().hotkeys().size()); - serverConfig().hotkeys().removeAt(idx); + serverConfig().hotkeys().erase(serverConfig().hotkeys().begin() + idx); m_pListActions->clear(); delete m_pListHotkeys->item(idx); }