summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/examples/config.xml1
-rw-r--r--doc/installerfw.qdoc17
-rw-r--r--examples/examples.pro22
-rw-r--r--examples/testapp/components.xml13
-rw-r--r--examples/testapp/componentselectiondialog.cpp203
-rw-r--r--examples/testapp/componentselectiondialog.h77
-rw-r--r--examples/testapp/componentselectiondialog.ui184
-rw-r--r--examples/testapp/config.xml16
-rw-r--r--examples/testapp/config/config.xml20
-rw-r--r--examples/testapp/config/license.txt84
-rw-r--r--examples/testapp/config/logo.pngbin1592 -> 0 bytes
-rw-r--r--examples/testapp/config/qticon.icnsbin162568 -> 0 bytes
-rw-r--r--examples/testapp/config/qticon.icobin355574 -> 0 bytes
-rw-r--r--examples/testapp/config/qticon.pngbin2109 -> 0 bytes
-rw-r--r--examples/testapp/config/watermark.pngbin14462 -> 0 bytes
-rw-r--r--examples/testapp/logo.pngbin5437 -> 0 bytes
-rw-r--r--examples/testapp/mainwindow.cpp182
-rw-r--r--examples/testapp/mainwindow.h68
-rw-r--r--examples/testapp/packages/com.nokia.testapp.subcomponent.alwaysvisible/meta/package.xml8
-rw-r--r--examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/installscript.qs4
-rw-r--r--examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/package.xml9
-rw-r--r--examples/testapp/packages/com.nokia.testapp.subcomponent/meta/package.xml7
-rw-r--r--examples/testapp/packages/com.nokia.testapp/meta/installscript.js18
-rw-r--r--examples/testapp/packages/com.nokia.testapp/meta/package.xml9
-rw-r--r--examples/testapp/testapp.pro49
-rw-r--r--examples/testapp/testapp.qrc8
-rw-r--r--examples/testapp/updateagent.cpp119
-rw-r--r--examples/testapp/updatesettingsdialog.cpp91
-rw-r--r--examples/testapp/updatesettingsdialog.h66
-rw-r--r--examples/testapp/updatesettingsdialog.ui39
-rw-r--r--examples/testapp/updatesettingswidget.cpp162
-rw-r--r--examples/testapp/updatesettingswidget.h73
-rw-r--r--examples/testapp/updatesettingswidget.ui286
-rw-r--r--installerfw.pri2
-rw-r--r--installerfw.pro2
-rw-r--r--src/libs/installer/addqtcreatorarrayvalueoperation.h6
-rw-r--r--src/libs/installer/adminauthorization_win.cpp6
-rw-r--r--src/libs/installer/adminauthorization_x11.cpp2
-rw-r--r--src/libs/installer/binaryformat.h2
-rw-r--r--src/libs/installer/component.cpp41
-rw-r--r--src/libs/installer/component.h8
-rw-r--r--src/libs/installer/component_p.cpp51
-rw-r--r--src/libs/installer/component_p.h4
-rw-r--r--src/libs/installer/componentmodel.cpp450
-rw-r--r--src/libs/installer/componentmodel.h51
-rw-r--r--src/libs/installer/constants.h1
-rw-r--r--src/libs/installer/createshortcutoperation.cpp12
-rw-r--r--src/libs/installer/errors.h5
-rw-r--r--src/libs/installer/fileutils.cpp2
-rw-r--r--src/libs/installer/fsengineclient.cpp2
-rw-r--r--src/libs/installer/fsengineserver.cpp2
-rw-r--r--src/libs/installer/getrepositoriesmetainfojob.cpp1
-rw-r--r--src/libs/installer/getrepositorymetainfojob.cpp11
-rw-r--r--src/libs/installer/globals.cpp (renamed from examples/testapp/updateagent.h)30
-rw-r--r--src/libs/installer/globals.h (renamed from examples/testapp/main.cpp)25
-rw-r--r--src/libs/installer/init.cpp4
-rw-r--r--src/libs/installer/installer.pro10
-rw-r--r--src/libs/installer/lib7z_facade.cpp10
-rw-r--r--src/libs/installer/lib7z_facade.h14
-rw-r--r--src/libs/installer/link.h2
-rw-r--r--src/libs/installer/macreplaceinstallnamesoperation.h6
-rw-r--r--src/libs/installer/messageboxhandler.cpp4
-rw-r--r--src/libs/installer/packagemanagercore.cpp87
-rw-r--r--src/libs/installer/packagemanagercore.h2
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp19
-rw-r--r--src/libs/installer/packagemanagercore_p.h17
-rw-r--r--src/libs/installer/packagemanagercoredata.cpp1
-rw-r--r--src/libs/installer/packagemanagergui.cpp204
-rw-r--r--src/libs/installer/packagemanagergui.h7
-rw-r--r--src/libs/installer/packagemanagerproxyfactory.h2
-rw-r--r--src/libs/installer/performinstallationform.h2
-rw-r--r--src/libs/installer/productkeycheck.cpp6
-rw-r--r--src/libs/installer/progresscoordinator.h6
-rw-r--r--src/libs/installer/qinstallerglobal.h8
-rw-r--r--src/libs/installer/registerqtincreatorqnxoperation.cpp (renamed from src/libs/installer/registerqtvqnxoperation.cpp)2
-rw-r--r--src/libs/installer/registerqtincreatorqnxoperation.h (renamed from src/libs/installer/registerqtvqnxoperation.h)6
-rw-r--r--src/libs/installer/settings.cpp117
-rw-r--r--src/libs/installer/settings.h7
-rw-r--r--src/libs/installer/utils.h2
-rw-r--r--src/libs/kdtools/kdsysinfo_win.cpp2
-rw-r--r--src/libs/kdtools/kdupdaterapplication.h2
-rw-r--r--src/libs/kdtools/kdupdaterpackagesinfo.cpp8
-rw-r--r--src/libs/kdtools/kdupdaterupdatefinder.cpp4
-rw-r--r--src/libs/kdtools/kdupdaterupdateoperation.cpp2
-rw-r--r--src/libs/kdtools/kdupdaterupdateoperations.cpp2
-rw-r--r--src/sdk/installerbase_p.h2
-rw-r--r--src/sdk/settingsdialog.cpp52
-rw-r--r--src/sdk/settingsdialog.h10
-rw-r--r--tests/auto/installer/componentmodel/componentmodel.pro8
-rw-r--r--tests/auto/installer/componentmodel/components.qrc5
-rw-r--r--tests/auto/installer/componentmodel/data/updates.xml132
-rw-r--r--tests/auto/installer/componentmodel/tst_componentmodel.cpp479
-rw-r--r--tests/auto/installer/installer.pro1
-rw-r--r--tests/auto/installer/settings/data/full_config.xml125
-rw-r--r--tests/auto/installer/settings/tst_settings.cpp9
-rw-r--r--tests/downloadspeed/main.cpp25
-rw-r--r--tools/binarycreator/binarycreator.cpp92
-rw-r--r--tools/common/repositorygen.cpp112
-rw-r--r--tools/common/repositorygen.h1
-rw-r--r--tools/repogenfromonlinerepo/downloadmanager.h2
-rw-r--r--tools/repogenfromonlinerepo/main.cpp4
101 files changed, 1373 insertions, 2802 deletions
diff --git a/doc/examples/config.xml b/doc/examples/config.xml
index c234bab25..daf212711 100644
--- a/doc/examples/config.xml
+++ b/doc/examples/config.xml
@@ -8,6 +8,7 @@
<Logo>logo.png</Logo>
<Watermark>watermark.png</Watermark>
<RunProgram></RunProgram>
+ <RunProgramArguments></RunProgramArguments>
<RunProgramDescription></RunProgramDescription>
<StartMenuDir>Some Application Entry Dir</StartMenuDir>
<UninstallerName>SDKMaintenanceTool</UninstallerName>
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc
index a68b7af46..c89e3f92a 100644
--- a/doc/installerfw.qdoc
+++ b/doc/installerfw.qdoc
@@ -182,7 +182,15 @@
\row
\o Icon
\o Filename for a custom installer icon. The actual file is looked up by attaching
- a '.icns' (Mac OS X), '.ico' (Windows) or '.png' (Unix) suffix.
+ a '.icns' (Mac OS X), '.ico' (Windows) or '.png' (Unix) suffix. Deprecated,
+ use InstallerApplicationIcon and / or InstallerWindowIcon instead.
+ \row
+ \o InstallerApplicationIcon
+ \o Filename for a custom installer icon. The actual file is looked up by attaching
+ a '.icns' (Mac OS X), '.ico' (Windows). No functionality on Unix.
+ \row
+ \o InstallerWindowIcon
+ \o Filename for a custom window icon in PNG format for the Installer application.
\row
\o Logo
\o Filename for a logo used as \a QWizard::LogoPixmap.
@@ -197,6 +205,9 @@
\o Command executed after the installer is done if the user accepts
the action.
\row
+ \o RunProgramArguments
+ \o Arguments passed to the program specified in RunProgram.
+ \row
\o RunProgramDescription
\o Text shown next to the check box for running the program after
the installation. Defaults to \gui {Run <Name>}.
@@ -246,10 +257,6 @@
\row
\o TargetConfigurationFile
\o Filename for the configuration file on the target. Default is components.xml.
- \row
- \o Pages
- \o Custom strings for labels in the installer pages. Deprecated,
- see \l{Translating Pages} instead.
\endtable
*/
diff --git a/examples/examples.pro b/examples/examples.pro
deleted file mode 100644
index 854677b57..000000000
--- a/examples/examples.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-CONFIG += ordered
-TEMPLATE = subdirs
-
-EXTRASUBDIRS = testapp
-
-
-include(../installerfw.pri)
-
-!isEqual(IFW_SOURCE_TREE, $$IFW_BUILD_TREE) {
- for(SUBDIR, EXTRASUBDIRS) {
- mkdir.commands += $$QMAKE_MKDIR $$SUBDIR $${IFW_NEWLINE}
- }
- QMAKE_EXTRA_TARGETS += mkdir
-}
-
-for(SUBDIR, EXTRASUBDIRS) {
- examples.commands += cd $$SUBDIR && $(QMAKE) -r $$PWD/$$SUBDIR && $(MAKE) $${IFW_NEWLINE}
-}
-!isEqual(IFW_SOURCE_TREE, $$IFW_BUILD_TREE) {
- examples.depends = mkdir
-}
-QMAKE_EXTRA_TARGETS += examples
diff --git a/examples/testapp/components.xml b/examples/testapp/components.xml
deleted file mode 100644
index ce4e15ad5..000000000
--- a/examples/testapp/components.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<Packages>
- <ApplicationName>Test App</ApplicationName>
- <ApplicationVersion>1</ApplicationVersion>
- <Package>
- <Name>Test App</Name>
- <Pixmap></Pixmap>
- <Title></Title>
- <Description></Description>
- <Version>1</Version>
- <LastUpdateDate></LastUpdateDate>
- <InstallDate>2009-12-01</InstallDate>
- </Package>
-</Packages>
diff --git a/examples/testapp/componentselectiondialog.cpp b/examples/testapp/componentselectiondialog.cpp
deleted file mode 100644
index c56ee5413..000000000
--- a/examples/testapp/componentselectiondialog.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-
-#include "componentselectiondialog.h"
-#include "ui_componentselectiondialog.h"
-
-#include <component.h>
-#include <componentmodel.h>
-#include <packagemanagercore.h>
-
-#include <QHeaderView>
-#include <QPushButton>
-
-using namespace QInstaller;
-
-class ComponentSelectionDialog::Private : public QObject
-{
- Q_OBJECT
-
-public:
- Private(ComponentSelectionDialog *qq, PackageManagerCore *core)
- : q(qq),
- m_core(core)
- {
- }
-
- void currentChanged(const QModelIndex &index)
- {
- installBtn->setEnabled(componentModel->hasCheckedComponents());
- const int selectionCount = componentModel->checkedComponents().count();
- installBtn->setText(selectionCount > 1 ? tr("Install %1 Items").arg(selectionCount) :
- selectionCount == 1 ? tr("Install 1 Item") : tr("Install"));
- ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(selectionCount > 0 ? tr("Cancel")
- : tr("Close"));
-
- if (index.isValid()) {
- ui.textBrowser->setHtml(componentModel->data(componentModel->index(index.row(), 0,
- index.parent()), Qt::ToolTipRole).toString());
- } else {
- ui.textBrowser->clear();
- }
- }
-
- void modelReset()
- {
- ui.treeView->header()->resizeSection(0, ui.labelTitle->sizeHint().width() / 1.5);
- ui.treeView->header()->setStretchLastSection(true);
- for (int i = 0; i < ui.treeView->model()->columnCount(); ++i)
- ui.treeView->resizeColumnToContents(i);
-
- bool hasChildren = false;
- const int rowCount = ui.treeView->model()->rowCount();
- for (int row = 0; row < rowCount && !hasChildren; ++row)
- hasChildren = ui.treeView->model()->hasChildren(ui.treeView->model()->index(row, 0));
- ui.treeView->setRootIsDecorated(hasChildren);
- ui.treeView->expandToDepth(0);
- }
-
-private:
- ComponentSelectionDialog *const q;
-
-public:
- Ui::ComponentSelectionDialog ui;
- PackageManagerCore *const m_core;
- ComponentModel *componentModel;
- QPushButton *installBtn;
-
-public Q_SLOTS:
- void selectAll();
- void deselectAll();
-};
-
-void ComponentSelectionDialog::Private::selectAll()
-{
- componentModel->selectAll();
-}
-
-void ComponentSelectionDialog::Private::deselectAll()
-{
- componentModel->deselectAll();
-}
-
-
-// -- ComponentSelectionDialog
-
-ComponentSelectionDialog::ComponentSelectionDialog(PackageManagerCore *core, QWidget *parent)
- : QDialog(parent),
- d(new Private(this, core))
-{
- d->ui.setupUi(this);
- d->ui.icon->setPixmap(windowIcon().pixmap(48, 48));
-
- d->ui.splitter->setStretchFactor(0, 2);
- d->ui.splitter->setStretchFactor(1, 1);
- d->ui.splitter->setCollapsible(0, false);
-
- d->componentModel = new ComponentModel(4, core);
- d->componentModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
- d->componentModel->setHeaderData(1, Qt::Horizontal, tr("Installed Version"));
- d->componentModel->setHeaderData(2, Qt::Horizontal, tr("New Version"));
- d->componentModel->setHeaderData(3, Qt::Horizontal, tr("Size"));
-
- d->ui.treeView->setModel(d->componentModel);
- d->ui.treeView->setAttribute(Qt::WA_MacShowFocusRect, false);
- connect(d->ui.treeView->model(), SIGNAL(modelReset()), this, SLOT(modelReset()));
- connect(d->ui.treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
- this, SLOT(currentChanged(QModelIndex)));
-
- d->ui.labelSubTitle->setAttribute(Qt::WA_MacSmallSize);
- d->ui.labelLicenseBlurb->setAttribute(Qt::WA_MacSmallSize);
- d->ui.textBrowser->setAttribute(Qt::WA_MacShowFocusRect, false);
-
- d->installBtn = d->ui.buttonBox->addButton(tr("Install"), QDialogButtonBox::AcceptRole) ;
- if (!d->ui.buttonBox->button(QDialogButtonBox::Cancel)->icon().isNull())
- d->installBtn->setIcon(style()->standardIcon(QStyle::SP_DialogOkButton));
-
- connect(d->installBtn, SIGNAL(clicked()), this, SIGNAL(requestUpdate()));
- connect(d->ui.selectAll, SIGNAL(clicked()), d, SLOT(selectAll()), Qt::QueuedConnection);
- connect(d->ui.deselectAll, SIGNAL(clicked()), d, SLOT(deselectAll()), Qt::QueuedConnection);
-
- d->ui.treeView->header()->setStretchLastSection(true);
- d->ui.treeView->setCurrentIndex(d->ui.treeView->model()->index(0, 0));
- for (int i = 0; i < d->ui.treeView->model()->columnCount(); ++i)
- d->ui.treeView->resizeColumnToContents(i);
- d->modelReset();
-}
-
-ComponentSelectionDialog::~ComponentSelectionDialog()
-{
- delete d;
-}
-
-void ComponentSelectionDialog::selectAll()
-{
- d->selectAll();
-}
-
-void ComponentSelectionDialog::deselectAll()
-{
- d->deselectAll();
-}
-
-void ComponentSelectionDialog::install()
-{
- emit requestUpdate();
-}
-
-void ComponentSelectionDialog::selectComponent(const QString &id)
-{
- const QModelIndex &idx = d->componentModel->indexFromComponentName(id);
- if (!idx.isValid())
- return;
- d->componentModel->setData(idx, Qt::Checked, Qt::CheckStateRole);
-}
-
-void ComponentSelectionDialog::deselectComponent(const QString &id)
-{
- const QModelIndex &idx = d->componentModel->indexFromComponentName(id);
- if (!idx.isValid())
- return;
- d->componentModel->setData(idx, Qt::Unchecked, Qt::CheckStateRole);
-}
-
-#include "moc_componentselectiondialog.cpp"
-#include "componentselectiondialog.moc"
diff --git a/examples/testapp/componentselectiondialog.h b/examples/testapp/componentselectiondialog.h
deleted file mode 100644
index cb0134481..000000000
--- a/examples/testapp/componentselectiondialog.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-
-#ifndef COMPONENTSELECTIONDIALOG_H
-#define COMPONENTSELECTIONDIALOG_H
-
-#include <QDialog>
-
-namespace QInstaller {
- class PackageManagerCore;
-}
-
-class ComponentSelectionDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit ComponentSelectionDialog(QInstaller::PackageManagerCore *core, QWidget *parent = 0);
- virtual ~ComponentSelectionDialog();
-
- Q_INVOKABLE void selectComponent(const QString &compoenent);
- Q_INVOKABLE void deselectComponent(const QString &component);
- Q_INVOKABLE void selectAll();
- Q_INVOKABLE void deselectAll();
- Q_INVOKABLE void install();
-
-Q_SIGNALS:
- void requestUpdate();
-
-private:
- Q_PRIVATE_SLOT(d, void modelReset())
- Q_PRIVATE_SLOT(d, void currentChanged(const QModelIndex &index))
-
-private:
- class Private;
- Private *d;
-};
-
-#endif
diff --git a/examples/testapp/componentselectiondialog.ui b/examples/testapp/componentselectiondialog.ui
deleted file mode 100644
index 74f3b3fe4..000000000
--- a/examples/testapp/componentselectiondialog.ui
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ComponentSelectionDialog</class>
- <widget class="QDialog" name="ComponentSelectionDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>656</width>
- <height>409</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Software Update</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" rowspan="3">
- <widget class="QLabel" name="icon">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="pixmap">
- <pixmap resource="testapp.qrc">:/logo.png</pixmap>
- </property>
- <property name="scaledContents">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="labelTitle">
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>All available updates are shown below.</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" rowspan="2">
- <widget class="QLabel" name="labelSubTitle">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Installing this software may take some time. If you're not ready to install now, you can choose Software Update from the menu later.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QSplitter" name="splitter">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <widget class="QTreeView" name="treeView">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- <widget class="QTextBrowser" name="textBrowser">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0">
- <item>
- <widget class="QPushButton" name="selectAll">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Select All</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="deselectAll">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Deselect All</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="labelLicenseBlurb">
- <property name="text">
- <string>Note: Use of this software is subject to the original Software License Agreement(s) that accompanied the software being updated.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources>
- <include location="testapp.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ComponentSelectionDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/testapp/config.xml b/examples/testapp/config.xml
deleted file mode 100644
index bc00e2c20..000000000
--- a/examples/testapp/config.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<Installer>
- <Name>Test App</Name>
- <Version>1</Version>
- <Title>Test App</Title>
- <Publisher>Nokia</Publisher>
- <ProductUrl>http://qt.nokia.com</ProductUrl>
-
- <!-- @homeDir@ and @rootDir@ are some of the supported vars -->
- <TargetDir>@homeDir@/testinstall</TargetDir>
- <RemoteRepositories>
- <Repository>
- <Url>http://www.kdab.com/~christoph/testapp</Url>
- </Repository>
- </RemoteRepositories>
-</Installer>
diff --git a/examples/testapp/config/config.xml b/examples/testapp/config/config.xml
deleted file mode 100644
index e49ab7337..000000000
--- a/examples/testapp/config/config.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<Installer>
- <Name>Test App</Name>
- <Version>1.0.0</Version>
- <Title>Test App_Hurra</Title>
- <Publisher>Digia</Publisher>
- <ProductUrl>http://qt.digia.com</ProductUrl>
-
- <Icon>qticon</Icon>
- <Watermark>watermark.png</Watermark>
- <UninstallerName>TestAppUninstaller</UninstallerName>
- <RemoteRepositories>
- <Repository>
- <Url>http://www.example.com/repository</Url>
- </Repository>
- </RemoteRepositories>
-
- <!-- @homeDir@ and @rootDir@ are some of the supported vars -->
- <TargetDir>@homeDir@/testinstall</TargetDir>
-</Installer>
diff --git a/examples/testapp/config/license.txt b/examples/testapp/config/license.txt
deleted file mode 100644
index a55990fe3..000000000
--- a/examples/testapp/config/license.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-For individuals and/or legal entities resident in the American Continent (including those resident in Canada, South America, and the United States of America), the applicable licensing terms are specified under the heading "Trolltech Technology Preview License
-Agreement: American Continent".
-
-For individuals and/or legal entities not resident in the American Continent, the applicable licensing terms are specified under the heading "Trolltech Technology Preview License Agreement: Norway".
-
-TROLLTECH TECHNOLOGY PREVIEW LICENSE AGREEMENT: AMERICAN CONTINENT Agreement version 2.0
-IMPORTANT-READ CAREFULLY:
-
-1. This Trolltech Technology Preview License Agreement ("Agreement") is a legal agreement between you (either an individual or a legal entity) and Trolltech, Inc. ("Trolltech"), and pertains to the Trolltech software product(s) accompanying this Agreement, which include(s) computer software and may include "online" or electronic documentation, associated media, and printed materials, including the source code, example programs and the documentation ("Licensed Software").
-
-2. The Licensed Software is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. Trolltech retains all rights not expressly granted. No title, property rights or copyright in the Licensed Software or in any modifications to the Licensed Software shall pass to the Licensee under any circumstances. The Licensed Software is licensed, not sold.
-
-3. By installing, copying, or otherwise using the Licensed Software, Licensee agrees to be bound by the terms of this Agreement. If Licensee does not agree to the terms of this Agreement, Licensee should not install, copy, or otherwise use the Licensed Software.
-
-4. Upon Licensee's acceptance of the terms and conditions of this Agreement, Trolltech grants Licensee the right to use the Licensed Software in the manner provided below.
-
-5. Trolltech grants to Licensee as an individual a personal, non-exclusive, non-transferable license to make and use copies of the Licensed Software for the sole purpose of evaluating and testing the Licensed Software and/or providing feedback to Trolltech. Licensee may install copies of the Licensed Software on an unlimited number of computers provided that Licensee is the only individual using the Licensed Software. If Licensee is an entity, Trolltech grants Licensee the right to designate one, and only one, individual within Licensee's organization who shall have the sole right to use the Licensed Software in the manner provided in this Agreement. Licensee may, at any time, but not more frequently than once every six (6) months, designate another individual to replace the current designated user by notifying Trolltech, so long as there is no more than one (1) designated user at any given time
-
-6. Licensee may not loan, rent, lease, or license the Licensed Software or any copy of it. Licensee may not alter or remove any details of ownership, copyright, trademark or other property right connected with the Licensed Software. Licensee may not modify or distribute the Licensed Software. Licensee may not distribute any software statically or dynamically linked with the Licensed Software.
-
-7. This Licensed Software is time-limited. All rights granted to Licensee in this Agreement will be void three (3) months after Licensee received the Licensed Software.
-
-8. The Licensed Software may provide links to third party libraries or code (collectively "Third Party Libraries") to implement various functions. Third Party Libraries do not comprise part of the Licensed Software. In some cases, access to Third Party Libraries may be included along with the Licensed Software delivery as a convenience for development and testing only. Such source code and libraries as are or may be listed in the ".../src/3rdparty" source tree delivered with the Licensed Software, as may be amended from time to time, do not comprise the Licensed Software. Licensee acknowledges (1) that some Third Party Libraries may require additional licensing of copyright and patents from the owners of such, and (2) that distribution of any of the Licensed Software referencing any portion of a Third Party Library may require appropriate licensing from such third parties.
-
-9. Pre-Release Code, Non-Commercial Use: The Licensed Software contains Pre-release Code that is not at the level of performance and compatibility of a final, generally available, product offering. The Licensed Software may not operate correctly and may be substantially modified prior to the first commercial shipment, if any. Trolltech is not obligated to make this or any later version of the Licensed Software commercially available. The License Software is "Not for Commercial Use" and may only be used for the purposes described in Section 5. You may not use the Licensed Software in a live operating environment where it may be relied upon to perform in the same manner as a commercially released product or with data that has not been sufficiently backed up.
-
-10. WARRANTY DISCLAIMER: THE LICENSED SOFTWARE IS LICENSED TO LICENSEE "AS IS". TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, TROLLTECH ON BEHALF OF ITSELF AND ITS SUPPLIERS, DISCLAIMS ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT WITH REGARD TO THE LICENSED SOFTWARE.
-
-11. LIMITATION OF LIABILITY: IF, TROLLTECH'S WARRANTY DISCLAIMER NOTWITHSTANDING, TROLLTECH IS HELD LIABLE TO LICENSEE, WHETHER IN CONTRACT, TORT OR ANY OTHER LEGAL THEORY, BASED ON THE LICENSED SOFTWARE, TROLLTECH'S ENTIRE LIABILITY TO LICENSEE AND LICENSEE'S EXCLUSIVE REMEDY SHALL BE, AT TROLLTECH'S OPTION, EITHER (A) RETURN OF THE PRICE LICENSEE PAID FOR THE LICENSED SOFTWARE, OR (B) REPAIR OR REPLACEMENT OF THE LICENSED SOFTWARE, PROVIDED LICENSEE RETURNS TO TROLLTECH ALL COPIES OF THE LICENSED SOFTWARE AS ORIGINALLY DELIVERED TO LICENSEE. TROLLTECH SHALL NOT UNDER ANY CIRCUMSTANCES BE LIABLE TO LICENSEE BASED ON FAILURE OF THE LICENSED SOFTWARE IF THE FAILURE RESULTED FROM ACCIDENT, ABUSE OR MISAPPLICATION, NOR SHALL TROLLTECH UNDER ANY CIRCUMSTANCES BE LIABLE FOR SPECIAL DAMAGES, PUNITIVE OR EXEMPLARY DAMAGES, DAMAGES FOR LOSS OF PROFITS OR INTERRUPTION OF BUSINESS OR FOR LOSS OR CORRUPTION OF DATA. ANY AWARD OF DAMAGES FROM TROLLTECH TO LICENSEE SHALL NOT EXCEED THE TOTAL AMOUNT LICENSEE HAS PAID TO TROLLTECH IN CONNECTION WITH THIS AGREEMENT.
-
-12. Termination: Without prejudice to any other rights, Trolltech may terminate this Agreement if Licensee fails to comply with the terms and conditions of this Agreement. In such event, Licensee must destroy all copies of the Licensed Software and all of its components.
-
-13. Export Restrictions: Licensee agrees not to export or re-export the Licensed Software, any part thereof, or any process or service that is the direct product of the Licensed Software. Licensee may not sell, resell, or otherwise transfer for value, the Licensed Software (the foregoing collectively referred to as the "Restricted Components"), to any country, person, entity or end user subject to U.S. export restrictions. Licensee specifically agrees not to export or re-export any of the Restricted Components (i) to any country to which the U.S. has embargoed or restricted the export of goods or services, which currently include, but are not necessarily limited to Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria, or to any national of any such country, wherever located, who intends to transmit or transport the Restricted Components back to such country; (ii) to any end-user who Licensee knows or has reason to know will utilize the Restricted Components in the design, development or production of nuclear, chemical or biological weapons; or (iii) to any end-user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government. Licensee warrants and represents that neither the U.S. Commerce Department, Bureau of Export Administration nor any other U.S. federal agency has suspended, revoked or denied Licensee's export privileges.
-
-14. Government End Users: A "U.S. Government End User" shall mean any agency or entity of the government of the United States. The following shall apply if Licensee is a U.S. Government End User. The Licensed Software is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire the Licensed Software with only those rights set forth herein. The Licensed Software (including related documentation) is provided to U.S. Government End Users: (a) only as a commercial end item; and (b) only pursuant to this Agreement.
-
-15. Compliance with local laws: Licensee shall comply with all applicable laws and regulations relating to the Licensed Software in the United States and in other countries in which Licensee uses or modifies the Licensed Software. Without limiting the generality of the foregoing, Licensee shall not export, re-export, disclose or distribute any of the Licensed Software in violation of any applicable laws or regulations, including the export laws and regulations of the United States, and shall comply with all such laws and regulations.
-
-16. Entire Agreement: This Agreement constitutes the complete agreement between the parties and supersedes all prior or contemporaneous discussions, representations, and proposals, written or oral, with respect to the subject matters discussed herein. No modification of this Agreement will be effective unless contained in a writing executed by an authorized representative of each party. No term or condition contained in Licensee's purchase order will apply unless expressly accepted by Trolltech in writing. If any provision of the Agreement is found void or unenforceable, the remainder will remain valid and enforceable according to its terms. If any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of damages set forth in this Agreement shall remain in effect.
-
-17. Governing law, legal venue: This Agreement shall be construed, interpreted and governed by the laws of the State of California, USA. Any action or proceeding arising from or relating to this Agreement shall be brought in a federal court in the Northern District of California or in the State Court in Santa Clara County, California, and each party irrevocably submits to the personal jurisdiction of any such court in any such action or proceeding. The Agreement gives Licensee specific legal rights; Licensee may have others, which vary from state to state and from country to country. Trolltech reserves all rights not specifically granted in this Agreement.
-
-
-
-
-For legal entities and/or individuals residing in any country other than Canada, the United States of America or South America:
-TROLLTECH TECHNOLOGY PREVIEW LICENSE AGREEMENT: NORWAY
-
-Agreement version 2.0
-IMPORTANT-READ CAREFULLY:
-
-1. This Trolltech Technology Preview License Agreement ("Agreement") is a legal agreement between you (either an individual or a legal entity) and Trolltech ASA ("Trolltech"), and pertains to the Trolltech software product(s) accompanying this Agreement, which include(s) computer software and may include "online" or electronic documentation, associated media, and printed materials, including the source code, example programs and the documentation ("Licensed Software").
-
-2. The Licensed Software is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. Trolltech retains all rights not expressly granted. No title, property rights or copyright in the Licensed Software or in any modifications to the Licensed Software shall pass to the Licensee under any circumstances. The Licensed Software is licensed, not sold.
-
-3. By installing, copying, or otherwise using the Licensed Software, Licensee agrees to be bound by the terms of this Agreement. If Licensee does not agree to the terms of this Agreement, Licensee should not install, copy, or otherwise use the Licensed Software.
-
-4. Upon Licensee's acceptance of the terms and conditions of this Agreement, Trolltech grants Licensee the right to use the Licensed Software in the manner provided below.
-
-5. Trolltech grants to Licensee as an individual a personal, non-exclusive, non-transferable license to make and use copies of the Licensed Software for the sole purpose of evaluating and testing the Licensed Software and/or providing feedback to Trolltech. Licensee may install copies of the Licensed Software on an unlimited number of computers provided that Licensee is the only individual using the Licensed Software. If Licensee is an entity, Trolltech grants Licensee the right to designate one, and only one, individual within Licensee's organization who shall have the sole right to use the Licensed Software in the manner provided in this Agreement. Licensee may, at any time, but not more frequently than once every six (6) months, designate another individual to replace the current designated user by notifying Trolltech, so long as there is no more than one (1) designated user at any given time
-
-6. Licensee may not loan, rent, lease, or license the Licensed Software or any copy of it. Licensee may not alter or remove any details of ownership, copyright, trademark or other property right connected with the Licensed Software. Licensee may not modify or distribute the Licensed Software. Licensee may not distribute any software statically or dynamically linked with the Licensed Software.
-
-7. This Licensed Software is time-limited. All rights granted to Licensee in this Agreement will be void three (3) months after Licensee received the Licensed Software.
-
-8. The Licensed Software may provide links to third party libraries or code (collectively "Third Party Libraries") to implement various functions. Third Party Libraries do not comprise part of the Licensed Software. In some cases, access to Third Party Libraries may be included along with the Licensed Software delivery as a convenience for development and testing only. Such source code and libraries as are or may be listed in the ".../src/3rdparty" source tree delivered with the Licensed Software, as may be amended from time to time, do not comprise the Licensed Software. Licensee acknowledges (1) that some Third Party Libraries may require additional licensing of copyright and patents from the owners of such, and (2) that distribution of any of the Licensed Software referencing any portion of a Third Party Library may require appropriate licensing from such third parties.
-
-9. Pre-Release Code, Non-Commercial Use: The Licensed Software contains Pre-release Code that is not at the level of performance and compatibility of a final, generally available, product offering. The Licensed Software may not operate correctly and may be substantially modified prior to the first commercial shipment, if any. Trolltech is not obligated to make this or any later version of the Licensed Software commercially available. The License Software is "Not for Commercial Use" and may only be used for the purposes described in Section 5. You may not use the Licensed Software in a live operating environment where it may be relied upon to perform in the same manner as a commercially released product or with data that has not been sufficiently backed up.
-
-10. WARRANTY DISCLAIMER: THE LICENSED SOFTWARE IS LICENSED TO LICENSEE "AS IS". TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, TROLLTECH ON BEHALF OF ITSELF AND ITS SUPPLIERS, DISCLAIMS ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT WITH REGARD TO THE LICENSED SOFTWARE.
-
-11. LIMITATION OF LIABILITY: IF, TROLLTECH'S WARRANTY DISCLAIMER NOTWITHSTANDING, TROLLTECH IS HELD LIABLE TO LICENSEE, WHETHER IN CONTRACT, TORT OR ANY OTHER LEGAL THEORY, BASED ON THE LICENSED SOFTWARE, TROLLTECH'S ENTIRE LIABILITY TO LICENSEE AND LICENSEE'S EXCLUSIVE REMEDY SHALL BE, AT TROLLTECH'S OPTION, EITHER (A) RETURN OF THE PRICE LICENSEE PAID FOR THE LICENSED SOFTWARE, OR (B) REPAIR OR REPLACEMENT OF THE LICENSED SOFTWARE, PROVIDED LICENSEE RETURNS TO TROLLTECH ALL COPIES OF THE LICENSED SOFTWARE AS ORIGINALLY DELIVERED TO LICENSEE. TROLLTECH SHALL NOT UNDER ANY CIRCUMSTANCES BE LIABLE TO LICENSEE BASED ON FAILURE OF THE LICENSED SOFTWARE IF THE FAILURE RESULTED FROM ACCIDENT, ABUSE OR MISAPPLICATION, NOR SHALL TROLLTECH UNDER ANY CIRCUMSTANCES BE LIABLE FOR SPECIAL DAMAGES, PUNITIVE OR EXEMPLARY DAMAGES, DAMAGES FOR LOSS OF PROFITS OR INTERRUPTION OF BUSINESS OR FOR LOSS OR CORRUPTION OF DATA. ANY AWARD OF DAMAGES FROM TROLLTECH TO LICENSEE SHALL NOT EXCEED THE TOTAL AMOUNT LICENSEE HAS PAID TO TROLLTECH IN CONNECTION WITH THIS AGREEMENT.
-
-12. Termination: Without prejudice to any other rights, Trolltech may terminate this Agreement if Licensee fails to comply with the terms and conditions of this Agreement. In such event, Licensee must destroy all copies of the Licensed Software and all of its components.
-
-13. Export Restrictions: Licensee agrees not to export or re-export the Licensed Software, any part thereof, or any process or service that is the direct product of the Licensed Software. Licensee may not sell, resell, or otherwise transfer for value, the Licensed Software (the foregoing collectively referred to as the "Restricted Components"), to any country, person, entity or end user subject to U.S. export restrictions. Licensee specifically agrees not to export or re-export any of the Restricted Components (i) to any country to which the U.S. has embargoed or restricted the export of goods or services, which currently include, but are not necessarily limited to Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria, or to any national of any such country, wherever located, who intends to transmit or transport the Restricted Components back to such country; (ii) to any end-user who Licensee knows or has reason to know will utilize the Restricted Components in the design, development or production of nuclear, chemical or biological weapons; or (iii) to any end-user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government. Licensee warrants and represents that neither the U.S. Commerce Department, Bureau of Export Administration nor any other U.S. federal agency has suspended, revoked or denied Licensee's export privileges.
-
-14. Government End Users: A "U.S. Government End User" shall mean any agency or entity of the government of the United States. The following shall apply if Licensee is a U.S. Government End User. The Licensed Software is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire the Licensed Software with only those rights set forth herein. The Licensed Software (including related documentation) is provided to U.S. Government End Users: (a) only as a commercial end item; and (b) only pursuant to this Agreement.
-
-15. Compliance with local laws: Licensee shall comply with all applicable laws and regulations relating to the Licensed Software in the United States and in other countries in which Licensee uses or modifies the Licensed Software. Without limiting the generality of the foregoing, Licensee shall not export, re-export, disclose or distribute any of the Licensed Software in violation of any applicable laws or regulations, including the export laws and regulations of the United States, and shall comply with all such laws and regulations.
-
-16. Entire Agreement: This Agreement constitutes the complete agreement between the parties and supersedes all prior or contemporaneous discussions, representations, and proposals, written or oral, with respect to the subject matters discussed herein. No modification of this Agreement will be effective unless contained in a writing executed by an authorized representative of each party. No term or condition contained in Licensee's purchase order will apply unless expressly accepted by Trolltech in writing. If any provision of the Agreement is found void or unenforceable, the remainder will remain valid and enforceable according to its terms. If any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of damages set forth in this Agreement shall remain in effect.
-
-17. Governing law, legal venue: This Agreement shall be construed, interpreted and governed by the laws of Norway, the legal venue to be Oslo City Court. Trolltech reserves all rights not specifically granted in this Agreement.
diff --git a/examples/testapp/config/logo.png b/examples/testapp/config/logo.png
deleted file mode 100644
index 8a9562614..000000000
--- a/examples/testapp/config/logo.png
+++ /dev/null
Binary files differ
diff --git a/examples/testapp/config/qticon.icns b/examples/testapp/config/qticon.icns
deleted file mode 100644
index 6291dd397..000000000
--- a/examples/testapp/config/qticon.icns
+++ /dev/null
Binary files differ
diff --git a/examples/testapp/config/qticon.ico b/examples/testapp/config/qticon.ico
deleted file mode 100644
index 9e1b83f1b..000000000
--- a/examples/testapp/config/qticon.ico
+++ /dev/null
Binary files differ
diff --git a/examples/testapp/config/qticon.png b/examples/testapp/config/qticon.png
deleted file mode 100644
index d68b205cd..000000000
--- a/examples/testapp/config/qticon.png
+++ /dev/null
Binary files differ
diff --git a/examples/testapp/config/watermark.png b/examples/testapp/config/watermark.png
deleted file mode 100644
index b07780d9d..000000000
--- a/examples/testapp/config/watermark.png
+++ /dev/null
Binary files differ
diff --git a/examples/testapp/logo.png b/examples/testapp/logo.png
deleted file mode 100644
index 3d5865a60..000000000
--- a/examples/testapp/logo.png
+++ /dev/null
Binary files differ
diff --git a/examples/testapp/mainwindow.cpp b/examples/testapp/mainwindow.cpp
deleted file mode 100644
index 016b568af..000000000
--- a/examples/testapp/mainwindow.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-#include "mainwindow.h"
-
-#include "componentselectiondialog.h"
-#include "updateagent.h"
-#include "updatesettingsdialog.h"
-
-#include <binaryformat.h>
-#include <errors.h>
-#include <updatesettings.h>
-
-#include <kdselfrestarter.h>
-
-#include <QAbstractButton>
-#include <QApplication>
-#include <QLabel>
-#include <QMenuBar>
-#include <QMessageBox>
-#include <QProgressDialog>
-
-using namespace QInstaller;
-using namespace QInstallerCreator;
-
-MainWindow::MainWindow(const QStringList &args, QWidget *parent)
- : QMainWindow(parent)
- , m_dialog(new UpdateSettingsDialog(this))
-{
- m_core.setUpdater();
-
- QMenu *fm = menuBar()->addMenu(QObject::tr("File"));
- fm->addAction(QObject::tr("Check for Updates"), this, SLOT(checkForUpdates()),
- QKeySequence(QLatin1String("Ctrl+U")));
- fm->addAction(QObject::tr("Update Settings"), this, SLOT(editUpdateSettings()));
- fm->addAction(QObject::tr("Quit"), QApplication::instance(), SLOT(quit()),
- QKeySequence(QLatin1String("Ctrl+Q")));
-
- QLabel *label = new QLabel(this);
- label->setWordWrap(true);
- label->setAlignment(Qt::AlignCenter);
- setCentralWidget(label);
- label->setText(QString::fromLatin1("Version: %1\n").arg(m_core.settings().applicationVersion())
- + args.join(QLatin1String(" ")));
-
- UpdateAgent *const agent = new UpdateAgent(this);
- connect(agent, SIGNAL(updatesAvailable()), this, SLOT(updatesAvailable()));
-}
-
-void MainWindow::editUpdateSettings()
-{
- connect(m_dialog, SIGNAL(checkForUpdates()), this, SLOT(checkForUpdates()));
- m_dialog->show();
-}
-
-void MainWindow::checkForUpdates()
-{
- QScopedPointer<BinaryFormatEngineHandler> handler(new BinaryFormatEngineHandler(ComponentIndex()));
- handler->setComponentIndex(QInstallerCreator::ComponentIndex());
-
- UpdateSettings settings;
- try {
- // TODO: check what this should have done
- //m_core.setTemporaryRepositories(settings.repositories());
- settings.setLastCheck(QDateTime::currentDateTime());
-
- if (!m_core.fetchRemotePackagesTree()) {
- settings.setLastResult(tr("Software Update failed."));
- QMessageBox::information(this, tr("Check for Updates"), tr("Failed to retrieve updates!"));
- return;
- }
-
- // no updates for us
- if (m_core.updaterComponents().isEmpty()) {
- QMessageBox::information(this, tr("Check for Updates"), tr("There are currently no updates "
- "available for you."));
- return;
- }
-
- // TODO: fix this, set the target directory to the actual one
- // m_core.setValue(scTargetDir, QFileInfo(updaterapp.packagesInfo()->fileName()).absolutePath());
-
- // this will automatically mark components as to get installed
- ComponentSelectionDialog componentSelection(&m_core, this);
- if (componentSelection.exec() == QDialog::Rejected)
- return;
-
- QProgressDialog dialog(this);
- dialog.setRange(0, 100);
- dialog.show();
- connect(&dialog, SIGNAL(canceled()), &m_core, SLOT(interrupt()));
- connect(&m_core, SIGNAL(installationProgressTextChanged(QString)), &dialog,
- SLOT(setLabelText(QString)));
- connect(&m_core, SIGNAL(installationProgressChanged(int)), &dialog, SLOT(setValue(int)));
- //m_core.installSelectedComponents(); //method doesn't exist anymore
- updatesInstalled();
- } catch (const QInstaller::Error &error) {
- QMessageBox::critical(this, tr("Check for Updates"), tr("Error while installing updates:\n%1")
- .arg(error.message()));
- m_core.rollBackInstallation();
- settings.setLastResult(tr("Software Update failed."));
- } catch (...) {
- QMessageBox::critical(this, tr("Check for Updates"), tr("Unknown error while installing updates."));
- m_core.rollBackInstallation();
- settings.setLastResult(tr("Software Update failed."));
- }
-}
-
-void MainWindow::updatesAvailable()
-{
- QScopedPointer<QMessageBox> box(new QMessageBox(this));
- box->setWindowTitle(tr("Updates Available"));
- box->setText(tr("Software updates are available for your computer. Do you want to install them?"));
- box->setStandardButtons(QMessageBox::Yes|QMessageBox::No);
- box->button(QMessageBox::Yes)->setText(tr("Continue"));
- box->button(QMessageBox::No)->setText(tr("Not Now"));
- box->exec();
-
- if (box && box->clickedButton() == box->button(QMessageBox::Yes))
- checkForUpdates();
-}
-
-void MainWindow::updatesInstalled()
-{
- // only ask that dumb question if a SelfUpdateOperation was executed
- if (!KDSelfRestarter::restartOnQuit()) {
- QMessageBox::information(this, tr("Updates Installed"), tr("Installation complete."));
- return;
- }
-
- QScopedPointer<QMessageBox> box(new QMessageBox(this));
- box->setWindowTitle(tr("Updates Installed"));
- box->setText(tr("Installation complete, you need to restart the application for the changes to take effect."));
- box->setStandardButtons(QMessageBox::Yes|QMessageBox::No);
- box->button(QMessageBox::Yes)->setText(tr("Restart Now"));
- box->button(QMessageBox::No)->setText(tr("Restart Later"));
- box->exec();
- if (!box)
- return;
- if (box->clickedButton() == box->button(QMessageBox::Yes))
- QCoreApplication::quit();
- else
- KDSelfRestarter::setRestartOnQuit(false);
-}
-
diff --git a/examples/testapp/mainwindow.h b/examples/testapp/mainwindow.h
deleted file mode 100644
index 7a0466dd1..000000000
--- a/examples/testapp/mainwindow.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-
-
-#include <packagemanagercore.h>
-#include <settings.h>
-
-#include <QMainWindow>
-
-class UpdateSettingsDialog;
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- explicit MainWindow(const QStringList &args, QWidget *parent = 0);
-
-private Q_SLOTS:
- void editUpdateSettings();
- void checkForUpdates();
- void updatesInstalled();
- void updatesAvailable();
-
-private:
- UpdateSettingsDialog *m_dialog;
-
- QInstaller::Settings m_settings;
- QInstaller::PackageManagerCore m_core;
-};
diff --git a/examples/testapp/packages/com.nokia.testapp.subcomponent.alwaysvisible/meta/package.xml b/examples/testapp/packages/com.nokia.testapp.subcomponent.alwaysvisible/meta/package.xml
deleted file mode 100644
index 5ab9c9fc9..000000000
--- a/examples/testapp/packages/com.nokia.testapp.subcomponent.alwaysvisible/meta/package.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<Package>
- <DisplayName>visible subcomponent</DisplayName>
- <Version>1337</Version>
- <ReleaseDate>2009-12-03</ReleaseDate>
- <Name>com.nokia.testapp.subcomponent.alwaysvisible</Name>
- <Default>true</Default>
-</Package>
diff --git a/examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/installscript.qs b/examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/installscript.qs
deleted file mode 100644
index 7907a268a..000000000
--- a/examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/installscript.qs
+++ /dev/null
@@ -1,4 +0,0 @@
-// constructor
-function Component()
-{
-}
diff --git a/examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/package.xml b/examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/package.xml
deleted file mode 100644
index d60cf21f4..000000000
--- a/examples/testapp/packages/com.nokia.testapp.subcomponent.virtual/meta/package.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<Package>
- <DisplayName>virtual subcomponent</DisplayName>
- <Version>1</Version>
- <ReleaseDate>2009-12-03</ReleaseDate>
- <Name>com.nokia.testapp.subcomponent.virtual</Name>
- <Virtual>true</Virtual>
- <Script>installscript.qs</Script>
-</Package>
diff --git a/examples/testapp/packages/com.nokia.testapp.subcomponent/meta/package.xml b/examples/testapp/packages/com.nokia.testapp.subcomponent/meta/package.xml
deleted file mode 100644
index 8d299684a..000000000
--- a/examples/testapp/packages/com.nokia.testapp.subcomponent/meta/package.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<Package>
- <DisplayName>subcomponents parent</DisplayName>
- <Version>1</Version>
- <ReleaseDate>2009-12-03</ReleaseDate>
- <Name>com.nokia.testapp.subcomponent</Name>
-</Package>
diff --git a/examples/testapp/packages/com.nokia.testapp/meta/installscript.js b/examples/testapp/packages/com.nokia.testapp/meta/installscript.js
deleted file mode 100644
index d1dded25b..000000000
--- a/examples/testapp/packages/com.nokia.testapp/meta/installscript.js
+++ /dev/null
@@ -1,18 +0,0 @@
-function Component()
-{
- if( installer.isUpdater() )
- {
- if( installer.value( "os" ) == "win" )
- component.addDownloadableArchive( "testapp.exe" );
- else
- component.addDownloadableArchive( "testapp.app.7z" );
- }
-}
-
-Component.prototype.createOperationsForArchive = function( archive )
-{
- component.createOperationsForArchive( archive );
-
- if( installer.isUpdater() )
- component.addOperation( "SelfRestart" );
-}
diff --git a/examples/testapp/packages/com.nokia.testapp/meta/package.xml b/examples/testapp/packages/com.nokia.testapp/meta/package.xml
deleted file mode 100644
index 2755d33f2..000000000
--- a/examples/testapp/packages/com.nokia.testapp/meta/package.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<Package>
- <DisplayName>Test App</DisplayName>
- <Description>Installs the complete Nokia SDK.</Description>
- <Version inheritVersionFrom="com.nokia.testapp.subcomponent.alwaysvisible">1</Version>
- <ReleaseDate>2009-12-03</ReleaseDate>
- <Name>com.nokia.testapp</Name>
- <Script>installscript.js</Script>
-</Package>
diff --git a/examples/testapp/testapp.pro b/examples/testapp/testapp.pro
deleted file mode 100644
index 4b2e622df..000000000
--- a/examples/testapp/testapp.pro
+++ /dev/null
@@ -1,49 +0,0 @@
-TEMPLATE = app
-INCLUDEPATH += . ..
-TARGET = testapp
-
-include(../../installerfw.pri)
-
-isEqual(QT_MAJOR_VERSION, 5) {
- QT += widgets
-}
-
-!static {
- warning("You can use this example only with a static build of Qt and IFW!")
-}
-
-DESTDIR = $$IFW_BUILD_TREE/examples/testapp/packages/com.nokia.testapp/data
-
-FORMS += \
- componentselectiondialog.ui \
- updatesettingsdialog.ui \
- updatesettingswidget.ui
-
-HEADERS += mainwindow.h \
- componentselectiondialog.h \
- updatesettingsdialog.h \
- updateagent.h \
- updatesettingswidget.h
-
-SOURCES += main.cpp \
- mainwindow.cpp \
- componentselectiondialog.cpp \
- updatesettingsdialog.cpp \
- updateagent.cpp \
- updatesettingswidget.cpp
-
-RESOURCES += testapp.qrc
-
-macx {
- QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator -p $$IFW_SOURCE_TREE/examples/testapp/packages \
- -c $$IFW_SOURCE_TREE/examples/testapp/config/config.xml -t $$IFW_APP_PATH/installerbase \
- TestAppInstaller.app
-} win32: {
- QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator.exe -p $$IFW_SOURCE_TREE/examples/testapp/packages \
- -c $$IFW_SOURCE_TREE/examples/testapp/config/config.xml -t $$IFW_APP_PATH/installerbase.exe \
- TestAppInstaller.exe)
-} else {
- QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator -p $$IFW_SOURCE_TREE/examples/testapp/packages \
- -c $$IFW_SOURCE_TREE/examples/testapp/config/config.xml -t $$IFW_APP_PATH/installerbase \
- TestAppInstaller)
-}
diff --git a/examples/testapp/testapp.qrc b/examples/testapp/testapp.qrc
deleted file mode 100644
index 89c08ca9e..000000000
--- a/examples/testapp/testapp.qrc
+++ /dev/null
@@ -1,8 +0,0 @@
-<RCC>
- <qresource prefix="/metadata/installer-config">
- <file>config.xml</file>
- </qresource>
- <qresource>
- <file>logo.png</file>
- </qresource>
-</RCC>
diff --git a/examples/testapp/updateagent.cpp b/examples/testapp/updateagent.cpp
deleted file mode 100644
index 0523f6da7..000000000
--- a/examples/testapp/updateagent.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-#include "updateagent.h"
-
-#include <binaryformatenginehandler.h>
-#include <binaryformat.h>
-#include <errors.h>
-#include <component.h>
-#include <packagemanagercore.h>
-#include <updatesettings.h>
-
-#include <QtCore/QDateTime>
-#include <QtCore/QTimer>
-
-using namespace QInstaller;
-using QInstallerCreator::ComponentIndex;
-using QInstallerCreator::BinaryFormatEngineHandler;
-
-class UpdateAgent::Private
-{
-public:
- Private(UpdateAgent *qq)
- : q(qq)
- {
- connect(&checkTimer, SIGNAL(timeout()), q, SLOT(maybeCheck()));
- checkTimer.start(1000);
- }
-
-private:
- QTimer checkTimer;
- UpdateAgent *const q;
-
-public:
- void maybeCheck()
- {
- checkTimer.stop();
-
- UpdateSettings settings;
- try {
- if (settings.updateInterval() > 0
- && settings.lastCheck().secsTo(QDateTime::currentDateTime()) >= settings.updateInterval()) {
- // update the time we last checked for updates
- settings.setLastCheck(QDateTime::currentDateTime());
-
- QScopedPointer<BinaryFormatEngineHandler> handler;
- handler.reset(new BinaryFormatEngineHandler(ComponentIndex()));
- handler->setComponentIndex(QInstallerCreator::ComponentIndex());
-
- PackageManagerCore core(QInstaller::MagicUpdaterMarker);
- // TODO: check what this should have done
- //core.setTemporaryRepositories(settings.repositories());
- if (!core.fetchRemotePackagesTree())
- throw Error(tr("Software Update failed."));
- settings.setLastResult(tr("Software Update run successfully."));
-
- QList<Component*> components = core.updaterComponents();
- // no updates available
- if (components.isEmpty())
- return;
- emit q->updatesAvailable();
- }
- } catch (...) {
- settings.setLastResult(tr("Software Update failed."));
- return;
- }
- checkTimer.start();
- }
-};
-
-UpdateAgent::UpdateAgent(QObject *parent)
- : QObject(parent),
- d(new Private(this))
-{
-}
-
-UpdateAgent::~UpdateAgent()
-{
- delete d;
-}
-
-#include "moc_updateagent.cpp"
diff --git a/examples/testapp/updatesettingsdialog.cpp b/examples/testapp/updatesettingsdialog.cpp
deleted file mode 100644
index 9013da67c..000000000
--- a/examples/testapp/updatesettingsdialog.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-#include "updatesettingsdialog.h"
-#include "ui_updatesettingsdialog.h"
-
-#include <repository.h>
-#include <updatesettings.h>
-
-#include <QDateTime>
-#include <QStringListModel>
-
-using namespace QInstaller;
-
-class UpdateSettingsDialog::Private
-{
-public:
- Private(UpdateSettingsDialog *qq)
- : q(qq)
- {
- ui.setupUi(q);
- }
-
-private:
- UpdateSettingsDialog *const q;
-
-public:
- Ui::UpdateSettingsDialog ui;
-};
-
-UpdateSettingsDialog::UpdateSettingsDialog(QWidget *parent)
- : QDialog(parent),
- d(new Private(this))
-{
- connect(d->ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(d->ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
-
- connect(d->ui.widget, SIGNAL(checkForUpdates()), this, SLOT(accept()));
- connect(d->ui.widget, SIGNAL(checkForUpdates()), this, SIGNAL(checkForUpdates()));
- setFixedSize(size());
-}
-
-UpdateSettingsDialog::~UpdateSettingsDialog()
-{
- delete d;
-}
-
-void UpdateSettingsDialog::accept()
-{
- d->ui.widget->accept();
- QDialog::accept();
-}
-
-#include "moc_updatesettingsdialog.cpp"
diff --git a/examples/testapp/updatesettingsdialog.h b/examples/testapp/updatesettingsdialog.h
deleted file mode 100644
index e952d4d2d..000000000
--- a/examples/testapp/updatesettingsdialog.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-
-#ifndef UPDATESETTINGSDIALOG_H
-#define UPDATESETTINGSDIALOG_H
-
-#include <QDialog>
-
-class UpdateSettingsDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit UpdateSettingsDialog(QWidget *parent = 0);
- ~UpdateSettingsDialog();
-
-public Q_SLOTS:
- void accept();
-
-Q_SIGNALS:
- void checkForUpdates();
-
-private:
- class Private;
- Private *const d;
-};
-
-#endif
diff --git a/examples/testapp/updatesettingsdialog.ui b/examples/testapp/updatesettingsdialog.ui
deleted file mode 100644
index 0a879257b..000000000
--- a/examples/testapp/updatesettingsdialog.ui
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UpdateSettingsDialog</class>
- <widget class="QWidget" name="UpdateSettingsDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>447</width>
- <height>312</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Software Update Settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="UpdateSettingsWidget" name="widget" native="true"/>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>UpdateSettingsWidget</class>
- <extends>QWidget</extends>
- <header>updatesettingswidget.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/examples/testapp/updatesettingswidget.cpp b/examples/testapp/updatesettingswidget.cpp
deleted file mode 100644
index b1f36304d..000000000
--- a/examples/testapp/updatesettingswidget.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-#include "updatesettingswidget.h"
-#include "ui_updatesettingswidget.h"
-
-#include <repository.h>
-#include <updatesettings.h>
-
-#include <QDateTime>
-#include <QStringListModel>
-
-using namespace QInstaller;
-
-class UpdateSettingsWidget::Private
-{
-public:
- Private(UpdateSettingsWidget *qq)
- : q(qq),
- initialized(false)
- {
- ui.setupUi(q);
- }
-
- void addUpdateSource()
- {
- const int newRow = model.rowCount();
- if (model.insertRow(newRow))
- ui.treeViewUpdateSources->edit(model.index(newRow, 0));
- }
-
- void removeUpdateSource()
- {
- model.removeRow(ui.treeViewUpdateSources->currentIndex().row());
- }
-
-private:
- UpdateSettingsWidget *const q;
-
-public:
- bool initialized;
- QStringListModel model;
- UpdateSettings settings;
-
- Ui::UpdateSettingsWidget ui;
-};
-
-
-// -- UpdateSettingsWidget
-
-UpdateSettingsWidget::UpdateSettingsWidget(QWidget *parent)
- : QWidget(parent),
- d(new Private(this))
-{
-}
-
-UpdateSettingsWidget::~UpdateSettingsWidget()
-{
- delete d;
-}
-
-void UpdateSettingsWidget::showEvent(QShowEvent *event)
-{
- Q_UNUSED(event)
- if (d->initialized)
- return;
-
- d->ui.checkBoxCheckForUpdates->setChecked(d->settings.updateInterval() > 0);
- d->ui.checkBoxCheckOnlyImportant->setChecked(d->settings.checkOnlyImportantUpdates());
- switch (qAbs(d->settings.updateInterval())) {
- case UpdateSettings::Daily:
- d->ui.comboBoxFrequency->setCurrentIndex(0);
- break;
- case UpdateSettings::Weekly:
- d->ui.comboBoxFrequency->setCurrentIndex(1);
- break;
- case UpdateSettings::Monthly:
- d->ui.comboBoxFrequency->setCurrentIndex(2);
- break;
- }
-
- connect(d->ui.buttonCheckNow, SIGNAL(clicked()), this, SIGNAL(checkForUpdates()));
- connect(d->ui.buttonAddUpdateSource, SIGNAL(clicked()), this, SLOT(addUpdateSource()));
- connect(d->ui.buttonRemoveUpdateSource, SIGNAL(clicked()), this, SLOT(removeUpdateSource()));
-
- QStringList reps;
- foreach (const Repository &repository, d->settings.repositories())
- reps.append(repository.url().toString());
-
- d->model.setStringList(reps);
- d->ui.treeViewUpdateSources->setModel(&d->model);
-
- d->ui.labelLastUpdateResult->clear();
- if (!d->settings.lastResult().isEmpty()) {
- d->ui.labelLastUpdateResult->setText(d->settings.lastResult() + QLatin1Char('\n')
- + d->settings.lastCheck().toString());
- }
- d->initialized = true;
-}
-
-void UpdateSettingsWidget::accept()
-{
- switch(d->ui.comboBoxFrequency->currentIndex()) {
- case 0:
- d->settings.setUpdateInterval(UpdateSettings::Daily);
- break;
- case 1:
- d->settings.setUpdateInterval(UpdateSettings::Weekly);
- break;
- case 2:
- d->settings.setUpdateInterval(UpdateSettings::Monthly);
- break;
- }
-
- if (!d->ui.checkBoxCheckForUpdates->isChecked())
- d->settings.setUpdateInterval(-d->settings.updateInterval());
- d->settings.setCheckOnlyImportantUpdates(d->ui.checkBoxCheckOnlyImportant->isChecked());
-
- QSet<Repository> repositories;
- foreach (const QString &url, d->model.stringList())
- repositories.insert(Repository(QUrl(url), false));
- d->settings.setRepositories(repositories);
-}
-
-#include "moc_updatesettingswidget.cpp"
diff --git a/examples/testapp/updatesettingswidget.h b/examples/testapp/updatesettingswidget.h
deleted file mode 100644
index 11ab70bf3..000000000
--- a/examples/testapp/updatesettingswidget.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-
-#ifndef UPDATESETTINGSWIDGET_H
-#define UPDATESETTINGSWIDGET_H
-
-#include <QWidget>
-
-class UpdateSettingsWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit UpdateSettingsWidget(QWidget *parent = 0);
- ~UpdateSettingsWidget();
-
-public Q_SLOTS:
- void accept();
-
-Q_SIGNALS:
- void checkForUpdates();
-
-protected:
- void showEvent(QShowEvent *event);
-
-private:
- Q_PRIVATE_SLOT(d, void addUpdateSource());
- Q_PRIVATE_SLOT(d, void removeUpdateSource());
-
-private:
- class Private;
- Private *const d;
-};
-
-#endif
diff --git a/examples/testapp/updatesettingswidget.ui b/examples/testapp/updatesettingswidget.ui
deleted file mode 100644
index 49525e1b9..000000000
--- a/examples/testapp/updatesettingswidget.ui
+++ /dev/null
@@ -1,286 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UpdateSettingsWidget</class>
- <widget class="QWidget" name="UpdateSettingsWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>438</width>
- <height>247</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Software Update Settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QTabWidget" name="tabWidget">
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Scheduled Check</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>16</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QCheckBox" name="checkBoxCheckForUpdates">
- <property name="text">
- <string>Check for updates:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QComboBox" name="comboBoxFrequency">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <item>
- <property name="text">
- <string>Daily</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Weekly</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Monthly</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="0" column="4">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>16</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1">
- <widget class="QWidget" name="widget" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>8</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>8</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="1" column="2" colspan="2">
- <widget class="QCheckBox" name="checkBoxCheckOnlyImportant">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Check only for important updates</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>11</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="2">
- <widget class="QPushButton" name="buttonCheckNow">
- <property name="text">
- <string>Check Now</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="labelLastCheck">
- <property name="text">
- <string>Last check:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item row="1" column="2" colspan="2">
- <widget class="QLabel" name="labelLastUpdateResult">
- <property name="text">
- <string>Software Update ran successfully.
-Monday, 2009 december 16 20.36</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>1</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="4">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>1</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>23</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2">
- <attribute name="title">
- <string>Update Sources</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0" colspan="3">
- <widget class="QTreeView" name="treeViewUpdateSources">
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="headerHidden">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QToolButton" name="buttonAddUpdateSource">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>25</height>
- </size>
- </property>
- <property name="text">
- <string>+</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QToolButton" name="buttonRemoveUpdateSource">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>25</height>
- </size>
- </property>
- <property name="text">
- <string>-</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>checkBoxCheckForUpdates</sender>
- <signal>toggled(bool)</signal>
- <receiver>comboBoxFrequency</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>179</x>
- <y>59</y>
- </hint>
- <hint type="destinationlabel">
- <x>293</x>
- <y>61</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>checkBoxCheckForUpdates</sender>
- <signal>toggled(bool)</signal>
- <receiver>checkBoxCheckOnlyImportant</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>135</x>
- <y>64</y>
- </hint>
- <hint type="destinationlabel">
- <x>149</x>
- <y>91</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/installerfw.pri b/installerfw.pri
index ec7b88fb4..c5b4a8b4a 100644
--- a/installerfw.pri
+++ b/installerfw.pri
@@ -3,7 +3,7 @@
}
IFW_PRI_INCLUDED = 1
-IFW_VERSION = 1.2.81
+IFW_VERSION = 1.3.81
IFW_REPOSITORY_FORMAT_VERSION = 1.0.0
diff --git a/installerfw.pro b/installerfw.pro
index 2f0b653d7..1f17d1dc9 100644
--- a/installerfw.pro
+++ b/installerfw.pro
@@ -1,6 +1,6 @@
CONFIG += ordered
TEMPLATE = subdirs
-SUBDIRS += src examples tests tools
+SUBDIRS += src tests tools
include (installerfw.pri)
include (doc/doc.pri)
diff --git a/src/libs/installer/addqtcreatorarrayvalueoperation.h b/src/libs/installer/addqtcreatorarrayvalueoperation.h
index 6792b8e88..670dccff8 100644
--- a/src/libs/installer/addqtcreatorarrayvalueoperation.h
+++ b/src/libs/installer/addqtcreatorarrayvalueoperation.h
@@ -39,8 +39,8 @@
**
**************************************************************************/
-#ifndef ADDQTCREATORVALUEOPERATION_H
-#define ADDQTCREATORVALUEOPERATION_H
+#ifndef ADDQTCREATORARRAYVALUEOPERATION_H
+#define ADDQTCREATORARRAYVALUEOPERATION_H
#include "qinstallerglobal.h"
@@ -60,4 +60,4 @@ public:
} // namespace QInstaller
-#endif // ADDQTCREATORVALUEOPERATION_H
+#endif // ADDQTCREATORARRAYVALUEOPERATION_H
diff --git a/src/libs/installer/adminauthorization_win.cpp b/src/libs/installer/adminauthorization_win.cpp
index 20420cef0..151fef953 100644
--- a/src/libs/installer/adminauthorization_win.cpp
+++ b/src/libs/installer/adminauthorization_win.cpp
@@ -91,9 +91,9 @@ bool AdminAuthorization::hasAdminRights()
&adminGroup))
return false;
- BOOL isInAdminGroup = FALSE;
- if (!CheckTokenMembership(0, adminGroup, &isInAdminGroup))
- isInAdminGroup = FALSE;
+ bool isInAdminGroup = false;
+ if (!CheckTokenMembership(0, adminGroup, (int*)&isInAdminGroup))
+ isInAdminGroup = false;
FreeSid(adminGroup);
return isInAdminGroup;
diff --git a/src/libs/installer/adminauthorization_x11.cpp b/src/libs/installer/adminauthorization_x11.cpp
index 71a66cd83..6d5a52357 100644
--- a/src/libs/installer/adminauthorization_x11.cpp
+++ b/src/libs/installer/adminauthorization_x11.cpp
@@ -194,7 +194,7 @@ bool AdminAuthorization::execute(QWidget *parent, const QString &program, const
const QString line = QString::fromLatin1(buf, bytes);
if (re.indexIn(line) != -1) {
const QString password = getPassword(parent);
- if (password == QString()) {
+ if (password.isEmpty()) {
QByteArray pwd = password.toLatin1();
for (int i = 0; i < 3; ++i) {
::write(masterFD, pwd.data(), pwd.length());
diff --git a/src/libs/installer/binaryformat.h b/src/libs/installer/binaryformat.h
index 49be60a06..d255ea8a9 100644
--- a/src/libs/installer/binaryformat.h
+++ b/src/libs/installer/binaryformat.h
@@ -203,7 +203,7 @@ class INSTALLER_EXPORT BinaryContentPrivate : public QSharedData
{
public:
BinaryContentPrivate();
- BinaryContentPrivate(const QString &path);
+ explicit BinaryContentPrivate(const QString &path);
BinaryContentPrivate(const BinaryContentPrivate &other);
~BinaryContentPrivate();
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index f9e809565..78d4eb68b 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -43,9 +43,9 @@
#include "errors.h"
#include "fileutils.h"
#include "fsengineclient.h"
+#include "globals.h"
#include "lib7z_facade.h"
#include "packagemanagercore.h"
-#include "qinstallerglobal.h"
#include "messageboxhandler.h"
#include <kdupdaterupdatesourcesinfo.h>
@@ -182,13 +182,13 @@ void Component::loadDataFromPackage(const Package &package)
}
setLocalTempPath(QInstaller::pathFromUrl(package.sourceInfo().url));
- const QStringList uis = package.data(QLatin1String("UserInterfaces")).toString().split(scCommaRegExp,
- QString::SkipEmptyParts);
+ const QStringList uis = package.data(QLatin1String("UserInterfaces")).toString()
+ .split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
if (!uis.isEmpty())
loadUserInterfaces(QDir(QString::fromLatin1("%1/%2").arg(localTempPath(), name())), uis);
- const QStringList qms = package.data(QLatin1String("Translations")).toString().split(scCommaRegExp,
- QString::SkipEmptyParts);
+ const QStringList qms = package.data(QLatin1String("Translations")).toString()
+ .split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
if (!qms.isEmpty())
loadTranslations(QDir(QString::fromLatin1("%1/%2").arg(localTempPath(), name())), qms);
@@ -308,23 +308,22 @@ void Component::removeComponent(Component *component)
}
/*!
- Returns a list of child components. If \a recursive is set to true, the returned list
- contains not only the direct children, but all ancestors. Note: The returned list does include ALL
- children, non virtual components as well as virtual components.
+ Returns a list of child components. If \a kind is set to DirectChildrenOnly, the returned list contains
+ only the direct children, if set to Descendants it will also include all descendants of the components
+ children. Note: The returned list does include ALL children, non virtual components as well as virtual
+ components.
*/
-QList<Component*> Component::childComponents(bool recursive, RunMode runMode) const
+QList<Component *> Component::childComponents(Kind kind) const
{
- QList<Component*> result;
- if (runMode == UpdaterMode)
- return result;
+ if (d->m_core->isUpdater())
+ return QList<Component*>();
- if (!recursive)
- return d->m_allChildComponents;
+ QList<Component *> result = d->m_allChildComponents;
+ if (kind == DirectChildrenOnly)
+ return result;
- foreach (Component *component, d->m_allChildComponents) {
- result.append(component);
- result += component->childComponents(true, runMode);
- }
+ foreach (Component *component, d->m_allChildComponents)
+ result += component->childComponents(kind);
return result;
}
@@ -977,7 +976,7 @@ bool Component::validatePage()
void Component::setSelected(bool selected)
{
Q_UNUSED(selected)
- qDebug() << Q_FUNC_INFO << QString::fromLatin1("on \"%1\" is deprecated!!!").arg(d->m_componentName);
+ qDebug() << Q_FUNC_INFO << QString::fromLatin1("on '%1' is deprecated.").arg(d->m_componentName);
}
void Component::addDependency(const QString &newDependency)
@@ -996,13 +995,13 @@ void Component::addDependency(const QString &newDependency)
*/
QStringList Component::dependencies() const
{
- return d->m_vars.value(scDependencies).split(scCommaRegExp, QString::SkipEmptyParts);
+ return d->m_vars.value(scDependencies).split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
}
QStringList Component::autoDependencies() const
{
QStringList autoDependencyStringList =
- d->m_vars.value(scAutoDependOn).split(scCommaRegExp, QString::SkipEmptyParts);
+ d->m_vars.value(scAutoDependOn).split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
autoDependencyStringList.removeAll(QLatin1String("script"));
return autoDependencyStringList;
}
diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h
index 1c8712145..343e1a3af 100644
--- a/src/libs/installer/component.h
+++ b/src/libs/installer/component.h
@@ -85,6 +85,12 @@ class INSTALLER_EXPORT Component : public QObject, public QScriptable, public Co
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
public:
+ enum Kind
+ {
+ Descendants = 0x1000, // all descendants of the current component (children, grandchildren, etc.)
+ DirectChildrenOnly = 0x2000 // all child components of the current component
+ };
+
explicit Component(PackageManagerCore *core);
~Component();
@@ -117,7 +123,7 @@ public:
Component *parentComponent() const;
void appendComponent(Component *component);
void removeComponent(Component *component);
- QList<Component*> childComponents(bool recursive, RunMode runMode) const;
+ QList<Component*> childComponents(Component::Kind kind) const;
void loadComponentScript();
diff --git a/src/libs/installer/component_p.cpp b/src/libs/installer/component_p.cpp
index 162b62c54..7af7a43b2 100644
--- a/src/libs/installer/component_p.cpp
+++ b/src/libs/installer/component_p.cpp
@@ -202,8 +202,8 @@ ComponentModelHelper::ComponentModelHelper()
}
/*!
- Returns the number of child components. Depending if virtual components are visible or not the count might
- differ from what one will get if calling Component::childComponents(...).count().
+ Returns the number of child components. Depending if virtual components are visible or not,
+ the count might differ from what one will get if calling Component::childComponents(...).count().
*/
int ComponentModelHelper::childCount() const
{
@@ -213,49 +213,38 @@ int ComponentModelHelper::childCount() const
}
/*!
- Returns the index of this component as seen from it's parent.
+ Returns the component at index position in the list. Index must be a valid position in
+ the list (i.e., index >= 0 && index < childCount()). Otherwise it returns 0.
*/
-int ComponentModelHelper::indexInParent() const
+Component *ComponentModelHelper::childAt(int index) const
{
- int index = 0;
- if (Component *parent = m_componentPrivate->m_parentComponent->parentComponent())
- index = parent->childComponents(false, AllMode).indexOf(m_componentPrivate->m_parentComponent);
- return (index >= 0 ? index : 0);
+ if (index < 0 && index >= childCount())
+ return 0;
+
+ if (m_componentPrivate->m_core->virtualComponentsVisible())
+ return m_componentPrivate->m_allChildComponents.value(index, 0);
+ return m_componentPrivate->m_childComponents.value(index, 0);
}
/*!
- Returns all children and whose children depending if virtual components are visible or not.
+ Returns all descendants of this component depending if virtual components are visible or not.
*/
-QList<Component*> ComponentModelHelper::childs() const
+QList<Component*> ComponentModelHelper::childItems() const
{
QList<Component*> *components = &m_componentPrivate->m_childComponents;
if (m_componentPrivate->m_core->virtualComponentsVisible())
components = &m_componentPrivate->m_allChildComponents;
QList<Component*> result;
- foreach (Component *component, *components) {
+ foreach (Component *const component, *components) {
result.append(component);
- result += component->childs();
+ result += component->childItems();
}
return result;
}
/*!
- Returns the component at index position in the list. Index must be a valid position in
- the list (i.e., index >= 0 && index < childCount()). Otherwise it returns 0.
-*/
-Component *ComponentModelHelper::childAt(int index) const
-{
- if (index >= 0 && index < childCount()) {
- if (m_componentPrivate->m_core->virtualComponentsVisible())
- return m_componentPrivate->m_allChildComponents.value(index, 0);
- return m_componentPrivate->m_childComponents.value(index, 0);
- }
- return 0;
-}
-
-/*!
- Determines if the components installations status can be changed. The default value is true.
+ Determines if the installation status of the component can be changed. The default value is true.
*/
bool ComponentModelHelper::isEnabled() const
{
@@ -263,7 +252,7 @@ bool ComponentModelHelper::isEnabled() const
}
/*!
- Enables oder disables ability to change the components installations status.
+ Enables or disables the ability to change the installation status of the components.
*/
void ComponentModelHelper::setEnabled(bool enabled)
{
@@ -271,7 +260,7 @@ void ComponentModelHelper::setEnabled(bool enabled)
}
/*!
- Returns whether the component is tristate; that is, if it's checkable with three separate states.
+ Returns whether the component is tri-state; that is, if it's checkable with three separate states.
The default value is false.
*/
bool ComponentModelHelper::isTristate() const
@@ -280,10 +269,10 @@ bool ComponentModelHelper::isTristate() const
}
/*!
- Sets whether the component is tristate. If tristate is true, the component is checkable with three
+ Sets whether the component is tri-state. If tri-state is true, the component is checkable with three
separate states; otherwise, the component is checkable with two states.
- (Note that this also requires that the component is checkable; see isCheckable().)
+ Note: this also requires that the component is checkable. \sa isCheckable()
*/
void ComponentModelHelper::setTristate(bool tristate)
{
diff --git a/src/libs/installer/component_p.h b/src/libs/installer/component_p.h
index 241888a3f..9101021ae 100644
--- a/src/libs/installer/component_p.h
+++ b/src/libs/installer/component_p.h
@@ -125,10 +125,8 @@ public:
explicit ComponentModelHelper();
int childCount() const;
- int indexInParent() const;
-
- QList<Component*> childs() const;
Component* childAt(int index) const;
+ QList<Component*> childItems() const;
bool isEnabled() const;
void setEnabled(bool enabled);
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp
index a87f59c00..f65611ffe 100644
--- a/src/libs/installer/componentmodel.cpp
+++ b/src/libs/installer/componentmodel.cpp
@@ -47,17 +47,18 @@
namespace QInstaller {
/*!
- \fn void defaultCheckStateChanged(bool changed)
+ \fn void checkStateChanged(const QModelIndex &index)
- This signal is emitted whenever the default check state of a model is changed. The \a changed value
- indicates whether the model has it's initial checked state or some components changed it's checked state.
+ This signal is emitted whenever the check state of a component is changed. The \a index value indicates
+ the QModelIndex representation of the component as seen from the model.
*/
/*!
- \fn void checkStateChanged(const QModelIndex &index)
+ \fn void checkStateChanged(QInstaller::ComponentModel::ModelState state)
- This signal is emitted whenever the default check state of a component is changed. The \a index value
- indicates the QModelIndex representation of the component as seen from the model.
+ This signal is emitted whenever the check state of a model is changed after all check state
+ calculations have taken place. The \a state value indicates whether the model has its default checked
+ state, all components are checked/ unchecked or some individual components checked state has changed.
*/
@@ -67,12 +68,10 @@ namespace QInstaller {
ComponentModel::ComponentModel(int columns, PackageManagerCore *core)
: QAbstractItemModel(core)
, m_core(core)
- , m_rootIndex(0)
+ , m_modelState(DefaultChecked)
{
m_headerData.insert(0, columns, QVariant());
-
connect(this, SIGNAL(modelReset()), this, SLOT(slotModelReset()));
- connect(this, SIGNAL(checkStateChanged(QModelIndex)), this, SLOT(slotCheckStateChanged(QModelIndex)));
}
/*!
@@ -83,8 +82,25 @@ ComponentModel::~ComponentModel()
}
/*!
- Returns the number of items under the given \a parent. When the parent is valid it means that rowCount is
- returning the number of items of parent.
+ Returns the item flags for the given \a index.
+
+ The class implementation returns a combination of flags that enables the item (Qt::ItemIsEnabled), allows
+ it to be selected (Qt::ItemIsSelectable) and to be checked (Qt::ItemIsUserCheckable).
+*/
+Qt::ItemFlags ComponentModel::flags(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return Qt::NoItemFlags;
+
+ if (Component *component = componentFromIndex(index))
+ return component->flags();
+
+ return Qt::ItemFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+}
+
+/*!
+ Returns the number of items under the given \a parent. When the parent is valid it means that rowCount
+ is returning the number of items of parent.
*/
int ComponentModel::rowCount(const QModelIndex &parent) const
{
@@ -160,9 +176,9 @@ QVariant ComponentModel::data(const QModelIndex &index, int role) const
}
/*!
- Sets the \a role data for the item at \a index to \a value. Returns true if successful; otherwise returns
- false. The dataChanged() signal is emitted if the data was successfully set. The checkStateChanged() and
- defaultCheckStateChanged() signal are emitted in addition if the check state of the item is set.
+ Sets the \a role data for the item at \a index to \a value. Returns true if successful;
+ otherwise returns false. The dataChanged() signal is emitted if the data was successfully set.
+ The checkStateChanged() signals are emitted in addition if the check state of the item is set.
*/
bool ComponentModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
@@ -173,14 +189,17 @@ bool ComponentModel::setData(const QModelIndex &index, const QVariant &value, in
if (!component)
return false;
- component->setData(value, role);
-
- emit dataChanged(index, index);
if (role == Qt::CheckStateRole) {
- emit checkStateChanged(index);
- foreach (Component* comp, m_rootComponentList) {
- comp->updateUncompressedSize();
+ ComponentSet nodes = component->childItems().toSet();
+ QSet<QModelIndex> changed = updateCheckedState(nodes << component, Qt::CheckState(value.toInt()));
+ foreach (const QModelIndex &index, changed) {
+ emit dataChanged(index, index);
+ emit checkStateChanged(index);
}
+ updateAndEmitModelState(); // update the internal state
+ } else {
+ component->setData(value, role);
+ emit dataChanged(index, index);
}
return true;
@@ -217,72 +236,69 @@ bool ComponentModel::setHeaderData(int section, Qt::Orientation orientation, con
}
/*!
- Returns the item flags for the given \a index.
-
- The class implementation returns a combination of flags that enables the item (Qt::ItemIsEnabled), allows
- it to be selected (Qt::ItemIsSelectable) and to be checked (Qt::ItemIsUserCheckable).
+ Returns a list of checked components.
*/
-Qt::ItemFlags ComponentModel::flags(const QModelIndex &index) const
+QSet<Component *> ComponentModel::checked() const
{
- if (!index.isValid())
- return Qt::NoItemFlags;
-
- if (Component *component = componentFromIndex(index))
- return component->flags();
+ return m_currentCheckedState[Qt::Checked];
+}
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
+/*!
+ Returns a list of partially checked components.
+*/
+QSet<Component *> ComponentModel::partially() const
+{
+ return m_currentCheckedState[Qt::PartiallyChecked];
}
/*!
- Returns a pointer to the PackageManagerCore this model belongs to.
+ Returns a list of unchecked components.
*/
-PackageManagerCore *ComponentModel::packageManagerCore() const
+QSet<Component *> ComponentModel::unchecked() const
{
- return m_core;
+ return m_currentCheckedState[Qt::Unchecked];
}
/*!
- Returns true if no changes to the components checked state have been done, otherwise returns false.
+ Returns a list of components whose check state can't be changed. If package manager core is run with no
+ forced installation argument, the list will always be empty.
*/
-bool ComponentModel::defaultCheckState() const
+QSet<Component *> ComponentModel::uncheckable() const
{
- return m_initialCheckedSet == m_currentCheckedSet;
+ return m_uncheckable;
}
/*!
- Returns true if this model has checked components, otherwise returns false.
+ Returns a pointer to the PackageManagerCore this model belongs to.
*/
-bool ComponentModel::hasCheckedComponents() const
+PackageManagerCore *ComponentModel::core() const
{
- return !m_currentCheckedSet.isEmpty();
+ return m_core;
}
/*!
- Returns a list of checked components.
+ Returns the current state check state of the model.
*/
-QList<Component*> ComponentModel::checkedComponents() const
+ComponentModel::ModelState ComponentModel::checkedState() const
{
- QList<Component*> list;
- foreach (const QString &name, m_currentCheckedSet)
- list.append(componentFromIndex(indexFromComponentName(name)));
- return list;
+ return m_modelState;
}
/*!
- Translates between a given component \a name and it's associated QModelIndex. Returns the QModelIndex that
- represents the component or an invalid QModelIndex if the component does not exist in the model.
+ Translates between a given component \a name and its associated QModelIndex. Returns the QModelIndex
+ that represents the component or an invalid QModelIndex if the component does not exist in the model.
*/
QModelIndex ComponentModel::indexFromComponentName(const QString &name) const
{
if (m_indexByNameCache.isEmpty()) {
for (int i = 0; i < m_rootComponentList.count(); ++i)
- updateCache(index(i, 0, QModelIndex()));
+ collectComponents(m_rootComponentList.at(i), index(i, 0, QModelIndex()));
}
return m_indexByNameCache.value(name, QModelIndex());
}
/*!
- Translates between a given QModelIndex \a index and it's associated Component. Returns the Component if
+ Translates between a given QModelIndex \a index and its associated Component. Returns the component if
the index is valid or 0 if an invalid QModelIndex is given.
*/
Component *ComponentModel::componentFromIndex(const QModelIndex &index) const
@@ -292,242 +308,218 @@ Component *ComponentModel::componentFromIndex(const QModelIndex &index) const
return 0;
}
-// -- public slots
-
-/*!
- Invoking this slot results in an checked state for every component the has a visual representation in the
- model. Note that components are not changed if they are not checkable. The checkStateChanged() and
- defaultCheckStateChanged() signal are emitted.
-*/
-void ComponentModel::selectAll()
-{
- m_currentCheckedSet = m_currentCheckedSet.unite(select(Qt::Checked));
- emit defaultCheckStateChanged(m_initialCheckedSet != m_currentCheckedSet);
-}
-/*!
- Invoking this slot results in an unchecked state for every component the has a visual representation in
- the model. Note that components are not changed if they are not checkable. The checkStateChanged() and
- defaultCheckStateChanged() signal are emitted.
-*/
-void ComponentModel::deselectAll()
-{
- m_currentCheckedSet = m_currentCheckedSet.subtract(select(Qt::Unchecked));
- emit defaultCheckStateChanged(m_initialCheckedSet != m_currentCheckedSet);
-}
+// -- public slots
/*!
- Invoking this slot results in an checked state for every component the has a visual representation in the
- model when the model was setup during setRootComponents() or appendRootComponents(). Note that components
- are not changed it they are not checkable. The checkStateChanged() and defaultCheckStateChanged() signal
- are emitted.
-*/
-void ComponentModel::selectDefault()
-{
- m_currentCheckedSet = m_currentCheckedSet.subtract(select(Qt::Unchecked));
- foreach (const QString &name, m_initialCheckedSet)
- setData(indexFromComponentName(name), Qt::Checked, Qt::CheckStateRole);
- emit defaultCheckStateChanged(m_initialCheckedSet != m_currentCheckedSet);
-}
+ Sets the passed \a rootComponents to be the list of currently shown components.
-/*!
- Set's the passed \a rootComponents to be list of currently shown components. The model is repopulated and
- the individual component checked state is used to show the check mark in front of the visual component
- representation. The modelAboutToBeReset() and modelReset() signals are emitted.
+ The model is repopulated and the individual component checked state is used to show the check mark in
+ front of the visual component representation. The modelAboutToBeReset() and modelReset() signals are
+ emitted.
*/
void ComponentModel::setRootComponents(QList<QInstaller::Component*> rootComponents)
{
beginResetModel();
+ m_uncheckable.clear();
m_indexByNameCache.clear();
- m_rootComponentList.clear();
- m_initialCheckedSet.clear();
- m_currentCheckedSet.clear();
-
- m_rootIndex = 0;
- m_rootComponentList = rootComponents;
-
+ m_initialCheckedState.clear();
+ m_currentCheckedState.clear();
+ m_modelState = DefaultChecked;
+
+ // show virtual components only in case we run as updater or if the core engine is set to show them
+ const bool showVirtuals = m_core->isUpdater() || m_core->virtualComponentsVisible();
+ foreach (Component *const component, rootComponents) {
+ if ((!showVirtuals) && component->isVirtual())
+ continue;
+ m_rootComponentList.append(component);
+ }
endResetModel();
}
/*!
- Appends the passed \a rootComponents to the currently shown list of components. The model is repopulated
- and the individual component checked state is used to show the check mark in front of the visual component
- representation. Already changed check states on the previous model are preserved. The modelAboutToBeReset()
- and modelReset() signals are emitted.
+ Sets the check state of every component in the model to be \a state.
+
+ The ComponentModel::PartiallyChecked flag is ignored by this function. Note that components are not
+ changed if they are not checkable. The dataChanged() and checkStateChanged() signals are emitted.
*/
-void ComponentModel::appendRootComponents(QList<QInstaller::Component*> rootComponents)
+void ComponentModel::setCheckedState(QInstaller::ComponentModel::ModelStateFlag state)
{
- beginResetModel();
-
- m_indexByNameCache.clear();
+ QSet<QModelIndex> changed;
+ switch (state) {
+ case AllChecked:
+ changed = updateCheckedState(m_currentCheckedState[Qt::Unchecked], Qt::Checked);
+ break;
+ case AllUnchecked:
+ changed = updateCheckedState(m_currentCheckedState[Qt::Checked], Qt::Unchecked);
+ break;
+ case DefaultChecked:
+ // record all changes, to be able to update the UI properly
+ changed = updateCheckedState(m_currentCheckedState[Qt::Checked], Qt::Unchecked);
+ changed += updateCheckedState(m_initialCheckedState[Qt::Checked], Qt::Checked);
+ break;
+ default:
+ break;
+ }
- m_rootIndex = m_rootComponentList.count() - 1;
- m_rootComponentList += rootComponents;
+ if (changed.isEmpty())
+ return;
- endResetModel();
+ // notify about changes done to the model
+ foreach (const QModelIndex &index, changed) {
+ emit dataChanged(index, index);
+ emit checkStateChanged(index);
+ }
+ updateAndEmitModelState(); // update the internal state
}
+
// -- private slots
void ComponentModel::slotModelReset()
{
- QList<QInstaller::Component*> components = m_rootComponentList;
- if (m_core->runMode() == QInstaller::AllMode) {
- for (int i = m_rootIndex; i < m_rootComponentList.count(); ++i)
- components.append(m_rootComponentList.at(i)->childs());
+ ComponentList components = m_rootComponentList;
+ if (!m_core->isUpdater()) {
+ foreach (Component *const component, m_rootComponentList)
+ components += component->childItems();
+ }
+
+ ComponentSet checked;
+ foreach (Component *const component, components) {
+ if (component->checkState() == Qt::Checked)
+ checked.insert(component);
}
- foreach (Component *child, components) {
- if (child->checkState() == Qt::Checked && !child->isTristate())
- m_initialCheckedSet.insert(child->name());
+ updateCheckedState(checked, Qt::Checked);
+ foreach (Component *const component, components) {
+ if (!component->isCheckable())
+ m_uncheckable.insert(component);
+ m_initialCheckedState[component->checkState()].insert(component);
+ }
+
+ m_currentCheckedState = m_initialCheckedState;
+ updateAndEmitModelState(); // update the internal state
+}
+
+
+// -- private
+
+void ComponentModel::updateAndEmitModelState()
+{
+ m_modelState = ComponentModel::DefaultChecked;
+ if (m_initialCheckedState != m_currentCheckedState)
+ m_modelState = ComponentModel::PartiallyChecked;
+
+ if (checked().count() == 0 && partially().count() == 0) {
+ m_modelState |= ComponentModel::AllUnchecked;
+ m_modelState &= ~ComponentModel::PartiallyChecked;
}
- m_currentCheckedSet += m_initialCheckedSet;
- if (m_core->runMode() == QInstaller::AllMode)
- select(Qt::Unchecked);
+ if (unchecked().count() == 0 && partially().count() == 0) {
+ m_modelState |= ComponentModel::AllChecked;
+ m_modelState &= ~ComponentModel::PartiallyChecked;
+ }
- foreach (const QString &name, m_currentCheckedSet)
- setData(indexFromComponentName(name), Qt::Checked, Qt::CheckStateRole);
+ emit checkStateChanged(m_modelState);
+}
+void ComponentModel::collectComponents(Component *const component, const QModelIndex &parent) const
+{
+ m_indexByNameCache.insert(component->name(), parent);
+ for (int i = 0; i < component->childCount(); ++i)
+ collectComponents(component->childAt(i), index(i, 0, parent));
}
+namespace ComponentModelPrivate {
+
+struct NameGreaterThan
+{
+ bool operator() (const Component *lhs, const Component *rhs) const
+ {
+ return lhs->name() > rhs->name();
+ }
+};
+
static Qt::CheckState verifyPartiallyChecked(Component *component)
{
int checked = 0;
int unchecked = 0;
- int virtualChilds = 0;
const int count = component->childCount();
for (int i = 0; i < count; ++i) {
- Component *const child = component->childAt(i);
- if (!child->isVirtual()) {
- switch (component->childAt(i)->checkState()) {
- case Qt::Checked: {
- ++checked;
- } break;
- case Qt::Unchecked: {
- ++unchecked;
- } break;
- default:
- break;
- }
- } else {
- ++virtualChilds;
+ switch (component->childAt(i)->checkState()) {
+ case Qt::Checked: {
+ ++checked;
+ } break;
+ case Qt::Unchecked: {
+ ++unchecked;
+ } break;
+ default:
+ break;
}
}
- if ((checked + virtualChilds) == count)
+ if (checked == count)
return Qt::Checked;
- if ((unchecked + virtualChilds) == count)
+ if (unchecked == count)
return Qt::Unchecked;
return Qt::PartiallyChecked;
}
-void ComponentModel::slotCheckStateChanged(const QModelIndex &index)
-{
- Component *component = componentFromIndex(index);
- if (!component)
- return;
-
- if (component->checkState() == Qt::Checked && !component->isTristate())
- m_currentCheckedSet.insert(component->name());
- else if (component->checkState() == Qt::Unchecked && !component->isTristate())
- m_currentCheckedSet.remove(component->name());
- emit defaultCheckStateChanged(m_initialCheckedSet != m_currentCheckedSet);
-
- if (component->isVirtual())
- return;
-
- const Qt::CheckState state = component->checkState();
- if (component->isTristate()) {
- if (state == Qt::PartiallyChecked) {
- component->setCheckState(verifyPartiallyChecked(component));
- return;
- }
-
- QModelIndexList notCheckable;
- foreach (Component *child, component->childs()) {
- const QModelIndex &idx = indexFromComponentName(child->name());
- if (child->isCheckable()) {
- if (child->checkState() != state && !child->isVirtual())
- setData(idx, state, Qt::CheckStateRole);
- } else {
- notCheckable.append(idx);
- }
- }
-
- if (state == Qt::Unchecked && !notCheckable.isEmpty()) {
- foreach (const QModelIndex &idx, notCheckable)
- setData(idx, idx.data(Qt::CheckStateRole), Qt::CheckStateRole);
- }
- } else {
- QList<Component*> parents;
- while (0 != component->parentComponent()) {
- parents.append(component->parentComponent());
- component = parents.last();
- }
-
- foreach (Component *parent, parents) {
- if (parent->isCheckable()) {
- const QModelIndex &idx = indexFromComponentName(parent->name());
- if (parent->checkState() == Qt::PartiallyChecked) {
- setData(idx, verifyPartiallyChecked(parent), Qt::CheckStateRole);
- } else {
- setData(idx, Qt::PartiallyChecked, Qt::CheckStateRole);
- }
- }
- }
- }
-}
-
-// -- private
+} // namespace ComponentModelPrivate
-QSet<QString> ComponentModel::select(Qt::CheckState state)
+QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &components, Qt::CheckState state)
{
- QSet<QString> changed;
- for (int i = 0; i < m_rootComponentList.count(); ++i) {
- QSet<QString> tmp;
- QList<Component*> children = m_rootComponentList.at(i)->childs();
- children.prepend(m_rootComponentList.at(i)); // we need to take the root item into account as well
- foreach (Component *child, children) {
- if (child->isCheckable() && !child->isTristate() && child->checkState() != state) {
- tmp.insert(child->name());
- child->setCheckState(state);
+ // get all parent nodes for the components we're going to update
+ ComponentSet nodes = components;
+ foreach (Component *const component, components) {
+ if (Component *parent = component->parentComponent()) {
+ nodes.insert(parent);
+ while (parent->parentComponent() != 0) {
+ parent = parent->parentComponent();
+ nodes.insert(parent);
}
}
- if (!tmp.isEmpty()) {
- changed += tmp;
- setData(index(i, 0, QModelIndex()), state, Qt::CheckStateRole);
- }
}
- return changed;
-}
-void ComponentModel::updateCache(const QModelIndex &parent) const
-{
- const QModelIndexList &list = collectComponents(parent);
- foreach (const QModelIndex &index, list) {
- if (Component *component = componentFromIndex(index))
- m_indexByNameCache.insert(component->name(), index);
- }
- m_indexByNameCache.insert((static_cast<Component*> (parent.internalPointer()))->name(), parent);
-}
-
-QModelIndexList ComponentModel::collectComponents(const QModelIndex &parent) const
-{
- QModelIndexList list;
- for (int i = 0; i < rowCount(parent) ; ++i) {
- const QModelIndex &next = index(i, 0, parent);
- if (Component *component = componentFromIndex(next)) {
- if (component->childCount() > 0)
- list += collectComponents(next);
+ QSet<QModelIndex> changed;
+ // sort the nodes, so we can start in descending order to check node and tri-state nodes properly
+ ComponentList sortedNodes = nodes.toList();
+ std::sort(sortedNodes.begin(), sortedNodes.end(), ComponentModelPrivate::NameGreaterThan());
+ foreach (Component *const node, sortedNodes) {
+ if (!node->isCheckable())
+ continue;
+
+ Qt::CheckState newState = state;
+ const Qt::CheckState recentState = node->checkState();
+ if (node->isTristate())
+ newState = ComponentModelPrivate::verifyPartiallyChecked(node);
+ if (recentState == newState)
+ continue;
+
+ node->setCheckState(newState);
+ changed.insert(indexFromComponentName(node->name()));
+
+ m_currentCheckedState[Qt::Checked].remove(node);
+ m_currentCheckedState[Qt::Unchecked].remove(node);
+ m_currentCheckedState[Qt::PartiallyChecked].remove(node);
+
+ switch (newState) {
+ case Qt::Checked:
+ m_currentCheckedState[Qt::Checked].insert(node);
+ break;
+ case Qt::Unchecked:
+ m_currentCheckedState[Qt::Unchecked].insert(node);
+ break;
+ case Qt::PartiallyChecked:
+ m_currentCheckedState[Qt::PartiallyChecked].insert(node);
+ break;
}
- list.append(next);
}
- return list;
+ return changed;
}
} // namespace QInstaller
diff --git a/src/libs/installer/componentmodel.h b/src/libs/installer/componentmodel.h
index b43bfc75a..a691906a4 100644
--- a/src/libs/installer/componentmodel.h
+++ b/src/libs/installer/componentmodel.h
@@ -57,11 +57,23 @@ class PackageManagerCore;
class INSTALLER_EXPORT ComponentModel : public QAbstractItemModel
{
Q_OBJECT
+ typedef QSet<Component *> ComponentSet;
+ typedef QList<Component *> ComponentList;
public:
+ enum ModelStateFlag {
+ AllChecked = 0x01,
+ AllUnchecked = 0x02,
+ DefaultChecked = 0x04,
+ PartiallyChecked = 0x08
+ };
+ Q_DECLARE_FLAGS(ModelState, ModelStateFlag);
+
explicit ComponentModel(int columns, PackageManagerCore *core = 0);
~ComponentModel();
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -75,49 +87,50 @@ public:
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value,
int role = Qt::EditRole);
- Qt::ItemFlags flags(const QModelIndex &index) const;
- PackageManagerCore *packageManagerCore() const;
+ QSet<Component *> checked() const;
+ QSet<Component *> partially() const;
+ QSet<Component *> unchecked() const;
+ QSet<Component *> uncheckable() const;
- bool defaultCheckState() const;
- bool hasCheckedComponents() const;
- QList<Component*> checkedComponents() const;
+ PackageManagerCore *core() const;
+ ComponentModel::ModelState checkedState() const;
QModelIndex indexFromComponentName(const QString &name) const;
Component* componentFromIndex(const QModelIndex &index) const;
public Q_SLOTS:
- void selectAll();
- void deselectAll();
- void selectDefault();
-
void setRootComponents(QList<QInstaller::Component*> rootComponents);
- void appendRootComponents(QList<QInstaller::Component*> rootComponents);
+ void setCheckedState(QInstaller::ComponentModel::ModelStateFlag state);
Q_SIGNALS:
- void defaultCheckStateChanged(bool changed);
void checkStateChanged(const QModelIndex &index);
+ void checkStateChanged(QInstaller::ComponentModel::ModelState state);
private Q_SLOTS:
void slotModelReset();
- void slotCheckStateChanged(const QModelIndex &index);
private:
- QSet<QString> select(Qt::CheckState state);
- void updateCache(const QModelIndex &parent) const;
- QModelIndexList collectComponents(const QModelIndex &parent) const;
+ void updateAndEmitModelState();
+ void collectComponents(Component *const component, const QModelIndex &parent) const;
+ QSet<QModelIndex> updateCheckedState(const ComponentSet &components, Qt::CheckState state);
private:
PackageManagerCore *m_core;
- int m_rootIndex;
+ ModelState m_modelState;
+ ComponentSet m_uncheckable;
QVector<QVariant> m_headerData;
- QSet<QString> m_initialCheckedSet;
- QSet<QString> m_currentCheckedSet;
- QList<Component*> m_rootComponentList;
+ ComponentList m_rootComponentList;
+ QHash<Qt::CheckState, ComponentSet> m_initialCheckedState;
+ QHash<Qt::CheckState, ComponentSet> m_currentCheckedState;
mutable QHash<QString, QPersistentModelIndex> m_indexByNameCache;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(ComponentModel::ModelState);
} // namespace QInstaller
+Q_DECLARE_METATYPE(QInstaller::ComponentModel::ModelState);
+Q_DECLARE_METATYPE(QInstaller::ComponentModel::ModelStateFlag);
+
#endif // COMPONENTMODEL_H
diff --git a/src/libs/installer/constants.h b/src/libs/installer/constants.h
index 3929681a7..7ea73bbb9 100644
--- a/src/libs/installer/constants.h
+++ b/src/libs/installer/constants.h
@@ -80,6 +80,7 @@ static const QLatin1String scSortingPriority("SortingPriority");
static const QLatin1String scTitle("Title");
static const QLatin1String scPublisher("Publisher");
static const QLatin1String scRunProgram("RunProgram");
+static const QLatin1String scRunProgramArguments("RunProgramArguments");
static const QLatin1String scStartMenuDir("StartMenuDir");
static const QLatin1String scRemoveTargetDir("RemoveTargetDir");
static const QLatin1String scRunProgramDescription("RunProgramDescription");
diff --git a/src/libs/installer/createshortcutoperation.cpp b/src/libs/installer/createshortcutoperation.cpp
index 62f7cfa82..2f2696fcd 100644
--- a/src/libs/installer/createshortcutoperation.cpp
+++ b/src/libs/installer/createshortcutoperation.cpp
@@ -107,8 +107,9 @@ static QString takeWorkingDirArgument(QStringList &args)
static bool createLink(const QString &fileName, const QString &linkName, QString workingDir,
QString arguments = QString())
{
- bool success = QFile::link(fileName, linkName);
#ifdef Q_OS_WIN
+ bool success = QFile::link(fileName, linkName);
+
if (!success)
return success;
@@ -131,7 +132,7 @@ static bool createLink(const QString &fileName, const QString &linkName, QString
IPersistFile *ppf = NULL;
if (SUCCEEDED(psl->QueryInterface(IID_IPersistFile, (void **)&ppf))) {
- ppf->Save((wchar_t*)QDir::toNativeSeparators(linkName).utf16(), TRUE);
+ ppf->Save((wchar_t*)QDir::toNativeSeparators(linkName).utf16(), true);
ppf->Release();
}
psl->Release();
@@ -145,11 +146,16 @@ static bool createLink(const QString &fileName, const QString &linkName, QString
SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_IDLIST, pidl, 0);
CoTaskMemFree(pidl);
}
+
+ return success;
#else
Q_UNUSED(arguments)
Q_UNUSED(workingDir)
+ Q_UNUSED(fileName)
+ Q_UNUSED(linkName)
+
+ return true;
#endif
- return success;
}
diff --git a/src/libs/installer/errors.h b/src/libs/installer/errors.h
index 7f5cc9071..18b8ead8f 100644
--- a/src/libs/installer/errors.h
+++ b/src/libs/installer/errors.h
@@ -54,7 +54,10 @@ class Error : public std::runtime_error
public:
explicit Error(const QString &message)
: std::runtime_error(message.toStdString())
- , m_message (message) { qDebug() << "create Error-Exception:" << message; }
+ , m_message (message)
+ {
+ qDebug() << "create Error-Exception:" << message;
+ }
virtual ~Error() throw() {}
QString message() const { return m_message; }
diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp
index ab7ad6df4..87d46282d 100644
--- a/src/libs/installer/fileutils.cpp
+++ b/src/libs/installer/fileutils.cpp
@@ -455,7 +455,7 @@ QString QInstaller::createTemporaryDirectory(const QString &templ)
if (!f.open())
throw Error(QObject::tr("Could not create temporary folder for template %1: %2").arg(t, f.errorString()));
const QString path = f.fileName() + QLatin1String("meta");
- qDebug() << "Creating meta data directory at" << path;
+ qDebug() << "\nCreating meta data directory at" << path;
QInstaller::mkpath(path);
return path;
diff --git a/src/libs/installer/fsengineclient.cpp b/src/libs/installer/fsengineclient.cpp
index c9aff560f..7822ed65b 100644
--- a/src/libs/installer/fsengineclient.cpp
+++ b/src/libs/installer/fsengineclient.cpp
@@ -753,7 +753,7 @@ void FSEngineClientHandler::setActive(bool active)
}
/*!
- Returns, wheter this FSEngineClientHandler is active or not.
+ Returns true when this FSEngineClientHandler is active.
*/
bool FSEngineClientHandler::isActive() const
{
diff --git a/src/libs/installer/fsengineserver.cpp b/src/libs/installer/fsengineserver.cpp
index 991681b95..76992c241 100644
--- a/src/libs/installer/fsengineserver.cpp
+++ b/src/libs/installer/fsengineserver.cpp
@@ -75,7 +75,7 @@ bool startDetached(const QString &program, const QStringList &args, const QStrin
const QString arguments = QInstaller::createCommandline(program, args);
const bool success = CreateProcess(0, (wchar_t*)arguments.utf16(),
- 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE,
+ 0, 0, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE,
0, (wchar_t*)workingDirectory.utf16(),
&startupInfo, &pinfo);
diff --git a/src/libs/installer/getrepositoriesmetainfojob.cpp b/src/libs/installer/getrepositoriesmetainfojob.cpp
index 996bf4692..7604bcf06 100644
--- a/src/libs/installer/getrepositoriesmetainfojob.cpp
+++ b/src/libs/installer/getrepositoriesmetainfojob.cpp
@@ -43,7 +43,6 @@
#include "getrepositorymetainfojob.h"
#include "packagemanagercore_p.h"
-#include "qinstallerglobal.h"
#include <QtCore/QDebug>
diff --git a/src/libs/installer/getrepositorymetainfojob.cpp b/src/libs/installer/getrepositorymetainfojob.cpp
index 6fa21e32c..34441b02b 100644
--- a/src/libs/installer/getrepositorymetainfojob.cpp
+++ b/src/libs/installer/getrepositorymetainfojob.cpp
@@ -44,22 +44,13 @@
#include "lib7z_facade.h"
#include "messageboxhandler.h"
#include "packagemanagercore_p.h"
-#include "qinstallerglobal.h"
#include "utils.h"
#include "kdupdaterfiledownloader.h"
#include "kdupdaterfiledownloaderfactory.h"
-#include <QtCore/QFile>
-#include <QtCore/QTimer>
-#include <QtCore/QUrl>
+#include <QTimer>
-#include <QMessageBox>
-
-#include <QtNetwork/QAuthenticator>
-
-#include <QtXml/QDomDocument>
-#include <QtXml/QDomElement>
using namespace KDUpdater;
using namespace QInstaller;
diff --git a/examples/testapp/updateagent.h b/src/libs/installer/globals.cpp
index 7e634a302..f0910372d 100644
--- a/examples/testapp/updateagent.h
+++ b/src/libs/installer/globals.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Installer Framework.
@@ -38,28 +38,10 @@
** $QT_END_LICENSE$
**
**************************************************************************/
+#include "globals.h"
-#ifndef UPDATEAGENT_H
-#define UPDATEAGENT_H
-
-#include <QtCore/QObject>
-
-class UpdateAgent : public QObject
+Q_GLOBAL_STATIC_WITH_ARGS(QRegExp, staticCommaRegExp, (QLatin1String("\\b(,|, )\\b")));
+QRegExp QInstaller::commaRegExp()
{
- Q_OBJECT
-public:
- explicit UpdateAgent(QObject *parent = 0);
- ~UpdateAgent();
-
-Q_SIGNALS:
- void updatesAvailable();
-
-private:
- Q_PRIVATE_SLOT(d, void maybeCheck());
-
-private:
- class Private;
- Private *const d;
-};
-
-#endif
+ return *staticCommaRegExp();
+}
diff --git a/examples/testapp/main.cpp b/src/libs/installer/globals.h
index b1b039822..858c856d5 100644
--- a/examples/testapp/main.cpp
+++ b/src/libs/installer/globals.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Installer Framework.
@@ -38,24 +38,17 @@
** $QT_END_LICENSE$
**
**************************************************************************/
+#ifndef GLOBALS_H
+#define GLOBALS_H
-#include "mainwindow.h"
+#include "installer_global.h"
-#include <init.h>
+#include <QRegExp>
-#include <kdselfrestarter.h>
+namespace QInstaller {
-#include <QApplication>
+QRegExp INSTALLER_EXPORT commaRegExp();
+} // QInstaller
-int main(int argc, char *argv[])
-{
- QInstaller::init();
- const KDSelfRestarter restarter(argc, argv);
-
- QApplication app(argc, argv);
- MainWindow mw(app.arguments());
- mw.show();
-
- return app.exec();
-}
+#endif // GLOBALS_H
diff --git a/src/libs/installer/init.cpp b/src/libs/installer/init.cpp
index 40c396ab4..912069c58 100644
--- a/src/libs/installer/init.cpp
+++ b/src/libs/installer/init.cpp
@@ -67,7 +67,7 @@
#include "setpluginpathonqtcoreoperation.h"
#include "setimportspathonqtcoreoperation.h"
#include "setpathonqtcoreoperation.h"
-#include "registerqtvqnxoperation.h"
+#include "registerqtincreatorqnxoperation.h"
#include "setqtcreatorvalueoperation.h"
#include "addqtcreatorarrayvalueoperation.h"
#include "registertoolchainoperation.h"
@@ -229,8 +229,8 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
void QInstaller::init()
{
-#if defined(QT_STATIC)
::initArchives();
+#if defined(QT_STATIC)
::initResources();
#endif
diff --git a/src/libs/installer/installer.pro b/src/libs/installer/installer.pro
index 3308876fb..79500b2d5 100644
--- a/src/libs/installer/installer.pro
+++ b/src/libs/installer/installer.pro
@@ -58,7 +58,6 @@ HEADERS += packagemanagercore.h \
replaceoperation.h \
linereplaceoperation.h \
registertoolchainoperation.h \
- registerqtvqnxoperation.h \
setqtcreatorvalueoperation.h \
addqtcreatorarrayvalueoperation.h \
copydirectoryoperation.h \
@@ -104,7 +103,9 @@ HEADERS += packagemanagercore.h \
link.h \
createlinkoperation.h \
packagemanagercoredata.h \
- applyproductkeyoperation.h
+ registerqtincreatorqnxoperation.h \
+ applyproductkeyoperation.h \
+ globals.h
SOURCES += packagemanagercore.cpp \
packagemanagercore_p.cpp \
@@ -129,7 +130,6 @@ HEADERS += packagemanagercore.h \
replaceoperation.cpp \
linereplaceoperation.cpp \
registertoolchainoperation.cpp \
- registerqtvqnxoperation.cpp \
setqtcreatorvalueoperation.cpp \
addqtcreatorarrayvalueoperation.cpp \
copydirectoryoperation.cpp \
@@ -173,7 +173,9 @@ HEADERS += packagemanagercore.h \
link.cpp \
createlinkoperation.cpp \
packagemanagercoredata.cpp \
- applyproductkeyoperation.cpp
+ registerqtincreatorqnxoperation.cpp \
+ applyproductkeyoperation.cpp \
+ globals.cpp
RESOURCES += resources/patch_file_lists.qrc \
resources/installer.qrc
diff --git a/src/libs/installer/lib7z_facade.cpp b/src/libs/installer/lib7z_facade.cpp
index 0c02890e2..fbec5e644 100644
--- a/src/libs/installer/lib7z_facade.cpp
+++ b/src/libs/installer/lib7z_facade.cpp
@@ -17,12 +17,12 @@
#include "Windows/PropVariant.h"
#include "Windows/PropVariantConversions.h"
-#include <QtCore/QDir>
-#include <QtCore/QFileInfo>
-#include <QtCore/QIODevice>
+#include <QDir>
+#include <QFileInfo>
+#include <QIODevice>
#include <QtCore/QMutexLocker>
-#include <QtCore/QPointer>
-#include <QtCore/QTemporaryFile>
+#include <QPointer>
+#include <QTemporaryFile>
#ifdef _MSC_VER
#pragma warning(disable:4297)
diff --git a/src/libs/installer/lib7z_facade.h b/src/libs/installer/lib7z_facade.h
index e61cce6ac..88185375e 100644
--- a/src/libs/installer/lib7z_facade.h
+++ b/src/libs/installer/lib7z_facade.h
@@ -3,14 +3,14 @@
#include "installer_global.h"
+#include <QCoreApplication>
#include <QDateTime>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QFile>
-#include <QtCore/QPoint>
-#include <QtCore/QRunnable>
-#include <QtCore/QString>
-#include <QtCore/QVector>
-#include <QtCore/QVariant>
+#include <QFile>
+#include <QPoint>
+#include <QRunnable>
+#include <QString>
+#include <QVariant>
+#include <QVector>
#include "Common/MyWindows.h"
diff --git a/src/libs/installer/link.h b/src/libs/installer/link.h
index fc8d8fee3..e359c8f91 100644
--- a/src/libs/installer/link.h
+++ b/src/libs/installer/link.h
@@ -47,7 +47,7 @@
class Link
{
public:
- Link(const QString &path);
+ explicit Link(const QString &path);
static Link create(const QString &link, const QString &targetPath);
QString targetPath() const;
bool targetExists();
diff --git a/src/libs/installer/macreplaceinstallnamesoperation.h b/src/libs/installer/macreplaceinstallnamesoperation.h
index 635f60054..f4b76de6d 100644
--- a/src/libs/installer/macreplaceinstallnamesoperation.h
+++ b/src/libs/installer/macreplaceinstallnamesoperation.h
@@ -39,8 +39,8 @@
**
**************************************************************************/
-#ifndef MACREPLACEINSTALLNAMEOPERATION_H
-#define MACREPLACEINSTALLNAMEOPERATION_H
+#ifndef MACREPLACEINSTALLNAMESOPERATION_H
+#define MACREPLACEINSTALLNAMESOPERATION_H
#include "qinstallerglobal.h"
@@ -85,4 +85,4 @@ private:
} // namespace QInstaller
-#endif // MACREPLACEINSTALLNAMEOPERATION_H
+#endif // MACREPLACEINSTALLNAMESOPERATION_H
diff --git a/src/libs/installer/messageboxhandler.cpp b/src/libs/installer/messageboxhandler.cpp
index cb9a845ff..219bc8057 100644
--- a/src/libs/installer/messageboxhandler.cpp
+++ b/src/libs/installer/messageboxhandler.cpp
@@ -47,8 +47,8 @@
#include <QDialogButtonBox>
#include <QPushButton>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValue>
QScriptValue QInstaller::registerMessageBox(QScriptEngine *scriptEngine)
{
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index cb957f9aa..6bd90051a 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -39,6 +39,7 @@
**
**************************************************************************/
#include "packagemanagercore.h"
+#include "packagemanagercore_p.h"
#include "adminauthorization.h"
#include "binaryformat.h"
@@ -47,12 +48,11 @@
#include "downloadarchivesjob.h"
#include "errors.h"
#include "fsengineclient.h"
+#include "globals.h"
#include "getrepositoriesmetainfojob.h"
#include "messageboxhandler.h"
-#include "packagemanagercore_p.h"
#include "packagemanagerproxyfactory.h"
#include "progresscoordinator.h"
-#include "qinstallerglobal.h"
#include "qprocesswrapper.h"
#include "qsettingswrapper.h"
#include "settings.h"
@@ -87,9 +87,9 @@
using namespace QInstaller;
-static QMutex sModelMutex;
+Q_GLOBAL_STATIC(QMutex, globalModelMutex);
static QFont *sVirtualComponentsFont = 0;
-static QMutex sVirtualComponentsFontMutex;
+Q_GLOBAL_STATIC(QMutex, globalVirtualComponentsFontMutex);
static bool sNoForceInstallation = false;
static bool sVirtualComponentsVisible = false;
@@ -131,12 +131,12 @@ Component *PackageManagerCore::subComponentByName(const QInstaller::PackageManag
if (check != 0 && componentMatches(check, name, version))
return check;
- if (installer->runMode() == AllMode) {
+ if (!installer->isUpdater()) {
QList<Component*> rootComponents;
if (check == 0)
rootComponents = installer->rootComponents();
else
- rootComponents = check->childComponents(false, AllMode);
+ rootComponents = check->childComponents(Component::DirectChildrenOnly);
foreach (QInstaller::Component *component, rootComponents) {
Component *const result = subComponentByName(installer, name, version, component);
@@ -487,7 +487,7 @@ void PackageManagerCore::rollBackInstallation()
if (!componentName.isEmpty()) {
Component *component = componentByName(componentName);
if (!component)
- component = d->componentsToReplace(runMode()).value(componentName).second;
+ component = d->componentsToReplace().value(componentName).second;
if (component) {
component->setUninstalled();
packages.removePackage(component->name());
@@ -550,12 +550,16 @@ PackageManagerCore::~PackageManagerCore()
QInstaller::VerboseWriter::instance()->setOutputStream(logFileName);
}
delete d;
+
+ QMutexLocker _(globalVirtualComponentsFontMutex());
+ delete sVirtualComponentsFont;
+ sVirtualComponentsFont = 0;
}
/* static */
QFont PackageManagerCore::virtualComponentsFont()
{
- QMutexLocker _(&sVirtualComponentsFontMutex);
+ QMutexLocker _(globalVirtualComponentsFontMutex());
if (!sVirtualComponentsFont)
sVirtualComponentsFont = new QFont;
return *sVirtualComponentsFont;
@@ -564,7 +568,7 @@ QFont PackageManagerCore::virtualComponentsFont()
/* static */
void PackageManagerCore::setVirtualComponentsFont(const QFont &font)
{
- QMutexLocker _(&sVirtualComponentsFontMutex);
+ QMutexLocker _(globalVirtualComponentsFontMutex());
if (sVirtualComponentsFont)
delete sVirtualComponentsFont;
sVirtualComponentsFont = new QFont(font);
@@ -606,11 +610,6 @@ void PackageManagerCore::setCreateLocalRepositoryFromBinary(bool create)
sCreateLocalRepositoryFromBinary = create;
}
-RunMode PackageManagerCore::runMode() const
-{
- return isUpdater() ? UpdaterMode : AllMode;
-}
-
bool PackageManagerCore::fetchLocalPackagesTree()
{
d->setStatus(Running);
@@ -725,7 +724,7 @@ bool PackageManagerCore::fetchRemotePackagesTree()
return false;
bool success = false;
- if (runMode() == AllMode)
+ if (!isUpdater())
success = fetchAllPackages(packages, installedPackages);
else {
success = fetchUpdaterPackages(packages, installedPackages);
@@ -934,7 +933,7 @@ QList<Component*> PackageManagerCore::availableComponents() const
QList<Component*> result = d->m_rootComponents;
foreach (QInstaller::Component *component, d->m_rootComponents)
- result += component->childComponents(true, AllMode);
+ result += component->childComponents(Component::Descendants);
return result + d->m_rootDependencyReplacements;
}
@@ -968,21 +967,23 @@ bool PackageManagerCore::calculateComponentsToInstall() const
if (!d->m_componentsToInstallCalculated) {
d->clearComponentsToInstall();
QList<Component*> components;
- if (runMode() == UpdaterMode) {
+ if (isUpdater()) {
foreach (Component *component, updaterComponents()) {
if (component->updateRequested())
components.append(component);
}
- } else if (runMode() == AllMode) {
+ } else if (!isUpdater()) {
// relevant means all components which are not replaced
QList<Component*> relevantComponents = rootComponents();
foreach (QInstaller::Component *component, rootComponents())
- relevantComponents += component->childComponents(true, AllMode);
+ relevantComponents += component->childComponents(Component::Descendants);
foreach (Component *component, relevantComponents) {
// ask for all components which will be installed to get all dependencies
- // even dependencies wich are changed without an increased version
- if (component->installationRequested() || (component->isInstalled() && !component->uninstallationRequested()))
- components.append(component);
+ // even dependencies which are changed without an increased version
+ if (component->installationRequested() || (component->isInstalled()
+ && !component->uninstallationRequested())) {
+ components.append(component);
+ }
}
}
@@ -1005,10 +1006,10 @@ QList<Component*> PackageManagerCore::orderedComponentsToInstall() const
*/
bool PackageManagerCore::calculateComponentsToUninstall() const
{
- if (runMode() == UpdaterMode)
+ if (isUpdater())
return true;
- // hack to avoid removeing needed dependencies
+ // hack to avoid removing needed dependencies
QSet<Component*> componentsToInstall = d->m_orderedComponentsToInstall.toSet();
QList<Component*> components;
@@ -1046,7 +1047,7 @@ QString PackageManagerCore::installReason(Component *component) const
}
/*!
- Returns a list of components that dependend on \a component. The list can be empty. Note: Auto
+ Returns a list of components that depend on \a component. The list can be empty. Note: Auto
installed dependencies are not resolved.
*/
QList<Component*> PackageManagerCore::dependees(const Component *_component) const
@@ -1090,7 +1091,7 @@ QList<Component*> PackageManagerCore::dependencies(const Component *component, Q
ComponentModel *PackageManagerCore::defaultComponentModel() const
{
- QMutexLocker _(&sModelMutex);
+ QMutexLocker _(globalModelMutex());
if (!d->m_defaultModel) {
d->m_defaultModel = componentModel(const_cast<PackageManagerCore*> (this),
QLatin1String("AllComponentsModel"));
@@ -1100,7 +1101,7 @@ ComponentModel *PackageManagerCore::defaultComponentModel() const
ComponentModel *PackageManagerCore::updaterComponentModel() const
{
- QMutexLocker _(&sModelMutex);
+ QMutexLocker _(globalModelMutex());
if (!d->m_updaterModel) {
d->m_updaterModel = componentModel(const_cast<PackageManagerCore*> (this),
QLatin1String("UpdaterComponentsModel"));
@@ -1263,12 +1264,13 @@ bool PackageManagerCore::executeDetached(const QString &program, const QStringLi
*/
QString PackageManagerCore::environmentVariable(const QString &name) const
{
+ if (name.isEmpty())
+ return QString();
+
#ifdef Q_OS_WIN
- const LPCWSTR n = (LPCWSTR) name.utf16();
- LPTSTR buff = (LPTSTR) malloc(4096 * sizeof(TCHAR));
- DWORD getenvret = GetEnvironmentVariable(n, buff, 4096);
- QString value = getenvret != 0 ? QString::fromUtf16((const unsigned short *) buff) : QString();
- free(buff);
+ static TCHAR buffer[32767];
+ DWORD size = GetEnvironmentVariable(LPCWSTR(name.utf16()), buffer, 32767);
+ QString value = QString::fromUtf16((const unsigned short *) buffer, size);
if (value.isEmpty()) {
static QLatin1String userEnvironmentRegistryPath("HKEY_CURRENT_USER\\Environment");
@@ -1281,8 +1283,7 @@ QString PackageManagerCore::environmentVariable(const QString &name) const
}
return value;
#else
- const char *pPath = name.isEmpty() ? 0 : getenv(name.toLatin1());
- return pPath ? QLatin1String(pPath) : QString();
+ return QString::fromUtf8(qgetenv(name.toLatin1()));
#endif
}
@@ -1646,7 +1647,7 @@ bool PackageManagerCore::updateComponentData(struct Data &data, Component *compo
// add downloadable archive from xml
const QStringList downloadableArchives = data.package->data(scDownloadableArchives).toString()
- .split(scCommaRegExp, QString::SkipEmptyParts);
+ .split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
if (component->isFromOnlineRepository()) {
foreach (const QString downloadableArchive, downloadableArchives)
@@ -1654,7 +1655,7 @@ bool PackageManagerCore::updateComponentData(struct Data &data, Component *compo
}
const QStringList componentsToReplace = data.package->data(scReplaces).toString()
- .split(scCommaRegExp, QString::SkipEmptyParts);
+ .split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
if (!componentsToReplace.isEmpty()) {
// Store the component (this is a component that replaces others) and all components that
@@ -1711,14 +1712,14 @@ void PackageManagerCore::storeReplacedComponents(QHash<QString, Component *> &co
qWarning() << componentName << "- Does not exist in the repositories anymore.";
continue;
}
- if (!component && !d->componentsToReplace(data.runMode).contains(componentName)) {
+ if (!component && !d->componentsToReplace().contains(componentName)) {
component = new Component(this);
component->setValue(scName, componentName);
} else {
component->loadComponentScript();
- d->replacementDependencyComponents(data.runMode).append(component);
+ d->replacementDependencyComponents().append(component);
}
- d->componentsToReplace(data.runMode).insert(componentName, qMakePair(it.key(), component));
+ d->componentsToReplace().insert(componentName, qMakePair(it.key(), component));
}
}
}
@@ -1731,7 +1732,6 @@ bool PackageManagerCore::fetchAllPackages(const PackagesList &remotes, const Loc
QHash<QString, QInstaller::Component*> components;
Data data;
- data.runMode = AllMode;
data.components = &components;
data.installedPackages = &locals;
@@ -1775,7 +1775,6 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const
QHash<QString, QInstaller::Component *> components;
Data data;
- data.runMode = UpdaterMode;
data.components = &components;
data.installedPackages = &locals;
@@ -1804,7 +1803,8 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const
bool isValidUpdate = locals.contains(name);
if (!isValidUpdate && !replaces.isEmpty()) {
- const QStringList possibleNames = replaces.split(scCommaRegExp, QString::SkipEmptyParts);
+ const QStringList possibleNames = replaces.split(QInstaller::commaRegExp(),
+ QString::SkipEmptyParts);
foreach (const QString &possibleName, possibleNames) {
if (locals.contains(possibleName)) {
isValidUpdate = true;
@@ -1976,7 +1976,8 @@ ComponentModel *PackageManagerCore::componentModel(PackageManagerCore *core, con
ComponentModel::tr("Size"));
connect(this, SIGNAL(setRootComponents(QList<QInstaller::Component*>)), model,
SLOT(setRootComponents(QList<QInstaller::Component*>)));
- connect(model, SIGNAL(defaultCheckStateChanged(bool)), this, SLOT(componentsToInstallNeedsRecalculation()));
+ connect(model, SIGNAL(checkStateChanged(QInstaller::ComponentModel::ModelState)), this,
+ SLOT(componentsToInstallNeedsRecalculation()));
return model;
}
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index 50eb63184..df77cd115 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -121,7 +121,6 @@ public:
bool fetchRemotePackagesTree();
bool run();
- RunMode runMode() const;
void reset(const QHash<QString, QString> &params);
Q_INVOKABLE void setDependsOnLocalInstallerBinary();
@@ -297,7 +296,6 @@ Q_SIGNALS:
private:
struct Data {
- RunMode runMode;
Package *package;
QHash<QString, Component*> *components;
const LocalPackagesHash *installedPackages;
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index c0c1c78b4..cd413c5b0 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -47,6 +47,7 @@
#include "errors.h"
#include "fileutils.h"
#include "fsengineclient.h"
+#include "globals.h"
#include "messageboxhandler.h"
#include "packagemanagercore.h"
#include "progresscoordinator.h"
@@ -422,14 +423,14 @@ void PackageManagerCorePrivate::clearUpdaterComponentLists()
m_componentsToInstallCalculated = false;
}
-QList<Component *> &PackageManagerCorePrivate::replacementDependencyComponents(RunMode mode)
+QList<Component *> &PackageManagerCorePrivate::replacementDependencyComponents()
{
- return mode == AllMode ? m_rootDependencyReplacements : m_updaterDependencyReplacements;
+ return (!isUpdater()) ? m_rootDependencyReplacements : m_updaterDependencyReplacements;
}
-QHash<QString, QPair<Component*, Component*> > &PackageManagerCorePrivate::componentsToReplace(RunMode mode)
+QHash<QString, QPair<Component*, Component*> > &PackageManagerCorePrivate::componentsToReplace()
{
- return mode == AllMode ? m_componentsToReplaceAllMode : m_componentsToReplaceUpdaterMode;
+ return (!isUpdater()) ? m_componentsToReplaceAllMode : m_componentsToReplaceUpdaterMode;
}
void PackageManagerCorePrivate::clearComponentsToInstall()
@@ -453,7 +454,7 @@ bool PackageManagerCorePrivate::appendComponentsToInstall(const QList<Component
relevantComponentForAutoDependOn = m_updaterComponents + m_updaterComponentsDeps;
else {
foreach (QInstaller::Component *component, m_rootComponents)
- relevantComponentForAutoDependOn += component->childComponents(true, AllMode);
+ relevantComponentForAutoDependOn += component->childComponents(Component::Descendants);
}
QList<Component*> notAppendedComponents; // for example components with unresolved dependencies
@@ -773,7 +774,7 @@ void PackageManagerCorePrivate::writeMaintenanceConfigFiles()
QVariantHash variables;
QSettingsWrapper cfg(iniPath, QSettingsWrapper::IniFormat);
foreach (const QString &key, m_data.keys()) {
- if (key != scRunProgramDescription && key != scRunProgram)
+ if (key != scRunProgramDescription && key != scRunProgram && key != scRunProgramArguments)
variables.insert(key, m_data.value(key));
}
cfg.setValue(QLatin1String("Variables"), variables);
@@ -2006,7 +2007,7 @@ void PackageManagerCorePrivate::runUndoOperations(const OperationList &undoOpera
if (!componentName.isEmpty()) {
Component *component = m_core->componentByName(componentName);
if (!component)
- component = componentsToReplace(m_core->runMode()).value(componentName).second;
+ component = componentsToReplace().value(componentName).second;
if (component) {
component->setUninstalled();
packages.removePackage(component->name());
@@ -2283,8 +2284,8 @@ bool PackageManagerCorePrivate::appendComponentsToUninstall(const QList<Componen
foreach (Component *c, installedComponents) {
const QString replaces = c->value(scReplaces);
- QStringList possibleNames = replaces.split(scCommaRegExp, QString::SkipEmptyParts);
- possibleNames.append(c->name());
+ const QStringList possibleNames = replaces.split(QInstaller::commaRegExp(),
+ QString::SkipEmptyParts) << c->name();
foreach (const QString &possibleName, possibleNames)
autoDependencies.removeAll(possibleName);
}
diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h
index 9d4a6abab..e77bff18f 100644
--- a/src/libs/installer/packagemanagercore_p.h
+++ b/src/libs/installer/packagemanagercore_p.h
@@ -43,18 +43,15 @@
#define PACKAGEMANAGERCORE_P_H
#include "getrepositoriesmetainfojob.h"
-#include "settings.h"
#include "packagemanagercore.h"
#include "packagemanagercoredata.h"
+#include "qinstallerglobal.h"
-#include <kdsysinfo.h>
-#include <kdupdaterapplication.h>
-#include <kdupdaterupdatefinder.h>
+#include "kdsysinfo.h"
+#include "kdupdaterapplication.h"
+#include "kdupdaterfiledownloaderfactory.h"
-#include <QtCore/QHash>
-#include <QtCore/QObject>
-#include <QtCore/QPair>
-#include <QtCore/QPointer>
+#include <QObject>
class FSEngineClientHandler;
class KDJob;
@@ -117,8 +114,8 @@ public:
void clearAllComponentLists();
void clearUpdaterComponentLists();
- QList<Component*> &replacementDependencyComponents(RunMode mode);
- QHash<QString, QPair<Component*, Component*> > &componentsToReplace(RunMode mode);
+ QList<Component*> &replacementDependencyComponents();
+ QHash<QString, QPair<Component*, Component*> > &componentsToReplace();
void clearComponentsToInstall();
bool appendComponentsToInstall(const QList<Component*> &components);
diff --git a/src/libs/installer/packagemanagercoredata.cpp b/src/libs/installer/packagemanagercoredata.cpp
index 660a72922..501a458d9 100644
--- a/src/libs/installer/packagemanagercoredata.cpp
+++ b/src/libs/installer/packagemanagercoredata.cpp
@@ -97,6 +97,7 @@ PackageManagerCoreData::PackageManagerCoreData(const QHash<QString, QString> &va
m_variables.insert(scTargetDir, replaceVariables(m_settings.targetDir()));
m_variables.insert(scRunProgram, replaceVariables(m_settings.runProgram()));
+ m_variables.insert(scRunProgramArguments, replaceVariables(m_settings.runProgramArguments()));
m_variables.insert(scRemoveTargetDir, replaceVariables(m_settings.removeTargetDir()));
}
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index 1e01e69ff..f0e0ba13c 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -46,7 +46,6 @@
#include "fileutils.h"
#include "messageboxhandler.h"
#include "packagemanagercore.h"
-#include "qinstallerglobal.h"
#include "progresscoordinator.h"
#include "performinstallationform.h"
#include "settings.h"
@@ -244,7 +243,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent)
setWindowTitle(tr("Maintain %1").arg(m_core->value(scTitle)));
#ifndef Q_OS_MAC
- setWindowIcon(QIcon(m_core->settings().icon()));
+ setWindowIcon(QIcon(m_core->settings().installerWindowIcon()));
#else
setPixmap(QWizard::BackgroundPixmap, m_core->settings().background());
#endif
@@ -699,41 +698,6 @@ PackageManagerCore *PackageManagerPage::packageManagerCore() const
return m_core;
}
-QVariantHash PackageManagerPage::elementsForPage(const QString &pageName) const
-{
- const QVariant variant = m_core->settings().value(pageName);
-
- QVariantHash hash;
- if (variant.canConvert<QVariantHash>())
- hash = variant.value<QVariantHash>();
- return hash;
-}
-
-QString PackageManagerPage::titleForPage(const QString &pageName, const QString &value) const
-{
- return titleFromHash(m_core->settings().titlesForPage(pageName), value);
-}
-
-QString PackageManagerPage::subTitleForPage(const QString &pageName, const QString &value) const
-{
- return titleFromHash(m_core->settings().subTitlesForPage(pageName), value);
-}
-
-QString PackageManagerPage::titleFromHash(const QVariantHash &hash, const QString &value) const
-{
- QString defaultValue = hash.value(QLatin1String("Default")).toString();
- if (defaultValue.isEmpty())
- defaultValue = value;
-
- if (m_core->isUpdater())
- return hash.value(QLatin1String("Updater"), defaultValue).toString();
- if (m_core->isInstaller())
- return hash.value(QLatin1String("Installer"), defaultValue).toString();
- if (m_core->isPackageManager())
- return hash.value(QLatin1String("PackageManager"), defaultValue).toString();
- return hash.value(QLatin1String("Uninstaller"), defaultValue).toString();
-}
-
QPixmap PackageManagerPage::watermarkPixmap() const
{
return QPixmap(m_core->value(QLatin1String("WatermarkPixmap")));
@@ -852,15 +816,12 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core)
{
setObjectName(QLatin1String("IntroductionPage"));
setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
- setSubTitle(subTitleForPage(QLatin1String("IntroductionPage")));
- setTitle(titleForPage(QLatin1String("IntroductionPage"), tr("Setup - %1")).arg(productName()));
+ setTitle(tr("Setup - %1").arg(productName()));
m_msgLabel = new QLabel(this);
m_msgLabel->setWordWrap(true);
m_msgLabel->setObjectName(QLatin1String("MessageLabel"));
- const QVariantHash hash = elementsForPage(QLatin1String("IntroductionPage"));
- m_msgLabel->setText(hash.value(QLatin1String("MessageLabel"), tr("Welcome to the %1 "
- "Setup Wizard.")).toString().arg(productName()));
+ m_msgLabel->setText(tr("Welcome to the %1 Setup Wizard.").arg(productName()));
QVBoxLayout *layout = new QVBoxLayout(this);
setLayout(layout);
@@ -919,7 +880,7 @@ LicenseAgreementPage::LicenseAgreementPage(PackageManagerCore *core)
setPixmap(QWizard::LogoPixmap, logoPixmap());
setPixmap(QWizard::WatermarkPixmap, QPixmap());
setObjectName(QLatin1String("LicenseAgreementPage"));
- setTitle(titleForPage(QLatin1String("LicenseAgreementPage"), tr("License Agreement")));
+ setTitle(tr("License Agreement"));
m_licenseListWidget = new QListWidget(this);
m_licenseListWidget->setObjectName(QLatin1String("LicenseListWidget"));
@@ -1046,11 +1007,10 @@ void LicenseAgreementPage::updateUi()
rejectButtonText = tr("I do not accept the licenses.");
}
- setSubTitle(subTitleForPage(QLatin1String("LicenseAgreementPage"), subTitleText));
+ setSubTitle(subTitleText);
- const QVariantHash hash = elementsForPage(QLatin1String("LicenseAgreementPage"));
- m_acceptLabel->setText(hash.value(QLatin1String("AcceptLicenseLabel"), acceptButtonText).toString());
- m_rejectLabel->setText(hash.value(QLatin1String("RejectLicenseLabel"), rejectButtonText).toString());
+ m_acceptLabel->setText(acceptButtonText);
+ m_rejectLabel->setText(rejectButtonText);
}
@@ -1072,8 +1032,10 @@ public:
{
m_treeView->setObjectName(QLatin1String("ComponentsTreeView"));
- connect(m_allModel, SIGNAL(defaultCheckStateChanged(bool)), q, SLOT(setModified(bool)));
- connect(m_updaterModel, SIGNAL(defaultCheckStateChanged(bool)), q, SLOT(setModified(bool)));
+ connect(m_allModel, SIGNAL(checkStateChanged(QInstaller::ComponentModel::ModelState)), this,
+ SLOT(onCheckStateChanged(QInstaller::ComponentModel::ModelState)));
+ connect(m_updaterModel, SIGNAL(checkStateChanged(QInstaller::ComponentModel::ModelState)), this,
+ SLOT(onCheckStateChanged(QInstaller::ComponentModel::ModelState)));
QHBoxLayout *hlayout = new QHBoxLayout;
hlayout->addWidget(m_treeView, 3);
@@ -1099,18 +1061,15 @@ public:
m_checkDefault = new QPushButton;
connect(m_checkDefault, SIGNAL(clicked()), this, SLOT(selectDefault()));
- connect(m_allModel, SIGNAL(defaultCheckStateChanged(bool)), m_checkDefault, SLOT(setEnabled(bool)));
- const QVariantHash hash = q->elementsForPage(QLatin1String("ComponentSelectionPage"));
if (m_core->isInstaller()) {
m_checkDefault->setObjectName(QLatin1String("SelectDefaultComponentsButton"));
m_checkDefault->setShortcut(QKeySequence(ComponentSelectionPage::tr("Alt+A", "select default components")));
- m_checkDefault->setText(hash.value(QLatin1String("SelectDefaultComponentsButton"), ComponentSelectionPage::tr("Def&ault"))
- .toString());
+ m_checkDefault->setText(ComponentSelectionPage::tr("Def&ault"));
} else {
m_checkDefault->setEnabled(false);
m_checkDefault->setObjectName(QLatin1String("ResetComponentsButton"));
m_checkDefault->setShortcut(QKeySequence(ComponentSelectionPage::tr("Alt+R", "reset to already installed components")));
- m_checkDefault->setText(hash.value(QLatin1String("ResetComponentsButton"), ComponentSelectionPage::tr("&Reset")).toString());
+ m_checkDefault->setText(ComponentSelectionPage::tr("&Reset"));
}
hlayout = new QHBoxLayout;
hlayout->addWidget(m_checkDefault);
@@ -1120,15 +1079,14 @@ public:
connect(m_checkAll, SIGNAL(clicked()), this, SLOT(selectAll()));
m_checkAll->setObjectName(QLatin1String("SelectAllComponentsButton"));
m_checkAll->setShortcut(QKeySequence(ComponentSelectionPage::tr("Alt+S", "select all components")));
- m_checkAll->setText(hash.value(QLatin1String("SelectAllComponentsButton"), ComponentSelectionPage::tr("&Select All")).toString());
+ m_checkAll->setText(ComponentSelectionPage::tr("&Select All"));
m_uncheckAll = new QPushButton;
hlayout->addWidget(m_uncheckAll);
connect(m_uncheckAll, SIGNAL(clicked()), this, SLOT(deselectAll()));
m_uncheckAll->setObjectName(QLatin1String("DeselectAllComponentsButton"));
m_uncheckAll->setShortcut(QKeySequence(ComponentSelectionPage::tr("Alt+D", "deselect all components")));
- m_uncheckAll->setText(hash.value(QLatin1String("DeselectAllComponentsButton"), ComponentSelectionPage::tr("&Deselect All"))
- .toString());
+ m_uncheckAll->setText(ComponentSelectionPage::tr("&Deselect All"));
hlayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::MinimumExpanding,
QSizePolicy::MinimumExpanding));
@@ -1176,8 +1134,8 @@ public:
public slots:
void currentChanged(const QModelIndex &current)
{
- // if there is not selection or the current selected node didn't change, return
- if (!current.isValid() || current != m_treeView->selectionModel()->currentIndex())
+ // if there is no selection, return
+ if (!current.isValid())
return;
m_descriptionLabel->setText(m_currentModel->data(m_currentModel->index(current.row(),
@@ -1185,42 +1143,50 @@ public slots:
m_sizeLabel->clear();
if (!m_core->isUninstaller()) {
- Component *component = m_currentModel->componentFromIndex(current);
- if (component && component->updateUncompressedSize() > 0) {
- const QVariantHash hash = q->elementsForPage(QLatin1String("ComponentSelectionPage"));
- m_sizeLabel->setText(hash.value(QLatin1String("ComponentSizeLabel"),
- ComponentSelectionPage::tr("This component will occupy approximately %1 on your hard disk drive.")).toString()
- .arg(m_currentModel->data(m_currentModel->index(current.row(),
- ComponentModelHelper::UncompressedSizeColumn, current.parent())).toString()));
+ const QModelIndex currentSelected = m_treeView->selectionModel()->currentIndex();
+ if (!currentSelected.isValid())
+ return;
+
+ Component *component = m_currentModel->componentFromIndex(currentSelected);
+ if (component == 0)
+ return;
+
+ if (component->updateUncompressedSize() > 0) {
+ m_sizeLabel->setText(ComponentSelectionPage::tr("This component "
+ "will occupy approximately %1 on your hard disk drive.")
+ .arg(humanReadableSize(component->value(scUncompressedSizeSum).toLongLong())));
}
}
}
- // TODO: all *select* function ignore the fact that components can be selected inside the tree view as
- // well, which will result in e.g. a disabled button state as long as "ALL" components not
- // unchecked again.
void selectAll()
{
- m_currentModel->selectAll();
-
- m_checkAll->setEnabled(false);
- m_uncheckAll->setEnabled(true);
+ m_currentModel->setCheckedState(ComponentModel::AllChecked);
}
void deselectAll()
{
- m_currentModel->deselectAll();
-
- m_checkAll->setEnabled(true);
- m_uncheckAll->setEnabled(false);
+ m_currentModel->setCheckedState(ComponentModel::AllUnchecked);
}
void selectDefault()
{
- m_currentModel->selectDefault();
+ m_currentModel->setCheckedState(ComponentModel::DefaultChecked);
+ }
+
+ void onCheckStateChanged(QInstaller::ComponentModel::ModelState state)
+ {
+ q->setModified(state != ComponentModel::DefaultChecked);
- m_checkAll->setEnabled(true);
- m_uncheckAll->setEnabled(true);
+ // If all components in the checked list are only checkable when run without forced installation, set
+ // ComponentModel::AllUnchecked as well, as we cannot uncheck anything. Helps to keep the UI correct.
+ if ((!m_core->noForceInstallation()) && (m_currentModel->checked() == m_currentModel->uncheckable()))
+ state |= ComponentModel::AllUnchecked;
+
+ // enable the button if the corresponding flag is not set
+ m_checkAll->setEnabled(state.testFlag(ComponentModel::AllChecked) == false);
+ m_uncheckAll->setEnabled(state.testFlag(ComponentModel::AllUnchecked) == false);
+ m_checkDefault->setEnabled(state.testFlag(ComponentModel::DefaultChecked) == false);
}
public:
@@ -1251,7 +1217,7 @@ ComponentSelectionPage::ComponentSelectionPage(PackageManagerCore *core)
setPixmap(QWizard::LogoPixmap, logoPixmap());
setPixmap(QWizard::WatermarkPixmap, QPixmap());
setObjectName(QLatin1String("ComponentSelectionPage"));
- setTitle(titleForPage(QLatin1String("ComponentSelectionPage"), tr("Select Components")));
+ setTitle(tr("Select Components"));
}
ComponentSelectionPage::~ComponentSelectionPage()
@@ -1273,7 +1239,7 @@ void ComponentSelectionPage::entering()
if (core->isInstaller()) index = 1;
if (core->isUninstaller()) index = 2;
if (core->isPackageManager()) index = 3;
- setSubTitle(subTitleForPage(QLatin1String("ComponentSelectionPage"), tr(strings[index])));
+ setSubTitle(tr(strings[index]));
d->updateTreeView();
setModified(isComplete());
@@ -1331,8 +1297,8 @@ void ComponentSelectionPage::setModified(bool modified)
bool ComponentSelectionPage::isComplete() const
{
if (packageManagerCore()->isInstaller() || packageManagerCore()->isUpdater())
- return d->m_currentModel->hasCheckedComponents();
- return !d->m_currentModel->defaultCheckState();
+ return d->m_currentModel->checked().count();
+ return d->m_currentModel->checkedState() != ComponentModel::DefaultChecked;
}
@@ -1344,17 +1310,14 @@ TargetDirectoryPage::TargetDirectoryPage(PackageManagerCore *core)
setPixmap(QWizard::LogoPixmap, logoPixmap());
setPixmap(QWizard::WatermarkPixmap, QPixmap());
setObjectName(QLatin1String("TargetDirectoryPage"));
- setSubTitle(subTitleForPage(QLatin1String("TargetDirectoryPage")));
- setTitle(titleForPage(QLatin1String("TargetDirectoryPage"), tr("Installation Folder")));
+ setTitle(tr("Installation Folder"));
QVBoxLayout *layout = new QVBoxLayout(this);
QLabel *msgLabel = new QLabel(this);
msgLabel->setWordWrap(true);
msgLabel->setObjectName(QLatin1String("MessageLabel"));
- const QVariantHash hash = elementsForPage(QLatin1String("TargetDirectoryPage"));
- msgLabel->setText(hash.value(QLatin1String("MessageLabel"), tr("Please specify the folder "
- "where %1 will be installed.")).toString().arg(productName()));
+ msgLabel->setText(tr("Please specify the folder where %1 will be installed.").arg(productName()));
layout->addWidget(msgLabel);
QHBoxLayout *hlayout = new QHBoxLayout;
@@ -1368,8 +1331,7 @@ TargetDirectoryPage::TargetDirectoryPage(PackageManagerCore *core)
browseButton->setObjectName(QLatin1String("BrowseDirectoryButton"));
connect(browseButton, SIGNAL(clicked()), this, SLOT(dirRequested()));
browseButton->setShortcut(QKeySequence(tr("Alt+R", "browse file system to choose a file")));
- browseButton->setText(hash.value(QLatin1String("BrowseDirectoryButton"), tr("B&rowse..."))
- .toString());
+ browseButton->setText(tr("B&rowse..."));
hlayout->addWidget(browseButton);
layout->addLayout(hlayout);
@@ -1403,12 +1365,10 @@ void TargetDirectoryPage::initializePage()
bool TargetDirectoryPage::validatePage()
{
- const QVariantHash hash = elementsForPage(QLatin1String("TargetDirectoryPage"));
if (targetDir().isEmpty()) {
MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(),
- QLatin1String("EmptyTargetDirectoryMessage"), tr("Error"), hash
- .value(QLatin1String("EmptyTargetDirectoryMessage"), tr("The install directory cannot be "
- "empty, please specify a valid folder.")).toString(), QMessageBox::Ok);
+ QLatin1String("EmptyTargetDirectoryMessage"), tr("Error"), tr("The install directory cannot be "
+ "empty, please specify a valid folder."), QMessageBox::Ok);
return false;
}
@@ -1421,9 +1381,8 @@ bool TargetDirectoryPage::validatePage()
// it exists, but is not empty
if (dir == QDir::root()) {
MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(),
- QLatin1String("ForbiddenTargetDirectoryMessage"), tr("Error"), hash
- .value(QLatin1String("ForbiddenTargetDirectoryMessage"), tr("As the install directory is "
- "completely deleted, installing in %1 is forbidden.")).toString().arg(QDir::rootPath()),
+ QLatin1String("ForbiddenTargetDirectoryMessage"), tr("Error"), tr("As the install directory "
+ "is completely deleted on uninstall, installing in %1 is forbidden.").arg(QDir::rootPath()),
QMessageBox::Ok);
return false;
}
@@ -1432,11 +1391,10 @@ bool TargetDirectoryPage::validatePage()
return true;
return MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(),
- QLatin1String("OverwriteTargetDirectoryMessage"), tr("Warning"), hash
- .value(QLatin1String("OverwriteTargetDirectoryMessage"), tr("You have selected an existing, "
+ QLatin1String("OverwriteTargetDirectoryMessage"), tr("Warning"), tr("You have selected an existing, "
"non-empty folder for installation. Note that it will be completely wiped on uninstallation of "
"this application. It is not advisable to install into this folder as installation might fail. "
- "Do you want to continue?")).toString(), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes;
+ "Do you want to continue?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes;
}
return true;
}
@@ -1456,9 +1414,7 @@ void TargetDirectoryPage::targetDirSelected()
void TargetDirectoryPage::dirRequested()
{
- const QVariantHash hash = elementsForPage(QLatin1String("TargetDirectoryPage"));
- const QString newDirName = QFileDialog::getExistingDirectory(this, hash
- .value(QLatin1String("SelectInstallationFolderCaption"), tr("Select Installation Folder")).toString(),
+ const QString newDirName = QFileDialog::getExistingDirectory(this, tr("Select Installation Folder"),
targetDir());
if (newDirName.isEmpty() || newDirName == targetDir())
return;
@@ -1474,9 +1430,9 @@ StartMenuDirectoryPage::StartMenuDirectoryPage(PackageManagerCore *core)
setPixmap(QWizard::LogoPixmap, logoPixmap());
setPixmap(QWizard::WatermarkPixmap, QPixmap());
setObjectName(QLatin1String("StartMenuDirectoryPage"));
- setTitle(titleForPage(QLatin1String("StartMenuDirectoryPage"), tr("Start Menu shortcuts")));
- setSubTitle(subTitleForPage(QLatin1String("StartMenuDirectoryPage"), tr("Select the Start Menu in which "
- "you would like to create the program's shortcuts. You can also enter a name to create a new folder.")));
+ setTitle(tr("Start Menu shortcuts"));
+ setSubTitle(tr("Select the Start Menu in which you would like to create the program's shortcuts. You can "
+ "also enter a name to create a new folder."));
m_lineEdit = new QLineEdit(this);
m_lineEdit->setObjectName(QLatin1String("LineEdit"));
@@ -1564,7 +1520,6 @@ ReadyForInstallationPage::ReadyForInstallationPage(PackageManagerCore *core)
setPixmap(QWizard::LogoPixmap, logoPixmap());
setPixmap(QWizard::WatermarkPixmap, QPixmap());
setObjectName(QLatin1String("ReadyForInstallationPage"));
- setSubTitle(subTitleForPage(QLatin1String("ReadyForInstallationPage")));
QVBoxLayout *baseLayout = new QVBoxLayout();
baseLayout->setObjectName(QLatin1String("BaseLayout"));
@@ -1612,7 +1567,7 @@ void ReadyForInstallationPage::entering()
m_taskDetailsButton->setVisible(false);
m_taskDetailsBrowser->setVisible(false);
setButtonText(QWizard::CommitButton, tr("U&ninstall"));
- setTitle(titleForPage(objectName(), tr("Ready to Uninstall")));
+ setTitle(tr("Ready to Uninstall"));
m_msgLabel->setText(tr("Setup is now ready to begin removing %1 from your computer.<br>"
"<font color=\"red\">The program directory %2 will be deleted completely</font>, "
"including all content in that directory!")
@@ -1622,12 +1577,12 @@ void ReadyForInstallationPage::entering()
return;
} else if (packageManagerCore()->isPackageManager() || packageManagerCore()->isUpdater()) {
setButtonText(QWizard::CommitButton, tr("U&pdate"));
- setTitle(titleForPage(objectName(), tr("Ready to Update Packages")));
+ setTitle(tr("Ready to Update Packages"));
m_msgLabel->setText(tr("Setup is now ready to begin updating your installation."));
} else {
Q_ASSERT(packageManagerCore()->isInstaller());
setButtonText(QWizard::CommitButton, tr("&Install"));
- setTitle(titleForPage(objectName(), tr("Ready to Install")));
+ setTitle(tr("Ready to Install"));
m_msgLabel->setText(tr("Setup is now ready to begin installing %1 on your computer.")
.arg(productName()));
}
@@ -1794,7 +1749,6 @@ PerformInstallationPage::PerformInstallationPage(PackageManagerCore *core)
setPixmap(QWizard::LogoPixmap, logoPixmap());
setPixmap(QWizard::WatermarkPixmap, QPixmap());
setObjectName(QLatin1String("PerformInstallationPage"));
- setSubTitle(subTitleForPage(QLatin1String("PerformInstallationPage")));
m_performInstallationForm->setupUi(this);
@@ -1836,17 +1790,17 @@ void PerformInstallationPage::entering()
if (packageManagerCore()->isUninstaller()) {
setButtonText(QWizard::CommitButton, tr("&Uninstall"));
- setTitle(titleForPage(objectName(), tr("Uninstalling %1")).arg(productName()));
+ setTitle(tr("Uninstalling %1").arg(productName()));
QTimer::singleShot(30, packageManagerCore(), SLOT(runUninstaller()));
} else if (packageManagerCore()->isPackageManager() || packageManagerCore()->isUpdater()) {
setButtonText(QWizard::CommitButton, tr("&Update"));
- setTitle(titleForPage(objectName(), tr("Updating components of %1")).arg(productName()));
+ setTitle(tr("Updating components of %1").arg(productName()));
QTimer::singleShot(30, packageManagerCore(), SLOT(runPackageUpdater()));
} else {
setButtonText(QWizard::CommitButton, tr("&Install"));
- setTitle(titleForPage(objectName(), tr("Installing %1")).arg(productName()));
+ setTitle(tr("Installing %1").arg(productName()));
QTimer::singleShot(30, packageManagerCore(), SLOT(runInstaller()));
}
@@ -1914,20 +1868,16 @@ FinishedPage::FinishedPage(PackageManagerCore *core)
{
setObjectName(QLatin1String("FinishedPage"));
setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
- setSubTitle(subTitleForPage(QLatin1String("FinishedPage")));
- setTitle(titleForPage(QLatin1String("FinishedPage"), tr("Completing the %1 Wizard")).arg(productName()));
+ setTitle(tr("Completing the %1 Wizard").arg(productName()));
m_msgLabel = new QLabel(this);
m_msgLabel->setWordWrap(true);
m_msgLabel->setObjectName(QLatin1String("MessageLabel"));
- const QVariantHash hash = elementsForPage(QLatin1String("FinishedPage"));
#ifdef Q_OS_MAC
- m_msgLabel->setText(hash.value(QLatin1String("MessageLabel"), tr("Click Done to exit the %1 "
- "Wizard.")).toString().arg(productName()));
+ m_msgLabel->setText(tr("Click Done to exit the %1 Wizard.").arg(productName()));
#else
- m_msgLabel->setText(hash.value(QLatin1String("MessageLabel"), tr("Click Finish to exit the "
- "%1 Wizard.")).toString().arg(productName()));
+ m_msgLabel->setText(tr("Click Finish to exit the %1 Wizard.").arg(productName()));
#endif
m_runItCheckBox = new QCheckBox(this);
@@ -2012,11 +1962,13 @@ void FinishedPage::leaving()
void FinishedPage::handleFinishClicked()
{
const QString program = packageManagerCore()->replaceVariables(packageManagerCore()->value(scRunProgram));
+ const QStringList args = packageManagerCore()->replaceVariables(
+ packageManagerCore()->value(scRunProgramArguments)).split(QLatin1Char(' '));
if (!m_runItCheckBox->isChecked() || program.isEmpty())
return;
- qDebug() << "starting" << program;
- QProcess::startDetached(program);
+ qDebug() << "starting" << program << args;
+ QProcess::startDetached(program, args);
}
@@ -2027,9 +1979,7 @@ RestartPage::RestartPage(PackageManagerCore *core)
{
setObjectName(QLatin1String("RestartPage"));
setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
- setSubTitle(subTitleForPage(QLatin1String("RestartPage")));
- setTitle(titleForPage(QLatin1String("RestartPage"), tr("Completing the %1 Setup Wizard"))
- .arg(productName()));
+ setTitle(tr("Completing the %1 Setup Wizard").arg(productName()));
setFinalPage(false);
setCommitPage(false);
diff --git a/src/libs/installer/packagemanagergui.h b/src/libs/installer/packagemanagergui.h
index 5b7bd0615..3cb1071bd 100644
--- a/src/libs/installer/packagemanagergui.h
+++ b/src/libs/installer/packagemanagergui.h
@@ -168,10 +168,6 @@ public:
protected:
PackageManagerCore *packageManagerCore() const;
- QVariantHash elementsForPage(const QString &pageName) const;
-
- QString titleForPage(const QString &pageName, const QString &value = QString()) const;
- QString subTitleForPage(const QString &pageName, const QString &value = QString()) const;
// Inserts widget into the same layout like a sibling identified
// by its name. Default position is just behind the sibling.
@@ -187,9 +183,6 @@ protected:
bool isConstructing() const { return m_fresh; }
private:
- QString titleFromHash(const QVariantHash &hash, const QString &value = QString()) const;
-
-private:
bool m_fresh;
bool m_complete;
diff --git a/src/libs/installer/packagemanagerproxyfactory.h b/src/libs/installer/packagemanagerproxyfactory.h
index 2ddfe7a18..a50605232 100644
--- a/src/libs/installer/packagemanagerproxyfactory.h
+++ b/src/libs/installer/packagemanagerproxyfactory.h
@@ -51,7 +51,7 @@ class PackageManagerCore;
class PackageManagerProxyFactory : public KDUpdater::FileDownloaderProxyFactory
{
public:
- PackageManagerProxyFactory(const PackageManagerCore *const core);
+ explicit PackageManagerProxyFactory(const PackageManagerCore *const core);
PackageManagerProxyFactory *clone() const;
QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery());
diff --git a/src/libs/installer/performinstallationform.h b/src/libs/installer/performinstallationform.h
index f3471ebe2..209afc42d 100644
--- a/src/libs/installer/performinstallationform.h
+++ b/src/libs/installer/performinstallationform.h
@@ -61,7 +61,7 @@ class PerformInstallationForm : public QObject
Q_OBJECT
public:
- PerformInstallationForm(QObject *parent);
+ explicit PerformInstallationForm(QObject *parent);
void setupUi(QWidget *widget);
void setDetailsWidgetVisible(bool visible);
diff --git a/src/libs/installer/productkeycheck.cpp b/src/libs/installer/productkeycheck.cpp
index f975db821..120014dad 100644
--- a/src/libs/installer/productkeycheck.cpp
+++ b/src/libs/installer/productkeycheck.cpp
@@ -47,10 +47,8 @@ ProductKeyCheck::~ProductKeyCheck()
ProductKeyCheck *ProductKeyCheck::instance()
{
- static ProductKeyCheck *instance = 0;
- if (instance == 0)
- instance = new ProductKeyCheck();
- return instance;
+ static ProductKeyCheck instance;
+ return &instance;
}
bool ProductKeyCheck::hasValidKey()
diff --git a/src/libs/installer/progresscoordinator.h b/src/libs/installer/progresscoordinator.h
index b1fa0ab67..263b25695 100644
--- a/src/libs/installer/progresscoordinator.h
+++ b/src/libs/installer/progresscoordinator.h
@@ -39,8 +39,8 @@
**
**************************************************************************/
-#ifndef PROGRESSCOORDNINATOR_H
-#define PROGRESSCOORDNINATOR_H
+#ifndef PROGRESSCOORDINATOR_H
+#define PROGRESSCOORDINATOR_H
#include <QtCore/QHash>
#include <QtCore/QObject>
@@ -102,4 +102,4 @@ private:
} //namespace QInstaller
-#endif //PROGRESSCOORDNINATOR_H
+#endif //PROGRESSCOORDINATOR_H
diff --git a/src/libs/installer/qinstallerglobal.h b/src/libs/installer/qinstallerglobal.h
index b7d5d3f3d..7f0fbbbc0 100644
--- a/src/libs/installer/qinstallerglobal.h
+++ b/src/libs/installer/qinstallerglobal.h
@@ -57,14 +57,6 @@ QT_END_NAMESPACE
namespace QInstaller {
-static QRegExp scCommaRegExp(QLatin1String("\\b(,|, )\\b"));
-
-enum INSTALLER_EXPORT RunMode
-{
- AllMode,
- UpdaterMode
-};
-
enum INSTALLER_EXPORT JobError
{
InvalidUrl = 0x24B04,
diff --git a/src/libs/installer/registerqtvqnxoperation.cpp b/src/libs/installer/registerqtincreatorqnxoperation.cpp
index b52558145..be99de4c7 100644
--- a/src/libs/installer/registerqtvqnxoperation.cpp
+++ b/src/libs/installer/registerqtincreatorqnxoperation.cpp
@@ -39,7 +39,7 @@
**
**************************************************************************/
-#include "registerqtvqnxoperation.h"
+#include "registerqtincreatorqnxoperation.h"
#include "packagemanagercore.h"
#include "qtcreator_constants.h"
diff --git a/src/libs/installer/registerqtvqnxoperation.h b/src/libs/installer/registerqtincreatorqnxoperation.h
index a5e49656a..5b6a3c9b1 100644
--- a/src/libs/installer/registerqtvqnxoperation.h
+++ b/src/libs/installer/registerqtincreatorqnxoperation.h
@@ -39,8 +39,8 @@
**
**************************************************************************/
-#ifndef REGISTERQTINCREATORVQNXOPERATION_H
-#define REGISTERQTINCREATORVQNXOPERATION_H
+#ifndef REGISTERQTINCREATORQNXOPERATION_H
+#define REGISTERQTINCREATORQNXOPERATION_H
#include "qinstallerglobal.h"
@@ -60,4 +60,4 @@ public:
} // namespace QInstaller
-#endif // REGISTERQTINCREATORVQNXOPERATION_H
+#endif // REGISTERQTINCREATORQNXOPERATION_H
diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp
index 79eee652f..9fc31c3cb 100644
--- a/src/libs/installer/settings.cpp
+++ b/src/libs/installer/settings.cpp
@@ -41,7 +41,6 @@
#include "settings.h"
#include "errors.h"
-#include "qinstallerglobal.h"
#include "repository.h"
#include <QtCore/QFileInfo>
@@ -52,8 +51,9 @@
using namespace QInstaller;
static const QLatin1String scIcon("Icon");
+static const QLatin1String scInstallerApplicationIcon("InstallerApplicationIcon");
+static const QLatin1String scInstallerWindowIcon("InstallerWindowIcon");
static const QLatin1String scLogo("Logo");
-static const QLatin1String scPages("Pages");
static const QLatin1String scPrefix("Prefix");
static const QLatin1String scWatermark("Watermark");
static const QLatin1String scProductUrl("ProductUrl");
@@ -115,40 +115,6 @@ static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefaul
return set;
}
-static QVariantHash readTitles(QXmlStreamReader &reader)
-{
- QVariantHash hash;
- while (reader.readNextStartElement())
- hash.insert(reader.name().toString(), reader.readElementText(QXmlStreamReader::SkipChildElements));
- return hash;
-}
-
-static QHash<QString, QVariantHash> readPages(QXmlStreamReader &reader)
-{
- QHash<QString, QVariantHash> hash;
- while (reader.readNextStartElement()) {
- if (reader.name() == QLatin1String("Page")) {
- QVariantHash pageElements;
- const QString pageName = reader.attributes().value(QLatin1String("name")).toString();
- if (pageName.isEmpty())
- reader.raiseError(QLatin1String("Expected non-empty attribute 'name' for element 'Page'."));
-
- while (reader.readNextStartElement()) {
- const QString name = reader.name().toString();
- if (name == QLatin1String("Title") || name == QLatin1String("SubTitle")) {
- pageElements.insert(name, readTitles(reader));
- } else {
- pageElements.insert(name, reader.readElementText(QXmlStreamReader::SkipChildElements));
- }
- }
- hash.insert(pageName, pageElements);
- } else {
- reader.raiseError(QString::fromLatin1("Unexpected element '%1'.").arg(reader.name().toString()));
- }
- }
- return hash;
-}
-
// -- Settings::Private
@@ -215,16 +181,14 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
QStringList elementList;
elementList << scName << scVersion << scTitle << scPublisher << scProductUrl
<< scTargetDir << scAdminTargetDir
- << scIcon << scLogo << scWatermark << scBackground
+ << scIcon << scInstallerApplicationIcon << scInstallerWindowIcon
+ << scLogo << scWatermark << scBackground
<< scStartMenuDir << scUninstallerName << scUninstallerIniFile << scRemoveTargetDir
- << scRunProgram << scRunProgramDescription
+ << scRunProgram << scRunProgramArguments << scRunProgramDescription
<< scDependsOnLocalInstallerBinary
<< scAllowSpaceInPath << scAllowNonAsciiCharacters
<< scRepositorySettingsPageVisible << scTargetConfigurationFile
- << scRemoteRepositories << scPages;
-
- QStringList blackList;
- blackList << scRemoteRepositories << scPages;
+ << scRemoteRepositories;
Settings s;
s.d->m_data.insert(scPrefix, prefix);
@@ -237,20 +201,15 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
if (!reader.attributes().isEmpty())
reader.raiseError(QString::fromLatin1("Unexpected attribute for element '%1'.").arg(name));
- if (blackList.contains(name)) {
- if (name == scRemoteRepositories)
- s.addDefaultRepositories(readRepositories(reader, true));
+ if (name == scIcon)
+ qWarning() << "Deprecated element 'Icon'.";
- if (name == scPages) {
- qWarning() << "Deprecated element 'Pages'.";
- QHash<QString, QVariantHash> pages = readPages(reader);
- const QStringList &keys = pages.keys();
- foreach (const QString &key, keys)
- s.d->m_data.insert(key, pages.value(key));
- }
+ if (s.d->m_data.contains(name))
+ reader.raiseError(QString::fromLatin1("Element '%1' has been defined before.").arg(name));
+
+ if (name == scRemoteRepositories) {
+ s.addDefaultRepositories(readRepositories(reader, true));
} else {
- if (s.d->m_data.contains(name))
- reader.raiseError(QString::fromLatin1("Element '%1' has been defined before.").arg(name));
s.d->m_data.insert(name, reader.readElementText(QXmlStreamReader::SkipChildElements));
}
}
@@ -268,6 +227,10 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
// Add some possible missing values
if (!s.d->m_data.contains(scIcon))
s.d->m_data.insert(scIcon, QLatin1String(":/installer"));
+ if (!s.d->m_data.contains(scInstallerApplicationIcon))
+ s.d->m_data.insert(scInstallerApplicationIcon, s.d->m_data.value(scIcon));
+ if (!s.d->m_data.contains(scInstallerWindowIcon))
+ s.d->m_data.insert(scInstallerWindowIcon, s.d->m_data.value(scIcon).toString() + s.systemIconSuffix());
if (!s.d->m_data.contains(scRemoveTargetDir))
s.d->m_data.insert(scRemoveTargetDir, scTrue);
if (!s.d->m_data.contains(scUninstallerName))
@@ -326,15 +289,30 @@ QString Settings::background() const
QString Settings::icon() const
{
- const QString icon = d->makeAbsolutePath(d->m_data.value(scIcon).toString());
+ return d->makeAbsolutePath(d->m_data.value(scIcon).toString() + systemIconSuffix());
+}
+
+QString Settings::installerApplicationIcon() const
+{
+ return d->makeAbsolutePath(d->m_data.value(scInstallerApplicationIcon).toString() + systemIconSuffix());
+}
+
+QString Settings::installerWindowIcon() const
+{
+ return d->makeAbsolutePath(d->m_data.value(scInstallerWindowIcon).toString());
+}
+
+QString Settings::systemIconSuffix() const
+{
#if defined(Q_OS_MAC)
- return icon + QLatin1String(".icns");
+ return QLatin1String(".icns");
#elif defined(Q_OS_WIN)
- return icon + QLatin1String(".ico");
+ return QLatin1String(".ico");
#endif
- return icon + QLatin1String(".png");
+ return QLatin1String(".png");
}
+
QString Settings::removeTargetDir() const
{
return d->m_data.value(scRemoveTargetDir).toString();
@@ -355,6 +333,11 @@ QString Settings::runProgram() const
return d->m_data.value(scRunProgram).toString();
}
+QString Settings::runProgramArguments() const
+{
+ return d->m_data.value(scRunProgramArguments).toString();
+}
+
QString Settings::runProgramDescription() const
{
return d->m_data.value(scRunProgramDescription).toString();
@@ -523,24 +506,6 @@ QVariantList Settings::values(const QString &key, const QVariantList &defaultVal
return list.isEmpty() ? defaultValue : list;
}
-QVariantHash Settings::titlesForPage(const QString &pageName) const
-{
- const QVariantHash hash = d->m_data.value(pageName).toHash();
- const QVariant variant = hash.value(QLatin1String("Title"), QVariant());
- if (!variant.canConvert<QVariantHash>())
- return QVariantHash();
- return variant.value<QVariantHash>();
-}
-
-QVariantHash Settings::subTitlesForPage(const QString &pageName) const
-{
- const QVariantHash hash = d->m_data.value(pageName).toHash();
- const QVariant variant = hash.value(QLatin1String("SubTitle"), QVariant());
- if (!variant.canConvert<QVariantHash>())
- return QVariantHash();
- return variant.value<QVariantHash>();
-}
-
bool Settings::repositorySettingsPageVisible() const
{
return d->m_data.value(scRepositorySettingsPageVisible, true).toBool();
diff --git a/src/libs/installer/settings.h b/src/libs/installer/settings.h
index 8ffbfc004..272c4ac07 100644
--- a/src/libs/installer/settings.h
+++ b/src/libs/installer/settings.h
@@ -89,11 +89,15 @@ public:
QString watermark() const;
QString background() const;
QString icon() const;
+ QString installerApplicationIcon() const;
+ QString installerWindowIcon() const;
+ QString systemIconSuffix() const;
QString applicationName() const;
QString applicationVersion() const;
QString runProgram() const;
+ QString runProgramArguments() const;
QString runProgramDescription() const;
QString startMenuDir() const;
QString targetDir() const;
@@ -129,9 +133,6 @@ public:
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
QVariantList values(const QString &key, const QVariantList &defaultValue = QVariantList()) const;
- QVariantHash titlesForPage(const QString &pageName) const;
- QVariantHash subTitlesForPage(const QString &pageName) const;
-
bool repositorySettingsPageVisible() const;
Settings::ProxyType proxyType() const;
diff --git a/src/libs/installer/utils.h b/src/libs/installer/utils.h
index 0d21adbee..e6aca456d 100644
--- a/src/libs/installer/utils.h
+++ b/src/libs/installer/utils.h
@@ -81,7 +81,7 @@ namespace QInstaller {
{
Q_OBJECT
public:
- VerboseWriter(QObject *parent = 0);
+ explicit VerboseWriter(QObject *parent = 0);
~VerboseWriter();
static VerboseWriter *instance();
diff --git a/src/libs/kdtools/kdsysinfo_win.cpp b/src/libs/kdtools/kdsysinfo_win.cpp
index 10666c8e0..0fa605ef9 100644
--- a/src/libs/kdtools/kdsysinfo_win.cpp
+++ b/src/libs/kdtools/kdsysinfo_win.cpp
@@ -247,7 +247,7 @@ bool killProcess(const ProcessInfo &process, int msecs)
// If we can't open the process with PROCESS_TERMINATE rights,
// then we give up immediately.
- HANDLE hProc = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, FALSE, process.id);
+ HANDLE hProc = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, false, process.id);
if (hProc == 0)
return false;
diff --git a/src/libs/kdtools/kdupdaterapplication.h b/src/libs/kdtools/kdupdaterapplication.h
index b2079fe7c..f1ca9d612 100644
--- a/src/libs/kdtools/kdupdaterapplication.h
+++ b/src/libs/kdtools/kdupdaterapplication.h
@@ -25,7 +25,6 @@
#include "kdupdater.h"
#include <QObject>
-#include <QRegExp>
QT_BEGIN_NAMESPACE
class QUrl;
@@ -36,7 +35,6 @@ namespace KDUpdater {
class PackagesInfo;
class UpdateSourcesInfo;
-static QRegExp scCommaRegExp(QLatin1String("\\b(,|, )\\b"));
class ConfigurationInterface
{
public:
diff --git a/src/libs/kdtools/kdupdaterpackagesinfo.cpp b/src/libs/kdtools/kdupdaterpackagesinfo.cpp
index 9ac2b8eac..142cf67b0 100644
--- a/src/libs/kdtools/kdupdaterpackagesinfo.cpp
+++ b/src/libs/kdtools/kdupdaterpackagesinfo.cpp
@@ -21,6 +21,7 @@
**********************************************************************/
#include "kdupdaterpackagesinfo.h"
#include "kdupdaterapplication.h"
+#include "globals.h"
#include <QFileInfo>
#include <QtXml/QDomDocument>
@@ -511,9 +512,10 @@ void PackagesInfo::PackagesInfoData::addPackageFrom(const QDomElement &packageE)
info.virtualComp = childNodeE.text().toLower() == QLatin1String("true") ? true : false;
else if (childNodeE.tagName() == QLatin1String("Size"))
info.uncompressedSize = childNodeE.text().toULongLong();
- else if (childNodeE.tagName() == QLatin1String("Dependencies"))
- info.dependencies = childNodeE.text().split(scCommaRegExp, QString::SkipEmptyParts);
- else if (childNodeE.tagName() == QLatin1String("ForcedInstallation"))
+ else if (childNodeE.tagName() == QLatin1String("Dependencies")) {
+ info.dependencies = childNodeE.text().split(QInstaller::commaRegExp(),
+ QString::SkipEmptyParts);
+ } else if (childNodeE.tagName() == QLatin1String("ForcedInstallation"))
info.forcedInstallation = childNodeE.text().toLower() == QLatin1String( "true" ) ? true : false;
else if (childNodeE.tagName() == QLatin1String("LastUpdateDate"))
info.lastUpdateDate = QDate::fromString(childNodeE.text(), Qt::ISODate);
diff --git a/src/libs/kdtools/kdupdaterupdatefinder.cpp b/src/libs/kdtools/kdupdaterupdatefinder.cpp
index caa66982e..0262dfc50 100644
--- a/src/libs/kdtools/kdupdaterupdatefinder.cpp
+++ b/src/libs/kdtools/kdupdaterupdatefinder.cpp
@@ -29,6 +29,8 @@
#include "kdupdaterfiledownloaderfactory.h"
#include "kdupdaterupdatesinfo_p.h"
+#include "globals.h"
+
#include <QCoreApplication>
#include <QDebug>
@@ -471,7 +473,7 @@ QList<UpdateInfo> UpdateFinder::Private::applicableUpdates(UpdatesInfo *updatesI
appName = appName.replace(QLatin1String( " ," ), QLatin1String( "," ));
// Catch hold of app names contained updatesInfo->applicationName()
- QStringList apps = appName.split(scCommaRegExp, QString::SkipEmptyParts);
+ QStringList apps = appName.split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
appNameIndex = apps.indexOf(this->application->applicationName());
// If the application appName isn't one of the app names, then
diff --git a/src/libs/kdtools/kdupdaterupdateoperation.cpp b/src/libs/kdtools/kdupdaterupdateoperation.cpp
index 40d2e5ada..6f09bc825 100644
--- a/src/libs/kdtools/kdupdaterupdateoperation.cpp
+++ b/src/libs/kdtools/kdupdaterupdateoperation.cpp
@@ -38,7 +38,7 @@
update operations. Concrete implementations of this class must perform a single update
operation like copy, move, delete etc.
- \note Two seperate threads cannot be using a single instance of KDUpdater::UpdateOperation
+ \note Two separate threads cannot be using a single instance of KDUpdater::UpdateOperation
at the same time.
*/
diff --git a/src/libs/kdtools/kdupdaterupdateoperations.cpp b/src/libs/kdtools/kdupdaterupdateoperations.cpp
index 8270bba03..51fcaf7b1 100644
--- a/src/libs/kdtools/kdupdaterupdateoperations.cpp
+++ b/src/libs/kdtools/kdupdaterupdateoperations.cpp
@@ -886,7 +886,7 @@ bool ExecuteOperation::performOperation()
0, 0, 0, STARTF_USESHOWWINDOW, SW_HIDE, 0, 0, 0, 0, 0
};
success = CreateProcess(0, (wchar_t*)arguments.utf16(),
- 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
+ 0, 0, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
0,
&startupInfo, &pinfo);
diff --git a/src/sdk/installerbase_p.h b/src/sdk/installerbase_p.h
index bea4c862f..cd6ed0142 100644
--- a/src/sdk/installerbase_p.h
+++ b/src/sdk/installerbase_p.h
@@ -66,7 +66,7 @@ class InstallerBase : public QObject
Q_OBJECT
public:
- InstallerBase(QObject *parent = 0);
+ explicit InstallerBase(QObject *parent = 0);
~InstallerBase();
int replaceMaintenanceToolBinary(QStringList arguments);
diff --git a/src/sdk/settingsdialog.cpp b/src/sdk/settingsdialog.cpp
index 5773d65c5..b9bfba617 100644
--- a/src/sdk/settingsdialog.cpp
+++ b/src/sdk/settingsdialog.cpp
@@ -54,6 +54,8 @@
#include <QtXml/QDomDocument>
+using namespace QInstaller;
+
// -- TestRepositoryJob
@@ -72,12 +74,12 @@ TestRepository::~TestRepository()
m_downloader->deleteLater();
}
-QInstaller::Repository TestRepository::repository() const
+Repository TestRepository::repository() const
{
return m_repository;
}
-void TestRepository::setRepository(const QInstaller::Repository &repository)
+void TestRepository::setRepository(const Repository &repository)
{
cancel();
@@ -93,13 +95,13 @@ void TestRepository::doStart()
const QUrl url = m_repository.url();
if (url.isEmpty()) {
- emitFinishedWithError(QInstaller::InvalidUrl, tr("Empty repository URL."));
+ emitFinishedWithError(InvalidUrl, tr("Empty repository URL."));
return;
}
m_downloader = KDUpdater::FileDownloaderFactory::instance().create(url.scheme(), this);
if (!m_downloader) {
- emitFinishedWithError(QInstaller::InvalidUrl, tr("URL scheme not supported: %1 (%2).")
+ emitFinishedWithError(InvalidUrl, tr("URL scheme not supported: %1 (%2).")
.arg(url.scheme(), url.toString()));
return;
}
@@ -132,7 +134,7 @@ void TestRepository::doCancel()
void TestRepository::downloadCompleted()
{
QString errorMsg;
- int error = QInstaller::DownloadError;
+ int error = DownloadError;
if (m_downloader->isDownloaded()) {
QFile file(m_downloader->downloadedFileName());
@@ -140,7 +142,7 @@ void TestRepository::downloadCompleted()
QDomDocument doc;
QString errorMsg;
if (!doc.setContent(&file, &errorMsg)) {
- error = QInstaller::InvalidUpdatesXml;
+ error = InvalidUpdatesXml;
errorMsg = tr("Could not parse Updates.xml! Error: %1.");
} else {
error = NoError;
@@ -163,7 +165,7 @@ void TestRepository::downloadCompleted()
void TestRepository::downloadAborted(const QString &reason)
{
- emitFinishedWithError(QInstaller::DownloadError, reason);
+ emitFinishedWithError(DownloadError, reason);
}
void TestRepository::onAuthenticatorChanged(const QAuthenticator &authenticator)
@@ -214,7 +216,7 @@ RepositoryItem::RepositoryItem(const QString &label)
m_repo = QInstaller::Repository(QUrl(), true);
}
-RepositoryItem::RepositoryItem(const QInstaller::Repository &repo)
+RepositoryItem::RepositoryItem(const Repository &repo)
: QTreeWidgetItem(QTreeWidgetItem::UserType)
, m_repo(repo)
{
@@ -302,9 +304,9 @@ void RepositoryItem::setData(int column, int role, const QVariant &value)
QTreeWidgetItem::setData(column, role, value);
}
-QSet<QInstaller::Repository> RepositoryItem::repositories() const
+QSet<Repository> RepositoryItem::repositories() const
{
- QSet<QInstaller::Repository> set;
+ QSet<Repository> set;
for (int i = 0; i < childCount(); ++i) {
if (QTreeWidgetItem *item = child(i)) {
if (item->type() == QTreeWidgetItem::UserType) {
@@ -319,7 +321,7 @@ QSet<QInstaller::Repository> RepositoryItem::repositories() const
// -- SettingsDialog
-SettingsDialog::SettingsDialog(QInstaller::PackageManagerCore *core, QWidget *parent)
+SettingsDialog::SettingsDialog(PackageManagerCore *core, QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::SettingsDialog)
, m_core(core)
@@ -328,15 +330,15 @@ SettingsDialog::SettingsDialog(QInstaller::PackageManagerCore *core, QWidget *pa
m_ui->setupUi(this);
setupRepositoriesTreeWidget();
- const QInstaller::Settings &settings = m_core->settings();
+ const Settings &settings = m_core->settings();
switch (settings.proxyType()) {
- case QInstaller::Settings::NoProxy:
+ case Settings::NoProxy:
m_ui->m_noProxySettings->setChecked(true);
break;
- case QInstaller::Settings::SystemProxy:
+ case Settings::SystemProxy:
m_ui->m_systemProxySettings->setChecked(true);
break;
- case QInstaller::Settings::UserDefinedProxy:
+ case Settings::UserDefinedProxy:
m_ui->m_manualProxySettings->setChecked(true);
break;
default:
@@ -381,8 +383,8 @@ SettingsDialog::SettingsDialog(QInstaller::PackageManagerCore *core, QWidget *pa
void SettingsDialog::accept()
{
bool settingsChanged = false;
- QInstaller::Settings newSettings;
- const QInstaller::Settings &settings = m_core->settings();
+ Settings newSettings;
+ const Settings &settings = m_core->settings();
// set possible updated default repositories
newSettings.setDefaultRepositories((dynamic_cast<RepositoryItem*> (m_rootItems.at(0)))->repositories());
@@ -399,14 +401,14 @@ void SettingsDialog::accept()
settingsChanged |= (settings.userRepositories() != newSettings.userRepositories());
// update proxy type
- newSettings.setProxyType(QInstaller::Settings::NoProxy);
+ newSettings.setProxyType(Settings::NoProxy);
if (m_ui->m_systemProxySettings->isChecked())
- newSettings.setProxyType(QInstaller::Settings::SystemProxy);
+ newSettings.setProxyType(Settings::SystemProxy);
else if (m_ui->m_manualProxySettings->isChecked())
- newSettings.setProxyType(QInstaller::Settings::UserDefinedProxy);
+ newSettings.setProxyType(Settings::UserDefinedProxy);
settingsChanged |= settings.proxyType() != newSettings.proxyType();
- if (newSettings.proxyType() == QInstaller::Settings::UserDefinedProxy) {
+ if (newSettings.proxyType() == Settings::UserDefinedProxy) {
// update ftp proxy settings
newSettings.setFtpProxy(QNetworkProxy(QNetworkProxy::HttpProxy, m_ui->m_ftpProxy->text(),
m_ui->m_ftpProxyPort->value(), m_ui->m_ftpProxyUser->text(), m_ui->m_ftpProxyPass->text()));
@@ -436,7 +438,7 @@ void SettingsDialog::addRepository()
}
if (parent) {
- QInstaller::Repository repository;
+ Repository repository;
repository.setEnabled(true);
RepositoryItem *item = new RepositoryItem(repository);
parent->insertChild(index, item);
@@ -537,7 +539,7 @@ void SettingsDialog::setupRepositoriesTreeWidget()
m_rootItems.append(new RepositoryItem(tr("User defined repositories")));
treeWidget->addTopLevelItems(m_rootItems);
- const QInstaller::Settings &settings = m_core->settings();
+ const Settings &settings = m_core->settings();
insertRepositories(settings.userRepositories(), m_rootItems.at(2));
insertRepositories(settings.defaultRepositories(), m_rootItems.at(0));
insertRepositories(settings.temporaryRepositories(), m_rootItems.at(1));
@@ -562,9 +564,9 @@ void SettingsDialog::setupRepositoriesTreeWidget()
m_delegate->disableEditing(false);
}
-void SettingsDialog::insertRepositories(const QSet<QInstaller::Repository> repos, QTreeWidgetItem *rootItem)
+void SettingsDialog::insertRepositories(const QSet<Repository> repos, QTreeWidgetItem *rootItem)
{
rootItem->setFirstColumnSpanned(true);
- foreach (const QInstaller::Repository &repo, repos)
+ foreach (const Repository &repo, repos)
rootItem->addChild(new RepositoryItem(repo));
}
diff --git a/src/sdk/settingsdialog.h b/src/sdk/settingsdialog.h
index f0d068a78..1a6633c67 100644
--- a/src/sdk/settingsdialog.h
+++ b/src/sdk/settingsdialog.h
@@ -77,7 +77,7 @@ class TestRepository : public KDJob
public:
- TestRepository(QObject *parent = 0);
+ explicit TestRepository(QObject *parent = 0);
~TestRepository();
QInstaller::Repository repository() const;
@@ -105,7 +105,7 @@ class PasswordDelegate : public QStyledItemDelegate
Q_OBJECT
public:
- PasswordDelegate(QWidget *parent = 0)
+ explicit PasswordDelegate(QWidget *parent = 0)
: QStyledItemDelegate(parent)
, m_showPasswords(true)
, m_disabledEditor(true)
@@ -129,8 +129,8 @@ private:
class RepositoryItem : public QTreeWidgetItem
{
public:
- RepositoryItem(const QString &label);
- RepositoryItem(const QInstaller::Repository &repo);
+ explicit RepositoryItem(const QString &label);
+ explicit RepositoryItem(const QInstaller::Repository &repo);
QVariant data(int column, int role) const;
void setData(int column, int role, const QVariant &value);
@@ -151,7 +151,7 @@ class SettingsDialog : public QDialog
Q_OBJECT
public:
- SettingsDialog(QInstaller::PackageManagerCore *core, QWidget *parent = 0);
+ explicit SettingsDialog(QInstaller::PackageManagerCore *core, QWidget *parent = 0);
public slots:
void accept();
diff --git a/tests/auto/installer/componentmodel/componentmodel.pro b/tests/auto/installer/componentmodel/componentmodel.pro
new file mode 100644
index 000000000..442986a96
--- /dev/null
+++ b/tests/auto/installer/componentmodel/componentmodel.pro
@@ -0,0 +1,8 @@
+include(../../qttest.pri)
+
+QT -= gui
+QT += network xml
+
+SOURCES += tst_componentmodel.cpp
+
+RESOURCES += components.qrc
diff --git a/tests/auto/installer/componentmodel/components.qrc b/tests/auto/installer/componentmodel/components.qrc
new file mode 100644
index 000000000..a2b530f13
--- /dev/null
+++ b/tests/auto/installer/componentmodel/components.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/updates.xml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/installer/componentmodel/data/updates.xml b/tests/auto/installer/componentmodel/data/updates.xml
new file mode 100644
index 000000000..e1f72de10
--- /dev/null
+++ b/tests/auto/installer/componentmodel/data/updates.xml
@@ -0,0 +1,132 @@
+<Updates>
+ <ApplicationName>Your application</ApplicationName>
+ <ApplicationVersion>1.2.3</ApplicationVersion>
+ <Checksum>true</Checksum>
+ <PackageUpdate>
+ <Name>com.vendor.product</Name>
+ <DisplayName>The root component</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Default>true</Default>
+ <Script>installscript.qs</Script>
+ <SortingPriority>1</SortingPriority>
+ <ForcedInstallation>true</ForcedInstallation>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.second.product</Name>
+ <DisplayName>The second root component</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Default>false</Default>
+ <Script>installscript.qs</Script>
+ <SortingPriority>1</SortingPriority>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.second.product.subnode</Name>
+ <DisplayName>A sub node component for the second root</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Default>false</Default>
+ <Script>installscript.qs</Script>
+ <SortingPriority>1</SortingPriority>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.second.product.subnode.sub</Name>
+ <DisplayName>A subcomponent for the second sub node of the second root</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Default>false</Default>
+ <Script>installscript.qs</Script>
+ <SortingPriority>1</SortingPriority>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.second.product.sub</Name>
+ <DisplayName>A subcomponent for the second root</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Script>installscript.qs</Script>
+ <Default>true</Default>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.second.product.sub1</Name>
+ <DisplayName>A subcomponent for the second root</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Default>false</Default>
+ <Script>installscript.qs</Script>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.second.product.virtual</Name>
+ <DisplayName>A virtual subcomponent for the second root</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Script>installscript.qs</Script>
+ <Virtual>true</Virtual>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>com.vendor.third.product.virtual</Name>
+ <DisplayName>A virtual root component</DisplayName>
+ <Description>Install this example.</Description>
+ <Version>0.1.0-1</Version>
+ <ReleaseDate>2010-09-21</ReleaseDate>
+ <Default>true</Default>
+ <Script>installscript.qs</Script>
+ <SortingPriority>0</SortingPriority>
+ <Virtual>true</Virtual>
+ <UpdateFile UncompressedSize="61"
+ CompressedSize="61"/>
+ <Licenses>
+ <License name="Beer Public License Agreement"
+ file="license.txt"/>
+ </Licenses>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/componentmodel/tst_componentmodel.cpp b/tests/auto/installer/componentmodel/tst_componentmodel.cpp
new file mode 100644
index 000000000..cfb83a27e
--- /dev/null
+++ b/tests/auto/installer/componentmodel/tst_componentmodel.cpp
@@ -0,0 +1,479 @@
+#include "component.h"
+#include "componentmodel.h"
+
+#include "kdupdaterupdatesinfo_p.h"
+#include "kdupdaterupdatesinfo.cpp"
+#include "kdupdaterupdatesourcesinfo.h"
+
+#include "packagemanagercore.h"
+
+#include <QTest>
+
+using namespace KDUpdater;
+using namespace QInstaller;
+
+#define EXPECTED_COUNT_VIRTUALS_VISIBLE 8
+#define EXPECTED_COUNT_VIRTUALS_INVISIBLE 7
+
+static const char vendorProduct[] = "com.vendor.product";
+static const char vendorSecondProduct[] = "com.vendor.second.product";
+static const char vendorSecondProductSub[] = "com.vendor.second.product.sub";
+static const char vendorSecondProductSub1[] = "com.vendor.second.product.sub1";
+static const char vendorSecondProductVirtual[] = "com.vendor.second.product.virtual";
+static const char vendorSecondProductSubnode[] = "com.vendor.second.product.subnode";
+static const char vendorSecondProductSubnodeSub[] = "com.vendor.second.product.subnode.sub";
+static const char vendorThirdProductVirtual[] = "com.vendor.third.product.virtual";
+
+class tst_ComponentModel : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum Option {
+ NoFlags = 0x00,
+ VirtualsVisible = 0x01,
+ NoForcedInstallation = 0x02
+ };
+ Q_DECLARE_FLAGS(Options, Option);
+
+private slots:
+ void initTestCase()
+ {
+ m_defaultChecked << vendorProduct << vendorSecondProductSub;
+ m_defaultPartially << vendorSecondProduct;
+ m_defaultUnchecked << vendorSecondProductSub1 << vendorSecondProductSubnode
+ << vendorSecondProductSubnodeSub;
+ }
+
+ void testNameToIndexAndIndexToName()
+ {
+ setPackageManagerOptions(NoFlags);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+
+ // all names should be resolvable, virtual components are not indexed if they are not visible
+ QStringList all;
+ all << m_defaultChecked << m_defaultPartially << m_defaultUnchecked;
+ foreach (const QString &name, all) {
+ QVERIFY(model.indexFromComponentName(name).isValid());
+ QVERIFY(model.componentFromIndex(model.indexFromComponentName(name)) != 0);
+ QCOMPARE(model.componentFromIndex(model.indexFromComponentName(name))->name(), name);
+ }
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testNameToIndexAndIndexToNameVirtualsVisible()
+ {
+ setPackageManagerOptions(VirtualsVisible);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+
+ // all names should be resolvable, including virtual components
+ QStringList all;
+ all << m_defaultChecked << m_defaultPartially << m_defaultUnchecked << vendorSecondProductVirtual
+ << vendorThirdProductVirtual;
+ foreach (const QString &name, all) {
+ QVERIFY(model.indexFromComponentName(name).isValid());
+ QVERIFY(model.componentFromIndex(model.indexFromComponentName(name)) != 0);
+ QCOMPARE(model.componentFromIndex(model.indexFromComponentName(name))->name(), name);
+ }
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testDefault()
+ {
+ setPackageManagerOptions(NoFlags);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ QCOMPARE(model.core(), &m_core);
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testVirtualsVisible()
+ {
+ setPackageManagerOptions(VirtualsVisible);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ // the virtual components are not checked
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked
+ + QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testNoForcedInstallation()
+ {
+ setPackageManagerOptions(NoForcedInstallation);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testVirtualsVisibleNoForcedInstallation()
+ {
+ setPackageManagerOptions(Options(VirtualsVisible | NoForcedInstallation));
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ // the virtual components are not checked
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked
+ + QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testSelect()
+ {
+ setPackageManagerOptions(NoFlags);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ // select all possible components
+ model.setCheckedState(ComponentModel::AllChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked, QStringList()
+ , QStringList());
+
+ // deselect all possible components
+ // as the first root is a forced install, should result in partially checked state
+ model.setCheckedState(ComponentModel::AllUnchecked);
+ QCOMPARE(model.checkedState(), ComponentModel::PartiallyChecked);
+ testModelState(&model, QStringList() << vendorProduct, QStringList(), m_defaultPartially
+ + m_defaultUnchecked + QStringList(vendorSecondProductSub));
+
+ // reset all possible components
+ model.setCheckedState(ComponentModel::DefaultChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testSelectVirtualsVisible()
+ {
+ setPackageManagerOptions(VirtualsVisible);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ // select all possible components
+ model.setCheckedState(ComponentModel::AllChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked
+ + QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual, QStringList(),
+ QStringList());
+
+ // deselect all possible components
+ // as the first root is a forced install, should result in partially checked state
+ model.setCheckedState(ComponentModel::AllUnchecked);
+ QCOMPARE(model.checkedState(), ComponentModel::PartiallyChecked);
+ testModelState(&model, QStringList() << vendorProduct, QStringList(), m_defaultPartially
+ + m_defaultUnchecked + QStringList(vendorSecondProductSub) << vendorSecondProductVirtual
+ << vendorThirdProductVirtual);
+
+ // reset all possible components
+ model.setCheckedState(ComponentModel::DefaultChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked
+ + QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testSelectNoForcedInstallation()
+ {
+ setPackageManagerOptions(NoForcedInstallation);
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ // select all possible components
+ model.setCheckedState(ComponentModel::AllChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked, QStringList()
+ , QStringList());
+
+ // deselect all possible components
+ model.setCheckedState(ComponentModel::AllUnchecked);
+ QCOMPARE(model.checkedState(), ComponentModel::AllUnchecked);
+ testModelState(&model, QStringList(), QStringList(), m_defaultPartially + m_defaultUnchecked
+ + QStringList(vendorSecondProductSub) << vendorProduct);
+
+ // reset all possible components
+ model.setCheckedState(ComponentModel::DefaultChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+ void testSelectVirtualsVisibleNoForcedInstallation()
+ {
+ setPackageManagerOptions(Options(VirtualsVisible | NoForcedInstallation));
+
+ QList<Component*> rootComponents = loadComponents();
+ testComponentsLoaded(rootComponents);
+
+ // setup the model with 1 column
+ ComponentModel model(1, &m_core);
+ model.setRootComponents(rootComponents);
+ testDefaultInheritedModelBehavior(&model, 1);
+
+ // select all possible components
+ model.setCheckedState(ComponentModel::AllChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked
+ + QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual, QStringList(),
+ QStringList());
+
+ // deselect all possible components
+ model.setCheckedState(ComponentModel::AllUnchecked);
+ QCOMPARE(model.checkedState(), ComponentModel::AllUnchecked);
+ testModelState(&model, QStringList(), QStringList(), m_defaultPartially + m_defaultUnchecked
+ + QStringList(vendorSecondProductSub) << vendorSecondProductVirtual << vendorProduct
+ << vendorThirdProductVirtual);
+
+ // reset all possible components
+ model.setCheckedState(ComponentModel::DefaultChecked);
+ QCOMPARE(model.checkedState(), ComponentModel::DefaultChecked);
+ testModelState(&model, m_defaultChecked, m_defaultPartially, m_defaultUnchecked
+ + QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual);
+
+ foreach (Component *const component, rootComponents)
+ delete component;
+ }
+
+private:
+ void setPackageManagerOptions(Options flags) const
+ {
+ m_core.setNoForceInstallation(flags.testFlag(NoForcedInstallation));
+ m_core.setVirtualComponentsVisible(flags.testFlag(VirtualsVisible));
+ }
+
+ void testComponentsLoaded(const QList<Component *> &rootComponents) const
+ {
+ // we need to have three root components
+ QCOMPARE(rootComponents.count(), 3);
+
+ QList<Component*> components = rootComponents;
+ foreach (Component *const component, rootComponents)
+ components.append(component->childItems());
+
+ // will differ between 6 and 7 components, (2 root nodes, 1 sub node, 3 non virtual and 1 virtual)
+ QCOMPARE(components.count(), m_core.virtualComponentsVisible() ? EXPECTED_COUNT_VIRTUALS_VISIBLE
+ : EXPECTED_COUNT_VIRTUALS_INVISIBLE);
+ }
+
+ void testDefaultInheritedModelBehavior(ComponentModel *model, int columnCount) const
+ {
+ // row count with invalid model index should return:
+ if (m_core.virtualComponentsVisible())
+ QCOMPARE(model->rowCount(), 3); // 3 (2 non virtual and 1 virtual root component)
+ else
+ QCOMPARE(model->rowCount(), 2); // 2 (the 2 non virtual root components)
+ QCOMPARE(model->columnCount(), columnCount);
+
+ const QModelIndex firstParent = model->indexFromComponentName(vendorProduct);
+ const QModelIndex secondParent = model->indexFromComponentName(vendorSecondProduct);
+ const QModelIndex thirdParent = model->indexFromComponentName(vendorThirdProductVirtual);
+
+ // return invalid indexes, as they are the root components
+ QCOMPARE(model->parent(firstParent), QModelIndex());
+ QCOMPARE(model->parent(secondParent), QModelIndex());
+ QCOMPARE(model->parent(thirdParent), QModelIndex());
+
+ // test valid indexes
+ QVERIFY(firstParent.isValid());
+ QVERIFY(secondParent.isValid());
+ QVERIFY(model->indexFromComponentName(vendorSecondProductSub).isValid());
+ QVERIFY(model->indexFromComponentName(vendorSecondProductSub1).isValid());
+ QVERIFY(model->indexFromComponentName(vendorSecondProductSubnode).isValid());
+ QVERIFY(model->indexFromComponentName(vendorSecondProductSubnodeSub).isValid());
+
+ // they should have the same parent
+ QCOMPARE(model->parent(model->indexFromComponentName(vendorSecondProductSub)), secondParent);
+ QCOMPARE(model->parent(model->indexFromComponentName(vendorSecondProductSub1)), secondParent);
+ QCOMPARE(model->parent(model->indexFromComponentName(vendorSecondProductSubnode)), secondParent);
+
+ const QModelIndex forthParent = model->indexFromComponentName(vendorSecondProductSubnode);
+ QCOMPARE(model->parent(model->indexFromComponentName(vendorSecondProductSubnodeSub)), forthParent);
+
+ // row count should be 0, as they have no children
+ QCOMPARE(model->rowCount(firstParent), 0);
+ QCOMPARE(model->rowCount(model->indexFromComponentName(vendorSecondProductSub)), 0);
+ QCOMPARE(model->rowCount(model->indexFromComponentName(vendorSecondProductSub1)), 0);
+ QCOMPARE(model->rowCount(model->indexFromComponentName(vendorSecondProductSubnodeSub)), 0);
+
+ if (m_core.virtualComponentsVisible()) {
+ // test valid index
+ QVERIFY(thirdParent.isValid());
+ QCOMPARE(model->rowCount(thirdParent), 0);
+
+ QVERIFY(model->indexFromComponentName(vendorSecondProductVirtual).isValid());
+ QCOMPARE(model->rowCount(model->indexFromComponentName(vendorSecondProductVirtual)), 0);
+ QCOMPARE(model->parent(model->indexFromComponentName(vendorSecondProductVirtual)), secondParent);
+ // row count should be 4, (2 standard, 1 virtual, 1 sub node)
+ QCOMPARE(model->rowCount(secondParent), 4);
+ } else {
+ // test invalid index
+ QVERIFY(!thirdParent.isValid());
+
+ // row count should be 3, (2 standard, 1 sub node, omit the virtual)
+ QCOMPARE(model->rowCount(secondParent), 3);
+ }
+ // row count should be 1, 1 sub node
+ QCOMPARE(model->rowCount(model->indexFromComponentName(vendorSecondProductSubnode)), 1);
+ }
+
+ void testModelState(ComponentModel *model, const QStringList &checked, const QStringList &partially,
+ const QStringList &unchecked) const
+ {
+ QCOMPARE(model->checked().count(), checked.count());
+ QCOMPARE(model->partially().count(), partially.count());
+ QCOMPARE(model->unchecked().count(), unchecked.count());
+
+ // these components should have checked state
+ foreach (Component *const component, model->checked())
+ QVERIFY(checked.contains(component->name()));
+
+ // these components should not have partially checked state
+ foreach (Component *const component, model->partially())
+ QVERIFY(partially.contains(component->name()));
+
+ // these components should not have checked state
+ foreach (Component *const component, model->unchecked())
+ QVERIFY(unchecked.contains(component->name()));
+ }
+
+ QList<Component*> loadComponents() const
+ {
+ UpdatesInfo updatesInfo;
+ updatesInfo.setFileName(":///data/updates.xml");
+ const QList<UpdateInfo> updateInfos = updatesInfo.updatesInfo(PackageUpdate);
+
+ QHash<QString, Component*> components;
+ foreach (const UpdateInfo &info, updateInfos) {
+ Component *component = new Component(const_cast<PackageManagerCore *>(&m_core));
+
+ // we need at least these to be able to test the model
+ component->setValue("Name", info.data.value("Name").toString());
+ component->setValue("Default", info.data.value("Default").toString());
+ component->setValue("Virtual", info.data.value("Virtual").toString());
+ component->setValue("DisplayName", info.data.value("DisplayName").toString());
+
+ QString forced = info.data.value("ForcedInstallation", scFalse).toString().toLower();
+ if (m_core.noForceInstallation())
+ forced = scFalse;
+ component->setValue("ForcedInstallation", forced);
+ if (forced == scTrue) {
+ component->setEnabled(false);
+ component->setCheckable(false);
+ component->setCheckState(Qt::Checked);
+ }
+ components.insert(component->name(), component);
+ }
+
+ QList <Component*> rootComponents;
+ foreach (QString id, components.keys()) {
+ QInstaller::Component *component = components.value(id);
+ while (!id.isEmpty() && component->parentComponent() == 0) {
+ id = id.section(QLatin1Char('.'), 0, -2);
+ if (components.contains(id))
+ components[id]->appendComponent(component);
+ }
+ }
+
+ foreach (QInstaller::Component *component, components) {
+ if (component->parentComponent() == 0)
+ rootComponents.append(component);
+
+ if (component->isCheckable() && component->isDefault() && (!component->isTristate()))
+ component->setCheckState(Qt::Checked);
+ }
+ return rootComponents;
+ }
+
+private:
+ PackageManagerCore m_core;
+
+ QStringList m_defaultChecked;
+ QStringList m_defaultPartially;
+ QStringList m_defaultUnchecked;
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(tst_ComponentModel::Options)
+
+QTEST_MAIN(tst_ComponentModel)
+
+#include "tst_componentmodel.moc"
diff --git a/tests/auto/installer/installer.pro b/tests/auto/installer/installer.pro
index 911e1ad75..67a454db7 100644
--- a/tests/auto/installer/installer.pro
+++ b/tests/auto/installer/installer.pro
@@ -3,4 +3,5 @@ TEMPLATE = subdirs
SUBDIRS += \
settings \
repository \
+ componentmodel \
fakestopprocessforupdateoperation
diff --git a/tests/auto/installer/settings/data/full_config.xml b/tests/auto/installer/settings/data/full_config.xml
index cde9f6310..36309f609 100644
--- a/tests/auto/installer/settings/data/full_config.xml
+++ b/tests/auto/installer/settings/data/full_config.xml
@@ -15,6 +15,8 @@ File should contain all elements we allow in a config.xml
<AdminTargetDir>@rootDir@InstallationDirectory</AdminTargetDir>
<Icon>icon</Icon>
+ <InstallerApplicationIcon>icon</InstallerApplicationIcon>
+ <InstallerWindowIcon>icon</InstallerWindowIcon>
<Logo>logo</Logo>
<Watermark>watermark</Watermark>
<Background>background</Background>
@@ -26,6 +28,7 @@ File should contain all elements we allow in a config.xml
<RemoveTargetDir>true</RemoveTargetDir>
<RunProgram>myapp</RunProgram>
+ <RunProgramArguments>foo bar</RunProgramArguments>
<RunProgramDescription>Launch MyApp</RunProgramDescription>
<DependsOnLocalInstallerBinary>true</DependsOnLocalInstallerBinary>
@@ -42,126 +45,4 @@ File should contain all elements we allow in a config.xml
<Password>password</Password>
</Repository>
</RemoteRepositories>
-
- <Pages>
- <Page name="IntroductionPage">
- <Title>
- <Default>Introduction Page Title</Default>
- </Title>
- <SubTitle>
- <Default>Introduction Page Sub Title</Default>
- </SubTitle>
- <MessageLabel>Introduction Page Message Label</MessageLabel>
- </Page>
- <Page name="LicenseAgreementPage">
- <Title>
- <Default>License Agreement Page Title</Default>
- </Title>
- <SubTitle>
- <Default>License Agreement Page Sub Title</Default>
- </SubTitle>
- <AcceptLicenseLabel>Accept License Radio Button</AcceptLicenseLabel>
- <RejectLicenseLabel>Reject License Radio Button</RejectLicenseLabel>
- </Page>
- <Page name="ComponentSelectionPage">
- <Title>
- <Default>Component Selection Page Title</Default>
- <Updater>Component Selection Page Sub Title Updater</Updater>
- <Installer>Component Selection Page Sub Title Installer</Installer>
- <Uninstaller>Component Selection Page Sub Title Uninstaller</Uninstaller>
- <PackageManager>Component Selection Page Sub Title Package Manager</PackageManager>
- </Title>
- <SubTitle>
- <Default>Component Selection Page Sub Title</Default>
- <Updater>Component Selection Page Sub Title Updater</Updater>
- <Installer>Component Selection Page Sub Title Installer</Installer>
- <Uninstaller>Component Selection Page Sub Title Uninstaller</Uninstaller>
- <PackageManager>Component Selection Page Sub Title Package Manager</PackageManager>
- </SubTitle>
- <SelectDefaultComponentsButton>Default Button</SelectDefaultComponentsButton>
- <SelectAllComponentsButton>Select All Button</SelectAllComponentsButton>
- <DeselectAllComponentsButton>Deselect All Button</DeselectAllComponentsButton>
- <ComponentSizeLabel>Component Size Label</ComponentSizeLabel>
- </Page>
- <Page name="TargetDirectoryPage">
- <Title>
- <Default>Target Directory Page Title</Default>
- </Title>
- <SubTitle>
- <Default>Target Directory Page Sub Title</Default>
- </SubTitle>
- <MessageLabel>Target Directory Page Message Label</MessageLabel>
- <BrowseDirectoryButton>Browse Directory Button</BrowseDirectoryButton>
- <EmptyTargetDirectoryMessage>Empty Target Directory Message</EmptyTargetDirectoryMessage>
- <ForbiddenTargetDirectoryMessage>Forbidden Target Directory Message</ForbiddenTargetDirectoryMessage>
- <OverwriteTargetDirectoryMessage>Overwrite Target Directory Message</OverwriteTargetDirectoryMessage>
- <SelectInstallationFolderCaption>Select Installation Folder Caption</SelectInstallationFolderCaption>
- </Page>
- <Page name="StartMenuDirectoryPage">
- <Title>
- <Default>Start Menu Directory Page Title</Default>
- </Title>
- <SubTitle>
- <Default>Start Menu Directory Page Sub Title</Default>
- </SubTitle>
- </Page>
- <Page name="ReadyForInstallationPage">
- <Title>
- <Default>Ready for Installation Page Title</Default>
- <Updater>Ready for Installation Page Title Updater</Updater>
- <Installer>Ready for Installation Page Title Installer</Installer>
- <Uninstaller>Ready for Installation Page Title Uninstaller</Uninstaller>
- <PackageManager>Ready for Installation Page Title Package Manager</PackageManager>
- </Title>
- <SubTitle>
- <Default>Ready for Installation Page Sub Title</Default>
- <Updater>Ready for Installation Page Sub Title Updater</Updater>
- <Installer>Ready for Installation Page Sub Title Installer</Installer>
- <Uninstaller>Ready for Installation Page Sub Title Uninstaller</Uninstaller>
- <PackageManager>Ready for Installation Page Sub Title Package Manager</PackageManager>
- </SubTitle>
- <MessageLabel>Ready for Installation Page Message Label</MessageLabel>
- </Page>
- <Page name="PerformInstallationPage">
- <Title>
- <Default>Perform Installation Page Title</Default>
- <Updater>Perform Installation Page Title Updater</Updater>
- <Installer>Perform Installation Page Title Installer</Installer>
- <Uninstaller>Perform Installation Page Title Uninstaller</Uninstaller>
- <PackageManager>Perform Installation Page Title Package Manager</PackageManager>
- </Title>
- <SubTitle>
- <Default>Perform Installation Page Sub Title</Default>
- <Updater>Perform Installation Page Sub Title Updater</Updater>
- <Installer>Perform Installation Page Sub Title Installer</Installer>
- <Uninstaller>Perform Installation Page Sub Title Uninstaller</Uninstaller>
- <PackageManager>Perform Installation Page Sub Title Package Manager</PackageManager>
- </SubTitle>
- </Page>
- <Page name ="FinishedPage">
- <Title>
- <Default>Finished Page Title</Default>
- <Updater>Finished Page Title Updater</Updater>
- <Installer>Finished Page Title Installer</Installer>
- <Uninstaller>Finished Page Title Uninstaller</Uninstaller>
- <PackageManager>Finished Page Title Package Manager</PackageManager>
- </Title>
- <SubTitle>
- <Default>Finished Page Sub Title</Default>
- <Updater>Finished Page Sub Title Updater</Updater>
- <Installer>Finished Page Sub Title Installer</Installer>
- <Uninstaller>Finished Page Sub Title Uninstaller</Uninstaller>
- <PackageManager>Finished Page Sub Title Package Manager</PackageManager>
- </SubTitle>
- <MessageLabel>Finished Page Message Label</MessageLabel>
- </Page>
- <Page name="RestartPage">
- <Title>
- <Default>Restart Page Title</Default>
- </Title>
- <SubTitle>
- <Default>Restart Page Sub Title</Default>
- </SubTitle>
- </Page>
- </Pages>
</Installer>
diff --git a/tests/auto/installer/settings/tst_settings.cpp b/tests/auto/installer/settings/tst_settings.cpp
index 1cc0fef00..5d4cbd9b3 100644
--- a/tests/auto/installer/settings/tst_settings.cpp
+++ b/tests/auto/installer/settings/tst_settings.cpp
@@ -40,12 +40,19 @@ void tst_Settings::loadTutorialConfig()
QCOMPARE(settings.background(), QLatin1String(":///data/"));
#if defined(Q_OS_WIN)
QCOMPARE(settings.icon(), QLatin1String(":/installer.ico"));
+ QCOMPARE(settings.installerApplicationIcon(), QLatin1String(":/installer.ico"));
+ QCOMPARE(settings.installerWindowIcon(), QLatin1String(":/installer.ico"));
#elif defined(Q_OS_MAC)
QCOMPARE(settings.icon(), QLatin1String(":/installer.icns"));
+ QCOMPARE(settings.installerApplicationIcon(), QLatin1String(":/installer.icns"));
+ QCOMPARE(settings.installerWindowIcon(), QLatin1String(":/installer.icns"));
#else
QCOMPARE(settings.icon(), QLatin1String(":/installer.png"));
+ QCOMPARE(settings.installerApplicationIcon(), QLatin1String(":/installer.png"));
+ QCOMPARE(settings.installerWindowIcon(), QLatin1String(":/installer.png"));
#endif
QCOMPARE(settings.runProgram(), QString());
+ QCOMPARE(settings.runProgramArguments(), QString());
QCOMPARE(settings.runProgramDescription(), QString());
QCOMPARE(settings.adminTargetDir(), QString());
QCOMPARE(settings.removeTargetDir(), QLatin1String("true"));
@@ -71,7 +78,7 @@ void tst_Settings::loadTutorialConfig()
void tst_Settings::loadFullConfig()
{
- QTest::ignoreMessage(QtWarningMsg, "Deprecated element 'Pages'. ");
+ QTest::ignoreMessage(QtWarningMsg, "Deprecated element 'Icon'. ");
Settings settings =
Settings::fromFileAndPrefix(":///data/full_config.xml", ":///data");
}
diff --git a/tests/downloadspeed/main.cpp b/tests/downloadspeed/main.cpp
index 6611ec17a..5a5b685aa 100644
--- a/tests/downloadspeed/main.cpp
+++ b/tests/downloadspeed/main.cpp
@@ -42,6 +42,8 @@
#include <kdupdaterfiledownloader.h>
#include <kdupdaterfiledownloaderfactory.h>
+#include <fileutils.h>
+
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QObject>
@@ -49,26 +51,6 @@
#include <QtNetwork/QNetworkProxy>
-static QString humanReadableSize(quint64 intSize)
-{
- QString unit;
- double size;
-
- if (intSize < 1024 * 1024) {
- size = 1. + intSize / 1024.;
- unit = QObject::tr("kB");
- } else if (intSize < 1024 * 1024 * 1024) {
- size = 1. + intSize / 1024. / 1024.;
- unit = QObject::tr("MB");
- } else {
- size = 1. + intSize / 1024. / 1024. / 1024.;
- unit = QObject::tr("GB");
- }
-
- size = qRound(size * 10) / 10.0;
- return QString::fromLatin1("%L1 %2").arg(size, 0, 'g', 4).arg(unit);
-}
-
// -- Receiver
class Receiver : public QObject
@@ -100,7 +82,8 @@ public slots:
void downloadSpeed(qint64 speed)
{
- qDebug() << "Download speed:" << humanReadableSize(speed) + QLatin1String("/sec");
+ qDebug() << "Download speed:" <<
+ QInstaller::humanReadableSize(speed) + QLatin1String("/sec");
}
void downloadProgress(double progress)
diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp
index 594686e61..d247525ea 100644
--- a/tools/binarycreator/binarycreator.cpp
+++ b/tools/binarycreator/binarycreator.cpp
@@ -154,8 +154,14 @@ Q_UNUSED(settings)
pkgInfoStream << QLatin1String("APPL????") << endl;
}
- const QString iconFile = QFile::exists(settings.icon()) ? settings.icon()
- : QString::fromLatin1(":/resources/default_icon_mac.icns");
+ QString iconFile;
+ if (QFile::exists(settings.installerApplicationIcon())) {
+ iconFile = settings.installerApplicationIcon();
+ } else {
+ iconFile = QFile::exists(settings.icon()) ? settings.icon()
+ : QString::fromLatin1(":/resources/default_icon_mac.icns");
+ }
+
const QString iconTargetFile = fi.completeBaseName() + QLatin1String(".icns");
QFile::copy(iconFile, fi.filePath() + QLatin1String("/Contents/Resources/") + iconTargetFile);
@@ -218,9 +224,13 @@ Q_UNUSED(settings)
#if defined(Q_OS_WIN)
// setting the windows icon must happen before we append our binary data - otherwise they get lost :-/
- if (QFile::exists(settings.icon())) {
+ if (QFile::exists(settings.installerApplicationIcon())) {
// no error handling as this is not fatal
- setApplicationIcon(tempFile, settings.icon());
+ setApplicationIcon(tempFile, settings.installerApplicationIcon());
+ } else {
+ if (QFile::exists(settings.icon())) {
+ setApplicationIcon(tempFile, settings.icon());
+ }
}
#elif defined(Q_OS_MAC)
if (isBundle) {
@@ -311,14 +321,14 @@ Q_UNUSED(settings)
} catch (const Error &e) {
qCritical("Error occurred while assembling the installer: %s", qPrintable(e.message()));
QFile::remove(tempFile);
- return 1;
+ return EXIT_FAILURE;
}
if (!out.commit(KDSaveFile::OverwriteExistingFile)) {
qCritical("Could not write installer to %s: %s", qPrintable(out.fileName()),
qPrintable(out.errorString()));
QFile::remove(tempFile);
- return 1;
+ return EXIT_FAILURE;
}
#ifndef Q_OS_WIN
chmod755(out.fileName());
@@ -342,7 +352,7 @@ Q_UNUSED(settings)
qDebug() << "done." << mkdmgscript;
}
#endif
- return 0;
+ return EXIT_SUCCESS;
}
QT_BEGIN_NAMESPACE
@@ -478,23 +488,23 @@ static QString createMetaDataDirectory(const QInstallerTools::PackageInfoVector
generateMetaDataDirectory(metapath, packagesDir, packages, settings.applicationName(),
settings.applicationVersion());
- const QString configCopy = metapath + QLatin1String("/installer-config");
- QInstaller::mkdir(configCopy);
+ const QString tempConfigDirPath = metapath + QLatin1String("/installer-config");
+ QInstaller::mkdir(tempConfigDirPath);
QString absoluteConfigPath = QFileInfo(configFile).absolutePath();
QDirIterator it(absoluteConfigPath, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
while (it.hasNext()) {
const QString next = it.next();
- if (next.contains(QLatin1String("/."))) // skip files that are in directories starting with a point
+ if (next.contains(QLatin1String("/."))) // skip files that are in directories starting with a dot
continue;
- qDebug() << "\tFound configuration file: " << next;
+ qDebug() << "Found configuration file: " << next;
const QFileInfo sourceFileInfo(next);
const QString source = sourceFileInfo.absoluteFilePath();
- QFileInfo targetFileInfo(configCopy, QFileInfo(next).fileName());
+ QFileInfo targetFileInfo(tempConfigDirPath, QFileInfo(next).fileName());
if (QFileInfo(next).fileName() == QFileInfo(configFile).fileName())
- targetFileInfo.setFile(configCopy, QLatin1String("config.xml"));
+ targetFileInfo.setFile(tempConfigDirPath, QLatin1String("config.xml"));
const QDir targetDir = targetFileInfo.dir();
if (!targetDir.exists())
@@ -514,42 +524,41 @@ static QString createMetaDataDirectory(const QInstallerTools::PackageInfoVector
// iterate over all child elements, searching for relative file names
const QDomNodeList children = dom.documentElement().childNodes();
for (int i = 0; i < children.count(); ++i) {
- QDomElement el = children.at(i).toElement();
- if (el.isNull())
+ QDomElement domElement = children.at(i).toElement();
+ if (domElement.isNull())
continue;
- QFileInfo fi(absoluteConfigPath, el.text());
+ QFileInfo elementFileInfo(absoluteConfigPath, domElement.text());
#if defined(Q_OS_MAC)
- const QFileInfo fiIcon(absoluteConfigPath, el.text() + QLatin1String(".icns"));
+ const QFileInfo iconFileInfo(absoluteConfigPath, domElement.text() + QLatin1String(".icns"));
#elif defined(Q_OS_WIN)
- const QFileInfo fiIcon(absoluteConfigPath, el.text() + QLatin1String(".ico"));
+ const QFileInfo iconFileInfo(absoluteConfigPath, domElement.text() + QLatin1String(".ico"));
#else
- const QFileInfo fiIcon(absoluteConfigPath, el.text() + QLatin1String(".png"));
+ const QFileInfo iconFileInfo(absoluteConfigPath, domElement.text() + QLatin1String(".png"));
#endif
- if (!fi.exists() && fiIcon.exists())
- fi = fiIcon;
+ if (!elementFileInfo.exists() && iconFileInfo.exists())
+ elementFileInfo = iconFileInfo;
- if (!fi.exists() || fi.absolutePath() == QFileInfo(configFile).dir().absolutePath())
+ if (!elementFileInfo.exists() || elementFileInfo.absolutePath() == QFileInfo(configFile).dir().absolutePath())
continue;
- if (fi.isDir())
+ if (elementFileInfo.isDir())
continue;
- const QString newName = el.text().replace(QRegExp(QLatin1String("\\\\|/|\\.")),
+ const QString newName = domElement.text().replace(QRegExp(QLatin1String("\\\\|/|\\.")),
QLatin1String("_"));
if (!QFile::exists(targetDir.absoluteFilePath(newName))) {
- if (!QFile::copy(fi.absoluteFilePath(), targetDir.absoluteFilePath(newName)))
- throw Error(QString::fromLatin1("Could not copy %1.").arg(el.text()));
+ if (!QFile::copy(elementFileInfo.absoluteFilePath(), targetDir.absoluteFilePath(newName)))
+ throw Error(QString::fromLatin1("Could not copy %1.").arg(domElement.text()));
}
- el.removeChild(el.firstChild());
- el.appendChild(dom.createTextNode(newName));
+ domElement.replaceChild(dom.createTextNode(newName), domElement.firstChild());
}
openForWrite(&configXml, configXml.fileName());
QTextStream stream(&configXml);
dom.save(stream, 4);
- qDebug() << "\tdone.";
+ qDebug() << "done.\n";
}
}
return metapath;
@@ -706,31 +715,31 @@ int main(int argc, char **argv)
qDebug() << "Parsed arguments, ok.";
+ int exitCode = EXIT_FAILURE;
+ QString tmpMetaDir;
try {
QInstallerTools::PackageInfoVector packages = createListOfPackages(packagesDirectory,
filteredPackages, ftype);
- const QString metaDir = createMetaDataDirectory(packages, packagesDirectory, configFile);
+ tmpMetaDir = createMetaDataDirectory(packages, packagesDirectory, configFile);
{
- QSettings confInternal(metaDir + QLatin1String("/config/config-internal.ini")
+ QSettings confInternal(tmpMetaDir + QLatin1String("/config/config-internal.ini")
, QSettings::IniFormat);
confInternal.setValue(QLatin1String("offlineOnly"), offlineOnly);
}
#if defined(Q_OS_MAC)
// on mac, we enforce building a bundle
- if (!target.endsWith(QLatin1String(".app")) && !target.endsWith(QLatin1String(".dmg"))) {
+ if (!target.endsWith(QLatin1String(".app")) && !target.endsWith(QLatin1String(".dmg")))
target += QLatin1String(".app");
- }
#endif
- int result = EXIT_FAILURE;
{
Input input;
input.outputPath = target;
input.installerExePath = templateBinary;
- input.binaryResourcePath = createBinaryResourceFile(metaDir);
+ input.binaryResourcePath = createBinaryResourceFile(tmpMetaDir);
input.binaryResources = createBinaryResourceFiles(resources);
- QInstallerTools::copyComponentData(packagesDirectory, metaDir, packages);
+ QInstallerTools::copyComponentData(packagesDirectory, tmpMetaDir, packages);
// now put the packages into the components section of the binary
foreach (const QInstallerTools::PackageInfo &info, packages) {
@@ -740,7 +749,7 @@ int main(int argc, char **argv)
qDebug() << "Creating component info for" << info.name;
foreach (const QString &archive, info.copiedArchives) {
const QSharedPointer<Archive> arch(new Archive(archive));
- qDebug() << QString::fromLatin1("\tAppending %1 (%2)").arg(archive,
+ qDebug() << QString::fromLatin1("Appending %1 (%2)").arg(archive,
humanReadableSize(arch->size()));
comp.appendArchive(arch);
}
@@ -748,7 +757,7 @@ int main(int argc, char **argv)
}
qDebug() << "Creating the binary";
- result = assemble(input, configFile);
+ exitCode = assemble(input, configFile);
// cleanup
qDebug() << "Cleaning up...";
@@ -756,14 +765,11 @@ int main(int argc, char **argv)
foreach (const QString &resource, input.binaryResources)
QFile::remove(resource);
}
- removeDirectory(metaDir, true);
- return result;
} catch (const Error &e) {
std::cerr << "caught exception: " << e.message() << std::endl;
- return EXIT_FAILURE;
} catch (...) {
std::cerr << "Unknown exception caught" << std::endl;
- return EXIT_FAILURE;
}
- return EXIT_FAILURE;
+ removeDirectory(tmpMetaDir, true);
+ return exitCode;
}
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index dcf6b6133..fdad96871 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -42,6 +42,7 @@
#include <fileutils.h>
#include <errors.h>
+#include <globals.h>
#include <lib7z_facade.h>
#include <settings.h>
#include <qinstallerglobal.h>
@@ -72,6 +73,31 @@ void QInstallerTools::printRepositoryGenOptions()
std::cout << " --ignore-invalid-packages Ignore all invalid packages instead of aborting." << std::endl;
}
+void QInstallerTools::copyWithException(const QString &source, const QString &target, const QString &kind)
+{
+ QFile sourceFile(source);
+ qDebug() << QString::fromLatin1("Copying associated %1 file '%2'").arg(kind, source);
+
+ const QFileInfo targetFileInfo(target);
+ const QDir targetDir = targetFileInfo.dir();
+ if (!targetDir.exists())
+ QInstaller::mkpath(targetFileInfo.absolutePath());
+
+ // in the case of an existing target the error String does not show the file
+ if (targetFileInfo.exists()) {
+ qDebug() << "failed!\n";
+ throw QInstaller::Error(QString::fromLatin1("Could not copy the %1 file from\n'%2' to '%3'\nError: '%4'."
+ ).arg(kind, source, target, QLatin1String("Target already exist.")));
+ }
+
+ if (!sourceFile.copy(target)) {
+ qDebug() << "failed!\n";
+ throw QInstaller::Error(QString::fromLatin1("Could not copy the %1 file.\nError: '%2'"
+ ).arg(kind, sourceFile.errorString()));
+ }
+ qDebug() << "done.\n";
+}
+
void QInstallerTools::compressPaths(const QStringList &paths, const QString &archivePath)
{
QFile archive(archivePath);
@@ -106,7 +132,6 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
QString metapath = outDir;
if (QFileInfo(metapath).isRelative())
metapath = QDir::cleanPath(QDir::current().absoluteFilePath(metapath));
- qDebug() << "Generating meta data...";
if (!QFile::exists(metapath))
QInstaller::mkpath(metapath);
@@ -133,7 +158,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
for (PackageInfoVector::const_iterator it = packages.begin(); it != packages.end(); ++it) {
const QString packageXmlPath = QString::fromLatin1("%1/meta/package.xml").arg(it->directory);
- qDebug() << QString::fromLatin1("\tGenerating meta data for package %1 using %2.").arg(
+ qDebug() << QString::fromLatin1("Generating meta data for package '%1' using '%2'.").arg(
it->name, packageXmlPath);
// remove existing entry for this component from existing Updates.xml
@@ -189,7 +214,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
const QString value = node.toElement().text();
QDomElement element = doc.createElement(key);
- for (int i = 0; i < node.attributes().size(); i++) {
+ for (int i = 0; i < node.attributes().size(); ++i) {
element.setAttribute(node.attributes().item(i).toAttr().name(),
node.attributes().item(i).toAttr().value());
}
@@ -213,14 +238,12 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
quint64 compressedComponentSize = 0;
const QDir::Filters filters = QDir::Files | QDir::NoDotAndDotDot;
- const QDir cmpDataDir = QString::fromLatin1("%1/%2/data").arg(dataDir, it->name);
- const QFileInfoList entries = cmpDataDir.exists() ? cmpDataDir.entryInfoList(filters | QDir::Dirs)
+ const QDir componentDataDir = QString::fromLatin1("%1/%2/data").arg(dataDir, it->name);
+ const QFileInfoList entries = componentDataDir.exists() ? componentDataDir.entryInfoList(filters | QDir::Dirs)
: QDir(QString::fromLatin1("%1/%2").arg(dataDir, it->name)).entryInfoList(filters);
+ qDebug() << QString::fromLatin1("calculate size of directory: %1").arg(componentDataDir.absolutePath());
foreach (const QFileInfo &fi, entries) {
- if (fi.isHidden())
- continue;
-
try {
if (fi.isDir()) {
QDirIterator recursDirIt(fi.filePath(), QDirIterator::Subdirectories);
@@ -285,15 +308,9 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
requiresAdminRightsElement.appendChild(doc.createTextNode(QLatin1String("true")));
}
- qDebug() << "\tCopying associated script" << script << "into the meta package...";
+ const QString kind(QLatin1String("script"));
QString toLocation(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, script));
- if (!scriptFile.copy(toLocation)) {
- qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the script '%1' to its target location '%2'.")
- .arg(fromLocation, toLocation));
- } else {
- qDebug() << "\tdone.";
- }
+ copyWithException(fromLocation, toLocation, kind);
}
// copy user interfaces
@@ -311,17 +328,12 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
"copying user interfaces of '%2'.").arg(node.toElement().text(), it->name));
}
+ const QString kind(QLatin1String("user interface"));
for (QStringList::const_iterator ui = uis.begin(); ui != uis.end(); ++ui) {
- qDebug() << "\tCopying associated user interface" << *ui << "into the meta package...";
+ const QString source(QString::fromLatin1("%1/meta/%2").arg(it->directory, *ui));
+ const QString target(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *ui));
userinterfaces.push_back(*ui);
- if (!QFile::copy(QString::fromLatin1("%1/meta/%2").arg(it->directory, *ui),
- QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *ui))) {
- qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the UI file '%1' to its target "
- "location '%2'.").arg(*ui, it->name));
- } else {
- qDebug() << "done";
- }
+ copyWithException(source, target, kind);
}
}
@@ -346,17 +358,12 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
"while copying translations of '%2'.").arg(node.toElement().text(), it->name));
}
+ const QString kind(QLatin1String("translation"));
for (QStringList::const_iterator qm = qms.begin(); qm != qms.end(); ++qm) {
- qDebug() << "\tCopying associated translation" << *qm << "into the meta package...";
+ const QString source(QString::fromLatin1("%1/meta/%2").arg(it->directory, *qm));
+ const QString target(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *qm));
translations.push_back(*qm);
- if (!QFile::copy(QString::fromLatin1("%1/meta/%2").arg(it->directory, *qm),
- QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *qm))) {
- qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the translation '%1' to its "
- "target location '%2'.").arg(*qm, it->name));
- } else {
- qDebug() << "done";
- }
+ copyWithException(source, target, kind);
}
}
@@ -381,15 +388,11 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
"copying license files of '%2'.").arg(licenseFile, it->name));
}
- qDebug() << "\tCopying associated license file" << licenseFile << "into the meta package...";
- if (!QFile::copy(sourceFile, QString::fromLatin1("%1/%2/%3")
- .arg(metapath, it->name, licenseFile))) {
- qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the license file '%1' to its "
- "target location '%2'.").arg(licenseFile, it->name));
- } else {
- qDebug() << "done.";
- }
+
+
+ const QString kind(QLatin1String("license"));
+ const QString target(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, licenseFile));
+ copyWithException(sourceFile, target, kind);
// Translated License files
for (int j = 0; j < translations.size(); ++j) {
@@ -405,14 +408,13 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
continue;
}
- qDebug() << "\tCopying associated license file" << translatedLicenseFile
- << "into the meta package...";
-
- if (!QFile::copy(translatedSourceFile, QString::fromLatin1("%1/%2/%3")
- .arg(metapath, it->name, translatedLicenseFile))) {
- qDebug() << "\tfailed!";
- } else {
- qDebug() << "\tdone.";
+ const QString translated_kind(QLatin1String("license"));
+ const QString translated_target(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name,
+ translatedLicenseFile));
+ try {
+ copyWithException(translatedSourceFile, translated_target, translated_kind);
+ } catch(...) {
+ // ignore, that's just about the translations
}
}
}
@@ -434,7 +436,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesDirectory,
const QStringList &filteredPackages, FilterType filterType)
{
- qDebug() << "Collecting information about available packages...";
+ qDebug() << "\nCollecting information about available packages...";
bool ignoreInvalidPackages = qApp->arguments().contains(QString::fromLatin1("--ignore-invalid-packages"));
@@ -449,7 +451,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
if (!filteredPackages.contains(it->fileName()))
continue;
}
- qDebug() << QString::fromLatin1("\tfound subdirectory '%1'").arg(it->fileName());
+ qDebug() << QString::fromLatin1("found subdirectory '%1'").arg(it->fileName());
// because the filter is QDir::Dirs - filename means the name of the subdirectory
if (it->fileName().contains(QLatin1Char('-'))) {
if (ignoreInvalidPackages)
@@ -507,11 +509,11 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
.arg(fileInfo.absoluteFilePath(), info.version));
}
info.dependencies = packageElement.firstChildElement(QLatin1String("Dependencies")).text()
- .split(QInstaller::scCommaRegExp, QString::SkipEmptyParts);
+ .split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
info.directory = it->filePath();
dict.push_back(info);
- qDebug() << QString::fromLatin1("\t- it provides the package %1 - %2").arg(name, info.version);
+ qDebug() << QString::fromLatin1("- it provides the package %1 - %2").arg(info.name, info.version);
}
if (dict.isEmpty())
diff --git a/tools/common/repositorygen.h b/tools/common/repositorygen.h
index 50349c8b6..85560a7fa 100644
--- a/tools/common/repositorygen.h
+++ b/tools/common/repositorygen.h
@@ -67,6 +67,7 @@ enum FilterType {
QHash<QString, QString> buildPathToVersionMapping(const PackageInfoVector &info);
+void copyWithException(const QString &source, const QString &target, const QString &kind = QString());
void compressMetaDirectories(const QString &repoDir);
void compressPaths(const QStringList &paths, const QString &archivePath);
void compressMetaDirectories(const QString &repoDir, const QString &baseDir,
diff --git a/tools/repogenfromonlinerepo/downloadmanager.h b/tools/repogenfromonlinerepo/downloadmanager.h
index 13cce7163..29aebec45 100644
--- a/tools/repogenfromonlinerepo/downloadmanager.h
+++ b/tools/repogenfromonlinerepo/downloadmanager.h
@@ -54,7 +54,7 @@ class DownloadManager: public QObject
{
Q_OBJECT
public:
- DownloadManager(QObject *parent = 0);
+ explicit DownloadManager(QObject *parent = 0);
void append(const QUrl &url);
void append(const QStringList &urlList);
diff --git a/tools/repogenfromonlinerepo/main.cpp b/tools/repogenfromonlinerepo/main.cpp
index 12023d495..d9c331fa2 100644
--- a/tools/repogenfromonlinerepo/main.cpp
+++ b/tools/repogenfromonlinerepo/main.cpp
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
// get Updates.xml to get to know what we can download
downloadManager.append(QUrl(repoUrl + QLatin1String("/Updates.xml")));
- QObject::connect( &downloadManager, SIGNAL( finished() ), &downloadEventLoop, SLOT( quit() ) );
+ QObject::connect(&downloadManager, SIGNAL(finished()), &downloadEventLoop, SLOT(quit()));
downloadEventLoop.exec();
// END - get Updates.xml to get to know what we can download
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
// get Updates.xml to get to know what we can download
downloadManager.append(QUrl(repoUrl + QLatin1String("/") + packageName + QLatin1String("/")
+ packageScript));
- QObject::connect( &downloadManager, SIGNAL( finished() ), &downloadEventLoop, SLOT( quit() ) );
+ QObject::connect(&downloadManager, SIGNAL(finished()), &downloadEventLoop, SLOT(quit()));
downloadEventLoop.exec();
// END - get Updates.xml to get to know what we can download