Krita Source Code Documentation
Loading...
Searching...
No Matches
KisInputProfileMigratorFrom6 Class Reference

#include <KisInputProfileMigrator.h>

+ Inheritance diagram for KisInputProfileMigratorFrom6:

Public Member Functions

 KisInputProfileMigratorFrom6 (KisInputProfileManager *manager)
 
QList< KisShortcutConfiguration > migrate (const ProfileEntry &profile) override
 
 ~KisInputProfileMigratorFrom6 () override
 
- Public Member Functions inherited from KisInputProfileMigrator
virtual ~KisInputProfileMigrator ()
 

Private Attributes

KisInputProfileManager * m_manager
 

Additional Inherited Members

- Static Protected Member Functions inherited from KisInputProfileMigrator
static QList< KisShortcutConfiguration > getShortcutsFromProfile (QString profile, KisInputProfileManager *manager)
 

Detailed Description

Migrates Krita profile from version 6 to the current version

Definition at line 67 of file KisInputProfileMigrator.h.

Constructor & Destructor Documentation

◆ KisInputProfileMigratorFrom6()

KisInputProfileMigratorFrom6::KisInputProfileMigratorFrom6 ( KisInputProfileManager * manager)

Definition at line 117 of file KisInputProfileMigrator.cpp.

118 : m_manager(manager)
119{
120
121}
KisInputProfileManager * m_manager

◆ ~KisInputProfileMigratorFrom6()

KisInputProfileMigratorFrom6::~KisInputProfileMigratorFrom6 ( )
override

Definition at line 123 of file KisInputProfileMigrator.cpp.

124{
125
126}

Member Function Documentation

◆ migrate()

QList< KisShortcutConfiguration > KisInputProfileMigratorFrom6::migrate ( const ProfileEntry & profile)
overridevirtual

Firstly, remove all native gesture shortcuts, since they change semantics in Version 7

Now add the default connection between native gestures and "Zoom and Rotate Canvas" action

Now add the default connection between native scroll and "Pan Canvas" action

Implements KisInputProfileMigrator.

Definition at line 128 of file KisInputProfileMigrator.cpp.

129{
135 auto shortcuts = getShortcutsFromProfile(profile.fullpath, m_manager);
136 for (auto it = shortcuts.begin(); it != shortcuts.end();) {
138 it = shortcuts.erase(it);
139 } else {
140 ++it;
141 }
142 }
143
144 for (auto it = shortcuts.begin(); it != shortcuts.end();) {
147 it = shortcuts.erase(it);
148 } else {
149 ++it;
150 }
151 }
152
153 auto actions = m_manager->actions();
154
155 {
161 auto it = std::find_if(actions.begin(), actions.end(), kismpl::mem_equal_to(&KisAbstractInputAction::id, "Zoom and Rotate Canvas"));
162 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(it != actions.end(), shortcuts);
163
164 KisShortcutConfiguration newNativeGestureShortcut;
165 newNativeGestureShortcut.setAction(*it);
169 shortcuts.append(newNativeGestureShortcut);
170 }
171
172 {
178 auto it = std::find_if(actions.begin(), actions.end(), kismpl::mem_equal_to(&KisAbstractInputAction::id, "Pan Canvas"));
179 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(it != actions.end(), shortcuts);
180
181 KisShortcutConfiguration newNativeGestureShortcut;
182 newNativeGestureShortcut.setAction(*it);
185 newNativeGestureShortcut.setMode(KisPanAction::PanModeShortcut);
186 shortcuts.append(newNativeGestureShortcut);
187 }
188
189 return shortcuts;
190}
QList< KisAbstractInputAction * > actions
static QList< KisShortcutConfiguration > getShortcutsFromProfile(QString profile, KisInputProfileManager *manager)
@ PanModeShortcut
Toggle the pan mode.
A class encapsulating all settings for a single shortcut.
void setNativeGesture(NativeGestureAction type)
@ MouseWheelType
Mouse wheel movement, possibly with key modifiers.
void setAction(KisAbstractInputAction *newAction)
void setType(ShortcutType newType)
@ TouchpadScroll
Two-dimensional pixel scrolling on a touchpad, supported on MacOS and Wayland only.
@ PinchGesture
Pinch gesture, a two finger gesture used for navigating the canvas.
@ WheelReserved_0
Do not use! Previously was used for TouchpadScroll shortcut.
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129
auto mem_equal_to(MemTypeNoRef Class::*ptr, MemType &&value)
mem_equal_to is an unary functor that compares a member of the object to a given value
Definition KisMpl.h:233

References KisInputProfileManager::actions, ProfileEntry::fullpath, KisInputProfileMigrator::getShortcutsFromProfile(), KisAbstractInputAction::id, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, m_manager, kismpl::mem_equal_to(), KisShortcutConfiguration::MouseWheelType, KisShortcutConfiguration::NativeGestureType, KisZoomAndRotateAction::PanAndZoomAndRotateMode, KisPanAction::PanModeShortcut, KisShortcutConfiguration::PinchGesture, KisShortcutConfiguration::setAction(), KisShortcutConfiguration::setMode(), KisShortcutConfiguration::setNativeGesture(), KisShortcutConfiguration::setType(), KisShortcutConfiguration::TouchpadScroll, and KisShortcutConfiguration::WheelReserved_0.

Member Data Documentation

◆ m_manager

KisInputProfileManager* KisInputProfileMigratorFrom6::m_manager
private

Definition at line 77 of file KisInputProfileMigrator.h.


The documentation for this class was generated from the following files: