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

List:       kde-commits
Subject:    [digikam] libs: The final fixes to make thumbnails for offline collections work
From:       Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date:       2014-11-16 18:04:50
Message-ID: E1Xq4Bu-0007Vt-Kn () scm ! kde ! org
[Download RAW message or body]

Git commit 0e9549a3822ef30809dc8a7e91393765f51d3ba7 by Marcel Wiesweg.
Committed on 16/11/2014 at 16:18.
Pushed by mwiesweg into branch 'master'.

The final fixes to make thumbnails for offline collections work

M  +12   -2    libs/models/imagethumbnailmodel.cpp
M  +6    -1    libs/threadimageio/thumbnailcreator.cpp

http://commits.kde.org/digikam/0e9549a3822ef30809dc8a7e91393765f51d3ba7

diff --git a/libs/models/imagethumbnailmodel.cpp \
b/libs/models/imagethumbnailmodel.cpp index 660aadc..d1d396a 100644
--- a/libs/models/imagethumbnailmodel.cpp
+++ b/libs/models/imagethumbnailmodel.cpp
@@ -216,7 +216,7 @@ QVariant ImageThumbnailModel::data(const QModelIndex& index, int \
role) const  ImageInfo info = imageInfo(index);
         QString   path = info.filePath();
 
-        if (info.isNull() || path.isEmpty())
+        if (info.isNull())
         {
             return QVariant(QVariant::Pixmap);
         }
@@ -293,7 +293,17 @@ void ImageThumbnailModel::slotThumbnailLoaded(const \
LoadingDescription& loadingD  }
 
     // In case of multiple occurrence, we currently do not know which thumbnail is \
                this. Signal change on all.
-    foreach(const QModelIndex& index, indexesForPath(loadingDescription.filePath))
+    QModelIndexList indexes;
+    ThumbnailIdentifier thumbId = loadingDescription.thumbnailIdentifier();
+    if (thumbId.filePath.isEmpty())
+    {
+        indexes = indexesForImageId(thumbId.id);
+    }
+    else
+    {
+        indexes = indexesForPath(thumbId.filePath);
+    }
+    foreach(const QModelIndex& index, indexes)
     {
         if (thumb.isNull())
         {
diff --git a/libs/threadimageio/thumbnailcreator.cpp \
b/libs/threadimageio/thumbnailcreator.cpp index 2fdb156..29c704c 100644
--- a/libs/threadimageio/thumbnailcreator.cpp
+++ b/libs/threadimageio/thumbnailcreator.cpp
@@ -236,7 +236,6 @@ QImage ThumbnailCreator::load(const ThumbnailIdentifier& \
identifier, const QRect  {
         d->dbIdForReplacement = -1;    // just to prevent bugs
     }
-
     // get info about path
     ThumbnailInfo info = makeThumbnailInfo(identifier, rect);
 
@@ -267,6 +266,12 @@ QImage ThumbnailCreator::load(const ThumbnailIdentifier& \
identifier, const QRect  break;
     }
 
+    // For images in offline collections we can stop here, they are not available on \
disk +    if (image.isNull() && info.filePath.isEmpty())
+    {
+        return QImage();
+    }
+
     // if pregenerated thumbnail is not available, generate
     if (image.isNull())
     {


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

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