Add a zoom factor setting.
authorSoren Stoutner <soren@stoutner.com>
Sat, 29 Jan 2022 18:40:37 +0000 (11:40 -0700)
committerSoren Stoutner <soren@stoutner.com>
Sat, 29 Jan 2022 18:40:37 +0000 (11:40 -0700)
po/privacybrowser.pot
src/mainview.cpp
src/mainwindow.cpp
src/privacybrowserui.rc
src/settings.kcfg
src/settings.kcfgc
src/settings.ui

index 3ab6a9b3d78f7dbfda0f44eadeaacdacff6e4823..4cf447629c5039f821dc7283e856cd73aa55e48e 100644 (file)
@@ -21,7 +21,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-01-22 14:47-0700\n"
+"POT-Creation-Date: 2022-01-29 11:34-0700\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -30,145 +30,64 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/mainwindow.cpp:46
-#, kde-format
-msgctxt "@action"
-msgid "Switch Colors"
-msgstr ""
-
-#: src/mainwindow.cpp:80
+#: src/mainwindow.cpp:74
 #, kde-format
 msgctxt "@title:tab"
 msgid "General"
 msgstr ""
 
-#: src/main.cpp:44
+#: src/main.cpp:46
 #, kde-format
 msgid "Privacy Browser"
 msgstr ""
 
-#: src/main.cpp:47
+#: src/main.cpp:49
 #, kde-format
 msgid "Soren Stoutner"
 msgstr ""
 
-#: src/main.cpp:47
+#: src/main.cpp:49
 #, kde-format
 msgid "Principal developer"
 msgstr ""
 
-#: src/main.cpp:51
+#: src/main.cpp:53
 #, kde-format
 msgid "Copyright © 2016-2017,2021-2022 Soren Stoutner <soren@stoutner.com>"
 msgstr ""
 
-#: src/main.cpp:56
+#: src/main.cpp:58
 #, kde-format
 msgid "A web browser that respects your privacy."
 msgstr ""
 
-#: src/mainview.cpp:44
-#, kde-format
-msgid "This project is %1 days old"
-msgstr ""
-
 #: rc.cpp:3
 #, kde-format
-msgid "Background color:"
+msgid "Zoom factor"
 msgstr ""
 
 #: rc.cpp:6
 #, kde-format
-msgid "Choose a new background color"
+msgid "Set the zoom factor between 0.25 and 5.00."
 msgstr ""
 
 #: rc.cpp:9
 #, kde-format
-msgid ""
-"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css"
-"\">\n"
-"p, li { white-space: pre-wrap; }\n"
-"</style></head><body style=\" font-family:'DejaVu Serif'; font-size:9pt; "
-"font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-"
-"right:0px; -qt-block-indent:0; text-indent:0px;\">Change the <span style=\" "
-"font-weight:600;\">background</span> color by clicking here and choose the "
-"new <span style=\" color:#ff0000;\">color</span> in the <span style=\" font-"
-"style:italic;\">color dialog</span>.</p></body></html>"
-msgstr ""
-
-#: rc.cpp:15
-#, kde-format
-msgid "Foreground color:"
-msgstr ""
-
-#: rc.cpp:18
-#, kde-format
-msgid "Choose a new foreground color"
-msgstr ""
-
-#: rc.cpp:21
-#, kde-format
-msgid ""
-"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css"
-"\">\n"
-"p, li { white-space: pre-wrap; }\n"
-"</style></head><body style=\" font-family:'DejaVu Serif'; font-size:9pt; "
-"font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-"
-"right:0px; -qt-block-indent:0; text-indent:0px;\">Change the <span style=\" "
-"font-weight:600;\">foreground</span> color by clicking here and choose the "
-"new <span style=\" color:#ff0000;\">color</span> in the <span style=\" font-"
-"style:italic;\">color dialog</span>.</p></body></html>"
-msgstr ""
-
-#: rc.cpp:27
-#, kde-format
-msgid "Project age:"
-msgstr ""
-
-#: rc.cpp:30
-#, kde-format
-msgid "Set the project age (in days)"
-msgstr ""
-
-#: rc.cpp:33
-#, kde-format
-msgid "Change the project age (in days) by choosing a new number of days."
-msgstr ""
-
-#: rc.cpp:36
-#, kde-format
-msgid "color of the background"
+msgid "Set the zoom factor between 0.25 and 5.00.  The default is 1.00."
 msgstr ""
 
-#: rc.cpp:39
-#, kde-format
-msgid "color of the foreground"
-msgstr ""
-
-#: rc.cpp:42
-#, kde-format
-msgid "age of the project"
-msgstr ""
-
-#: rc.cpp:45
+#: rc.cpp:12
 #, kde-format
 msgid "Main Toolbar"
 msgstr ""
 
-#: rc.cpp:48
-#, kde-format
-msgid "hello, world"
-msgstr ""
-
-#: rc.cpp:49
+#: rc.cpp:13
 #, kde-format
 msgctxt "NAME OF TRANSLATORS"
 msgid "Your names"
 msgstr ""
 
-#: rc.cpp:50
+#: rc.cpp:14
 #, kde-format
 msgctxt "EMAIL OF TRANSLATORS"
 msgid "Your emails"
index a1e018b400734422350bbf1b8cf3c46d5ef88685..e46f00d1d6660f68a6d9140a2ca61121668015f8 100644 (file)
@@ -47,6 +47,9 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     connect(webEngineViewPointer, SIGNAL(loadProgress(int)), this, SLOT(updateUrlLineEdit()));
     connect(webEngineViewPointer, SIGNAL(loadFinished(bool)), this, SLOT(updateUrlLineEdit()));
 
+    // Set the zoom factor.
+    webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
+
     // Load a website.
     webEngineViewPointer->setUrl(QUrl(QStringLiteral("https://www.stoutner.com/")));
 }
@@ -60,5 +63,8 @@ void MainView::loadUrl(const QString &urlFromUser)
 void MainView::updateUrlLineEdit()
 {
     // Update the URL line edit.
-    urlLineEditPointer->setText(webEngineViewPointer->url().toString());
+    urlLineEditPointer->setUrl(webEngineViewPointer->url().toString());
+
+    // Reapply the zoom factor.  This is a bug in QWebEngineView that resets the zoom with every load.  Hopefully it will be fixed in Qt6.  <https://bugreports.qt.io/browse/QTBUG-51992>
+    webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
 }
index 1f7f34643832d83db1d14774441c8f95394c6e27..c48e4955853c03f469af71149129dfa565127d36 100644 (file)
@@ -71,7 +71,7 @@ void MainWindow::settingsConfigure()
         KConfigDialog *configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
 
         // Add the general settings widget page.
-        configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("@title:tab", "General"), QStringLiteral("package_setting"));
+        configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("@title:tab", "General"), QStringLiteral("breeze-settings"));
 
         // Delete the config dialog when it is closed.
         configDialogPointer->setAttribute(Qt::WA_DeleteOnClose);
index cedd0c6b1ed7da175cdb26c973973be90273b4fd..fc7ae9deaaff1620e74593ba74f07821e2f0d8f0 100644 (file)
     <ToolBar name="mainToolBar" noMerge="1">
         <text>Main Toolbar</text>
 
-        <Action name="switch_action"/>
-
-        <Separator/>
-
         <Action name="options_configure"/>
     </ToolBar>
 </gui>
index 9a85eda27cd2485d2563ac7b13be404504c107ce..7ef17aa73a3969de2f9b45e801ad9a3b1e6c57f0 100644 (file)
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
 
-    <kcfgfile name="privacybrowserpc"/>
+    <kcfgfile name="settings"/>
 
-    <group name="Preferences">
-        <entry name="colorBackground" type="Color">
-            <label>color of the background</label>
-            <default>black</default>
-        </entry>
-
-        <entry name="colorForeground" type="Color">
-            <label>color of the foreground</label>
-            <default>yellow</default>
-        </entry>
-
-        <entry name="ageInDays" type="Int">
-            <label>age of the project</label>
-            <default>2</default>
+    <group name="General">
+        <entry name="zoomFactor" type="Double">
+            <default>1.00</default>
         </entry>
     </group>
 </kcfg>
index 4cd27467884968e5527b0c916533c35ec74a3b72..5304975e5aabd64645314cbd5904a2ff77ad9c7b 100644 (file)
@@ -24,6 +24,3 @@ ClassName=Settings
 
 # Make the generated class a singleton.  TODO, the default is false.  This may not be needed.
 Singleton=true
-
-# Allow mutating (making changes to) the listed variables.
-Mutators=colorBackground,colorForeground
index fdfe8f22c520bf655d6a4db53e6eb0be7007ac10..35d51b893156082bc4ab133f64cc7feb23c079cd 100644 (file)
 
         <layout class="QFormLayout">
             <item row="0" column="0">
-                <widget class="QLabel" name="backgroundLabel">
+                <widget class="QLabel" name="zoomFactorLabel">
                     <property name="text">
-                        <string>Background color:</string>
+                        <string>Zoom factor</string>
                     </property>
                 </widget>
             </item>
 
             <item row="0" column="1">
-                <widget class="KColorButton" name="kcfg_colorBackground">
+                <widget class="QDoubleSpinBox" name="kcfg_zoomFactor">
                     <property name="toolTip">
-                        <string>Choose a new background color</string>
+                        <string>Set the zoom factor between 0.25 and 5.00.</string>
                     </property>
 
                     <property name="whatsThis">
-                        <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-                            p, li { white-space: pre-wrap; }
-                            &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-                            &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Change the &lt;span style=&quot; font-weight:600;&quot;&gt;background&lt;/span&gt; color by clicking here and choose the new &lt;span style=&quot; color:#ff0000;&quot;&gt;color&lt;/span&gt; in the &lt;span style=&quot; font-style:italic;&quot;&gt;color dialog&lt;/span&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-                    </property>
-
-                    <property name="text">
-                        <string/>
-                    </property>
-                </widget>
-            </item>
-
-            <item row="1" column="0">
-                <widget class="QLabel" name="foregroundLabel">
-                    <property name="text">
-                        <string>Foreground color:</string>
-                    </property>
-                </widget>
-            </item>
-
-            <item row="1" column="1">
-                <widget class="KColorButton" name="kcfg_colorForeground">
-                    <property name="toolTip">
-                        <string>Choose a new foreground color</string>
-                    </property>
-
-                    <property name="whatsThis">
-                        <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-                            p, li { white-space: pre-wrap; }
-                            &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-                            &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Change the &lt;span style=&quot; font-weight:600;&quot;&gt;foreground&lt;/span&gt; color by clicking here and choose the new &lt;span style=&quot; color:#ff0000;&quot;&gt;color&lt;/span&gt; in the &lt;span style=&quot; font-style:italic;&quot;&gt;color dialog&lt;/span&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-                    </property>
-
-                    <property name="text">
-                        <string/>
-                    </property>
-                </widget>
-            </item>
-
-            <item row="2" column="0">
-                <widget class="QLabel" name="projectLabel">
-                    <property name="text">
-                        <string>Project age:</string>
-                    </property>
-                </widget>
-            </item>
-
-            <item row="2" column="1">
-                <widget class="QSpinBox" name="kcfg_ageInDays">
-                    <property name="toolTip">
-                        <string>Set the project age (in days)</string>
-                    </property>
-
-                    <property name="whatsThis">
-                        <string>Change the project age (in days) by choosing a new number of days.</string>
+                        <string>Set the zoom factor between 0.25 and 5.00.  The default is 1.00.</string>
                     </property>
 
                     <property name="minimum">
-                        <number>1</number>
+                        <double>0.250000000000000</double>
                     </property>
 
-                    <property name="value">
-                        <number>2</number>
+                    <property name="maximum">
+                        <double>5.000000000000000</double>
                     </property>
                 </widget>
             </item>
         </layout>
     </widget>
 
-    <customwidgets>
-        <customwidget>
-            <class>KColorButton</class>
-
-            <extends>QPushButton</extends>
-
-            <header>kcolorbutton.h</header>
-        </customwidget>
-    </customwidgets>
-
     <resources/>
 
     <connections/>