[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [digikam/frameworks] libs/imageproperties: Optimize tag loading
From:       Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date:       2015-09-11 16:48:54
Message-ID: E1ZaRVO-0003pi-D3 () scm ! kde ! org
[Download RAW message or body]

Git commit a2f2c046f38623a6247ebb9f4760bb96c66062ac by Marcel Wiesweg.
Committed on 11/09/2015 at 16:45.
Pushed by mwiesweg into branch 'frameworks'.

Optimize tag loading

No need to traverse all tags, only affected tags must be set

M  +4    -21   libs/imageproperties/imagedescedittab.cpp
M  +0    -1    libs/imageproperties/imagedescedittab.h

http://commits.kde.org/digikam/a2f2c046f38623a6247ebb9f4760bb96c66062ac

diff --git a/libs/imageproperties/imagedescedittab.cpp \
b/libs/imageproperties/imagedescedittab.cpp index a270620..03a8c34 100644
--- a/libs/imageproperties/imagedescedittab.cpp
+++ b/libs/imageproperties/imagedescedittab.cpp
@@ -1080,24 +1080,6 @@ void ImageDescEditTab::setTagState(TAlbum* const tag, \
DisjointMetadata::Status s  }
 }
 
-void ImageDescEditTab::initializeTags(QModelIndex& parent)
-{
-    TAlbum* const tag = d->tagModel->albumForIndex(parent);
-
-    if (!tag)
-    {
-        return;
-    }
-
-    setTagState(tag, d->hub.tagStatus(tag->id()));
-
-    for (int row = 0; row < d->tagModel->rowCount(parent); ++row)
-    {
-        QModelIndex index = d->tagModel->index(row, 0, parent);
-        initializeTags(index);
-    }
-}
-
 void ImageDescEditTab::updateTagsView()
 {
     // avoid that the automatic tag toggling handles these calls and
@@ -1110,10 +1092,11 @@ void ImageDescEditTab::updateTagsView()
     d->tagModel->resetAllCheckedAlbums();
 
     // then update checked state for all tags of the currently selected images
-    for (int row = 0; row < d->tagModel->rowCount(); ++row)
+    const QMap<int, DisjointMetadata::Status> hubMap = d->hub.tags();
+    for (QMap<int, DisjointMetadata::Status>::const_iterator it = hubMap.begin(); it \
!= hubMap.end(); ++it)  {
-        QModelIndex index = d->tagModel->index(row, 0);
-        initializeTags(index);
+        TAlbum* tag = AlbumManager::instance()->findTAlbum(it.key());
+        setTagState(tag, it.value());
     }
 
     d->ignoreTagChanges = false;
diff --git a/libs/imageproperties/imagedescedittab.h \
b/libs/imageproperties/imagedescedittab.h index 44582da..fee0cac 100644
--- a/libs/imageproperties/imagedescedittab.h
+++ b/libs/imageproperties/imagedescedittab.h
@@ -97,7 +97,6 @@ protected:
 private:
 
     void reset();
-    void initializeTags(QModelIndex& parent);
     void setTagState(TAlbum* const tag, DisjointMetadata::Status status);
 
     void setInfos(const ImageInfoList& infos);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic