refactor Action::ActionType => Action::Type enum class
This commit is contained in:
parent
d2d28f5ad6
commit
1c7d5de01b
2 changed files with 8 additions and 7 deletions
|
|
@ -14,7 +14,8 @@ QString Action::text() const
|
||||||
{
|
{
|
||||||
auto text = QString(m_actionTypeNames.at(keySequence().isMouseButton() ? type() + 6 : type()));
|
auto text = QString(m_actionTypeNames.at(keySequence().isMouseButton() ? type() + 6 : type()));
|
||||||
|
|
||||||
switch (type()) {
|
switch (static_cast<Action::Type>(type())) {
|
||||||
|
using enum Type;
|
||||||
case keyDown:
|
case keyDown:
|
||||||
case keyUp:
|
case keyUp:
|
||||||
case keystroke: {
|
case keystroke: {
|
||||||
|
|
@ -36,15 +37,15 @@ QString Action::text() const
|
||||||
text.append(m_commandTemplate.arg(commandArgs));
|
text.append(m_commandTemplate.arg(commandArgs));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case switchToScreen:
|
case Type::switchToScreen:
|
||||||
text.append(m_commandTemplate.arg(m_switchScreenName));
|
text.append(m_commandTemplate.arg(m_switchScreenName));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case switchInDirection:
|
case Type::switchInDirection:
|
||||||
text.append(m_commandTemplate.arg(m_switchDirectionNames.at(m_switchDirection)));
|
text.append(m_commandTemplate.arg(m_switchDirectionNames.at(m_switchDirection)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lockCursorToScreen:
|
case Type::lockCursorToScreen:
|
||||||
text.append(m_commandTemplate.arg(m_lockCursorModeNames.at(m_lockCursorMode)));
|
text.append(m_commandTemplate.arg(m_lockCursorModeNames.at(m_lockCursorMode)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -58,7 +59,7 @@ QString Action::text() const
|
||||||
void Action::loadSettings(QSettings &settings)
|
void Action::loadSettings(QSettings &settings)
|
||||||
{
|
{
|
||||||
keySequence().loadSettings(settings);
|
keySequence().loadSettings(settings);
|
||||||
setType(settings.value(SettingsKeys::ActionType, keyDown).toInt());
|
setType(settings.value(SettingsKeys::ActionType, static_cast<int>(Type::keyDown)).toInt());
|
||||||
|
|
||||||
typeScreenNames().clear();
|
typeScreenNames().clear();
|
||||||
int numTypeScreens = settings.beginReadArray(SettingsKeys::ScreenNames);
|
int numTypeScreens = settings.beginReadArray(SettingsKeys::ScreenNames);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class Action
|
||||||
friend QTextStream &operator<<(QTextStream &outStream, const Action &action);
|
friend QTextStream &operator<<(QTextStream &outStream, const Action &action);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ActionType
|
enum class Type
|
||||||
{
|
{
|
||||||
keyDown,
|
keyDown,
|
||||||
keyUp,
|
keyUp,
|
||||||
|
|
@ -151,7 +151,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KeySequence m_keySequence;
|
KeySequence m_keySequence;
|
||||||
int m_type = keystroke;
|
int m_type = static_cast<int>(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;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue