Commit 9b1714fc authored by Henrik Fehlauer's avatar Henrik Fehlauer

Enlarge small SVGs too

Summary:
For images smaller than the viewport at 100% zoom, Gwenview allows to
scale up the image to {nav Fit} the window if {nav Enlarge smaller images}
is checked in the configuration dialog. So far this only worked for
raster-based images, but not for SVGs.

`mEnlargeSmallerImages` is meant to be handled by the abstract base
class `AbstractImageView`, however when f00cef3c moved code over there
from `RasterImageView`, it was missed to also adapt `SvgImageView`. This
can be fixed by implementing the missing function.

In addition, a left-over `bool` is removed.

BUG: 364822
FIXED-IN: 17.12.3

Test Plan:
- Open `icons/hisc-apps-gwenview.svgz`, press {nav Fit}: Small icon shown.
- Check {nav Enlarge smaller images}, press {nav Fit} again: Icon scaled up to fit window.
- Enlarging raster-based images still works fine.

Reviewers: #gwenview, huoni, muhlenpfordt, ngraham

Reviewed By: #gwenview, huoni, muhlenpfordt, ngraham

Subscribers: ngraham, muhlenpfordt, huoni

Differential Revision: https://phabricator.kde.org/D10926
parent ca181efd
......@@ -53,7 +53,6 @@ struct RasterImageViewPrivate
// Config
RasterImageView::AlphaBackgroundMode mAlphaBackgroundMode;
QColor mAlphaBackgroundColor;
bool mEnlargeSmallerImages;
// /Config
bool mBufferIsEmpty;
......@@ -202,7 +201,6 @@ RasterImageView::RasterImageView(QGraphicsItem* parent)
d->mAlphaBackgroundMode = AlphaBackgroundCheckBoard;
d->mAlphaBackgroundColor = Qt::black;
d->mEnlargeSmallerImages = false;
d->mBufferIsEmpty = true;
d->mScaler = new ImageScaler(this);
......
......@@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include "document/documentfactory.h"
#include <qgraphicssceneevent.h>
#include <lib/gvdebug.h>
#include <lib/gwenviewconfig.h>
namespace Gwenview
{
......@@ -144,6 +145,11 @@ Document::Ptr SvgViewAdapter::document() const
return d->mView->document();
}
void SvgViewAdapter::loadConfig()
{
d->mView->setEnlargeSmallerImages(GwenviewConfig::enlargeSmallerImages());
}
void SvgViewAdapter::setZoomToFit(bool on)
{
d->mView->setZoomToFit(on);
......
......@@ -73,6 +73,8 @@ public:
virtual Document::Ptr document() const Q_DECL_OVERRIDE;
virtual void loadConfig() Q_DECL_OVERRIDE;
virtual MimeTypeUtils::Kind kind() const Q_DECL_OVERRIDE
{
return MimeTypeUtils::KIND_SVG_IMAGE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment