JJ:Add workspaces as submenu in the window menu
ClosedPublic

Authored by bruceoutdoors on Sep 18 2016, 3:06 PM.

Details

Summary

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

well... just thought I tried it since it's been hanging for awhile. It's more of a hack, so some revisions will be required. Currently missing deleting workspaces (to be explained). I tried to follow how it is done in photoshop.

The workspaces submenu shows up and updating accordingly when modified by KisWorkspaceChooser; that's the easy part.

For importing and creating workspaces, this patch just simply copy paste from where it was originally from; there's 2 copies of the same thing.

For deleting workspaces, I had not implemented it as I have my doubts on whether it would work. I initially have in mind a simple QInputDialog::getItem modal dialog, but there's a slight complication: there can exists multiple workspaces with the same name (for example if I save "bruce" as a workspace twice there are 2 workspaces named "bruce"). This is not allowed in photoshop; I'm not sure what use case would exist that a user wants 2 of more workspaces with the same name.

To workaround this is to create a custom QDialog that would have a QCombobox take a KoResourceModel as a model. Another Alternative is to copy paste code from KoResourceItemChooser. Either way there's going to be duplicate code.

Some refactoring in various parts of Krita will be needed to have import, create and delete workspace functionality properly shared.

Thoughts on this? Feel free to also comment on best practices and stuff; I'm fairly new to the project.

Diff Detail

Repository
R37 Krita
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruceoutdoors retitled this revision from to JJ:Add workspaces as submenu in the window menu.
bruceoutdoors updated this object.
bruceoutdoors edited the test plan for this revision. (Show Details)
bruceoutdoors added a reviewer: rempt.
bruceoutdoors set the repository for this revision to R37 Krita.
bruceoutdoors added a project: Krita.
Restricted Application added a subscriber: woltherav. · View Herald TranscriptSep 18 2016, 3:06 PM
bruceoutdoors added a comment.EditedSep 18 2016, 3:21 PM

Owh. I just noticed that although you can have duplicate workspaces with the same name, after restart krita will differentiate them accordingly:

There could be another alternative: have "(filename.kws)" appended without needing to restart, and now it would be easier to differentiate duplicate workspaces.

rempt edited edge metadata.Sep 18 2016, 4:39 PM

Thanks for picking this up! Even if it were imperfect and wouldn't have a delete option in the menu, it would be an improvement. I'll check your patch and your reservations tomorrow, but there's one remark I'd like to put in already: please reduce the number of places where you use 'auto' -- it doesn't really fit in with the rest of Krita's coding style.

This revision was automatically updated to reflect the committed changes.