From aca3bbeca7fee2ff50918a9d09a41be4edf1140c Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Sat, 29 Jan 2022 11:40:37 -0700 Subject: [PATCH] Add a zoom factor setting. --- po/privacybrowser.pot | 107 +++++----------------------------------- src/mainview.cpp | 8 ++- src/mainwindow.cpp | 2 +- src/privacybrowserui.rc | 4 -- src/settings.kcfg | 19 ++----- src/settings.kcfgc | 3 -- src/settings.ui | 80 +++--------------------------- 7 files changed, 33 insertions(+), 190 deletions(-) diff --git a/po/privacybrowser.pot b/po/privacybrowser.pot index 3ab6a9b..4cf4476 100644 --- a/po/privacybrowser.pot +++ b/po/privacybrowser.pot @@ -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 \n" "Language-Team: LANGUAGE \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 " 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 "" -"\n" -"

Change the background color by clicking here and choose the " -"new color in the color dialog.

" -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 "" -"\n" -"

Change the foreground color by clicking here and choose the " -"new color in the color dialog.

" -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" diff --git a/src/mainview.cpp b/src/mainview.cpp index a1e018b..e46f00d 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -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. + webEngineViewPointer->setZoomFactor(Settings::zoomFactor()); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1f7f346..c48e495 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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); diff --git a/src/privacybrowserui.rc b/src/privacybrowserui.rc index cedd0c6..fc7ae9d 100644 --- a/src/privacybrowserui.rc +++ b/src/privacybrowserui.rc @@ -34,10 +34,6 @@ Main Toolbar - - - - diff --git a/src/settings.kcfg b/src/settings.kcfg index 9a85eda..7ef17aa 100644 --- a/src/settings.kcfg +++ b/src/settings.kcfg @@ -23,22 +23,11 @@ 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" > - + - - - - black - - - - - yellow - - - - - 2 + + + 1.00 diff --git a/src/settings.kcfgc b/src/settings.kcfgc index 4cd2746..5304975 100644 --- a/src/settings.kcfgc +++ b/src/settings.kcfgc @@ -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 diff --git a/src/settings.ui b/src/settings.ui index fdfe8f2..35d51b8 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -33,99 +33,35 @@ - + - Background color: + Zoom factor - + - Choose a new background color + Set the zoom factor between 0.25 and 5.00. - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; font-weight:400; font-style:normal;"> - <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> - - - - - - - - - - - - Foreground color: - - - - - - - - Choose a new foreground color - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; font-weight:400; font-style:normal;"> - <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> - - - - - - - - - - - - Project age: - - - - - - - - Set the project age (in days) - - - - Change the project age (in days) by choosing a new number of days. + Set the zoom factor between 0.25 and 5.00. The default is 1.00. - 1 + 0.250000000000000 - - 2 + + 5.000000000000000 - - - KColorButton - - QPushButton - -
kcolorbutton.h
-
-
- -- 2.43.0