1. 09 Apr, 2018 1 commit
    • Huon Imberger's avatar
      Add support for configurable transparent background to SVGs · 836ec0e4
      Huon Imberger authored
      SVGs do not honor the "Transparent background" config option, and simply have no
      background at all. This patch ensures this option is applied to SVGs as well as
      raster images.
      Unlike `RasterImageView` that uses a `QPixmap` buffer (`mCurrentBuffer`) for drawing
      the background and the image, SVGs are rendered directly on top of `SvgImageView`
      (`QGraphicsWidget`). Therefore we just paint the background in `SvgImageView::paint`
      which happens before the SVG is rendered.
      We move the checkboard texture code to `AbstractImageView` now that it's used by
      both subclasses `RasterImageView` and `SvgImageView`.
      This patch also configures kconf_update due to the moving of the above enum.
      Since I didn't want to litter `/app` with files, I've moved the update files to
      Fixes T8125
      Test Plan:
        - Open an SVG with solid color config option
        - Open and SVG with checkboard background config. At a high enough zoom (where the
          birdseye view shows up), panning/scrolling should have the checkboard pattern
          fixed to the image, like raster images
        - Ensure raster images with transparent backgrounds are unaffected
      ## kconf_update
      The script `gwenview-imageview-alphabackgroundmode-update.pl` must be in
      `/usr/share/kconf_update` in order for `/usr/lib/kf5/kconf_update` to find it.
      If successfull, instances of `RasterImageView::AlphaBackground*` should change to
      Reviewers: #gwenview, rkflx, ngraham
      Reviewed By: #gwenview, rkflx, ngraham
      Tags: #gwenview
      Maniphest Tasks: T8125
      Differential Revision: https://phabricator.kde.org/D11629
  2. 08 Apr, 2018 2 commits
    • Peter Mühlenpfordt's avatar
    • Peter Mühlenpfordt's avatar
      Fix thumbnail bar update after editing a viewed image · e359ebf1
      Peter Mühlenpfordt authored
      After editing an image (e.g. rotate) a new thumbnail is created but
      it is not repainted in the View Mode thumbnail bar.
      The custom signals `documentChanged` and `busyStateChanged` provide
      a `QModelIndex` for the modified document but this is based on the
      source model and cannot be used in `ThumbnailBarView` where the list
      view is based on a filtered proxy model and the index is wrong or
      does not exist in some cases.
      This patch uses the QUrl as argument for both signals and gets the
      proper index for the current model in the receiver view.
      FIXED-IN: 18.04.0
      Test Plan:
      * Open image in Gwenview View Mode
      * Enable thumbnail bar ({key Ctrl B})
      * Edit image (e.g. rotate with {key Ctrl R})
      * Edit a second time (same or another image)
      * Thumbnail should always correspond to edited image
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: rkflx, huoni
      Differential Revision: https://phabricator.kde.org/D11714
  3. 07 Apr, 2018 1 commit
    • Huon Imberger's avatar
      Fix SVGs overlapping selection rect in View compare mode · d5ab1869
      Huon Imberger authored
      Zooming an SVG in compare mode allowed the SVG to be painted outside its
      parent widget `SvgImageView`, effectively overlapping the selection rect
      which is drawn in `DocumentView::paint`. This patch clips all painting
      done by children of `AbstractImageView` to its own shape, therefore
      fixing the issue.
      {F5790186, size=full}
      {F5790283, size=full}
      Test Plan:
      Open an SVG image in comparison mode.
      Zoom in enough so it fills the entire document view (and therefore
      can be panned).
      Image should not draw over the selection rectangle.
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: muhlenpfordt
      Differential Revision: https://phabricator.kde.org/D11942
  4. 05 Apr, 2018 2 commits
    • __ __'s avatar
    • Silas Lenz's avatar
      Update window title when changing selection in comparison mode · a7819f6e
      Silas Lenz authored
      The window title now updates with the currently selected image when the user changes the selection in comparison mode.
      BUG: 314724
      Test Plan:
      View and select different images with and without comparison mode and verify the title.
      Resize images by resizing the window or selecting/deselecting images while in comparison mode and verify the title.
      View and switch between images in normal mode to verify it still works, including title updates.
      Reviewers: #gwenview, ngraham, rkflx
      Reviewed By: #gwenview, ngraham, rkflx
      Subscribers: muhlenpfordt, ngraham, rkflx, #gwenview
      Tags: #gwenview
      Differential Revision: https://phabricator.kde.org/D11105
  5. 04 Apr, 2018 2 commits
  6. 03 Apr, 2018 3 commits
  7. 02 Apr, 2018 1 commit
  8. 22 Mar, 2018 11 commits
    • __ __'s avatar
    • __ __'s avatar
      Adapt code to new crop terminology too · d3f4793e
      __ __ authored
      D11578 changes UI strings from "Restrict to image ratio" to
      "Preserve aspect ratio". Here we adapt the naming of functions and
      config variables too, to lessen developer confusion.
      Test Plan: Compile, grep for "restrict"
      Reviewers: #gwenview, ngraham, huoni
      Reviewed By: huoni
      Differential Revision: https://phabricator.kde.org/D11589
    • Nate Graham's avatar
      Use more user-friendly terminology in the crop tool · 9558f487
      Nate Graham authored
      Summary: Use the term "Preserve aspect ratio" to make the crop tool a bit more user-friendly.
      Test Plan:
      Reviewers: #gwenview, huoni, rkflx
      Reviewed By: #gwenview, huoni, rkflx
      Subscribers: richardbowen
      Differential Revision: https://phabricator.kde.org/D11578
    • __ __'s avatar
    • __ __'s avatar
      Polish wording in crop ratio combobox · ab8a25ad
      __ __ authored
      576cfa68 enabled the clear button in the {nav Crop} ratio combobox.
      This resulted in an even wider toolbar at the bottom, because the
      combobox automatically adjusts its width to its widest entry,
      potentially cutting off the toolbar at the right even more than before.
      As all other entries also lack the "size" moniker, we can just drop it
      for {nav ISO size (A4, A3, …)}. Even the original entry before the
      change in a028ea5c lacked "size" in the naming.
      Test Plan
      Open {nav Crop} tool in {nav Advanced} mode and inspect the ratio
      combobox (now with consistent wording) as well as the width of the crop
      toolbar (now less wide).
      Reviewers: #gwenview, ngraham, huoni
      Reviewed By: ngraham
      Differential Revision: https://phabricator.kde.org/D11579
    • Huon Imberger's avatar
    • Huon Imberger's avatar
      Lock crop ratio to current rect when holding Ctrl/Shift · ef8bfd40
      Huon Imberger authored
      In many graphics apps, holding Ctrl and/or Shift locks the ratio of
      the rectangle being resized, making it quicker than manually choosing
      a ratio. This patch adds this functionality to the Crop tool.
      When Ctrl or Shift is pressed, the current ratio of the crop rect
      is saved, "locking it". When resizing, so long as Ctrl or Shift is
      pressed, the ratio is enforced to this locked value. Otherwise it
      behaves the same as before - enforcing ratio if one was chosen in
      the GUI
      Depends on D11379
      Test Plan:
        - Crop tool behaves normally when Ctrl/Shift not pressed
        - Crop ratio locked when Ctrl/Shift is pressed
        - Ctrl/Shift has no effect if ratio is already restricted
          by the {nav Basic} toggle or {nav Advanced} combobox
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Differential Revision: https://phabricator.kde.org/D11380
    • Huon Imberger's avatar
      Fix crop ratio combobox not updating crop when text didn't change · 0cf3b3d7
      Huon Imberger authored
      For example, "US Letter" is duplicated - one for landscape, one
      for portrait. Since the crop was only updated when the combobox
      text changed, switching between these two didn't do anything.
      This patch adds a connection to the `currentIndexChanged` signal
      so that changes like this are detected.
      Depends on D11378
      Test Plan:
        # Open crop tool > Advanced settings
        # Change Ratio to US Letter (portrait)
        # Change Ratio to US Letter (landscape)
        # Repeat for the ISO ratio
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Differential Revision: https://phabricator.kde.org/D11379
    • Huon Imberger's avatar
      Save last used crop ratio settings · c1e227f1
      Huon Imberger authored
      The crop tool currently remembers if you have Advanced settings enabled.
      This patch similarly remembers the Restrict to image ratio option
      (Basic view) and the chosen Ratio (Advanced view).
      Given how we store the ratios, and allow custom ratios using the same
      combobox, we need to store both the current index of the combobox and
      the ratio values.
      I have removed `CropTool::onWidgetSlidedIn` because all it did was
      ensure the crop rect was set, and we now always load a crop ratio
      triggering the rect to update. If we leave it in, it actually resets
      the rect after the saved ratio is loaded.
      Note that if you enable the crop tool, then go to next image, any
      changes will not be saved, including Advanced settings. This is
      because the config is only saved when the tool is deactivated,
      which is not triggered in this case.
      Depends on D11202
      BUG: 391757
      Reimplement function now needed again, fix bug, add const
      Save blank ratio combobox instead of last chosen ratio (if it's blank)
      Crop ratio combobox is now saved properly
      Test Plan:
      Change ratio constraint with checkbox in {nav Basic} or the combobox
      in {nav Advanced}. Ensure changes are saved after closing the crop tool
      and closing Gwenview entirely.
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Differential Revision: https://phabricator.kde.org/D11378
    • Huon Imberger's avatar
    • Huon Imberger's avatar
      Add ability to constrain crop tool to current image ratio · 576cfa68
      Huon Imberger authored
      The crop tool was lacking the ability to choose the ratio of the current image.
      This patch adds:
        - Checkbox in {nav Normal} to toggle between no restriction (default),
        and restrict to the current image ratio
        - "Current Image" item to the Ratio combobox in {nav Advanced}
        - "Unrestricted" item to the Ratio combobox in {nav Advanced}
        (default, functionally no change from before)
        - Clear button to the Ratio combobox in {nav Advanced}, to help make
        it clear the user can enter a custom ratio
      BUG: 236970
      Test Plan:
        # {nav Image} view > enable crop tool (e.g. by using {key shift}+{key
        # Ensure ratio restrictions work in both {nav Normal} and {nav Advanced}
      The ratio settings in {nav Normal} and {nav Advanced} are independant of
      one another, in prep for future patch which will have these remember the
      chosen setting.
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: muhlenpfordt
      Differential Revision: https://phabricator.kde.org/D11202
  9. 21 Mar, 2018 9 commits
    • __ __'s avatar
    • __ __'s avatar
      Align slideshow terminology to MPRIS behaviour · beef8f3b
      __ __ authored
      9631043c introduced MPRIS support to Gwenview. Common MPRIS
      controllers often only provide "Pause" in the main interface, with
      "Stop" being non-existent or hidden. Therefore "holding" the slideshow
      was mapped to "Pause". "Play" either "Resumes" automatically advancing
      to the next image, or in non-fullscreen mode switches to fullscreen and
      starts playback. Conversely, "Stop" ends playback and exits from
      To keep consistency, we change the tooltip text of the fullscreen button
      controlling the playback to "Pause". In addition, the internal `enum` is
      adapted accordingly to avoid confusing developers.
      Note that the icon on the button still shows a "Pause" symbol as before
      the patch.
      Ref T8222
      Test Plan:
      Start Gwenview normally, with `-f` and with `-s`, and observe the
      tooltip of the playback button in the top fullscreen toolbar as well as
      the button text in non-fullscreen mode (use {nav Configure Toolbars} to
      add it) make sense in every situation.
      Reviewers: #gwenview, kossebau, muhlenpfordt
      Reviewed By: #gwenview, muhlenpfordt
      Subscribers: ltoscano, muhlenpfordt, huoni, kde-doc-english
      Maniphest Tasks: T8222
      Differential Revision: https://phabricator.kde.org/D11495
    • Peter Mühlenpfordt's avatar
    • Peter Mühlenpfordt's avatar
      Fix context menus for Recent Files / Folders on Start Page · 3a02df6e
      Peter Mühlenpfordt authored
      On {nav Start Page > Recent Files} the context menu is missing and
      right clicking on an item switches to View Mode.
      This patch adds the context menu to {nav Recent Files} tab items
      with the entries {nav Add Containing Folder to Places},
      {nav Forget This File} and {nav Forget All Files}. The entries on
      the {nav Recent Folders} tab are renamed accordingly.
      Ref T8194
      FIXED-IN: 18.04.0
      Test Plan:
      * Open some images to populate the recent files/folders lists
      * Go to {nav Start Page}
      * Right click on file / folder items to show context menu
      * Check actions to execute correctly
      * Check if clear actions for recent files sync with {nav File > Open Recent}
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: rkflx
      Maniphest Tasks: T8194
      Differential Revision: https://phabricator.kde.org/D11479
    • Huon Imberger's avatar
    • Huon Imberger's avatar
      Fix crop tool not saving config when navigating away · 312ab20c
      Huon Imberger authored
      Tool settings are saved in `toolDeactivated`, which is only triggered
      when the tool is exited gracefully (e.g. when clicking Crop or Cancel).
      This patch calls `toolDeactivated` when the parent `RasterImageView`
      object is destroyed, ensuring settings are saved even when navigating
      away, e.g. to another image, or back to {nav Browse}.
      BUG: 392036
      Test Plan:
      {nav Crop} tool > activate/deactivate {nav Advanced} > navigate to next
      image > open {nav Crop} tool > ensure the {nav Advanced} state is saved.
      Also navigate away by clicking {nav Browse}.
      Ensure navigating without {nav Crop} active is unaffected.
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Differential Revision: https://phabricator.kde.org/D11535
    • __ __'s avatar
    • __ __'s avatar
      Prettify display of URLs in Recent Folders and Places · b4e9e0fc
      __ __ authored
      Entries in the {nav Recent Folders} tab on the {nav Start Page}
      contained superfluous information like `file://` for local folders and
      the user's home directory, taking away valuable space and unnecessarily
      eliding the text:
      By abbreviating to `~` and omitting the protocol for local folders, the
      entries can look much neater, making them faster to scan for users:
      The changes not only affect the {nav Recent Folders} tab, but also what
      is displayed in the {nav Recent Files} tab and the hover overlays for
      very long entries.
      In addition, adding folders to the {nav Places} panel now uses the last
      subfolder for naming the entry, bringing the behaviour in line with
      BUG: 383850
      FIXED-IN: 18.04.0
      Test Plan:
      - Inspected {nav Recent Folders} and {nav Recent Files} on the {nav Start Page}.
      - In {nav Browse} mode, used {nav File > Add Folder to Places}.
      - Tested that remote paths containing `~` are still intact.
      Reviewers: #gwenview, muhlenpfordt
      Reviewed By: #gwenview, muhlenpfordt
      Subscribers: ngraham, muhlenpfordt
      Differential Revision: https://phabricator.kde.org/D11493
    • __ __'s avatar
      Prevent duplicate slashes in Recent Folders · 79a537ee
      __ __ authored
      Sometimes the {nav Recent Folders} tab on the {nav Start Page} would
      show directory entries with multiple `/` at the end. Clicking on those
      folders works fine, but as the same folder could also be added without
      two slashes, in some cases there were multiple entries for the same
      The duplicate slash is caused by a porting mistake in d760ced7,
      which added `/` unconditionally while `KUrl::AddTrailingSlash` only
      added `/` if there was none at the end. Performing this check manually
      fixes the bug.
      Note that the fix for Bug #312060 (differentiate between home and root
      folder for remote hosts) and what was added in 7eb5472f (no password
      dialog right after startup) are still in effect as well, even after
      porting away from `KUrl`.
      As a side effect, visiting `/` does not result anymore in broken
      {nav Recent Folder} entries (non-functional and showing an error icon).
      KIO warnings are gone, too:
        kf5.kio.core: Invalid URL: QUrl("")
      CCBUG: 383850
      Test Plan:
      Open folder, {nav Go > Up}, switch to {nav Start Page} and notice how
      now the added recent folder only has a single slash at the end. In
      particular, there is only a single entry for this location after
      navigating back and forth again.
      Start `sshd`, `sftp://localhost` still shows home folder,
      `sftp://localhost/` shows root dir. Killing `kiod` and restarting
      Gwenview does not show a password prompt on the {nav Start Page}.
      Visit `/`, switch back to {nav Start Page} and observe that the newly
      added entry shows and works correctly.
      Reviewers: #gwenview, muhlenpfordt
      Reviewed By: #gwenview, muhlenpfordt
      Subscribers: muhlenpfordt
      Differential Revision: https://phabricator.kde.org/D11492
  10. 20 Mar, 2018 2 commits
    • Peter Mühlenpfordt's avatar
    • Peter Mühlenpfordt's avatar
      Extend action "Clear Recent List" to clear model and recent folders · d2afcfe2
      Peter Mühlenpfordt authored
      {nav File > Open Recent > Clear List} clears the displayed list of
      recent files, but the same list in the {nav Start Page > Recent Files}
      tab is not cleared (only after restarting Gwenview).
      This patch extends and renames the menu entry to clear the internal
      models and both tabs {nav Start Page > Recent Files / Folders}.
      Ref T8194
      FIXED-IN: 18.04.0
      Test Plan:
      * Open some images to populate the recent files/folders lists
      * Click {nav File > Open Recent > Forget All Files & Folders}
      * Check if {nav File > Open Recent} is empty
      * Check if {nav Start Page > Recent Files / Folders} are empty
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: rkflx
      Maniphest Tasks: T8194
      Differential Revision: https://phabricator.kde.org/D11477
  11. 19 Mar, 2018 2 commits
  12. 17 Mar, 2018 1 commit
    • Friedrich W. H. Kossebau's avatar
      MPRIS: for images report the slideshow interval as well as timer resets · 4fbffe22
      Friedrich W. H. Kossebau authored
      Setting "mpris:length" "Metadata" property of images matching the interval of the
      slideshow, signalling resets of the "Position" and delivering the
      current timeout progress in the autoadvance timer, all that allows
      MPRIS controllers to show the timely progress in the slideshow.
      Supporting the same for video files is left-out for now, that needs
      some bigger refactoring to have this information properly modelled
      by the slideshow object.
      ((The Plasma media controller applet of <= 5.12 sadly only shows time
      progress information if CanSeek=true. That got fixed for Plasma 5.13,
      which will show a read-only progressbar instead of a slider))
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: rkflx
      Differential Revision: https://phabricator.kde.org/D11359
  13. 15 Mar, 2018 3 commits
    • Gregory Legrain's avatar
      Swap position and size in crop tool · 8d61a5b9
      Gregory Legrain authored
      When one wants to re-use crop settings in gwenview (i.e. position and size), they have to be entered in the following order :
      1/ Size
      2/ Position
      (it is not possible to do it the other way, as position is locked until the size of the crop area is smaller than the size of the image).
      However, the settings are displayed in the reverse order, which is not convenient (un-necessary mouse actions).
      BUG: 391758
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: muhlenpfordt, rkflx, ngraham
      Tags: #gwenview
      Differential Revision: https://phabricator.kde.org/D11329
    • Peter Mühlenpfordt's avatar
      Keep click position in focus on middle-click zoom · 1e66de8f
      Peter Mühlenpfordt authored
      Clicking on an image in View Mode with the middle mouse button toggles
      between `Fit` and `100%` zoom modes. The image zoomed to `100%` is
      always scrolled to the image center.
      This patch keeps the clicked location in focus as it is done while
      zooming with {key Ctrl Scroll}.
      FEATURE: 308335
      Test Plan:
      * Open a big image in View Mode
      * Middle-click on different locations over the image
      * The `100%` zoom view should keep the clicked location in focus
      Reviewers: #gwenview, rkflx
      Reviewed By: #gwenview, rkflx
      Subscribers: rkflx, huoni
      Differential Revision: https://phabricator.kde.org/D11336
    • Friedrich W. H. Kossebau's avatar