[kde-doc-english] [gwenview] /: Allow different ways to handle zoom and position between images

Aurélien Gâteau agateau at kde.org
Thu Aug 7 16:27:32 UTC 2014


Git commit 5572aded5dfedd7219138166c26b9d01cadebe84 by Aurélien Gâteau, on behalf of John Zaitseff.
Committed on 07/08/2014 at 16:24.
Pushed by gateau into branch 'master'.

Allow different ways to handle zoom and position between images

(Taken from bug #337262 )

Over the years, there has been much discussion about whether the zoom and position should be kept the same between images (see, for example, bug 293103, which I submitted, or bugs 291759, 294915, 321122, 327889, 331412, 334530, 337037 --- there may be more!).  I have even submitted a patch (with bug 293103) which was applied in modified form---thanks!  However, it has been subsequently broken...

I have come to realise that there are THREE main ways people like to have the zoom and position settings applied to successive images:

1. Each image should be opened in Zoom to Fit mode, even if the previous image was zoomed in or out and was panned to a different position.  This is Aurélien Gâteau's preferred mode of operation: call it Autofit zoom mode.

2. The zoom and position settings should be shared across all images.  New images should be opened with the previous image's settings.  If you go back to a previous image (from image B to image A, previously opened), image A's settings should be updated to be those of image B.  This allows you to set zoom and position on an image, then go back and forward to the previous and next image while retaining the settings.  This is MY preferred mode of operation: call it Shared mode.

3. Each image should remember its own zoom and position settings.  New images should be opened with the previous image's position and zoom, but if you then change image B's zoom/position, this is NOT passed back to image A, if you go back to that image.  This is Abhinav Gangwar's preferred mode of operation, and is what LockZoom implements in Gwenview: call it Individual mode.

I think people don't mind Autofit being the default, as long as it can be changed.  At the moment, doing so is very non-obvious, and the Shared mode of operation simply does not exist (as of 12th February 2014).

I am submitting a patch that does the following:

1. Create a config file option "ZoomMode" with ZoomMode::Autofit, ZoomMode::Shared and ZoomMode::Individual being the choices (Autofit is the default, per Aurélien's preferences).

2. Remove the now-obsolete ShowLockZoomButton and LockZoom config options.

3. Remove the Lock Zoom button: it is not visible in Autofit mode anyway, and when a user wants the other modes, they want it on ALL the time, not just some of the time!  Besides, it clutters up the interface :-)

4. Set the zoom and position settings for each image depending on the ZoomMode selected.

5. Add a group of three Zoom Mode radio buttons to the Image Settings configuration dialog page: "Autofit each image", "Shared zoom and position" and "Individual (per-image) zoom and position".  I think adding these radio buttons is the most elegant way for users to change this setting, given how non-obvious the current method is (as can be seen by the continual stream of bug reports!).

REVIEW: 119549
BUG: 337262

M  +7    -0    app/configdialog.cpp
M  +181  -45   app/imageviewconfigpage.ui
M  +0    -1    app/kipiinterface.h
M  +7    -12   app/viewmainpage.cpp
M  +1    -2    cmake/FindLCMS2.cmake
M  +0    -1    devdoc/CONTRIBUTING.md
M  +19   -19   doc/index.docbook
M  +0    -1    lib/archiveutils.h
M  +1    -1    lib/cms/iccjpeg.c
M  +5    -1    lib/documentview/documentview.cpp
M  +19   -9    lib/gwenviewconfig.kcfg
A  +49   -0    lib/zoommode.h     [License: GPL (v2)]
M  +0    -29   lib/zoomwidget.cpp
M  +0    -6    lib/zoomwidget.h
M  +0    -1    part/gvpart.rc

http://commits.kde.org/gwenview/5572aded5dfedd7219138166c26b9d01cadebe84

diff --git a/app/configdialog.cpp b/app/configdialog.cpp
index a582695..8027a0f 100644
--- a/app/configdialog.cpp
+++ b/app/configdialog.cpp
@@ -41,6 +41,7 @@ struct ConfigDialogPrivate
     InvisibleButtonGroup* mAlphaBackgroundModeGroup;
     InvisibleButtonGroup* mWheelBehaviorGroup;
     InvisibleButtonGroup* mAnimationMethodGroup;
+    InvisibleButtonGroup* mZoomModeGroup;
     InvisibleButtonGroup* mThumbnailBarOrientationGroup;
     Ui_GeneralConfigPage mGeneralConfigPage;
     Ui_ImageViewConfigPage mImageViewConfigPage;
@@ -92,6 +93,12 @@ ConfigDialog::ConfigDialog(QWidget* parent)
     d->mAnimationMethodGroup->addButton(d->mImageViewConfigPage.softwareAnimationRadioButton, int(DocumentView::SoftwareAnimation));
     d->mAnimationMethodGroup->addButton(d->mImageViewConfigPage.noAnimationRadioButton, int(DocumentView::NoAnimation));
 
+    d->mZoomModeGroup = new InvisibleButtonGroup(widget);
+    d->mZoomModeGroup->setObjectName(QLatin1String("kcfg_ZoomMode"));
+    d->mZoomModeGroup->addButton(d->mImageViewConfigPage.autofitZoomModeRadioButton, int(ZoomMode::Autofit));
+    d->mZoomModeGroup->addButton(d->mImageViewConfigPage.keepSameZoomModeRadioButton, int(ZoomMode::KeepSame));
+    d->mZoomModeGroup->addButton(d->mImageViewConfigPage.individualZoomModeRadioButton, int(ZoomMode::Individual));
+
     d->mThumbnailBarOrientationGroup = new InvisibleButtonGroup(widget);
     d->mThumbnailBarOrientationGroup->setObjectName(QLatin1String("kcfg_ThumbnailBarOrientation"));
     d->mThumbnailBarOrientationGroup->addButton(d->mImageViewConfigPage.horizontalRadioButton, int(Qt::Horizontal));
diff --git a/app/imageviewconfigpage.ui b/app/imageviewconfigpage.ui
index f5e1e5a..5a95cc1 100644
--- a/app/imageviewconfigpage.ui
+++ b/app/imageviewconfigpage.ui
@@ -6,13 +6,13 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>385</height>
+    <width>500</width>
+    <height>600</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout">
    <item row="0" column="0">
-    <widget class="QLabel" name="label_7">
+    <widget class="QLabel" name="label_1">
      <property name="text">
       <string>Transparent background:</string>
      </property>
@@ -25,7 +25,7 @@
     </widget>
    </item>
    <item row="0" column="1">
-    <layout class="QHBoxLayout">
+    <layout class="QHBoxLayout" name="horizontalLayout_1">
      <property name="spacing">
       <number>6</number>
      </property>
@@ -43,7 +43,7 @@
       </widget>
      </item>
      <item>
-      <spacer>
+      <spacer name="horizontalSpacer_1">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -58,7 +58,7 @@
     </layout>
    </item>
    <item row="1" column="1">
-    <layout class="QHBoxLayout" name="_2">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
      <property name="spacing">
       <number>6</number>
      </property>
@@ -83,7 +83,7 @@
       </widget>
      </item>
      <item>
-      <spacer>
+      <spacer name="horizontalSpacer_2">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -98,7 +98,7 @@
     </layout>
    </item>
    <item row="2" column="1">
-    <spacer name="verticalSpacer_2">
+    <spacer name="verticalSpacer_1">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
@@ -114,7 +114,7 @@
     </spacer>
    </item>
    <item row="3" column="0">
-    <widget class="QLabel" name="label_8">
+    <widget class="QLabel" name="label_2">
      <property name="text">
       <string>Mouse wheel behavior:</string>
      </property>
@@ -127,7 +127,7 @@
     </widget>
    </item>
    <item row="3" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout">
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
      <item>
       <widget class="QRadioButton" name="mouseWheelScrollRadioButton">
        <property name="text">
@@ -139,7 +139,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer">
+      <spacer name="horizontalSpacer_3">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -154,7 +154,7 @@
     </layout>
    </item>
    <item row="4" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout_2">
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
      <item>
       <widget class="QRadioButton" name="mouseWheelBrowseRadioButton">
        <property name="text">
@@ -163,7 +163,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_2">
+      <spacer name="horizontalSpacer_4">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -178,7 +178,7 @@
     </layout>
    </item>
    <item row="5" column="1">
-    <spacer name="verticalSpacer">
+    <spacer name="verticalSpacer_2">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
@@ -193,8 +193,112 @@
      </property>
     </spacer>
    </item>
+   <item row="6" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
+      <string>Zoom mode:</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy">
+      <cstring>autofitZoomModeRadioButton</cstring>
+     </property>
+    </widget>
+   </item>
    <item row="6" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout_3">
+    <layout class="QHBoxLayout" name="horizontalLayout_5">
+     <item>
+      <widget class="QRadioButton" name="autofitZoomModeRadioButton">
+       <property name="text">
+        <string>Autofit each image</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_5">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="7" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_6">
+     <item>
+      <widget class="QRadioButton" name="keepSameZoomModeRadioButton">
+       <property name="text">
+        <string>Keep same zoom and position</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_6">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="8" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_7">
+     <item>
+      <widget class="QRadioButton" name="individualZoomModeRadioButton">
+       <property name="text">
+        <string>Per image zoom and position</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_7">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="9" column="1">
+    <spacer name="verticalSpacer_3">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>207</width>
+       <height>17</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="10" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_8">
      <item>
       <widget class="QCheckBox" name="kcfg_EnlargeSmallerImages">
        <property name="text">
@@ -203,7 +307,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_3">
+      <spacer name="horizontalSpacer_8">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -217,7 +321,7 @@
      </item>
     </layout>
    </item>
-   <item row="7" column="1">
+   <item row="11" column="1">
     <spacer name="verticalSpacer_4">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
@@ -233,8 +337,8 @@
      </property>
     </spacer>
    </item>
-   <item row="8" column="0">
-    <widget class="QLabel" name="label_3">
+   <item row="12" column="0">
+    <widget class="QLabel" name="label_4">
      <property name="text">
       <string>Animations:</string>
      </property>
@@ -246,7 +350,7 @@
      </property>
     </widget>
    </item>
-   <item row="8" column="1">
+   <item row="12" column="1">
     <layout class="QHBoxLayout" name="horizontalLayout_9">
      <item>
       <widget class="QRadioButton" name="glAnimationRadioButton">
@@ -259,7 +363,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_7">
+      <spacer name="horizontalSpacer_9">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -273,8 +377,8 @@
      </item>
     </layout>
    </item>
-   <item row="9" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout_8">
+   <item row="13" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_10">
      <item>
       <widget class="QRadioButton" name="softwareAnimationRadioButton">
        <property name="text">
@@ -283,7 +387,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_8">
+      <spacer name="horizontalSpacer_10">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -297,8 +401,8 @@
      </item>
     </layout>
    </item>
-   <item row="10" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout_7">
+   <item row="14" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_11">
      <item>
       <widget class="QRadioButton" name="noAnimationRadioButton">
        <property name="text">
@@ -307,7 +411,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_9">
+      <spacer name="horizontalSpacer_11">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -321,15 +425,47 @@
      </item>
     </layout>
    </item>
-   <item row="11" column="0">
-    <widget class="QLabel" name="label_2">
+   <item row="15" column="1">
+    <spacer name="verticalSpacer_5">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>204</width>
+       <height>17</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="16" column="0">
+    <widget class="QLabel" name="label_5">
      <property name="text">
       <string><b>Thumbnail Bar</b></string>
      </property>
     </widget>
    </item>
-   <item row="12" column="0">
-    <widget class="QLabel" name="label_9">
+   <item row="17" column="1">
+    <spacer name="verticalSpacer_6">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>204</width>
+       <height>12</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="18" column="0">
+    <widget class="QLabel" name="label_6">
      <property name="text">
       <string>Orientation:</string>
      </property>
@@ -341,8 +477,8 @@
      </property>
     </widget>
    </item>
-   <item row="12" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout_4">
+   <item row="18" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_12">
      <item>
       <widget class="QRadioButton" name="horizontalRadioButton">
        <property name="text">
@@ -351,7 +487,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_4">
+      <spacer name="horizontalSpacer_12">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -365,8 +501,8 @@
      </item>
     </layout>
    </item>
-   <item row="13" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout_5">
+   <item row="19" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_13">
      <item>
       <widget class="QRadioButton" name="verticalRadioButton">
        <property name="text">
@@ -375,7 +511,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_5">
+      <spacer name="horizontalSpacer_13">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -389,8 +525,8 @@
      </item>
     </layout>
    </item>
-   <item row="14" column="0">
-    <widget class="QLabel" name="label">
+   <item row="20" column="0">
+    <widget class="QLabel" name="label_7">
      <property name="text">
       <string>Row count:</string>
      </property>
@@ -402,8 +538,8 @@
      </property>
     </widget>
    </item>
-   <item row="14" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout_6">
+   <item row="20" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_14">
      <item>
       <widget class="KIntSpinBox" name="kcfg_ThumbnailBarRowCount">
        <property name="minimum">
@@ -415,7 +551,7 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_6">
+      <spacer name="horizontalSpacer_14">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -429,15 +565,15 @@
      </item>
     </layout>
    </item>
-   <item row="15" column="1">
-    <spacer name="verticalSpacer_3">
+   <item row="21" column="1">
+    <spacer name="verticalSpacer_7">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
      <property name="sizeHint" stdset="0">
       <size>
        <width>20</width>
-       <height>62</height>
+       <height>60</height>
       </size>
      </property>
     </spacer>
diff --git a/app/kipiinterface.h b/app/kipiinterface.h
index 45fb03b..d2a9e23 100644
--- a/app/kipiinterface.h
+++ b/app/kipiinterface.h
@@ -116,4 +116,3 @@ private:
 
 } // namespace
 #endif /* KIPIINTERFACE_H */
-
diff --git a/app/viewmainpage.cpp b/app/viewmainpage.cpp
index 7caf099..439ccd6 100644
--- a/app/viewmainpage.cpp
+++ b/app/viewmainpage.cpp
@@ -58,6 +58,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #include <lib/statusbartoolbutton.h>
 #include <lib/thumbnailview/thumbnailbarview.h>
 #include <lib/zoomwidget.h>
+#include <lib/zoommode.h>
 
 namespace Gwenview
 {
@@ -163,6 +164,7 @@ struct ViewMainPagePrivate
     bool mFullScreenMode;
     bool mCompareMode;
     bool mThumbnailBarVisibleBeforeFullScreen;
+    ZoomMode::Enum mZoomMode;
 
     void setupThumbnailBar()
     {
@@ -489,20 +491,13 @@ void ViewMainPage::loadConfig()
         d->mThumbnailBar->setUpdatesEnabled(true);
     }
 
-    if (GwenviewConfig::showLockZoomButton()) {
-        d->mZoomWidget->setZoomLocked(GwenviewConfig::lockZoom());
-    } else {
-        d->mZoomWidget->setLockZoomButtonVisible(false);
-    }
+    d->mZoomMode = GwenviewConfig::zoomMode();
 }
 
 void ViewMainPage::saveConfig()
 {
     d->saveSplitterConfig();
     GwenviewConfig::setThumbnailBarIsVisible(d->mToggleThumbnailBarAction->isChecked());
-    if (GwenviewConfig::showLockZoomButton()) {
-        GwenviewConfig::setLockZoom(d->mZoomWidget->isZoomLocked());
-    }
 }
 
 void ViewMainPage::setThumbnailBarVisibility(bool visible)
@@ -638,11 +633,11 @@ void ViewMainPage::openUrls(const KUrl::List& allUrls, const KUrl& currentUrl)
     if (!d->mDocumentViews.isEmpty()) {
         d->mDocumentViewContainer->updateSetup(d->mDocumentViews.last());
     }
-    if (!d->mDocumentViews.isEmpty() && d->mZoomWidget->isZoomLocked()) {
-        setup = d->mDocumentViews.last()->setup();
-    } else {
+    if (d->mDocumentViews.isEmpty() || d->mZoomMode == ZoomMode::Autofit) {
         setup.valid = true;
         setup.zoomToFit = true;
+    } else {
+        setup = d->mDocumentViews.last()->setup();
     }
     // Destroy views which show urls we don't care about, remove from "urls" the
     // urls which already have a view.
@@ -687,7 +682,7 @@ void ViewMainPage::openUrls(const KUrl::List& allUrls, const KUrl& currentUrl)
         KUrl url = it.key();
         DocumentView* view = it.value();
         DocumentView::Setup savedSetup = d->mDocumentViewContainer->savedSetup(url);
-        view->openUrl(url, savedSetup.valid ? savedSetup : setup);
+        view->openUrl(url, d->mZoomMode == ZoomMode::Individual && savedSetup.valid ? savedSetup : setup);
         d->mActivityResources.value(view)->setUri(url);
     }
 
