summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2013-02-28 16:32:23 +0100
committerKai Koehne <kai.koehne@digia.com>2013-04-23 16:33:47 +0200
commit20fc67fdf1569dc349ae2b703ff911fbcf72836d (patch)
treed40da766798eb1eb30acf4fc9658fc98568740e2
parent2d832326bd1b6257849b23a86527c12a19d120b9 (diff)
Add documentation for JS API
Change-Id: Ifef70bf0ef12b90972186f64ff9b0ae602f14420 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
-rw-r--r--doc/config/installerfw-project.qdocconf15
-rw-r--r--doc/scripting.qdoc31
-rw-r--r--src/libs/installer/component.cpp296
-rw-r--r--src/libs/installer/messageboxhandler.cpp83
-rw-r--r--src/libs/installer/packagemanagercore.cpp642
5 files changed, 926 insertions, 141 deletions
diff --git a/doc/config/installerfw-project.qdocconf b/doc/config/installerfw-project.qdocconf
index 3b96a00af..fc0074d8c 100644
--- a/doc/config/installerfw-project.qdocconf
+++ b/doc/config/installerfw-project.qdocconf
@@ -3,6 +3,12 @@ description = "Qt Installer Framework Manual"
headerdirs =
sourcedirs = $SRCDIR
+
+# Contains documentation for JS API
+sources = $SRCDIR/../src/libs/installer/packagemanagercore.cpp \
+ $SRCDIR/../src/libs/installer/component.cpp \
+ $SRCDIR/../src/libs/installer/messageboxhandler.cpp
+
imagedirs = $SRCDIR/images $SRCDIR/templates/images
outputdir = $OUTDIR
exampledirs = $SRCDIR $SRCDIR/examples
@@ -13,7 +19,7 @@ include(macros.qdocconf)
include(qt-cpp-ignore.qdocconf)
include(qt-defines.qdocconf)
-sources.fileextensions = "*.qdoc"
+sources.fileextensions = "*.qdoc *.cpp"
qhp.projects = InstallerFramework
qhp.InstallerFramework.file = ifw.qhp
@@ -34,3 +40,10 @@ qhp.InstallerFramework.subprojects.manual.type = manual
macro.see = "\\sa"
macro.function = "\\fn"
+
+
+# We 'misuse' QML doc commands to generate JS documentation
+# (only works with qdoc from Qt 5)
+
+outputprefixes = QML
+outputprefixes.QML =
diff --git a/doc/scripting.qdoc b/doc/scripting.qdoc
index 410e1645a..d0094575c 100644
--- a/doc/scripting.qdoc
+++ b/doc/scripting.qdoc
@@ -57,8 +57,8 @@
}
\endcode
- For more information, see the documentation for \a addWizardPage and
- \a userInterface.
+ For more information, see the documentation for \l QInstaller::addWizardPage and
+ \l Component::userInterface.
\section1 Installer Hooks
@@ -73,13 +73,13 @@
\o Called when the language of the installer changes.
\row
\o \a{Component.prototype.createOperations}
- \o See \a QInstaller::Component::createOperations.
+ \o See \l Component::createOperations.
\row
\o \a{Component.prototype.createOperationsForArchive}
- \o See \a QInstaller::Component::createOperationsForArchive.
+ \o See \l Component::createOperationsForArchive.
\row
\o \a{Component.prototype.createOperationsForPath}
- \o See \a QInstaller::Component::createOperationsForPath.
+ \o See \l Component::createOperationsForPath.
\endtable
\section1 Global Variables
@@ -92,25 +92,22 @@
\o Description
\row
\o installer
- \o Reference to the \a installer of the component
+ \o Reference to the \l QInstaller of the component
\row
\o component
- \o Reference to the \a Component of the component
+ \o Reference to the \l Component of the component
\endtable
- All methods marked with \a Q_INVOKABLE as well as all signals, slots, and
- properties can be used by the script.
-
\section1 Message Boxes
- You can show a \a QMessageBox from within the script by using:
+ You can show a \l QMessageBox from within the script by using:
- \code
- QMessageBox.critical
- QMessageBox.information
- QMessageBox.question
- QMessageBox.warning
- \endcode
+ \list
+ \li \l QMessageBox::critical
+ \li \l QMessageBox::information
+ \li \l QMessageBox::question
+ \li \l QMessageBox::warning
+ \endlist
For your convenience, the values for \a QMessageBox::StandardButton are made
available by using \a QMessageBox.Ok, \a QMessageBox.Open, and so on.
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 76c7d6ef3..0de8014fa 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -75,10 +75,131 @@ static const QLatin1String scCurrentState("CurrentState");
static const QLatin1String scForcedInstallation("ForcedInstallation");
/*!
- \class QInstaller::Component
- Component describes a component within the installer.
+ \qmltype Component
+ \inqmlmodule scripting
+
+ \brief Represents an installer component in Qt Script.
+
+ The object represents the component an install script belongs to. It is accessible through the
+ global \c component variable:
+
+ \code
+ function Component()
+ {
+ print("component: " + component.displayName);
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty string Component::name
+
+ Returns the name of the component as set in the \c <Name> tag of the package
+ information file.
+*/
+
+/*!
+ \qmlproperty string Component::displayName
+
+ Returns the name of the component as shown in the user interface.
+*/
+
+/*!
+ \qmlproperty boolean Component::selected
+
+ Indicates whether the component is currently selected.
+*/
+
+/*!
+ \qmlproperty boolean Component::autoCreateOperations
+
+ Specifies whether some standard operations for the component should be
+ automatically created when the installation starts. The default is \c true.
+*/
+
+/*!
+ \qmlproperty stringlist Component::archives
+
+ Returns the list of archive URL's (prefixed with \c installer://) registered
+ for the component.
+
+ \sa addDownloadableArchive, removeDownloadableArchive
+*/
+
+/*!
+ \qmlproperty stringlist Component::dependencies
+
+ This read-only property contains components this component depends on.
+*/
+
+/*!
+ \qmlproperty stringlist Component::autoDependencies
+
+ Returns the value of the \c <AutoDependsOn> tag in the package information file.
+*/
+
+/*!
+ \qmlproperty boolean Component::fromOnlineRepository
+
+ Returns whether this component has been loaded from an online repository.
+
+ \sa isFromOnlineRepository
+*/
+
+/*!
+ \qmlproperty url Component::repositoryUrl
+
+ Returns the repository URL the component is downloaded from.
+ When this component is not downloaded from an online repository, returns an empty #QUrl.
+
+*/
+
+/*!
+ \qmlproperty boolean Component::default
+
+ This read-only property indicates if the component is a default one.
+
+ \note Always \c false for virtual components.
+
+ \sa isDefault
+*/
+
+/*!
+ \qmlproperty boolean Component::installed
+
+ This read-only property returns if the component is installed.
+
+ \sa isInstalled
+*/
+
+/*!
+ \qmlproperty boolean Component::enabled
+
+ Indicates whether the component is currently enabled. The property is both readable and writable.
+*/
+
+/*!
+ \qmlsignal Component::loaded()
+
+ Emitted when the component has been loaded.
+*/
+
+
+/*!
+ \qmlsignal Component::selectedChanged(boolean isSelected)
+
+ Emitted when the component selection has changed to \a isSelected.
+*/
+
+/*!
+ \qmlsignal Component::valueChanged(string key, string value)
+
+ Emitted when the variable with name \a key has changed to \a value.
+
+ \sa setValue
*/
+
/*!
Constructor. Creates a new Component inside of \a installer.
*/
@@ -227,9 +348,11 @@ QHash<QString,QString> Component::variables() const
}
/*!
+ \qmlmethod string Component::value(string key, string value = "")
+
Returns the value of variable name \a key. If \a key is not known yet, \a defaultValue is returned.
Note: If a component is virtual and you ask for the component value with key "Default", it will always
- return false.
+ return \c false.
*/
QString Component::value(const QString &key, const QString &defaultValue) const
{
@@ -239,6 +362,8 @@ QString Component::value(const QString &key, const QString &defaultValue) const
}
/*!
+ \qmlmethod void Component::setValue(string key, string value)
+
Sets the value of the variable with \a key to \a value.
*/
void Component::setValue(const QString &key, const QString &value)
@@ -354,7 +479,7 @@ void Component::loadComponentScript()
Loads the script at \a fileName into this component's script engine. The installer and all its
components as well as other useful stuff are being exported into the script.
Read \link componentscripting Component Scripting \endlink for details.
- \throws Error when either the script at \a fileName couldn't be opened, or the QScriptEngine
+ Throws an error when either the script at \a fileName couldn't be opened, or the QScriptEngine
couldn't evaluate the script.
*/
void Component::loadComponentScript(const QString &fileName)
@@ -443,7 +568,7 @@ QScriptValue Component::callScriptMethod(const QString &methodName, const QScrip
Loads the translations matching the name filters \a qms inside \a directory. Only translations
with a \link QFileInfo::baseName() baseName \endlink matching the current locales \link
QLocale::name() name \endlink are loaded.
- Read \ref componenttranslation for details.
+ Read \l componenttranslation for details.
*/
void Component::loadTranslations(const QDir &directory, const QStringList &qms)
{
@@ -463,7 +588,7 @@ void Component::loadTranslations(const QDir &directory, const QStringList &qms)
/*!
Loads the user interface files matching the name filters \a uis inside \a directory. The loaded
interface can be accessed via userInterfaces by using the class name set in the ui file.
- Read \ref componentuserinterfaces for details.
+ Read \l componentuserinterfaces for details.
*/
void Component::loadUserInterfaces(const QDir &directory, const QStringList &uis)
{
@@ -530,8 +655,11 @@ void Component::loadLicenses(const QString &directory, const QHash<QString, QVar
}
}
+
/*!
- Contains a list of all user interface class names known to this component.
+ \qmlproperty stringlist Component::userInterfaces
+
+ Returns a list of all user interface class names known to this component.
*/
QStringList Component::userInterfaces() const
{
@@ -544,6 +672,8 @@ QHash<QString, QPair<QString, QString> > Component::licenses() const
}
/*!
+ \qmlmethod QWidget Component::userInterface(string name)
+
Returns the QWidget created for \a name or 0 if the widget already has been deleted or cannot be found.
*/
QWidget *Component::userInterface(const QString &name) const
@@ -552,9 +682,11 @@ QWidget *Component::userInterface(const QString &name) const
}
/*!
+ \qmlmethod void Component::createOperationsForPath(string path)
+
Creates all operations needed to install this component's \a path. \a path is a full qualified
- filename including the component's name. This methods gets called from
- Component::createOperationsForArchive. You can override this method by providing a method with
+ filename including the component's name. This method gets called from
+ Component::createOperationsForArchive. You can override it by providing a method with
the same name in the component script.
\note RSA signature files are omitted by this method.
@@ -594,6 +726,8 @@ void Component::createOperationsForPath(const QString &path)
}
/*!
+ \qmlmethod void Component::createOperationsForArchive(string archive)
+
Creates all operations needed to install this component's \a archive. This method gets called
from Component::createOperations. You can override this method by providing a method with the
same name in the component script.
@@ -626,6 +760,22 @@ void Component::createOperationsForArchive(const QString &archive)
}
}
+/*!
+ \qmlmethod void Component::beginInstallation()
+
+ Starts the component installation.
+ You can override this method by providing a method with the same name in the component script.
+
+ \code
+ Component.prototype.beginInstallation = function()
+ {
+ // call default implementation
+ component.beginInstallation();
+ // ...
+ }
+ \endcode
+
+*/
void Component::beginInstallation()
{
// the script can override this method
@@ -635,6 +785,8 @@ void Component::beginInstallation()
}
/*!
+ \qmlmethod void Component::createOperations()
+
Creates all operations needed to install this component.
You can override this method by providing a method with the same name in the component script.
@@ -657,8 +809,10 @@ void Component::createOperations()
}
/*!
+ \qmlmethod void Component::registerPathForUninstallation(string path, boolean wipe = false)
+
Registers the file or directory at \a path for being removed when this component gets uninstalled.
- In case of a directory, this will be recursive. If \a wipe is set to true, the directory will
+ In case of a directory, this will be recursive. If \a wipe is set to \c true, the directory will
also be deleted if it contains changes done by the user after installation.
*/
void Component::registerPathForUninstallation(const QString &path, bool wipe)
@@ -667,6 +821,8 @@ void Component::registerPathForUninstallation(const QString &path, bool wipe)
}
/*!
+ \qmlmethod QList<QPair<string, boolean> > Component::pathesForUninstallation()
+
Returns the list of paths previously registered for uninstallation with
#registerPathForUninstallation.
*/
@@ -689,11 +845,13 @@ QStringList Component::archives() const
}
/*!
+ \qmlmethod void Component::addDownloadableArchive(string path)
+
Adds the archive \a path to this component. This can only be called when this component was
downloaded from an online repository. When adding \a path, it will be downloaded from the
repository when the installation starts.
- Read \ref sec_repogen for details. \sa fromOnlineRepository
+ \sa removeDownloadableArchive, fromOnlineRepository, archives
*/
void Component::addDownloadableArchive(const QString &path)
{
@@ -704,10 +862,12 @@ void Component::addDownloadableArchive(const QString &path)
}
/*!
+ \qmlmethod void Component::removeDownloadableArchive(string path)
+
Removes the archive \a path previously added via addDownloadableArchive from this component.
This can only be called when this component was downloaded from an online repository.
- Read \ref sec_repogen for details.
+ \sa addDownloadableArchive, fromOnlineRepository, archives
*/
void Component::removeDownloadableArchive(const QString &path)
{
@@ -724,7 +884,9 @@ QStringList Component::downloadableArchives() const
}
/*!
- Adds a request for quitting the process @p process before installing/updating/uninstalling the
+ \qmlmethod void Component::addStopProcessForUpdateRequest(string process)
+
+ Adds a request for quitting the process \a process before installing/updating/uninstalling the
component.
*/
void Component::addStopProcessForUpdateRequest(const QString &process)
@@ -733,7 +895,9 @@ void Component::addStopProcessForUpdateRequest(const QString &process)
}
/*!
- Removes the request for quitting the process @p process again.
+ \qmlmethod void Component::removeStopProcessForUpdateRequest(string process)
+
+ Removes the request for quitting the process \a process again.
*/
void Component::removeStopProcessForUpdateRequest(const QString &process)
{
@@ -741,7 +905,9 @@ void Component::removeStopProcessForUpdateRequest(const QString &process)
}
/*!
- Convenience: Add/remove request depending on @p requested (add if @p true, remove if @p false).
+ \qmlmethod void Component::setStopProcessForUpdateRequest(string process, boolean requested)
+
+ Convenience: Add/remove request depending on \a requested (add if \c true, remove if \c false).
*/
void Component::setStopProcessForUpdateRequest(const QString &process, bool requested)
{
@@ -760,7 +926,7 @@ QStringList Component::stopProcessForUpdateRequests() const
}
/*!
- Returns the operations needed to install this component. If autoCreateOperations is true,
+ Returns the operations needed to install this component. If autoCreateOperations is \c true,
createOperations is called, if no operations have been auto-created yet.
*/
OperationList Component::operations() const
@@ -872,10 +1038,9 @@ Operation *Component::createOperation(const QString &operation, const QStringLis
}
/*!
- Creates and adds an installation operation for \a operation. Add any number of \a parameter1,
- \a parameter2, \a parameter3, \a parameter4, \a parameter5 and \a parameter6. The contents of
- the parameters get variables like "@TargetDir@" replaced with their values, if contained.
- \sa installeroperations
+ \qmlmethod boolean Component::addOperation(string operation, string parameter1 = "", string parameter2 = "", ..., string parameter10 = "")
+
+ Convenience method for calling addOperation(string, stringlist) with up to 10 arguments.
*/
bool Component::addOperation(const QString &operation, const QString &parameter1, const QString &parameter2,
const QString &parameter3, const QString &parameter4, const QString &parameter5, const QString &parameter6,
@@ -890,6 +1055,13 @@ bool Component::addOperation(const QString &operation, const QString &parameter1
return false;
}
+/*!
+ \qmlmethod boolean Component::addOperation(string operation, stringlist parameters)
+
+ Creates and adds an installation operation for \a operation. Add any number of parameters.
+ The contents of the parameters get variables like "@TargetDir@" replaced with their values,
+ if contained.
+*/
bool Component::addOperation(const QString &operation, const QStringList &parameters)
{
if (Operation *op = createOperation(operation, parameters)) {
@@ -901,11 +1073,9 @@ bool Component::addOperation(const QString &operation, const QStringList &parame
}
/*!
- Creates and adds an installation operation for \a operation. Add any number of \a parameter1,
- \a parameter2, \a parameter3, \a parameter4, \a parameter5 and \a parameter6. The contents of
- the parameters get variables like "@TargetDir@" replaced with their values, if contained.
- \a operation is executed with elevated rights.
- \sa installeroperations
+ \qmlmethod boolean Component::addElevatedOperation(string operation, string parameter1 = "", string parameter2 = "", ..., string parameter10 = "")
+
+ Convenience method for calling addElevatedOperation(string, stringlist) with up to 10 arguments.
*/
bool Component::addElevatedOperation(const QString &operation, const QString &parameter1,
const QString &parameter2, const QString &parameter3, const QString &parameter4, const QString &parameter5,
@@ -921,6 +1091,14 @@ bool Component::addElevatedOperation(const QString &operation, const QString &pa
return false;
}
+/*!
+ \qmlmethod boolean Component::addElevatedOperation(string operation, stringlist parameters)
+
+ Creates and adds an installation operation for \a operation. Add any number of parameters.
+ The contents of the parameters get variables like "@TargetDir@" replaced with their values,
+ if contained. \a operation is executed with elevated rights.
+
+*/
bool Component::addElevatedOperation(const QString &operation, const QStringList &parameters)
{
if (Operation *op = createOperation(operation, parameters)) {
@@ -933,7 +1111,7 @@ bool Component::addElevatedOperation(const QString &operation, const QStringList
/*!
Specifies whether operations should be automatically created when the installation starts. This
- would be done by calling #createOperations. If you set this to false, it's completely up to the
+ would be done by calling #createOperations. If you set this to \c false, it is completely up to the
component's script to create all operations.
*/
bool Component::autoCreateOperations() const
@@ -941,6 +1119,11 @@ bool Component::autoCreateOperations() const
return d->m_autoCreateOperations;
}
+/*!
+ \qmlmethod void Component::setAutoCreateOperations(boolean autoCreateOperations)
+
+ Setter for the \l autoCreateOperations property.
+ */
void Component::setAutoCreateOperations(bool autoCreateOperations)
{
d->m_autoCreateOperations = autoCreateOperations;
@@ -952,9 +1135,7 @@ bool Component::isVirtual() const
}
/*!
- \property Component::selected
- Specifies whether this component is selected for installation. Get this property's value by using
- %isSelected(), and set it using %setSelected().
+ Specifies whether this component is selected for installation.
*/
bool Component::isSelected() const
{
@@ -979,7 +1160,11 @@ bool Component::validatePage()
}
/*!
+ \qmlmethod void Component::setSelected(boolean selected)
+
Marks the component for installation. Emits the selectedChanged() signal if the check state changes.
+
+ \note This method does not do anything and is deprecated since 1.3.
*/
void Component::setSelected(bool selected)
{
@@ -987,6 +1172,14 @@ void Component::setSelected(bool selected)
qDebug() << Q_FUNC_INFO << QString::fromLatin1("on '%1' is deprecated.").arg(d->m_componentName);
}
+/*!
+ \qmlmethod void Component::addDependency(string newDependency)
+
+ Adds a new component \a newDependency to the list of dependencies.
+
+ \sa dependencies
+*/
+
void Component::addDependency(const QString &newDependency)
{
QString oldDependencies = d->m_vars.value(scDependencies);
@@ -999,7 +1192,7 @@ void Component::addDependency(const QString &newDependency)
/*!
Contains this component dependencies.
- Read \ref componentdependencies for details.
+ Read \l componentdependencies for details.
*/
QStringList Component::dependencies() const
{
@@ -1010,11 +1203,14 @@ QStringList Component::autoDependencies() const
{
QStringList autoDependencyStringList =
d->m_vars.value(scAutoDependOn).split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
+ qDebug() << Q_FUNC_INFO << autoDependencyStringList;
autoDependencyStringList.removeAll(QLatin1String("script"));
return autoDependencyStringList;
}
/*!
+ \qmlmethod void Component::setInstalled()
+
Set's the components state to installed.
*/
void Component::setInstalled()
@@ -1023,8 +1219,10 @@ void Component::setInstalled()
}
/*!
- Determines if the component comes as an auto dependency. Returns true if the component needs to be
- installed.
+ \qmlmethod boolean Component::isAutoDependOn(QSet<string> componentsToInstall)
+
+ Determines if the component comes as an auto dependency. Returns \c true if the component needs
+ to be installed.
*/
bool Component::isAutoDependOn(const QSet<QString> &componentsToInstall) const
{
@@ -1070,8 +1268,13 @@ bool Component::isAutoDependOn(const QSet<QString> &componentsToInstall) const
}
/*!
- Determines if the component is a default one. Note: if a component is virtual, this function will always
- return false.
+ \qmlmethod boolean Component::isDefault()
+
+ Indicates if the component is a default one.
+
+ \note Always returns \c false for virtual components.
+
+ \sa default
*/
bool Component::isDefault() const
{
@@ -1099,6 +1302,8 @@ bool Component::isDefault() const
}
/*!
+ \qmlmethod boolean Component::isInstalled()
+
Determines if the component is installed.
*/
bool Component::isInstalled() const
@@ -1107,6 +1312,8 @@ bool Component::isInstalled() const
}
/*!
+ \qmlmethod boolean Component::installationRequested()
+
Determines if the user wants to install the component
*/
bool Component::installationRequested() const
@@ -1115,6 +1322,8 @@ bool Component::installationRequested() const
}
/*!
+ \qmlmethod void Component::setUpdateAvailable(boolean isUpdateAvailable)
+
Sets a flag that the core found an update
*/
void Component::setUpdateAvailable(bool isUpdateAvailable)
@@ -1123,6 +1332,8 @@ void Component::setUpdateAvailable(bool isUpdateAvailable)
}
/*!
+ \qmlmethod boolean Component::updateRequested()
+
Determines if the user wants to install the update for this component
*/
bool Component::updateRequested()
@@ -1131,7 +1342,9 @@ bool Component::updateRequested()
}
/*!
- Returns true if that component will be changed (update/installation/uninstallation)
+ \qmlmethod boolean Component::componentChangeRequested()
+
+ Returns \c true if that component will be changed (update/installation/uninstallation).
*/
bool Component::componentChangeRequested()
{
@@ -1140,6 +1353,8 @@ bool Component::componentChangeRequested()
/*!
+ \qmlmethod void Component::setUninstalled()
+
Sets the component state to uninstalled.
*/
void Component::setUninstalled()
@@ -1148,6 +1363,8 @@ void Component::setUninstalled()
}
/*!
+ \qmlmethod boolean Component::isUninstalled()
+
Determines if the component is uninstalled.
*/
bool Component::isUninstalled() const
@@ -1156,6 +1373,8 @@ bool Component::isUninstalled() const
}
/*!
+ \qmlmethod boolean Component::uninstallationRequested()
+
Determines if the user wants to uninstall the component.
*/
bool Component::uninstallationRequested() const
@@ -1166,10 +1385,11 @@ bool Component::uninstallationRequested() const
}
/*!
- \property Component::fromOnlineRepository
+ \qmlmethod boolean Component::isFromOnlineRepository()
+
+ Determines whether this component has been loaded from an online repository.
- Determines whether this component has been loaded from an online repository. Get this property's
- value by using %isFromOnlineRepository. \sa addDownloadableArchive
+ \sa addDownloadableArchive, fromOnlineRepository
*/
bool Component::isFromOnlineRepository() const
{
diff --git a/src/libs/installer/messageboxhandler.cpp b/src/libs/installer/messageboxhandler.cpp
index 2ae4c351d..9905e024d 100644
--- a/src/libs/installer/messageboxhandler.cpp
+++ b/src/libs/installer/messageboxhandler.cpp
@@ -51,6 +51,89 @@
#include <QScriptValue>
#include <QMetaEnum>
+/*!
+ \qmltype QMessageBox
+ \inqmlmodule scripting
+
+ \brief The QMessageBox type provides a modal dialog for informing the
+ user or asking the user a question and receiving an answer.
+
+
+ \code
+ var result = QMessageBox.question("quit.question", "Installer", "Do you want to quit the installer?",
+ QMessageBox.Yes | QMessageBox.No);
+ if (result == QMessageBox.Yes) {
+ // ...
+ }
+ \endcode
+
+ \section2 Buttons
+
+ QMessageBox defines a list of common buttons:
+ \list
+ \li QMessageBox.Ok
+ \li QMessageBox.Open
+ \li QMessageBox.Save
+ \li QMessageBox.Cancel
+ \li QMessageBox.Close
+ \li QMessageBox.Discard
+ \li QMessageBox.Apply
+ \li QMessageBox.Reset
+ \li QMessageBox.RestoreDefaults
+ \li QMessageBox.Help
+ \li QMessageBox.SaveAll
+ \li QMessageBox.Yes
+ \li QMessageBox.YesToAll
+ \li QMessageBox.No
+ \li QMessageBox.NoToAll
+ \li QMessageBox.Abort
+ \li QMessageBox.Retry
+ \li QMessageBox.Ignore
+ \li QMessageBox.NoButton
+ \endlist
+
+ \section2 Scripted Installations
+
+ Sometimes it is useful to automatically close message boxes, for example during a scripted
+ installation. This can be achieved by calling
+ Installer::setMessageBoxAutomaticAnswer, Installer::autoAcceptMessageBoxes,
+ Installer::autoRejectMessageBoxes. The \c identifier argument in the method calls
+ allows to identify specific message boxes for this purpose.
+ */
+
+
+/*!
+ \qmlmethod Button QMessageBox::critical(string identifier, string title, string text,
+ Buttons buttons = QMessageBox.Ok, Button button
+ = QMessageBox.NoButton)
+
+ Opens a critical message box with the given \a title and \a text.
+*/
+
+/*!
+ \qmlmethod Button QMessageBox::information(string identifier, string title, string text,
+ Buttons buttons = QMessageBox.Ok, Button button
+ = QMessageBox.NoButton)
+
+ Opens an information message box with the given \a title and \a text.
+*/
+
+/*!
+ \qmlmethod Button QMessageBox::question(string identifier, string title, string text,
+ Buttons buttons = QMessageBox.Yes | QMessageBox.No, Button button
+ = QMessageBox.NoButton)
+
+ Opens a question message box with the given \a title and \a text.
+*/
+
+/*!
+ \qmlmethod Button QMessageBox::warning(string identifier, string title, string text,
+ Buttons buttons = QMessageBox.Ok, Button button
+ = QMessageBox.NoButton)
+
+ Opens a warning message box with the given \a title and \a text.
+*/
+
QScriptValue QInstaller::registerMessageBox(QScriptEngine *scriptEngine)
{
// register QMessageBox::StandardButton enum in the script connection
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 6bd90051a..578acf873 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -85,6 +85,263 @@
# include <QStandardPaths>
#endif
+/*!
+ \qmltype QInstaller
+ \inqmlmodule scripting
+
+ \brief Provides access to the installer from Qt Script.
+
+ Use the \c installer object in the global namespace to access functionality of the installer.
+
+ \section2 Wizard Pages
+
+ The installer has various pre-defined pages that can be used to for example insert pages
+ in a certain place:
+ \list
+ \li QInstaller.Introduction
+ \li QInstaller.TargetDirectory
+ \li QInstaller.ComponentSelection
+ \li QInstaller.LicenseCheck
+ \li QInstaller.StartMenuSelection
+ \li QInstaller.ReadyForInstallation
+ \li QInstaller.PerformInstallation
+ \li QInstaller.InstallationFinished
+ \li QInstaller.End
+ \endlist
+*/
+
+
+/*!
+ \qmlproperty enumeration QInstaller::status
+
+ Status of the installer.
+
+ Possible values are:
+ \list
+ \li QInstaller.Success (deprecated: QInstaller.InstallerSucceeded)
+ \li QInstaller.Failure (deprecated: QInstaller.InstallerFailed)
+ \li QInstaller.Running (deprecated: QInstaller.InstallerFailed)
+ \li QInstaller.Canceled (deprecated: QInstaller.CanceledByUser)
+ \li deprecated: QInstaller.InstallerUnfinished
+ \endlist
+*/
+
+/*!
+ \qmlsignal QInstaller::aboutCalculateComponentsToInstall()
+
+ Emitted before the ordered list of components to install is calculated.
+*/
+
+/*!
+ \qmlsignal QInstaller::componentAdded(Component component)
+
+ Emitted when a new root component has been added.
+
+ \sa rootComponentsAdded, updaterComponentsAdded
+*/
+
+/*!
+ \qmlsignal QInstaller::rootComponentsAdded(list<Component> components)
+
+ Emitted when a new list of root components has been added.
+
+ \sa componentAdded, updaterComponentsAdded
+*/
+
+/*!
+ \qmlsignal QInstaller::updaterComponentsAdded(list<Component> components)
+
+ Emitted when a new list of updater components has been added.
+ \sa componentAdded, rootComponentsAdded
+*/
+
+/*!
+ \qmlsignal QInstaller::componentsAboutToBeCleared()
+
+ Deprecated, and not emitted any more.
+*/
+
+/*!
+ \qmlsignal QInstaller::valueChanged(string key, string value)
+
+ Emitted whenever a value changes.
+
+ \sa setValue
+*/
+
+/*!
+ \qmlsignal QInstaller::statusChanged(Status status)
+
+ Emitted whenever the installer status changes.
+*/
+
+/*!
+ \qmlsignal QInstaller::currentPageChanged(int page)
+
+ Emitted whenever the current page changes.
+*/
+
+/*!
+ \qmlsignal QInstaller::finishButtonClicked()
+
+ Emitted when the user clicks the \uicontrol Finish button of the installer.
+*/
+
+/*!
+ \qmlsignal QInstaller::metaJobInfoMessage(string message)
+
+ Triggered with informative updates of the communication with a remote repository.
+ This is only useful for debugging purposes.
+*/
+
+/*!
+ \qmlsignal QInstaller::setRootComponents(list<Component> components)
+
+ Triggered with the list of new root components (for example after an online update).
+*/
+
+/*!
+ \qmlsignal QInstaller::startAllComponentsReset()
+
+ Triggered when the list of components starts to get updated.
+
+ \sa finishAllComponentsReset
+*/
+
+/*!
+ \qmlsignal QInstaller::finishAllComponentsReset()
+
+ Triggered when the list of components has been updated.
+
+ \sa startAllComponentsReset
+*/
+
+/*!
+ \qmlsignal QInstaller::startUpdaterComponentsReset()
+
+ Triggered when components start to get updated during a remote update.
+*/
+
+/*!
+ \qmlsignal QInstaller::finishUpdaterComponentsReset()
+
+ Triggered when components have been updated during a remote update.
+*/
+
+/*!
+ \qmlsignal QInstaller::installationStarted()
+
+ Triggered when installation has started.
+
+ \sa installationFinished installationInterrupted
+*/
+
+/*!
+ \qmlsignal QInstaller::installationInterrupted()
+
+ Triggered when installation has been interrupted (cancelled).
+
+ \sa interrupt installationStarted installationFinished
+*/
+
+/*!
+ \qmlsignal QInstaller::installationFinished()
+
+ Triggered when installation has been finished.
+
+ \sa installationStarted installationInterrupted
+*/
+
+/*!
+ \qmlsignal QInstaller::updateFinished()
+
+ Triggered when an update has been finished.
+*/
+
+/*!
+ \qmlsignal QInstaller::uninstallationStarted()
+
+ Triggered when uninstallation has started.
+
+ \sa uninstallationFinished
+*/
+
+/*!
+ \qmlsignal QInstaller::uninstallationFinished()
+
+ Triggered when uninstallation has been finished.
+
+ \sa uninstallationStarted
+*/
+
+/*!
+ \qmlsignal QInstaller::titleMessageChanged(string title)
+
+ Emitted when the text of the installer status (on the PerformInstallation page) changes to
+ \a title.
+*/
+
+/*!
+ \qmlsignal QInstaller::wizardPageInsertionRequested(Widget widget, WizardPage page)
+
+ Emitted when a custom \a widget is about to be inserted into \a page by addWizardPage.
+*/
+
+/*!
+ \qmlsignal QInstaller::wizardPageRemovalRequested(Widget widget)
+
+ Emitted when a \a widget is removed by removeWizardPage.
+*/
+
+/*!
+ \qmlsignal QInstaller::wizardWidgetInsertionRequested(Widget widget, WizardPage page)
+
+ Emitted when a \a widget is inserted into \a page by addWizardPageItem.
+*/
+
+/*!
+ \qmlsignal QInstaller::wizardWidgetRemovalRequested(Widget widget)
+
+ Emitted when a \a widget is removed by removeWizardPageItem.
+*/
+
+/*!
+ \qmlsignal QInstaller::wizardPageVisibilityChangeRequested(bool visible, int page)
+
+ Emitted when the visibility of the page with id \a page changes to \a visible.
+
+ \sa setDefaultPageVisible
+*/
+
+/*!
+ \qmlsignal QInstaller::setValidatorForCustomPageRequested(Componentcomponent, string name,
+ string callbackName)
+
+ Triggered when setValidatorForCustomPage is called.
+*/
+
+/*!
+ \qmlsignal QInstaller::setAutomatedPageSwitchEnabled(bool request)
+
+ Triggered when the automatic switching from PerformInstallation to InstallationFinished page
+ is enabled (\a request = \c true) or disabled (\a request = \c false).
+
+ The automatic switching is disabled automatically when for example the user expands or unexpands
+ the \gui Details section of the PerformInstallation page.
+*/
+
+/*!
+ \qmlsignal QInstaller::coreNetworkSettingsChanged()
+
+ Emitted when the network settings are changed.
+*/
+
+/*!
+ \qmlmethod list<Component> QInstaller::components()
+
+ Returns the list of all components.
+*/
+
using namespace QInstaller;
Q_GLOBAL_STATIC(QMutex, globalModelMutex);
@@ -245,55 +502,6 @@ QString QInstaller::uncaughtExceptionString(QScriptEngine *scriptEngine, const Q
.join(QLatin1String("\n\t")));
}
-
-/*!
- \class QInstaller::PackageManagerCore
- PackageManagerCore forms the core of the installation, update, maintenance and un-installation system.
- */
-
-/*!
- \enum QInstaller::PackageManagerCore::WizardPage
- WizardPage is used to number the different pages known to the Installer GUI.
- */
-
-/*!
- \var QInstaller::PackageManagerCore::Introduction
- I ntroduction page.
- */
-
-/*!
- \var QInstaller::PackageManagerCore::LicenseCheck
- License check page
- */
-/*!
- \var QInstaller::PackageManagerCore::TargetDirectory
- Target directory selection page
- */
-/*!
- \var QInstaller::PackageManagerCore::ComponentSelection
- %Component selection page
- */
-/*!
- \var QInstaller::PackageManagerCore::StartMenuSelection
- Start menu directory selection page - Microsoft Windows only
- */
-/*!
- \var QInstaller::PackageManagerCore::ReadyForInstallation
- "Ready for Installation" page
- */
-/*!
- \var QInstaller::PackageManagerCore::PerformInstallation
- Page shown while performing the installation
- */
-/*!
- \var QInstaller::PackageManagerCore::InstallationFinished
- Page shown when the installation was finished
- */
-/*!
- \var QInstaller::PackageManagerCore::End
- Non-existing page - this value has to be used if you want to insert a page after \a InstallationFinished
- */
-
void PackageManagerCore::writeUninstaller()
{
if (d->m_needToWriteUninstaller) {
@@ -330,6 +538,8 @@ void PackageManagerCore::reset(const QHash<QString, QString> &params)
}
/*!
+ \qmlmethod void QInstaller::setCompleteUninstallation(bool complete)
+
Sets the uninstallation to be \a complete. If \a complete is false, only components deselected
by the user will be uninstalled. This option applies only on uninstallation.
*/
@@ -338,27 +548,60 @@ void PackageManagerCore::setCompleteUninstallation(bool complete)
d->m_completeUninstall = complete;
}
+/*!
+ \qmlmethod void QInstaller::cancelMetaInfoJob()
+
+ Cancels the retrieval of meta information from a remote repository.
+ */
void PackageManagerCore::cancelMetaInfoJob()
{
if (d->m_repoMetaInfoJob)
d->m_repoMetaInfoJob->cancel();
}
+/*!
+ \qmlmethod void QInstaller::componentsToInstallNeedsRecalculation()
+
+ Ensures that component dependencies are re-calculated.
+ */
void PackageManagerCore::componentsToInstallNeedsRecalculation()
{
d->m_componentsToInstallCalculated = false;
}
+/*!
+ \qmlmethod void QInstaller::autoAcceptMessageBoxes()
+
+ Automatically accept all user message boxes.
+
+ \sa autoRejectMessageBoxes, setMessageBoxAutomaticAnswer
+ */
void PackageManagerCore::autoAcceptMessageBoxes()
{
MessageBoxHandler::instance()->setDefaultAction(MessageBoxHandler::Accept);
}
+/*!
+ \qmlmethod void QInstaller::autoRejectMessageBoxes()
+
+ Automatically reject all user message boxes.
+
+ \sa autoAcceptMessageBoxes, setMessageBoxAutomaticAnswer
+ */
void PackageManagerCore::autoRejectMessageBoxes()
{
MessageBoxHandler::instance()->setDefaultAction(MessageBoxHandler::Reject);
}
+/*!
+ \qmlmethod void QInstaller::setMessageBoxAutomaticAnswer(string identifier, int button)
+
+ Automatically close the message box with ID \a identifier as if the user had pressed \a button.
+
+ This can be used for unattended (automatic) installations.
+
+ \sa QMessageBox, autoAcceptMessageBoxes, autoRejectMessageBoxes
+ */
void PackageManagerCore::setMessageBoxAutomaticAnswer(const QString &identifier, int button)
{
MessageBoxHandler::instance()->setAutomaticAnswer(identifier,
@@ -372,6 +615,13 @@ quint64 size(QInstaller::Component *component, const QString &value)
return component->value(value).toLongLong();
}
+/*!
+ \qmlmethod float QInstaller::requiredDiskSpace()
+
+ Returns the estimated amount of disk space in bytes required after installation.
+
+ \sa requiredTemporaryDiskSpace
+ */
quint64 PackageManagerCore::requiredDiskSpace() const
{
quint64 result = 0;
@@ -382,6 +632,13 @@ quint64 PackageManagerCore::requiredDiskSpace() const
return result;
}
+/*!
+ \qmlmethod float QInstaller::requiredTemporaryDiskSpace()
+
+ Returns the estimated required disk space during installation in bytes.
+
+ \sa requiredDiskSpace
+ */
quint64 PackageManagerCore::requiredTemporaryDiskSpace() const
{
quint64 result = 0;
@@ -510,12 +767,26 @@ void PackageManagerCore::rollBackInstallation()
packages.writeToDisk();
}
+/*!
+ \qmlmethod boolean Installer::isFileExtensionRegistered(string extension)
+
+ Returns whether a file extension is already registered in the Windows registry. Returns \c false
+ on all other platforms.
+ */
bool PackageManagerCore::isFileExtensionRegistered(const QString &extension) const
{
QSettingsWrapper settings(QLatin1String("HKEY_CLASSES_ROOT"), QSettingsWrapper::NativeFormat);
return settings.value(QString::fromLatin1(".%1/Default").arg(extension)).isValid();
}
+/*!
+ \qmlmethod boolean QInstaller::fileExists(string filePath)
+
+ Returns \c true if the \a filePath exists; otherwise returns \c false.
+
+ \note If the file is a symlink that points to a non existing
+ file, \c false is returned.
+ */
bool PackageManagerCore::fileExists(const QString &filePath) const
{
return QFileInfo(filePath).exists();
@@ -738,9 +1009,16 @@ bool PackageManagerCore::fetchRemotePackagesTree()
}
/*!
+ \qmlmethod boolean QInstaller::addWizardPage(Component component, string name, int page)
+
Adds the widget with objectName() \a name registered by \a component as a new page
into the installer's GUI wizard. The widget is added before \a page.
- \a page has to be a value of \ref QInstaller::PackageManagerCore::WizardPage "WizardPage".
+
+ See \l{Wizard Pages} for the possible values of \a page.
+
+ Returns \c true if the operation succeeded.
+
+ \sa removeWizardPage, setDefaultPageVisible
*/
bool PackageManagerCore::addWizardPage(Component *component, const QString &name, int page)
{
@@ -752,8 +1030,14 @@ bool PackageManagerCore::addWizardPage(Component *component, const QString &name
}
/*!
+ \qmlmethod boolean QInstaller::removeWizardPage(Component component, string name)
+
Removes the widget with objectName() \a name previously added to the installer's wizard
by \a component.
+
+ Returns \c true if the operation succeeded.
+
+ \sa addWizardPage, setDefaultPageVisible, wizardPageRemovalRequested
*/
bool PackageManagerCore::removeWizardPage(Component *component, const QString &name)
{
@@ -765,9 +1049,15 @@ bool PackageManagerCore::removeWizardPage(Component *component, const QString &n
}
/*!
+ \qmlmethod boolean QInstaller::setDefaultPageVisible(int page, boolean visible)
+
Sets the visibility of the default page with id \a page to \a visible, i.e.
removes or adds it from/to the wizard. This works only for pages which have been
in the installer when it was started.
+
+ Returns \c true.
+
+ \sa addWizardPage, removeWizardPage
*/
bool PackageManagerCore::setDefaultPageVisible(int page, bool visible)
{
@@ -775,6 +1065,12 @@ bool PackageManagerCore::setDefaultPageVisible(int page, bool visible)
return true;
}
+/*!
+ \qmlmethod void QInstaller::setValidatorForCustomPage(Component component, string name,
+ string callbackName)
+
+ \sa setValidatorForCustomPageRequested
+ */
void PackageManagerCore::setValidatorForCustomPage(Component *component, const QString &name,
const QString &callbackName)
{
@@ -782,9 +1078,14 @@ void PackageManagerCore::setValidatorForCustomPage(Component *component, const Q
}
/*!
+ \qmlmethod boolean QInstaller::addWizardPageItem(Component component, string name, int page)
+
Adds the widget with objectName() \a name registered by \a component as an GUI element
into the installer's GUI wizard. The widget is added on \a page.
- \a page has to be a value of \ref QInstaller::PackageManagerCore::WizardPage "WizardPage".
+
+ See \l{Wizard Pages} for the possible values of \a page.
+
+ \sa removeWizardPageItem, wizardWidgetInsertionRequested
*/
bool PackageManagerCore::addWizardPageItem(Component *component, const QString &name, int page)
{
@@ -796,8 +1097,12 @@ bool PackageManagerCore::addWizardPageItem(Component *component, const QString &
}
/*!
+ \qmlmethod boolean QInstaller::removeWizardPageItem(Component component, string name)
+
Removes the widget with objectName() \a name previously added to the installer's wizard
by \a component.
+
+ \sa addWizardPageItem
*/
bool PackageManagerCore::removeWizardPageItem(Component *component, const QString &name)
{
@@ -808,6 +1113,13 @@ bool PackageManagerCore::removeWizardPageItem(Component *component, const QStrin
return false;
}
+/*!
+ \qmlmethod void QInstaller::addUserRepositories(stringlist repositories)
+
+ Registers additional \a repositories.
+
+ \sa setTemporaryRepositories
+ */
void PackageManagerCore::addUserRepositories(const QStringList &repositories)
{
QSet<Repository> repositorySet;
@@ -818,8 +1130,12 @@ void PackageManagerCore::addUserRepositories(const QStringList &repositories)
}
/*!
- Sets additional repository for this instance of the installer or updater.
+ \qmlmethod void QInstaller::setTemporaryRepositories(stringlist repositories, boolean replace)
+
+ Sets additional \a repositories for this instance of the installer or updater.
Will be removed after invoking it again.
+
+ \sa addUserRepositories
*/
void PackageManagerCore::setTemporaryRepositories(const QStringList &repositories, bool replace)
{
@@ -885,6 +1201,8 @@ void PackageManagerCore::appendRootComponent(Component *component)
}
/*!
+ \qmlmethod int QInstaller::updaterComponentCount()
+
Returns the number of components in the list for updater mode. Might return 0 in case the engine has only
been run in installer or package manager mode or no components have been fetched.
*/
@@ -938,6 +1256,8 @@ QList<Component*> PackageManagerCore::availableComponents() const
}
/*!
+ \qmlmethod Component QInstaller::componentByName(string name)
+
Returns a component matching \a name. \a name can also contains a version requirement.
E.g. "com.nokia.sdk.qt" returns any component with that name, "com.nokia.sdk.qt->=4.5" requires
the returned component to have at least version 4.5.
@@ -1115,7 +1435,11 @@ Settings &PackageManagerCore::settings() const
}
/*!
- This method tries to gain admin rights. On success, it returns true.
+ \qmlmethod boolean QInstaller::gainAdminRights()
+
+ Tries to gain admin rights. On success, it returns \c true.
+
+ \sa dropAdminRights
*/
bool PackageManagerCore::gainAdminRights()
{
@@ -1129,7 +1453,11 @@ bool PackageManagerCore::gainAdminRights()
}
/*!
- This method drops gained admin rights.
+ \qmlmethod void QInstaller::dropAdminRights()
+
+ Drops admin rights gained by gainAdminRights.
+
+ \sa gainAdminRights
*/
void PackageManagerCore::dropAdminRights()
{
@@ -1137,7 +1465,9 @@ void PackageManagerCore::dropAdminRights()
}
/*!
- Return true, if a process with \a name is running. On Windows, the comparison
+ \qmlmethod boolean QInstaller::isProcessRunning(string name)
+
+ Returns true, if a process with \a name is running. On Windows, the comparison
is case-insensitive.
*/
bool PackageManagerCore::isProcessRunning(const QString &name) const
@@ -1146,8 +1476,11 @@ bool PackageManagerCore::isProcessRunning(const QString &name) const
}
/*!
- Return true, if a process with \a absoluteFilePath could be killed or isn't running
- Note: this is implemented in a semi blocking way (to keep the main thread to paint the UI)
+ \qmlmethod boolean QInstaller::killProcess(string absoluteFilePath)
+
+ Returns true, if a process with \a absoluteFilePath could be killed or isn't running
+
+ \note This is implemented in a semi blocking way (to keep the main thread to paint the UI).
*/
bool PackageManagerCore::killProcess(const QString &absoluteFilePath) const
{
@@ -1181,11 +1514,30 @@ bool PackageManagerCore::killProcess(const QString &absoluteFilePath) const
}
+/*!
+ \qmlmethod void QInstaller::setDependsOnLocalInstallerBinary()
+
+ Makes sure the installer runs from a local drive. Otherwise the user will get an
+ appropriate error message.
+
+ \note This only works on Windows.
+
+ \sa localInstallerBinaryUsed
+*/
+
void PackageManagerCore::setDependsOnLocalInstallerBinary()
{
d->m_dependsOnLocalInstallerBinary = true;
}
+/*!
+ \qmlmethod boolean QInstaller::localInstallerBinaryUsed()
+
+ Returns \c false if the installer is run on Windows, and the installer has been started from
+ a remote file system drive. Otherwise returns \c true.
+
+ \sa setDependsOnLocalInstallerBinary
+*/
bool PackageManagerCore::localInstallerBinaryUsed()
{
#ifdef Q_OS_WIN
@@ -1195,14 +1547,20 @@ bool PackageManagerCore::localInstallerBinaryUsed()
}
/*!
- Executes a program.
+ \qmlmethod array QInstaller::execute(string program, stringlist arguments = undefined,
+ string stdin = "")
+
+ Starts the program \a program with the arguments \a arguments in a
+ new process and waits for it to finish.
+
+ \a stdin is sent as standard input to the application.
+
+ Returns an empty array if the program could not be executed, otherwise
+ the output of command as the first item, and the return code as the second.
- \param program The program that should be executed.
- \param arguments Optional list of arguments.
- \param stdIn Optional stdin the program reads.
- \return If the command could not be executed, an empty QList, otherwise the output of the
- command as first item, the return code as second item.
\note On Unix, the output is just the output to stdout, not to stderr.
+
+ \sa executeDetached
*/
QList<QVariant> PackageManagerCore::execute(const QString &program, const QStringList &arguments,
const QString &stdIn) const
@@ -1235,12 +1593,24 @@ QList<QVariant> PackageManagerCore::execute(const QString &program, const QStrin
}
/*!
- Executes a program.
+ \qmlmethod boolean QInstaller::executeDetached(string program, stringlist arguments = undefined,
+ string workingDirectory = "")
+
+ Starts the program \a program with the arguments \a arguments in a
+ new process, and detaches from it. Returns \c true on success;
+ otherwise returns \c false. If the installer exits, the
+ detached process will continue to live.
- \param program The program that should be executed.
- \param arguments Optional list of arguments.
- \param workingDirectory Optional working directory of the forked process.
- \return If the command could not be executed, an false will be returned
+ \note Arguments that contain spaces are not passed to the
+ process as separate arguments.
+
+ \b{Unix:} The started process will run in its own session and act
+ like a daemon.
+
+ \b{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 \a workingDirectory.
*/
bool PackageManagerCore::executeDetached(const QString &program, const QStringList &arguments,
@@ -1260,7 +1630,10 @@ bool PackageManagerCore::executeDetached(const QString &program, const QStringLi
/*!
- Returns an environment variable.
+ \qmlmethod string QInstaller::environmentVariable(string name)
+
+ Returns content of an environment variable \a name. An empty string is returned if the
+ environment variable is not set.
*/
QString PackageManagerCore::environmentVariable(const QString &name) const
{
@@ -1288,8 +1661,9 @@ QString PackageManagerCore::environmentVariable(const QString &name) const
}
/*!
+ \qmlmethod boolean QInstaller::performOperation(string name, stringlist arguments)
+
Instantly performs an operation \a name with \a arguments.
- \sa Component::addOperation
*/
bool PackageManagerCore::performOperation(const QString &name, const QStringList &arguments)
{
@@ -1307,7 +1681,9 @@ bool PackageManagerCore::performOperation(const QString &name, const QStringList
}
/*!
- Returns true when \a version matches the \a requirement.
+ \qmlmethod boolean QInstaller::versionMatches(string version, string requirement)
+
+ Returns \c true when \a version matches the \a requirement.
\a requirement can be a fixed version number or it can be prefix by the comparators '>', '>=',
'<', '<=' and '='.
*/
@@ -1334,10 +1710,15 @@ bool PackageManagerCore::versionMatches(const QString &version, const QString &r
}
/*!
+ \qmlmethod string QInstaller::findLibrary(string name, stringlist paths = [])
+
Finds a library named \a name in \a paths.
If \a paths is empty, it gets filled with platform dependent default paths.
- The resulting path is stored in \a library.
+ The resulting path is returned.
+
This method can be used by scripts to check external dependencies.
+
+ \sa findPath
*/
QString PackageManagerCore::findLibrary(const QString &name, const QStringList &paths)
{
@@ -1363,9 +1744,14 @@ QString PackageManagerCore::findLibrary(const QString &name, const QStringList &
}
/*!
+ \qmlmethod string QInstaller::findPath(string name, stringlist paths = [])
+
Tries to find a file name \a name in one of \a paths.
- The resulting path is stored in \a path.
+ The resulting path is returned.
+
This method can be used by scripts to check external dependencies.
+
+ \sa findLibrary
*/
QString PackageManagerCore::findPath(const QString &name, const QStringList &paths)
{
@@ -1381,8 +1767,11 @@ QString PackageManagerCore::findPath(const QString &name, const QStringList &pat
}
/*!
+ \qmlmethod void QInstaller::setInstallerBaseBinary(string path)
+
Sets the "installerbase" binary to use when writing the package manager/uninstaller.
Set this if an update to installerbase is available.
+
If not set, the executable segment of the running un/installer will be used.
*/
void PackageManagerCore::setInstallerBaseBinary(const QString &path)
@@ -1391,8 +1780,12 @@ void PackageManagerCore::setInstallerBaseBinary(const QString &path)
}
/*!
+ \qmlmethod string QInstaller::value(string key, string defaultValue = "")
+
Returns the installer value for \a key. If \a key is not known to the system, \a defaultValue is
returned. Additionally, on Windows, \a key can be a registry key.
+
+ \sa setValue, containsValue, valueChanged
*/
QString PackageManagerCore::value(const QString &key, const QString &defaultValue) const
{
@@ -1400,7 +1793,11 @@ QString PackageManagerCore::value(const QString &key, const QString &defaultValu
}
/*!
+ \qmlmethod void QInstaller::setValue(string key, string value)
+
Sets the installer value for \a key to \a value.
+
+ \sa value, containsValue, valueChanged
*/
void PackageManagerCore::setValue(const QString &key, const QString &value)
{
@@ -1410,18 +1807,38 @@ void PackageManagerCore::setValue(const QString &key, const QString &value)
}
/*!
- Returns true, when the installer contains a value for \a key.
+ \qmlmethod boolean QInstaller::containsValue(string key)
+
+ Returns \c true if the installer contains a value for \a key.
+
+ \sa value, setValue, valueChanged
*/
bool PackageManagerCore::containsValue(const QString &key) const
{
return d->m_data.contains(key);
}
+/*!
+ \qmlmethod void QInstaller::setSharedFlag(string key, boolean value)
+
+ Sets a shared flag with name \a key to \a value. This is one option
+ to share information between scripts.
+
+ \sa sharedFlag
+*/
void PackageManagerCore::setSharedFlag(const QString &key, bool value)
{
d->m_sharedFlags.insert(key, value);
}
+/*!
+ \qmlmethod boolean QInstaller::sharedFlag(string key)
+
+ Returns shared flag with name \a key. This is one option
+ to share information between scripts.
+
+ \sa setSharedFlag
+*/
bool PackageManagerCore::sharedFlag(const QString &key) const
{
return d->m_sharedFlags.value(key, false);
@@ -1448,7 +1865,7 @@ QString PackageManagerCore::error() const
}
/*!
- Returns true if at least one complete installation/update was successful, even if the user cancelled the
+ Returns \c true if at least one complete installation/update was successful, even if the user cancelled the
newest installation process.
*/
bool PackageManagerCore::finishedWithSuccess() const
@@ -1456,12 +1873,24 @@ bool PackageManagerCore::finishedWithSuccess() const
return d->m_status == PackageManagerCore::Success || d->m_needToWriteUninstaller;
}
+/*!
+ \qmlmethod void QInstaller::interrupt()
+
+ Cancels an ongoing installation.
+
+ \sa installationInterrupted
+ */
void PackageManagerCore::interrupt()
{
setCanceled();
emit installationInterrupted();
}
+/*!
+ \qmlmethod void QInstaller::setCanceled()
+
+ Cancels the installation.
+ */
void PackageManagerCore::setCanceled()
{
cancelMetaInfoJob();
@@ -1507,7 +1936,11 @@ QString PackageManagerCore::installerBinaryPath() const
}
/*!
- Returns true when this is the installer running.
+ \qmlmethod boolean QInstaller::isInstaller()
+
+ Returns \c true if executed in an install step.
+
+ \sa isUninstaller, isUpdater, isPackageManager
*/
bool PackageManagerCore::isInstaller() const
{
@@ -1515,47 +1948,79 @@ bool PackageManagerCore::isInstaller() const
}
/*!
- Returns true if this is an offline-only installer.
+ \qmlmethod boolean QInstaller::isOfflineOnly()
+
+ Returns \c true if this is an offline-only installer.
*/
bool PackageManagerCore::isOfflineOnly() const
{
return d->isOfflineOnly();
}
+/*!
+ \qmlmethod void QInstaller::setUninstaller()
+
+ Forces an uninstaller context.
+
+ \sa isUninstaller, setUpdater, setPackageManager
+*/
void PackageManagerCore::setUninstaller()
{
d->m_magicBinaryMarker = QInstaller::MagicUninstallerMarker;
}
/*!
- Returns true when this is the uninstaller running.
+ \qmlmethod boolean QInstaller::isUninstaller()
+
+ Returns \c true if the script is executed in an uninstall context.
+
+ \sa setUninstaller, isInstaller, isUpdater, isPackageManager
*/
bool PackageManagerCore::isUninstaller() const
{
return d->isUninstaller();
}
+/*!
+ \qmlmethod void QInstaller::setUpdater()
+
+ Forces an updater context.
+
+ \sa isUpdater, setUninstaller, setPackageManager
+*/
void PackageManagerCore::setUpdater()
{
d->m_magicBinaryMarker = QInstaller::MagicUpdaterMarker;
}
/*!
- Returns true when this is neither an installer nor an uninstaller running.
- Must be an updater, then.
+ \qmlmethod boolean QInstaller::isUpdater()
+
+ Returns \c true if the script is executed in an updater context.
+
+ \sa setUpdater, isInstaller, isUninstaller, isPackageManager
*/
bool PackageManagerCore::isUpdater() const
{
return d->isUpdater();
}
+/*!
+ \qmlmethod void QInstaller::setPackageManager()
+
+ Forces a package manager context.
+*/
void PackageManagerCore::setPackageManager()
{
d->m_magicBinaryMarker = QInstaller::MagicPackageManagerMarker;
}
+
/*!
- Returns true when this is the package manager running.
+ \qmlmethod boolean QInstaller::isPackageManager()
+
+ Returns \c true if the script is executed in a package manager context.
+ \sa setPackageManager, isInstaller, isUninstaller, isUpdater
*/
bool PackageManagerCore::isPackageManager() const
{
@@ -1563,7 +2028,9 @@ bool PackageManagerCore::isPackageManager() const
}
/*!
- Runs the installer. Returns true on success, false otherwise.
+ \qmlmethod boolean QInstaller::runInstaller()
+
+ Runs the installer. Returns \c true on success, \c false otherwise.
*/
bool PackageManagerCore::runInstaller()
{
@@ -1571,7 +2038,9 @@ bool PackageManagerCore::runInstaller()
}
/*!
- Runs the uninstaller. Returns true on success, false otherwise.
+ \qmlmethod boolean QInstaller::runUninstaller()
+
+ Runs the uninstaller. Returns \c true on success, \c false otherwise.
*/
bool PackageManagerCore::runUninstaller()
{
@@ -1579,7 +2048,9 @@ bool PackageManagerCore::runUninstaller()
}
/*!
- Runs the package updater. Returns true on success, false otherwise.
+ \qmlmethod boolean QInstaller::runPackageUpdater()
+
+ Runs the package updater. Returns \c true on success, \c false otherwise.
*/
bool PackageManagerCore::runPackageUpdater()
{
@@ -1587,7 +2058,8 @@ bool PackageManagerCore::runPackageUpdater()
}
/*!
- \internal
+ \qmlmethod void QInstaller::languageChanged()
+
Calls languangeChanged on all components.
*/
void PackageManagerCore::languageChanged()