Revision a86b7b8...

Go back to digest for 19th May 2013

Features in Office

Boudewijn Rempt committed changes in [calligra] /:

Add resource categorizing with tags

Patch by Sascha Suelzer


REVIEW:110429
FEATURE: Add resource categorizing with tags

Todo: keep the comboboxes synchronized

This improves the way the user can organize resources into named sets
that can be added, deleted and chosen from a drop down menu that I've
added to KoResourceItemChooser. This made the changes available to the
paintoppreset choosers, the gradient choosers and the pattern choosers.

Usage right now is:

Mostly mouse based version:
Right clicking any resource can assign it to or remove it from any tag.
There is an option to create a new tag for the resource as well.
It's fairly intuitive.
-----------------------------------------------------------------------

Mostly keyboard based version:
Resource dockers and popups start with an unfiltered view, in this view
the tag search bar at the bottom is disabled.

To add a tag category, press the plus button and enter a name for the tag.

This creates an empty view and enables the search text box at the bottom.

Terms in double quotes "like this" will be matched to the resource name
exactly.

Entering terms without quotes will partial matching, good for filtering
many resources. filtering eraser would remove all resources with eraser in
their name.

Putting an exclamation mark in front of a term will exclude the term from
the set.

Pressing enter saves the set and will clear the search box, so we don't end
up with something like erase,sketch,fur,!paint,smudge_1,smudge_2,... etc

Once a set is defined, it can be used as a search term as well.
For example:
We've created a set that contains all erasers and is called 'erasers'.
If we switch to a different set and type [erasers] in the search box then
all the items of that set will be added to the current set, exclusions work
the same way.

============================================================================
Remarks about the patch:

Currently only adding and deleting categories is supported, renaming them
is in the code but lacks an UI feature, which I was unable to implement.
(I wanted the unfiltered view to be immutable and tried dis and enabling
the editable state of the drop down box based on which index was active,
but that introduced a segfault.)
All in all the UI parts I've written aren't exactly amazing, maybe
someone more experienced can take care of that? I can do it but it'd be
slow since I have very little experience with that.

I have removed the `show all' checkbox in the paintop preset docker and
all references to that functionality since it made filtering a bit more
complicated as well as just not making too much sense with the
improvements to the tagging system.

I have also removed the proxy adapter in KisPresetChooser since it
didn't do anything useful after these changes, yet required attention
since it overloaded some now improved functions.

Current shortcomings of the system, most of them are UI related:

- Since I used the already existing KoResourceTagging class to handle all
the tagging bits, and ultimately save tags to disk, in alphabetical
order, restarting Krita, and thus repopulating the combo boxes also
fills them in alphabetical order and not in the order they might have
been defined by the user.

- Adding a new tag in a pop-up chooser closes the popup since I used an
input dialog after failing to implement it with combobox editing.

- Combo boxes aren't updated for all item choosers of the same kind.
For example adding a few categories in the preset docker does not update
the combo box in the preset chooser popup that can be found in the toolbar.

I also had a crash at one point in time where some brush presets got
changed around in master and clicking some resources in the brush preset
box crashed the program, but I was not able to reproduce that after a
clean rebuild of my local workspace and changing presets around
externally, so it might not be an issue, but I'm including it for
completeness sake.

File Changes

Added 2 files
  • /widgets
  •   libs/KoResourceFiltering.cpp
  •   libs/KoResourceFiltering.h
Modified 23 files
  •   krita/ui/kis_config.cc
  •   krita/ui/kis_config.h
  •   krita/ui/kis_paintop_box.cc
  •   krita/ui/kis_palette_manager.cpp
  •   libs/widgets/CMakeLists.txt
  •   libs/widgets/KoResourceItemChooser.cpp
  •   libs/widgets/KoResourceItemChooser.h
  •   libs/widgets/KoResourceItemView.cpp
  •   libs/widgets/KoResourceItemView.h
  •   libs/widgets/KoResourceModel.cpp
  •   libs/widgets/KoResourceModel.h
  •   libs/widgets/KoResourceServer.h
  •   libs/widgets/KoResourceServerAdapter.h
  •   krita/ui/forms/wdgpaintoppresets.ui
  •   krita/ui/widgets/kis_paintop_presets_chooser_popup.cpp
  •   krita/ui/widgets/kis_paintop_presets_chooser_popup.h
  •   krita/ui/widgets/kis_preset_chooser.cpp
  •   krita/ui/widgets/kis_preset_chooser.h
  •   krita/ui/widgets/kis_preset_selector_strip.cpp
  •   krita/plugins/extensions/dockers/dockerplugintemplate/presetdocker_dock.cpp
  •   krita/plugins/extensions/dockers/dockerplugintemplate/presetdocker_dock.h
  •   krita/plugins/extensions/dockers/presetdocker/presetdocker_dock.cpp
  •   krita/plugins/extensions/dockers/presetdocker/presetdocker_dock.h
25 files changed in total