QInstaller Namespace | Qt Installer Framework Manual

- Qt Installer Framework Manual
- QInstaller Namespace

# QInstaller Namespace

Contains classes to implement the core functionality of the Qt Installer Framework and the installer UI. More...

Header: | #include <QInstaller>

## Namespaces

namespace | Protocol
namespace | TaskRole
namespace | Ui

## Classes

class | AbstractArchive
class | AbstractFileTask
class | AbstractOperationTracer
class | AliasFinder
struct | AliasSource
struct | ArchiveEntry
class | ArchiveFactory
class | AspectRatioLabel
class | BinaryContent
class | BinaryFormatEngine
class | BinaryFormatEngineHandler
struct | BinaryLayout
class | CacheableItem
class | Component
class | ComponentAlias
class | ComponentModel
class | ComponentSelectionPage
class | ComponentSortFilterProxyModel
class | ConcurrentOperationRunner
class | ConcurrentOperationTracer
class | DirectoryGuard
class | FileGuard
class | FileGuardLocker
class | FileTaskItem
class | FileTaskResult
class | FinishedPage
class | GenericDataCache
class | IntroductionPage
class | Lib7zArchive
class | LibArchiveArchive
class | LibArchiveWrapper
class | LicenseAgreementPage
class | LoggingHandler
class | MessageBoxHandler
class | Metadata
class | MetadataCache
struct | OperationBlob
class | OperationTracer
class | PackageManagerCore
class | PackageManagerGui
class | PackageManagerPage
struct | PackageSource
class | PerformInstallationForm
class | PerformInstallationPage
class | ReadyForInstallationPage
class | Resource
class | ResourceCollection
class | ResourceCollectionManager
class | RestartPage
class | ScriptEngine
class | StartMenuDirectoryPage
class | SystemInfo
class | TargetDirectoryPage

## Types

| AutoDependencyHash
enum | DefaultFilePermissions { NonExecutable, Executable }
enum | DownloadType { All, CompressedPackage }
enum | JobError { InvalidUrl, Timeout, DownloadError, InvalidUpdatesXml, InvalidMetaInfo, …, CacheError }
| LocalDependencyHash
| LocalPackagesMap
| Operation
| OperationList
| Package
| PackagesList
| RepoHash

## Functions

bool | canCreateSymbolicLinks()
QStringList | checkMutualOptions(const CommandLineParser &parser, const QStringList &options)
QString | htmlToString(const QString &html)
QString | humanReadableSize(const qint64 &size, int precision = 2)
void | init()
QStringList | loggingCategories()
hashValue | qHash(const QInstaller::PackageSource &key, hashValue seed)
hashValue | qHash(const QInstaller::Repository &repository)
hashValue | qHash(const QInstaller::RepositoryCategory &repository)
hashValue | qHash(const QInstaller::AliasSource &key, hashValue seed)
bool | receivePacket(QIODevice *device, QByteArray *command, QByteArray *data)
void | removeSystemGeneratedFiles(const QString &path)
void | replaceHighDpiImage(QString &imagePath)
QString | replacePath(const QString &path, const QString &before, const QString &after, bool cleanPath = true)
void | sendPacket(QIODevice *device, const QByteArray &command, const QByteArray &data)
bool | setDefaultFilePermissions(const QString &fileName, QInstaller::DefaultFilePermissions permissions)
bool | setDefaultFilePermissions(QFile *file, QInstaller::DefaultFilePermissions permissions)
bool | startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid = 0)
void | trimmedCopyConfigData(const QString &source, const QString &target, const QStringList &elementsToRemoveTags)
QDataStream & | operator<<(QDataStream &ostream, const QInstaller::ArchiveEntry &entry)
QDebug | operator<<(QDebug dbg, QInstaller::Component *component)
bool | operator==(const QInstaller::PackageSource &lhs, const QInstaller::PackageSource &rhs)
bool | operator==(const QInstaller::ArchiveEntry &lhs, const QInstaller::ArchiveEntry &rhs)
bool | operator==(const QInstaller::AliasSource &lhs, const QInstaller::AliasSource &rhs)
QDataStream & | operator>>(QDataStream &istream, QInstaller::ArchiveEntry &entry)

## Detailed Description

## Namespaces

### namespace QInstaller::Protocol

### namespace QInstaller::TaskRole

### namespace QInstaller::Ui

## Classes

### class AbstractArchive

