diff --git a/app/configdialog.cpp b/app/configdialog.cpp
--- a/app/configdialog.cpp
+++ b/app/configdialog.cpp
@@ -70,6 +70,7 @@
mAlphaBackgroundModeGroup->setObjectName(QLatin1String("kcfg_AlphaBackgroundMode"));
mAlphaBackgroundModeGroup->addButton(mImageViewConfigPage.checkBoardRadioButton, int(AbstractImageView::AlphaBackgroundCheckBoard));
mAlphaBackgroundModeGroup->addButton(mImageViewConfigPage.solidColorRadioButton, int(AbstractImageView::AlphaBackgroundSolid));
+ mAlphaBackgroundModeGroup->addButton(mImageViewConfigPage.noBackgroundRadioButton, int(AbstractImageView::AlphaBackgroundNone));
mWheelBehaviorGroup = new InvisibleButtonGroup(widget);
mWheelBehaviorGroup->setObjectName(QLatin1String("kcfg_MouseWheelBehavior"));
diff --git a/app/imageviewconfigpage.ui b/app/imageviewconfigpage.ui
--- a/app/imageviewconfigpage.ui
+++ b/app/imageviewconfigpage.ui
@@ -7,29 +7,25 @@
0
0
500
- 600
+ 611
- -
-
-
- Transparent background:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- checkBoardRadioButton
-
-
-
-
6
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -57,12 +53,87 @@
+ -
+
+
+ Mouse wheel behavior:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ mouseWheelScrollRadioButton
+
+
+
+ -
+
+
+ Transparent background:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ checkBoardRadioButton
+
+
+
+ -
+
+
-
+
+
+ Browse
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 207
+ 17
+
+
+
+
-
6
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -97,49 +168,33 @@
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 207
- 17
-
-
-
-
- -
-
+
-
+
- Mouse wheel behavior:
+ Zoom mode:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- mouseWheelScrollRadioButton
+ autofitZoomModeRadioButton
- -
-
+
-
+
-
-
+
- Scroll
+ Autofit each image
true
-
-
+
Qt::Horizontal
@@ -153,17 +208,20 @@
- -
-
+
-
+
-
-
+
- Browse
+ Scroll
+
+
+ true
-
-
+
Qt::Horizontal
@@ -177,7 +235,7 @@
- -
+
-
Qt::Vertical
@@ -193,47 +251,7 @@
- -
-
-
- Zoom mode:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- autofitZoomModeRadioButton
-
-
-
- -
-
-
-
-
-
- Autofit each image
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
+
-
-
@@ -257,7 +275,7 @@
- -
+
-
-
@@ -281,7 +299,7 @@
- -
+
-
Qt::Vertical
@@ -297,7 +315,7 @@
- -
+
-
-
@@ -321,7 +339,7 @@
- -
+
-
Qt::Vertical
@@ -337,7 +355,7 @@
- -
+
-
Animations:
@@ -350,7 +368,7 @@
- -
+
-
-
@@ -377,7 +395,7 @@
- -
+
-
-
@@ -401,7 +419,7 @@
- -
+
-
-
@@ -425,7 +443,7 @@
- -
+
-
Qt::Vertical
@@ -441,14 +459,14 @@
- -
+
-
<b>Thumbnail Bar</b>
- -
+
-
Qt::Vertical
@@ -464,7 +482,7 @@
- -
+
-
Orientation:
@@ -477,7 +495,7 @@
- -
+
-
-
@@ -501,7 +519,7 @@
- -
+
-
-
@@ -525,7 +543,31 @@
- -
+
-
+
+
-
+
+
+ None
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
Row count:
@@ -538,7 +580,7 @@
- -
+
-
-
@@ -565,7 +607,7 @@
- -
+
-
Qt::Vertical
@@ -586,11 +628,6 @@
QPushButton
-
- QSpinBox
- QSpinBox
-
-
checkBoardRadioButton
diff --git a/lib/documentview/abstractimageview.h b/lib/documentview/abstractimageview.h
--- a/lib/documentview/abstractimageview.h
+++ b/lib/documentview/abstractimageview.h
@@ -46,7 +46,8 @@
};
enum AlphaBackgroundMode {
AlphaBackgroundCheckBoard,
- AlphaBackgroundSolid
+ AlphaBackgroundSolid,
+ AlphaBackgroundNone
};
AbstractImageView(QGraphicsItem* parent);
diff --git a/lib/documentview/rasterimageview.h b/lib/documentview/rasterimageview.h
--- a/lib/documentview/rasterimageview.h
+++ b/lib/documentview/rasterimageview.h
@@ -51,6 +51,7 @@
void setAlphaBackgroundMode(AlphaBackgroundMode mode) Q_DECL_OVERRIDE;
void setAlphaBackgroundColor(const QColor& color) Q_DECL_OVERRIDE;
+ void setViewBackgroundValue(int value);
void setRenderingIntent(const RenderingIntent::Enum& renderingIntent);
Q_SIGNALS:
diff --git a/lib/documentview/rasterimageview.cpp b/lib/documentview/rasterimageview.cpp
--- a/lib/documentview/rasterimageview.cpp
+++ b/lib/documentview/rasterimageview.cpp
@@ -49,6 +49,7 @@
// Config
AbstractImageView::AlphaBackgroundMode mAlphaBackgroundMode;
QColor mAlphaBackgroundColor;
+ int mViewBackgroundValue;
cmsUInt32Number mRenderingIntent;
bool mEnlargeSmallerImages;
// /Config
@@ -164,17 +165,30 @@
void drawAlphaBackground(QPainter* painter, const QRect& viewportRect, const QPoint& zoomedImageTopLeft, QPixmap texture)
{
- if (mAlphaBackgroundMode == AbstractImageView::AlphaBackgroundCheckBoard) {
- QPoint textureOffset(
- zoomedImageTopLeft.x() % texture.width(),
- zoomedImageTopLeft.y() % texture.height()
- );
- painter->drawTiledPixmap(
- viewportRect,
- texture,
- textureOffset);
- } else {
- painter->fillRect(viewportRect, mAlphaBackgroundColor);
+ switch (mAlphaBackgroundMode) {
+ case (AbstractImageView::AlphaBackgroundCheckBoard): {
+ QPoint textureOffset(
+ zoomedImageTopLeft.x() % texture.width(),
+ zoomedImageTopLeft.y() % texture.height()
+ );
+ painter->drawTiledPixmap(
+ viewportRect,
+ texture,
+ textureOffset);
+ break;
+ }
+ case (AbstractImageView::AlphaBackgroundSolid): {
+ painter->fillRect(viewportRect, mAlphaBackgroundColor);
+ break;
+ }
+ case (AbstractImageView::AlphaBackgroundNone): {
+ // Need to fake lack of background by drawing the main view background color
+ painter->fillRect(viewportRect, QColor::fromHsv(0, 0, mViewBackgroundValue));
+ break;
+ }
+ default: {
+ // Should never reach here because we cover all enum options
+ }
}
}
};
@@ -190,6 +204,7 @@
d->mAlphaBackgroundMode = AlphaBackgroundCheckBoard;
d->mAlphaBackgroundColor = Qt::black;
+ d->mViewBackgroundValue = 0;
d->mRenderingIntent = INTENT_PERCEPTUAL;
d->mEnlargeSmallerImages = false;
@@ -229,6 +244,11 @@
}
}
+void RasterImageView::setViewBackgroundValue(int value)
+{
+ d->mViewBackgroundValue = value;
+}
+
void RasterImageView::setRenderingIntent(const RenderingIntent::Enum& renderingIntent)
{
if (d->mRenderingIntent != renderingIntent) {
diff --git a/lib/documentview/rasterimageviewadapter.cpp b/lib/documentview/rasterimageviewadapter.cpp
--- a/lib/documentview/rasterimageviewadapter.cpp
+++ b/lib/documentview/rasterimageviewadapter.cpp
@@ -138,6 +138,7 @@
{
d->mView->setAlphaBackgroundMode(GwenviewConfig::alphaBackgroundMode());
d->mView->setAlphaBackgroundColor(GwenviewConfig::alphaBackgroundColor());
+ d->mView->setViewBackgroundValue(GwenviewConfig::viewBackgroundValue());
d->mView->setRenderingIntent(GwenviewConfig::renderingIntent());
d->mView->setEnlargeSmallerImages(GwenviewConfig::enlargeSmallerImages());
}
diff --git a/lib/documentview/svgviewadapter.cpp b/lib/documentview/svgviewadapter.cpp
--- a/lib/documentview/svgviewadapter.cpp
+++ b/lib/documentview/svgviewadapter.cpp
@@ -130,6 +130,10 @@
painter->fillRect(imageRect, mAlphaBackgroundColor);
break;
}
+ case AbstractImageView::AlphaBackgroundNone: {
+ // Unlike RasterImageView, SVGs are rendered directly on the image view,
+ // therefore we can simply not draw a background
+ }
default: {
// Should never reach here because we cover all enum options
}
diff --git a/lib/gwenviewconfig.kcfg b/lib/gwenviewconfig.kcfg
--- a/lib/gwenviewconfig.kcfg
+++ b/lib/gwenviewconfig.kcfg
@@ -121,6 +121,7 @@
+
AbstractImageView::AlphaBackgroundCheckBoard