diff --git a/cmake/FindLCMS2.cmake b/cmake/FindLCMS2.cmake
index cc17e9f..53231ed 100644
--- a/cmake/FindLCMS2.cmake
+++ b/cmake/FindLCMS2.cmake
@@ -30,7 +30,7 @@ find_path(LCMS2_INCLUDE_DIR lcms2.h
 )
 
 find_library(LCMS2_LIBRARIES NAMES lcms2 liblcms2 lcms-2 liblcms-2
-   PATHS     
+   PATHS
    ${PC_LCMS2_LIBDIR}
    ${PC_LCMS2_LIBRARY_DIRS}
    PATH_SUFFIXES lcms2
@@ -69,4 +69,3 @@ else()
 endif()
 
 mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARIES LCMS2_VERSION)
-
diff --git a/devdoc/CONTRIBUTING.md b/devdoc/CONTRIBUTING.md
index ffdb7f7..2efc8f2 100644
--- a/devdoc/CONTRIBUTING.md
+++ b/devdoc/CONTRIBUTING.md
@@ -43,4 +43,3 @@ is required to make it easy to rollback the merge if need be.
     git merge --no-ff origin/KDE/4.x
     # Check merge is correct
     git push
-
diff --git a/doc/index.docbook b/doc/index.docbook
index d3266b8..4509f67 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -52,7 +52,7 @@
 <keyword>picture</keyword>
 </keywordset>
 </bookinfo>
-<!--FIXME Read devels blog on http://agateau.com/ 
+<!--FIXME Read devels blog on http://agateau.com/
 -->
 <chapter id="introduction">
 <title>Introduction</title>
@@ -64,8 +64,8 @@
 &kappname; is a fast and easy to use image and video viewer for KDE.
 </para>
 
- <para> 
-Gwenview features two main modes: Browse and View. Both modes can be used 
+ <para>
+Gwenview features two main modes: Browse and View. Both modes can be used
 in a normal application window and Full Screen. Browse Mode
 lets you navigate through your computer showing thumbnails of your images, View
 Mode lets you view images one at a time, and Full Screen lets you make quick
@@ -81,7 +81,7 @@ with an alpha channel (transparency) as well as animations.</para>
 images. Lossless JPEG transforms such as rotations and mirroring are also supported.</para>
 
 <para>&kappname; can read embedded color profiles from PNG and JPEG files.
-It can use the image color profile together with the display color profile 
+It can use the image color profile together with the display color profile
 to output correct colors on the screen.</para>
 </sect1>
 
@@ -198,12 +198,12 @@ on your images.  For more information, see the
 
 <para>
 Moving the mouse over an image shows buttons to select or rotate the image as well as
-a button to enter Fullscreen Mode. 
+a button to enter Fullscreen Mode.
 Modified images are indicated by an icon down right, click it to save the changed image.
 Clicking on an image takes you into View
 Mode.  You may select multiple images and switch to View Mode to view them side-by-side.</para>
 
-<para>The slider at the bottom right allows you to change the size of the images. 
+<para>The slider at the bottom right allows you to change the size of the images.
 You can also filter the images by filename, date, tag or rating using the box on the
 lower left. The toolbar appears in both Browse mode as well as View
 mode and contains the most commonly used actions. </para>
@@ -264,12 +264,12 @@ button are next to the zoom slider and are two preset zoom levels. The
 of the window, and the <guibutton>100%</guibutton> button zooms the image to
 the actual pixel size. The shortcut <keycap>F</keycap> toggles between both view modes.</para>
 
-<para>When an image is in zoom-to-fit mode, you can go to the previous and next 
-image with the arrow keys. When you zoom in, arrow keys are used to scroll the image. 
+<para>When an image is in zoom-to-fit mode, you can go to the previous and next
+image with the arrow keys. When you zoom in, arrow keys are used to scroll the image.
 This is very similar to the behavior provided by phones or digital cameras.</para>
 
-<para>When an image is zoomed in, a bird-eye view appears and lets you scroll 
-the image using the mouse and the arrow keys. The bird-eye view automatically hides 
+<para>When an image is zoomed in, a bird-eye view appears and lets you scroll
+the image using the mouse and the arrow keys. The bird-eye view automatically hides
 itself after a short delay, showing back only while zooming or scrolling.</para>
 
 <tip><para>You can start directly in View mode by starting &kappname; from a
@@ -329,7 +329,7 @@ button on the toolbar, or by
 <sect2>
 <title>Browse Mode Full Screen</title>
 
-<para>In Browse Mode you can switch to fullscreen also by clicking on the button that 
+<para>In Browse Mode you can switch to fullscreen also by clicking on the button that
 appears when you move the mouse over the thumbnails.
 </para>
 <screenshot>
@@ -340,9 +340,9 @@ appears when you move the mouse over the thumbnails.
     </imageobject>
   </mediaobject>
 </screenshot>
-<para>Going fullscreen while browsing gives you a more immersive experience while 
-you go through your pictures. It is quite nice on your regular computer, but makes 
-even more sense when you connect your laptop to the big TV in the living room to show 
+<para>Going fullscreen while browsing gives you a more immersive experience while
+you go through your pictures. It is quite nice on your regular computer, but makes
+even more sense when you connect your laptop to the big TV in the living room to show
 pictures to your guests.
 </para>
 </sect2>
@@ -410,8 +410,8 @@ not appear by default in Browse Mode.  Its appearance can be toggled using
 <guimenu>View</guimenu>
 <guimenuitem>Sidebar</guimenuitem>
 </menuchoice>
-or using the <guiicon>▮←</guiicon> / <guiicon>▮→</guiicon> button at the left side 
-of the statusbar. When clicked it collapses or expands the sidebar. 
+or using the <guiicon>▮←</guiicon> / <guiicon>▮→</guiicon> button at the left side
+of the statusbar. When clicked it collapses or expands the sidebar.
 The sidebar contains several tabs:</para>
 
 <variablelist>
@@ -456,7 +456,7 @@ in the &kde; Device Notifier after connecting a supported device.</para>
 
 <para>When you plug in a device the &kappname; importer recursively lists all images and videos.
 </para>
-<para>This is not always what you expect, ⪚ plugging a smartphone you do not want to list all medias 
+<para>This is not always what you expect, ⪚ plugging a smartphone you do not want to list all medias
 of the device; but only the pictures you took, which are usually in a special subfolder.
 </para>
 
@@ -468,8 +468,8 @@ of the device; but only the pictures you took, which are usually in a special su
     </imageobject>
   </mediaobject>
 </screenshot>
-<para>It is possible to select the root folder to list, and &kappname; Importer will remember the 
-last root folder for each device. This way, next time you plug a device in, only the relevant 
+<para>It is possible to select the root folder to list, and &kappname; Importer will remember the
+last root folder for each device. This way, next time you plug a device in, only the relevant
 pictures and videos should be listed.
 </para>
 
diff --git a/lib/archiveutils.h b/lib/archiveutils.h
index db79771..b1b047f 100644
--- a/lib/archiveutils.h
+++ b/lib/archiveutils.h
@@ -58,4 +58,3 @@ GWENVIEWLIB_EXPORT QString protocolForMimeType(const QString& mimeType);
 
 } // namespace Gwenview
 #endif