The AbstractArchive class is the base class for classes representing different archive files. It cannot be instantiated on its own but defines the API and provides common functionality when subclassed. More...

### class AbstractFileTask

The AbstractFileTask class is the base class of file related tasks. More...

### class AbstractOperationTracer

The AbstractOperationTracer is a pure virtual base class for classes tracing starting and finishing of installer operations. More...

### class AliasFinder

Creates component alias objects from parsed alias source files, based on version and source priorities. More...

### class AliasSource

Describes a source for alias declarations. More...

### class ArchiveEntry

The ArchiveEntry struct represents an entry in an archive file, which can be for example a file or a directory. More...

### class ArchiveFactory

The ArchiveFactory class is used to create archive objects based on the suffix of a given filename. More...

### class AspectRatioLabel

The AspectRatioLabel class provides a label for displaying a pixmap that maintains its original aspect ratio when resized. More...

### class BinaryContent

The BinaryContent class handles binary information embedded into executables. More...

### class BinaryFormatEngine

The BinaryFormatEngine class is the default file engine for accessing resource collections and resource files. More...

### class BinaryFormatEngineHandler

The BinaryFormatEngineHandler class provides a way to register resource collections and resource files. More...

### class BinaryLayout

The BinaryLayout class describes the binary content appended to a file. More...

### class CacheableItem

The CacheableItem is a pure virtual class that defines an interface for a type suited for storage with the GenericDataCache class. More...

### class Component

The Component class represents the current component. More...

### class ComponentAlias

The ComponentAlias class represents an alias for single or multiple components. More...

### class ComponentModel

The ComponentModel class holds a data model for visual representation of available components to install. More...

### class ComponentSelectionPage

The ComponentSelectionPage class changes the checked state of components. More...

### class ComponentSortFilterProxyModel

The ComponentSortFilterProxyModel provides support for sorting and filtering data passed between another model and a view. More...

### class ConcurrentOperationRunner

The ConcurrentOperationRunner class can be used to perform installer operations concurrently. More...

### class ConcurrentOperationTracer

The ConcurrentOperationTracer prints trace output for starting of asynchronous operations. More...

### class DirectoryGuard

RAII class to create a directory and delete it on destruction unless released. More...

### class FileGuard

The `FileGuard` class provides basic access serialization for file paths. More...

### class FileGuardLocker

The `FileGuardLocker` class locks a file path and releases it on destruction. More...

### class FileTaskItem

The FileTaskItem class represents an item in a file task object. More...

### class FileTaskResult

The FileTaskResult class represents the results of a file task. More...

### class FinishedPage

The FinishedPage class completes the installation wizard. More...

### class GenericDataCache

The GenericDataCache is a template class for a checksum based storage of items on disk. More...

### class IntroductionPage

The IntroductionPage class displays information about the product to install. More...

### class Lib7zArchive

The Lib7zArchive class represents an archive file handled with the LZMA software development kit. More...

### class LibArchiveArchive

The LibArchiveArchive class represents an archive file handled with libarchive archive and compression library. More...

### class LibArchiveWrapper

The LibArchiveWrapper class provides an interface for interacting with archives handled using the libarchive archive and compression library. More...

### class LicenseAgreementPage

The LicenseAgreementPage presents a license agreement to the end users for acceptance. More...

### class LoggingHandler

The LoggingHandler class provides methods for manipulating the application-wide verbosiveness and format of printed debug messages. More...

### class MessageBoxHandler

The MessageBoxHandler class provides a modal dialog for informing the user or asking the user a question and receiving an answer. More...

### class Metadata

The Metadata class represents fetched metadata from a repository. More...

### class MetadataCache

The MetadataCache is a class for a checksum based storage of `Metadata` objects on disk. More...

### class OperationBlob

The OperationBlob class is a textual representation of an operation that can be instantiated and executed by the Qt Installer Framework. More...

### class OperationTracer

The OperationTracer prints trace output for starting of operations and automatically indicates finish on destruction. More...

### class PackageManagerCore

The PackageManagerCore class provides the core functionality of the Qt Installer Framework. More...

### class PackageManagerGui

The PackageManagerGui class provides the core functionality for non-interactive installations. More...

### class PackageManagerPage

The PackageManagerPage class displays information about the product to install. More...

### class PackageSource

The PackageSource class specifies a single package source. More...

### class PerformInstallationForm

The PerformInstallationForm class shows progress information about the installation state. More...

