support rating tag from EXIF/XMP- fixes

This commit is contained in:
lewiatan 2018-02-17 22:08:25 +01:00 committed by Eric Jiang
parent 105517c561
commit 7512093c20
2 changed files with 12 additions and 1 deletions

View File

@ -66,6 +66,10 @@ int CacheImageData::load (const Glib::ustring& fname)
rankOld = keyFile.get_integer ("General", "Rank"); rankOld = keyFile.get_integer ("General", "Rank");
} }
if (keyFile.has_key ("General", "Rating")) {
rating = keyFile.get_integer ("General", "Rating");
}
if (keyFile.has_key ("General", "InTrash")) { if (keyFile.has_key ("General", "InTrash")) {
inTrashOld = keyFile.get_boolean ("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_boolean ("General", "Supported", supported);
keyFile.set_integer ("General", "Format", format); keyFile.set_integer ("General", "Format", format);
keyFile.set_boolean ("General", "RecentlySaved", recentlySaved); keyFile.set_boolean ("General", "RecentlySaved", recentlySaved);
keyFile.set_integer ("General", "Rating", rating);
// remove the old implementation of Rank and InTrash from cache // remove the old implementation of Rank and InTrash from cache
if (keyFile.has_key ("General", "Rank")) { if (keyFile.has_key ("General", "Rank")) {

View File

@ -168,7 +168,13 @@ public:
{ {
return cfs.rating; 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; int getColorLabel () const;
void setColorLabel (int colorlabel); void setColorLabel (int colorlabel);