aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-02-27 09:23:59 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-02-27 11:47:39 +0100
commit23feba7e5a1396110d543a676e018bcbdfa50d39 (patch)
treed4e2a6fed26a490a5ba2df4f755f6ad90b2203b1 /src/main.cpp
parent435532d97dcfbb23e46f51f690914fd910cc65ee (diff)
downloadkristall-23feba7e5a1396110d543a676e018bcbdfa50d39.tar.gz
Adds emoji toggle preference.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 546371c..645630f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -29,6 +29,15 @@ QDir kristall::dirs::offline_pages;
QDir kristall::dirs::themes;
QDir kristall::dirs::styles;
+// We need QFont::setFamilies for emojis to work properly,
+// Qt versions below 5.13 don't support this.
+const bool kristall::EMOJIS_SUPPORTED =
+#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
+ false;
+#else
+ true;
+#endif
+
QString toFingerprintString(QSslCertificate const & certificate)
{
return QCryptographicHash::hash(certificate.toDer(), QCryptographicHash::Sha256).toHex(':');
@@ -379,6 +388,10 @@ void GenericSettings::load(QSettings &settings)
fancy_quotes = settings.value("fancy_quotes", true).toBool();
+ emojis_enabled = kristall::EMOJIS_SUPPORTED
+ ? settings.value("emojis_enabled", true).toBool()
+ : false;
+
max_redirections = settings.value("max_redirections", 5).toInt();
redirection_policy = RedirectionWarning(settings.value("redirection_policy ", WarnOnHostChange).toInt());
@@ -439,6 +452,13 @@ void GenericSettings::save(QSettings &settings) const
settings.setValue("cache_threshold", cache_threshold);
settings.setValue("cache_life", cache_life);
settings.setValue("cache_unlimited_life", cache_unlimited_life);
+
+ if (kristall::EMOJIS_SUPPORTED)
+ {
+ // Save emoji pref only if emojis are supported, so if user changes to a build
+ // with emoji support, they get it out of the box.
+ settings.setValue("emojis_enabled", emojis_enabled);
+ }
}