[Digikam-devel] [Bug 140131] No zoom in image preview

Gilles Caulier caulier.gilles at gmail.com
Sun Apr 8 15:17:29 BST 2007


------- 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=140131         




------- Additional Comments From caulier.gilles gmail com  2007-04-08 16:17 -------
SVN commit 651581 by cgilles:

digiKam from trunk : Image preview mode is abble to use CTRL+ and CTRL- to zoom in/out into image.

Increase/Decrease Thumbs Size actions from View menu of Album GUI are now renamed Zoom In/Out

Code simplification and factorized between albumwidgetstack/imagepreviewview.

CCBUGS: 140131

 M  +25 -3     albumwidgetstack.cpp  
 M  +5 -0      albumwidgetstack.h  
 M  +26 -40    digikamapp.cpp  
 M  +0 -1      digikamapp.h  
 M  +5 -5      digikamui.rc  
 M  +60 -21    digikamview.cpp  
 M  +5 -4      digikamview.h  
 M  +2 -8      imagepreviewview.cpp  
 M  +1 -0      imagepreviewview.h  
 M  +2 -1      imagepreviewwidget.cpp  
 M  +0 -3      imagepreviewwidget.h  


--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #651580:651581
 @ -179,12 +179,14  @
     {
         d->albumIconView->setFocus();   
         setPreviewItem();
+        raiseWidget(mode);
         emit signalToggledToPreviewMode(false);
     }
-    else 
+    else
+    { 
+        raiseWidget(mode);
         emit signalToggledToPreviewMode(true);
-
-    raiseWidget(mode);
+    }
 }
 
 void AlbumWidgetStack::slotPreviewLoaded()
 @ -206,4 +208,24  @
         d->imagePreviewView->reload();
 }
 
+void AlbumWidgetStack::increaseZoom()
+{
+    d->imagePreviewView->slotIncreaseZoom();
+}
+
+void AlbumWidgetStack::decreaseZoom()
+{
+    d->imagePreviewView->slotDecreaseZoom();
+}
+
+bool AlbumWidgetStack::maxZoom()
+{
+    return d->imagePreviewView->maxZoom();
+}
+
+bool AlbumWidgetStack::minZoom()
+{
+    return d->imagePreviewView->minZoom();
+}
+
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #651580:651581
 @ -67,6 +67,11  @
     void setPreviewItem(ImageInfo* info=0, ImageInfo *previous=0, ImageInfo *next=0);
     int  previewMode(void);
     void setPreviewMode(int mode);
+    
+    void increaseZoom();
+    void decreaseZoom();
+    bool maxZoom();
+    bool minZoom();
 
 signals:
 
--- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #651580:651581
 @ -360,7 +360,7  @
     connect(d->thumbSizeSlider, SIGNAL(valueChanged(int)),
             this, SLOT(slotThumbSizeTimer(int)));
 
-    connect(d->view, SIGNAL(signalThumbSizeChanged(int)),
+    connect(d->view, SIGNAL(signalZoomChanged(int)),
             this, SLOT(slotThumbSizeChanged(int)));
     
     connect(d->view, SIGNAL(signalTogglePreview(bool)),
 @ -757,25 +757,21  @
 
     // -----------------------------------------------------------
 
-    d->thumbSizePlusAction = new KAction(i18n("Increase Thumbnail Size"),
+    d->thumbSizePlusAction = new KAction(i18n("Zoom in"),
                                    "viewmag+",
                                    CTRL+Key_Plus,
                                    d->view,
-                                   SLOT(slotThumbSizePlus()),
+                                   SLOT(slotZoomIn()),
                                    actionCollection(),
-                                   "album_thumbSizeIncrease");
-    d->thumbSizePlusAction->setWhatsThis(i18n("This option allows you to increase "
-                                              "the Album thumbnails size."));
+                                   "album_zoomin");
 
-    d->thumbSizeMinusAction = new KAction(i18n("Decrease Thumbnail Size"),
+    d->thumbSizeMinusAction = new KAction(i18n("Zoom out"),
                                    "viewmag-",
                                    CTRL+Key_Minus,
                                    d->view,
-                                   SLOT(slotThumbSizeMinus()),
+                                   SLOT(slotZoomOut()),
                                    actionCollection(),
-                                   "album_thumbSizeDecrease");
-    d->thumbSizeMinusAction->setWhatsThis(i18n("This option allows you to decrease "
-                                               "the Album thumbnails size."));
+                                   "album_zoomout");
 
 #if KDE_IS_VERSION(3,2,0)
     d->fullScreenAction = KStdAction::fullScreen(this, SLOT(slotToggleFullScreen()),
 @ -1796,28 +1792,6  @
     KApplication::kApplication()->invokeBrowser("http://www.digikam.org/?q=donation");
 }
 
-void DigikamApp::toggledToPreviewMode(bool t)
-{
-    // NOTE: if 't' is true, we are in Preview Mode, else we are in AlbumView Mode
-
-    // This is require if ESC is pressed to go out of Preview Mode. 
-    // imagePreviewAction is handled by F3 key only. 
-    d->imagePreviewAction->setChecked(t);
-
-    // Here, we will toggle some menu actions depending of current Mode.
-    
-    // Select menu.
-    d->selectAllAction->setEnabled(!t);
-    d->selectNoneAction->setEnabled(!t);
-    d->selectInvertAction->setEnabled(!t);
-
-    // View menu     
-    d->thumbSizePlusAction->setEnabled(!t);
-    d->thumbSizeMinusAction->setEnabled(!t);
-    d->albumSortAction->setEnabled(!t);
-    d->imageSortAction->setEnabled(!t);
-}
-
 void DigikamApp::slotThumbSizeTimer(int size)
 {
     d->thumbSizeTracker->setText(i18n("Thumbnail size: %1").arg(size));
 @ -1847,14 +1821,26  @
     d->thumbSizeSlider->blockSignals(false);
 }
 
-void DigikamApp::slotTooglePreview(bool b)
+void DigikamApp::slotTooglePreview(bool t)
 {
-    d->thumbSizeSlider->setEnabled(!b);
-    // TODO : enable/disable the menu actions accordinly with the current mode. 
-    // For ex., in Image Preview mode:
-    //  - disable Thumbs size +/-
-    //  - diable thumbs selection.
-    // etc. 
+    // NOTE: if 't' is true, we are in Preview Mode, else we are in AlbumView Mode
+
+    d->thumbSizeSlider->setEnabled(!t);
+
+    // This is require if ESC is pressed to go out of Preview Mode. 
+    // imagePreviewAction is handled by F3 key only. 
+    d->imagePreviewAction->setChecked(t);
+
+    // Here, we will toggle some menu actions depending of current Mode.
+    
+    // Select menu.
+    d->selectAllAction->setEnabled(!t);
+    d->selectNoneAction->setEnabled(!t);
+    d->selectInvertAction->setEnabled(!t);
+
+    // View menu     
+    d->albumSortAction->setEnabled(!t);
+    d->imageSortAction->setEnabled(!t);
 }
 
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/digikam/digikamapp.h #651580:651581
 @ -77,7 +77,6  @
     void enableThumbSizeMinusAction(bool val);
     void enableAlbumBackwardHistory(bool enable);
     void enableAlbumForwardHistory(bool enable);
-    void toggledToPreviewMode(bool t);
     
 signals:
 
--- trunk/extragear/graphics/digikam/digikam/digikamui.rc #651580:651581
 @ -1,5 +1,5  @
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui version="21" name="digikam" >
+<kpartgui version="22" name="digikam" >
 
  <MenuBar>
 
 @ -62,8 +62,8  @
      <Action name="full_screen" />
      <Action name="slideshow" />
      <Separator/>
-     <Action name="album_thumbSizeIncrease" />
-     <Action name="album_thumbSizeDecrease" />
+     <Action name="album_zoomin" />
+     <Action name="album_zoomout" />
      <Separator />
      <Action name="album_sort" />
      <Action name="image_sort" />
 @ -123,8 +123,8  @
   <Action name="image_edit" />
   <Action name="image_rename" />
   <Separator/>
-  <Action name="album_thumbSizeIncrease" />
-  <Action name="album_thumbSizeDecrease" />
+  <Action name="album_zoomin" />
+  <Action name="album_zoomout" />
   <Separator/>
   <Action name="full_screen" />
   <Action name="slideshow" />
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #651580:651581
 @ -711,37 +711,74  @
 
     emit signalNoCurrentItem();
 
-    d->parent->enableThumbSizeMinusAction(true);
-    d->parent->enableThumbSizePlusAction(true);
+    d->iconView->setThumbnailSize(size);
 
-    if (size == ThumbnailSize::Huge)
-        d->parent->enableThumbSizePlusAction(false);
+    toogleZoomActions();
 
-    if (size == ThumbnailSize::Small)
-        d->parent->enableThumbSizeMinusAction(false);
-
-    d->iconView->setThumbnailSize(size);
-
     AlbumSettings* settings = AlbumSettings::instance();
     if (!settings)
         return;
     settings->setDefaultIconSize(size);
 }
 
-void DigikamView::slotThumbSizePlus()
+void DigikamView::toogleZoomActions()
 {
-    int newSize = d->iconView->thumbnailSize().size() + ThumbnailSize::Step; 
-    setThumbSize(newSize);
-    emit signalThumbSizeChanged(newSize);  
+    if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode)
+    {
+        d->parent->enableThumbSizeMinusAction(true);
+        d->parent->enableThumbSizePlusAction(true);
+    
+        if (d->albumWidgetStack->maxZoom())
+            d->parent->enableThumbSizePlusAction(false);
+    
+        if (d->albumWidgetStack->minZoom())
+            d->parent->enableThumbSizeMinusAction(false);
+    }  
+    else if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
+    {
+        int size = d->iconView->thumbnailSize().size();
+    
+        d->parent->enableThumbSizeMinusAction(true);
+        d->parent->enableThumbSizePlusAction(true);
+    
+        if (size == ThumbnailSize::Huge)
+            d->parent->enableThumbSizePlusAction(false);
+    
+        if (size == ThumbnailSize::Small)
+            d->parent->enableThumbSizeMinusAction(false);
+    }
 }
 
