refactor: Action: use m_foo style member names

This commit is contained in:
sithlord48 2025-01-04 20:11:56 -05:00 committed by Nick Bolton
parent 665049b723
commit 4c70f4fde5
2 changed files with 38 additions and 38 deletions

View file

@ -21,17 +21,17 @@
#include <QSettings> #include <QSettings>
#include <QTextStream> #include <QTextStream>
const char *Action::m_ActionTypeNames[] = { const char *Action::m_actionTypeNames[] = {
"keyDown", "keyUp", "keystroke", "switchToScreen", "switchInDirection", "lockCursorToScreen", "keyDown", "keyUp", "keystroke", "switchToScreen", "switchInDirection", "lockCursorToScreen",
"restartServer", "mouseDown", "mouseUp", "mousebutton" "restartServer", "mouseDown", "mouseUp", "mousebutton"
}; };
const char *Action::m_SwitchDirectionNames[] = {"left", "right", "up", "down"}; const char *Action::m_switchDirectionNames[] = {"left", "right", "up", "down"};
const char *Action::m_LockCursorModeNames[] = {"toggle", "on", "off"}; const char *Action::m_lockCursorModeNames[] = {"toggle", "on", "off"};
QString Action::text() const QString Action::text() const
{ {
QString text = QString(m_ActionTypeNames[keySequence().isMouseButton() ? type() + 6 : type()]) + "("; QString text = QString(m_actionTypeNames[keySequence().isMouseButton() ? type() + 6 : type()]) + "(";
switch (type()) { switch (type()) {
case keyDown: case keyDown:
@ -59,11 +59,11 @@ QString Action::text() const
break; break;
case switchInDirection: case switchInDirection:
text += m_SwitchDirectionNames[m_SwitchDirection]; text += m_switchDirectionNames[m_switchDirection];
break; break;
case lockCursorToScreen: case lockCursorToScreen:
text += m_LockCursorModeNames[m_LockCursorMode]; text += m_lockCursorModeNames[m_lockCursorMode];
break; break;
case restartAllConnections: case restartAllConnections:
@ -122,10 +122,10 @@ void Action::saveSettings(QSettings &settings) const
bool Action::operator==(const Action &a) const bool Action::operator==(const Action &a) const
{ {
return m_KeySequence == a.m_KeySequence && m_Type == a.m_Type && m_TypeScreenNames == a.m_TypeScreenNames && 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_switchScreenName == a.m_switchScreenName && m_switchDirection == a.m_switchDirection &&
m_LockCursorMode == a.m_LockCursorMode && m_ActiveOnRelease == a.m_ActiveOnRelease && m_lockCursorMode == a.m_lockCursorMode && m_activeOnRelease == a.m_activeOnRelease &&
m_HasScreens == a.m_HasScreens && m_restartServer == a.m_restartServer; m_hasScreens == a.m_hasScreens && m_restartServer == a.m_restartServer;
} }
QTextStream &operator<<(QTextStream &outStream, const Action &action) QTextStream &operator<<(QTextStream &outStream, const Action &action)

View file

@ -68,37 +68,37 @@ public:
QString text() const; QString text() const;
const KeySequence &keySequence() const const KeySequence &keySequence() const
{ {
return m_KeySequence; return m_keySequence;
} }
void loadSettings(QSettings &settings); void loadSettings(QSettings &settings);
void saveSettings(QSettings &settings) const; void saveSettings(QSettings &settings) const;
int type() const int type() const
{ {
return m_Type; return m_type;
} }
const QStringList &typeScreenNames() const const QStringList &typeScreenNames() const
{ {
return m_TypeScreenNames; return m_typeScreenNames;
} }
const QString &switchScreenName() const const QString &switchScreenName() const
{ {
return m_SwitchScreenName; return m_switchScreenName;
} }
int switchDirection() const int switchDirection() const
{ {
return m_SwitchDirection; return m_switchDirection;
} }
int lockCursorMode() const int lockCursorMode() const
{ {
return m_LockCursorMode; return m_lockCursorMode;
} }
bool activeOnRelease() const bool activeOnRelease() const
{ {
return m_ActiveOnRelease; return m_activeOnRelease;
} }
bool haveScreens() const bool haveScreens() const
{ {
return m_HasScreens; return m_hasScreens;
} }
bool restartServer() const bool restartServer() const
{ {
@ -110,39 +110,39 @@ public:
protected: protected:
KeySequence &keySequence() KeySequence &keySequence()
{ {
return m_KeySequence; return m_keySequence;
} }
void setKeySequence(const KeySequence &seq) void setKeySequence(const KeySequence &seq)
{ {
m_KeySequence = seq; m_keySequence = seq;
} }
void setType(int t) void setType(int t)
{ {
m_Type = t; m_type = t;
} }
QStringList &typeScreenNames() QStringList &typeScreenNames()
{ {
return m_TypeScreenNames; return m_typeScreenNames;
} }
void setSwitchScreenName(const QString &n) void setSwitchScreenName(const QString &n)
{ {
m_SwitchScreenName = n; m_switchScreenName = n;
} }
void setSwitchDirection(int d) void setSwitchDirection(int d)
{ {
m_SwitchDirection = d; m_switchDirection = d;
} }
void setLockCursorMode(int m) void setLockCursorMode(int m)
{ {
m_LockCursorMode = m; m_lockCursorMode = m;
} }
void setActiveOnRelease(bool b) void setActiveOnRelease(bool b)
{ {
m_ActiveOnRelease = b; m_activeOnRelease = b;
} }
void setHaveScreens(bool b) void setHaveScreens(bool b)
{ {
m_HasScreens = b; m_hasScreens = b;
} }
void setRestartServer(bool b) void setRestartServer(bool b)
{ {
@ -150,19 +150,19 @@ protected:
} }
private: private:
KeySequence m_KeySequence; KeySequence m_keySequence;
int m_Type = keystroke; int m_type = keystroke;
QStringList m_TypeScreenNames = QStringList(); QStringList m_typeScreenNames = QStringList();
QString m_SwitchScreenName = QString(); QString m_switchScreenName = QString();
int m_SwitchDirection = switchLeft; int m_switchDirection = switchLeft;
int m_LockCursorMode = lockCursorToggle; int m_lockCursorMode = lockCursorToggle;
bool m_ActiveOnRelease = false; bool m_activeOnRelease = false;
bool m_HasScreens = false; bool m_hasScreens = false;
bool m_restartServer; bool m_restartServer;
static const char *m_ActionTypeNames[]; static const char *m_actionTypeNames[];
static const char *m_SwitchDirectionNames[]; static const char *m_switchDirectionNames[];
static const char *m_LockCursorModeNames[]; static const char *m_lockCursorModeNames[];
}; };
using ActionList = QList<Action>; using ActionList = QList<Action>;