Summary: | No zoom in image preview | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | alan |
Component: | Preview-Image | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | lure |
Priority: | NOR | ||
Version: | 0.9.0 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.2 | |
Sentry Crash Report: |
Description
alan
2007-01-15 23:58:35 UTC
Yes, current view mode is very limited. Since this is now default action for single click on image, it will have to be improved, otherwise it will leave bad impression to the user. Related bug 135655 is regarding full screen mode in View mode. Preview mode now disables Zoom icons, as they have no effect on image (only in thumbnail view). Zoom in preview is a wish list to be added in future. I concur. I use the preview mode to quickly sort through a bunch of images, deciding which ones I want to keep. It's often hard to make this decision without zooming into the image, for instance to check if it isn't slightly blurry, or other details which you won't see if the image is reduced to fit the window (noise level is another example). I will certainly implement it in a near future. Somebody have sent to me a very fast algorithm to scale a QImage (20x faster than QImage::smothscale() method) Gilles > have sent to me a very fast algorithm to scale a QImage (20x faster than
> QImage::smothscale() method)
So maybe it would be possible to have thumbnails in Album view bigger
than 256 pixels :)
SVN commit 651326 by cgilles: digikam from trunk : added scrooling function in Preview Mode. Just use CTRL + Mouse wheel to change zoom factor. SHIFT + Mouse wheel change the current image to preview in current album. BUG: 140131 M +1 -0 Makefile.am AM fastscale.cpp [License: GPL] AM fastscale.h [License: GPL] M +145 -156 imagepreviewview.cpp M +2 -6 imagepreviewview.h M +384 -72 imagepreviewwidget.cpp M +31 -14 imagepreviewwidget.h 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: > digiKam from trunk : Image preview mode is abble to use CTRL+ and CTRL-
> to zoom in/out into image.
I see some changes from patch: no pan tool, no zoom icons in toolbar.
Also noticed some strange tiling previously posted by someone.
Note: you can also zoom by pressing CTRL and using mouse wheel at the
same time.
SVN commit 651639 by cgilles: digiKam from trunk : Image preview mode is abble to use the slider on status bar to zoom in/out into image. Zoom factor is given as feedback on slider tool tip. CCBUGS: 140131 M +10 -0 albumwidgetstack.cpp M +2 -0 albumwidgetstack.h M +22 -23 digikamapp.cpp M +1 -1 digikamapp.h M +0 -3 digikamappprivate.h M +48 -7 digikamview.cpp M +4 -1 digikamview.h M +5 -0 imagepreviewwidget.cpp M +1 -0 imagepreviewwidget.h --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #651638:651639 @@ -228,4 +228,14 @@ return d->imagePreviewView->minZoom(); } +void AlbumWidgetStack::setZoomFactor(double z) +{ + d->imagePreviewView->setZoomFactor(z); +} + +double AlbumWidgetStack::zoomFactor() +{ + return d->imagePreviewView->zoomFactor(); +} + } // namespace Digikam --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #651638:651639 @@ -72,6 +72,8 @@ void decreaseZoom(); bool maxZoom(); bool minZoom(); + void setZoomFactor(double z); + double zoomFactor(); signals: --- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #651638:651639 @@ -174,9 +174,6 @@ DigikamApp::~DigikamApp() { - if (d->thumbSizeTimer) - delete d->thumbSizeTimer; - ImageAttributesWatch::shutDown(); if (ImageWindow::imagewindowCreated()) @@ -360,8 +357,11 @@ connect(d->thumbSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotThumbSizeTimer(int))); - connect(d->view, SIGNAL(signalZoomChanged(int)), + connect(d->view, SIGNAL(signalThumbSizeChanged(int)), this, SLOT(slotThumbSizeChanged(int))); + + connect(d->view, SIGNAL(signalZoomChanged(double)), + this, SLOT(slotZoomChanged(double))); connect(d->view, SIGNAL(signalTogglePreview(bool)), this, SLOT(slotTooglePreview(bool))); @@ -918,7 +918,7 @@ d->imageSortAction->setCurrentItem((int)d->albumSettings->getImageSortOrder()); d->thumbSizeSlider->setValue(d->albumSettings->getDefaultIconSize()); - slotThumbSizeEffect(); + slotThumbSizeChanged(d->thumbSizeSlider->value()); } void DigikamApp::enableThumbSizePlusAction(bool val) @@ -1794,30 +1794,31 @@ void DigikamApp::slotThumbSizeTimer(int size) { - d->thumbSizeTracker->setText(i18n("Thumbnail size: %1").arg(size)); - - if (d->thumbSizeTimer) - { - d->thumbSizeTimer->stop(); - delete d->thumbSizeTimer; - } - - d->thumbSizeTimer = new QTimer( this ); - connect(d->thumbSizeTimer, SIGNAL(timeout()), - this, SLOT(slotThumbSizeEffect()) ); - d->thumbSizeTimer->start(300, true); + d->view->setThumbSize(size); } -void DigikamApp::slotThumbSizeEffect() +void DigikamApp::slotThumbSizeChanged(int size) { - d->view->setThumbSize(d->thumbSizeSlider->value()); + d->thumbSizeSlider->blockSignals(true); + d->thumbSizeSlider->setValue(size); + d->thumbSizeTracker->setText(i18n("Thumbnail size: %1").arg(size)); + d->thumbSizeSlider->blockSignals(false); } -void DigikamApp::slotThumbSizeChanged(int size) +void DigikamApp::slotZoomChanged(double zoom) { d->thumbSizeSlider->blockSignals(true); + + double h = (double)ThumbnailSize::Huge; + double s = (double)ThumbnailSize::Small; + double zmin = 0.1; + double zmax = 10.0; + double b = (zmin-(zmax*s/h))/(1-s/h); + double a = (zmax-b)/h; + int size = (int)((zoom - b) /a); + d->thumbSizeSlider->setValue(size); - d->thumbSizeTracker->setText(i18n("Thumbnail size: %1").arg(size)); + d->thumbSizeTracker->setText(i18n("zoom: %1%").arg((int)(zoom*100.0))); d->thumbSizeSlider->blockSignals(false); } @@ -1825,8 +1826,6 @@ { // 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); --- trunk/extragear/graphics/digikam/digikam/digikamapp.h #651638:651639 @@ -154,8 +154,8 @@ void slotProgressValue(int); void slotThumbSizeTimer(int); - void slotThumbSizeEffect(); void slotThumbSizeChanged(int); + void slotZoomChanged(double); void slotTooglePreview(bool); private: --- trunk/extragear/graphics/digikam/digikam/digikamappprivate.h #651638:651639 @@ -130,7 +130,6 @@ view = 0; splashScreen = 0; thumbSizeSlider = 0; - thumbSizeTimer = 0; thumbSizeTracker = 0; } @@ -145,8 +144,6 @@ QPtrList<KAction> kipiBatchActions; QPtrList<KAction> kipiAlbumActions; - QTimer *thumbSizeTimer; - QSlider *thumbSizeSlider; QMap<int, QString> mediaItems; --- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #651638:651639 @@ -101,6 +101,7 @@ tagFilterView = 0; albumWidgetStack = 0; selectionTimer = 0; + thumbSizeTimer = 0; needDispatchSelection = false; cancelSlideShow = false; } @@ -109,10 +110,12 @@ bool cancelSlideShow; int initialAlbumID; + int thumbSize; QSplitter *splitter; QTimer *selectionTimer; + QTimer *thumbSizeTimer; DigikamApp *parent; @@ -178,6 +181,9 @@ DigikamView::~DigikamView() { + if (d->thumbSizeTimer) + delete d->thumbSizeTimer; + saveViewState(); delete d->albumHistory; @@ -706,19 +712,50 @@ void DigikamView::setThumbSize(int size) { - if (size > ThumbnailSize::Huge || size < ThumbnailSize::Small) - return; + if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode) + { + double h = (double)ThumbnailSize::Huge; + double s = (double)ThumbnailSize::Small; + double zmin = 0.1; + double zmax = 10.0; + double b = (zmin-(zmax*s/h))/(1-s/h); + double a = (zmax-b)/h; + double z = a*size+b; + d->albumWidgetStack->setZoomFactor(z); + emit signalZoomChanged(d->albumWidgetStack->zoomFactor()); + } + else if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewAlbumMode) + { + if (size > ThumbnailSize::Huge || size < ThumbnailSize::Small) + return; + emit signalThumbSizeChanged(size); + d->thumbSize = size; + + if (d->thumbSizeTimer) + { + d->thumbSizeTimer->stop(); + delete d->thumbSizeTimer; + } + + d->thumbSizeTimer = new QTimer( this ); + connect(d->thumbSizeTimer, SIGNAL(timeout()), + this, SLOT(slotThumbSizeEffect()) ); + d->thumbSizeTimer->start(300, true); + } +} + +void DigikamView::slotThumbSizeEffect() +{ emit signalNoCurrentItem(); - d->iconView->setThumbnailSize(size); - + d->iconView->setThumbnailSize(d->thumbSize); toogleZoomActions(); AlbumSettings* settings = AlbumSettings::instance(); if (!settings) return; - settings->setDefaultIconSize(size); + settings->setDefaultIconSize(d->thumbSize); } void DigikamView::toogleZoomActions() @@ -755,12 +792,13 @@ { int newSize = d->iconView->thumbnailSize().size() + ThumbnailSize::Step; setThumbSize(newSize); - emit signalZoomChanged(newSize); + emit signalThumbSizeChanged(newSize); } else if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode) { d->albumWidgetStack->increaseZoom(); toogleZoomActions(); + emit signalZoomChanged(d->albumWidgetStack->zoomFactor()); } } @@ -770,12 +808,13 @@ { int newSize = d->iconView->thumbnailSize().size() - ThumbnailSize::Step; setThumbSize(newSize); - emit signalZoomChanged(newSize); + emit signalThumbSizeChanged(newSize); } else if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode) { d->albumWidgetStack->decreaseZoom(); toogleZoomActions(); + emit signalZoomChanged(d->albumWidgetStack->zoomFactor()); } } @@ -912,11 +951,13 @@ nextInfo = static_cast<AlbumIconItem*>(iconItem->nextItem())->imageInfo(); d->albumWidgetStack->setPreviewItem(iconItem->imageInfo(), previousInfo, nextInfo); + emit signalZoomChanged(d->albumWidgetStack->zoomFactor()); } else { // We go back to AlbumView Mode. d->albumWidgetStack->setPreviewMode( AlbumWidgetStack::PreviewAlbumMode ); + emit signalThumbSizeChanged(d->iconView->thumbnailSize().size()); } } --- trunk/extragear/graphics/digikam/digikam/digikamview.h #651638:651639 @@ -72,7 +72,8 @@ void signalNoCurrentItem(); void signalProgressBarMode(int, const QString&); void signalProgressValue(int); - void signalZoomChanged(int); + void signalThumbSizeChanged(int); + void signalZoomChanged(double); void signalTogglePreview(bool); public slots: @@ -168,6 +169,8 @@ void slotEscapePreview(); void slotCancelSlideShow(); + void slotThumbSizeEffect(); + private: DigikamViewPriv* d; --- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #651638:651639 @@ -437,6 +437,11 @@ viewport()->update(); } +double ImagePreviewWidget::zoomFactor() +{ + return d->zoom; +} + bool ImagePreviewWidget::fitToWindow() { return d->autoZoom; --- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.h #651638:651639 @@ -50,6 +50,7 @@ void setImage(const QImage& image); void setZoomFactor(double z); + double zoomFactor(); bool fitToWindow(); void toggleFitToWindow(); bool maxZoom(); > Zoom factor is given as feedback on slider tool tip.
Few bugs:
Tooltip of slider is below-right of mouse pointer. When Digikam is
maximized (for me it is always) I cannot see tooltip and zoom factor.
Nav buttons are working properly (with Digikam window smaller than
fullscreen tooltips are below-right of mouse pointer; with maximized
window tooltips are up-left of button).
When using CTRL-MouseWheel slider position isn't updated.
Still problems with tiling at some zoom-factor values. Couldn't track
any rule to this.
Slider position isn't updated when switching between contexts for proper
zoom-factor.
Wish/suggestion:
At the moment you have two centers for size manipulation: buttons in
toolbar and slider. IMO this is not right. Everything should be in one
place. So please - move buttons to status bar or slider to toolbar.
Personally prefer first solution - it will give more room in already
crowded toolbar, especially with coming KDE4 guidelines (icon+text as
default).
Wow - that zooming looks absolutely great!!!! Some observations and comments: - I also observe artefacts at different zoom-levels (eg. at 92 % and at 397%, but these values differ from image to image; also this only seems to happen when using CTRL+ and CTRL-, but not the slider?) - pressing F4 to open the image editor: the zoom in the album view is undone (however, moving the slider afterwards shows, that it is still zoomed in) - maybe related: somehow the previous zoom-level is memorized: F3 for an image and zoom in (e.g. 1000%) ESC to leave F3 again: the image is displayed to fit the available space, but the slider is still on 1000%. - the zoom percentages do not seem to match with the values in the image editor (but maybe I am wrong): I.e., shouldn't 100% mean that one image pixel corresponds one display pixel? - Maybe just a personal problem: I always find my to press CTRL-Q to leave the large view (obviously because of the large display some corner of my brain thinks that this must be the image editor), but this does leave digikam (which does indeed leave the large view, but not in the way I wanted ...) - And another one: I happen to press the left-mouse (having panning in mind) quite frequently, which brings me back to the thumbnail view (which I did not want;-) - not sure if this is optimal from the useability point of view (I know that the "return-on-left-click" was a wish brought up a while ago...;-) Some wishes: - When zoomed in: a pan-window widget in the lower-right corner where the scroll-bars meet (as in the image editor) would be nice - it would be nice if the position of the mouse would be the center around which the zoom is done (I also mentioned this as a wish for the image editor zoom, but did not yet manage to look into the logic there, should be fairly easy to implement...) There is maybe one very important point: the zoom as it is presently done, uses a reduced-size version of the underlying image, right? So while it is nice to be able to zoom in, it does not allow for a judgement of the image quality (in contrast to the image editor). Do you think that there is a way to use the actual image (maybe from a certain zoom-level on?) But that would (quite certainly?) slow things down... In particular for the upcoming light-table I think it is important to compare the real images, not just up-scaled ones Uups: I just realized that for zooming in, the image editor also some interpolation is done, so that that one does not see the single pixels, but some nicely interpolated version? OK, that's all for the moment... Best, Arnd To Mik on #10: >Few bugs: >Tooltip of slider is below-right of mouse pointer. When Digikam is >maximized (for me it is always) I cannot see tooltip and zoom factor. >Nav buttons are working properly (with Digikam window smaller than >fullscreen tooltips are below-right of mouse pointer; with maximized >window tooltips are up-left of button). yes, i have seen this problem. I will fix it. >When using CTRL-MouseWheel slider position isn't updated. idem. >Still problems with tiling at some zoom-factor values. Couldn't track >any rule to this. Antonio Larossa (witch have written the fast scale algorithm) have found the problem. It a division precision problem. He will patch svn today... >Slider position isn't updated when switching between contexts for proper >zoom-factor. Strange, here it work. I will take a look. >Wish/suggestion: >At the moment you have two centers for size manipulation: buttons in >toolbar and slider. IMO this is not right. Everything should be in one >place. So please - move buttons to status bar or slider to toolbar. >Personally prefer first solution - it will give more room in already >crowded toolbar, especially with coming KDE4 guidelines (icon+text as >default). agree. I have thinking to do it too, but i have been lost to improve canvas implementation previous week (:=))) Gilles Dnia poniedzia IMHO using Shift+MouseWheel to switch between pictures is not very intuitive, I would prefer to be able to use just the MouseWheel. I understand that if the picture is displayed larger than the view then the MouseWheel is used to pan. Maybe a solution would be that the picture can be paned by draging the mouse pointer... but then it is not possible to use a single click to go out from preview mode maybe double click could be used. Just my opinion. It's technically not a problem to pan when dragging the mouse and exit on single click. The question is if this confuses users, or if it comes natural to expect. (Apart from the question of mouse dragging, personally I am very much in favor of the exit-on-click functionality. It is very convenient when browsing and quickly viewing some pictures. No need to move the mouse back to a tiny button somewhere. The whole picture is the largest possible mouse target.) I just noticed, that I only sent my comment to the mailing list, and since that topic is discussed in this thread, I am sending a copy here now: Arnd Baecker wrote: > - And another one: I happen to press the left-mouse > (having panning in mind) quite frequently, which brings > me back to the thumbnail view (which I did not want;-) - not sure > if this is optimal from the useability point of view > (I know that the "return-on-left-click" was a wish brought > up a while ago...;-) It was me, who brought up this wish back then, and I still do like it very much to go forth and back with simple clicks. But of course these new developments in F3-preview require some adjustments. It would be perfect in my opinion, if you could go back on a single click, while it would pan on dragging your mouse (i.e. holding down the click and move the mouse). This would nicely account for both needs, wouldn't it? I don't know, whether this is easy with Qt/KDE. > There is maybe one very important point: > the zoom as it is presently done, uses a reduced-size version of the > underlying image, right? > So while it is nice to be able to zoom in, it does not allow for > a judgement of the image quality (in contrast to the image editor). > Do you think that there is a way to use the actual image > (maybe from a certain zoom-level on?) But that would (quite > certainly?) slow things down... > > In particular for the upcoming light-table I think it is important > to compare the real images, not just up-scaled ones > > Uups: I just realized that for zooming in, the image editor also > some interpolation is done, so that that one does not see the single > pixels, but some nicely interpolated version? A solution might be the following: While you move the slider, the image could be fast-scaled, and when you release the slider, the pixmap could be smoothly replaced in the background by the real picture. Same for Zoom+ and Zoom- buttons: on button click, immediately display a fast scaled version, and with a short delay after release, if the buttons has not been clicked again, replace it by the real picture. SVN commit 652122 by cgilles: digiKam from trunk : Zoom In/Out buttons are now in statusbar, around the zoom slider. CCBUGS: 140131 M +29 -2 digikamapp.cpp M +6 -0 digikamappprivate.h M +1 -4 digikamui.rc --- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #652121:652122 @@ -30,6 +30,7 @@ #include <qtooltip.h> #include <qsignalmapper.h> #include <qdockarea.h> +#include <qhbox.h> // KDE includes. @@ -341,19 +342,43 @@ d->statusProgressBar->setMaximumHeight(fontMetrics().height()+2); statusBar()->addWidget(d->statusProgressBar, 100, true); + //------------------------------------------------------------------------------ + + QHBox *zoomBar = new QHBox(statusBar()); + + d->zoomMinusButton = new QToolButton(zoomBar); + d->zoomMinusButton->setAutoRaise(true); + d->zoomMinusButton->setIconSet(SmallIconSet("viewmag-")); + QToolTip::add(d->zoomMinusButton, i18n("Zoom out")); + d->thumbSizeSlider = new QSlider(ThumbnailSize::Small, ThumbnailSize::Huge, ThumbnailSize::Step, ThumbnailSize::Medium, - Qt::Horizontal, statusBar()); + Qt::Horizontal, zoomBar); d->thumbSizeSlider->setMaximumHeight(fontMetrics().height()+2); d->thumbSizeSlider->setFixedWidth(120); + d->zoomPlusButton = new QToolButton(zoomBar); + d->zoomPlusButton->setAutoRaise(true); + d->zoomPlusButton->setIconSet(SmallIconSet("viewmag+")); + QToolTip::add(d->zoomPlusButton, i18n("Zoom in")); + d->thumbSizeTracker = new DTipTracker("", d->thumbSizeSlider); - statusBar()->addWidget(d->thumbSizeSlider, 1, true); + + statusBar()->addWidget(zoomBar, 1, true); + + //------------------------------------------------------------------------------ + d->statusNavigateBar = new StatusNavigateBar(statusBar()); d->statusNavigateBar->setMaximumHeight(fontMetrics().height()+2); statusBar()->addWidget(d->statusNavigateBar, 1, true); + connect(d->zoomMinusButton, SIGNAL(clicked()), + d->view, SLOT(slotZoomOut())); + + connect(d->zoomPlusButton, SIGNAL(clicked()), + d->view, SLOT(slotZoomIn())); + connect(d->thumbSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotThumbSizeTimer(int))); @@ -924,11 +949,13 @@ void DigikamApp::enableThumbSizePlusAction(bool val) { d->thumbSizePlusAction->setEnabled(val); + d->zoomPlusButton->setEnabled(val); } void DigikamApp::enableThumbSizeMinusAction(bool val) { d->thumbSizeMinusAction->setEnabled(val); + d->zoomMinusButton->setEnabled(val); } void DigikamApp::enableAlbumBackwardHistory(bool enable) --- trunk/extragear/graphics/digikam/digikam/digikamappprivate.h #652121:652122 @@ -24,6 +24,7 @@ #include <qstring.h> #include <qmap.h> #include <qslider.h> +#include <qtoolbutton.h> #include <qtimer.h> // KDE includes. @@ -131,6 +132,8 @@ splashScreen = 0; thumbSizeSlider = 0; thumbSizeTracker = 0; + zoomMinusButton = 0; + zoomPlusButton = 0; } bool fullScreen; @@ -150,6 +153,9 @@ QString cameraGuiPath; + QToolButton *zoomPlusButton; + QToolButton *zoomMinusButton; + KPopupMenu *cameraMediaList; KAccel *accelerators; --- trunk/extragear/graphics/digikam/digikam/digikamui.rc #652121:652122 @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui version="22" name="digikam" > +<kpartgui version="23" name="digikam" > <MenuBar> @@ -123,9 +123,6 @@ <Action name="image_edit" /> <Action name="image_rename" /> <Separator/> - <Action name="album_zoomin" /> - <Action name="album_zoomout" /> - <Separator/> <Action name="full_screen" /> <Action name="slideshow" /> </ToolBar> In addition to the other points:
using CTRL mousewheel, the slider position is not updated.
The corrupted image problem on zooming seems to be gone.
Frank suggested in #16:
> A solution might be the following: While you move the slider, the image
> could be fast-scaled, and when you release the slider, the pixmap could be
> smoothly replaced in the background by the real picture.
> Same for Zoom+ and Zoom- buttons: on button click, immediately display a
> fast scaled version, and with a short delay after release, if the buttons
> has not been clicked again, replace it by the real picture.
I very much like this idea!
About #15 Just for your information, gqview behaves this way : single click swith to next picture, middle-click switch to previous, drag the mouse pan in the picture and Ctrl+Mousewheel zoom in or out I think this behavior is quite intuitive... SVN commit 652199 by cgilles: digikam from trunk : handle properlly the zoom in/out action from preview widget changed by keyboard shorcut and mouse wheel. CCBUGS: 140131 M +5 -2 albumwidgetstack.cpp M +3 -2 albumwidgetstack.h M +3 -3 digikamview.cpp M +2 -0 imagepreviewwidget.cpp M +1 -0 imagepreviewwidget.h --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #652198:652199 @@ -1,10 +1,10 @@ /* ============================================================ - * Authors: Gilles Caulier + * Authors: Gilles Caulier <caulier dot gilles at gmail dot com> * Date : 2006-06-13 * Description : A widget stack to embedded album content view * or the current image preview. * - * Copyright 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * Copyright 2006-2007 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General @@ -102,6 +102,9 @@ connect(d->imagePreviewView, SIGNAL(signalSlideShow()), this, SIGNAL(signalSlideShow())); + + connect(d->imagePreviewView, SIGNAL(signalZoomFactorChanged(double)), + this, SIGNAL(signalZoomFactorChanged(double))); } AlbumWidgetStack::~AlbumWidgetStack() --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #652198:652199 @@ -1,10 +1,10 @@ /* ============================================================ - * Authors: Gilles Caulier + * Authors: Gilles Caulier <caulier dot gilles at gmail dot com> * Date : 2006-06-13 * Description : A widget stack to embedded album content view * or the current image preview. * - * Copyright 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * Copyright 2006-2007 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General @@ -84,6 +84,7 @@ void signalToggledToPreviewMode(bool); void signalBack2Album(); void signalSlideShow(); + void signalZoomFactorChanged(double); public slots: --- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #652198:652199 @@ -340,6 +340,9 @@ connect(d->albumWidgetStack, SIGNAL(signalSlideShow()), this, SLOT(slotSlideShowAll())); + connect(d->albumWidgetStack, SIGNAL(signalZoomFactorChanged(double)), + this, SIGNAL(signalZoomChanged(double))); + // -- Selection timer --------------- connect(d->selectionTimer, SIGNAL(timeout()), @@ -722,7 +725,6 @@ double a = (zmax-b)/h; double z = a*size+b; d->albumWidgetStack->setZoomFactor(z); - emit signalZoomChanged(d->albumWidgetStack->zoomFactor()); } else if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewAlbumMode) { @@ -799,7 +801,6 @@ { d->albumWidgetStack->increaseZoom(); toogleZoomActions(); - emit signalZoomChanged(d->albumWidgetStack->zoomFactor()); } } @@ -815,7 +816,6 @@ { d->albumWidgetStack->decreaseZoom(); toogleZoomActions(); - emit signalZoomChanged(d->albumWidgetStack->zoomFactor()); } } --- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #652198:652199 @@ -435,6 +435,8 @@ (int)(((cpy * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom))); viewport()->setUpdatesEnabled(true); viewport()->update(); + + emit signalZoomFactorChanged(d->zoom); } double ImagePreviewWidget::zoomFactor() --- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.h #652198:652199 @@ -62,6 +62,7 @@ void signalLeftButtonClicked(); void signalShowNextImage(); void signalShowPrevImage(); + void signalZoomFactorChanged(double); public slots: To Arnd, #18: >using CTRL mousewheel, the slider position is not updated. Fixed in svn. > The corrupted image problem on zooming seems to be gone. Patch ready to be applied to svn. I'm waiting feedback from Antionio Larrosa (who have reported also this problem and have proposed solution to fix it). Gilles To Arnd, #11 : >Wow - that zooming looks absolutely great!!!! Thanks >Some observations and comments: >- I also observe artefacts at different zoom-levels > (eg. at 92 % and at 397%, but these values differ from image to > image; also this only seems to happen when using CTRL+ and CTRL-, > but not the slider?) Artifact are give from FastScale algorithm from Antonio Larrossa. Investigation are under progress to fix it. Slider step is more fine than CTRL+/- or mouse wheel. This is why you can see a diff. >- pressing F4 to open the image editor: the zoom in the album view > is undone (however, moving the slider afterwards shows, that it is > still zoomed in) Hum, fixed in svn i think. >- maybe related: somehow the previous zoom-level is memorized: > F3 for an image and zoom in (e.g. 1000%) > ESC to leave > F3 again: the image is displayed to fit the available space, > but the slider is still on 1000%. Right, i will fix it. >- the zoom percentages do not seem to match with the values in > the image editor (but maybe I am wrong): I.e., > shouldn't 100% mean that one image pixel corresponds one > display pixel? 100% is the real image size on the screen. >- Maybe just a personal problem: I always find my to press CTRL-Q > to leave the large view (obviously because of the large display > some corner of my brain thinks that this must be the image editor), > but this does leave digikam (which does indeed leave the large view, > but not in the way I wanted ...) Here i use 3 flat screens with Xinerama. not reproductible. >- And another one: I happen to press the left-mouse > (having panning in mind) quite frequently, which brings > me back to the thumbnail view (which I did not want;-) - not sure > if this is optimal from the useability point of view > (I know that the "return-on-left-click" was a wish brought > up a while ago...;-) preview with zooming/scrooling work like old static preview mode : when you press on left mouse button, you go back to album view. F-spot work like this too. The canvas preview use the same implementation than canvas from editor. You pan the image when you use central mouse buttom. Gimp work like this. Some wishes: >- When zoomed in: a pan-window widget in the lower-right corner > where the scroll-bars meet > (as in the image editor) would be nice TODO >- it would be nice if the position of the mouse would be > the center around which the zoom is done > (I also mentioned this as a wish for the image editor zoom, > but did not yet manage to look into the logic there, should > be fairly easy to implement...) TODO >There is maybe one very important point: >the zoom as it is presently done, uses a reduced-size version of the >underlying image, right? yes >So while it is nice to be able to zoom in, it does not allow for >a judgement of the image quality (in contrast to the image editor). >Do you think that there is a way to use the actual image >(maybe from a certain zoom-level on?) But that would (quite >certainly?) slow things down... no. the implementation is not do in this way. All tool to change the image are in editor. Preview mode is not an editor. >In particular for the upcoming light-table I think it is important >to compare the real images, not just up-scaled ones Light Table is planed (:=))) Uups: I just realized that for zooming in, the image editor also some interpolation is done, so that that one does not see the single pixels, but some nicely interpolated version? You want mean to have an option to disable interpolation with Zoom in (named antialiasing in editor) ? Gilles > >- pressing F4 to open the image editor: the zoom in the album view > > is undone (however, moving the slider afterwards shows, that it is > > still zoomed in) > > Hum, fixed in svn i think. Just tried with revision 652228: the problem persists; steps to reproduce are: - F3 - zoom in (e.g. 1200%) - F4 ==> the zoom in the album view is undone. > >So while it is nice to be able to zoom in, it does not allow for > >a judgement of the image quality (in contrast to the image editor). > >Do you think that there is a way to use the actual image > >(maybe from a certain zoom-level on?) But that would (quite > >certainly?) slow things down... > > no. the implementation is not do in this way. All tool to change the image are in editor. Preview mode is not an editor. Well, I was not thinking of editing the image, but just displaying it at its actual resolution from a certain zoom-level on. I think Frank's suggestion in #16 would be a very good solution. > Uups: I just realized that for zooming in, the image editor also > some interpolation is done, so that that one does not see the single > pixels, but some nicely interpolated version? > > You want mean to have an option to disable interpolation with Zoom in (named antialiasing in editor) ? I think that this would be good to have. (The quality of the interpolation is very good, but to just judge the quality on the pixel-level alone it would be good to have no interpolation - e.g for gqview this corresponds to the "interpolation=nearest") >Just tried with revision 652228: the problem persists; steps to
>reproduce are:
>- F3
>- zoom in (e.g. 1200%)
>- F4 ==> the zoom in the album view is undone.
Fixed in svn...
Gilles
> You want mean to have an option to disable interpolation with Zoom in
> (named antialiasing in editor) ?
Yes. Quality of interpolation is very good but sometimes I have to see
real image.
m.
SVN commit 652434 by antlarr: Fixed a precision problem that produced some artifacts when zooming images in the preview and canvas since a wrong tile was chosen when painting. CCBUGS: 140131 M +6 -6 digikam/imagepreviewwidget.cpp M +16 -20 utilities/imageeditor/canvas/canvas.cpp --- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #652433:652434 @@ -265,8 +265,8 @@ pix->fill(d->bgColor); - sx = (int)floor(((double)i / d->zoom) / (d->tileSize / d->zoom)) * step; - sy = (int)floor(((double)j / d->zoom) / (d->tileSize / d->zoom)) * step; + sx = (int)floor((double)i / d->tileSize ) * step; + sy = (int)floor((double)j / d->tileSize ) * step; sw = step; sh = step; @@ -427,8 +427,8 @@ double cpx = contentsX() + visibleWidth() / 2.0; double cpy = contentsY() + visibleHeight() / 2.0; - cpx = ((cpx / d->zoom) / (d->tileSize / d->zoom)) * floor(d->tileSize / d->zoom); - cpy = ((cpy / d->zoom) / (d->tileSize / d->zoom)) * floor(d->tileSize / d->zoom); + cpx = ( cpx / d->tileSize ) * floor(d->tileSize / d->zoom); + cpy = ( cpy / d->tileSize ) * floor(d->tileSize / d->zoom); // To limit precision of zoom value and reduce error with check of max/min zoom. d->zoom = floor(zoom * 10000.0) / 10000.0; @@ -438,8 +438,8 @@ updateContentsSize(); viewport()->setUpdatesEnabled(false); - center((int)(((cpx * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)), - (int)(((cpy * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom))); + center((int)((cpx * d->tileSize ) / floor(d->tileSize / d->zoom)), + (int)((cpy * d->tileSize ) / floor(d->tileSize / d->zoom))); viewport()->setUpdatesEnabled(true); viewport()->update(); --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #652433:652434 @@ -433,10 +433,10 @@ { int xSel, ySel, wSel, hSel; d->im->getSelectedArea(xSel, ySel, wSel, hSel); - xSel = (int)(((xSel * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)); - ySel = (int)(((ySel * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)); - wSel = (int)(((wSel * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)); - hSel = (int)(((hSel * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)); + xSel = (int)((xSel * d->tileSize) / floor(d->tileSize / d->zoom)); + ySel = (int)((ySel * d->tileSize) / floor(d->tileSize / d->zoom)); + wSel = (int)((wSel * d->tileSize) / floor(d->tileSize / d->zoom)); + hSel = (int)((hSel * d->tileSize) / floor(d->tileSize / d->zoom)); d->rubber->setX(xSel); d->rubber->setY(ySel); d->rubber->setWidth(wSel); @@ -550,8 +550,8 @@ // The new implementation below fix this problem to handle properly the areas to // use from the source image to generate the canvas pixmap tiles. - sx = (int)floor(((double)i / d->zoom) / (d->tileSize / d->zoom)) * step; - sy = (int)floor(((double)j / d->zoom) / (d->tileSize / d->zoom)) * step; + sx = (int)floor((double)i / d->tileSize) * step; + sy = (int)floor((double)j / d->tileSize) * step; sw = step; sh = step; @@ -933,8 +933,8 @@ double cpx = contentsX() + visibleWidth() / 2.0; double cpy = contentsY() + visibleHeight() / 2.0; - cpx = ((cpx / d->zoom) / (d->tileSize / d->zoom)) * floor(d->tileSize / d->zoom); - cpy = ((cpy / d->zoom) / (d->tileSize / d->zoom)) * floor(d->tileSize / d->zoom); + cpx = (cpx / d->tileSize) * floor(d->tileSize / d->zoom); + cpy = (cpy / d->tileSize) * floor(d->tileSize / d->zoom); d->zoom = zoom; @@ -942,8 +942,8 @@ updateContentsSize(false); viewport()->setUpdatesEnabled(false); - center((int)(((cpx * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)), - (int)(((cpy * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom))); + center((int)((cpx * d->tileSize) / floor(d->tileSize / d->zoom)), + (int)((cpy * d->tileSize) / floor(d->tileSize / d->zoom))); viewport()->setUpdatesEnabled(true); viewport()->update(); @@ -974,8 +974,8 @@ updateContentsSize(true); viewport()->setUpdatesEnabled(false); - center((int)(((cpx * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)), - (int)(((cpy * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom))); + center((int)((cpx * d->tileSize) / floor(d->tileSize / d->zoom)), + (int)((cpy * d->tileSize) / floor(d->tileSize / d->zoom))); viewport()->setUpdatesEnabled(true); viewport()->update(); @@ -1194,17 +1194,13 @@ { r.moveBy(- d->pixmapRect.x(), - d->pixmapRect.y()); - int step = (int)floor(d->tileSize / d->zoom); + x = (int)(((double)r.x() / d->tileSize) * floor(d->tileSize / d->zoom)); + y = (int)(((double)r.y() / d->tileSize) * floor(d->tileSize / d->zoom)); + w = (int)(((double)r.width() / d->tileSize) * floor(d->tileSize / d->zoom)); + h = (int)(((double)r.height() / d->tileSize) * floor(d->tileSize / d->zoom)); - x = (int)((((double)r.x() / d->zoom) / (d->tileSize / d->zoom)) * step); - y = (int)((((double)r.y() / d->zoom) / (d->tileSize / d->zoom)) * step); - - w = (int)((((double)r.width() / d->zoom) / (d->tileSize / d->zoom)) * step); - h = (int)((((double)r.height() / d->zoom) / (d->tileSize / d->zoom)) * step); - x = QMIN(imageWidth(), QMAX(x, 0)); y = QMIN(imageHeight(), QMAX(y, 0)); - w = QMIN(imageWidth(), QMAX(w, 0)); h = QMIN(imageHeight(), QMAX(h, 0)); SVN commit 652884 by cgilles: digikam from trunk : pan icon widget is back with Preview Mode... CCBUGS: 140131 M +107 -10 digikam/imagepreviewwidget.cpp M +4 -0 digikam/imagepreviewwidget.h M +2 -2 libs/widgets/common/Makefile.am AM libs/widgets/common/paniconwidget.cpp [License: GPL] AM libs/widgets/common/paniconwidget.h [License: GPL] --- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #652883:652884 @@ -24,6 +24,7 @@ // Qt includes. +#include <qtooltip.h> #include <qcache.h> #include <qpainter.h> #include <qimage.h> @@ -31,12 +32,15 @@ #include <qrect.h> #include <qtimer.h> #include <qguardedptr.h> +#include <qtoolbutton.h> // KDE include. #include <kcursor.h> #include <kprocess.h> #include <klocale.h> +#include <kdatetbl.h> +#include <kiconloader.h> // Local includes. @@ -44,6 +48,7 @@ #include "fastscale.h" #include "themeengine.h" #include "albumsettings.h" +#include "paniconwidget.h" #include "imagepreviewwidget.h" #include "imagepreviewwidget.moc" @@ -57,16 +62,19 @@ ImagePreviewWidgetPriv() : tileSize(128), minZoom(0.1), maxZoom(12.0), zoomMultiplier(1.2) { - pressedMoving = false; - midButtonPressed = false; - midButtonX = 0; - midButtonY = 0; - autoZoom = false; - fullScreen = false; - zoom = 1.0; - zoomWidth = 0; - zoomHeight = 0; - tileTmpPix = new QPixmap(tileSize, tileSize); + pressedMoving = false; + midButtonPressed = false; + midButtonX = 0; + midButtonY = 0; + autoZoom = false; + fullScreen = false; + zoom = 1.0; + zoomWidth = 0; + zoomHeight = 0; + panIconPopup = 0; + panIconWidget = 0; + cornerButton = 0; + tileTmpPix = new QPixmap(tileSize, tileSize); tileCache.setMaxCost((10*1024*1024)/(tileSize*tileSize*4)); tileCache.setAutoDelete(true); @@ -88,6 +96,8 @@ const double maxZoom; const double zoomMultiplier; + QToolButton *cornerButton; + QRect pixmapRect; QCache<QPixmap> tileCache; @@ -97,6 +107,10 @@ QColor bgColor; QImage preview; + + KPopupFrame *panIconPopup; + + PanIconWidget *panIconWidget; }; ImagePreviewWidget::ImagePreviewWidget(QWidget *parent) @@ -112,8 +126,20 @@ setMargin(0); setLineWidth(1); + d->cornerButton = new QToolButton(this); + d->cornerButton->setIconSet(SmallIcon("move")); + d->cornerButton->hide(); + QToolTip::add(d->cornerButton, i18n("Pan the image to a region")); + setCornerWidget(d->cornerButton); + // ------------------------------------------------------------ + connect(this, SIGNAL(signalZoomFactorChanged(double)), + this, SLOT(slotZoomChanged(double))); + + connect(d->cornerButton, SIGNAL(pressed()), + this, SLOT(slotCornerButtonPressed())); + connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged())); } @@ -156,6 +182,8 @@ d->zoom = calcAutoZoomFactor(); d->zoomWidth = (int)(d->preview.width() * d->zoom); d->zoomHeight = (int)(d->preview.height() * d->zoom); + + emit signalZoomFactorChanged(d->zoom); } double ImagePreviewWidget::calcAutoZoomFactor() @@ -210,6 +238,10 @@ // No need to repaint. its called // automatically after resize + + // To be sure than corner widget used to pan image will be hide/show + // accordinly with resize event. + slotZoomChanged(d->zoom); } void ImagePreviewWidget::viewportPaintEvent(QPaintEvent *e) @@ -463,10 +495,75 @@ if (d->autoZoom) updateAutoZoom(); else + { d->zoom = 1.0; + emit signalZoomFactorChanged(d->zoom); + } updateContentsSize(); viewport()->update(); } +void ImagePreviewWidget::slotCornerButtonPressed() +{ + if (d->panIconPopup) + { + d->panIconPopup->hide(); + delete d->panIconPopup; + d->panIconPopup = 0; + } + + d->panIconPopup = new KPopupFrame(this); + PanIconWidget *pan = new PanIconWidget(d->panIconPopup); + pan->setImage(180, 120, d->preview); + d->panIconPopup->setMainWidget(pan); + + QRect r((int)(contentsX() / d->zoom), (int)(contentsY() / d->zoom), + (int)(visibleWidth() / d->zoom), (int)(visibleHeight() / d->zoom)); + pan->setRegionSelection(r); + pan->setMouseFocus(); + + connect(pan, SIGNAL(signalSelectionMoved(QRect, bool)), + this, SLOT(slotPanIconSelectionMoved(QRect, bool))); + + connect(pan, SIGNAL(signalHiden()), + this, SLOT(slotPanIconHiden())); + + QPoint g = mapToGlobal(viewport()->pos()); + g.setX(g.x()+ viewport()->size().width()); + g.setY(g.y()+ viewport()->size().height()); + d->panIconPopup->popup(QPoint(g.x() - d->panIconPopup->width(), + g.y() - d->panIconPopup->height())); + + pan->setCursorToLocalRegionSelectionCenter(); +} + +void ImagePreviewWidget::slotPanIconHiden() +{ + d->cornerButton->blockSignals(true); + d->cornerButton->animateClick(); + d->cornerButton->blockSignals(false); +} + +void ImagePreviewWidget::slotPanIconSelectionMoved(QRect r, bool b) +{ + setContentsPos((int)(r.x()*d->zoom), (int)(r.y()*d->zoom)); + + if (b) + { + d->panIconPopup->hide(); + delete d->panIconPopup; + d->panIconPopup = 0; + slotPanIconHiden(); + } +} + +void ImagePreviewWidget::slotZoomChanged(double zoom) +{ + if (zoom > calcAutoZoomFactor()) + d->cornerButton->show(); + else + d->cornerButton->hide(); +} + } // NameSpace Digikam --- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.h #652883:652884 @@ -85,6 +85,10 @@ private slots: void slotThemeChanged(); + void slotCornerButtonPressed(); + void slotZoomChanged(double); + void slotPanIconSelectionMoved(QRect, bool); + void slotPanIconHiden(); private: --- trunk/extragear/graphics/digikam/libs/widgets/common/Makefile.am #652883:652884 @@ -5,7 +5,7 @@ libcommonwidgets_la_SOURCES = histogramwidget.cpp colorgradientwidget.cpp curveswidget.cpp \ sidebar.cpp squeezedcombobox.cpp filesaveoptionsbox.cpp \ dpopupmenu.cpp statusnavigatebar.cpp statusprogressbar.cpp \ - dcursortracker.cpp + dcursortracker.cpp paniconwidget.cpp libcommonwidgets_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) @@ -17,6 +17,6 @@ $(all_includes) digikaminclude_HEADERS = histogramwidget.h colorgradientwidget.h sidebar.h curveswidget.h \ - squeezedcombobox.h dcursortracker.h + squeezedcombobox.h dcursortracker.h paniconwidget.h digikamincludedir = $(includedir)/digikam ** trunk/extragear/graphics/digikam/libs/widgets/common/paniconwidget.cpp #property svn:eol-style + native ** trunk/extragear/graphics/digikam/libs/widgets/common/paniconwidget.h #property svn:eol-style + native Very nice! (Only clicking onto the thumb in the album view does not bring up the preview mode, while F3/F4 still work) Two minor questions: - would it technically be possible to have the current percentage displayed as a small transient window, also when using the + - buttons and the CTRL- mousewheel? - would it technically be possible to make the 100% view as one step in the sequence of possible zoom values? (Neither with CTRL+- or CTRL mousewheel I manage to get to that value) Presumably the answer to this is the following: The reason is of course that one starts from a view which fits the available space, leading to a certain percentage. Increasing the zoom, a factor gets multiplied onto the current zoom percentage in each step. Now the 100% is usually not in this sequence of numbers. Actually, I just realized, that it is even not possible to get back to the initial "fit to the available space" once one went to the borders (10% or 1200%) of the zoom-range. OK, and here my question ends, because these are two incompatible goals: having both the 100% view and the "fit-to-the available-space" percentage in the same sequence of number is not possible (in general). The only possible solution would be to specially set anything near 100% to 100% view and do something similar for the "fit-to-the available-space" percentag but I am really not sure whether this is worth the effort ... >(Only clicking onto the thumb in the album view does not bring up >the preview mode, while F3/F4 still work) This behaviours can be set in Config dialog. >Two minor questions: >- would it technically be possible to have the current percentage > displayed as a small transient window, also > when using the + - buttons and the CTRL- mousewheel? just move the mouse cursor over the zoom slider on status bar, you will see the zoom factor value like a tool tip. >- would it technically be possible to make the 100% view > as one step in the sequence of possible zoom values? > (Neither with CTRL+- or CTRL mousewheel I manage to get to that value) > Presumably the answer to this is the following: > The reason is of course that one starts from a view which > fits the available space, leading to a certain percentage. > Increasing the zoom, a factor gets multiplied onto the current zoom > percentage in each step. Now the 100% is usually not in this > sequence of numbers. > Actually, I just realized, that it is even not possible > to get back to the initial "fit to the available space" > once one went to the borders (10% or 1200%) of the zoom-range. Like a keyboard shorcut, yes, it possible... If you know a standard shorcut to toogle on 100% zoom factor, let's me hear... Gilles > >(Only clicking onto the thumb in the album view does not bring up > >the preview mode, while F3/F4 still work) > > This behaviours can be set in Config dialog. I know, and it is set to "show embedded preview", but it does not work anymore! (I.e., can you reproduce this?) > >Two minor questions: > >- would it technically be possible to have the current percentage > > displayed as a small transient window, also > > when using the + - buttons and the CTRL- mousewheel? > > just move the mouse cursor over the zoom slider on status bar, > you will see the zoom factor value like a tool tip. Yes, I know, but would it be possible to display a small tool tip also when using the + - buttons and the mousewheel? > >- would it technically be possible to make the 100% view > > as one step in the sequence of possible zoom values? > > (Neither with CTRL+- or CTRL mousewheel I manage to get to that value) > > > Presumably the answer to this is the following: > > The reason is of course that one starts from a view which > > fits the available space, leading to a certain percentage. > > Increasing the zoom, a factor gets multiplied onto the current zoom > > percentage in each step. Now the 100% is usually not in this > > sequence of numbers. > > > Actually, I just realized, that it is even not possible > > to get back to the initial "fit to the available space" > > once one went to the borders (10% or 1200%) of the zoom-range. > > Like a keyboard shorcut, yes, it possible... Yes, that's a **much** better solution. > If you know a standard shorcut to toogle on 100% zoom factor, let's me hear... gqview uses: "Z" Zoom 1:1 "X" Zoom to fit If these where added to the View menu entry (greyed out when not in preview mode), the user could easily find them. > If you know a standard shorcut to toogle on 100% zoom factor, let's me
> hear...
GIMP uses 1 for 1:1
Shift-Ctrl-E dla 'fit to window'
----------------------------------------------------
Ka
SVN commit 653028 by cgilles: digiKam from trunk : new option to reset zoom factor to fit preview on window size. CCBUGS: 140131 M +5 -0 digikam/albumwidgetstack.cpp M +1 -0 digikam/albumwidgetstack.h M +13 -4 digikam/digikamapp.cpp M +6 -4 digikam/digikamappprivate.h M +1 -0 digikam/digikamui.rc M +8 -0 digikam/digikamview.cpp M +1 -0 digikam/digikamview.h M +9 -2 libs/widgets/common/previewwidget.cpp M +3 -2 libs/widgets/common/previewwidget.h --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #653027:653028 @@ -217,6 +217,11 @@ d->imagePreviewView->slotDecreaseZoom(); } +void AlbumWidgetStack::fitToWindow() +{ + d->imagePreviewView->fitToWindow(); +} + bool AlbumWidgetStack::maxZoom() { return d->imagePreviewView->maxZoom(); --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #653027:653028 @@ -71,6 +71,7 @@ void increaseZoom(); void decreaseZoom(); + void fitToWindow(); bool maxZoom(); bool minZoom(); void setZoomFactor(double z); --- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #653027:653028 @@ -784,7 +784,7 @@ // ----------------------------------------------------------- - d->thumbSizePlusAction = new KAction(i18n("Zoom in"), + d->zoomPlusAction = new KAction(i18n("Zoom in"), "viewmag+", CTRL+Key_Plus, d->view, @@ -792,7 +792,7 @@ actionCollection(), "album_zoomin"); - d->thumbSizeMinusAction = new KAction(i18n("Zoom out"), + d->zoomMinusAction = new KAction(i18n("Zoom out"), "viewmag-", CTRL+Key_Minus, d->view, @@ -800,6 +800,14 @@ actionCollection(), "album_zoomout"); + d->zoomFitToWindowAction = new KAction(i18n("Fit to &Window"), + "view_fit_window", + CTRL+SHIFT+Key_A, + d->view, + SLOT(slotFitToWindow()), + actionCollection(), + "album_zoomfit2window"); + #if KDE_IS_VERSION(3,2,0) d->fullScreenAction = KStdAction::fullScreen(this, SLOT(slotToggleFullScreen()), actionCollection(), this, "full_screen"); @@ -950,13 +958,13 @@ void DigikamApp::enableZoomPlusAction(bool val) { - d->thumbSizePlusAction->setEnabled(val); + d->zoomPlusAction->setEnabled(val); d->zoomPlusButton->setEnabled(val); } void DigikamApp::enableZoomMinusAction(bool val) { - d->thumbSizeMinusAction->setEnabled(val); + d->zoomMinusAction->setEnabled(val); d->zoomMinusButton->setEnabled(val); } @@ -1865,6 +1873,7 @@ // View menu d->albumSortAction->setEnabled(!t); d->imageSortAction->setEnabled(!t); + d->zoomFitToWindowAction->setEnabled(t); } } // namespace Digikam --- trunk/extragear/graphics/digikam/digikam/digikamappprivate.h #653027:653028 @@ -100,8 +100,6 @@ selectAllAction = 0; selectNoneAction = 0; selectInvertAction = 0; - thumbSizePlusAction = 0; - thumbSizeMinusAction = 0; fullScreenAction = 0; slideShowAction = 0; slideShowAllAction = 0; @@ -134,6 +132,9 @@ zoomTracker = 0; zoomMinusButton = 0; zoomPlusButton = 0; + zoomFitToWindowAction = 0; + zoomPlusAction = 0; + zoomMinusAction = 0; } bool fullScreen; @@ -209,10 +210,11 @@ KAction *slideShowAllAction; KAction *slideShowSelectionAction; KAction *slideShowRecursiveAction; - KAction *thumbSizePlusAction; - KAction *thumbSizeMinusAction; KSelectAction *imageSortAction; KSelectAction *albumSortAction; + KAction *zoomPlusAction; + KAction *zoomMinusAction; + KAction *zoomFitToWindowAction; KAction *rating0Star; KAction *rating1Star; --- trunk/extragear/graphics/digikam/digikam/digikamui.rc #653027:653028 @@ -64,6 +64,7 @@ <Separator/> <Action name="album_zoomin" /> <Action name="album_zoomout" /> + <Action name="album_zoomfit2window" /> <Separator /> <Action name="album_sort" /> <Action name="image_sort" /> --- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #653027:653028 @@ -817,6 +817,14 @@ } } +void DigikamView::slotFitToWindow() +{ + if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode) + { + d->albumWidgetStack->fitToWindow(); + } +} + void DigikamView::slotZoomFactorChanged(double zoom) { toogleZoomActions(); --- trunk/extragear/graphics/digikam/digikam/digikamview.h #653027:653028 @@ -81,6 +81,7 @@ // View Action slots void slotZoomIn(); void slotZoomOut(); + void slotFitToWindow(); void slotSlideShowAll(); void slotSlideShowSelection(); void slotSlideShowRecursive(); --- trunk/extragear/graphics/digikam/libs/widgets/common/previewwidget.cpp #653027:653028 @@ -479,13 +479,20 @@ return d->zoom; } -bool PreviewWidget::fitToWindow() +bool PreviewWidget::isFitToWindow() { return d->autoZoom; } -void PreviewWidget::toggleFitToWindow() +void PreviewWidget::fitToWindow() { + updateAutoZoom(); + updateContentsSize(); + viewport()->update(); +} + +void PreviewWidget::lockFitToWindow() +{ d->autoZoom = !d->autoZoom; if (d->autoZoom) --- trunk/extragear/graphics/digikam/libs/widgets/common/previewwidget.h #653027:653028 @@ -50,8 +50,9 @@ void setImage(const QImage& image); void setZoomFactor(double z); void setBackgroundColor(const QColor& color); - bool fitToWindow(); - void toggleFitToWindow(); + void fitToWindow(); + bool isFitToWindow(); + void lockFitToWindow(); bool maxZoom(); bool minZoom(); SVN commit 653032 by cgilles: digiKam from trunk : Zoom In/Out buttons are now in statusbar, around the zoom slider. CCBUGS: 140131 M +1 -1 previewwidget.cpp M +1 -1 previewwidget.h --- trunk/extragear/graphics/digikam/libs/widgets/common/previewwidget.cpp #653031:653032 @@ -491,7 +491,7 @@ viewport()->update(); } -void PreviewWidget::lockFitToWindow() +void PreviewWidget::toggleFitToWindow() { d->autoZoom = !d->autoZoom; --- trunk/extragear/graphics/digikam/libs/widgets/common/previewwidget.h #653031:653032 @@ -52,7 +52,7 @@ void setBackgroundColor(const QColor& color); void fitToWindow(); bool isFitToWindow(); - void lockFitToWindow(); + void toggleFitToWindow(); bool maxZoom(); bool minZoom(); Hi Gilles, I just compiled and tried it. That's great. Just some comments : - like somebody said earlier (can't find it anymore), Ctrl+Mousewheel-UP is usually affected to zoom in and Mousewheel-Down to zoom out (it's the case in gwenview, gqview) - Ctrl+Shif+A for "fit to window" is not very convenient to use and to remember. Somebody said 1 is used in gimp to zoom 100%. It also works in gqview. Here's my proposal : 0 for "fit to window" 1 for 100% 2 for 200% 3 for 300% etc. - I have a bug (at least on my computer) about the zoom value. For a 5MP picture, fit to window gives me "115%". If I go to 100%, it's not the right size (should be bigger than my 17" screen :) ). > - Ctrl+Shif+A for "fit to window" is not very convenient to use and to
> remember. Somebody said 1 is used in gimp to zoom 100%. It also works in
> gqview. Here's my proposal :
> 0 for "fit to window"
> 1 for 100%
> 2 for 200%
> 3 for 300%
Since we are working on bitmaps there is little use for 200% or 300%
shortcuts. Fit to window and 1:1 shortcuts are necessary but the rest...
IMO no.
SVN commit 653197 by cgilles: digiKam from trunk : new action to set zoom factor to 100% in Preview mode. CCBUGS: 140131 M +5 -0 albumwidgetstack.cpp M +1 -0 albumwidgetstack.h M +9 -0 digikamapp.cpp M +2 -0 digikamappprivate.h M +2 -1 digikamui.rc M +8 -0 digikamview.cpp M +1 -0 digikamview.h --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #653196:653197 @@ -217,6 +217,11 @@ d->imagePreviewView->slotDecreaseZoom(); } +void AlbumWidgetStack::zoomTo100Percents() +{ + d->imagePreviewView->setZoomFactor(1.0); +} + void AlbumWidgetStack::fitToWindow() { d->imagePreviewView->fitToWindow(); --- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #653196:653197 @@ -72,6 +72,7 @@ void increaseZoom(); void decreaseZoom(); void fitToWindow(); + void zoomTo100Percents(); bool maxZoom(); bool minZoom(); void setZoomFactor(double z); --- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #653196:653197 @@ -800,6 +800,14 @@ actionCollection(), "album_zoomout"); + d->zoomTo100percents = new KAction(i18n("Zoom to 1:1"), + "viewmag1", + CTRL+SHIFT+Key_Z, + d->view, + SLOT(slotZoomTo100Percents()), + actionCollection(), + "album_zoomto100percents"); + d->zoomFitToWindowAction = new KAction(i18n("Fit to &Window"), "view_fit_window", CTRL+SHIFT+Key_A, @@ -1873,6 +1881,7 @@ // View menu d->albumSortAction->setEnabled(!t); d->imageSortAction->setEnabled(!t); + d->zoomTo100percents->setEnabled(t); d->zoomFitToWindowAction->setEnabled(t); } --- trunk/extragear/graphics/digikam/digikam/digikamappprivate.h #653196:653197 @@ -132,6 +132,7 @@ zoomTracker = 0; zoomMinusButton = 0; zoomPlusButton = 0; + zoomTo100percents = 0; zoomFitToWindowAction = 0; zoomPlusAction = 0; zoomMinusAction = 0; @@ -215,6 +216,7 @@ KAction *zoomPlusAction; KAction *zoomMinusAction; KAction *zoomFitToWindowAction; + KAction *zoomTo100percents; KAction *rating0Star; KAction *rating1Star; --- trunk/extragear/graphics/digikam/digikam/digikamui.rc #653196:653197 @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui version="24" name="digikam" > +<kpartgui version="25" name="digikam" > <MenuBar> @@ -64,6 +64,7 @@ <Separator/> <Action name="album_zoomin" /> <Action name="album_zoomout" /> + <Action name="album_zoomto100percents" /> <Action name="album_zoomfit2window" /> <Separator /> <Action name="album_sort" /> --- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #653196:653197 @@ -817,6 +817,14 @@ } } +void DigikamView::slotZoomTo100Percents() +{ + if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode) + { + d->albumWidgetStack->zoomTo100Percents(); + } +} + void DigikamView::slotFitToWindow() { if (d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewImageMode) --- trunk/extragear/graphics/digikam/digikam/digikamview.h #653196:653197 @@ -81,6 +81,7 @@ // View Action slots void slotZoomIn(); void slotZoomOut(); + void slotZoomTo100Percents(); void slotFitToWindow(); void slotSlideShowAll(); void slotSlideShowSelection(); The new Zoom to 1:1 and fit to window are very nice! The 1:1 zoom, however, makes me think that the image shown in the middle of the light-table is a reduced version of the original, i.e. a 3456 x 2304 image does almost fit on a 1024x768 screen. >The 1:1 zoom, however, makes me think that
>the image shown in the middle of the light-table
>is a reduced version of the original, i.e. a 3456 x 2304
>image does almost fit on a 1024x768 screen.
yes, it is... For performance reason, a Preview is not the full image. this is why the zoom factor value is a non sence to be show with Preview.
Gilles
Sorry, I wanted to post this remark in this thread http://bugs.kde.org/show_bug.cgi?id=135048 about the light-table. (maybe Frank's idea, see #16 above, would be the solution in both cases?) |