[graphics/gwenview] /: Add option to change the background for fullscreen
Antonio Prcela
null at kde.org
Fri Jan 15 20:36:13 GMT 2021
Git commit 275e9288c8b587078b3c4ff75633157a44197eba by Antonio Prcela.
Committed on 15/01/2021 at 20:26.
Pushed by ngraham into branch 'master'.
Add option to change the background for fullscreen
M +6 -1 app/configdialog.cpp
M +1 -0 app/configdialog.h
M +55 -18 app/generalconfigpage.ui
M +8 -3 app/gvcore.cpp
M +14 -0 doc/index.docbook
A +47 -0 lib/fullscreenbackground.h [License: GPL (v2)]
M +8 -1 lib/gwenviewconfig.kcfg
https://invent.kde.org/graphics/gwenview/commit/275e9288c8b587078b3c4ff75633157a44197eba
diff --git a/app/configdialog.cpp b/app/configdialog.cpp
index cb1329f6..a1133c55 100644
--- a/app/configdialog.cpp
+++ b/app/configdialog.cpp
@@ -52,7 +52,12 @@ ConfigDialog::ConfigDialog(QWidget* parent)
// General
widget = setupPage(mGeneralConfigPage);
-
+
+ mFullScreenBackgroundGroup = new InvisibleButtonGroup(widget);
+ mFullScreenBackgroundGroup->setObjectName(QStringLiteral("kcfg_FullScreenBackground"));
+ mFullScreenBackgroundGroup->addButton(mGeneralConfigPage.fullscreenBackgroundBlackRadioButton, int(FullScreenBackground::Black));
+ mFullScreenBackgroundGroup->addButton(mGeneralConfigPage.fullscreenBackgroundImageRadioButton, int(FullScreenBackground::Image));
+
mThumbnailActionsGroup = new InvisibleButtonGroup(widget);
mThumbnailActionsGroup->setObjectName(QStringLiteral("kcfg_ThumbnailActions"));
mThumbnailActionsGroup->addButton(mGeneralConfigPage.allButtonsThumbnailActionsRadioButton, int(ThumbnailActions::AllButtons));
diff --git a/app/configdialog.h b/app/configdialog.h
index 8b3e2682..74c202cb 100644
--- a/app/configdialog.h
+++ b/app/configdialog.h
@@ -48,6 +48,7 @@ private:
InvisibleButtonGroup* mAlphaBackgroundModeGroup = nullptr;
InvisibleButtonGroup* mWheelBehaviorGroup = nullptr;
InvisibleButtonGroup* mAnimationMethodGroup = nullptr;
+ InvisibleButtonGroup* mFullScreenBackgroundGroup = nullptr;
InvisibleButtonGroup* mThumbnailActionsGroup = nullptr;
InvisibleButtonGroup* mZoomModeGroup = nullptr;
InvisibleButtonGroup* mThumbnailBarOrientationGroup = nullptr;
diff --git a/app/generalconfigpage.ui b/app/generalconfigpage.ui
index 33da2943..54769fd4 100644
--- a/app/generalconfigpage.ui
+++ b/app/generalconfigpage.ui
@@ -12,7 +12,7 @@
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
- <widget class="QLabel" name="label_2">
+ <widget class="QLabel" name="label">
<property name="text">
<string>Videos:</string>
</property>
@@ -25,6 +25,13 @@
</property>
</widget>
</item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="kcfg_AutoplayVideos">
+ <property name="text">
+ <string>Automatically play</string>
+ </property>
+ </widget>
+ </item>
<item row="2" column="1">
<spacer name="verticalSpacer_1">
<property name="orientation">
@@ -42,7 +49,7 @@
</spacer>
</item>
<item row="3" column="0">
- <widget class="QLabel" name="label">
+ <widget class="QLabel" name="label_2">
<property name="text">
<string>Background color:</string>
</property>
@@ -122,14 +129,51 @@
</property>
</spacer>
</item>
- <item row="6" column="0">
- <widget class="QLabel" name="label">
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_3">
<property name="text">
- <string>JPEG save quality:</string>
+ <string>Fullscreen background:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QRadioButton" name="fullscreenBackgroundImageRadioButton">
+ <property name="text">
+ <string>Dark gray texture</string>
</property>
</widget>
</item>
<item row="6" column="1">
+ <widget class="QRadioButton" name="fullscreenBackgroundBlackRadioButton">
+ <property name="text">
+ <string>Black</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" 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>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>JPEG save quality:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="kcfg_JPEGQuality">
@@ -187,7 +231,7 @@
</item>
</layout>
</item>
- <item row="7" column="1">
+ <item row="9" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -203,41 +247,34 @@
</property>
</spacer>
</item>
- <item row="8" column="0">
- <widget class="QLabel" name="label_3">
+ <item row="10" column="0">
+ <widget class="QLabel" name="label_5">
<property name="text">
<string>Thumbnail actions:</string>
</property>
</widget>
</item>
- <item row="8" column="1">
+ <item row="10" column="1">
<widget class="QRadioButton" name="allButtonsThumbnailActionsRadioButton">
<property name="text">
<string>All buttons</string>
</property>
</widget>
</item>
- <item row="9" column="1">
+ <item row="11" column="1">
<widget class="QRadioButton" name="selectionOnlyThumbnailActionsRadioButton">
<property name="text">
<string>Show selection button only</string>
</property>
</widget>
</item>
- <item row="10" column="1">
+ <item row="12" column="1">
<widget class="QRadioButton" name="noneThumbnailActionsRadioButton">
<property name="text">
<string>None</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="kcfg_AutoplayVideos">
- <property name="text">
- <string>Automatically play</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
<resources/>
diff --git a/app/gvcore.cpp b/app/gvcore.cpp
index 60ac3fa3..bdd2e0d7 100644
--- a/app/gvcore.cpp
+++ b/app/gvcore.cpp
@@ -196,10 +196,15 @@ struct GvCorePrivate
adjustDefaultFullScreenPalette();
}
- // FullScreenView has textured background
+ // FullScreenView has either a solid black color or a textured background
pal = mPalettes[GvCore::FullScreenPalette];
- QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, "images/background.png");
- QPixmap bgTexture(path);
+ QPixmap bgTexture(256,256);
+ if (Gwenview::GwenviewConfig::fullScreenBackground() == Gwenview::FullScreenBackground::Black) {
+ bgTexture.fill(Qt::black);
+ } else {
+ QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, "images/background.png");
+ bgTexture = path;
+ }
pal.setBrush(QPalette::Base, bgTexture);
mPalettes[GvCore::FullScreenViewPalette] = pal;
}
diff --git a/doc/index.docbook b/doc/index.docbook
index 8aa22883..9f2a85a6 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -724,6 +724,20 @@ Link an image.</para></listitem>
<para>Move the slider to change the color of the gray background in Browse and View mode from black (the leftmost position) to white (the rightmost position).</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><guilabel>Fullscreen background</guilabel></term>
+ <listitem>
+ <para>Move the slider to change the color of the gray background in Browse and View mode from black (the leftmost position) to white (the rightmost position).</para>
+ <itemizedlist>
+ <listitem>
+ <para><guilabel>Black</guilabel> — Set the background color in fullscreen mode to black.</para>
+ </listitem>
+ <listitem>
+ <para><guilabel>Dark gray texture</guilabel> — Set the background in fullscreen mode to a dark gray texture.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><guilabel>JPEG save quality</guilabel></term>
<listitem>
diff --git a/lib/fullscreenbackground.h b/lib/fullscreenbackground.h
new file mode 100644
index 00000000..ba7722be
--- /dev/null
+++ b/lib/fullscreenbackground.h
@@ -0,0 +1,47 @@
+// vim: set tabstop=4 shiftwidth=4 expandtab:
+/*
+Gwenview: an image viewer
+Copyright 2021 Antonio Prcela <antonio.prcela at gmail.com>
+
+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 FULLSCREENBACKGROUND_H
+#define FULLSCREENBACKGROUND_H
+
+// Qt
+
+// KF
+
+// Local
+
+namespace Gwenview
+{
+
+namespace FullScreenBackground
+{
+/**
+ * This enum represents the different background types in fullscreen mode
+ */
+enum Enum {
+ Black,
+ Image
+};
+
+} // namespace FullScreenBackground
+
+} // namespace Gwenview
+
+#endif /* FULLSCREENBACKGROUND_H */
diff --git a/lib/gwenviewconfig.kcfg b/lib/gwenviewconfig.kcfg
index 114770f4..2cb11de2 100644
--- a/lib/gwenviewconfig.kcfg
+++ b/lib/gwenviewconfig.kcfg
@@ -8,6 +8,7 @@
<include>lib/zoommode.h</include>
<include>lib/thumbnailactions.h</include>
<include>lib/mousewheelbehavior.h</include>
+ <include>lib/fullscreenbackground.h</include>
<include>lib/documentview/documentview.h</include>
<include>lib/documentview/rasterimageview.h</include>
<include>lib/print/printoptionspage.h</include>
@@ -94,7 +95,13 @@
<entry name="SideBarPage" type="String">
<default>information</default>
</entry>
-
+ <entry name="FullScreenBackground" type="Enum">
+ <choices name="Gwenview::FullScreenBackground::Enum">
+ <choice name="FullScreenBackground::Image"/>
+ <choice name="FullScreenBackground::Black"/>
+ </choices>
+ <default>FullScreenBackground::Image</default>
+ </entry>
<entry name="ThumbnailActions" type="Enum">
<choices name="Gwenview::ThumbnailActions::Enum">
<choice name="ThumbnailActions::AllButtons"/>
More information about the kde-doc-english
mailing list