Skip to content

Less saves in the palette docker

I added a "Save" button to the palette docker and smart autosaving in various cases.

Current behaviour:

  • just editing the palette doesn't create a new version of the palette
  • clicking Save button does create a new version of the palette
  • closing Krita normally does create a new version of the palette if the palette was modified
  • switching to another palette does create a new version of the palette if the palette was modified
  • crashing Krita loses the unsaved changes to the palette

Concerns:

  • now the "Save" button is basically only used in case when Krita crashes - so is it even needed? is the icon good? Maybe I should add a separator between swatches edit buttons and the other buttons? (also what's up with that remove button... wouldn't a trashcan be better?)
  • maybe Save shouldn't create a new palette version if the palette was not modified?
  • should changes on palettes that are document-embedded be shown? They will be saved anyway. If the user saves, that is.

Notes:

  • for exporting the palette, there is a separate export button in the palette chooser

To do:

  • ensure it works after Dmitry's fixes to resources versions
  • ensure it updates thumbnails on saving a new version
  • don't show changes on files that are not global (since they will be saved anyway into the document)

Test Plan

  1. Creating a new global palette
  • go to the palette chooser, click the + button, put a name for the palette - it should create an empty palette for you. It should be visible after restarting Krita under the same name. It should have the same colors as before.
  1. Saving normally
  • edit the palette
  • use the Save button
  • close and open Krita
  • changes should be there, there should be no copies of the palettes in the list
  1. Switching to another palette
  • edit the palette
  • switch to another palette
  • changes should be there, there should be no copies of the palettes in the list
  • the name should look as if it was saved
  • close and open Krita, the changes should be there
  1. Just closing Krita
  • edit the palette
  • close Krita
  • changes should be there, no duplicate palettes
  1. Crashing Krita
  • edit the palette
  • crash Krita
  • no changes saved!
  1. Crash + save before
  • edit the palette
  • use the Save button
  • crash and reopen Krita
  • changes should be there, there should be no copies of the palettes in the list
  1. Crash + switch to another palette before
  • edit the palette
  • switch to another palette
  • changes should be there, there should be no copies of the palettes in the list
  • the name should look as if it was saved
  • crash and reopen Krita, the changes should be there
  1. Create a new document palette
  • create the palette inside the document
  • save the document
  • reopen Krita
  • open the document
  • the palette should be there
  1. New changes in the palette
  • open a document with a palette
  • make changes
  • overwrite the file
  • the changes should be there
  1. New changes in the palette - new file
  • open a document with a palette
  • make changes
  • save to a new file
  • the changes should be in the new file
  • old file should still show the old palette

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Agata Cacko

Merge request reports