Change the way how old paintops are saved over and named.
ClosedPublic

Authored by woltherav on Jun 21 2017, 2:33 PM.

Details

Summary

Currently, in master, when saving over an old preset, the new preset is saved to presetNameGBLGK.kpp with the help of QTemporaryFile, and the oldpreset is blacklisted.
This patch does two things.

  1. The new preset will be saved using an unmodified name, while the old preset is given the new file name and blacklisted. This means that the latest version of the preset is always named presetName.kpp
  2. The renamed filename is turned into presetName_backup_datetimestamp.kpp

These two things should make making presets a lot more user-friendly. This fixes https://bugs.kde.org/show_bug.cgi?id=330251

Test Plan

I have veriefied this works for pre-installed preset(that is, presets that are loaded from the install directory, and not the resource directory). These require extra help to make sure that they get blacklisted, so I am happy with that.

However, as you may know everything that happens in Kis_Paintop_Box.cc is bound to haunt us for the coming year, so I refuse to commit this patch unless all the reviewers I assigned have tested and accepted the thing.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
woltherav created this revision.Jun 21 2017, 2:33 PM
woltherav updated this revision to Diff 15737.Jun 22 2017, 11:12 AM

It seems that presets always need to be readded to the server, otherwise they won't show up in the list after saving. I updated the diff to handle that.

woltherav updated this revision to Diff 15776.Jun 23 2017, 9:21 AM

Based on @dkazakov and Wysteriary[m]'s testing, we found that the new code didn't test making new presets properly.

Now it checks for the name, whether or not to make a back-up and sets the name properly.

woltherav updated this revision to Diff 15780.Jun 23 2017, 10:32 AM

Make sure we're saving a new preset all-together when having a new name. (Krita will still, in the case of having presetA and presetB present, when resaving presetA as presetB make a backup of the old presetB)

timotheegiet accepted this revision.Jun 23 2017, 11:21 AM

Tested and approved, good work!

This revision is now accepted and ready to land.Jun 23 2017, 11:21 AM
scottpetrovic edited edge metadata.Jun 24 2017, 2:00 PM

looks great! It is definitely easier to understand the older versions of the presets now by looking at the file names

scottpetrovic accepted this revision.Jun 24 2017, 2:04 PM
rempt accepted this revision.Jun 27 2017, 12:10 PM
dkazakov accepted this revision.Jun 27 2017, 12:40 PM

Hi, @woltherav!

Now the patch works and looks perfectly fine! :) The presets and backups are saved with easily recognizable filenames :)

This revision was automatically updated to reflect the committed changes.