Skip to main content

Overview

The Zeal::Core::Application class is the central singleton managing Zeal’s application lifecycle, settings, networking, docset registry, and other core services. It inherits from QObject and follows the singleton pattern. Header: <core/application.h> Namespace: Zeal::Core

Constructor & Destructor

Application()

explicit Application(QObject *parent = nullptr)
Constructs the Application instance. Should only be called once as this is a singleton.
parent
QObject*
default:"nullptr"
Parent QObject for memory management

~Application()

~Application() override
Destructor that cleans up all managed resources.

Static Methods

instance()

static Application *instance()
Returns the singleton instance of the Application. Returns: Pointer to the Application singleton instance Example:
auto registry = Core::Application::instance()->docsetRegistry();
const Core::Settings *settings = Core::Application::instance()->settings();
Source: src/libs/core/application.h:40

cacheLocation()

static QString cacheLocation()
Returns the directory path where Zeal stores cache data. Returns: Absolute path to the cache directory Source: src/libs/core/application.h:52

configLocation()

static QString configLocation()
Returns the directory path where Zeal stores configuration files. Returns: Absolute path to the configuration directory Source: src/libs/core/application.h:53

version()

static QVersionNumber version()
Returns the application version as a QVersionNumber. Returns: Version number object Source: src/libs/core/application.h:54

versionString()

static QString versionString()
Returns the application version as a human-readable string. Returns: Version string (e.g., “0.7.0”) Source: src/libs/core/application.h:55

Public Methods

mainWindow()

WidgetUi::MainWindow *mainWindow() const
Returns the main application window. Returns: Pointer to the MainWindow instance Source: src/libs/core/application.h:42

showMainWindow()

void showMainWindow(bool forceMinimized = false)
Shows the main window, optionally forcing it to start minimized.
forceMinimized
bool
default:"false"
If true, show the window minimized regardless of settings
Source: src/libs/core/application.h:43

networkManager()

QNetworkAccessManager *networkManager() const
Returns the application’s network access manager for HTTP requests. Returns: Pointer to the QNetworkAccessManager instance Source: src/libs/core/application.h:45

settings()

Settings *settings() const
Returns the application settings manager. Returns: Pointer to the Settings instance Example:
Core::Settings *settings = Core::Application::instance()->settings();
if (settings->startMinimized) {
    // Handle minimized start
}
Source: src/libs/core/application.h:46

docsetRegistry()

Registry::DocsetRegistry *docsetRegistry()
Returns the docset registry managing all documentation sets. Returns: Pointer to the DocsetRegistry instance Example:
auto registry = Core::Application::instance()->docsetRegistry();
const auto docsets = registry->docsets();
Source: src/libs/core/application.h:48

fileManager()

FileManager *fileManager() const
Returns the file manager for handling file operations. Returns: Pointer to the FileManager instance Source: src/libs/core/application.h:49

httpServer()

HttpServer *httpServer() const
Returns the HTTP server used to serve local documentation. Returns: Pointer to the HttpServer instance Example:
QUrl url = Core::Application::instance()->httpServer()->mount(name, docset->documentPath());
Source: src/libs/core/application.h:50

Public Slots

executeQuery()

void executeQuery(const Registry::SearchQuery &query, bool preventActivation)
Executes a search query in the docset registry.
query
const Registry::SearchQuery&
The search query to execute
preventActivation
bool
If true, prevent activating the main window
Source: src/libs/core/application.h:58

extract()

void extract(const QString &filePath, const QString &destination, const QString &root = QString())
Extracts an archive file (e.g., docset tarball) to a destination directory.
filePath
const QString&
Path to the archive file to extract
destination
const QString&
Directory where contents should be extracted
root
const QString&
default:"QString()"
Optional root directory within the archive to extract from
Source: src/libs/core/application.h:59

download()

QNetworkReply *download(const QUrl &url)
Initiates a download from the specified URL.
url
const QUrl&
URL to download from
Returns: QNetworkReply object for the download operation Source: src/libs/core/application.h:60

checkForUpdates()

void checkForUpdates(bool quiet = false)
Checks for available application updates.
quiet
bool
default:"false"
If true, suppress UI notifications
Source: src/libs/core/application.h:61

Signals

extractionCompleted()

void extractionCompleted(const QString &filePath)
Emitted when an extraction operation completes successfully.
filePath
const QString&
Path to the file that was extracted
Source: src/libs/core/application.h:64

extractionError()

void extractionError(const QString &filePath, const QString &errorString)
Emitted when an extraction operation fails.
filePath
const QString&
Path to the file that failed to extract
errorString
const QString&
Error message describing the failure
Source: src/libs/core/application.h:65

extractionProgress()

void extractionProgress(const QString &filePath, qint64 extracted, qint64 total)
Emitted periodically during extraction to report progress.
filePath
const QString&
Path to the file being extracted
extracted
qint64
Number of bytes extracted so far
total
qint64
Total number of bytes to extract
Source: src/libs/core/application.h:66

updateCheckDone()

void updateCheckDone(const QString &version = QString())
Emitted when update check completes.
version
const QString&
default:"QString()"
Available version string if an update is available, empty otherwise
Source: src/libs/core/application.h:67

updateCheckError()

void updateCheckError(const QString &message)
Emitted when update check fails.
message
const QString&
Error message describing the failure
Source: src/libs/core/application.h:68

Usage Example

// Access the singleton instance
auto app = Zeal::Core::Application::instance();

// Get settings
auto settings = app->settings();
if (settings->isFuzzySearchEnabled) {
    // Use fuzzy search
}

// Access docset registry
auto registry = app->docsetRegistry();
for (const auto *docset : registry->docsets()) {
    qDebug() << docset->title();
}

// Mount documentation via HTTP server
QUrl url = app->httpServer()->mount("python", "/path/to/docs");

// Check for updates
connect(app, &Application::updateCheckDone, [](const QString &version) {
    if (!version.isEmpty()) {
        qDebug() << "Update available:" << version;
    }
});
app->checkForUpdates();

Build docs developers (and LLMs) love