From 4b456bf835e4b5876eea5a956cff3f624bf10a3a Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 4 Jan 2025 19:09:20 -0500 Subject: [PATCH] refactor: ActionDialog, don't keep a copy of the server config --- src/apps/deskflow-gui/dialogs/ActionDialog.cpp | 6 +++--- src/apps/deskflow-gui/dialogs/ActionDialog.h | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/apps/deskflow-gui/dialogs/ActionDialog.cpp b/src/apps/deskflow-gui/dialogs/ActionDialog.cpp index fa4e90ea9..510f718ac 100644 --- a/src/apps/deskflow-gui/dialogs/ActionDialog.cpp +++ b/src/apps/deskflow-gui/dialogs/ActionDialog.cpp @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * Copyright (C) 2025 Chris Rizzitello * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2008 Volker Lanz (vl@fidra.de) * @@ -26,10 +27,9 @@ #include -ActionDialog::ActionDialog(QWidget *parent, ServerConfig &config, Hotkey &hotkey, Action &action) +ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &hotkey, Action &action) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), ui{std::make_unique()}, - m_ServerConfig(config), m_Hotkey(hotkey), m_Action(action), m_pButtonGroupType(new QButtonGroup(this)) @@ -65,7 +65,7 @@ ActionDialog::ActionDialog(QWidget *parent, ServerConfig &config, Hotkey &hotkey ui->m_pGroupBoxScreens->setChecked(m_Action.haveScreens()); int idx = 0; - for (const Screen &screen : serverConfig().screens()) { + for (const Screen &screen : config.screens()) { if (!screen.isNull()) { QListWidgetItem *pListItem = new QListWidgetItem(screen.name()); ui->m_pListScreens->addItem(pListItem); diff --git a/src/apps/deskflow-gui/dialogs/ActionDialog.h b/src/apps/deskflow-gui/dialogs/ActionDialog.h index 3519d3c8b..dcb2a218f 100644 --- a/src/apps/deskflow-gui/dialogs/ActionDialog.h +++ b/src/apps/deskflow-gui/dialogs/ActionDialog.h @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * Copyright (C) 2025 Chris Rizzitello * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2008 Volker Lanz (vl@fidra.de) * @@ -36,7 +37,7 @@ class ActionDialog : public QDialog Q_OBJECT public: - ActionDialog(QWidget *parent, ServerConfig &config, Hotkey &hotkey, Action &action); + ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &hotkey, Action &action); ~ActionDialog() override; protected slots: @@ -45,14 +46,9 @@ protected slots: protected: const KeySequenceWidget *sequenceWidget() const; - const ServerConfig &serverConfig() const - { - return m_ServerConfig; - } private: std::unique_ptr ui; - const ServerConfig &m_ServerConfig; Hotkey &m_Hotkey; Action &m_Action;