Make Krita's canvas input profile migrate-able from version 5 to 6
The porting (PROFILE_VERSION - 1) to PROFILE_VERSION works as something like this, with entry point being loadProfile():
-
We fill two lists,
profileEntries
: one with profiles with profile version being PROFILE_VERSION,profileEntriesToMigrate
: one with profiles with version being (PROFILE_VERSION - 1). -
We go through the list we want to migrate and check if there is a corresponding version of it in
profileEntries
and that has to exist in user-local directory (not in install location -- which is the profile version we ship).a. If there doesn't exist one, we migrate the profile entry. And remove it from
profileEntriesToMigrate
.b. If there exists one (which isn't in user-local), we don't migrate.
-
Once we get what we have to migrate and what we don't. We invoke
KisInputProfileMigrator
to migrate the entries and because it will change how you want to carry out migration, it is an abstract class.a. Currently we invoke
KisInputProfileMigrator5To6
, which handles the migration where we have need to import only the new touch shortcuts. -
Once we've migrated, we copy the old file to same directory with version number suffix added to the filename -- this old file is what will be loaded by the old version of Krita if it ever is opened.
-
That's all, at this point we can save the new profile at the location where the old version was.
cc: @alvinwong