-void DigikamView::slotThumbSizeMinus()
+void DigikamView::slotZoomIn()
 {
-    int newSize = d->iconView->thumbnailSize().size() - ThumbnailSize::Step; 
-    setThumbSize(newSize);
-    emit signalThumbSizeChanged(newSize);  
+    if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
+    {
+        int newSize = d->iconView->thumbnailSize().size() + ThumbnailSize::Step; 
+        setThumbSize(newSize);
+        emit signalZoomChanged(newSize);
+    }
+    else if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode)
+    {
+        d->albumWidgetStack->increaseZoom();
+        toogleZoomActions();
+    }
 }
 
+void DigikamView::slotZoomOut()
+{
+    if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
+    {
+        int newSize = d->iconView->thumbnailSize().size() - ThumbnailSize::Step; 
+        setThumbSize(newSize);
+        emit signalZoomChanged(newSize);
+    }  
+    else if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode)
+    {
+        d->albumWidgetStack->decreaseZoom();
+        toogleZoomActions();
+    }
+}
+
 void DigikamView::slotAlbumPropsEdit()
 {
     d->folderView->albumEdit();
 @ -867,24 +904,26  @
     {
         // We will go to ImagePreview Mode.
         ImageInfo *previousInfo=0, *nextInfo=0;
+
         if (iconItem->prevItem())
             previousInfo = static_cast<AlbumIconItem*>(iconItem->prevItem())->imageInfo();
+
         if (iconItem->nextItem())
             nextInfo = static_cast<AlbumIconItem*>(iconItem->nextItem())->imageInfo();
+
         d->albumWidgetStack->setPreviewItem(iconItem->imageInfo(), previousInfo, nextInfo);
-        emit signalTogglePreview(true);
     }
     else
     {
         // We go back to AlbumView Mode.
         d->albumWidgetStack->setPreviewMode( AlbumWidgetStack::PreviewAlbumMode );
-        emit signalTogglePreview(false);
     }
 }
 
