Add optional image rank/color load/save from/to xmp sidecar

Add optional ability to load/save image rank property from/to xmp
sidecar "xmp.Rating" and color property from xmp "xmp.Label" ignoring
the ones provided in the processing params file.

This behavior is disabled by default and an option under settings ->
file browser has been added to enable it.

When enabled:

* On load:
  * rank and color are not read from processing params.
  * rank is mapped from xmp sidecar file rating entry.
  * color is mapped from xmp sidecar file label entry.

* On save:
  * rank and color are saved to the xmp sidecar
  * rank and color are also saved to the processing param (pp3) files to
    keep them in sync

Rating mapping:

Since rating can be also -1 but rank only goes from 0 to 5, the -1 value
is ignored like already done when importing from embedded xmp data.

Color mapping:

XMP has no color concept, usually programs like digikam uses the label
field to write a color name ("Red", "Orange"). The problem is that this
isn't standardized and label can be any string. Additionally Rawtherapee
has 5 specific colors while other programs can have different colors
with different name so they won't be shown if they don't map to the 5
color names supported by rawtherapee. On save only the 5 color supported
by rawtherapee wil be saved.

Trash is kept only in the profile files for multiple reasons:

* There's no trash concept in xmp, there's the rejected concept assigned
  to a rating == -1.
* We could map rejected to trash but in rawtherapee rank and trash are two different values and
  an image can have both rank >= 0 and trashed set to true.
  Using an unique value like rating for rank and trash (when -1) will
  require changing the current rawtherapee logic.
* Also digikam only handles ratings from 0 to 5 (no -1) and handles
  trash in its own internal way without reflecting it in the xmp
  sidecar.
This commit is contained in:
Simone Gotti
2024-03-12 18:12:49 +01:00
parent 68fd35d881
commit 1098966a8b
9 changed files with 152 additions and 17 deletions

View File

@@ -2033,6 +2033,7 @@ PREFERENCES_THUMBNAIL_INSPECTOR_JPEG;Embedded JPEG preview
PREFERENCES_THUMBNAIL_INSPECTOR_MODE;Image to show
PREFERENCES_THUMBNAIL_INSPECTOR_RAW;Neutral raw rendering
PREFERENCES_THUMBNAIL_INSPECTOR_RAW_IF_NO_JPEG_FULLSIZE;Embedded JPEG if fullsize, neutral raw otherwise
PREFERENCES_THUMBNAIL_RANK_COLOR_MODE;Load/Save thumbnail rank and color from/to XMP sidecars
PREFERENCES_TOOLPANEL_AVAILABLETOOLS;Available Tools
PREFERENCES_TOOLPANEL_CLONE_FAVORITES;Keep favorite tools in original locations
PREFERENCES_TOOLPANEL_CLONE_FAVORITES_TOOLTIP;If set, favorite tools will appear in both the favorites tab and their original tabs.\n\nNote: Enabling this option may result in a slight delay when switching tabs.