[niepce] library: minor cleanup of thumbnailcache



commit 17588f547c29ea2cf4cec92fdf109486fd8f71e4
Author: Hubert Figuière <hub figuiere net>
Date:   Wed May 31 22:53:46 2017 -0400

    library: minor cleanup of thumbnailcache

 src/engine/library/thumbnailcache.cpp |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)
---
diff --git a/src/engine/library/thumbnailcache.cpp b/src/engine/library/thumbnailcache.cpp
index 9b1c04b..af7f37f 100644
--- a/src/engine/library/thumbnailcache.cpp
+++ b/src/engine/library/thumbnailcache.cpp
@@ -92,20 +92,17 @@ void ThumbnailCache::execute(const ptr_t & task)
     DBG_OUT("cached thumbnail %s", dest.c_str());
 
     fwk::Thumbnail pix = getThumbnail(task->file(), w, h, dest);
-    if(pix.ok()) {
-        fwk::NotificationCenter::Ptr nc(m_notif_center);
-        if(nc) {
-            // pass the notification
-            fwk::Notification::Ptr n(new fwk::Notification(niepce::NOTIFICATION_THUMBNAIL));
-            ThumbnailNotification tn;
-            tn.id = task->file()->id();
-            tn.width = pix.get_width();
-            tn.height = pix.get_height();
-            tn.pixmap = pix;
-            n->setData(boost::any(tn));
-            DBG_OUT("notify thumbnail for id=%Ld", (long long)tn.id);
-            nc->post(std::move(n));
-        }
+    if(!pix.ok()) {
+        return;
+    }
+    fwk::NotificationCenter::Ptr nc(m_notif_center);
+    if(nc) {
+        // pass the notification
+        fwk::Notification::Ptr n(new fwk::Notification(niepce::NOTIFICATION_THUMBNAIL));
+        ThumbnailNotification tn{task->file()->id(), pix.get_width(), get_height(), pix};
+        n->setData(boost::any(tn));
+        DBG_OUT("notify thumbnail for id=%Ld", (long long)tn.id);
+        nc->post(std::move(n));
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]