pmaports/main/qt5-qtwebengine/patches-luna/0007-WebEngineSettings-add-also-Serif-Fixed-and-Cursive-f.patch

147 lines
6.2 KiB
Diff

From f9f47062768dbd6f4a131f630ceb6ad83ab9c0e5 Mon Sep 17 00:00:00 2001
From: Christophe Chapuis <chris.chapuis@gmail.com>
Date: Sat, 17 Oct 2015 22:13:32 +0200
Subject: [PATCH 07/18] WebEngineSettings: add also Serif, Fixed and Cursive
font settings, and font size for normal and fixed fonts.
Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
---
src/webengine/api/qquickwebenginesettings.cpp | 62 ++++++++++++++++++++++++++-
src/webengine/api/qquickwebenginesettings_p.h | 20 +++++++++
2 files changed, 81 insertions(+), 1 deletion(-)
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index c0f1227..22adb28 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -393,7 +393,27 @@ QString QQuickWebEngineSettings::luneOSIdentifier() const
QString QQuickWebEngineSettings::standardFontFamily() const
{
- return d_ptr->fontFamily(WebEngineSettings::StandardFont);;
+ return d_ptr->fontFamily(WebEngineSettings::StandardFont);
+}
+QString QQuickWebEngineSettings::fixedFontFamily() const
+{
+ return d_ptr->fontFamily(WebEngineSettings::FixedFont);
+}
+QString QQuickWebEngineSettings::serifFontFamily() const
+{
+ return d_ptr->fontFamily(WebEngineSettings::SerifFont);
+}
+QString QQuickWebEngineSettings::cursiveFontFamily() const
+{
+ return d_ptr->fontFamily(WebEngineSettings::CursiveFont);
+}
+int QQuickWebEngineSettings::defaultFontSize() const
+{
+ return d_ptr->fontSize(WebEngineSettings::DefaultFontSize);
+}
+int QQuickWebEngineSettings::defaultFixedFontSize() const
+{
+ return d_ptr->fontSize(WebEngineSettings::DefaultFixedFontSize);
}
void QQuickWebEngineSettings::setAutoLoadImages(bool on)
@@ -616,6 +636,46 @@ void QQuickWebEngineSettings::setStandardFontFamily(QString fontFamily)
Q_EMIT standardFontFamilyChanged();
}
+void QQuickWebEngineSettings::setFixedFontFamily(QString fontFamily)
+{
+ const QString oldFixedFontFamily = d_ptr->fontFamily(WebEngineSettings::FixedFont);
+ d_ptr->setFontFamily(WebEngineSettings::FixedFont, fontFamily);
+ if (oldFixedFontFamily.compare(fontFamily))
+ Q_EMIT fixedFontFamilyChanged();
+}
+
+void QQuickWebEngineSettings::setSerifFontFamily(QString fontFamily)
+{
+ const QString oldSerifFontFamily = d_ptr->fontFamily(WebEngineSettings::SerifFont);
+ d_ptr->setFontFamily(WebEngineSettings::SerifFont, fontFamily);
+ if (oldSerifFontFamily.compare(fontFamily))
+ Q_EMIT serifFontFamilyChanged();
+}
+
+void QQuickWebEngineSettings::setCursiveFontFamily(QString fontFamily)
+{
+ const QString oldCursiveFontFamily = d_ptr->fontFamily(WebEngineSettings::CursiveFont);
+ d_ptr->setFontFamily(WebEngineSettings::CursiveFont, fontFamily);
+ if (oldCursiveFontFamily.compare(fontFamily))
+ Q_EMIT standardFontFamilyChanged();
+}
+
+void QQuickWebEngineSettings::setDefaultFontSize(int fontSize)
+{
+ const int oldDefaultFontSize = d_ptr->fontSize(WebEngineSettings::DefaultFontSize);
+ d_ptr->setFontSize(WebEngineSettings::DefaultFontSize, fontSize);
+ if (oldDefaultFontSize!= fontSize)
+ Q_EMIT defaultFontSizeChanged();
+}
+
+void QQuickWebEngineSettings::setDefaultFixedFontSize(int fontSize)
+{
+ const int oldDefaultFixedFontSize = d_ptr->fontSize(WebEngineSettings::DefaultFixedFontSize);
+ d_ptr->setFontSize(WebEngineSettings::DefaultFixedFontSize, fontSize);
+ if (oldDefaultFixedFontSize != fontSize)
+ Q_EMIT defaultFixedFontSizeChanged();
+}
+
void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings)
{
d_ptr->setParentSettings(parentSettings->d_ptr.data());
diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
index 8b5cf49..e793089 100644
--- a/src/webengine/api/qquickwebenginesettings_p.h
+++ b/src/webengine/api/qquickwebenginesettings_p.h
@@ -90,6 +90,11 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
Q_PROPERTY(bool luneOSPrivileged READ luneOSPrivileged WRITE setLuneOSPrivileged NOTIFY luneOSPrivilegedChanged)
Q_PROPERTY(QString luneOSIdentifier READ luneOSIdentifier WRITE setLuneOSIdentifier NOTIFY luneOSIdentifierChanged)
Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily NOTIFY standardFontFamilyChanged)
+ Q_PROPERTY(QString fixedFontFamily READ standardFontFamily WRITE setFixedFontFamily NOTIFY fixedFontFamilyChanged)
+ Q_PROPERTY(QString serifFontFamily READ standardFontFamily WRITE setSerifFontFamily NOTIFY serifFontFamilyChanged)
+ Q_PROPERTY(QString cursiveFontFamily READ standardFontFamily WRITE setCursiveFontFamily NOTIFY cursiveFontFamilyChanged)
+ Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize NOTIFY defaultFontSizeChanged)
+ Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize NOTIFY defaultFixedFontSizeChanged)
public:
~QQuickWebEngineSettings();
@@ -121,6 +126,11 @@ public:
bool luneOSPrivileged() const;
QString luneOSIdentifier() const;
QString standardFontFamily() const;
+ QString fixedFontFamily() const;
+ QString serifFontFamily() const;
+ QString cursiveFontFamily() const;
+ int defaultFontSize() const;
+ int defaultFixedFontSize() const;
void setAutoLoadImages(bool on);
void setJavascriptEnabled(bool on);
@@ -149,6 +159,11 @@ public:
void setLuneOSPrivileged(bool on);
void setLuneOSIdentifier(QString identifier);
void setStandardFontFamily(QString fontFamily);
+ void setFixedFontFamily(QString fontFamily);
+ void setSerifFontFamily(QString fontFamily);
+ void setCursiveFontFamily(QString fontFamily);
+ void setDefaultFontSize(int fontSize);
+ void setDefaultFixedFontSize(int fontSize);
signals:
void autoLoadImagesChanged();
@@ -178,6 +193,11 @@ signals:
void luneOSPrivilegedChanged();
void luneOSIdentifierChanged();
void standardFontFamilyChanged();
+ void fixedFontFamilyChanged();
+ void serifFontFamilyChanged();
+ void cursiveFontFamilyChanged();
+ void defaultFontSizeChanged();
+ void defaultFixedFontSizeChanged();
private:
explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0);
--
2.7.4