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

New upstream version 0.6.0

parent b2fa9ffc
...@@ -24,3 +24,4 @@ COPYING ...@@ -24,3 +24,4 @@ COPYING
*.icns binary *.icns binary
*.ico binary *.ico binary
*.png 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) cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
project(Zeal VERSION 0.5.0) project(Zeal VERSION 0.6.0)
# Project information. # Project information.
if(APPLE) if(APPLE)
...@@ -15,5 +15,7 @@ string(TIMESTAMP PROJECT_COPYRIGHT "© 2015-%Y Oleg Shparber" UTC) ...@@ -15,5 +15,7 @@ string(TIMESTAMP PROJECT_COPYRIGHT "© 2015-%Y Oleg Shparber" UTC)
set(PROJECT_DESCRIPTION "A simple documentation browser.") set(PROJECT_DESCRIPTION "A simple documentation browser.")
set(PROJECT_URL "https://zealdocs.org") set(PROJECT_URL "https://zealdocs.org")
set(QT_MINIMUM_VERSION 5.5.1)
add_subdirectory(assets) add_subdirectory(assets)
add_subdirectory(src) add_subdirectory(src)
...@@ -8,18 +8,16 @@ ...@@ -8,18 +8,16 @@
Zeal is a simple offline documentation browser inspired by [Dash](https://kapeli.com/dash). Zeal is a simple offline documentation browser inspired by [Dash](https://kapeli.com/dash).
![Screenshot](https://i.imgur.com/v63u1ZJ.png) ![Screenshot](https://i.imgur.com/qBkZduS.png)
[More screenshots](https://imgur.com/a/eVi97)
## Build Status ## Build Status
[![Coverity Scan](https://img.shields.io/coverity/scan/4271.svg?style=flat-square)](https://scan.coverity.com/projects/4271) [![Coverity Scan](https://img.shields.io/coverity/scan/4271.svg?style=flat-square)](https://scan.coverity.com/projects/4271)
OS \ Branch | master | stable | OS | Build Status |
------------|--------|------- | -------- | ------------ |
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) | 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) | [![AppVeyor](https://img.shields.io/appveyor/ci/trollixx/zeal/stable.svg?style=flat-square)](https://ci.appveyor.com/project/trollixx/zeal) | Windows | [![AppVeyor](https://img.shields.io/appveyor/ci/trollixx/zeal/master.svg?style=flat-square)](https://ci.appveyor.com/project/trollixx/zeal) |
## Download ## 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. # TODO: Move zeal.qrc one level up to rely on CMAKE_AUTORCC.
find_package(Qt5Core REQUIRED) find_package(Qt5Core REQUIRED)
qt5_add_resources(App_RESOURCES resources/zeal.qrc) qt5_add_resources(App_RESOURCES resources/zeal.qrc)
# Silence CMP0071.
set_property(SOURCE qrc_zeal.cpp PROPERTY SKIP_AUTOGEN ON)
if(APPLE) if(APPLE)
list(APPEND App_RESOURCES resources/zeal.icns) list(APPEND App_RESOURCES resources/zeal.icns)
...@@ -17,6 +19,10 @@ add_executable(App WIN32 ...@@ -17,6 +19,10 @@ add_executable(App WIN32
target_link_libraries(App Core Util) target_link_libraries(App Core Util)
find_package(Qt5 COMPONENTS Widgets REQUIRED) 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) target_link_libraries(App Qt5::Widgets)
set_target_properties(App PROPERTIES 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 @@ ...@@ -46,10 +46,6 @@
using namespace Zeal; using namespace Zeal;
namespace {
const char contactUrl[] = "https://go.zealdocs.org/l/contact";
}
struct CommandLineParameters struct CommandLineParameters
{ {
bool force; 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 @@ ...@@ -4,31 +4,44 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome</title> <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/welcome.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/font-awesome.min.css">
</head> </head>
<body class="is-unselectable"> <body class="is-unselectable">
<section class="hero is-fullheight"> <section class="hero is-fullheight">
<div class="hero-head"> <div class="hero-body">
<header class="navbar is-transparent" role="navigation"> <div class="container">
<div class="navbar-brand"> <div class="columns is-vcentered">
<a class="navbar-item" href="https://zealdocs.org/">ZealDocs.org</a> <div class="column has-text-centered">
<a class="navbar-item" href="https://gitter.im/zealdocs/zeal">Gitter</a> <p class="title">Zeal
<a class="navbar-item" href="https://github.com/zealdocs/zeal">GitHub</a> <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>
</header>
</div> </div>
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title">
Zeal
</h1>
<h2 class="subtitle">
Docs for everyone
</h2>
</div> </div>
</div> </div>
...@@ -36,21 +49,33 @@ ...@@ -36,21 +49,33 @@
<div class="container"> <div class="container">
<div class="content has-text-centered"> <div class="content has-text-centered">
<p> <p>
<a class="icon" href="https://github.com/zealdocs/zeal"> <a class="icon" onclick="zAppBridge.openShortUrl('github')">
<i class="fa fa-github"></i> <i class="fab fa-github"></i>
</a> </a>
<a class="icon" href="https://twitter.com/zealdocs"> <a class="icon" onclick="zAppBridge.openShortUrl('gitter')">
<i class="fa fa-twitter"></i> <i class="fab fa-gitter"></i>
</a>
<a class="icon" onclick="zAppBridge.openShortUrl('twiter')">
<i class="fab fa-twitter"></i>
</a> </a>
</p> </p>
<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></p> <p></p>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<script>
document.getElementById("version").textContent = zAppBridge.AppVersion;
</script>
</body> </body>
</html> </html>
...@@ -4,59 +4,84 @@ ...@@ -4,59 +4,84 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome</title> <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/welcome.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/font-awesome.min.css">
</head> </head>
<body class="is-unselectable"> <body class="is-unselectable">
<section class="hero is-fullheight"> <section class="hero is-fullheight">
<div class="hero-head"> <div class="hero-body">
<header class="navbar is-transparent" role="navigation"> <div class="container">
<div class="navbar-brand"> <div class="columns is-vcentered">
<a class="navbar-item" href="https://zealdocs.org/">ZealDocs.org</a> <div class="column has-text-centered">
<a class="navbar-item" href="https://gitter.im/zealdocs/zeal">Gitter</a> <p class="title">Zeal
<a class="navbar-item" href="https://github.com/zealdocs/zeal">GitHub</a> <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>
</header>
</div> </div>
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title">
Zeal
</h1>
<h2 class="subtitle">
Docs for everyone
</h2>
</div> </div>
</div> </div>
<div class="hero-foot"> <div class="hero-foot">
<div class="container"> <div class="container">
<div class="content has-text-centered"> <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> <p>
<a class="icon" href="https://github.com/zealdocs/zeal"> <a class="icon" onclick="zAppBridge.openShortUrl('github')">
<i class="fa fa-github"></i> <i class="fab fa-github"></i>
</a> </a>
<a class="icon" href="https://twitter.com/zealdocs"> <a class="icon" onclick="zAppBridge.openShortUrl('gitter')">
<i class="fa fa-twitter"></i> <i class="fab fa-gitter"></i>
</a>
<a class="icon" onclick="zAppBridge.openShortUrl('twiter')">
<i class="fab fa-twitter"></i>
</a> </a>
</p> </p>
<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></p> <p></p>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<script>
document.getElementById("version").textContent = zAppBridge.AppVersion;
</script>
</body> </body>
</html> </html>
...@@ -2,10 +2,13 @@ ...@@ -2,10 +2,13 @@
<qresource prefix="/"> <qresource prefix="/">
<file>zeal.ico</file> <file>zeal.ico</file>
<file>browser/assets/css/darkmode.css</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/highlight.css</file>
<file>browser/assets/css/welcome.min.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.html</file>
<file>browser/welcome-noad.html</file> <file>browser/welcome-noad.html</file>
<file>icons/type/Abbreviation.png</file> <file>icons/type/Abbreviation.png</file>
......
...@@ -109,6 +109,11 @@ Application *Application::instance() ...@@ -109,6 +109,11 @@ Application *Application::instance()
return m_instance; return m_instance;
} }
WidgetUi::MainWindow *Application::mainWindow() const
{
return m_mainWindow;
}
QNetworkAccessManager *Application::networkManager() const QNetworkAccessManager *Application::networkManager() const
{ {
return m_networkManager; return m_networkManager;
......
...@@ -55,6 +55,8 @@ public: ...@@ -55,6 +55,8 @@ public:
static Application *instance(); static Application *instance();
WidgetUi::MainWindow *mainWindow() const;
QNetworkAccessManager *networkManager() const; QNetworkAccessManager *networkManager() const;
Settings *settings() 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 @@ ...@@ -22,9 +22,13 @@
#include "filemanager.h" #include "filemanager.h"
#include <QCoreApplication>
#include <QDateTime>
#include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QStandardPaths>
#include <QtConcurrent> #include <QtConcurrent>
...@@ -35,6 +39,9 @@ static Q_LOGGING_CATEGORY(log, "zeal.core.filemanager") ...@@ -35,6 +39,9 @@ static Q_LOGGING_CATEGORY(log, "zeal.core.filemanager")
FileManager::FileManager(QObject *parent) FileManager::FileManager(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
// Ensure that cache location exists.
// TODO: Check for errors.
QDir().mkpath(cacheLocation());
} }
bool FileManager::removeRecursively(const QString &path) bool FileManager::removeRecursively(const QString &path)
...@@ -74,3 +81,12 @@ bool FileManager::removeRecursively(const QString &path) ...@@ -74,3 +81,12 @@ bool FileManager::removeRecursively(const QString &path)
return true; 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 { ...@@ -30,12 +30,13 @@ namespace Core {
class FileManager : public QObject class FileManager : public QObject
{ {
Q_OBJECT
public: public:
typedef unsigned int JobId;
explicit FileManager(QObject *parent = nullptr); explicit FileManager(QObject *parent = nullptr);
bool removeRecursively(const QString &path); bool removeRecursively(const QString &path);
static QString cacheLocation();
}; };
} // namespace Core } // namespace Core
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "settings.h" #include "settings.h"
#include "filemanager.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QSettings> #include <QSettings>
...@@ -47,6 +49,13 @@ using namespace Zeal::Core; ...@@ -47,6 +49,13 @@ using namespace Zeal::Core;
Settings::Settings(QObject *parent) : Settings::Settings(QObject *parent) :
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(); load();
} }
...@@ -81,13 +90,53 @@ void Settings::load() ...@@ -81,13 +90,53 @@ void Settings::load()
settings->endGroup(); settings->endGroup();
settings->beginGroup(GroupContent); 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},