Union::PackageHandler Class

class Union::PackageHandler
Header: #include <PackageHandler.h>

Public Types

struct CreateInfo

Public Functions

QList<Union::StylePackage> allPackages(Union::PackageHandler::PackageFilter filter = PackageFilter::Default)
Union::PackageHandler::Error create(Union::StylePackage &destination, const Union::PackageHandler::CreateInfo &info)
Union::PackageHandler::Error install(const Union::StylePackage &package)
Union::StylePackage package(const QString &id)
Union::PackageHandler::Error uninstall(const Union::StylePackage &package)
Union::PackageHandler::Error update(const Union::StylePackage &updatePackage)

Detailed Description

A class that contains operations that can be performed on style packages.

This encapsulates things like listing packages, installing and uninstalling and related operations.

Member Function Documentation

QList<Union::StylePackage> PackageHandler::allPackages(Union::PackageHandler::PackageFilter filter = PackageFilter::Default)

Returns a list of all installed packages.

Union::PackageHandler::Error PackageHandler::create(Union::StylePackage &destination, const Union::PackageHandler::CreateInfo &info)

Create a new package.

Union::PackageHandler::Error PackageHandler::install(const Union::StylePackage &package)

Install a package.

This will install the package \p package if it is valid by copying the contents to a platform-specific installation directory. It will return Error::None if installation was successful. Installation will fail and return Error::AlreadyInstalled if the package is already installed. It may also return Error::FilesystemError if any operating system error occurs.

Union::StylePackage PackageHandler::package(const QString &id)

Returns the package with id \p id or an invalid package if it cannot be found.

Union::PackageHandler::Error PackageHandler::uninstall(const Union::StylePackage &package)

Uninstall a package.

This will uninstall the package \p package if it is currently installed. It will return Error::None if uninstallation was successful. It will return Error::NotInstalled if the package is not installed. It will return Error::FilesystemError if an operating system error occurs.

Union::PackageHandler::Error PackageHandler::update(const Union::StylePackage &updatePackage)

Update a package.

This will update an installed package with the same ID as \p updatePackage and replace its contents with the contents of \p updatePackage. It will return Error::None if the update was successful. It will return Error::NotInstalled if no installed package with the same ID could be found. It will return Error::NotAnUpdate if the given package is not considered to be an update for the installed package.

Updating happens by first uninstalling the existing package and then installing \p updatePackage. Any error that occurs during these steps will cause the update to fail and will return the error.