Use rating from EXIF/XMP where available

This commit is contained in:
Eric Jiang
2019-05-16 17:09:46 -07:00
parent 7512093c20
commit 820024972a
5 changed files with 25 additions and 16 deletions

View File

@@ -1006,15 +1006,22 @@ void Thumbnail::setFileName (const Glib::ustring &fn)
int Thumbnail::getRank () const
{
return pparams->rank;
// prefer the user-set rank over the embedded Rating
// pparams->rank == -1 means that there is no saved rank yet, so we should
// next look for the embedded Rating metadata.
if (pparams->rank != -1) {
return pparams->rank;
} else {
return cfs.rating;
}
}
void Thumbnail::setRank (int rank)
{
if (pparams->rank != rank) {
pparams->rank = rank;
pparamsValid = true;
}
pparamsValid = true;
}
int Thumbnail::getColorLabel () const