diff options
author | kh1 <karsten.heimrich@nokia.com> | 2012-03-15 14:53:47 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@nokia.com> | 2012-03-19 16:14:04 +0100 |
commit | be3b47d0d504a3409ce66bd77bb8c0acff87c4f5 (patch) | |
tree | 09dfb02d484a4f395991972b828da71400fb761a /src/libs/installer/component.h | |
parent | 9fd62353cf7f973d78cd2093328ac15b5c4980b6 (diff) |
Reorganize the tree, have better ifw.pri. Shadow build support.
Change-Id: I01fb12537f863ed0744979973c7e4153889cc5cb
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'src/libs/installer/component.h')
-rw-r--r-- | src/libs/installer/component.h | 233 |
1 files changed, 233 insertions, 0 deletions
diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h new file mode 100644 index 000000000..14d16722c --- /dev/null +++ b/src/libs/installer/component.h @@ -0,0 +1,233 @@ +/************************************************************************** +** +** This file is part of Installer Framework +** +** Copyright (c) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef COMPONENT_H +#define COMPONENT_H + +#include "constants.h" +#include "component_p.h" +#include "qinstallerglobal.h" + +#include <QtCore/QDir> +#include <QtCore/QMetaType> +#include <QtCore/QObject> +#include <QtCore/QUrl> + +#include <QtScript/QScriptable> +#include <QtScript/QScriptValueList> + +QT_FORWARD_DECLARE_CLASS(QDebug) + +namespace KDUpdater { + class Update; + struct PackageInfo; +} + +namespace QInstaller { + +class PackageManagerCore; + +class INSTALLER_EXPORT Component : public QObject, public QScriptable, public ComponentModelHelper +{ + Q_OBJECT + Q_DISABLE_COPY(Component) + + Q_PROPERTY(QString name READ name) + Q_PROPERTY(QString displayName READ displayName) + Q_PROPERTY(bool selected READ isSelected WRITE setSelected) + Q_PROPERTY(bool autoCreateOperations READ autoCreateOperations WRITE setAutoCreateOperations) + Q_PROPERTY(QStringList archives READ archives) + Q_PROPERTY(QStringList userInterfaces READ userInterfaces) + Q_PROPERTY(QStringList dependencies READ dependencies) + Q_PROPERTY(QStringList autoDependencies READ autoDependencies) + Q_PROPERTY(bool fromOnlineRepository READ isFromOnlineRepository) + Q_PROPERTY(QUrl repositoryUrl READ repositoryUrl) + Q_PROPERTY(bool removeBeforeUpdate READ removeBeforeUpdate WRITE setRemoveBeforeUpdate) + Q_PROPERTY(bool default READ isDefault) + Q_PROPERTY(bool installed READ isInstalled) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) + +public: + explicit Component(PackageManagerCore *core); + ~Component(); + + struct SortingPriorityLessThan + { + bool operator() (const Component *lhs, const Component *rhs) const + { + return lhs->value(scSortingPriority).toInt() < rhs->value(scSortingPriority).toInt(); + } + }; + + void loadDataFromPackage(const Package &package); + void loadDataFromPackage(const LocalPackage &package); + + QHash<QString, QString> variables() const; + Q_INVOKABLE void setValue(const QString &key, const QString &value); + Q_INVOKABLE QString value(const QString &key, const QString &defaultValue = QString()) const; + + QStringList archives() const; + PackageManagerCore *packageManagerCore() const; + + Component *parentComponent() const; + void appendComponent(Component *component); + void removeComponent(Component *component); + QList<Component*> childComponents(bool recursive, RunMode runMode) const; + + void loadComponentScript(); + + //move this to private + void loadComponentScript(const QString &fileName); + void loadTranslations(const QDir &directory, const QStringList &qms); + void loadUserInterfaces(const QDir &directory, const QStringList &uis); + void loadLicenses(const QString &directory, const QHash<QString, QVariant> &hash); + void markAsPerformedInstallation(); + + QStringList userInterfaces() const; + QHash<QString, QPair<QString, QString> > licenses() const; + Q_INVOKABLE QWidget *userInterface(const QString &name) const; + Q_INVOKABLE virtual void beginInstallation(); + Q_INVOKABLE virtual void createOperations(); + Q_INVOKABLE virtual void createOperationsForArchive(const QString &archive); + Q_INVOKABLE virtual void createOperationsForPath(const QString &path); + + Q_INVOKABLE QList<QPair<QString, bool> > pathesForUninstallation() const; + Q_INVOKABLE void registerPathForUninstallation(const QString &path, bool wipe = false); + + OperationList operations() const; + + void addOperation(Operation *operation); + Q_INVOKABLE bool addOperation(const QString &operation, const QString ¶meter1 = QString(), + const QString ¶meter2 = QString(), const QString ¶meter3 = QString(), + const QString ¶meter4 = QString(), const QString ¶meter5 = QString(), + const QString ¶meter6 = QString(), const QString ¶meter7 = QString(), + const QString ¶meter8 = QString(), const QString ¶meter9 = QString(), + const QString ¶meter10 = QString()); + + void addElevatedOperation(Operation *operation); + Q_INVOKABLE bool addElevatedOperation(const QString &operation, + const QString ¶meter1 = QString(), const QString ¶meter2 = QString(), + const QString ¶meter3 = QString(), const QString ¶meter4 = QString(), + const QString ¶meter5 = QString(), const QString ¶meter6 = QString(), + const QString ¶meter7 = QString(), const QString ¶meter8 = QString(), + const QString ¶meter9 = QString(), const QString ¶meter10 = QString()); + + QStringList downloadableArchives() const; + Q_INVOKABLE void addDownloadableArchive(const QString &path); + Q_INVOKABLE void removeDownloadableArchive(const QString &path); + + QStringList stopProcessForUpdateRequests() const; + Q_INVOKABLE void addStopProcessForUpdateRequest(const QString &process); + Q_INVOKABLE void removeStopProcessForUpdateRequest(const QString &process); + Q_INVOKABLE void setStopProcessForUpdateRequest(const QString &process, bool requested); + + QString name() const; + QString displayName() const; + QString uncompressedSize() const; + quint64 updateUncompressedSize(); + + QUrl repositoryUrl() const; + void setRepositoryUrl(const QUrl &url); + + bool removeBeforeUpdate() const; + void setRemoveBeforeUpdate(bool removeBeforeUpdate); + + Q_INVOKABLE void addDependency(const QString &newDependency); + QStringList dependencies() const; + QStringList autoDependencies() const; + + void languageChanged(); + QString localTempPath() const; + + bool autoCreateOperations() const; + bool operationsCreatedSuccessfully() const; + + Q_INVOKABLE bool isDefault() const; + Q_INVOKABLE bool isAutoDependOn(const QSet<QString> &componentsToInstall) const; + + Q_INVOKABLE void setInstalled(); + Q_INVOKABLE bool isInstalled() const; + Q_INVOKABLE bool installationRequested() const; + + Q_INVOKABLE void setUninstalled(); + Q_INVOKABLE bool isUninstalled() const; + Q_INVOKABLE bool uninstallationRequested() const; + + Q_INVOKABLE bool isFromOnlineRepository() const; + + Q_INVOKABLE void setUpdateAvailable(bool isUpdateAvailable); + Q_INVOKABLE bool updateRequested(); + + Q_INVOKABLE bool componentChangeRequested(); + + + bool isVirtual() const; + bool isSelected() const; + bool forcedInstallation() const; + +public Q_SLOTS: + void setSelected(bool selected); + void setAutoCreateOperations(bool autoCreateOperations); + +Q_SIGNALS: + void loaded(); + void selectedChanged(bool selected); + void valueChanged(const QString &key, const QString &value); + +protected: + QScriptValue callScriptMethod(const QString &name, + const QScriptValueList ¶meters = QScriptValueList()) const; + +private Q_SLOTS: + void updateModelData(const QString &key, const QString &value); + +private: + void setLocalTempPath(const QString &tempPath); + + Operation *createOperation(const QString &operation, const QString ¶meter1 = QString(), + const QString ¶meter2 = QString(), const QString ¶meter3 = QString(), + const QString ¶meter4 = QString(), const QString ¶meter5 = QString(), + const QString ¶meter6 = QString(), const QString ¶meter7 = QString(), + const QString ¶meter8 = QString(), const QString ¶meter9 = QString(), + const QString ¶meter10 = QString()); + +private: + ComponentPrivate *d; +}; + +QDebug operator<<(QDebug dbg, Component *component); + +} // namespace QInstaller + +Q_DECLARE_METATYPE(QInstaller::Component*) + +#endif // COMPONENT_H |