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;
};
typedef QList<Hotkey> HotkeyList;
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey);
#endif

View File

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

View File

@ -59,7 +59,7 @@ class ServerConfig : public BaseConfig
bool switchCorner(SwitchCorner c) const { return m_SwitchCorners[static_cast<int>(c)]; }
int switchCornerSize() const { return m_SwitchCornerSize; }
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 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<bool>& switchCorners() { return m_SwitchCorners; }
HotkeyList& hotkeys() { return m_Hotkeys; }
std::vector<Hotkey>& 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<bool> m_SwitchCorners;
HotkeyList m_Hotkeys;
std::vector<Hotkey> m_Hotkeys;
QString m_ServerName;
bool m_IgnoreAutoConfigClient;
bool m_EnableDragAndDrop;

View File

@ -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);
}