|
Krita Source Code Documentation
|
A class encapsulating all settings for a single shortcut. More...
#include <kis_shortcut_configuration.h>
Classes | |
| class | Private |
Public Types | |
| enum | GestureAction { NoGesture , OneFingerTap , TwoFingerTap , ThreeFingerTap , FourFingerTap , FiveFingerTap , OneFingerDrag , TwoFingerDrag , ThreeFingerDrag , FourFingerDrag , FiveFingerDrag , MaxGesture } |
| enum | MouseWheelMovement { NoMovement , WheelUp , WheelDown , WheelLeft , WheelRight , WheelTrackpad } |
| enum | ShortcutType { UnknownType , KeyCombinationType , MouseButtonType , MouseWheelType , GestureType , MacOSGestureType } |
Public Member Functions | |
| KisAbstractInputAction * | action () const |
| Qt::MouseButtons | buttons () const |
| GestureAction | gesture () const |
| QString | getInputText () const |
| bool | isNoOp () const |
| QList< Qt::Key > | keys () const |
| KisShortcutConfiguration () | |
| KisShortcutConfiguration (const KisShortcutConfiguration &other) | |
| uint | mode () const |
| KisShortcutConfiguration & | operator= (const KisShortcutConfiguration &other) |
| bool | operator== (const KisShortcutConfiguration &other) const |
| QString | serialize () |
| void | setAction (KisAbstractInputAction *newAction) |
| void | setButtons (Qt::MouseButtons newButtons) |
| void | setGesture (GestureAction type) |
| void | setKeys (const QList< Qt::Key > &newKeys) |
| void | setMode (uint newMode) |
| void | setType (ShortcutType newType) |
| void | setWheel (MouseWheelMovement type) |
| ShortcutType | type () const |
| bool | unserialize (const QString &serialized) |
| MouseWheelMovement | wheel () const |
| virtual | ~KisShortcutConfiguration () |
Static Public Member Functions | |
| static QString | buttonsInputToText (const QList< Qt::Key > &keys, Qt::MouseButtons buttons) |
| static QString | buttonsToText (Qt::MouseButtons buttons) |
| static QString | gestureToText (GestureAction action) |
| static QString | keysToText (const QList< Qt::Key > &keys) |
| static QString | wheelInputToText (const QList< Qt::Key > &keys, MouseWheelMovement wheel) |
| static QString | wheelToText (MouseWheelMovement wheel) |
Private Attributes | |
| Private *const | d |
A class encapsulating all settings for a single shortcut.
This class encapsulates mouse buttons, keyboard keys and other settings related to a single shortcut for a single action.
Definition at line 27 of file kis_shortcut_configuration.h.
The type of gesture.
| Enumerator | |
|---|---|
| NoGesture | No gesture. |
| OneFingerTap | |
| TwoFingerTap | |
| ThreeFingerTap | |
| FourFingerTap | |
| FiveFingerTap | |
| OneFingerDrag | |
| TwoFingerDrag | |
| ThreeFingerDrag | |
| FourFingerDrag | |
| FiveFingerDrag | |
| MaxGesture | |
Definition at line 57 of file kis_shortcut_configuration.h.
The type of mouse wheel movement.
Definition at line 45 of file kis_shortcut_configuration.h.
The type of shortcut, i.e. what kind of input does it expect.
Definition at line 33 of file kis_shortcut_configuration.h.
| KisShortcutConfiguration::KisShortcutConfiguration | ( | ) |
Constructor.
Definition at line 37 of file kis_shortcut_configuration.cpp.
| KisShortcutConfiguration::KisShortcutConfiguration | ( | const KisShortcutConfiguration & | other | ) |
Copy constructor.
Definition at line 43 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::action, action(), KisShortcutConfiguration::Private::buttons, buttons(), d, KisShortcutConfiguration::Private::gesture, gesture(), KisShortcutConfiguration::Private::keys, keys(), KisShortcutConfiguration::Private::mode, mode(), KisShortcutConfiguration::Private::type, type(), KisShortcutConfiguration::Private::wheel, and wheel().
|
virtual |
| KisAbstractInputAction * KisShortcutConfiguration::action | ( | ) | const |
Definition at line 180 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::action, and d.
| Qt::MouseButtons KisShortcutConfiguration::buttons | ( | ) | const |
Definition at line 228 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::buttons, and d.
|
static |
Convert a shortcut build of a set of keys and a set of mouse buttons into a user-readable string.
This will convert the given mouse buttons-based shortcut into a string that can be shown to a user. For example, the combination of Qt::Key_Control and Qt::LeftButton + Qt::RightButton will produce the string "Ctrl + Left + Right Button".
| keys | The keys to convert. |
| buttons | The mouse buttons to convert. |
Definition at line 439 of file kis_shortcut_configuration.cpp.
References buttons(), buttonsToText(), keys(), and keysToText().
|
static |
Convert a set of mouse buttons into a user-readable string.
This will convert the given set of buttons into a string that can be shown to a user. For example, the combination Qt::LeftButton + Qt::RightButton will produce the string "Left + Right Button".
| buttons | The buttons to convert. |
Definition at line 290 of file kis_shortcut_configuration.cpp.
References _, buttons(), and EXTRA_BUTTON.
| KisShortcutConfiguration::GestureAction KisShortcutConfiguration::gesture | ( | ) | const |
Definition at line 252 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::gesture.
|
static |
Definition at line 471 of file kis_shortcut_configuration.cpp.
References action(), FiveFingerDrag, FiveFingerTap, FourFingerDrag, FourFingerTap, OneFingerDrag, OneFingerTap, ThreeFingerDrag, ThreeFingerTap, TwoFingerDrag, and TwoFingerTap.
| QString KisShortcutConfiguration::getInputText | ( | ) | const |
Definition at line 273 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::buttons, buttonsInputToText(), d, KisShortcutConfiguration::Private::gesture, gestureToText(), GestureType, KeyCombinationType, KisShortcutConfiguration::Private::keys, keysToText(), MacOSGestureType, MouseButtonType, MouseWheelType, KisShortcutConfiguration::Private::type, KisShortcutConfiguration::Private::wheel, and wheelInputToText().
| bool KisShortcutConfiguration::isNoOp | ( | ) | const |
Definition at line 264 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::buttons, d, KisShortcutConfiguration::Private::gesture, GestureType, KeyCombinationType, KisShortcutConfiguration::Private::keys, MacOSGestureType, MaxGesture, MouseButtonType, MouseWheelType, NoGesture, NoMovement, KisShortcutConfiguration::Private::type, UnknownType, and KisShortcutConfiguration::Private::wheel.
| QList< Qt::Key > KisShortcutConfiguration::keys | ( | ) | const |
Definition at line 216 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::keys.
|
static |
Convert a list of keys to a user-readable string.
This will convert the given list of keys into a string that can be shown to a user. For example, the list [Qt::Key_Shift, Qt::Key_Space] will produce the string "Shift + Space".
| keys | The keys to convert. |
Definition at line 364 of file kis_shortcut_configuration.cpp.
References keys().
| uint KisShortcutConfiguration::mode | ( | ) | const |
Definition at line 204 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::mode.
| KisShortcutConfiguration & KisShortcutConfiguration::operator= | ( | const KisShortcutConfiguration & | other | ) |
Copy assignment.
Definition at line 55 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::action, action(), KisShortcutConfiguration::Private::buttons, buttons(), d, KisShortcutConfiguration::Private::gesture, gesture(), KisShortcutConfiguration::Private::keys, keys(), KisShortcutConfiguration::Private::mode, mode(), KisShortcutConfiguration::Private::type, type(), KisShortcutConfiguration::Private::wheel, and wheel().
| bool KisShortcutConfiguration::operator== | ( | const KisShortcutConfiguration & | other | ) | const |
Checks whether two configurations have the same input config.
Definition at line 68 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::buttons, d, KisShortcutConfiguration::Private::gesture, KisShortcutConfiguration::Private::keys, KisShortcutConfiguration::Private::type, and KisShortcutConfiguration::Private::wheel.
| QString KisShortcutConfiguration::serialize | ( | ) |
Serialize the data of this shortcut into a string that can be saved into a configuration file.
The string will have the following format:
{mode;type;[key,key];buttons;wheel;gesture}
with each property serialized into a base-16 integer.
Definition at line 79 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::buttons, d, KisShortcutConfiguration::Private::gesture, GestureType, KisShortcutConfiguration::Private::keys, MacOSGestureType, KisShortcutConfiguration::Private::mode, KisShortcutConfiguration::Private::type, and KisShortcutConfiguration::Private::wheel.
| void KisShortcutConfiguration::setAction | ( | KisAbstractInputAction * | newAction | ) |
Set the action this shortcut should be associated with.
| newAction | The action to set. |
Definition at line 185 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::action, and d.
| void KisShortcutConfiguration::setButtons | ( | Qt::MouseButtons | newButtons | ) |
Set the mouse buttons that will trigger this shortcut.
| newButtons | The mouse buttons to use. |
Definition at line 233 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::buttons, and d.
| void KisShortcutConfiguration::setGesture | ( | KisShortcutConfiguration::GestureAction | type | ) |
Set the gesture that will trigger this shortcut.
| type | The gesture to use. |
Definition at line 257 of file kis_shortcut_configuration.cpp.
References d, KisShortcutConfiguration::Private::gesture, and type().
Set the list of keys that will trigger this shortcut.
| newKeys | The list of keys to use. |
Definition at line 221 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::keys.
Set the mode of the action this shortcut will trigger.
| newMode | The mode to set. |
Definition at line 209 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::mode.
| void KisShortcutConfiguration::setType | ( | KisShortcutConfiguration::ShortcutType | newType | ) |
Set the type of shortcut.
| newType | The type to set. |
Definition at line 197 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::type.
| void KisShortcutConfiguration::setWheel | ( | KisShortcutConfiguration::MouseWheelMovement | type | ) |
Set the mouse wheel movement that will trigger this shortcut.
| type | The wheel movement to use. |
Definition at line 245 of file kis_shortcut_configuration.cpp.
References d, type(), and KisShortcutConfiguration::Private::wheel.
| KisShortcutConfiguration::ShortcutType KisShortcutConfiguration::type | ( | ) | const |
Definition at line 192 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::type.
| bool KisShortcutConfiguration::unserialize | ( | const QString & | serialized | ) |
Apply the data from a serialized shortcut to this shortcut.
This method expects a string as described in serialize().
| serialized | The serialized shortcut. |
Definition at line 116 of file kis_shortcut_configuration.cpp.
References KisShortcutConfiguration::Private::buttons, d, KisShortcutConfiguration::Private::gesture, GestureType, KisShortcutConfiguration::Private::keys, MacOSGestureType, KisShortcutConfiguration::Private::mode, KisShortcutConfiguration::Private::type, UnknownType, and KisShortcutConfiguration::Private::wheel.
| KisShortcutConfiguration::MouseWheelMovement KisShortcutConfiguration::wheel | ( | ) | const |
Definition at line 240 of file kis_shortcut_configuration.cpp.
References d, and KisShortcutConfiguration::Private::wheel.
|
static |
Convert a shortcut build of a set of keys and a set of mouse wheel buttons into a user-readable string.
This will convert the given mouse wheel-based shortcut into a string that can be shown to a user. For example, the combination of Qt::Key_Control and WheelUp will produce the string "Ctrl + Mouse Wheel Up".
| keys | The keys to convert. |
| wheel | The mouse wheel buttons to convert. |
Definition at line 455 of file kis_shortcut_configuration.cpp.
References keys(), keysToText(), wheel(), and wheelToText().
|
static |
Convert the given mouse wheel movement to a string.
This will convert the given mouse wheel movement into a string that can be shown to a user. For example, WheelUp will produce the string "Mouse Wheel Up".
| wheel | The mouse wheel movement to convert. |
Definition at line 410 of file kis_shortcut_configuration.cpp.
References wheel(), WheelDown, WheelLeft, WheelRight, WheelTrackpad, and WheelUp.
|
private |
Definition at line 326 of file kis_shortcut_configuration.h.