-void DigikamView::slotToggledToPreviewMode(bool t)
+void DigikamView::slotToggledToPreviewMode(bool b)
 {
-    d->parent->toggledToPreviewMode(t);
+    toogleZoomActions();
+    emit signalTogglePreview(b);
 }
 
 void DigikamView::slotImageEdit()
--- trunk/extragear/graphics/digikam/digikam/digikamview.h #651580:651581
 @ -72,14 +72,14  @
     void signalNoCurrentItem();
     void signalProgressBarMode(int, const QString&);
     void signalProgressValue(int);
-    void signalThumbSizeChanged(int);
+    void signalZoomChanged(int);
     void signalTogglePreview(bool);
 
 public slots:
 
     // View Action slots
-    void slotThumbSizePlus();
-    void slotThumbSizeMinus();
+    void slotZoomIn();
+    void slotZoomOut();
     void slotSlideShowAll();
     void slotSlideShowSelection();
     void slotSlideShowRecursive();
 @ -136,6 +136,7  @
 
 private:
 
+    void toogleZoomActions();
     void setupConnections();
     void loadViewState();
     void saveViewState();
 @ -152,7 +153,6  @
 
     void slotImageSelected();
     void slotTogglePreviewMode(AlbumIconItem *iconItem=0);
-    void slotToggledToPreviewMode(bool);
     void slotDispatchImageSelected();
     void slotImageCopyResult(KIO::Job* job);
     void slotItemsInfoFromAlbums(const ImageInfoList&);
 @ -164,6 +164,7  @
     void slotNextItem(void);
     void slotLastItem(void);
 
+    void slotToggledToPreviewMode(bool);
     void slotEscapePreview();
     void slotCancelSlideShow();
 
--- trunk/extragear/graphics/digikam/digikam/imagepreviewview.cpp #651580:651581
 @ -97,12 +97,6  @
 
     // ----------------------------------------------------------------
 
-    connect(this, SIGNAL(signalPreviewComplete()),
-            this, SIGNAL(signalPreviewLoaded()));          
-    
-    connect(this, SIGNAL(signalPreviewFailed()),
-            this, SIGNAL(signalPreviewLoaded()));    
-
     connect(this, SIGNAL(signalShowNextImage()),
             this, SIGNAL(signalNextItem()));
 
 @ -179,7 +173,7  @
 
     if (preview.isNull())
     {
-        emit signalPreviewFailed();
+        emit signalPreviewLoaded();
         QPixmap pix(visibleWidth(), visibleHeight());
         pix.fill(ThemeEngine::instance()->baseColor());
         QPainter p(&pix);
 @ -194,7 +188,7  @
     }
     else
     {
-        emit signalPreviewComplete();
+        emit signalPreviewLoaded();
         setImage(preview);
     }
 
--- trunk/extragear/graphics/digikam/digikam/imagepreviewview.h #651580:651581
 @ -57,6 +57,7  @
 
 signals:
 
+    void signalPreviewStarted();
     void signalNextItem();
     void signalPrevItem();
     void signalDeleteItem();
--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #651580:651581
 @ -270,6 +270,7  @
                     sw = step;
                     sh = step;
 
+                    // Fast smooth scale method from Antonio.
                     QImage img = FastScale::fastScaleQImage(d->preview.copy(sx, sy, sw, sh),
                                                             d->tileSize, d->tileSize);
                     bitBlt(pix, 0, 0, &img, 0, 0);
 @ -381,7 +382,7  @
         return;
     }
 
-    QScrollView::contentsWheelEvent(e);
+    QScrollView::contentsWheelEvent(e);*/
 }
 
 bool ImagePreviewWidget::maxZoom()
--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.h #651580:651581
 @ -61,9 +61,6  @
     void signalLeftButtonClicked();    
     void signalShowNextImage();
     void signalShowPrevImage();
-    void signalPreviewStarted();
-    void signalPreviewComplete();
-    void signalPreviewFailed();
 
 public slots:



More information about the Digikam-devel mailing list