1. 22 Feb, 2022 1 commit
    • Agata Cacko's avatar
      Speed up updateView() in tag selection widget · 983ea2ac
      Agata Cacko authored
      Before this commit, to get the tags for the resources,
      Krita would, for every resource separately, set the resource id
      to the filterproxy model and then iterate on that model to get
      the tags. This is inefficient because the filter proxy model
      iterates on all the items in the original model to get the
      matching rows anyway.
      
      This commit ensures that the model has all the resource ids
      at once, so the iterating over the base model rows happens
      only twice (one to filter out inside the proxy model,
      one to iterate on the rows to build the tags list).
      
      NOTE: Setting of the resource ids happens only
      in setResourceIds() function, and updateView() assumes
      it's already done.
      This improves the performance even more (because every
      setResourcesFilter() invalidates the filter inside the model,
      which causes it to iterate and filter out incorrect rows again,
      while having the filter already done means that adding or removing
      on those resources will only add or remove some rows), but the
      performance imrpovements are only on doing repeated actions on
      the same set of resources.
      It can potentially make it a bit more error prone, hence the
      comment above the loop.
      
      A possibility to make it still faster than before this commit,
      but less error prone: just set resources filter just before the
      loop, or set it to empty list and check for resource id being
      in the selected list manually in updateView().
      
      ---
      Credit for Grum999 for the idea and noticing the problem.
      983ea2ac
  2. 17 Feb, 2022 2 commits
    • Agata Cacko's avatar
      Untag multiple resources at once · 71d62749
      Agata Cacko authored
      Before this commit, untagging resources in
      KisTagResourceModel would happen only one resource
      and one tag at a time. This was pretty inefficient.
      Moreover there was an issue with signals sent by the model,
      they didn't match the actual rows being removed.
      
      This commit allows for untagging multiple resources at once,
      speeding it up a lot (the bigger the database/resources_tags
      table is, the more speed increase you get)
      and makes sure the signals sent by the models are correct
      and match the removed rows.
      71d62749
    • Agata Cacko's avatar
      Tag multiple resources at once · 6ac4f420
      Agata Cacko authored
      Before this commit, tagging resources in
      KisTagResourceModel would happen only one resource
      and one tag at a time. This was pretty inefficient.
      Moreover there was an issue with signals sent by the model,
      they didn't match the actual rows being inserted or removed.
      
      This commit allows for tagging multiple resources at once,
      speeding it up a lot (the bigger the database/resources_tags
      table is, the more speed increase you get; with Rakurri's
      bundle imported, I would get even 140x speed increase)
      and makes sure the signals sent by the models are correct
      and match the inserted and removed rows.
      6ac4f420
  3. 15 Dec, 2021 1 commit
  4. 06 Aug, 2021 2 commits
    • Agata Cacko's avatar
      Ask user on adding a tag with the same url in WdgTagSel · d8986090
      Agata Cacko authored
      Before this commit, if the user tried to create a new tag
      with the same url as an existing tag,
      it would undelete the deleted tag, which means the assigned
      resources would still be assigned.
      This commit instead asks the user what they want to achieve,
      and there are three options:
      * Replace (overwrite) - this will reset assigned resources
      * Undelete - this will cancel adding the tag and just
      undelete the existing, deleted tag with all the assigned
      resources it had before
      * Cancel - no operation
      
      Note that this will only happen if the tag is not active
      (if it's deleted). If it's not, Krita will just use that
      tag and tag the resource.
      
      CCMAIL:kde-i18n-doc@kde.org
      d8986090
    • Agata Cacko's avatar
      Add allowOverwrite option when adding a tag in KisTagModel · dea9c2a5
      Agata Cacko authored
      Before this commit, KisTagModel would always just undelete
      the tag if it was asked to add a tag with the same url
      as an existing tag.
      This commit changes this behaviour to overwrite the tag
      (which means the new Name and Comment is used and all
      assigned resources are unassigned) if "allowOverwrite"
      is set to true, or just return false if "allowOverwrite"
      is set to false.
      dea9c2a5
  5. 05 Aug, 2021 1 commit
  6. 09 Jun, 2021 1 commit
    • Agata Cacko's avatar
      Fix order of tags in Resource Manager · 47e575e7
      Agata Cacko authored
      In both the Tag Selection Widget and the tags combobox
      in the Resource Manager, the order of tags was different from
      the order of tags in the Brush Presets docker.
      This commit fixes it and now all of them uses tag model
      sorted by Name.
      47e575e7
  7. 10 Mar, 2021 8 commits
    • Agata Cacko's avatar
      Remove CustomTag classes · 419fe0c8
      Agata Cacko authored
      They are not used and won't be used anywhere.
      419fe0c8
    • Agata Cacko's avatar
      Fix AddTagButton looking disabled when no resource is selected · 2bd49f34
      Agata Cacko authored
      Before this commit, if there was no resource selected,
      the button would look exactly the same as always.
      This commit ensures that when the widget is disabled
      (when no resources are selected), it will look disabled.
      2bd49f34
    • Agata Cacko's avatar
      Add create new tag widget inside the AddTag button · 86609afa
      Agata Cacko authored
      Before this commit, there was no way to create a new tag in the Resource
      Manager. This commit adds a simple textbox with a [+] button at the end
      at the end of the context menu that appears when you click on the AddTag
      button.
      
      There are still several issues regarding this addition.
      - the popup only closes after the second Enter... it should close
      always after the user presses Enter or clicks on the [+] button
      (which doesn't happen)
      - it adds QAction::trigger() in a class that is used elsewhere;
      must check if it still works properly in the old location
      (right-click in Brush Presets docker)
      - KisSignalCompressor is most probably unnecessary
      86609afa
    • Agata Cacko's avatar
      Fix not finding tags in Resource Manager in some situations · d478fdb6
      Agata Cacko authored
      Before this commit, if the user clicked on some brushes (brush tips),
      and then went to Brush Presets and clicked on some presets,
      it would look as if there are no tags associated with those presets.
      This commit fixes it by ensuring there will be a proper tag resources
      model for a specific resource type.
      d478fdb6
    • Agata Cacko's avatar
      Implement better behaviour for multiple selected tags · af5b513c
      Agata Cacko authored
      Before this commit, KisTagSelectionWidget was used
      with CustomTagsCategory button. This wasn't used anywhere
      and was removed in this commit.
      On the other hand this commit also adds a semi-selected
      tag implementation.
      af5b513c
    • Agata Cacko's avatar
      Use resourceId instead of resource in OneResController · 664ffeec
      Agata Cacko authored
      Before this commit, TagSelectionWidgetOneResourceController
      would use a whole KisResourceSP instead of resourceId.
      This commit ensures the controller uses resourceId instead.
      
      Before this commit, the model would get a whole resource which meant
      that the resource had to be loaded first. This commit removes that need
      by using only the resourceId for those actions.
      664ffeec
    • Agata Cacko's avatar
      Add KisTagSelectionWidget to ResourceManager · 6afb7757
      Agata Cacko authored
      Before this commit, ResourceManager had no widget for tags.
      This commit adds the widget to Resource Manager.
      Note:
      - it also renames it
      - the tag widget is still working quite randomly and needs a bit of work
      6afb7757
    • Agata Cacko's avatar
      Implement TagSelectionWidget · e9c2f9aa
      Agata Cacko authored
      Before this commit, there was no widget that behaved
      like tags on websites or mobile applications.
      This commit adds a widget like that
      with a simple controller.
      Accepted tags are in KoID format.
      
      This commit also adds a flow layout.
      e9c2f9aa