diff --git a/src/apps/deskflow-gui/Action.cpp b/src/apps/deskflow-gui/Action.cpp index cfc073a39..3b02cf387 100644 --- a/src/apps/deskflow-gui/Action.cpp +++ b/src/apps/deskflow-gui/Action.cpp @@ -21,17 +21,9 @@ #include #include -const char *Action::m_actionTypeNames[] = { - "keyDown", "keyUp", "keystroke", "switchToScreen", "switchInDirection", "lockCursorToScreen", - "restartServer", "mouseDown", "mouseUp", "mousebutton" -}; - -const char *Action::m_switchDirectionNames[] = {"left", "right", "up", "down"}; -const char *Action::m_lockCursorModeNames[] = {"toggle", "on", "off"}; - QString Action::text() const { - QString text = QString(m_actionTypeNames[keySequence().isMouseButton() ? type() + 6 : type()]); + QString text = QString(m_actionTypeNames.at(keySequence().isMouseButton() ? type() + 6 : type())); switch (type()) { case keyDown: @@ -60,11 +52,11 @@ QString Action::text() const break; case switchInDirection: - text.append(m_commandTemplate.arg(m_switchDirectionNames[m_switchDirection])); + text.append(m_commandTemplate.arg(m_switchDirectionNames.at(m_switchDirection))); break; case lockCursorToScreen: - text.append(m_commandTemplate.arg(m_lockCursorModeNames[m_lockCursorMode])); + text.append(m_commandTemplate.arg(m_lockCursorModeNames.at(m_lockCursorMode))); break; default: diff --git a/src/apps/deskflow-gui/Action.h b/src/apps/deskflow-gui/Action.h index 8dd4c2425..051b763f0 100644 --- a/src/apps/deskflow-gui/Action.h +++ b/src/apps/deskflow-gui/Action.h @@ -172,10 +172,22 @@ private: bool m_hasScreens = false; bool m_restartServer; - static const char *m_actionTypeNames[]; - static const char *m_switchDirectionNames[]; - static const char *m_lockCursorModeNames[]; inline static const QString m_commandTemplate = QStringLiteral("(%1)"); + inline static const QStringList m_actionTypeNames{ + QStringLiteral("keyDown"), QStringLiteral("keyUp"), + QStringLiteral("keystroke"), QStringLiteral("switchToScreen"), + QStringLiteral("switchInDirection"), QStringLiteral("lockCursorToScreen"), + QStringLiteral("restartServer"), QStringLiteral("mouseDown"), + QStringLiteral("mouseUp"), QStringLiteral("mousebutton") + }; + + inline static const QStringList m_switchDirectionNames{ + QStringLiteral("left"), QStringLiteral("right"), QStringLiteral("up"), QStringLiteral("down") + }; + + inline static const QStringList m_lockCursorModeNames{ + QStringLiteral("toggle"), QStringLiteral("on"), QStringLiteral("off") + }; }; using ActionList = QList;