Fix rank, color label, and trash status reset

The rank, color label, and trash status from a previous session would
reset after editing an image or clearing the processing profile.
This commit is contained in:
Lawrence Lee 2024-10-20 15:14:50 -07:00
parent 00360a6dbb
commit b16287ff6f
No known key found for this signature in database
GPG Key ID: 048FF2B76A63895F
2 changed files with 8 additions and 8 deletions

View File

@ -485,7 +485,7 @@ void Thumbnail::clearProcParams (int whoClearedIt)
pparams->setDefaults();
// preserve rank, colorlabel and inTrash across clear
updateProcParamsProperties();
updateProcParamsProperties(true);
// params could get validated by updateProcParamsProperties
if (pparamsValid) {
@ -594,7 +594,7 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh
pparamsValid = true;
// do not update rank, colorlabel and inTrash
updateProcParamsProperties();
updateProcParamsProperties(true);
if (updateCacheNow) {
updateCache();
@ -1295,25 +1295,25 @@ void Thumbnail::loadProperties()
}
}
void Thumbnail::updateProcParamsProperties()
void Thumbnail::updateProcParamsProperties(bool forceUpdate)
{
if (!properties.edited()) {
if (!(properties.edited() || forceUpdate)) {
return;
}
if (properties.trashed.edited && properties.trashed != pparams->inTrash) {
if ((properties.trashed.edited || forceUpdate) && properties.trashed != pparams->inTrash) {
pparams->inTrash = properties.trashed;
pparamsValid = true;
}
// save procparams rank and color also when options.thumbnailRankColorMode == Options::ThumbnailPropertyMode::XMP
// so they'll be kept in sync
if (properties.rank.edited && properties.rank != pparams->rank) {
if ((properties.rank.edited || forceUpdate) && properties.rank != pparams->rank) {
pparams->rank = properties.rank;
pparamsValid = true;
}
if (properties.color.edited && properties.color != pparams->colorlabel) {
if ((properties.color.edited || forceUpdate) && properties.color != pparams->colorlabel) {
pparams->colorlabel = properties.color;
pparamsValid = true;
}

View File

@ -115,7 +115,7 @@ class Thumbnail
void saveMetadata();
void loadProperties();
void updateProcParamsProperties();
void updateProcParamsProperties(bool forceUpdate = false);
void saveXMPSidecarProperties();
public: