From 4955e8c2ba667ee7d03f0a621af1afcbc661979c Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Tue, 5 Aug 2025 22:06:06 -0400 Subject: [PATCH] refactor: Fingerprint, KeyMap, KeySequence and Action use default == operator --- src/lib/deskflow/KeyMap.cpp | 13 ------------- src/lib/deskflow/KeyMap.h | 2 +- src/lib/gui/Action.cpp | 8 -------- src/lib/gui/Action.h | 2 +- src/lib/gui/KeySequence.cpp | 5 ----- src/lib/gui/KeySequence.h | 2 +- src/lib/net/Fingerprint.cpp | 5 ----- src/lib/net/Fingerprint.h | 2 +- 8 files changed, 4 insertions(+), 35 deletions(-) diff --git a/src/lib/deskflow/KeyMap.cpp b/src/lib/deskflow/KeyMap.cpp index d1012e08e..7be845973 100644 --- a/src/lib/deskflow/KeyMap.cpp +++ b/src/lib/deskflow/KeyMap.cpp @@ -1210,19 +1210,6 @@ void KeyMap::initKeyNameMaps() } } -// -// KeyMap::KeyItem -// - -bool KeyMap::KeyItem::operator==(const KeyItem &x) const -{ - return ( - m_id == x.m_id && m_group == x.m_group && m_button == x.m_button && m_required == x.m_required && - m_sensitive == x.m_sensitive && m_generates == x.m_generates && m_dead == x.m_dead && m_lock == x.m_lock && - m_client == x.m_client - ); -} - // // KeyMap::Keystroke // diff --git a/src/lib/deskflow/KeyMap.h b/src/lib/deskflow/KeyMap.h index 50d92a73b..d0defadb7 100644 --- a/src/lib/deskflow/KeyMap.h +++ b/src/lib/deskflow/KeyMap.h @@ -52,7 +52,7 @@ public: uint32_t m_client{}; //!< Client data public: - bool operator==(const KeyItem &) const; + bool operator==(const KeyItem &) const = default; }; //! The KeyButtons needed to synthesize a KeyID diff --git a/src/lib/gui/Action.cpp b/src/lib/gui/Action.cpp index e5567f4d6..8c256d2d9 100644 --- a/src/lib/gui/Action.cpp +++ b/src/lib/gui/Action.cpp @@ -96,14 +96,6 @@ void Action::saveSettings(QSettings &settings) const settings.setValue(SettingsKeys::RestartServer, restartServer()); } -bool Action::operator==(const Action &a) const -{ - return m_keySequence == a.m_keySequence && m_type == a.m_type && m_typeScreenNames == a.m_typeScreenNames && - m_switchScreenName == a.m_switchScreenName && m_switchDirection == a.m_switchDirection && - m_lockCursorMode == a.m_lockCursorMode && m_activeOnRelease == a.m_activeOnRelease && - m_hasScreens == a.m_hasScreens && m_restartServer == a.m_restartServer; -} - QTextStream &operator<<(QTextStream &outStream, const Action &action) { if (action.activeOnRelease()) diff --git a/src/lib/gui/Action.h b/src/lib/gui/Action.h index 8bccd2605..a31003f42 100644 --- a/src/lib/gui/Action.h +++ b/src/lib/gui/Action.h @@ -105,7 +105,7 @@ public: return m_restartServer; } - bool operator==(const Action &a) const; + bool operator==(const Action &a) const = default; protected: KeySequence &keySequence() diff --git a/src/lib/gui/KeySequence.cpp b/src/lib/gui/KeySequence.cpp index 56315b588..e3fd5ccfe 100644 --- a/src/lib/gui/KeySequence.cpp +++ b/src/lib/gui/KeySequence.cpp @@ -218,8 +218,3 @@ QString KeySequence::keyToString(int key) // give up, deskflow probably won't handle this return ""; } - -bool KeySequence::operator==(const KeySequence &ks) const -{ - return m_Sequence == ks.m_Sequence && m_Modifiers == ks.m_Modifiers && m_IsValid == ks.m_IsValid; -} diff --git a/src/lib/gui/KeySequence.h b/src/lib/gui/KeySequence.h index ffb7635d5..426c39a06 100644 --- a/src/lib/gui/KeySequence.h +++ b/src/lib/gui/KeySequence.h @@ -36,7 +36,7 @@ public: return m_Sequence; } - bool operator==(const KeySequence &ks) const; + bool operator==(const KeySequence &ks) const = default; private: void setValid(bool b) diff --git a/src/lib/net/Fingerprint.cpp b/src/lib/net/Fingerprint.cpp index 1073064c2..21edf5bb2 100644 --- a/src/lib/net/Fingerprint.cpp +++ b/src/lib/net/Fingerprint.cpp @@ -24,11 +24,6 @@ bool Fingerprint::isValid() const } } -bool Fingerprint::operator==(const Fingerprint &other) const -{ - return type == other.type && data == other.data; -} - QString Fingerprint::toDbLine() const { if (!isValid()) { diff --git a/src/lib/net/Fingerprint.h b/src/lib/net/Fingerprint.h index 0d1720d36..9975cbf67 100644 --- a/src/lib/net/Fingerprint.h +++ b/src/lib/net/Fingerprint.h @@ -29,7 +29,7 @@ public: bool isValid() const; - bool operator==(const Fingerprint &other) const; + bool operator==(const Fingerprint &other) const = default; QString toDbLine() const; static Fingerprint fromDbLine(const QString &line); static QString typeToString(Fingerprint::Type type);