### class PerformInstallationPage

The PerformInstallationPage class shows progress information about the installation state. More...

### class ReadyForInstallationPage

The ReadyForInstallationPage class informs end users that the installation can begin. More...

### class Resource

The Resource class is an interface for wrapping a file as read only device. More...

### class ResourceCollection

The ResourceCollection class is an abstraction that groups together a number of resources. More...

### class ResourceCollectionManager

The ResourceCollectionManager class is an abstraction that groups together a number of resource collections. More...

### class RestartPage

The RestartPage class enables restarting the installer. More...

### class ScriptEngine

The ScriptEngine class is used to prepare and run the component scripts. More...

### class StartMenuDirectoryPage

The StartMenuDirectoryPage class specifies the program group for the product in the Windows Start menu. More...

### class SystemInfo

Provides information about the operating system. More...

### class TargetDirectoryPage

The TargetDirectoryPage class specifies the target directory for the installation. More...

## Type Documentation

### QInstaller::AutoDependencyHash

Synonym for QHash<QString, QStringList>. The hash key is component name, that other components automatically depend on. The value can contain several component names, which are installed as an automatic dependency. For example:

     <Name>A</Name> //Hash value
     <AutoDependOn>B</AutoDependOn> //Hash key

### enum QInstaller::DefaultFilePermissions

Constant | Value | Description
--- | --- | ---
`QInstaller::NonExecutable` | `0x6644` | Default permissions for a non-executable file.
`QInstaller::Executable` | `0x7755` | Default permissions for an executable file.

### enum QInstaller::DownloadType

Constant | Value
--- | ---
`QInstaller::All` | `0`
`QInstaller::CompressedPackage` | `1`

### enum QInstaller::JobError

Constant | Value
--- | ---
`QInstaller::InvalidUrl` | `0x24B04`
`QInstaller::Timeout` | `0x24b05`
`QInstaller::DownloadError` | `0x24b06`
`QInstaller::InvalidUpdatesXml` | `0x24b07`
`QInstaller::InvalidMetaInfo` | `0x24b08`
`QInstaller::ExtractionError` | `0x24b09`
`QInstaller::UserIgnoreError` | `0x24b0a`
`QInstaller::RepositoryUpdatesReceived` | `0x24b0b`
`QInstaller::CacheError` | `0x24b0c`

### QInstaller::LocalDependencyHash

Synonym for QHash<QString, QStringList>. The hash key is component name, which other components depend on. The value can contain several component names, which depend on the key. For example:

     <Name>A</Name> //Hash value
     <Dependencies>B</Dependencies> //Hash key

### QInstaller::LocalPackagesMap

Synonym for QMap<QString, KDUpdater::LocalPackage>. The map key is component name, and value contains information about the local package.

### QInstaller::Operation

Synonym for KDUpdater::UpdateOperation.

### QInstaller::OperationList

Synonym for QList<QInstaller::Operation*>.

### QInstaller::Package

Synonym for KDUpdater::Update.

### QInstaller::PackagesList

Synonym for QList<QInstaller::Package*>.

### QInstaller::RepoHash

Synonym for QHash<QString, QPair<Repository, Repository> >. Describes a repository update with the supported key strings being replace, remove, and add.

## Function Documentation

### bool QInstaller::canCreateSymbolicLinks()

On Windows checks if the user account has the privilege required to create a symbolic links. Returns `true` if the privilege is held, `false` otherwise.

On Unix platforms always returns `true`.

### QStringList QInstaller::checkMutualOptions(const CommandLineParser &parser, const QStringList &options)

Returns a list of mutually exclusive options passed to the parser, if there is at least one mutually exclusive pair of options set. Otherwise returns an empty `QStringList`. The options considered mutual are provided with options.

### QString QInstaller::htmlToString(const QString &html)

Converts and returns a string html containing an HTML document as a plain text.

### QString QInstaller::humanReadableSize(const qint64 &size, int precision = 2)

Returns the given size in a measuring unit suffixed human readable format, with precision marking the number of shown decimals.

### void QInstaller::init()

Initializes the 7z library and installer resources. Registers custom operations and installs a custom message handler.

### QStringList QInstaller::loggingCategories()

Returns available logging categories.

### hashValue QInstaller::qHash(const QInstaller::PackageSource &key, hashValue seed)

Returns the hash value for the key, using seed to seed the calculation.

### hashValue QInstaller::qHash(const QInstaller::Repository &repository)

