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:
@@ -694,6 +694,7 @@ void Options::setDefaults()
|
||||
lastICCProfCreatorDir = "";
|
||||
gimpPluginShowInfoDialog = true;
|
||||
maxRecentFolders = 15;
|
||||
thumbnailRankColorMode = Options::ThumbnailPropertyMode::PROCPARAMS;
|
||||
sortMethod = SORT_BY_NAME;
|
||||
sortDescending = false;
|
||||
rtSettings.lensfunDbDirectory = ""; // set also in main.cc and main-cli.cc
|
||||
@@ -1366,6 +1367,15 @@ void Options::readFromFile(Glib::ustring fname)
|
||||
if (keyFile.has_key("File Browser", "BrowseRecursiveFollowLinks")) {
|
||||
browseRecursiveFollowLinks = keyFile.get_boolean("File Browser", "BrowseRecursiveFollowLinks");
|
||||
}
|
||||
|
||||
if (keyFile.has_key("File Browser", "ThumbnailRankColorMode")) {
|
||||
std::string val = keyFile.get_string("File Browser", "ThumbnailRankColorMode");
|
||||
if (val == "xmp") {
|
||||
thumbnailRankColorMode = ThumbnailPropertyMode::XMP;
|
||||
} else {
|
||||
thumbnailRankColorMode = ThumbnailPropertyMode::PROCPARAMS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (keyFile.has_group("Clipping Indication")) {
|
||||
@@ -2462,6 +2472,14 @@ void Options::saveToFile(Glib::ustring fname)
|
||||
|
||||
keyFile.set_string_list("File Browser", "RecentFolders", temp);
|
||||
}
|
||||
switch (thumbnailRankColorMode) {
|
||||
case ThumbnailPropertyMode::XMP:
|
||||
keyFile.set_string("File Browser", "ThumbnailRankColorMode", "xmp");
|
||||
break;
|
||||
default: // ThumbnailPropertyMode::PROCPARAMS
|
||||
keyFile.set_string("File Browser", "ThumbnailRankColorMode", "procparams");
|
||||
break;
|
||||
}
|
||||
keyFile.set_integer("File Browser", "SortMethod", sortMethod);
|
||||
keyFile.set_boolean("File Browser", "SortDescending", sortDescending);
|
||||
keyFile.set_boolean("File Browser", "BrowseRecursive", browseRecursive);
|
||||
|
Reference in New Issue
Block a user