[Digikam-devel] [Bug 133590] Usability: Walking through photos using image View (F3)

Gilles Caulier caulier.gilles at free.fr
Fri Sep 8 15:49:18 BST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=133590         




------- Additional Comments From caulier.gilles free fr  2006-09-08 16:49 -------
SVN commit 582194 by cgilles:

digiKam from trunk : image preview widget : do not run a blinking text during image loading. Toggle mouse cursor to busy instead.
CCBUGS: 133590

 M  +21 -56    imagepreviewwidget.cpp  
 M  +0 -1      imagepreviewwidget.h  


--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #582193:582194
 @ -40,6 +40,7  @
 #include "albumsettings.h"
 #include "imagepreviewjob.h"
 #include "imagepreviewwidget.h"
+#include "imagepreviewwidget.moc"
 
 namespace Digikam
 {
 @ -50,13 +51,9  @
 
     ImagePreviewWidgetPriv()
     {
-        previewBlink      = false;
-        blinkPreviewTimer = 0;
         previewJob        = 0;
     }
 
-    bool                          previewBlink;
-    
     QString                       path;
 
     QPixmap                       pixmap;
 @ -64,15 +61,12  @
     QImage                        preview;
     
     QGuardedPtr<ImagePreviewJob>  previewJob;
-    
-    QTimer                       *blinkPreviewTimer;
 };
 
 ImagePreviewWidget::ImagePreviewWidget(QWidget *parent)
                   : QFrame(parent, 0, Qt::WDestructiveClose)
 {
     d = new ImagePreviewWidgetPriv;
-    d->blinkPreviewTimer = new QTimer(this);
     setBackgroundMode(Qt::NoBackground);
     setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
     setFocusPolicy(QWidget::StrongFocus);
 @ -81,9 +75,6  @
     setLineWidth(0);
     
     // ---------------------------------------------------------------
-    
-    connect(d->blinkPreviewTimer, SIGNAL(timeout()),
-            this, SLOT(slotPreviewBlinkTimerDone()));
             
     connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
             this, SLOT(slotThemeChanged()));
 @ -97,8 +88,6  @
         d->previewJob = 0;
     }
 
-    d->blinkPreviewTimer->stop();
-
     delete d;
 }
 
 @ -106,9 +95,8  @
 {
     if (path == d->path) return;
 
-    d->path              = path;
-    d->previewBlink      = false;
-    d->blinkPreviewTimer->start(200);
+    setCursor( KCursor::waitCursor() );
+    d->path = path;
 
     if (!d->previewJob.isNull())
     {
 @ -127,19 +115,10  @
     emit previewStarted();
 }
 
-void ImagePreviewWidget::slotPreviewBlinkTimerDone()
-{
-    d->previewBlink = !d->previewBlink;
-    updatePixmap();
-    repaint(false);
-    d->blinkPreviewTimer->start(200);
-}
-                
 void ImagePreviewWidget::slotGotImagePreview(const KURL&, const QImage& preview)
 {
-    d->blinkPreviewTimer->stop();
-    d->preview    = preview;
-    d->pixmap     = QPixmap(contentsRect().size());
+    d->preview = preview;
+    d->pixmap  = QPixmap(contentsRect().size());
 
     // It is very important to kill the thumbnail job properly
     // so that is frees its shared memory. Otherwise the memory
 @ -152,23 +131,23  @
 
     updatePixmap();
     repaint(false);
+    unsetCursor();
     emit previewComplete();
 }
 
 void ImagePreviewWidget::slotFailedImagePreview(const KURL&)
 {
-    d->blinkPreviewTimer->stop();
-
     if (!d->previewJob.isNull())
     {
         d->previewJob->kill();
         d->previewJob = 0;
     }
 
-    d->preview    = QImage();
-    d->pixmap     = QPixmap(contentsRect().size());
+    d->preview = QImage();
+    d->pixmap  = QPixmap(contentsRect().size());
     updatePixmap();
     repaint(false);
+    unsetCursor();
     emit previewFailed();
 }
 
 @ -179,35 +158,23  @
 
     if (!d->path.isEmpty())
     {
-        if (!d->previewJob)
+        // Preview extraction is complete...
+        
+        if (!d->preview.isNull())
         {
-            // Preview extraction is complete...
-            
-            if (!d->preview.isNull())
-            {
-                QPixmap pix(d->preview.smoothScale(contentsRect().size(), QImage::ScaleMin));
-                p.drawPixmap((contentsRect().width()-pix.width())/2,
-                             (contentsRect().height()-pix.height())/2, pix,
-                             0, 0, pix.width(), pix.height());
-            }
-            else
-            {
-                // ...or failed...
-
-                p.setPen(QPen(Qt::red));
-                p.drawText(0, 0, d->pixmap.width(), d->pixmap.height(),
-                           Qt::AlignCenter|Qt::WordBreak, 
-                           i18n("Cannot display image preview!"));
-            }
+            QPixmap pix(d->preview.smoothScale(contentsRect().size(), QImage::ScaleMin));
+            p.drawPixmap((contentsRect().width()-pix.width())/2,
+                            (contentsRect().height()-pix.height())/2, pix,
+                            0, 0, pix.width(), pix.height());
         }
         else
         {
-            // Preview extraction under progress
-            
-            p.setPen(QPen(d->previewBlink ? Qt::green : Qt::darkGreen));
+            // ...or failed...
+
+            p.setPen(QPen(Qt::red));
             p.drawText(0, 0, d->pixmap.width(), d->pixmap.height(),
-                       Qt::AlignCenter|Qt::WordBreak, 
-                       i18n("Preview extraction in progress..."));
+                        Qt::AlignCenter|Qt::WordBreak, 
+                        i18n("Cannot display image preview!"));
         }
     }
     else
 @ -253,5 +220,3  @
 }
 
 }  // NameSpace Digikam
-
-#include "imagepreviewwidget.moc"
--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.h #582193:582194
 @ -73,7 +73,6  @
     
     void slotGotImagePreview(const KURL&, const QImage& preview);
     void slotFailedImagePreview(const KURL&);
-    void slotPreviewBlinkTimerDone();    
     
 private:



More information about the Digikam-devel mailing list