Returns a hash of the repository.

### hashValue QInstaller::qHash(const QInstaller::RepositoryCategory &repository)

Returns a hash of the repository category repository.

### hashValue QInstaller::qHash(const QInstaller::AliasSource &key, hashValue seed)

Returns the hash value for the key, using seed to seed the calculation.

### bool QInstaller::receivePacket(QIODevice *device, QByteArray *command, QByteArray *data)

Reads a packet from device, and stores its content into command and data.

Returns `false` if the packet in the device buffer is yet incomplete, `true` otherwise.

Note: Both client and server need to have the same endianness.

### void QInstaller::removeSystemGeneratedFiles(const QString &path)

Removes system generated files from path on Windows and macOS. Does nothing on Linux.

### void QInstaller::replaceHighDpiImage(QString &imagePath)

Replaces imagePath with high dpi image. If high dpi image is not provided or high dpi screen is not in use, the original value is returned.

### QString QInstaller::replacePath(const QString &path, const QString &before, const QString &after, bool cleanPath = true)

Replaces the path before with the path after at the beginning of path and returns the replaced path. If before cannot be found in path, the original value is returned. If cleanPath is `true`, path is returned with directory separators normalized (that is, platform-native separators converted to "/") and redundant ones removed, and "."s and ".."s resolved (as far as possible). If cleanPath is `false`, path is returned as such. Default value is `true`.

### void QInstaller::sendPacket(QIODevice *device, const QByteArray &command, const QByteArray &data)

Write a packet containing command and data to device.

Note: Both client and server need to have the same endianness.

### bool QInstaller::setDefaultFilePermissions(const QString &fileName, QInstaller::DefaultFilePermissions permissions)

Sets permissions of file or directory specified by fileName to `644` or `755` based by the value of permissions.

Returns `true` on success, `false` otherwise.

### bool QInstaller::setDefaultFilePermissions(QFile *file, QInstaller::DefaultFilePermissions permissions)

Sets permissions of file or directory specified by file to `644` or `755` based by the value of permissions. This is effective only on Unix platforms as `setPermissions()` does not manipulate ACLs. On Windows NTFS volumes this only unsets the legacy read-only flag regardless of the value of permissions.

Returns `true` on success, `false` otherwise.

### bool QInstaller::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid = 0)

Starts the program program with the arguments arguments in a new process, and detaches from it. Returns true on success; otherwise returns false. If the calling process exits, the detached process will continue to live.

Note that arguments that contain spaces are not passed to the process as separate arguments.

Unix: The started process will run in its own session and act like a daemon. Windows: Arguments that contain spaces are wrapped in quotes. The started process will run as a regular standalone process.

The process will be started in the directory workingDirectory.

If the function is successful then pid is set to the process identifier of the started process.

Additional note: The difference in using this function over its equivalent from QProcess appears on Windows. While this function will truly detach and not show a GUI window for the started process, the QProcess version will.

### void QInstaller::trimmedCopyConfigData(const QString &source, const QString &target, const QStringList &elementsToRemoveTags)

Copies an internal configuration file from source to target. The XML elements, and their children, specified by elementsToRemoveTags will be removed from the target file. All relative filenames referenced in the source configuration file will be also copied to the location of the target file.

Throws `QInstaller::Error` in case of failure.

### QDataStream &QInstaller::operator<<(QDataStream &ostream, const QInstaller::ArchiveEntry &entry)

Writes an entry to the specified ostream. Returns a reference to ostream.

### QDebug QInstaller::operator<<(QDebug dbg, QInstaller::Component *component)

Returns the debugging output stream, dbg, for the component component.

### bool QInstaller::operator==(const QInstaller::PackageSource &lhs, const QInstaller::PackageSource &rhs)

Returns `true` if lhs and rhs are equal; otherwise returns `false`.

### bool QInstaller::operator==(const QInstaller::ArchiveEntry &lhs, const QInstaller::ArchiveEntry &rhs)

Returns `true` if left-hand-side entry lhs is equal to right-hand-size entry rhs.

### bool QInstaller::operator==(const QInstaller::AliasSource &lhs, const QInstaller::AliasSource &rhs)

Returns `true` if lhs and rhs are equal; otherwise returns `false`.

### QDataStream &QInstaller::operator>>(QDataStream &istream, QInstaller::ArchiveEntry &entry)

Reads an entry from the specified istream. Returns a reference to istream.