Commit 448f0adc authored by ChangZhuo Chen's avatar ChangZhuo Chen

New upstream version 0.6.0

parent b2fa9ffc
......@@ -24,3 +24,4 @@ COPYING
*.icns binary
*.ico binary
*.png binary
*.woff binary
SRC_ROOT=$$PWD
BUILD_ROOT=$$shadowed($$PWD)
ZEAL_COMMON_PRI = $$SRC_ROOT/qmake/common.pri
ZEAL_LIBRARY_PRI = $$SRC_ROOT/qmake/library.pri
# Changelog
The version history is available on [GitHub Releases](https://github.com/zealdocs/zeal/releases).
cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
project(Zeal VERSION 0.5.0)
project(Zeal VERSION 0.6.0)
# Project information.
if(APPLE)
......@@ -15,5 +15,7 @@ string(TIMESTAMP PROJECT_COPYRIGHT "© 2015-%Y Oleg Shparber" UTC)
set(PROJECT_DESCRIPTION "A simple documentation browser.")
set(PROJECT_URL "https://zealdocs.org")
set(QT_MINIMUM_VERSION 5.5.1)
add_subdirectory(assets)
add_subdirectory(src)
......@@ -8,18 +8,16 @@
Zeal is a simple offline documentation browser inspired by [Dash](https://kapeli.com/dash).
![Screenshot](https://i.imgur.com/v63u1ZJ.png)
[More screenshots](https://imgur.com/a/eVi97)
![Screenshot](https://i.imgur.com/qBkZduS.png)
## Build Status
[![Coverity Scan](https://img.shields.io/coverity/scan/4271.svg?style=flat-square)](https://scan.coverity.com/projects/4271)
OS \ Branch | master | stable
------------|--------|-------
Linux | [![Shippable](https://img.shields.io/shippable/54ac2ce4d46935d5fbc19b84/master.svg?style=flat-square)](https://app.shippable.com/projects/54ac2ce4d46935d5fbc19b84) | [![Shippable](https://img.shields.io/shippable/54ac2ce4d46935d5fbc19b84/stable.svg?style=flat-square)](https://app.shippable.com/projects/54ac2ce4d46935d5fbc19b84)
Windows | [![AppVeyor](https://img.shields.io/appveyor/ci/trollixx/zeal/master.svg?style=flat-square)](https://ci.appveyor.com/project/trollixx/zeal) | [![AppVeyor](https://img.shields.io/appveyor/ci/trollixx/zeal/stable.svg?style=flat-square)](https://ci.appveyor.com/project/trollixx/zeal)
| OS | Build Status |
| -------- | ------------ |
| Linux | [![Shippable](https://img.shields.io/shippable/54ac2ce4d46935d5fbc19b84/master.svg?style=flat-square)](https://app.shippable.com/projects/54ac2ce4d46935d5fbc19b84) |
| Windows | [![AppVeyor](https://img.shields.io/appveyor/ci/trollixx/zeal/master.svg?style=flat-square)](https://ci.appveyor.com/project/trollixx/zeal) |
## Download
......
include($$ZEAL_COMMON_PRI)
TEMPLATE = aux
unix:!macx {
TARGET = zeal
appicons16.files=freedesktop/appicons/16/*
appicons24.files=freedesktop/appicons/24/*
appicons32.files=freedesktop/appicons/32/*
appicons64.files=freedesktop/appicons/64/*
appicons128.files=freedesktop/appicons/128/*
appicons16.path=$$PREFIX/share/icons/hicolor/16x16/apps
appicons24.path=$$PREFIX/share/icons/hicolor/24x24/apps
appicons32.path=$$PREFIX/share/icons/hicolor/32x32/apps
appicons64.path=$$PREFIX/share/icons/hicolor/64x64/apps
appicons128.path=$$PREFIX/share/icons/hicolor/128x128/apps
desktop.files=freedesktop/zeal.desktop
desktop.path=$$PREFIX/share/applications
INSTALLS += appicons16 appicons24 appicons32 appicons64 appicons128 desktop
}
# Shared build options
#
# This file must be included at the top of every non-subdirs .pro file.
# Use:
# include($$ZEAL_COMMON_PRI)
# Compilation settings
CONFIG += c++11 silent
# Shared include path
INCLUDEPATH += $$SRC_ROOT/src/libs
LIBS = -L$$BUILD_ROOT/.lib
# QString options
DEFINES *= QT_USE_QSTRINGBUILDER
DEFINES *= QT_RESTRICTED_CAST_FROM_ASCII
DEFINES *= QT_NO_CAST_TO_ASCII
DEFINES *= QT_NO_URL_CAST_FROM_STRING
# Workaround for AppVeyor: Do not warn if the library had to be created.
# Based on https://codereview.qt-project.org/150326
win32-g++:lessThan(QT_VERSION, "5.6.0") {
QMAKE_LIB = ar -rc
}
# Keep build directory clean
MOC_DIR = $$BUILD_ROOT/.moc
OBJECTS_DIR = $$BUILD_ROOT/.obj
RCC_DIR = $$BUILD_ROOT/.rcc
UI_DIR = $$BUILD_ROOT/.ui
# Application version
VERSION = 0.5.0
DEFINES += ZEAL_VERSION=\\\"$${VERSION}\\\"
# Portable build
CONFIG(zeal_portable) {
message("Portable build: Yes.")
DEFINES += PORTABLE_BUILD
}
# Unix installation prefix
unix:!macx {
isEmpty(PREFIX): PREFIX = /usr
}
include($$ZEAL_COMMON_PRI)
include($$replace(_PRO_FILE_PWD_, ([^/]+$), \\1/\\1.pri))
TEMPLATE = lib
CONFIG += staticlib
DESTDIR = $$BUILD_ROOT/.lib
TARGET = $$ZEAL_LIB_NAME
# TODO: Move zeal.qrc one level up to rely on CMAKE_AUTORCC.
find_package(Qt5Core REQUIRED)
qt5_add_resources(App_RESOURCES resources/zeal.qrc)
# Silence CMP0071.
set_property(SOURCE qrc_zeal.cpp PROPERTY SKIP_AUTOGEN ON)
if(APPLE)
list(APPEND App_RESOURCES resources/zeal.icns)
......@@ -17,6 +19,10 @@ add_executable(App WIN32
target_link_libraries(App Core Util)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
if (Qt5Widgets_VERSION VERSION_LESS QT_MINIMUM_VERSION)
message(FATAL_ERROR "Qt version >= ${QT_MINIMUM_VERSION} is required.")
endif()
target_link_libraries(App Qt5::Widgets)
set_target_properties(App PROPERTIES
......
include($$ZEAL_COMMON_PRI)
TEMPLATE = app
QT += gui widgets
SOURCES += \
main.cpp
RESOURCES += \
resources/zeal.qrc
DESTDIR = $$BUILD_ROOT/bin
unix:!macx {
TARGET = zeal
target.path = $$PREFIX/bin
INSTALLS += target
}
win32 {
TARGET = zeal
RC_ICONS = resources/zeal.ico
}
macx {
TARGET = Zeal
ICON = resources/zeal.icns
}
# FIXME: Hardcoded link line & cyclic dependencies.
LIBS += -lCore -lUi -lRegistry -lUtil
# Depend on all dependencies of libraries
for(lib_dir, $$list($$files($$SRC_ROOT/src/libs/*))) {
!equals(lib_dir, $$SRC_ROOT/src/libs/libs.pro) {
exists($$lib_dir/$$basename(lib_dir).pri) {
include($$lib_dir/$$basename(lib_dir).pri)
msvc:PRE_TARGETDEPS += $$BUILD_ROOT/.lib/$${ZEAL_LIB_NAME}.$${QMAKE_EXTENSION_STATICLIB}
else:PRE_TARGETDEPS += $$BUILD_ROOT/.lib/lib$${ZEAL_LIB_NAME}.$${QMAKE_EXTENSION_STATICLIB}
# LIBS += -l$$ZEAL_LIB_NAME
}
}
}
......@@ -46,10 +46,6 @@
using namespace Zeal;
namespace {
const char contactUrl[] = "https://go.zealdocs.org/l/contact";
}
struct CommandLineParameters
{
bool force;
......
/*!
* Font Awesome Free 5.0.4 by @fontawesome - http://fontawesome.com
* License - http://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@font-face{font-family:Font Awesome\ 5 Brands;font-style:normal;font-weight:400;src:url(../fonts/fa-brands-400.eot);src:url(../fonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../fonts/fa-brands-400.woff2) format("woff2"),url(../fonts/fa-brands-400.woff) format("woff"),url(../fonts/fa-brands-400.ttf) format("truetype"),url(../fonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:Font Awesome\ 5 Brands}
/*!
* Font Awesome Free 5.0.4 by @fontawesome - http://fontawesome.com
* License - http://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@font-face{font-family:Font Awesome\ 5 Free;font-style:normal;font-weight:900;src:url(../fonts/fa-solid-900.eot);src:url(../fonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../fonts/fa-solid-900.woff2) format("woff2"),url(../fonts/fa-solid-900.woff) format("woff"),url(../fonts/fa-solid-900.ttf) format("truetype"),url(../fonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.fas{font-family:Font Awesome\ 5 Free;font-weight:900}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
......@@ -4,31 +4,44 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome</title>
<link rel="stylesheet" type="text/css" href="assets/css/fa-brands.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/fa-solid.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/fontawesome.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/welcome.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/font-awesome.min.css">
</head>
<body class="is-unselectable">
<section class="hero is-fullheight">
<div class="hero-head">
<header class="navbar is-transparent" role="navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://zealdocs.org/">ZealDocs.org</a>
<a class="navbar-item" href="https://gitter.im/zealdocs/zeal">Gitter</a>
<a class="navbar-item" href="https://github.com/zealdocs/zeal">GitHub</a>
</div>
</header>
</div>
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title">
Zeal
</h1>
<h2 class="subtitle">
Docs for everyone
</h2>
<div class="container">
<div class="columns is-vcentered">
<div class="column has-text-centered">
<p class="title">Zeal
<span id="version" class="has-text-weight-light is-size-5"></span>
</p>
<p class="subtitle">Docs for everyone</p>
</div>
<div class="column">
<p class="subtitle is-5">Customize</p>
<div class="command-block" onclick="zAppBridge.triggerAction('openDocsetManager')">
<p class="title is-6">Docsets</p>
<p class="subtitle is-6">Install and update docsets</p>
</div>
<div class="command-block" onclick="zAppBridge.triggerAction('openPreferences')">
<p class="title is-6">Preferences</p>
<p class="subtitle is-6">Adjust application settings</p>
</div>
<p class="subtitle is-5">Get in touch</p>
<div class="command-block" onclick="zAppBridge.openShortUrl('gitter')">
<p class="title is-6">Gitter</p>
<p class="subtitle is-6">Chat with developers and other users</p>
</div>
<div class="command-block" onclick="zAppBridge.openShortUrl('github')">
<p class="title is-6">GitHub</p>
<p class="subtitle is-6">Contribute to the project</p>
</div>
</div>
</div>
</div>
</div>
......@@ -36,21 +49,33 @@
<div class="container">
<div class="content has-text-centered">
<p>
<a class="icon" href="https://github.com/zealdocs/zeal">
<i class="fa fa-github"></i>
<a class="icon" onclick="zAppBridge.openShortUrl('github')">
<i class="fab fa-github"></i>
</a>
<a class="icon" onclick="zAppBridge.openShortUrl('gitter')">
<i class="fab fa-gitter"></i>
</a>
<a class="icon" href="https://twitter.com/zealdocs">
<i class="fa fa-twitter"></i>
<a class="icon" onclick="zAppBridge.openShortUrl('twiter')">
<i class="fab fa-twitter"></i>
</a>
</p>
<p>
<a class="is-size-7" href="https://www.kapeli.com/dash">Get Dash for macOS or iOS</a>
<a class="is-size-7" onclick="zAppBridge.openShortUrl('report-bug')">
<span class="icon">
<i class="fas fa-bug"></i>
</span>
<span>Report a problem</span>
</a>
</p>
<p></p>
</div>
</div>
</div>
</section>
<script>
document.getElementById("version").textContent = zAppBridge.AppVersion;
</script>
</body>
</html>
......@@ -4,59 +4,84 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome</title>
<link rel="stylesheet" type="text/css" href="assets/css/fa-brands.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/fa-solid.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/fontawesome.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/welcome.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/font-awesome.min.css">
</head>
<body class="is-unselectable">
<section class="hero is-fullheight">
<div class="hero-head">
<header class="navbar is-transparent" role="navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://zealdocs.org/">ZealDocs.org</a>
<a class="navbar-item" href="https://gitter.im/zealdocs/zeal">Gitter</a>
<a class="navbar-item" href="https://github.com/zealdocs/zeal">GitHub</a>
</div>
</header>
</div>
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title">
Zeal
</h1>
<h2 class="subtitle">
Docs for everyone
</h2>
<div class="container">
<div class="columns is-vcentered">
<div class="column has-text-centered">
<p class="title">Zeal
<span id="version" class="has-text-weight-light is-size-5"></span>
</p>
<p class="subtitle">Docs for everyone</p>
<div id="carboncontainer" style="margin-top: 75px;">
<div id="carbon" class="box">
<script async type="text/javascript" src="https://cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=zealdocsforwindowsorg"
onerror="document.getElementById('carboncontainer').style.display = 'none';" id="_carbonads_js"></script>
</div>
</div>
</div>
<div class="column">
<p class="subtitle is-5">Customize</p>
<div class="command-block" onclick="zAppBridge.triggerAction('openDocsetManager')">
<p class="title is-6">Docsets</p>
<p class="subtitle is-6">Install and update docsets</p>
</div>
<div class="command-block" onclick="zAppBridge.triggerAction('openPreferences')">
<p class="title is-6">Preferences</p>
<p class="subtitle is-6">Adjust application settings</p>
</div>
<p class="subtitle is-5">Get in touch</p>
<div class="command-block" onclick="zAppBridge.openShortUrl('gitter')">
<p class="title is-6">Gitter</p>
<p class="subtitle is-6">Chat with developers and other users</p>
</div>
<div class="command-block" onclick="zAppBridge.openShortUrl('github')">
<p class="title is-6">GitHub</p>
<p class="subtitle is-6">Contribute to the project</p>
</div>
</div>
</div>
</div>
</div>
<div class="hero-foot">
<div class="container">
<div class="content has-text-centered">
<div id="carboncontainer">
<div id="carbon" class="box">
<script async type="text/javascript" src="https://cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=zealdocsforwindowsorg"
onerror="document.getElementById('carboncontainer').style.display = 'none';" id="_carbonads_js"></script>
</div>
</div>
<p>
<a class="icon" href="https://github.com/zealdocs/zeal">
<i class="fa fa-github"></i>
<a class="icon" onclick="zAppBridge.openShortUrl('github')">
<i class="fab fa-github"></i>
</a>
<a class="icon" onclick="zAppBridge.openShortUrl('gitter')">
<i class="fab fa-gitter"></i>
</a>
<a class="icon" href="https://twitter.com/zealdocs">
<i class="fa fa-twitter"></i>
<a class="icon" onclick="zAppBridge.openShortUrl('twiter')">
<i class="fab fa-twitter"></i>
</a>
</p>
<p>
<a class="is-size-7" href="https://www.kapeli.com/dash">Get Dash for macOS or iOS</a>
<a class="is-size-7" onclick="zAppBridge.openShortUrl('report-bug')">
<span class="icon">
<i class="fas fa-bug"></i>
</span>
<span>Report a problem</span>
</a>
</p>
<p></p>
</div>
</div>
</div>
</section>
<script>
document.getElementById("version").textContent = zAppBridge.AppVersion;
</script>
</body>
</html>
......@@ -2,10 +2,13 @@
<qresource prefix="/">
<file>zeal.ico</file>
<file>browser/assets/css/darkmode.css</file>
<file>browser/assets/css/font-awesome.min.css</file>
<file>browser/assets/css/fa-brands.min.css</file>
<file>browser/assets/css/fa-solid.min.css</file>
<file>browser/assets/css/fontawesome.min.css</file>
<file>browser/assets/css/highlight.css</file>
<file>browser/assets/css/welcome.min.css</file>
<file>browser/assets/fonts/fontawesome-webfont.woff</file>
<file>browser/assets/fonts/fa-brands-400.woff</file>
<file>browser/assets/fonts/fa-solid-900.woff</file>
<file>browser/welcome.html</file>
<file>browser/welcome-noad.html</file>
<file>icons/type/Abbreviation.png</file>
......
......@@ -109,6 +109,11 @@ Application *Application::instance()
return m_instance;
}
WidgetUi::MainWindow *Application::mainWindow() const
{
return m_mainWindow;
}
QNetworkAccessManager *Application::networkManager() const
{
return m_networkManager;
......
......@@ -55,6 +55,8 @@ public:
static Application *instance();
WidgetUi::MainWindow *mainWindow() const;
QNetworkAccessManager *networkManager() const;
Settings *settings() const;
......
ZEAL_LIB_NAME = Core
QT += concurrent network webkit widgets
unix:!macx {
CONFIG += link_pkgconfig
PKGCONFIG += libarchive
}
win32: {
LIBS += -larchive_static -lz
}
include($$ZEAL_LIBRARY_PRI)
HEADERS += $$files(*.h)
SOURCES += $$files(*.cpp)
......@@ -22,9 +22,13 @@
#include "filemanager.h"
#include <QCoreApplication>
#include <QDateTime>
#include <QDir>
#include <QFileInfo>
#include <QFutureWatcher>
#include <QLoggingCategory>
#include <QStandardPaths>
#include <QtConcurrent>
......@@ -35,6 +39,9 @@ static Q_LOGGING_CATEGORY(log, "zeal.core.filemanager")
FileManager::FileManager(QObject *parent)
: QObject(parent)
{
// Ensure that cache location exists.
// TODO: Check for errors.
QDir().mkpath(cacheLocation());
}
bool FileManager::removeRecursively(const QString &path)
......@@ -74,3 +81,12 @@ bool FileManager::removeRecursively(const QString &path)
return true;
}
QString FileManager::cacheLocation()
{
#ifndef PORTABLE_BUILD
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
#else
return QCoreApplication::applicationDirPath() + QLatin1String("/cache");
#endif
}
......@@ -30,12 +30,13 @@ namespace Core {
class FileManager : public QObject
{
Q_OBJECT
public:
typedef unsigned int JobId;
explicit FileManager(QObject *parent = nullptr);
bool removeRecursively(const QString &path);
static QString cacheLocation();
};
} // namespace Core
......
......@@ -22,6 +22,8 @@
#include "settings.h"
#include "filemanager.h"
#include <QCoreApplication>
#include <QDir>
#include <QSettings>
......@@ -47,6 +49,13 @@ using namespace Zeal::Core;
Settings::Settings(QObject *parent) :
QObject(parent)
{
qRegisterMetaTypeStreamOperators<ExternalLinkPolicy>("ExternalLinkPolicy");
// Enable local storage due to https://github.com/zealdocs/zeal/issues/872.
QWebSettings *webSettings = QWebSettings::globalSettings();
webSettings->setLocalStoragePath(FileManager::cacheLocation() + QLatin1String("/localStorage"));
webSettings->setAttribute(QWebSettings::LocalStorageEnabled, true);
load();
}
......@@ -81,13 +90,53 @@ void Settings::load()
settings->endGroup();
settings->beginGroup(GroupContent);
// Fonts
QWebSettings *webSettings = QWebSettings::globalSettings();
serifFontFamily = settings->value(QStringLiteral("serif_font_family"),
webSettings->fontFamily(QWebSettings::SerifFont)).toString();
sansSerifFontFamily = settings->value(QStringLiteral("sans_serif_font_family"),
webSettings->fontFamily(QWebSettings::SansSerifFont)).toString();
fixedFontFamily = settings->value(QStringLiteral("fixed_font_family"),
webSettings->fontFamily(QWebSettings::FixedFont)).toString();
static const QMap<QString, QWebSettings::FontFamily> fontFamilies = {
{QStringLiteral("sans-serif"), QWebSettings::SansSerifFont},
{QStringLiteral("serif"), QWebSettings::SerifFont},
{QStringLiteral("monospace"), QWebSettings::FixedFont}
};
defaultFontFamily = settings->value(QStringLiteral("default_font_family"),
QStringLiteral("serif")).toString();
// Fallback to the serif font family.
if (!fontFamilies.contains(defaultFontFamily)) {
defaultFontFamily = QStringLiteral("serif");
}
webSettings->setFontFamily(QWebSettings::SansSerifFont, sansSerifFontFamily);
webSettings->setFontFamily(QWebSettings::SerifFont, serifFontFamily);
webSettings->setFontFamily(QWebSettings::FixedFont, fixedFontFamily);
const QString defaultFontFamilyResolved = webSettings->fontFamily(fontFamilies.value(defaultFontFamily));
webSettings->setFontFamily(QWebSettings::StandardFont, defaultFontFamilyResolved);
defaultFontSize = settings->value(QStringLiteral("default_font_size"),
webSettings->fontSize(QWebSettings::DefaultFontSize)).toInt();
defaultFixedFontSize = settings->value(QStringLiteral("default_fixed_font_size"),
webSettings->fontSize(QWebSettings::DefaultFixedFontSize)).toInt();
minimumFontSize = settings->value(QStringLiteral("minimum_font_size"),
QWebSettings::globalSettings()->fontSize(QWebSettings::MinimumFontSize)).toInt();
QWebSettings::globalSettings()->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize);
webSettings->fontSize(QWebSettings::MinimumFontSize)).toInt();
webSettings->setFontSize(QWebSettings::DefaultFontSize, defaultFontSize);
webSettings->setFontSize(QWebSettings::DefaultFixedFontSize, defaultFixedFontSize);
webSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize);
darkModeEnabled = settings->value(QStringLiteral("dark_mode"), false).toBool();
highlightOnNavigateEnabled = settings->value(QStringLiteral("highlight_on_navigate"), true).toBool();
customCssFile = settings->value(QStringLiteral("custom_css_file")).toString();
externalLinkPolicy = settings->value(QStringLiteral("external_link_policy"),
QVariant::fromValue(ExternalLinkPolicy::Ask)).value<ExternalLinkPolicy>();
isSmoothScrollingEnabled = settings->value(QStringLiteral("smooth_scrolling"), false).toBool();
isAdDisabled = settings->value(QStringLiteral("disable_ad"), false).toBool();
settings->endGroup();
......@@ -153,10 +202,20 @@ void Settings::save()
settings->endGroup();
settings->beginGroup(GroupContent);
settings->setValue(QStringLiteral("default_font_family"), defaultFontFamily);
settings->setValue(QStringLiteral("serif_font_family"), serifFontFamily);
settings->setValue(QStringLiteral("sans_serif_font_family"), sansSerifFontFamily);
settings->setValue(QStringLiteral("fixed_font_family"), fixedFontFamily);
settings->setValue(QStringLiteral("default_font_size"), defaultFontSize);
settings->setValue(QStringLiteral("default_fixed_font_size"), defaultFixedFontSize);
settings->setValue(QStringLiteral("minimum_font_size"), minimumFontSize);
settings->setValue(QStringLiteral("dark_mode"), darkModeEnabled);
settings->setValue(QStringLiteral("highlight_on_navigate"), highlightOnNavigateEnabled);
settings->setValue(QStringLiteral("custom_css_file"), customCssFile);
settings->setValue(QStringLiteral("external_link_policy"), QVariant::fromValue(externalLinkPolicy));
settings->setValue(QStringLiteral("smooth_scrolling"), isSmoothScrollingEnabled);
settings->setValue(QStringLiteral("disable_ad"), isAdDisabled);
settings->endGroup();
......@@ -254,3 +313,17 @@ QSettings *Settings::qsettings(QObject *parent)
QSettings::IniFormat, parent);
#endif
}
QDataStream &operator<<(QDataStream &out, const Settings::ExternalLinkPolicy &policy)
{
out << static_cast<std::underlying_type<Settings::ExternalLinkPolicy>::type>(policy);
return out;
}
QDataStream &operator>>(QDataStream &in, Settings::ExternalLinkPolicy &policy)
{
std::underlying_type<Settings::ExternalLinkPolicy>::type value;
in >> value;
policy = static_cast<Settings::ExternalLinkPolicy>(value);
return in;
}
......@@ -60,15 +60,29 @@ public:
bool fuzzySearchEnabled;
// Content
QString defaultFontFamily;
QString serifFontFamily;
QString sansSerifFontFamily;
QString fixedFontFamily;
int defaultFontSize;
int defaultFixedFontSize;
int minimumFontSize;
enum class ExternalLinkPolicy : unsigned int {
Ask = 0,
Open,
OpenInSystemBrowser
};
Q_ENUM(ExternalLinkPolicy)
ExternalLinkPolicy externalLinkPolicy = ExternalLinkPolicy::Ask;
bool darkModeEnabled;
bool highlightOnNavigateEnabled;
QString customCssFile;
bool isSmoothScrollingEnabled;
bool isAdDisabled;
// TODO: bool askOnExternalLink;
// TODO: QString customCss;
// Network
enum ProxyType : unsigned int {
None,
......@@ -118,4 +132,9 @@ private:
} // namespace Core