From 7512093c205090608c316cd3e866af9feaa0ce66 Mon Sep 17 00:00:00 2001 From: lewiatan Date: Sat, 17 Feb 2018 22:08:25 +0100 Subject: [PATCH] support rating tag from EXIF/XMP- fixes --- rtgui/cacheimagedata.cc | 5 +++++ rtgui/thumbnail.h | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index 1c4ac83ea..47318990d 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -66,6 +66,10 @@ int CacheImageData::load (const Glib::ustring& fname) rankOld = keyFile.get_integer ("General", "Rank"); } + if (keyFile.has_key ("General", "Rating")) { + rating = keyFile.get_integer ("General", "Rating"); + } + if (keyFile.has_key ("General", "InTrash")) { inTrashOld = keyFile.get_boolean ("General", "InTrash"); } @@ -227,6 +231,7 @@ int CacheImageData::save (const Glib::ustring& fname) keyFile.set_boolean ("General", "Supported", supported); keyFile.set_integer ("General", "Format", format); keyFile.set_boolean ("General", "RecentlySaved", recentlySaved); + keyFile.set_integer ("General", "Rating", rating); // remove the old implementation of Rank and InTrash from cache if (keyFile.has_key ("General", "Rank")) { diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 2c0cba2b0..75b1ecdd5 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -168,7 +168,13 @@ public: { return cfs.rating; } - void setRank (int rank); + void setRank (int rank) + { + if (cfs.rating != rank) { + cfs.rating = rank; + } + pparamsValid = true; // FIXME-piotr Is this the right way to refresh the cache? Probably not since pparams and cache should be 2 different things + } int getColorLabel () const; void setColorLabel (int colorlabel);