-
diff --git a/lib/cms/iccjpeg.c b/lib/cms/iccjpeg.c
index 1f6c4b1..7cbec5e 100644
--- a/lib/cms/iccjpeg.c
+++ b/lib/cms/iccjpeg.c
@@ -12,7 +12,7 @@
  *
  * The above copyright notice and this permission notice shall be included
  * in all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/lib/documentview/documentview.cpp b/lib/documentview/documentview.cpp
index 1ab8bbb..0b8d201 100644
--- a/lib/documentview/documentview.cpp
+++ b/lib/documentview/documentview.cpp
@@ -146,7 +146,11 @@ struct DocumentViewPrivate
         q->adapterChanged();
         q->positionChanged();
         if (adapter->canZoom()) {
-            q->zoomToFitChanged(adapter->zoomToFit());
+            if (adapter->zoomToFit()) {
+                q->zoomToFitChanged(true);
+            } else {
+                q->zoomChanged(adapter->zoom());
+            }
         }
         if (adapter->rasterImageView()) {
             QObject::connect(adapter->rasterImageView(), SIGNAL(currentToolChanged(AbstractRasterImageViewTool*)),
diff --git a/lib/gwenviewconfig.kcfg b/lib/gwenviewconfig.kcfg
index 92d39f7..96925df 100644
--- a/lib/gwenviewconfig.kcfg
+++ b/lib/gwenviewconfig.kcfg
@@ -6,6 +6,7 @@
                         http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
     <kcfgfile name="gwenviewrc"/>
     <include>lib/sorting.h</include>
+    <include>lib/zoommode.h</include>
     <include>lib/mousewheelbehavior.h</include>
     <include>lib/documentview/documentview.h</include>
     <include>lib/documentview/rasterimageview.h</include>
@@ -129,14 +130,24 @@
             <default>DocumentView::SoftwareAnimation</default>
         </entry>
 
-        <entry name="ShowLockZoomButton" type="Bool">
-            <default>false</default>
-        </entry>
-
-        <entry name="LockZoom" type="Bool">
-            <default>false</default>
-            <whatsthis>Defines what happens when going to image B after having zoomed an area of image A.
-                When true: zoom and position is kept. When false: image B is zoomed out to fit the screen.</whatsthis>
+        <entry name="ZoomMode" type="Enum">
+                <choices name="Gwenview::ZoomMode::Enum">
+                <choice name="ZoomMode::Autofit"/>
+                <choice name="ZoomMode::KeepSame"/>
+                <choice name="ZoomMode::Individual"/>
+            </choices>
+            <default>ZoomMode::Autofit</default>
+            <whatsthis>Defines what happens when going to image B after
+            having zoomed in on an area of image A.  If set to Autofit,
+            image B is zoomed out to fit the screen.  If set to KeepSame,
+            all images share the same zoom and position: image B is set
+            to the same zoom parameters as image A (and if these are
+            changed, image A will then be displayed with the updated zoom
+            and position).  If set to Individual, all images remember
+            their own zoom and position: image B is initially set to the
+            same zoom parameters as image A, but will then remember its
+            own zoom and position (if these are changed, image A will NOT
+            be displayed with the updated zoom and position).</whatsthis>
         </entry>
     </group>
 
@@ -251,4 +262,3 @@
     </group>
 
 </kcfg>
-
diff --git a/lib/zoommode.h b/lib/zoommode.h
new file mode 100644
index 0000000..ed9cbba
--- /dev/null
+++ b/lib/zoommode.h
@@ -0,0 +1,49 @@
+// vim: set tabstop=4 shiftwidth=4 expandtab:
+/*
+Gwenview: an image viewer
+Copyright 2008 Aurélien Gâteau <agateau at kde.org>
+Copyright 2014 John Zaitseff <J.Zaitseff at zap.org.au>
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
+
+*/
+#ifndef ZOOMMODE_H
+#define ZOOMMODE_H
+
+// Qt
+
+// KDE
+
+// Local
+
+namespace Gwenview
+{
+
+namespace ZoomMode
+{
+/**
+ * This enum represents the different zoom modes.
+ */
+enum Enum {
+    Autofit,
+    KeepSame,
+    Individual
+};
+
+} // namespace ZoomMode
+
+} // namespace Gwenview
+
+#endif /* ZOOMMODE_H */
diff --git a/lib/zoomwidget.cpp b/lib/zoomwidget.cpp
index da66a56..7ca8aa6 100644
--- a/lib/zoomwidget.cpp
+++ b/lib/zoomwidget.cpp
@@ -67,8 +67,6 @@ struct ZoomWidgetPrivate
     QAction* mZoomToFitAction;
     QAction* mActualSizeAction;
 
-    QToolButton* mLockZoomButton;
-
     bool mZoomUpdatedBySlider;
 
     void emitZoomChanged()
@@ -113,12 +111,6 @@ ZoomWidget::ZoomWidget(QWidget* parent)
     d->mZoomSlider->slider()->setPageStep(3 * int(PRECISION));
     connect(d->mZoomSlider->slider(), SIGNAL(actionTriggered(int)), SLOT(slotZoomSliderActionTriggered()));
 
-    d->mLockZoomButton = new QToolButton;
-    d->mLockZoomButton->setAutoRaise(true);
-    d->mLockZoomButton->setCheckable(true);
-    updateLockZoomButton();
-    connect(d->mLockZoomButton, SIGNAL(toggled(bool)), SLOT(updateLockZoomButton()));
-
     // Layout
     QHBoxLayout* layout = new QHBoxLayout(this);
     layout->setMargin(0);
@@ -127,7 +119,6 @@ ZoomWidget::ZoomWidget(QWidget* parent)
     layout->addWidget(d->mActualSizeButton);
     layout->addWidget(d->mZoomSlider);
     layout->addWidget(d->mZoomLabel);
-    layout->addWidget(d->mLockZoomButton);
 }
 
 ZoomWidget::~ZoomWidget()
@@ -190,24 +181,4 @@ void ZoomWidget::setMaximumZoom(qreal zoom)
     d->mZoomSlider->setMaximum(sliderValueForZoom(zoom));
 }
 
