diff --git a/libs/ui/input/kis_abstract_input_action.h b/libs/ui/input/kis_abstract_input_action.h --- a/libs/ui/input/kis_abstract_input_action.h +++ b/libs/ui/input/kis_abstract_input_action.h @@ -168,7 +168,7 @@ /** * Some of the actions are available in particular situations - * only. E.g. switch frame action is available iff a animated + * only. E.g. switch frame action is available if an animated * layer is selected. If isAvailable() returns true then the * action will *not* be triggered by the shortcut matcher. */ diff --git a/libs/ui/input/kis_input_manager_p.cpp b/libs/ui/input/kis_input_manager_p.cpp --- a/libs/ui/input/kis_input_manager_p.cpp +++ b/libs/ui/input/kis_input_manager_p.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include "kis_input_manager.h" #include "kis_config.h" #include "kis_abstract_input_action.h" @@ -363,6 +365,11 @@ return QObject::eventFilter(object, event); } +#define EXTRA_BUTTON(z, n, _) \ + if(buttons & Qt::ExtraButton##n) { \ + buttonList << Qt::ExtraButton##n; \ + } + void KisInputManager::Private::addStrokeShortcut(KisAbstractInputAction* action, int index, const QList &modifiers, Qt::MouseButtons buttons) @@ -380,12 +387,8 @@ if(buttons & Qt::MidButton) { buttonList << Qt::MidButton; } - if(buttons & Qt::XButton1) { - buttonList << Qt::XButton1; - } - if(buttons & Qt::XButton2) { - buttonList << Qt::XButton2; - } + + BOOST_PP_REPEAT_FROM_TO(1, 25, EXTRA_BUTTON, _) if (buttonList.size() > 0) { strokeShortcut->setButtons(QSet::fromList(modifiers), QSet::fromList(buttonList)); diff --git a/libs/ui/input/kis_shortcut_configuration.cpp b/libs/ui/input/kis_shortcut_configuration.cpp --- a/libs/ui/input/kis_shortcut_configuration.cpp +++ b/libs/ui/input/kis_shortcut_configuration.cpp @@ -23,6 +23,11 @@ #include #include +#include +#include +#include + + class KisShortcutConfiguration::Private { public: @@ -228,6 +233,13 @@ } } +#define EXTRA_BUTTON(z, n, _)\ + if (buttons & Qt::ExtraButton##n) { \ + if (buttonCount++ > 0) { text.append(sep); } \ + text.append(i18nc("Mouse Button " BOOST_PP_STRINGIZE(BOOST_PP_ADD(n, 3)), \ + "Mouse " BOOST_PP_STRINGIZE(BOOST_PP_ADD(n, 3)))); \ + } + QString KisShortcutConfiguration::buttonsToText(Qt::MouseButtons buttons) { QString text; @@ -248,7 +260,7 @@ text.append(i18nc("Right Mouse Button", "Right")); } - if (buttons & Qt::MidButton) { + if (buttons & Qt::MiddleButton) { if (buttonCount++ > 0) { text.append(sep); } @@ -256,7 +268,7 @@ text.append(i18nc("Middle Mouse Button", "Middle")); } - if (buttons & Qt::XButton1) { + if (buttons & Qt::BackButton) { if (buttonCount++ > 0) { text.append(sep); } @@ -264,7 +276,7 @@ text.append(i18nc("Mouse Back Button", "Back")); } - if (buttons & Qt::XButton2) { + if (buttons & Qt::ForwardButton) { if (buttonCount++ > 0) { text.append(sep); } @@ -272,6 +284,16 @@ text.append(i18nc("Mouse Forward Button", "Forward")); } + if (buttons & Qt::TaskButton) { + if (buttonCount++ > 0) { + text.append(sep); + } + + text.append(i18nc("Mouse Task Button", "Task")); + } + + BOOST_PP_REPEAT_FROM_TO(4, 25, EXTRA_BUTTON, _) + if (buttonCount == 0) { text.append(i18nc("No mouse buttons for shortcut", "None")); } diff --git a/libs/ui/input/kis_shortcut_matcher.h b/libs/ui/input/kis_shortcut_matcher.h --- a/libs/ui/input/kis_shortcut_matcher.h +++ b/libs/ui/input/kis_shortcut_matcher.h @@ -45,7 +45,7 @@ * * The class works with two types of actions: long running * (represented by KisStrokeShortcuts) and "atomic" - * (KisSingleActionShortcut). The former one invole some long + * (KisSingleActionShortcut). The former one involve some long * interaction with the user by means of a mouse cursor or a tablet, * the latter one simple action like "Zoom 100%" or "Reset Rotation". * diff --git a/libs/ui/input/kis_stroke_shortcut.cpp b/libs/ui/input/kis_stroke_shortcut.cpp --- a/libs/ui/input/kis_stroke_shortcut.cpp +++ b/libs/ui/input/kis_stroke_shortcut.cpp @@ -46,7 +46,7 @@ { int buttonScore = 0; Q_FOREACH (Qt::MouseButton button, m_d->buttons) { - buttonScore += Qt::XButton2 - button; + buttonScore += Qt::ForwardButton - button; } return m_d->modifiers.size() * 0xFFFF + buttonScore * 0xFF + action()->priority();