Commit 94b704f8 authored by ChangZhuo Chen's avatar ChangZhuo Chen

New upstream version 0.4.0

parent 7485026e
# Autodetect text files
* text=auto
# Enforce text mode
*.c text
*.cmake text
*.conf text
*.cpp text
*.css text
*.desktop text
*.h text
*.html text
*.in text
*.md text
*.pri text
*.pro text
*.qrc text
*.ui text
*.yml text
CMakeLists.txt text
COPYING
# Binary files
*.icns binary
*.ico binary
*.png binary
# C++ objects and libs
*.slo
*.lo
*.o
......@@ -10,8 +9,7 @@
*.dll
*.dylib
# Qt-es
# qmake
/.qmake.cache
/.qmake.stash
*.pro.user
......@@ -23,10 +21,12 @@ ui_*.h
Makefile*
*-build-*
# QtCreator
# Qt Creator
*.autosave
#QtCtreator Qml
# Qt Ctreator QML
*.qmlproject.user
*.qmlproject.user.*
# CMake
CMakeLists.txt.user
......@@ -2,8 +2,13 @@ language: c
compiler:
- gcc
build:
pre_ci_boot:
image_name: drydock/u16cppall
image_tag: tip
ci:
- shippable_retry sudo apt-get -y -qq update
- shippable_retry sudo apt-get -y -qq install --no-install-recommends qt5-default libqt5webkit5-dev libqt5x11extras5-dev libarchive-dev libxcb-keysyms1-dev
- qmake
- make
- shippable_retry sudo apt-get -y -qq install --no-install-recommends cmake extra-cmake-modules qt5-default libqt5webkit5-dev libqt5x11extras5-dev libarchive-dev libxcb-keysyms1-dev
- mkdir build; cd build
- cmake ..
- cd ..
- cmake --build build
cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
project(Zeal VERSION 0.4.0)
# Project information.
if(APPLE)
set(PROJECT_OUTPUT_NAME "Zeal")
else()
set(PROJECT_OUTPUT_NAME "zeal")
endif()
set(PROJECT_COMPANY_NAME "ZealDocs")
string(TIMESTAMP PROJECT_COPYRIGHT "© 2015-%Y Oleg Shparber" UTC)
set(PROJECT_DESCRIPTION "A simple documentation browser.")
set(PROJECT_URL "https://zealdocs.org")
add_subdirectory(assets)
add_subdirectory(src)
# Zeal
[![Changelog](https://img.shields.io/github/release/zealdocs/zeal.svg?style=flat-square)](https://github.com/zealdocs/zeal/releases)
[![IRC](https://img.shields.io/badge/chat-on%20irc-blue.svg?style=flat-square)](https://kiwiirc.com/client/irc.freenode.net/#zealdocs)
[![Gitter](https://img.shields.io/gitter/room/zealdocs/zeal.svg?style=flat-square)](https://gitter.im/zealdocs/zeal)
[![Telegram Chat](https://img.shields.io/badge/chat-on%20telegram-179cde.svg?style=flat-square)](https://telegram.me/zealdocschat)
[![IRC](https://img.shields.io/badge/chat-on%20irc-blue.svg?style=flat-square)](https://kiwiirc.com/client/irc.freenode.net/#zealdocs)
[![Telegram Channel](https://img.shields.io/badge/follow-on%20telegram-179cde.svg?style=flat-square)](https://telegram.me/zealdocs)
[![Twitter](https://img.shields.io/badge/follow-on%20twitter-1da1f2.svg?style=flat-square)](https://twitter.com/zealdocs)
......@@ -40,10 +41,9 @@ After installing Zeal, you need to download docsets. Go to *Tools->Docsets*, sel
## How to compile
### Requirements
* [Qt](https://www.qt.io/) version 5.2.0 or above. Required modules: Qt WebKit Widgets, Qt SQL plugin for SQLite, Qt X11 Extras (X11 only).
* [Qt](https://www.qt.io/) version 5.5.1 or above. Required modules: Qt WebKit Widgets, Qt X11 Extras (X11 only).
* [libarchive](http://libarchive.org/).
* X11 only: `xcb-util-keysyms`.
* Ubuntu Unity only: [libappindicator](https://launchpad.net/libappindicator).
To compile Zeal run `qmake` and then `make`. Linux users can install Zeal with `make install` command.
......
if(UNIX AND NOT APPLE)
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
foreach(_i 16 24 32 64 128)
install(FILES "freedesktop/appicons/${_i}/zeal.png"
DESTINATION "${KDE_INSTALL_ICONDIR}/hicolor/${_i}x${_i}/apps"
# TODO: Use `RENAME zeal.png` and get rid of subdirectories.
)
endforeach()
# TODO: Generate via zeal.desktop.in.
install(FILES "freedesktop/zeal.desktop"
DESTINATION ${KDE_INSTALL_APPDIR}
)
endif()
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
# FindSQLite
# ----------
#
# Finds SQLite headers and libraries.
#
# SQLite_FOUND - True if SQLite is found.
# SQLite_INCLUDE_DIR - Path to SQLite header files.
# SQLite_LIBRARY - SQLite library to link to.
# SQLite_VERSION_STRING - The version of SQLite found.
# A simple fallback to pkg-config.
if(NOT WIN32)
find_package(PkgConfig QUIET)
pkg_search_module(PC_SQLITE QUIET sqlite3)
endif()
find_path(SQLite_INCLUDE_DIR NAMES sqlite3.h
PATHS
${PC_SQLITE_INCLUDEDIR}
${PC_SQLITE_INCLUDE_DIRS}
)
find_library(SQLite_LIBRARY NAMES sqlite3
PATHS
${PC_SQLITE_LIBDIR}
${PC_SQLITE_LIBRARY_DIRS}
)
# TODO: Set version when library is found not via pkg-config.
set(SQLite_VERSION_STRING ${PC_SQLITE_VERSION})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLite
REQUIRED_VARS SQLite_LIBRARY SQLite_INCLUDE_DIR
VERSION_VAR SQLite_VERSION_STRING
)
mark_as_advanced(SQLite_INCLUDE_DIR SQLite_LIBRARY)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
......@@ -30,29 +30,9 @@ RCC_DIR = $$BUILD_ROOT/.rcc
UI_DIR = $$BUILD_ROOT/.ui
# Application version
VERSION = 0.3.1
VERSION = 0.4.0
DEFINES += ZEAL_VERSION=\\\"$${VERSION}\\\"
# Browser engine
CONFIG(zeal_qtwebengine) {
qtHaveModule(webenginewidgets): BROWSER_ENGINE = qtwebengine
else: error("Qt WebEngine is not available.")
} else {
qtHaveModule(webkitwidgets): BROWSER_ENGINE = qtwebkit
else: qtHaveModule(webenginewidgets): BROWSER_ENGINE = qtwebengine
else: error("Zeal requires Qt WebEngine or Qt WebKit.")
}
equals(BROWSER_ENGINE, qtwebengine) {
message("Browser engine: Qt WebEngine.")
QT += webenginewidgets
DEFINES += USE_WEBENGINE
} else {
message("Browser engine: Qt WebKit.")
QT += webkitwidgets
DEFINES += USE_WEBKIT
}
# Portable build
CONFIG(zeal_portable) {
message("Portable build: Yes.")
......@@ -63,10 +43,3 @@ CONFIG(zeal_portable) {
unix:!macx {
isEmpty(PREFIX): PREFIX = /usr
}
unix:!macx:packagesExist(appindicator-0.1) {
CONFIG += link_pkgconfig
PKGCONFIG += appindicator-0.1 gtk+-2.0
DEFINES += USE_APPINDICATOR
message("AppIndicator support: Yes.")
}
# Only C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find includes in corresponding build directories.
set(CMAKE_INCLUDE_CURRENT_DIR ON)
## Build options
option(ZEAL_PORTABLE_BUILD "Build portable version")
if(ZEAL_PORTABLE_BUILD)
add_definitions(-DPORTABLE_BUILD)
endif()
## Macro
add_definitions(-DZEAL_VERSION="${Zeal_VERSION}")
# QString options
add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_RESTRICTED_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
## Handle moc, uic, and rcc files.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
include_directories(libs)
add_subdirectory(libs)
add_subdirectory(app)
# TODO: Move zeal.qrc one level up to rely on CMAKE_AUTORCC.
find_package(Qt5Core REQUIRED)
qt5_add_resources(App_RESOURCES resources/zeal.qrc)
if(APPLE)
list(APPEND App_RESOURCES resources/zeal.icns)
elseif(WIN32)
configure_file(versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc)
list(APPEND App_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc)
endif()
add_executable(App WIN32
main.cpp
${App_RESOURCES}
)
target_link_libraries(App Core Util)
find_package(Qt5 COMPONENTS Concurrent Widgets REQUIRED)
target_link_libraries(App Qt5::Concurrent Qt5::Widgets)
set_target_properties(App PROPERTIES
OUTPUT_NAME ${PROJECT_OUTPUT_NAME}
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
if(APPLE)
set_target_properties(App PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
MACOSX_BUNDLE_GUI_IDENTIFIER "org.zealdocs.zeal"
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
MACOSX_BUNDLE_ICON_FILE "zeal.icns"
MACOSX_BUNDLE_COPYRIGHT ${PROJECT_COPYRIGHT}
RESOURCE "resources/zeal.icns"
)
elseif(UNIX)
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
install(TARGETS App DESTINATION ${KDE_INSTALL_BINDIR})
endif()
......@@ -2,7 +2,7 @@ include($$ZEAL_COMMON_PRI)
TEMPLATE = app
QT += gui widgets sql concurrent
QT += gui widgets concurrent
SOURCES += \
main.cpp
......@@ -35,8 +35,11 @@ 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) {
include($$lib_dir/$$basename(lib_dir).pri)
PRE_TARGETDEPS += $$BUILD_ROOT/.lib/lib$${ZEAL_LIB_NAME}.a
# LIBS += -l$$ZEAL_LIB_NAME
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
}
}
}
......@@ -31,8 +31,8 @@
#include <QDir>
#include <QIcon>
#include <QMessageBox>
#include <QSqlDatabase>
#include <QTextStream>
#include <QTimer>
#include <QUrlQuery>
#ifdef Q_OS_WIN32
......@@ -75,9 +75,8 @@ CommandLineParameters parseCommandLine(const QStringList &arguments)
parser.addHelpOption();
parser.addVersionOption();
// TODO: [Qt 5.4] parser.addOption({{"f", "force"}, "Force the application run."});
parser.addOption(QCommandLineOption({QStringLiteral("f"), QStringLiteral("force")},
QObject::tr("Force the application run.")));
parser.addOption({{QStringLiteral("f"), QStringLiteral("force")},
QObject::tr("Force the application run.")});
#ifdef Q_OS_WIN32
parser.addOption(QCommandLineOption({QStringLiteral("register")},
......@@ -105,6 +104,7 @@ CommandLineParameters parseCommandLine(const QStringList &arguments)
// TODO: Support dash-feed:// protocol
const QString arg
= QUrl::fromPercentEncoding(parser.positionalArguments().value(0).toUtf8());
if (arg.startsWith(QLatin1String("dash:"))) {
clParams.query.setQuery(stripParameterUrl(arg, QStringLiteral("dash")));
} else if (arg.startsWith(QLatin1String("dash-plugin:"))) {
......@@ -179,6 +179,11 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain(QStringLiteral("zealdocs.org"));
QCoreApplication::setOrganizationName(QStringLiteral("Zeal"));
#if QT_VERSION >= 0x050600
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QScopedPointer<QApplication> qapp(new QApplication(argc, argv));
const CommandLineParameters clParams = parseCommandLine(qapp->arguments());
......@@ -216,16 +221,14 @@ int main(int argc, char *argv[])
msgBox->setText(QObject::tr("Another application instance can be still running, "
"or has crashed.<br>Make sure to start Zeal only once."));
msgBox->addButton(QMessageBox::Help);
msgBox->addButton(QMessageBox::Retry);
QPushButton *quitButton = msgBox->addButton(QObject::tr("&Quit"),
QMessageBox::DestructiveRole);
msgBox->setDefaultButton(quitButton);
msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Retry));
msgBox->addButton(QObject::tr("&Quit"), QMessageBox::DestructiveRole);
switch (msgBox->exec()) {
case QMessageBox::Rejected:
return EXIT_SUCCESS;
case QMessageBox::Help:
QDesktopServices::openUrl(QUrl(contactUrl));
case QMessageBox::Rejected:
return EXIT_SUCCESS;
case QMessageBox::Help:
QDesktopServices::openUrl(QUrl(contactUrl));
}
msgBox->removeButton(msgBox->button(QMessageBox::Retry));
......@@ -243,30 +246,17 @@ int main(int argc, char *argv[])
}
}
// Check for SQLite plugin
// TODO: Specific to docset format and should be handled accordingly in the future
if (!QSqlDatabase::isDriverAvailable(QStringLiteral("QSQLITE"))) {
QScopedPointer<QMessageBox> msgBox(new QMessageBox());
msgBox->setWindowTitle(QStringLiteral("Zeal"));
msgBox->setIcon(QMessageBox::Critical);
msgBox->setText(QObject::tr("Qt SQLite driver is not available."));
msgBox->addButton(QMessageBox::Help);
QPushButton *quitButton = msgBox->addButton(QObject::tr("&Quit"),
QMessageBox::DestructiveRole);
msgBox->setDefaultButton(quitButton);
if (msgBox->exec() == QMessageBox::Help)
QDesktopServices::openUrl(QUrl(contactUrl));
return EXIT_SUCCESS;
}
QDir::setSearchPaths(QStringLiteral("typeIcon"), {QStringLiteral(":/icons/type")});
QScopedPointer<Core::Application> app(new Core::Application());
QObject::connect(localServer.data(), &Core::LocalServer::newQuery,
app.data(), &Core::Application::executeQuery);
if (!clParams.query.isEmpty())
Core::LocalServer::sendQuery(clParams.query, clParams.preventActivation);
if (!clParams.query.isEmpty()) {
QTimer::singleShot(0, [clParams] {
Core::LocalServer::sendQuery(clParams.query, clParams.preventActivation);
});
}
return qapp->exec();
}
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Dark mode (see #466). */
/* TODO: Check if we need -webkit-filter for old Qt WebKit. */
html {
-webkit-filter: invert() hue-rotate(180deg) contrast(70%);
filter: invert() hue-rotate(180deg) contrast(70%);
}
html img {
-webkit-filter: invert() hue-rotate(180deg) contrast(120%);
filter: invert() hue-rotate(180deg) contrast(120%);
}
This diff is collapsed.
/* Highlight on navigation to an anchor. */
@-webkit-keyframes targetNavigatedAnimation {
from { background: #ffffff; }
50% { background: #ffffdd; }
50% { background: #ffff00; }
to { background: #ffffff; }
}
......
This diff was suppressed by a .gitattributes entry.
<html>
<head>
<title>Start Page</title>
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body onmousedown="event.preventDefault()" oncontextmenu="event.preventDefault()">
<div class="dynamic"></div>
<div class="container">
<img src="qrc:///icons/logo/128x128.png">
<h1 id="title">Zeal</h1>
</div>
<div class="dynamic"></div>
<footer>
<p><a href="https://zealdocs.org">zealdocs.org</a> | <a href="https://twitter.com/zealdocs">@zealdocs</a><p>
<p><small><a href="https://www.kapeli.com/dash">Get Dash for OS X or iOS</a></small><p>
</footer>
</body>
</html>
<html>
<head>
<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/bulma.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="nav">
<div class="container">
<div class="nav-left nav-menu">
<a class="nav-item" href="https://zealdocs.org/">
zealdocs.org
</a>
</div>
</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>
</div>
<div class="hero-foot">
<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>
<a class="icon" href="https://twitter.com/zealdocs">
<i class="fa fa-twitter"></i>
</a>
</p>
<p>
<a class="is-size-7" href="https://www.kapeli.com/dash">Get Dash for OS X or iOS</a>
</p>
</p></p>
</div>
</div>
</div>
</section>
</body>
</html>
<html>
<head>
<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/bulma.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="nav">
<div class="container">
<div class="nav-left nav-menu">
<a class="nav-item" href="https://zealdocs.org/">
zealdocs.org
</a>
</div>
</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>
</div>
<div class="hero-foot">
<div class="container">
<div class="content has-text-centered">
<div id="carbon" class="box">
<script async type="text/javascript" src="https://cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=zealdocsforwindowsorg" id="_carbonads_js"></script>
</div>
<p>
<a class="icon" href="https://github.com/zealdocs/zeal">
<i class="fa fa-github"></i>
</a>
<a class="icon" href="https://twitter.com/zealdocs">
<i class="fa fa-twitter"></i>
</a>
</p>
<p>
<a class="is-size-7" href="https://www.kapeli.com/dash">Get Dash for OS X or iOS</a>
</p>
</p></p>
</div>
</div>
</div>
</section>
</body>
</html>
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.