-bool ZoomWidget::isZoomLocked() const
-{
-    return d->mLockZoomButton->isVisible() && d->mLockZoomButton->isChecked();
-}
-
-void ZoomWidget::setZoomLocked(bool locked)
-{
-    d->mLockZoomButton->setChecked(locked);
-}
-
-void ZoomWidget::setLockZoomButtonVisible(bool visible)
-{
-    d->mLockZoomButton->setVisible(visible);
-}
-
-void ZoomWidget::updateLockZoomButton()
-{
-    d->mLockZoomButton->setIcon(KIcon(d->mLockZoomButton->isChecked() ? "object-locked" : "object-unlocked"));
-}
-
 } // namespace
diff --git a/lib/zoomwidget.h b/lib/zoomwidget.h
index b181f5a..d5de70b 100644
--- a/lib/zoomwidget.h
+++ b/lib/zoomwidget.h
@@ -45,11 +45,6 @@ public:
 
     void setActions(QAction* zoomToFitAction, QAction* actualSizeAction, QAction* zoomInAction, QAction* zoomOutAction);
 
-    bool isZoomLocked() const;
-    void setZoomLocked(bool);
-
-    void setLockZoomButtonVisible(bool);
-
 public Q_SLOTS:
     void setZoom(qreal zoom);
 
@@ -61,7 +56,6 @@ Q_SIGNALS:
 
 private Q_SLOTS:
     void slotZoomSliderActionTriggered();
-    void updateLockZoomButton();
 
 private:
     friend struct ZoomWidgetPrivate;
diff --git a/part/gvpart.rc b/part/gvpart.rc
index 35703a7..7af31d6 100644
--- a/part/gvpart.rc
+++ b/part/gvpart.rc
@@ -19,4 +19,3 @@
 	<Action name="view_zoom_out"/>
 </ToolBar>
 </kpartgui>
-


More information about the kde-doc-english mailing list