Skip to content

Undo commands for adding/removing/editing assistants/guides

Tusooa Zhu requested to merge tusooaw/krita:tusooaw/guide-undo-commands into master

CCBUG: https://bugs.kde.org/show_bug.cgi?id=361012

This MR adds undo command for assistant editing and controls the condition for merging KisChangeGuidesCommands. Adding multiple guides/assistants will create multiple undo commands. Removing multiple guides/assistants will create multiple undo commands. Consecutive editing of one single guide will lead to only one undo command. Consecutive editing of one assistants will lead to several commands. The list of assistants will be cloned between each adding/removing/editing, and the display properties will be shared between these clones. Changing the visual properties of guides/assistants will not create undo commands.

Test Plan

  1. Create a document.
  2. Create a guide. The undo history will have an item named "Add Guide."
  3. Create another guide. The undo history will have another item named "Add Guide."
  4. Move the first guide. The undo history will have another item named "Edit Guides."
  5. Disable "View->Lock Guides." No additional item added to undo history.
  6. Undo. Guides should still be locked and the first guide is moved to its original place.
  7. Redo. Guides should still be locked and the first guide's position goes back.
  8. Remove the first guide. The last "Edit Guides" should become "Remove Guide." (XXX)
  9. Undo and redo several times. There should be no errors and the position of only one guide may change per undo/redo.
  10. Activate "Assistant Tool."
  11. Create an assistant. There should be an item named "Add Assistant" in the undo history.
  12. Create another assistant. There should be another item named "Add Assistant" in the undo history.
  13. Move/Edit (change shape) the second assistant. There should be another item named "Edit Assistants."
  14. Toggle the visibility of the second assistant. There should be no new items.
  15. Remove the second assistant. There should be another item named "Remove Assistant."
  16. Undo/redo several times. The visibility should not change and the position of only one assistant may change per undo/redo.

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. -- All libs/ui/tests passed.
  • 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. -- Many things in this file conflicts with docs.krita.org.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Tusooa Zhu

Merge request reports