Commit a4eb78aa authored by Maik Qualmann's avatar Maik Qualmann

fix slowdown when updating face tags counter

BUGS: 421023
FIXED-IN: 7.0.0
parent ccb06b19
......@@ -736,4 +736,5 @@ BUGFIXES:
700 ==> 406461 - Can't update from V9 to V10.
701 ==> 421361 - Removing a keyboard shortcut crashes Digikam.
702 ==> 421387 - Camera Leica V-Lux (Typ 114) not supported.
703 ==>
703 ==> 421023 - Face tagging quirky in digiKam 7.0.0-beta3.
704 ==>
......@@ -816,7 +816,9 @@ private Q_SLOTS:
Q_SIGNALS:
void signalFaceCountsDirty(const QMap<int, int>&, const QMap<int, int>&);
void signalFaceCountsDirty(const QMap<int, int>& faceCount,
const QMap<int, int>& unconfirmedCount,
const QList<TAlbum*>& updateFaceAlbums);
//@}
......
......@@ -108,7 +108,21 @@ void AlbumManager::slotPeopleJobData(const QMap<QString, QMap<int, int> >& faces
}
}
emit signalFaceCountsDirty(d->fAlbumsCount, d->uAlbumsCount);
QList<TAlbum*> updateFaceAlbums;
foreach (int id, d->toUpdatedFaceTags)
{
TAlbum* const album = findTAlbum(id);
if (album)
{
updateFaceAlbums << album;
}
}
d->toUpdatedFaceTags.clear();
emit signalFaceCountsDirty(d->fAlbumsCount, d->uAlbumsCount, updateFaceAlbums);
}
} // namespace Digikam
......@@ -196,8 +196,9 @@ public:
QMap<int, int> tAlbumsCount;
QMap<YearMonth, int> dAlbumsCount;
QMap<int, int> fAlbumsCount;
//Unconfirmed face counts
// Unconfirmed face counts
QMap<int, int> uAlbumsCount;
QList<int> toUpdatedFaceTags;
public:
......
......@@ -951,12 +951,6 @@ void AlbumManager::slotTagChange(const TagChangeset& changeset)
break;
case TagChangeset::Updated:
// Start the timer new for fewer events
d->scanTAlbumsTimer->start();
break;
case TagChangeset::Renamed:
case TagChangeset::IconChanged:
/**
......@@ -966,7 +960,7 @@ void AlbumManager::slotTagChange(const TagChangeset& changeset)
case TagChangeset::PropertiesChanged:
{
TAlbum* tag = findTAlbum(changeset.tagId());
TAlbum* const tag = findTAlbum(changeset.tagId());
if (tag)
{
......@@ -1000,6 +994,14 @@ void AlbumManager::slotImageTagChange(const ImageTagChangeset& changeset)
// Thus, the count of entries in face tags are not
// updated. This adoption should fix the problem.
case ImageTagChangeset::PropertiesChanged:
{
foreach (int id, changeset.tags())
{
if (!d->toUpdatedFaceTags.contains(id))
{
d->toUpdatedFaceTags << id;
}
}
if (!d->tagItemCountTimer->isActive())
{
......@@ -1007,6 +1009,7 @@ void AlbumManager::slotImageTagChange(const ImageTagChangeset& changeset)
}
break;
}
default:
break;
......
......@@ -1279,7 +1279,6 @@ void CoreDB::addImageTagProperty(qlonglong imageId, int tagId, const QString& pr
imageId, tagId, property, value);
d->db->recordChangeset(ImageTagChangeset(imageId, tagId, ImageTagChangeset::PropertiesChanged));
//d->db->recordChangeset(TagChangeset(tagId, TagChangeset::Updated));
}
void CoreDB::addImageTagProperty(const ImageTagProperty& property)
......@@ -1315,7 +1314,6 @@ void CoreDB::removeImageTagProperties(qlonglong imageId, int tagId, const QStrin
}
d->db->recordChangeset(ImageTagChangeset(imageId, tagId, ImageTagChangeset::PropertiesChanged));
//d->db->recordChangeset(TagChangeset(tagId, TagChangeset::Updated));
}
ItemShortInfo CoreDB::getItemShortInfo(qlonglong imageID) const
......
......@@ -287,7 +287,6 @@ public:
Moved,
Deleted,
Renamed,
Updated,
Reparented,
IconChanged,
PropertiesChanged /// ImageTagProperties Table
......
......@@ -170,10 +170,18 @@ void TagModel::setTagCount(TagCountMode mode)
else
{
connect(AlbumManager::instance(), &AlbumManager::signalFaceCountsDirty,
[=](const QMap<int, int> &faceCount, const QMap<int, int>& unconfirmedFaceCount)
[=](const QMap<int, int>& faceCount,
const QMap<int, int>& unconfirmedCount,
const QList<TAlbum*>& updateFaceAlbums)
{
setCountMap(faceCount);
m_unconfirmedFaceCount = unconfirmedFaceCount;
m_unconfirmedFaceCount = unconfirmedCount;
foreach (TAlbum* const album, updateFaceAlbums)
{
QModelIndex index = indexForAlbum(album);
emit dataChanged(index, index);
}
});
setCountMap(AlbumManager::instance()->getFaceCount());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment