summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-01-06 16:08:14 +0100
committerhjk <qtc-committer@nokia.com>2009-01-06 16:08:14 +0100
commitaa3b488e79ac0050134f2d854044074e601882b1 (patch)
treed1ceb39017fb430599c481409fc5bf2f22cd1180
parentc88245ac086cf847125aabd11d053233330bd68f (diff)
downloadqt-creator-aa3b488e79ac0050134f2d854044074e601882b1.tar.gz
remove unused installer code to avoid confusion
-rw-r--r--installer/TODO.txt12
-rw-r--r--installer/installer.cpp433
-rw-r--r--installer/installer.pro29
-rw-r--r--installer/installer.qrc7
-rw-r--r--installer/qinstaller.cpp1872
-rw-r--r--installer/qinstaller.h357
-rw-r--r--installer/qinstallergui.cpp742
-rw-r--r--installer/qinstallergui.h256
-rw-r--r--installer/resources/license.txt84
-rw-r--r--installer/resources/logo.pngbin1592 -> 0 bytes
-rw-r--r--installer/resources/watermark.pngbin14462 -> 0 bytes
11 files changed, 0 insertions, 3792 deletions
diff --git a/installer/TODO.txt b/installer/TODO.txt
deleted file mode 100644
index 57aed14430..0000000000
--- a/installer/TODO.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-<all>
-- installdir whitespace check done.
-- installdir exist/non-empty check
-
-<linux>
-- run '/bin/xdg-desktop-install.sh' if '/usr/bin/xdg-mime exists'
-- desktop shortcut
-
-<windows>
-- create dir '${env(APPDATA)}/Trolltech'
-- start menue shortcuts
-
diff --git a/installer/installer.cpp b/installer/installer.cpp
deleted file mode 100644
index 013d26d2b8..0000000000
--- a/installer/installer.cpp
+++ /dev/null
@@ -1,433 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 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 GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-// This file contains the QtCreator-specific part of the installer.
-// It lists the files and features the installer should handle.
-
-#include "qinstaller.h"
-#include "qinstallergui.h"
-
-#include <QtCore/QDebug>
-#include <QtCore/QFileInfo>
-#include <QtCore/QObject>
-
-#include <QtGui/QApplication>
-#include <QtGui/QBoxLayout>
-#include <QtGui/QGridLayout>
-#include <QtGui/QLabel>
-#include <QtGui/QMessageBox>
-
-
-// QInstallerGui is base of the Gui part of an installer, i.e.
-// the "main installer wizard". In the simplest case it's just
-// a sequence of "standard" wizard pages. A few commonly used
-// ones are provided already in qinstallergui.h.
-
-
-// A custom target directory selection based due to the no-space
-// restriction...
-
-class TargetDirectoryPage : public QInstallerTargetDirectoryPage
-{
-public:
- TargetDirectoryPage(QInstaller *installer)
- : QInstallerTargetDirectoryPage(installer)
- {
- m_noSpaceLabel = new QLabel(this);
- m_noSpaceLabel->setText("The directory name should not contain any space.");
- m_noSpaceLabel->hide();
- insertWidget(m_noSpaceLabel, "MessageLabel");
- }
-
- bool isComplete() const
- {
- bool invalid = targetDir().contains(' ');
- QPalette palette;
- // We show the warning only if the user types a space.
- // No need to scare him if the path is ok for us...
- if (invalid) {
- m_noSpaceLabel->show();
- palette.setColor(QPalette::WindowText, Qt::red);
- }
- m_noSpaceLabel->setPalette(palette);
- return !invalid;
- }
-
- int nextId() const
- {
- QFileInfo fi(targetDir());
-
- if (isVisible() && fi.isDir()) {
- QFileInfo fi2(targetDir() + '/' + installer()->uninstallerName());
- if (fi2.exists()) {
- QMessageBox::StandardButton bt = QMessageBox::warning(wizard(),
- tr("Warning"),
- tr("The directory you selected exists already and contains an installaion.\n"
- "Do you want to overwrite it?"),
- QMessageBox::Yes | QMessageBox::No);
- if (bt == QMessageBox::No)
- return wizard()->currentId();
- } else {
- QMessageBox::StandardButton bt = QMessageBox::warning(wizard(),
- tr("Warning"),
- tr("The directory you selected exists already.\n"
- "Do you want to remove it and continue?"),
- QMessageBox::Yes | QMessageBox::No);
- if (bt == QMessageBox::No)
- return wizard()->currentId();
- }
- }
- return QInstallerPage::nextId();
- }
-
-private:
- QLabel *m_noSpaceLabel;
-};
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QtCreatorInstallerGui
-//
-////////////////////////////////////////////////////////////////////
-
-// QtCreatorInstallerGui is the QtCreator specific incarnation
-// of a QInstallerGui.
-
-class QtCreatorInstallerGui : public QInstallerGui
-{
-public:
- QtCreatorInstallerGui(QInstaller *installer)
- {
- // The Gui has access to the installer backend at construction
- // time. For later access it needs to store the QInstaller *
- // pointer provided. Not needed in this case here.
-
- setWindowTitle(tr("%1 Setup").arg(installer->value("ProductName")));
- installer->connectGui(this);
-
- // We are happy with the default set of pages.
- addPage(new QInstallerIntroductionPage(installer));
- addPage(new QInstallerLicenseAgreementPage(installer));
- //addPage(new QInstallerTargetDirectoryPage(installer));
- addPage(new TargetDirectoryPage(installer));
- if (installer->componentCount() > 1)
- addPage(new QInstallerComponentSelectionPage(installer));
- addPage(new QInstallerReadyForInstallationPage(installer));
- addPage(new QInstallerPerformInstallationPage(installer));
- addPage(new QInstallerFinishedPage(installer));
-
- setStartId(installer->value("GuiStartPage").toInt());
- }
-};
-
-
-// QInstaller is base of the "backend" part of an installer, i.e.
-// the part handling the installer tasks and keeping track of
-// related data like the directory to install to, the name of
-// the Product, version of the Product etc.
-
-// QtCreatorInstaller is the QtCreator specific incarnation
-// of a QInstaller. It needs to list all tasks that a performed
-// during installation. The tasks themselves specify what to
-// do at uninstall time.
-
-class QtCreatorInstaller : public QInstaller
-{
-public:
- QtCreatorInstaller()
- {
- // basic product information
- setValue("ProductName", "Qt Creator");
- setValue("ProductVersion", "alpha");
-
- // registration information
- setValue("Comments", "");
- setValue("Contact", "");
- setValue("DisplayVersion", "");
- setValue("HelpLink", "");
- setValue("Publisher", "");
- setValue("UrlAboutInfo", "");
-
- // information needed at installer generation time
- setValue("OutputFile", "qtcreator-installer");
- setValue("RunProgram", "@TargetDir@/bin/qtcreator");
-
- // default component selection, overridable from command line
- setValue("UseQtCreator", "true");
-#ifdef Q_OS_WIN
- //setValue("UseQt", "true");
- //setValue("UseMinGW", "true");
-#endif
- }
-
-private:
- // tasks related to QtCreator itself. Binary, libraries etc.
- void appendQtCreatorComponent()
- {
- QString sourceDir = value("SourceDir");
- if (sourceDir.isEmpty() && QFileInfo("../bin/qtcreator").isReadable())
- sourceDir = QLatin1String("..");
- if (sourceDir.isEmpty())
- throw QInstallerError("Missing 'SourceDir=<dir>' on command line.");
- QInstallerComponent *component = new QInstallerComponent(this);
- component->setValue("Name", "QtCreator");
- component->setValue("DisplayName", "Qt Creator");
- component->setValue("Description", "The Qt Creator IDE");
- component->setValue("SuggestedState", "AlwaysInstalled");
-#ifdef Q_OS_MAC
- component->appendDirectoryTasks(sourceDir + "/bin/QtCreator.app", "@TargetDir@");
-#else
- component->appendDirectoryTasks(sourceDir + "/bin", "@TargetDir@/bin");
- component->appendDirectoryTasks(sourceDir + "/lib", "@TargetDir@/lib");
-#endif
-
- QInstallerPatchFileTask *task = new QInstallerPatchFileTask(this);
- task->setTargetPath("@TargetDir@/lib/Trolltech/" + libraryName("ProjectExplorer", "1.0.0"));
- task->setNeedle("Clear Session");
- task->setReplacement("CLEAR SESSION");
- component->appendTask(task);
-
- appendComponent(component);
- }
-
- void appendMinGWComponent()
- {
- QString mingwSourceDir = value("MinGWSourceDir");
- if (mingwSourceDir.isEmpty())
- throw QInstallerError("Missing 'MinGWSourceDir=<dir>' on command line.");
- QInstallerComponent *component = new QInstallerComponent(this);
- component->setValue("Name", "MinGW");
- component->setValue("DisplayName", "MinGW");
- component->setValue("Description",
- "The MinGW environment including the g++ compiler "
- "and the gdb debugger.");
- component->setValue("SuggestedState", "Installed");
- component->appendDirectoryTasks(mingwSourceDir, "@TargetDir@");
- appendComponent(component);
- }
-
- void appendQtComponent()
- {
- QString qtSourceDir = value("QtSourceDir");
- if (qtSourceDir.isEmpty())
- throw QInstallerError("Missing 'QtSourceDir=<dir>' on command line.");
-
- QInstallerComponent *component = new QInstallerComponent(this);
- component->setValue("Name", "Qt Development Libraries");
- component->setValue("DisplayName", "Qt");
- component->setValue("Description",
- "The Qt library files for development including "
- "documentation");
- component->setValue("SuggestedState", "Installed");
- component->appendDirectoryTasks(qtSourceDir, "@TargetDir@");
-
-#ifdef Q_OS_WIN
- static const struct
- {
- const char *fileName;
- const char *sourceLocation;
- } libs[] = {
- {"/bin/Qt3Support", "/src/qt3support/"},
- {"/bin/QtCore", "/src/corelib/"},
- {"/bin/QtGui", "/src/gui/"},
- {"/bin/QtHelp", "/tools/assistant/lib/"},
- {"/bin/QtNetwork", "/src/network/"},
- {"/bin/QtOpenGL", "/src/opengl/"},
- {"/bin/QtScript", "/src/script/"},
- {"/bin/QtSql", "/src/sql/"},
- {"/bin/QtSvg", "/src/svg/"},
- {"/bin/QtTest", "/src/testlib/"},
- {"/bin/QtWebKit", "/src/3rdparty/webkit/WebCore/"},
- {"/bin/QtXml", "/src/xml/"},
- {"/bin/QtXmlPatterns", "/src/xmlpatterns/"},
- {"/plugins/accessible/qtaccessiblecompatwidgets",
- "/src/plugins/accessible/compat/"},
- {"/plugins/accessible/qtaccessiblewidgets",
- "/src/plugins/accessible/widgets/"},
- {"/plugins/codecs/qcncodecs", "/src/plugins/codecs/cn/"},
- {"/plugins/codecs/qjpcodecs", "/src/plugins/codecs/jp/"},
- {"/plugins/codecs/qkrcodecs", "/src/plugins/codecs/kr/"},
- {"/plugins/codecs/qtwcodecs", "/src/plugins/codecs/tw/"},
- {"/plugins/iconengines/qsvgicon", "/src/plugins/iconengines/svgiconengine/"},
- {"/plugins/imageformats/qgif", "/src/plugins/imageformats/gif/"},
- {"/plugins/imageformats/qjpeg", "/src/plugins/imageformats/jpeg/"},
- {"/plugins/imageformats/qmng", "/src/plugins/imageformats/mng/"},
- {"/plugins/imageformats/qsvg", "/src/plugins/imageformats/svg/"},
- {"/plugins/imageformats/qtiff", "/src/plugins/imageformats/tiff/"},
- {"/plugins/sqldrivers/qsqlite", "/src/plugins/sqldrivers/sqlite/"},
- // {"/plugins/sqldrivers/qsqlodbc", "/src/plugins/sqldrivers/odbc/"}
- };
-
- QString debug = QLatin1String("d4.dll");
-
- for (int i = 0; i != sizeof(libs) / sizeof(libs[0]); ++i) {
- QInstallerPatchFileTask *task = new QInstallerPatchFileTask(this);
- task->setTargetPath(QString("@TargetDir@/") + libs[i].fileName + debug);
- task->setNeedle("f:/depot/qt");
- task->setReplacement(QByteArray("@TargetDir@/") + libs[i].sourceLocation);
- component->appendTask(task);
- }
-#endif
-
- appendComponent(component);
- }
-
- void createTasks()
- {
- // set UseXXX=false on command line to prevent inclusion of the
- // respective component
- if (value("UseQtCreator") == "true")
- appendQtCreatorComponent();
- if (value("UseMinGW") == "true")
- appendMinGWComponent();
- if (value("UseQt") == "true")
- appendQtComponent();
- }
-};
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QtCreatorUninstallerGui
-//
-////////////////////////////////////////////////////////////////////
-
-class QtCreatorUninstallerGui : public QObject
-{
-public:
- QtCreatorUninstallerGui(QInstaller *installer)
- : m_installer(installer)
- {}
-
- int exec()
- {
- QMessageBox::StandardButton bt = QMessageBox::question(0,
- tr("Question"),
- tr("Do you want to deinstall %1 and all of its modules?")
- .arg(m_installer->value("ProductName")),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- if (bt == QMessageBox::No)
- return 0;
- QWizard wizard;
- wizard.addPage(new QInstallerPerformUninstallationPage(m_installer));
- wizard.show();
- return qApp->exec();
- }
-
-private:
- QInstaller *m_installer;
-};
-
-
-
-////////////////////////////////////////////////////////////////////
-//
-// The Main Driver Program
-//
-////////////////////////////////////////////////////////////////////
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QStringList args = app.arguments();
- qDebug() << "ARGS: " << args;
-
- QtCreatorInstaller installer;
-
- bool helpRequested = false;
- bool guiRequested = true;
-
- for (int i = 1; i < args.size(); ++i) {
- if (args.at(i).contains('=')) {
- const QString arg = args.at(i);
- const QString name = arg.section('=', 0, 0);
- const QString value = arg.section('=', 1, 1);
- installer.setValue(name, value);
- } else if (args.at(i) == "--help" || args.at(i) == "-h") {
- helpRequested = true;
- } else if (args.at(i) == "--no-gui" || args.at(i) == "NoGui") {
- qDebug() << "NOGUI";
- guiRequested = false;
- } else if (args.at(i) == "--verbose" || args.at(i) == "Verbose") {
- installer.setVerbose(true);
- } else {
- helpRequested = true;
- }
- }
-
- if (installer.isVerbose())
- installer.dump();
-
- if (helpRequested) {
- QString productName = installer.value("ProductName");
- QString str;
- if (installer.isCreator())
- str = QString(" [SourceDir=<dir>]\n"
- "\n Creates the %1 installer.\n").arg(productName);
- else if (installer.isInstaller())
- str = QString(" [--no-gui] [<name>=<value>...]\n"
- "\n Runs the %1 installer\n"
- "\n If the '--no-gui' parameter is given, it runs "
- " installer without GUI\n").arg(productName);
- else if (installer.isUninstaller())
- str = QString(" [<name>=<value>...]\n"
- "\n Runs the %1 uninstaller.\n").arg(productName);
- str = "\nUsage: " + installer.installerBinaryPath() + str;
- qDebug() << qPrintable(str);
- return 0;
- }
-
- if (installer.isInstaller() && guiRequested) {
- QtCreatorInstallerGui gui(&installer);
- gui.show();
- return app.exec();
- }
-
-#ifdef Q_OS_WIN
- if (installer.isUninstaller()) {
- QStringList newArgs = args;
- newArgs.removeFirst();
- installer.restartTempUninstaller(newArgs);
- return 0;
- }
-#endif
- if ((installer.isUninstaller() || installer.isTempUninstaller())
- && guiRequested) {
- QtCreatorUninstallerGui gui(&installer);
- //gui.show();
- return gui.exec();
- }
-
- return installer.run() ? 0 : 1;
-}
diff --git a/installer/installer.pro b/installer/installer.pro
deleted file mode 100644
index d9e59651de..0000000000
--- a/installer/installer.pro
+++ /dev/null
@@ -1,29 +0,0 @@
-TEMPLATE = app
-TARGET = installercreator
-DEPENDPATH += .
-INCLUDEPATH += .
-
-CONFIG -= debug
-CONFIG += release
-
-HEADERS += \
- qinstaller.h \
- qinstallergui.h \
-
-SOURCES += \
- qinstaller.cpp \
- qinstallergui.cpp \
- installer.cpp \
-
-RESOURCES += \
- installer.qrc \
-
-true {
- OBJECTS_DIR = .tmp/
- MOC_DIR = .tmp/
- RCC_DIR = .tmp/
- UI_DIR = .tmp/
-}
-
-win32:LIBS += ole32.lib
-
diff --git a/installer/installer.qrc b/installer/installer.qrc
deleted file mode 100644
index 5080febcd6..0000000000
--- a/installer/installer.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>resources/logo.png</file>
- <file>resources/watermark.png</file>
- <file>resources/license.txt</file>
-</qresource>
-</RCC>
diff --git a/installer/qinstaller.cpp b/installer/qinstaller.cpp
deleted file mode 100644
index be72b66b2f..0000000000
--- a/installer/qinstaller.cpp
+++ /dev/null
@@ -1,1872 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 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 GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#include "qinstaller.h"
-
-#include <QtCore/QBuffer>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QDateTime>
-#include <QtCore/QDebug>
-#include <QtCore/QDir>
-#include <QtCore/QDirIterator>
-#include <QtCore/QFile>
-#include <QtCore/QHash>
-#include <QtCore/QProcess>
-#include <QtCore/QSettings>
-
-#ifdef Q_OS_WIN
-#include "qt_windows.h"
-#include <shlobj.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*
- FIXME: Documentation
-
-NAME = "Name";
-DISPLAY_NAME = "DisplayName";
-DESCRIPTION = "Description";
-TASK_COUNT = "TaskCount";
-SIZE = "ComponentSize";
-OUTPUT_FILE = "OutputFile";
-WANTED_STATE = "WantedState";
-SUGGESTED_STATE = "SuggestedState";
-PRODUCT_NAME = "ProductName";
-GUI_START_PAGE = "GuiStartPage";
-RUN_PROGRAM = "RunProgram";
-COMMENTS = "Comments";
-CONTACT = "Contact";
-DISPLAY_VERSION = "DisplayVersion";
-ESTIMATED_SIZE = "EstimatedSize";
-HELP_LINK = "HelpLink";
-INSTALL_DATE = "InstallDate";
-INSTALL_LOCATION = "InstallLocation";
-NO_MODIFY = "NoModify";
-NO_REPAIR = "NoRepair";
-PUBLISHER = "Publisher";
-UNINSTALL_STRING = "UninstallString";
-URL_INFO_ABOUT = "UrlInfoAbout";
-LOGO_PIXMAP
-WATERMARK_PIXMAP
-*/
-
-
-//static qint64 magicInstallerMarker = (0xdea0d345UL << 32) + 0x12023233UL;
-//static qint64 magicUninstallerMarker = (0xdea0d345UL << 32) + 0x12023234UL;
-static const qint64 magicInstallerMarker = 0x12023233UL;
-static const qint64 magicUninstallerMarker = 0x12023234UL;
-static const qint64 magicTempUninstallerMarker = 0x12023235UL;
-
-// Installer Layout:
-//
-// 0000: <binary: installer code>
-// ...
-// $comptask[0]: <int: $ctc[0]: 1st component task count>
-// $comptask[0][0]: <task: first component task data>
-// ...
-// $comptask[0][$ctc0-1]: <task: first component task data>
-// ...
-// $comptask[$ncomp-1]: <int : $cnn: last component task data>
-// $comptask[$ncomp-1][0]: <task: last component task data>
-// ...
-// $comtaskp[$ncomp-1][$ctc-1]: <task: last component task data>
-// $compvars[0]: <dict: $cn0: first component variables>
-// ...
-// $compvars[$ncomp-1]: <dict: $cnn: last component var data>
-// $comptaskoffsets: <int: $comptask[0]: offset>
-// <int: $comptask[1]: offset>
-// ...
-// $compvarsoffsets: <int: $compvars[0]: offset>
-// <int: $compvars[1]: offset>
-// ...
-// $installervars: <dict: installer variable data>
-// ...
-// end - 7: <int: $comptask[0]: start of comp.tasks>
-// end - 6: <int: $compvars[0]: start of .vars>
-// end - 5: <int: $ncomp: number of components>
-// end - 4: <int: $comptaskoffsets>
-// end - 3: <int: $compvarsoffsets>
-// end - 2: <int: $installervars: offset installer vars>
-// end - 1: <int: magic marker>
-//
-// The stuff after the binary is not present in the "Creator" incarnation
-
-////////////////////////////////////////////////////////////////////
-//
-// Misc helpers
-//
-////////////////////////////////////////////////////////////////////
-
-namespace {
-
-#define ifVerbose(s) if (!installer()->isVerbose()) {} else { qDebug() << s; }
-
-
-QDebug &operator<<(QDebug &os, QInstallerTask *task)
-{
- task->dump(os);
- return os;
-}
-
-class Dictionary : public QHash<QString, QString>
-{
-public:
- typedef QHash<QString, QString> BaseType;
-
- void setValue(const QString &key, const QString &val)
- {
- insert(key, val);
- }
-
- void removeTemporaryKeys()
- {
- foreach (const QString &key, keys())
- if (key.startsWith('@'))
- remove(key);
- }
-};
-
-//////////////////////////////////////////////////////////////////////
-
-class Error : public QInstallerError
-{
-public:
- Error(const QString &m)
- : QInstallerError(m) {}
- // convenience
- Error(const char *m, int n)
- : QInstallerError(QString(QLatin1String(m)).arg(n)) {}
- Error(const char *m, const QString & n)
- : QInstallerError(QString(QLatin1String(m)).arg(n)) {}
-private:
-private:
- QString m_message;
-};
-
-} // anonymous namespace
-
-static void openForWrite(QFile &file)
-{
- if (!file.open(QIODevice::WriteOnly))
- throw Error("Cannot open file %1 for writing", file.fileName());
-}
-
-static void openForRead(QFile &file)
-{
- if (!file.open(QIODevice::ReadOnly))
- throw Error("Cannot open file %1 for reading", file.fileName());
-}
-
-static void rawWrite(QIODevice *out, const char *buffer, qint64 size)
-{
- while (size > 0) {
- qint64 n = out->write(buffer, size);
- if (n == -1)
- throw Error("RAW WRITE FAILED: %1", size);
- size -= n;
- }
-}
-
-static void rawRead(QIODevice *in, char *buffer, qint64 size)
-{
- while (size > 0) {
- qint64 n = in->read(buffer, size);
- size -= n;
- buffer += n;
- if (size != 0)
- qDebug() << "COULD ONLY READ " << n << "OF" << size + n << "BYTES";
- }
-}
-
-static inline QByteArray &theBuffer(int size)
-{
- static QByteArray b;
- if (size > b.size())
- b.reserve(size * 3 / 2);
- return b;
-}
-
-
-#if 0
-// Faster or not?
-static void appendFileData(QIODevice *out, const QString &fileName)
-{
- QFile file(fileName);
- openForRead(file);
- qint64 size = file.size();
- QInstaller::appendInt(out, size);
- if (size == 0)
- return;
- uchar *data = file.map(0, size);
- if (!data)
- throw Error(QInstaller::tr("Cannot map file %1").arg(file.fileName()));
- rawWrite(out, (const char *)data, size);
- if (!file.unmap(data))
- throw Error(QInstaller::tr("Cannot unmap file %1").arg(file.fileName()));
-}
-#endif
-
-static void appendFileData(QIODevice *out, QIODevice *in)
-{
- QTC_ASSERT(!in->isSequential(), return);
- qint64 size = in->size();
- QByteArray &b = theBuffer(size);
- rawRead(in, b.data(), size);
- QInstaller::appendInt(out, size);
- rawWrite(out, b.constData(), size);
-}
-
-static void retrieveFileData(QIODevice *out, QIODevice *in)
-{
- qint64 size = QInstaller::retrieveInt(in);
- QByteArray &b = theBuffer(size);
- rawRead(in, b.data(), size);
- rawWrite(out, b.constData(), size);
-}
-
-static void appendData(QIODevice *out, QIODevice *in, qint64 size)
-{
- QByteArray &b = theBuffer(size);
- rawRead(in, b.data(), size);
- rawWrite(out, b.constData(), size);
-}
-
-static void appendInt(QIODevice *out, qint64 n)
-{
- rawWrite(out, (char*)&n, sizeof(n));
-}
-
-static void appendString(QIODevice *out, const QString &str)
-{
- int n = str.size();
- appendInt(out, n);
- rawWrite(out, (char*)str.utf16(), n * sizeof(QChar));
-}
-
-static void appendByteArray(QIODevice *out, const QByteArray &ba)
-{
- appendInt(out, ba.size());
- rawWrite(out, ba.constData(), ba.size());
-}
-
-static void appendDictionary(QIODevice *out, const Dictionary &dict)
-{
- appendInt(out, dict.size());
- foreach (const QString &key, dict.keys()) {
- appendString(out, key);
- appendString(out, dict.value(key));
- }
-}
-
-static qint64 retrieveInt(QIODevice *in)
-{
- qint64 n = 0;
- in->read((char*)&n, sizeof(n));
- return n;
-}
-
-static QString retrieveString(QIODevice *in)
-{
- static QByteArray b;
- qint64 n = retrieveInt(in);
- if (n * int(sizeof(QChar)) > b.size())
- b.reserve(n * sizeof(QChar) * 3 / 2);
- in->read(b.data(), n * sizeof(QChar));
- QString str((QChar *)b.data(), n);
- return str;
-}
-
-static QByteArray retrieveByteArray(QIODevice *in)
-{
- QByteArray ba;
- qint64 n = retrieveInt(in);
- ba.resize(n);
- rawRead(in, ba.data(), n);
- return ba;
-}
-
-static Dictionary retrieveDictionary(QIODevice *in)
-{
- Dictionary dict;
- for (qint64 i = retrieveInt(in); --i >= 0; ) {
- QString key = retrieveString(in);
- dict.insert(key, retrieveString(in));
- }
- return dict;
-}
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerComponent::Private
-//
-////////////////////////////////////////////////////////////////////
-
-class QInstallerComponent::Private
-{
-public:
- QInstaller *m_installer;
- Dictionary m_vars;
- QList<QInstallerTask *> m_tasks;
-
- // filled before intaller runs
- qint64 m_offsetInInstaller;
-};
-
-#if 0
-
-// this is dead slow as QDirIterator::Private::advance needlessly
-// creates tons of QFileInfo objects
-
-static void listDir
- (const QString &sourcePath0, const QString &targetPath0,
- QList<QInstallerTask *> *copyTasks,
- QList<QInstallerTask *> *linkTasks,
- int sourcePathLength)
-{
- Q_UNUSED(sourcePathLength);
- QDirIterator it(sourcePath0, QDir::Files, QDirIterator::Subdirectories);
- const int pos = sourcePath0.size();
- while (it.hasNext()) {
- QString sourcePath = it.next();
- QFileInfo sourceInfo = it.fileInfo();
- if (sourceInfo.isSymLink()) {
- QFileInfo absSourceInfo(sourceInfo.absoluteFilePath());
- //QString linkTarget = sourceInfo.symLinkTarget();
- QString absLinkTarget = absSourceInfo.symLinkTarget();
- //QString relPath = sourceInfo.dir().relativeFilePath(linkTarget);
- QString absRelPath = absSourceInfo.dir().relativeFilePath(absLinkTarget);
- if (0) {
- ifVerbose("\n\nCREATING LINK: "
- << "\nSOURCE : " << sourceInfo.filePath()
- << "\nSOURCE ABS: " << absSourceInfo.filePath()
- //<< "\nLINK : " << linkTarget
- << "\nLINK ABS: " << absLinkTarget
- //<< "\nREL : " << relPath
- << "\nREL ABS: " << absRelPath);
- }
- QString targetPath = targetPath0;
- targetPath += sourcePath.midRef(pos);
- //qDebug() << "LINK " << absRelPath << targetPath << targetPath0;
- QInstallerLinkFileTask *task = new QInstallerLinkFileTask(m_installer);
- task->setLinkTargetPath(absRelPath);
- task->setTargetPath(targetPath);
- task->setPermissions(sourceInfo.permissions());
- linkTasks->append(task);
- } else {
- QInstallerCopyFileTask *task = new QInstallerCopyFileTask(m_installer);
- QString targetPath = targetPath0;
- targetPath += sourcePath.midRef(pos);
- //qDebug() << "COPY " << sourcePath << targetPath << targetPath0;
- task->setSourcePath(sourcePath);
- task->setTargetPath(targetPath);
- task->setPermissions(sourceInfo.permissions());
- copyTasks.append(task);
- }
- }
-}
-#else
-
-static void listDir
- (const QString &sourcePath, const QString &targetPath0,
- QList<QInstallerTask *> *copyTasks,
- QList<QInstallerTask *> *linkTasks,
- QInstaller *installer,
- int sourcePathLength = -1)
-
-{
- if (sourcePathLength == -1)
- sourcePathLength = sourcePath.size();
- QFileInfo sourceInfo(sourcePath);
- if (sourceInfo.isDir()) {
- QDir dir(sourcePath);
- dir.setSorting(QDir::Unsorted);
- foreach (const QFileInfo &fi, dir.entryInfoList()) {
- QString sourceFile = fi.fileName();
- if (sourceFile == QLatin1String(".")
- || sourceFile == QLatin1String(".."))
- continue;
- listDir(sourcePath + '/' + sourceFile, targetPath0,
- copyTasks, linkTasks, installer, sourcePathLength);
- }
- } else if (sourceInfo.isSymLink()) {
- QFileInfo absSourceInfo(sourceInfo.absoluteFilePath());
- QString absLinkTarget = absSourceInfo.symLinkTarget();
- QString absRelPath = absSourceInfo.dir().relativeFilePath(absLinkTarget);
- QString targetPath = targetPath0;
- targetPath += sourcePath.midRef(sourcePathLength);
- //qDebug() << "LINK " << absRelPath << targetPath << targetPath0;
- QInstallerLinkFileTask *task = new QInstallerLinkFileTask(installer);
- task->setLinkTargetPath(absRelPath);
- task->setTargetPath(targetPath);
- task->setPermissions(sourceInfo.permissions());
- linkTasks->append(task);
- } else {
- QInstallerCopyFileTask *task = new QInstallerCopyFileTask(installer);
- QString targetPath = targetPath0;
- targetPath += sourcePath.midRef(sourcePathLength);
- //qDebug() << "COPY " << sourcePath << targetPath << targetPath0;
- task->setSourcePath(sourcePath);
- task->setTargetPath(targetPath);
- task->setPermissions(sourceInfo.permissions());
- copyTasks->append(task);
- }
-}
-#endif
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerComponent
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerComponent::QInstallerComponent(QInstaller *installer)
- : d(new QInstallerComponent::Private)
-{
- d->m_installer = installer;
-}
-
-
-QInstallerComponent::~QInstallerComponent()
-{
- qDeleteAll(d->m_tasks);
- d->m_tasks.clear();
- delete d;
-}
-
-QString QInstallerComponent::value(const QString &key,
- const QString &defaultValue) const
-{
- return d->m_vars.value(key, defaultValue);
-}
-
-void QInstallerComponent::setValue(const QString &key, const QString &value)
-{
- d->m_vars[key] = value;
-}
-
-void QInstallerComponent::appendDirectoryTasks
- (const QString &sourcePath0, const QString &targetPath)
-{
- QList<QInstallerTask *> copyTasks;
- QList<QInstallerTask *> linkTasks;
- QString sourcePath = d->m_installer->replaceVariables(sourcePath0);
- listDir(sourcePath, targetPath, &copyTasks, &linkTasks, d->m_installer);
- d->m_tasks += copyTasks;
- d->m_tasks += linkTasks;
-}
-
-void QInstallerComponent::appendSettingsTask
- (const QString &key, const QString &value)
-{
- QInstallerWriteSettingsTask *task =
- new QInstallerWriteSettingsTask(d->m_installer);
- task->setKey(key);
- task->setValue(value);
- appendTask(task);
-}
-
-void QInstallerComponent::appendTask(QInstallerTask *task)
-{
- d->m_tasks.append(task);
-}
-
-int QInstallerComponent::taskCount() const
-{
- return d->m_tasks.size();
-}
-
-QInstallerTask *QInstallerComponent::task(int i) const
-{
- return d->m_tasks.at(i);
-}
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstaller::Private
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerTask *createCopyFileTask(QInstaller *installer)
-{
- return new QInstallerCopyFileTask(installer);
-}
-
-QInstallerTask *createLinkFileTask(QInstaller *installer)
-{
- return new QInstallerLinkFileTask(installer);
-}
-
-QInstallerTask *createWriteSettingsTask(QInstaller *installer)
-{
- return new QInstallerWriteSettingsTask(installer);
-}
-
-QInstallerTask *createPatchFileTask(QInstaller *installer)
-{
- return new QInstallerPatchFileTask(installer);
-}
-
-QInstallerTask *createMenuShortcutTask(QInstaller *installer)
-{
- return new QInstallerMenuShortcutTask(installer);
-}
-
-
-
-class QInstaller::Private : public QObject
-{
- Q_OBJECT;
-
-public:
- explicit Private(QInstaller *);
- ~Private();
-
- void initialize();
-
- QInstallerTask *createTaskFromCode(int code);
- void undo(const QList<QInstallerTask *> &tasks);
- void writeUninstaller(const QList<QInstallerTask *> &tasks);
- bool statusCanceledOrFailed() const;
-
- void writeInstaller(QIODevice *out);
- void writeInstaller();
- void appendCode(QIODevice *out);
- void runInstaller();
- void runUninstaller();
- void deleteUninstaller();
- QString uninstallerName() const;
- QString replaceVariables(const QString &str) const;
- QByteArray replaceVariables(const QByteArray &str) const;
- QString registerPath() const;
- void registerInstaller();
- void unregisterInstaller();
- QString installerBinaryPath() const;
- bool isCreator() const;
- bool isInstaller() const;
- bool isUninstaller() const;
- bool isTempUninstaller() const;
- QInstaller *installer() const { return q; }
- bool restartTempUninstaller(const QStringList &args);
- void setInstallationProgress(qint64 progress); // relative to m_totalProgress
-
-signals:
- void installationStarted();
- void installationFinished();
- void uninstallationStarted();
- void uninstallationFinished();
-
-public:
- QInstaller *q;
-
- Dictionary m_vars;
- QInstaller::InstallerStatus m_status;
- bool m_verbose;
-
- qint64 m_codeSize;
- qint64 m_tasksStart;
- qint64 m_variablesStart;
- qint64 m_componentCount;
- qint64 m_tasksOffsetsStart;
- qint64 m_variablesOffsetsStart;
- qint64 m_variableDataStart;
- qint64 m_magicMarker;
-
- int m_installationProgress;
- int m_totalProgress;
- QString m_installationProgressText;
-
- // Owned. Indexed by component name
- QList<QInstallerComponent *> m_components;
- QList<QInstaller::TaskCreator> m_taskCreators;
-};
-
-QInstaller::Private::Private(QInstaller *q_)
- : q(q_), m_status(QInstaller::InstallerUnfinished), m_verbose(false)
-{
- connect(this, SIGNAL(installationStarted()),
- q, SIGNAL(installationStarted()));
- connect(this, SIGNAL(installationFinished()),
- q, SIGNAL(installationFinished()));
- connect(this, SIGNAL(uninstallationStarted()),
- q, SIGNAL(uninstallationStarted()));
- connect(this, SIGNAL(uninstallationFinished()),
- q, SIGNAL(uninstallationFinished()));
-}
-
-QInstaller::Private::~Private()
-{
- qDeleteAll(m_components);
- m_components.clear();
-}
-
-
-void QInstaller::Private::initialize()
-{
- m_installationProgress = 0;
- m_totalProgress = 100;
-
- m_vars["ProductName"] = "Unknown Product";
- m_vars["LogoPixmap"] = ":/resources/logo.png";
- m_vars["WatermarkPixmap"] = ":/resources/watermark.png";
-
- QFile in(installerBinaryPath());
- openForRead(in);
- m_codeSize = in.size();
-
- // this reads bogus values for 'creators', but it does not harm
- in.seek(in.size() - 7 * sizeof(qint64));
- m_tasksStart = retrieveInt(&in);
- m_variablesStart = retrieveInt(&in);
- m_componentCount = retrieveInt(&in);
- m_tasksOffsetsStart = retrieveInt(&in);
- m_variablesOffsetsStart = retrieveInt(&in);
- m_variableDataStart = retrieveInt(&in);
- m_magicMarker = retrieveInt(&in);
-
- if (isCreator()) {
- // valgrind complains otherwise
- m_tasksStart = 0;
- m_variablesStart = 0;
- m_componentCount = 0;
- m_tasksOffsetsStart = 0;
- m_variablesOffsetsStart = 0;
- m_variableDataStart = 0;
- m_magicMarker = 0;
- } else {
- // fix code size
- m_codeSize = m_tasksStart;
-
- // merge stored variables
- in.seek(m_variablesStart);
-
- for (int i = 0; i != m_componentCount; ++i) {
- QInstallerComponent *component = new QInstallerComponent(q);
- component->d->m_vars = retrieveDictionary(&in);
- qDebug() << "DICT " << i << component->d->m_vars;
- m_components.append(component);
- }
-
- // read installer variables
- Dictionary dict = retrieveDictionary(&in);
- if (m_verbose)
- qDebug() << "READ VARIABLES FROM INSTALLER:" << dict;
- foreach (const QString &key, dict.keys()) {
- if (!m_vars.contains(key))
- m_vars.insert(key, dict.value(key));
- }
- if (m_verbose)
- qDebug() << "MERGED VARIABLES:" << m_vars;
- }
-}
-
-void QInstaller::Private::setInstallationProgress(qint64 progress)
-{
- // from 0 to m_totalProgress
- int percent = progress * 100 / m_totalProgress;
- if (percent == m_installationProgress)
- return;
- //qDebug() << "setting progress to " << progress
- // << " of " << m_totalProgress << " " << percent << "%";
- m_installationProgress = percent;
- qApp->processEvents();
-}
-
-QString QInstaller::Private::installerBinaryPath() const
-{
- return qApp->arguments().at(0);
-}
-
-bool QInstaller::Private::isCreator() const
-{
- return !isInstaller() && !isUninstaller() && !isTempUninstaller();
-}
-
-bool QInstaller::Private::isInstaller() const
-{
- return m_magicMarker == magicInstallerMarker;
-}
-
-bool QInstaller::Private::isUninstaller() const
-{
- return m_magicMarker == magicUninstallerMarker;
-}
-
-bool QInstaller::Private::isTempUninstaller() const
-{
- return m_magicMarker == magicTempUninstallerMarker;
-}
-
-void QInstaller::Private::writeInstaller()
-{
- QString fileName = m_vars["OutputFile"];
-#ifdef Q_OS_WIN
- if (!fileName.endsWith(QLatin1String(".exe")))
- fileName += QLatin1String(".exe");
-#endif
- QFile out;
- out.setFileName(fileName);
- openForWrite(out);
- writeInstaller(&out);
- out.setPermissions(out.permissions() | QFile::WriteUser
- | QFile::ExeOther | QFile::ExeGroup | QFile::ExeUser);
-}
-
-void QInstaller::Private::writeInstaller(QIODevice *out)
-{
- appendCode(out);
-
- QList<qint64> tasksOffsets;
- QList<qint64> variablesOffsets;
-
- // write component task data
- foreach (QInstallerComponent *component, m_components) {
- qint64 componentStart = out->size();
- tasksOffsets.append(out->size()); // record start of tasks
- // pack the component as a whole
- QBuffer buffer;
- buffer.open(QIODevice::WriteOnly);
- foreach (QInstallerTask *task, component->d->m_tasks) {
- appendInt(&buffer, q->indexOfTaskType(task->creator()));
- task->writeToInstaller(&buffer);
- }
- buffer.close();
- QByteArray compressed = qCompress(buffer.buffer());
- int uncompressedSize = buffer.buffer().size();
- int compressedSize = compressed.size();
- appendByteArray(out, compressed);
- qDebug() << "COMPRESS: " << uncompressedSize << compressedSize;
- component->setValue("TaskCount", QString::number(component->d->m_tasks.size()));
- component->setValue("ComponentStart", QString::number(componentStart));
- component->setValue("CompressedSize", QString::number(compressedSize));
- component->setValue("UncompressedSize", QString::number(uncompressedSize));
- }
-
- // write component variables
- foreach (QInstallerComponent *component, m_components) {
- variablesOffsets.append(out->size()); // record start of variables
- appendDictionary(out, component->d->m_vars);
- }
-
- // append variables except temporary ones
- qint64 variableDataStart = out->size();
- Dictionary dict = m_vars;
- dict.removeTemporaryKeys();
- appendDictionary(out, dict);
-
- // append recorded list of component task offsets
- qint64 taskOffsetsStart = out->size();
- foreach (qint64 offset, tasksOffsets)
- appendInt(out, offset);
-
- // append recorded list of component varaibles offsets
- qint64 variablesOffsetsStart = out->size();
- foreach (qint64 offset, variablesOffsets)
- appendInt(out, offset);
-
- // append trailer
- appendInt(out, tasksOffsets[0]);
- appendInt(out, variablesOffsets[0]);
- appendInt(out, m_components.size());
- appendInt(out, taskOffsetsStart);
- appendInt(out, variablesOffsetsStart);
- appendInt(out, variableDataStart);
- appendInt(out, magicInstallerMarker);
-}
-
-bool QInstaller::Private::statusCanceledOrFailed() const
-{
- return m_status == QInstaller::InstallerCanceledByUser
- || m_status == QInstaller::InstallerFailed;
-}
-
-QInstallerTask *QInstaller::Private::createTaskFromCode(int code)
-{
- if (code >= 0 && code < m_taskCreators.size())
- return m_taskCreators[code](q);
- throw Error("NO TASK WITH CODE %1 REGISTERED");
-}
-
-void QInstaller::Private::undo(const QList<QInstallerTask *> &tasks)
-{
- //qDebug() << "REMOVING" << files.size();
- // tasks.size() corresponds to m_installationProgress;
- m_totalProgress = tasks.size() * m_installationProgress / 100 + 1;
- for (int i = tasks.size(); --i >= 0; ) {
- QInstallerTask *task = tasks.at(i);
- setInstallationProgress(i);
- task->undo();
- }
- setInstallationProgress(0);
-}
-
-void QInstaller::Private::appendCode(QIODevice *out)
-{
- QFile in(installerBinaryPath());
- openForRead(in);
- if (m_verbose)
- qDebug() << "CODE SIZE: " << m_codeSize;
- appendData(out, &in, m_codeSize);
- in.close();
-}
-
-QString QInstaller::Private::replaceVariables(const QString &str) const
-{
- QString res;
- int pos = 0;
- while (true) {
- int pos1 = str.indexOf('@', pos);
- if (pos1 == -1)
- break;
- int pos2 = str.indexOf('@', pos1 + 1);
- if (pos2 == -1)
- break;
- res += str.mid(pos, pos1 - pos);
- QString name = str.mid(pos1 + 1, pos2 - pos1 - 1);
- res += m_vars.value(name);
- pos = pos2 + 1;
- }
- res += str.mid(pos);
- return res;
-}
-
-QByteArray QInstaller::Private::replaceVariables(const QByteArray &ba) const
-{
- QByteArray res;
- int pos = 0;
- while (true) {
- int pos1 = ba.indexOf('@', pos);
- if (pos1 == -1)
- break;
- int pos2 = ba.indexOf('@', pos1 + 1);
- if (pos2 == -1)
- break;
- res += ba.mid(pos, pos1 - pos);
- QString name = QString::fromLocal8Bit(ba.mid(pos1 + 1, pos2 - pos1 - 1));
- res += m_vars.value(name).toLocal8Bit();
- pos = pos2 + 1;
- }
- res += ba.mid(pos);
- return res;
-}
-
-QString QInstaller::Private::uninstallerName() const
-{
- QString name = m_vars["TargetDir"];
- name += "/uninstall";
-#ifdef Q_OS_WIN
- name += QLatin1String(".exe");
-#endif
- return name;
-}
-
-void QInstaller::Private::writeUninstaller(const QList<QInstallerTask *> &tasks)
-{
- QFile out(uninstallerName());
- try {
- ifVerbose("CREATING UNINSTALLER " << tasks.size());
- // Create uninstaller. this is basically a clone of ourselves
- // with a few changed variables
- openForWrite(out);
- appendCode(&out);
- qint64 tasksStart = out.size();
- appendInt(&out, tasks.size());
-
- for (int i = tasks.size(); --i >= 0; ) {
- QInstallerTask *task = tasks.at(i);
- appendInt(&out, m_taskCreators.indexOf(task->creator()));
- task->writeToUninstaller(&out); // might throw
- }
-
- // append variables except temporary ones
- qint64 variableDataStart = out.size();
- Dictionary dict = m_vars;
- dict.removeTemporaryKeys();
- dict.setValue(QLatin1String("UninstallerPath"), uninstallerName());
- appendDictionary(&out, dict);
-
- // append trailer
- appendInt(&out, tasksStart);
- appendInt(&out, variableDataStart); // variablesStart
- appendInt(&out, 0); // componentCount
- appendInt(&out, 0); // tasksOffsetsStart
- appendInt(&out, 0); // variablesOffsetsStart
- appendInt(&out, variableDataStart);
- appendInt(&out, magicUninstallerMarker);
-
- out.setPermissions(out.permissions() | QFile::WriteUser
- | QFile::ExeOther | QFile::ExeGroup | QFile::ExeUser);
- }
- catch (const QInstallerError &err) {
- m_status = QInstaller::InstallerFailed;
- // local roll back
- qDebug() << "WRITING TO UNINSTALLER FAILED: " << err.message();
- out.close();
- out.remove();
- throw;
- }
-}
-
-QString QInstaller::Private::registerPath() const
-{
- QString productName = m_vars["ProductName"];
- if (productName.isEmpty())
- throw QInstallerError("ProductName should be set");
- QString path;
- if (m_vars["AllUsers"] == "true")
- path += "HKEY_LOCAL_MACHINE";
- else
- path += "HKEY_CURRENT_USER";
- path += "\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
- path += productName;
- return path;
-}
-
-void QInstaller::Private::registerInstaller()
-{
-#ifdef Q_OS_WIN
- QSettings settings(registerPath(), QSettings::NativeFormat);
- settings.beginGroup("CurrentVersion");
- settings.beginGroup("Uninstall");
- settings.beginGroup(m_vars["ProductName"]);
- settings.setValue("Comments", m_vars["Comments"]);
- settings.setValue("Contact", m_vars["Contact"]);
- settings.setValue("DisplayName", m_vars["ProductName"]);
- settings.setValue("DisplayVersion", m_vars["DisplayVersion"]);
- settings.setValue("EstimatedSize", "X4957efb0");
- settings.setValue("HelpLink", m_vars["HelpLink"]);
- settings.setValue("InstallDate", QDateTime::currentDateTime().toString());
- settings.setValue("InstallLocation", m_vars["TargetDir"]);
- settings.setValue("NoModify", "1");
- settings.setValue("NoRepair", "1");
- settings.setValue("Publisher", m_vars["Publisher"]);
- settings.setValue("UninstallString", uninstallerName());
- settings.setValue("UrlInfoAbout", m_vars["UrlInfoAbout"]);
-#endif
-}
-
-void QInstaller::Private::unregisterInstaller()
-{
-#ifdef Q_OS_WIN
- QSettings settings(registerPath(), QSettings::NativeFormat);
- settings.remove(QString());
-#endif
-}
-
-void QInstaller::Private::runInstaller()
-{
- QList<QInstallerTask *> tasks;
-
- try {
- emit installationStarted();
- if (!m_vars.contains("TargetDir"))
- throw QInstallerError(QLatin1String("Variable 'TargetDir' not set."));
-
- QFile in(installerBinaryPath());
- openForRead(in);
-
- m_totalProgress = 0;
- QList<QInstallerComponent *> componentsToInstall;
-
- for (int i = 0; i != m_componentCount; ++i) {
- QInstallerComponent *comp = m_components.at(i);
- QString wantedState = comp->value("WantedState");
- ifVerbose("HANDLING COMPONENT" << i << "WANTED: " << wantedState);
- if (wantedState == "Uninstalled") {
- qDebug() << "SKIPPING COMPONENT" << comp->value("DisplayName");
- continue;
- }
- componentsToInstall.append(comp);
- m_totalProgress += comp->value("UncompressedSize").toInt();
- }
-
- qDebug() << "Install size: " << m_totalProgress
- << "in " << componentsToInstall.size() << "components";
-
- qint64 lastProgressBase = 0;
- foreach (QInstallerComponent *comp, componentsToInstall) {
- int taskCount = comp->value("TaskCount").toInt();
- quint64 componentStart = comp->value("ComponentStart").toInt();
- in.seek(componentStart);
- if (statusCanceledOrFailed())
- throw Error("Installation canceled by user");
- m_installationProgressText =
- tr("Decompressing component %1").arg(comp->value("DisplayName"));
- qApp->processEvents();
- QByteArray compressed = retrieveByteArray(&in);
- QByteArray uncompressed = qUncompress(compressed);
- if (uncompressed.isEmpty()) {
- qDebug() << "SIZE: " << compressed.size() << " TASK COUNT: " << taskCount
- << uncompressed.size();
- throw Error("DECOMPRESSION FAILED");
- }
- QBuffer buffer(&uncompressed);
- buffer.open(QIODevice::ReadOnly);
- for (int j = 0; j != taskCount; ++j) {
- int code = retrieveInt(&buffer);
- QInstallerTask *task = createTaskFromCode(code); // might throw
- task->readAndExecuteFromInstaller(&buffer); // might throw
- tasks.append(task);
- if (statusCanceledOrFailed())
- throw Error("Installation canceled by user");
- setInstallationProgress(lastProgressBase + buffer.pos());
- }
- comp->setValue("CurrentState", "Installed");
- lastProgressBase += uncompressed.size();
- }
- in.close();
-
- registerInstaller();
- writeUninstaller(tasks);
-
- m_status = InstallerSucceeded;
- m_installationProgressText = tr("Installation finished!");
- qApp->processEvents();
- emit installationFinished();
- }
- catch (const QInstallerError &err) {
- installer()->showWarning(err.message());
- qDebug() << "INSTALLER FAILED: " << err.message() << "\nROLLING BACK";
- undo(tasks);
- m_installationProgressText = tr("Installation aborted");
- qApp->processEvents();
- emit installationFinished();
- throw;
- }
-}
-
-bool QInstaller::Private::restartTempUninstaller(const QStringList &args)
-{
-#ifdef Q_OS_WIN
- ifVerbose("Running uninstaller on Windows.");
- if (isUninstaller()) {
- QString uninstallerFile = installerBinaryPath();
- QDir tmpDir = QDir::temp();
- QString tmpDirName = QLatin1String("qtcreator_uninst");
- QString tmpAppName = QLatin1String("uninst.exe");
- if (!tmpDir.exists(tmpDirName)) {
- tmpDir.mkdir(tmpDirName);
- if (!tmpDir.exists(tmpDirName)) {
- ifVerbose("Could not create temporary folder!");
- return false;
- }
- tmpDir.cd(tmpDirName);
- }
-
- if (tmpDir.exists(tmpAppName) && !tmpDir.remove(tmpAppName)) {
- ifVerbose("Could not remove old temporary uninstaller!");
- return false;
- }
-
- QString tmpUninstaller = tmpDir.absoluteFilePath(tmpAppName);
-
- QFile in(uninstallerFile);
- if (!in.open(QIODevice::ReadOnly)) {
- ifVerbose("Cannot open uninstall.exe!");
- return false;
- }
-
- QFile out(tmpUninstaller);
- if (!out.open(QIODevice::WriteOnly)) {
- ifVerbose("Cannot open temporary uninstall.exe!");
- return false;
- }
-
- QByteArray ba = in.readAll();
- QBuffer buf(&ba);
- buf.open(QIODevice::ReadWrite);
- buf.seek(buf.size() - sizeof(qint64));
- appendInt(&buf, magicTempUninstallerMarker);
- if (in.size() != out.write(buf.data())) {
- ifVerbose("Could not copy uninstaller!");
- return false;
- }
-
- in.close();
- out.close();
-
- MoveFileExW((TCHAR*)tmpUninstaller.utf16(),
- 0, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
-
- STARTUPINFOW sInfo;
- PROCESS_INFORMATION pInfo;
- memset(&sInfo, 0, sizeof(sInfo));
- memset(&pInfo, 0, sizeof(pInfo));
- sInfo.cb = sizeof(sInfo);
-
- QString cmd = QString("\"%1\"").arg(tmpUninstaller);
- foreach (const QString &s, args)
- cmd.append(QLatin1String(" \"") + s + QLatin1String("\""));
- if (CreateProcessW(0, (TCHAR*)cmd.utf16(), 0, 0, false, 0, 0, 0, &sInfo, &pInfo)) {
- CloseHandle(pInfo.hThread);
- CloseHandle(pInfo.hProcess);
- ifVerbose("Started temp uninstaller.");
- } else {
- ifVerbose("Cannot launch uninstaller!");
- return false;
- }
- }
-#else
- Q_UNUSED(args);
-#endif
- return true;
-}
-
-void QInstaller::Private::runUninstaller()
-{
- QFile uninstaller(installerBinaryPath());
- openForRead(uninstaller);
- QByteArray ba = uninstaller.readAll();
- uninstaller.close();
-
- emit uninstallationStarted();
-#ifndef Q_OS_WIN
- // remove uninstaller binary itself. Also necessary for successful
- // removal of the application directory.
- uninstaller.remove();
-#else
- if (m_vars.contains(QLatin1String("UninstallerPath"))) {
- QFile orgUninstaller(m_vars.value(QLatin1String("UninstallerPath")));
- orgUninstaller.remove();
- }
-#endif
-
- // read file
- QBuffer in(&ba);
- in.open(QIODevice::ReadOnly);
- in.seek(m_tasksStart);
- qint64 taskCount = retrieveInt(&in);
- ifVerbose("FOUND " << taskCount << "UNINSTALLER TASKS");
-
- m_totalProgress = m_variablesStart;
- for (int i = 0; i != taskCount; ++i) {
- int code = retrieveInt(&in);
- QInstallerTask *task = createTaskFromCode(code);
- task->readAndExecuteFromUninstaller(&in);
- setInstallationProgress(in.pos());
- }
- in.close();
-
- unregisterInstaller();
-
- m_installationProgressText = tr("Deinstallation finished");
- qApp->processEvents();
- emit uninstallationFinished();
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstaller
-//
-////////////////////////////////////////////////////////////////////
-
-QInstaller::QInstaller()
-{
- d = new Private(this);
- d->initialize();
- registerTaskType(createCopyFileTask);
- registerTaskType(createLinkFileTask);
- registerTaskType(createPatchFileTask);
- registerTaskType(createWriteSettingsTask);
- registerTaskType(createMenuShortcutTask);
-}
-
-QInstaller::~QInstaller()
-{
- delete d;
-}
-
-void QInstaller::appendComponent(QInstallerComponent *component)
-{
- d->m_components.append(component);
-}
-
-int QInstaller::componentCount() const
-{
- return d->m_components.size();
-}
-
-QInstallerComponent *QInstaller::component(int i) const
-{
- return d->m_components.at(i);
-}
-
-void QInstaller::registerTaskType(TaskCreator tc)
-{
- d->m_taskCreators.append(tc);
-}
-
-int QInstaller::indexOfTaskType(TaskCreator tc) const
-{
- return d->m_taskCreators.indexOf(tc);
-}
-
-QString QInstaller::value(const QString &key, const QString &defaultValue) const
-{
- return d->m_vars.value(key, defaultValue);
-}
-
-void QInstaller::setValue(const QString &key, const QString &value)
-{
- d->m_vars[key] = value;
-}
-
-bool QInstaller::containsValue(const QString &key) const
-{
- return d->m_vars.contains(key);
-}
-
-bool QInstaller::isVerbose() const
-{
- return d->m_verbose;
-}
-
-void QInstaller::setVerbose(bool on)
-{
- d->m_verbose = on;
-}
-
-QInstaller::InstallerStatus QInstaller::status() const
-{
- return d->m_status;
-}
-
-void QInstaller::interrupt()
-{
- qDebug() << "INTERRUPT INSTALLER";
- d->m_status = InstallerCanceledByUser;
-}
-
-QString QInstaller::replaceVariables(const QString &str) const
-{
- return d->replaceVariables(str);
-}
-
-QByteArray QInstaller::replaceVariables(const QByteArray &ba) const
-{
- return d->replaceVariables(ba);
-}
-
-int QInstaller::installationProgress() const
-{
- return d->m_installationProgress;
-}
-
-void QInstaller::setInstallationProgressText(const QString &value)
-{
- d->m_installationProgressText = value;
-}
-
-QString QInstaller::installationProgressText() const
-{
- return d->m_installationProgressText;
-}
-
-QString QInstaller::installerBinaryPath() const
-{
- return d->installerBinaryPath();
-}
-
-bool QInstaller::isCreator() const
-{
- return d->isCreator();
-}
-
-bool QInstaller::isInstaller() const
-{
- return d->isInstaller();
-}
-
-bool QInstaller::isUninstaller() const
-{
- return d->isUninstaller();
-}
-
-bool QInstaller::isTempUninstaller() const
-{
- return d->isTempUninstaller();
-}
-
-bool QInstaller::runInstaller()
-{
- try { d->runInstaller(); return true; } catch (...) { return false; }
-}
-
-bool QInstaller::runUninstaller()
-{
- try { d->runUninstaller(); return true; } catch (...) { return false; }
-}
-
-void QInstaller::showWarning(const QString &str)
-{
- emit warning(str);
-}
-
-void QInstaller::dump() const
-{
- qDebug() << "COMMAND LINE VARIABLES:" << d->m_vars;
-}
-
-void QInstaller::appendInt(QIODevice *out, qint64 n)
-{
- QT_PREPEND_NAMESPACE(appendInt)(out, n);
-}
-
-void QInstaller::appendString(QIODevice *out, const QString &str)
-{
- QT_PREPEND_NAMESPACE(appendString)(out, str);
-}
-
-void QInstaller::appendByteArray(QIODevice *out, const QByteArray &str)
-{
- QT_PREPEND_NAMESPACE(appendByteArray)(out, str);
-}
-
-qint64 QInstaller::retrieveInt(QIODevice *in)
-{
- return QT_PREPEND_NAMESPACE(retrieveInt)(in);
-}
-
-QString QInstaller::retrieveString(QIODevice *in)
-{
- return QT_PREPEND_NAMESPACE(retrieveString)(in);
-}
-
-QByteArray QInstaller::retrieveByteArray(QIODevice *in)
-{
- return QT_PREPEND_NAMESPACE(retrieveByteArray)(in);
-}
-
-bool QInstaller::run()
-{
- try {
- if (isCreator()) {
- createTasks(); // implemented in derived classes
- d->writeInstaller();
- } else if (isInstaller()) {
- d->runInstaller();
- } else if (isUninstaller() || isTempUninstaller()) {
- runUninstaller();
- }
- return true;
- } catch (const QInstallerError &err) {
- qDebug() << "Caught Installer Error: " << err.message();
- return false;
- }
-}
-
-QString QInstaller::uninstallerName() const
-{
- return d->uninstallerName();
-}
-
-QString QInstaller::libraryName(const QString &baseName, const QString &version)
-{
-#ifdef Q_OS_WIN
- return baseName + QLatin1String(".dll");
-#elif Q_OS_MAC
- return QString("lib%1.dylib").arg(baseName);
-#else
- return QString("lib%1.so.%2").arg(baseName).arg(version);
-#endif
-}
-
-bool QInstaller::restartTempUninstaller(const QStringList &args)
-{
- return d->restartTempUninstaller(args);
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerTask
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerTask::QInstallerTask(QInstaller *parent)
- : m_installer(parent)
-{}
-
-QInstaller *QInstallerTask::installer() const
-{
- return m_installer;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerCopyFileTask
-//
-////////////////////////////////////////////////////////////////////
-
-QInstaller::TaskCreator QInstallerCopyFileTask::creator() const
-{
- return &createCopyFileTask;
-}
-
-void QInstallerCopyFileTask::writeToInstaller(QIODevice *out) const
-{
- appendString(out, m_targetPath);
- appendInt(out, m_permissions);
- QFile file(m_sourcePath);
- openForRead(file);
- appendFileData(out, &file);
-}
-
-static int createParentDirs(const QString &absFileName)
-{
- QFileInfo fi(absFileName);
- if (fi.isDir())
- return 0;
- QString dirName = fi.path();
- int n = createParentDirs(dirName);
- QDir dir(dirName);
- dir.mkdir(fi.fileName());
- return n + 1;
-}
-
-void QInstallerCopyFileTask::readAndExecuteFromInstaller(QIODevice *in)
-{
- m_targetPath = installer()->replaceVariables(retrieveString(in));
- m_permissions = retrieveInt(in);
- ifVerbose("EXECUTE COPY FILE, TARGET " << m_targetPath);
-
- QString path = QDir::cleanPath(QFileInfo(m_targetPath).absolutePath());
- m_parentDirCount = createParentDirs(path);
- QString msg = QInstaller::tr("Copying file %1").arg(m_targetPath);
- installer()->setInstallationProgressText(msg);
-
- QFile file(m_targetPath);
- bool res = file.open(QIODevice::WriteOnly);
- if (!res) {
- // try to make it writeable, and try again
- bool res1 = file.setPermissions(file.permissions()|QFile::WriteOwner);
- ifVerbose("MAKE WRITABLE: " << res1);
- res = file.open(QIODevice::WriteOnly);
- }
- if (!res) {
- // try to remove it, and try again
- bool res1 = file.remove();
- ifVerbose("REMOVING FILE: " << res1);
- res = file.open(QIODevice::WriteOnly);
- }
-
- if (!res) {
- QString msg = QInstaller::tr("The file %1 is not writeable.")
- .arg(m_targetPath);
- installer()->showWarning(msg);
- throw Error(msg);
- }
- retrieveFileData(&file, in);
- QFile::Permissions perms(m_permissions | QFile::WriteOwner);
- file.close();
- file.setPermissions(perms);
-}
-
-void QInstallerCopyFileTask::writeToUninstaller(QIODevice *out) const
-{
- appendString(out, m_targetPath);
- appendInt(out, m_parentDirCount);
-}
-
-void QInstallerCopyFileTask::readAndExecuteFromUninstaller(QIODevice *in)
-{
- m_targetPath = retrieveString(in);
- m_parentDirCount = retrieveInt(in);
- undo();
-}
-
-void QInstallerCopyFileTask::undo()
-{
- ifVerbose("UNLINKING FILE" << m_targetPath << m_parentDirCount);
- QString msg = QInstaller::tr("Removing %1").arg(m_targetPath);
- installer()->setInstallationProgressText(msg);
-
- QFileInfo fi(m_targetPath);
- QDir dir(fi.path());
-
- QFile file(m_targetPath);
- bool res = file.remove();
- if (!res) {
- // try to make it writeable, and try again
- bool res1 = file.setPermissions(file.permissions()|QFile::WriteOwner);
- ifVerbose("MAKE WRITABLE: " << res1);
- res = file.remove();
- }
-
- while (res && --m_parentDirCount >= 0) {
- QString dirName = dir.dirName();
- dir.cdUp();
- res = dir.rmdir(dirName);
- msg = QInstaller::tr("Removing file %1").arg(m_targetPath);
- installer()->setInstallationProgressText(msg);
- ifVerbose("REMOVING DIR " << dir.path() << dirName << res);
- }
-}
-
-void QInstallerCopyFileTask::dump(QDebug & os) const
-{
- os << "c|" + sourcePath() + '|' + targetPath();
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerLinkFileTask
-//
-////////////////////////////////////////////////////////////////////
-
-QInstaller::TaskCreator QInstallerLinkFileTask::creator() const
-{
- return &createLinkFileTask;
-}
-
-void QInstallerLinkFileTask::writeToInstaller(QIODevice *out) const
-{
- appendString(out, m_targetPath);
- appendString(out, m_linkTargetPath);
- appendInt(out, m_permissions);
-}
-
-void QInstallerLinkFileTask::readAndExecuteFromInstaller(QIODevice *in)
-{
- m_targetPath = installer()->replaceVariables(retrieveString(in));
- m_linkTargetPath = installer()->replaceVariables(retrieveString(in));
- m_permissions = retrieveInt(in);
-
- ifVerbose("LINK " << m_targetPath << " TARGET " << m_linkTargetPath);
-
- QFile file(m_linkTargetPath);
- if (file.link(m_targetPath))
- return;
-
- // ok. linking failed. try to remove targetPath and link again
- bool res1 = QFile::remove(m_targetPath);
- ifVerbose("TARGET EXITS, REMOVE: " << m_targetPath << res1);
- if (file.link(m_targetPath))
- return;
-
- // nothing helped.
- throw Error(QInstaller::tr("Cannot link file %1 to %2:\n")
- .arg(m_linkTargetPath).arg(m_targetPath));
-}
-
-void QInstallerLinkFileTask::writeToUninstaller(QIODevice *out) const
-{
- appendString(out, m_targetPath);
-}
-
-void QInstallerLinkFileTask::readAndExecuteFromUninstaller(QIODevice *in)
-{
- m_targetPath = retrieveString(in);
- ifVerbose("UNLINKING LINK" << m_targetPath);
- undo();
-}
-
-void QInstallerLinkFileTask::undo()
-{
- QFile file(m_targetPath);
- file.remove();
-}
-
-void QInstallerLinkFileTask::dump(QDebug & os) const
-{
- os << "l|" + targetPath() + '|' + linkTargetPath();
-}
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerWriteSettingsTask
-//
-////////////////////////////////////////////////////////////////////
-
-QInstaller::TaskCreator QInstallerWriteSettingsTask::creator() const
-{
- return &createWriteSettingsTask;
-}
-
-void QInstallerWriteSettingsTask::writeToInstaller(QIODevice *out) const
-{
- appendString(out, m_key);
- appendString(out, m_value);
-}
-
-void QInstallerWriteSettingsTask::readAndExecuteFromInstaller(QIODevice *in)
-{
- m_key = installer()->replaceVariables(retrieveString(in));
- m_value = installer()->replaceVariables(retrieveString(in));
- QSettings settings;
- settings.setValue(m_key, m_value);
-}
-
-void QInstallerWriteSettingsTask::writeToUninstaller(QIODevice *out) const
-{
- appendString(out, m_key);
- appendString(out, m_value);
-}
-
-void QInstallerWriteSettingsTask::readAndExecuteFromUninstaller(QIODevice *in)
-{
- m_key = installer()->replaceVariables(retrieveString(in));
- m_value = installer()->replaceVariables(retrieveString(in));
- undo();
-}
-
-void QInstallerWriteSettingsTask::undo()
-{
- QSettings settings;
- settings.setValue(m_key, QString());
-}
-
-void QInstallerWriteSettingsTask::dump(QDebug & os) const
-{
- os << "s|" + key() + '|' + value();
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerPatchFileTask
-//
-////////////////////////////////////////////////////////////////////
-
-QInstaller::TaskCreator QInstallerPatchFileTask::creator() const
-{
- return &createPatchFileTask;
-}
-
-void QInstallerPatchFileTask::writeToInstaller(QIODevice *out) const
-{
- appendString(out, m_targetPath);
- appendByteArray(out, m_needle);
- appendByteArray(out, m_replacement);
-}
-
-void QInstallerPatchFileTask::readAndExecuteFromInstaller(QIODevice *in)
-{
- m_targetPath = installer()->replaceVariables(retrieveString(in));
- m_needle = retrieveByteArray(in);
- m_replacement = installer()->replaceVariables(retrieveByteArray(in));
- ifVerbose("PATCHING" << m_replacement << m_needle << m_targetPath);
-
- QFile file;
- file.setFileName(m_targetPath);
- if (!file.open(QIODevice::ReadWrite))
- throw Error(QInstaller::tr("Cannot open file %1 for reading").arg(file.fileName()));
-
- uchar *data = file.map(0, file.size());
- if (!data)
- throw Error(QInstaller::tr("Cannot map file %1").arg(file.fileName()));
- QByteArray ba = QByteArray::fromRawData((const char *)data, file.size());
- int pos = ba.indexOf(m_needle);
- if (pos != -1) {
- for (int i = m_replacement.size(); --i >= 0; )
- data[pos + i] = m_replacement.at(i);
- }
- if (!file.unmap(data))
- throw Error(QInstaller::tr("Cannot unmap file %1").arg(file.fileName()));
- file.close();
-}
-
-void QInstallerPatchFileTask::dump(QDebug & os) const
-{
- os << "p|" + targetPath() + '|' + needle() + '|' + replacement();
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerMenuShortcutTask
-//
-//
-// Usage:
-//
-// static const struct
-// {
-// const char *target;
-// const char *linkTarget;
-// } menuShortcuts[] = {
-// {"Qt Creator by Nokia\\Run Qt Creator", "bin\\qtcreator.exe"},
-// {"Qt Creator by Nokia\\Readme", "readme.txt"},
-// {"Qt Creator by Nokia\\Uninstall", "uninstall.exe"}
-// };
-//
-// for (int i = 0; i != sizeof(menuShortcuts) / sizeof(menuShortcuts[0]); ++i) {
-// QInstallerMenuShortcutTask *task = new QInstallerMenuShortcutTask(this);
-// task->setTargetPath(menuShortcuts[i].target);
-// task->setLinkTargetPath(QLatin1String("@TargetDir@\\") + menuShortcuts[i].linkTarget);
-// }
-//
-////////////////////////////////////////////////////////////////////
-
-QInstaller::TaskCreator QInstallerMenuShortcutTask::creator() const
-{
- return &createMenuShortcutTask;
-}
-
-void QInstallerMenuShortcutTask::writeToInstaller(QIODevice *out) const
-{
- appendString(out, m_targetPath);
- appendString(out, m_linkTargetPath);
-}
-
-void QInstallerMenuShortcutTask::readAndExecuteFromInstaller(QIODevice *in)
-{
- m_targetPath = installer()->replaceVariables(retrieveString(in));
- m_linkTargetPath = installer()->replaceVariables(retrieveString(in));
-
-#ifdef Q_OS_WIN
- QString workingDir = installer()->value(QLatin1String("TargetDir"));
- bool res = false;
- HRESULT hres;
- IShellLink *psl;
- bool neededCoInit = false;
-
- ifVerbose("CREATE MENU SHORTCUT: " << m_targetPath << " TARGET " << m_linkTargetPath);
-
- if (installer()->value(QLatin1String("AllUsers")) == "true") {
- QSettings registry(QLatin1String("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows"
- "\\CurrentVersion\\Explorer\\Shell Folders"), QSettings::NativeFormat);
- m_startMenuPath = registry.value(QLatin1String("Common Programs"), QString()).toString();
- } else {
- QSettings registry(QLatin1String("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows"
- "\\CurrentVersion\\Explorer\\Shell Folders"), QSettings::NativeFormat);
- m_startMenuPath = registry.value(QLatin1String("Programs"), QString()).toString();
- }
- if (m_startMenuPath.isEmpty()) {
- ifVerbose("CREATE MENU SHORTCUT: Cannot find start menu folder!");
- return;
- }
-
- if (!m_targetPath.isEmpty()) {
- if (!m_targetPath.endsWith(QLatin1String(".lnk")))
- m_targetPath.append(QLatin1String(".lnk"));
- m_targetPath = m_targetPath.replace('/', '\\');
- int i = m_targetPath.lastIndexOf('\\');
- if (i > -1) {
- QDir dir(m_startMenuPath);
- if (!dir.exists(m_targetPath.left(i)))
- dir.mkpath(m_targetPath.left(i));
- }
-
- if (m_linkTargetPath.isEmpty())
- return;
-
- QString trgt = m_linkTargetPath;
- if (trgt.startsWith('\"')) {
- trgt = trgt.left(trgt.indexOf('\"', 1) + 1);
- } else {
- trgt = trgt.left(trgt.indexOf(' '));
- }
- if (trgt.isEmpty())
- trgt = m_linkTargetPath;
-
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
- if (hres == CO_E_NOTINITIALIZED) {
- neededCoInit = true;
- CoInitialize(NULL);
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink,
- (void **)&psl);
- }
- if (SUCCEEDED(hres)) {
- hres = psl->SetPath((wchar_t *)trgt.utf16());
- if (SUCCEEDED(hres)) {
- hres = psl->SetArguments((wchar_t *)m_linkTargetPath.mid(trgt.length()).utf16());
- if (SUCCEEDED(hres)) {
- hres = psl->SetWorkingDirectory((wchar_t *)workingDir.utf16());
- if (SUCCEEDED(hres)) {
- IPersistFile *ppf;
- hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
- if (SUCCEEDED(hres)) {
- hres = ppf->Save((TCHAR*)QString(m_startMenuPath
- + QDir::separator() + m_targetPath).utf16(), TRUE);
- if (SUCCEEDED(hres))
- res = true;
- ppf->Release();
- }
- }
- }
- }
- psl->Release();
- }
- if (neededCoInit)
- CoUninitialize();
- }
- if (!res) {
- QString msg = QInstaller::tr("Cannot create menu shortcut %1 to %2:\n")
- .arg(m_linkTargetPath).arg(m_targetPath);
- installer()->showWarning(msg);
- return;
- }
-#endif
-}
-
-void QInstallerMenuShortcutTask::writeToUninstaller(QIODevice *out) const
-{
- appendString(out, m_targetPath);
- appendString(out, m_startMenuPath);
-}
-
-void QInstallerMenuShortcutTask::readAndExecuteFromUninstaller(QIODevice *in)
-{
- m_targetPath = retrieveString(in);
- m_startMenuPath = retrieveString(in);
- ifVerbose("REMOVE MENU SHORTCUT: " << m_targetPath);
- undo();
-}
-
-void QInstallerMenuShortcutTask::undo()
-{
-#ifdef Q_OS_WIN
- QFileInfo fi(m_startMenuPath + QDir::separator() + m_targetPath);
- QString path = fi.absoluteFilePath();
- if (fi.isFile()) {
- path = fi.absolutePath();
- QFile file(fi.absoluteFilePath());
- file.remove();
- }
- QDir dir(m_startMenuPath);
- dir.rmpath(path);
-#endif
-}
-
-void QInstallerMenuShortcutTask::dump(QDebug & os) const
-{
- os << "msc|" + targetPath() + '|' + linkTargetPath();
-}
-
-QT_END_NAMESPACE
-
-#include "qinstaller.moc"
diff --git a/installer/qinstaller.h b/installer/qinstaller.h
deleted file mode 100644
index ea3a97f8d5..0000000000
--- a/installer/qinstaller.h
+++ /dev/null
@@ -1,357 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 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 GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#ifndef QINSTALLER_H
-#define QINSTALLER_H
-
-#include <QtCore/QObject>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QIODevice;
-class QInstallerTask;
-class QInstallerComponent;
-
-class QInstaller : public QObject
-{
- Q_OBJECT
-
-public:
- QInstaller();
- ~QInstaller();
-
- bool run();
-
- // parameter handling
- void setValue(const QString &key, const QString &value);
- QString value(const QString &key,
- const QString &defaultValue = QString()) const;
- bool containsValue(const QString &key) const;
- QString replaceVariables(const QString &str) const;
- QByteArray replaceVariables(const QByteArray &str) const;
- QString installerBinaryPath() const;
- QString uninstallerName() const;
-
- // installer-specific task creation
- virtual void createTasks() {}
-
- // component handling
- void appendComponent(QInstallerComponent *components);
- int componentCount() const;
- QInstallerComponent *component(int i) const;
- typedef QInstallerTask *(*TaskCreator)(QInstaller *);
- void registerTaskType(TaskCreator);
- int indexOfTaskType(TaskCreator) const;
-
- // progress handling
- //void setInstallationProgress(int);
- int installationProgress() const;
- void setInstallationProgressText(const QString &);
- QString installationProgressText() const;
-
- // convenience
- bool isCreator() const;
- bool isInstaller() const;
- bool isUninstaller() const;
- bool isTempUninstaller() const;
-
- bool isVerbose() const;
- void setVerbose(bool on);
- void connectGui(QObject *gui);
-
- QString libraryName(const QString &baseName, const QString &version);
-
- bool restartTempUninstaller(const QStringList &args);
-
- // status
- enum InstallerStatus {
- InstallerUnfinished,
- InstallerCanceledByUser,
- InstallerFailed,
- InstallerSucceeded,
- };
- InstallerStatus status() const;
-
- // I/O helper for authors of classes deriving from QInstallerStep
- static void appendInt(QIODevice *out, qint64 n);
- static void appendString(QIODevice *out, const QString &str);
- static void appendByteArray(QIODevice *out, const QByteArray &str);
- static qint64 retrieveInt(QIODevice *in);
- static QString retrieveString(QIODevice *in);
- static QByteArray retrieveByteArray(QIODevice *in);
-
- void dump() const;
- class Private;
-
-public slots:
- bool runInstaller();
- bool runUninstaller();
- void interrupt();
- void showWarning(const QString &);
-
-signals:
- void installationStarted();
- void installationFinished();
- void uninstallationStarted();
- void uninstallationFinished();
- void warning(QString);
-
-private:
- Private *d;
-};
-
-
-class QInstallerComponent
-{
-public:
- explicit QInstallerComponent(QInstaller *installer);
- ~QInstallerComponent();
-
- void setValue(const QString &key, const QString &value);
- QString value(const QString &key,
- const QString &defaultValue = QString()) const;
-
- void appendTask(QInstallerTask *step);
- void appendDirectoryTasks(const QString &sourcePath,
- const QString &targetPath);
- void appendSettingsTask(const QString &key, const QString &value);
- void appendUninstallerRegistrationTask();
- int taskCount() const;
- QInstallerTask *task(int) const;
-
- friend class QInstaller;
- friend class QInstaller::Private;
-private:
- Q_DISABLE_COPY(QInstallerComponent);
- class Private;
- Private *d;
-};
-
-
-class QInstallerTask
-{
-public:
- QInstallerTask(QInstaller *parent);
- virtual ~QInstallerTask() {}
-
- QInstaller *installer() const;
-
- virtual void writeToInstaller(QIODevice *out) const = 0;
- virtual void readAndExecuteFromInstaller(QIODevice *in) = 0;
-
- virtual void writeToUninstaller(QIODevice *out) const = 0;
- virtual void readAndExecuteFromUninstaller(QIODevice *in) = 0;
-
- virtual void undo() = 0;
- virtual void dump(QDebug &) const {}
-
- virtual QInstaller::TaskCreator creator() const = 0;
-
-private:
- QInstaller *m_installer;
-};
-
-
-class QInstallerError
-{
-public:
- QInstallerError(const QString &m) : m_message(m) {}
- virtual ~QInstallerError() {}
- virtual QString message() const { return m_message; }
-private:
- QString m_message;
-};
-
-/////////////////////////////////////////////////////////////////////
-//
-// Some useful examples
-//
-/////////////////////////////////////////////////////////////////////
-
-
-class QInstallerCopyFileTask : public QInstallerTask
-{
-public:
- QInstallerCopyFileTask(QInstaller *parent) : QInstallerTask(parent) {}
- QInstaller::TaskCreator creator() const;
-
- void setSourcePath(const QString &sourcePath) { m_sourcePath = sourcePath; }
- QString sourcePath() const { return m_sourcePath; }
-
- void setTargetPath(const QString &targetPath) { m_targetPath = targetPath; }
- QString targetPath() const { return m_targetPath; }
-
- void setPermissions(qint64 permissions) { m_permissions = permissions; }
- qint64 permissions() const { return m_permissions; }
-
- void writeToInstaller(QIODevice *out) const;
- void readAndExecuteFromInstaller(QIODevice *in);
-
- void writeToUninstaller(QIODevice *out) const;
- void readAndExecuteFromUninstaller(QIODevice *in);
-
- void undo();
- void dump(QDebug &) const;
-
-private:
- QString m_sourcePath;
- QString m_targetPath;
- qint64 m_permissions;
- int m_parentDirCount;
-};
-
-
-class QInstallerLinkFileTask : public QInstallerTask
-{
-public:
- QInstallerLinkFileTask(QInstaller *parent) : QInstallerTask(parent) {}
- QInstaller::TaskCreator creator() const;
-
- void setTargetPath(const QString &path) { m_targetPath = path; }
- QString targetPath() const { return m_targetPath; }
-
- void setLinkTargetPath(const QString &path) { m_linkTargetPath = path; }
- QString linkTargetPath() const { return m_linkTargetPath; }
-
- void setPermissions(qint64 permissions) { m_permissions = permissions; }
- qint64 permissions() const { return m_permissions; }
-
- void writeToInstaller(QIODevice *out) const;
- void readAndExecuteFromInstaller(QIODevice *in);
-
- void writeToUninstaller(QIODevice *out) const;
- void readAndExecuteFromUninstaller(QIODevice *in);
-
- void undo();
- void dump(QDebug &) const;
-
-public:
- QString m_targetPath; // location of the link in the target system
- QString m_linkTargetPath; // linkee
- qint64 m_permissions;
-};
-
-
-class QInstallerWriteSettingsTask : public QInstallerTask
-{
-public:
- QInstallerWriteSettingsTask(QInstaller *parent)
- : QInstallerTask(parent) {}
- QInstaller::TaskCreator creator() const;
-
- void setKey(const QString &key) { m_key = key; }
- QString key() const { return m_key; }
-
- void setValue(const QString &value) { m_value = value; }
- QString value() const { return m_value; }
-
- void writeToInstaller(QIODevice *out) const;
- void readAndExecuteFromInstaller(QIODevice *in);
-
- void writeToUninstaller(QIODevice *out) const;
- void readAndExecuteFromUninstaller(QIODevice *in);
-
- void undo();
- void dump(QDebug &) const;
-
-public:
- QString m_key;
- QString m_value;
-};
-
-
-class QInstallerPatchFileTask : public QInstallerTask
-{
-public:
- QInstallerPatchFileTask(QInstaller *parent) : QInstallerTask(parent) {}
- QInstaller::TaskCreator creator() const;
-
- void setTargetPath(const QString &path) { m_targetPath = path; }
- QString targetPath() const { return m_targetPath; }
-
- void setNeedle(const QByteArray &needle) { m_needle = needle; }
- QByteArray needle() const { return m_needle; }
-
- void setReplacement(const QByteArray &repl) { m_replacement = repl; }
- QByteArray replacement() const { return m_replacement; }
-
- void writeToInstaller(QIODevice *out) const;
- void readAndExecuteFromInstaller(QIODevice *in);
-
- void writeToUninstaller(QIODevice *) const {}
- void readAndExecuteFromUninstaller(QIODevice *) {}
-
- void undo() {}
- void dump(QDebug &) const;
-
-private:
- QByteArray m_needle;
- QByteArray m_replacement;
- QString m_targetPath;
-};
-
-
-class QInstallerMenuShortcutTask : public QInstallerTask
-{
-public:
- QInstallerMenuShortcutTask(QInstaller *parent) : QInstallerTask(parent) {}
- QInstaller::TaskCreator creator() const;
-
- void setTargetPath(const QString &path) { m_targetPath = path; }
- QString targetPath() const { return m_targetPath; }
-
- void setLinkTargetPath(const QString &path) { m_linkTargetPath = path; }
- QString linkTargetPath() const { return m_linkTargetPath; }
-
- void writeToInstaller(QIODevice *out) const;
- void readAndExecuteFromInstaller(QIODevice *in);
-
- void writeToUninstaller(QIODevice *out) const;
- void readAndExecuteFromUninstaller(QIODevice *in);
-
- void undo();
- void dump(QDebug &) const;
-
-public:
- QString m_targetPath;
- QString m_linkTargetPath;
- QString m_startMenuPath;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QINSTALLER_H
diff --git a/installer/qinstallergui.cpp b/installer/qinstallergui.cpp
deleted file mode 100644
index ca2c6d73c0..0000000000
--- a/installer/qinstallergui.cpp
+++ /dev/null
@@ -1,742 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 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 GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#include "qinstallergui.h"
-
-#include "qinstaller.h"
-#include "private/qobject_p.h"
-
-#include <QtCore/QDebug>
-#include <QtCore/QDir>
-#include <QtCore/QProcess>
-#include <QtCore/QRegExp>
-#include <QtCore/QTimer>
-
-#include <QtGui/QApplication>
-#include <QtGui/QCheckBox>
-#include <QtGui/QFileDialog>
-#include <QtGui/QGridLayout>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QHeaderView>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QMessageBox>
-#include <QtGui/QProgressBar>
-#include <QtGui/QPushButton>
-#include <QtGui/QRadioButton>
-#include <QtGui/QTextEdit>
-#include <QtGui/QTreeWidget>
-#include <QtGui/QTreeView>
-#include <QtGui/QVBoxLayout>
-
-
-QT_BEGIN_NAMESPACE
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerGui
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerGui::QInstallerGui(QInstaller *installer, QWidget *parent)
- : QWizard(parent)
-{
- #ifndef Q_WS_MAC
- setWizardStyle(QWizard::ModernStyle);
- #endif
- setOption(QWizard::IndependentPages);
- connect(button(QWizard::CancelButton), SIGNAL(clicked()),
- this, SLOT(cancelButtonClicked()));
-
- connect(this, SIGNAL(interrupted()),
- installer, SLOT(interrupt()));
- connect(installer, SIGNAL(installationFinished()),
- this, SLOT(showFinishedPage()));
- connect(installer, SIGNAL(warning(QString)),
- this, SLOT(showWarning(QString)));
-}
-
-void QInstallerGui::cancelButtonClicked()
-{
- QInstallerPage *page = qobject_cast<QInstallerPage *>(currentPage());
- qDebug() << "CANCEL CLICKED" << currentPage() << page;
- if (page && page->isInterruptible()) {
- QMessageBox::StandardButton bt = QMessageBox::warning(this,
- tr("Warning"),
- tr("Do you want to abort the installation process?"),
- QMessageBox::Yes | QMessageBox::No);
- if (bt == QMessageBox::Yes)
- emit interrupted();
- } else {
- QMessageBox::StandardButton bt = QMessageBox::warning(this,
- tr("Warning"),
- tr("Do you want to abort the installer application?"),
- QMessageBox::Yes | QMessageBox::No);
- if (bt == QMessageBox::Yes)
- QDialog::reject();
- }
-}
-
-void QInstallerGui::reject()
-{}
-
-void QInstallerGui::showFinishedPage()
-{
- qDebug() << "SHOW FINISHED PAGE";
- next();
-}
-
-void QInstallerGui::showWarning(const QString &msg)
-{
- QMessageBox::warning(this, tr("Warning"), msg);
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerPage::QInstallerPage(QInstaller *installer)
- : m_installer(installer), m_fresh(true)
-{
- setSubTitle(QString(" ")); // otherwise the colors will screw up
-
-}
-
-QInstaller *QInstallerPage::installer() const
-{
- return m_installer;
-}
-
-QPixmap QInstallerPage::watermarkPixmap() const
-{
- return QPixmap(m_installer->value("WatermarkPixmap"));
-}
-
-QPixmap QInstallerPage::logoPixmap() const
-{
- return QPixmap(m_installer->value("LogoPixmap"));
-}
-
-QString QInstallerPage::productName() const
-{
- return m_installer->value("ProductName");
-}
-
-void QInstallerPage::insertWidget(QWidget *widget, const QString &siblingName, int offset)
-{
- QWidget *sibling = findChild<QWidget *>(siblingName);
- QWidget *parent = sibling ? sibling->parentWidget() : 0;
- QLayout *layout = parent ? parent->layout() : 0;
- QBoxLayout *blayout = qobject_cast<QBoxLayout *>(layout);
- //qDebug() << "FOUND: " << sibling << parent << layout << blayout;
- if (blayout) {
- int index = blayout->indexOf(sibling) + offset;
- blayout->insertWidget(index, widget);
- }
-}
-
-QWidget *QInstallerPage::findWidget(const QString &objectName) const
-{
- return findChild<QWidget *>(objectName);
-}
-
-void QInstallerPage::setVisible(bool visible)
-{
- QWizardPage::setVisible(visible);
- qApp->processEvents();
- //qDebug() << "VISIBLE: " << visible << objectName() << installer();
- if (m_fresh && !visible) {
- //qDebug() << "SUPRESSED...";
- m_fresh = false;
- return;
- }
- if (visible)
- entering();
- else
- leaving();
-}
-
-int QInstallerPage::nextId() const
-{
- //qDebug() << "NEXTID";
- return QWizardPage::nextId();
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerIntroductionPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerIntroductionPage::QInstallerIntroductionPage(QInstaller *installer)
- : QInstallerPage(installer)
-{
- setObjectName("IntroductionPage");
- setTitle(tr("Setup - %1").arg(productName()));
- setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
- setSubTitle(QString());
-
- QLabel *msgLabel = new QLabel(this);
- msgLabel->setObjectName("MessageLabel");
- msgLabel->setWordWrap(true);
- msgLabel->setText(QInstaller::tr("Welcome to the %1 Setup Wizard.")
- .arg(productName()));
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(msgLabel);
- setLayout(layout);
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerLicenseAgreementPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerLicenseAgreementPage::QInstallerLicenseAgreementPage(QInstaller *installer)
- : QInstallerPage(installer)
-{
- setObjectName("LicenseAgreementPage");
- setTitle(tr("License Agreement"));
- QString msg = tr("Please read the following License Agreement. "
- "You must accept the terms of this agreement "
- "before continuing with the installation.");
- setPixmap(QWizard::LogoPixmap, logoPixmap());
- setPixmap(QWizard::WatermarkPixmap, QPixmap());
-
- QTextEdit *textEdit = new QTextEdit(this);
- textEdit->setObjectName("LicenseText");
- QFile file(":/resources/license.txt");
- file.open(QIODevice::ReadOnly);
- textEdit->setText(file.readAll());
-
- m_acceptRadioButton = new QRadioButton(tr("I accept the agreement"), this);
- m_rejectRadioButton = new QRadioButton(tr("I do not accept the agreement"), this);
-
- QLabel *msgLabel = new QLabel(msg, this);
- msgLabel->setObjectName("MessageLabel");
- msgLabel->setWordWrap(true);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(msgLabel);
- layout->addWidget(textEdit);
- QHBoxLayout *hlayout = new QHBoxLayout;
- hlayout->addWidget(new QLabel(tr("Do you accept this License?")));
- QVBoxLayout *vlayout = new QVBoxLayout;
- vlayout->addWidget(m_acceptRadioButton);
- vlayout->addWidget(m_rejectRadioButton);
- hlayout->addLayout(vlayout);
- layout->addLayout(hlayout);
- setLayout(layout);
- connect(m_acceptRadioButton, SIGNAL(toggled(bool)),
- this, SIGNAL(completeChanged()));
- connect(m_rejectRadioButton, SIGNAL(toggled(bool)),
- this, SIGNAL(completeChanged()));
-}
-
-bool QInstallerLicenseAgreementPage::isComplete() const
-{
- return m_acceptRadioButton->isChecked();
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerComponentSelectionPage
-//
-////////////////////////////////////////////////////////////////////
-
-static QString niceSizeText(const QString &str)
-{
- qint64 size = str.toInt();
- QString msg = QInstallerComponentSelectionPage::tr(
- "This component will occupy approximately %1 %2 on your harddisk.");
- if (size < 10000)
- return msg.arg(size).arg("Bytes");
- if (size < 1024 * 10000)
- return msg.arg(size / 1024).arg("kBytes");
- return msg.arg(size / 1024 / 1024).arg("MBytes");
-}
-
-class QInstallerComponentSelectionPage::Private : public QObject
-{
- Q_OBJECT
-
-public:
- Private(QInstallerComponentSelectionPage *q_, QInstaller *installer)
- : q(q_), m_installer(installer)
- {
- m_treeView = new QTreeWidget(q);
- m_treeView->setObjectName("TreeView");
- m_treeView->setMouseTracking(true);
- m_treeView->header()->hide();
-
- for (int i = 0; i != installer->componentCount(); ++i) {
- QInstallerComponent *component = installer->component(i);
- QTreeWidgetItem *item = new QTreeWidgetItem(m_treeView);
- item->setText(0, component->value("Name"));
- item->setToolTip(0, component->value("Description"));
- item->setToolTip(1, niceSizeText(component->value("UncompressedSize")));
- //QString current = component->value("CurrentState");
- QString suggested = component->value("SuggestedState");
- if (suggested == "Uninstalled") {
- item->setCheckState(0, Qt::Unchecked);
- } else if (suggested == "AlwaysInstalled") {
- item->setCheckState(0, Qt::PartiallyChecked);
- item->setFlags(item->flags() & ~Qt::ItemIsUserCheckable);
- } else { //if (suggested == "Installed")
- item->setCheckState(0, Qt::Checked);
- }
- }
-
- m_descriptionLabel = new QLabel(q);
- m_descriptionLabel->setWordWrap(true);
-
- m_sizeLabel = new QLabel(q);
- m_sizeLabel->setWordWrap(true);
-
- QVBoxLayout *layout = new QVBoxLayout(q);
- //layout->addWidget(msgLabel);
- QHBoxLayout *hlayout = new QHBoxLayout;
- hlayout->addWidget(m_treeView, 3);
- QVBoxLayout *vlayout = new QVBoxLayout;
- vlayout->addWidget(m_descriptionLabel);
- vlayout->addWidget(m_sizeLabel);
- vlayout->addSpacerItem(new QSpacerItem(1, 1,
- QSizePolicy::MinimumExpanding,
- QSizePolicy::MinimumExpanding));
- hlayout->addLayout(vlayout, 2);
- layout->addLayout(hlayout);
- q->setLayout(layout);
-
- connect(m_treeView,
- SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
- this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
- }
-
-public slots:
- void currentItemChanged(QTreeWidgetItem *item, QTreeWidgetItem *)
- {
- m_descriptionLabel->setText(item->toolTip(0));
- m_sizeLabel->setText(item->toolTip(1));
- }
-
-public:
- QInstallerComponentSelectionPage *q;
- QInstaller *m_installer;
- QTreeWidget *m_treeView;
- QLabel *m_descriptionLabel;
- QLabel *m_sizeLabel;
-};
-
-
-QInstallerComponentSelectionPage::QInstallerComponentSelectionPage
- (QInstaller *installer)
- : QInstallerPage(installer), d(new Private(this, installer))
-{
- setObjectName("ComponentSelectionPage");
- setTitle(tr("Select Components"));
- QString msg = tr("Please select the components you want to install.");
- setSubTitle(msg);
- setPixmap(QWizard::LogoPixmap, logoPixmap());
- setPixmap(QWizard::WatermarkPixmap, QPixmap());
-}
-
-QInstallerComponentSelectionPage::~QInstallerComponentSelectionPage()
-{
- delete d;
-}
-
-void QInstallerComponentSelectionPage::leaving()
-{
- int n = d->m_treeView->topLevelItemCount();
- for (int i = 0; i != n; ++i) {
- QTreeWidgetItem *item = d->m_treeView->topLevelItem(i);
- QInstallerComponent *component = installer()->component(i);
- if (item->checkState(0) == Qt::Unchecked)
- component->setValue("WantedState", "Uninstalled");
- else
- component->setValue("WantedState", "Installed");
- }
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerTargetDirectoryPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerTargetDirectoryPage::QInstallerTargetDirectoryPage(QInstaller *installer)
- : QInstallerPage(installer)
-{
- setObjectName("TargetDirectoryPage");
- setTitle(tr("Installation Directory"));
- setPixmap(QWizard::LogoPixmap, logoPixmap());
- setPixmap(QWizard::WatermarkPixmap, QPixmap());
-
- QLabel *msgLabel = new QLabel(this);
- msgLabel->setText(QInstaller::tr("Please specify the directory where %1 "
- "will be installed.").arg(productName()));
- msgLabel->setWordWrap(true);
- msgLabel->setObjectName("MessageLabel");
-
- m_lineEdit = new QLineEdit(this);
- m_lineEdit->setObjectName("LineEdit");
-
- QPushButton *browseButton = new QPushButton(this);
- browseButton->setObjectName("BrowseButton");
- browseButton->setText("Browse...");
- browseButton->setIcon(QIcon(logoPixmap()));
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(msgLabel);
- QHBoxLayout *hlayout = new QHBoxLayout;
- hlayout->addWidget(m_lineEdit);
- hlayout->addWidget(browseButton);
- layout->addLayout(hlayout);
- setLayout(layout);
-
- QString targetDir = installer->value("TargetDir");
- //targetDir = QDir::currentPath();
- if (targetDir.isEmpty())
- targetDir = QDir::homePath() + QDir::separator() + productName();
- m_lineEdit->setText(targetDir);
-
- connect(browseButton, SIGNAL(clicked()),
- this, SLOT(dirRequested()));
- connect(m_lineEdit, SIGNAL(textChanged(QString)),
- this, SIGNAL(completeChanged()));
-}
-
-QString QInstallerTargetDirectoryPage::targetDir() const
-{
- return m_lineEdit->text();
-}
-
-void QInstallerTargetDirectoryPage::setTargetDir(const QString &dirName)
-{
- m_lineEdit->setText(dirName);
-}
-
-void QInstallerTargetDirectoryPage::entering()
-{
- connect(wizard(), SIGNAL(customButtonClicked(int)),
- this, SLOT(targetDirSelected()));
-}
-
-void QInstallerTargetDirectoryPage::leaving()
-{
- installer()->setValue("TargetDir", targetDir());
- disconnect(wizard(), SIGNAL(customButtonClicked(int)),
- this, SLOT(targetDirSelected()));
-}
-
-void QInstallerTargetDirectoryPage::targetDirSelected()
-{
- //qDebug() << "TARGET DIRECTORY";
- QDir dir(targetDir());
- if (dir.exists() && dir.isReadable()) {
- QMessageBox::StandardButton bt = QMessageBox::warning(this,
- tr("Warning"),
- tr("The directory you slected exists already.\n"
- "Do you want to continue?"),
- QMessageBox::Yes | QMessageBox::No);
- if (bt == QMessageBox::Yes)
- wizard()->next();
- return;
- }
- dir.cdUp();
- if (dir.exists() && dir.isReadable()) {
- wizard()->next();
- return;
- }
- wizard()->next();
-}
-
-void QInstallerTargetDirectoryPage::dirRequested()
-{
- //qDebug() << "DIR REQUESTED";
- QString newDirName = QFileDialog::getExistingDirectory(this,
- tr("Select Installation Directory"), targetDir()
- /*, Options options = ShowDirsOnly*/);
- if (newDirName.isEmpty() || newDirName == targetDir())
- return;
- m_lineEdit->setText(newDirName);
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerReadyForInstallationPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerReadyForInstallationPage::
- QInstallerReadyForInstallationPage(QInstaller *installer)
- : QInstallerPage(installer)
-{
- setObjectName("ReadyForInstallationPage");
- setTitle(tr("Ready to Install"));
- setCommitPage(true);
- setButtonText(QWizard::CommitButton, tr("Install"));
-
- QLabel *msgLabel = new QLabel(this);
- msgLabel->setObjectName("MessageLabel");
- msgLabel->setText(QInstaller::tr("Setup is now ready to begin installing %1 "
- "on your computer.").arg(productName()));
-
- QLayout *layout = new QVBoxLayout(this);
- layout->addWidget(msgLabel);
- setLayout(layout);
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerPerformInstallationPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerPerformInstallationPage::QInstallerPerformInstallationPage(QInstaller *gui)
- : QInstallerPage(gui)
-{
- setObjectName("InstallationPage");
- setTitle(tr("Installing %1").arg(installer()->value("ProductName")));
- setCommitPage(true);
-
- m_progressBar = new QProgressBar(this);
- m_progressBar->setObjectName("ProgressBar");
- m_progressBar->setRange(1, 100);
-
- m_progressLabel = new QLabel(this);
- m_progressLabel->setObjectName("ProgressLabel");
-
- m_updateTimer = new QTimer(this);
- connect(m_updateTimer, SIGNAL(timeout()),
- this, SLOT(updateProgress()));
- m_updateTimer->setInterval(50);
-
- QLayout *layout = new QVBoxLayout(this);
- layout->addWidget(m_progressBar);
- layout->addWidget(m_progressLabel);
- setLayout(layout);
-
- connect(installer(), SIGNAL(installationStarted()),
- this, SLOT(installationStarted()));
- connect(installer(), SIGNAL(installationFinished()),
- this, SLOT(installationFinished()));
-}
-
-void QInstallerPerformInstallationPage::initializePage()
-{
- QWizardPage::initializePage();
- QTimer::singleShot(30, installer(), SLOT(runInstaller()));
-}
-
-// FIXME: remove function
-bool QInstallerPerformInstallationPage::isComplete() const
-{
- return true;
-}
-
-void QInstallerPerformInstallationPage::installationStarted()
-{
- qDebug() << "INSTALLATION STARTED";
- m_updateTimer->start();
- updateProgress();
-}
-
-void QInstallerPerformInstallationPage::installationFinished()
-{
- qDebug() << "INSTALLATION FINISHED";
- m_updateTimer->stop();
- updateProgress();
-}
-
-void QInstallerPerformInstallationPage::updateProgress()
-{
- int progress = installer()->installationProgress();
- if (progress != m_progressBar->value())
- m_progressBar->setValue(progress);
- QString progressText = installer()->installationProgressText();
- if (progressText != m_progressLabel->text())
- m_progressLabel->setText(progressText);
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerPerformUninstallationPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerPerformUninstallationPage::QInstallerPerformUninstallationPage
- (QInstaller *gui)
- : QInstallerPage(gui)
-{
- setObjectName("UninstallationPage");
- setTitle(tr("Uninstalling %1").arg(installer()->value("ProductName")));
- setCommitPage(true);
-
- m_progressBar = new QProgressBar(this);
- m_progressBar->setObjectName("ProgressBar");
- m_progressBar->setRange(1, 100);
-
- m_progressLabel = new QLabel(this);
- m_progressLabel->setObjectName("ProgressLabel");
-
- m_updateTimer = new QTimer(this);
- connect(m_updateTimer, SIGNAL(timeout()),
- this, SLOT(updateProgress()));
- m_updateTimer->setInterval(50);
-
- QLayout *layout = new QVBoxLayout(this);
- layout->addWidget(m_progressBar);
- layout->addWidget(m_progressLabel);
- setLayout(layout);
-
- connect(installer(), SIGNAL(uninstallationStarted()),
- this, SLOT(uninstallationStarted()));
- connect(installer(), SIGNAL(uninstallationFinished()),
- this, SLOT(uninstallationFinished()));
-}
-
-void QInstallerPerformUninstallationPage::initializePage()
-{
- QWizardPage::initializePage();
- QTimer::singleShot(30, installer(), SLOT(runUninstaller()));
-}
-
-// FIXME: remove function
-bool QInstallerPerformUninstallationPage::isComplete() const
-{
- return true;
-}
-
-void QInstallerPerformUninstallationPage::uninstallationStarted()
-{
- m_updateTimer->start();
- updateProgress();
-}
-
-void QInstallerPerformUninstallationPage::uninstallationFinished()
-{
- m_updateTimer->stop();
- updateProgress();
-}
-
-void QInstallerPerformUninstallationPage::updateProgress()
-{
- int progress = installer()->installationProgress();
- if (progress != m_progressBar->value())
- m_progressBar->setValue(progress);
- QString progressText = installer()->installationProgressText();
- if (progressText != m_progressLabel->text())
- m_progressLabel->setText(progressText);
-}
-
-
-////////////////////////////////////////////////////////////////////
-//
-// QInstallerFinishedPage
-//
-////////////////////////////////////////////////////////////////////
-
-QInstallerFinishedPage::QInstallerFinishedPage(QInstaller *installer)
- : QInstallerPage(installer)
-{
- setObjectName("FinishedPage");
- setTitle(tr("Completing the %1 Setup Wizard").arg(productName()));
- setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
- setSubTitle(QString());
-
- QLabel *msgLabel = new QLabel(this);
- msgLabel->setObjectName("MessageLabel");
- msgLabel->setWordWrap(true);
- msgLabel->setText(tr("Click Finish to exit the Setup Wizard"));
-
- m_runItCheckBox = new QCheckBox(this);
- m_runItCheckBox->setObjectName("RunItCheckBox");
- m_runItCheckBox->setChecked(true);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(msgLabel);
- if (m_runItCheckBox)
- layout->addWidget(m_runItCheckBox);
- setLayout(layout);
-}
-
-void QInstallerFinishedPage::entering()
-{
- qDebug() << "FINISHED ENTERING: ";
- connect(wizard()->button(QWizard::FinishButton), SIGNAL(clicked()),
- this, SLOT(handleFinishClicked()));
- if (installer()->status() == QInstaller::InstallerSucceeded) {
- m_runItCheckBox->show();
- m_runItCheckBox->setText(tr("Run %1 now.").arg(productName()));
- } else {
- setTitle(tr("The %1 Setup Wizard failed").arg(productName()));
- m_runItCheckBox->hide();
- m_runItCheckBox->setChecked(false);
- }
-}
-
-void QInstallerFinishedPage::leaving()
-{
- disconnect(wizard(), SIGNAL(customButtonClicked(int)),
- this, SLOT(handleFinishClicked()));
-}
-
-void QInstallerFinishedPage::handleFinishClicked()
-{
- if (!m_runItCheckBox->isChecked())
- return;
- QString program = installer()->value("RunProgram");
- if (program.isEmpty())
- return;
- program = installer()->replaceVariables(program);
- qDebug() << "STARTING " << program;
- QProcess *process = new QProcess;
- process->start(program);
- process->waitForFinished();
-}
-
-#include "qinstallergui.moc"
-
-QT_END_NAMESPACE
diff --git a/installer/qinstallergui.h b/installer/qinstallergui.h
deleted file mode 100644
index ec7db64677..0000000000
--- a/installer/qinstallergui.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/***************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-**
-** Non-Open Source Usage
-**
-** Licensees may use this file in accordance with the Qt Beta Version
-** License Agreement, Agreement version 2.2 provided with the Software or,
-** alternatively, in accordance with the terms contained in a written
-** agreement between you and Nokia.
-**
-** GNU General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License versions 2.0 or 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 GNU
-** General Public Licensing requirements will be met:
-**
-** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt GPL Exception
-** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
-**
-***************************************************************************/
-
-#ifndef QINSTALLERGUI_H
-#define QINSTALLERGUI_H
-
-#include <QtGui/QWizard>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QInstaller;
-
-// FIXME: move to private classes
-class QCheckBox;
-class QLabel;
-class QLineEdit;
-class QProgressBar;
-class QRadioButton;
-class QTreeView;
-class QTreeWidget;
-
-class QInstallerGui : public QWizard
-{
- Q_OBJECT
-
-public:
- explicit QInstallerGui(QInstaller *installer, QWidget *parent = 0);
-
-signals:
- void interrupted();
-
-public slots:
- void cancelButtonClicked();
- void reject();
- void showFinishedPage();
- void showWarning(const QString &msg);
-};
-
-
-class QInstallerPage : public QWizardPage
-{
- Q_OBJECT
-
-public:
- QInstallerPage(QInstaller *installer);
-
- virtual bool isInterruptible() const { return false; }
- virtual QPixmap watermarkPixmap() const;
- virtual QPixmap logoPixmap() const;
- virtual QString productName() const;
-
-protected:
- QInstaller *installer() const;
-
- // Inserts widget into the same layout like a sibling identified
- // by its name. Default position is just behind the sibling.
- virtual void insertWidget(QWidget *widget, const QString &siblingName,
- int offset = 1);
- virtual QWidget *findWidget(const QString &objectName) const;
-
- virtual void setVisible(bool visible); // reimp
- virtual int nextId() const; // reimp
-
- virtual void entering() {} // called on entering
- virtual void leaving() {} // called on leaving
-
- virtual void forward() const {} // called when going forwards
- //virtual void backward() const {} // called when going back
- bool isConstructing() const { return m_fresh; }
-
-private:
- QInstaller *m_installer;
- bool m_fresh;
-};
-
-
-class QInstallerIntroductionPage : public QInstallerPage
-{
-public:
- explicit QInstallerIntroductionPage(QInstaller *installer);
-};
-
-
-class QInstallerLicenseAgreementPage : public QInstallerPage
-{
- Q_OBJECT
-
-public:
- explicit QInstallerLicenseAgreementPage(QInstaller *installer);
- bool isComplete() const;
-
-private:
- QRadioButton *m_acceptRadioButton;
- QRadioButton *m_rejectRadioButton;
-};
-
-
-class QInstallerComponentSelectionPage : public QInstallerPage
-{
- Q_OBJECT
-
-public:
- explicit QInstallerComponentSelectionPage(QInstaller *installer);
- ~QInstallerComponentSelectionPage();
-
-protected:
- //void entering();
- void leaving();
-
-private:
- class Private;
- Private *d;
-};
-
-
-class QInstallerTargetDirectoryPage : public QInstallerPage
-{
- Q_OBJECT
-
-public:
- explicit QInstallerTargetDirectoryPage(QInstaller *installer);
- QString targetDir() const;
- void setTargetDir(const QString &dirName);
-
-protected:
- void entering();
- void leaving();
-
-private slots:
- void targetDirSelected();
- void dirRequested();
-
-private:
- QLineEdit *m_lineEdit;
-};
-
-
-class QInstallerReadyForInstallationPage : public QInstallerPage
-{
- Q_OBJECT
-
-public:
- explicit QInstallerReadyForInstallationPage(QInstaller *installer);
-};
-
-
-class QInstallerPerformInstallationPage : public QInstallerPage
-{
- Q_OBJECT
-
-public:
- explicit QInstallerPerformInstallationPage(QInstaller *installer);
-
-protected:
- void initializePage();
- bool isComplete() const;
- bool isInterruptible() const { return true; }
-
-signals:
- void installationRequested();
-
-private slots:
- void installationStarted();
- void installationFinished();
- void updateProgress();
-
-private:
- QProgressBar *m_progressBar;
- QLabel *m_progressLabel;
- QTimer *m_updateTimer;
-};
-
-
-class QInstallerPerformUninstallationPage : public QInstallerPage
-{
- Q_OBJECT
-
-public:
- explicit QInstallerPerformUninstallationPage(QInstaller *installer);
-
-protected:
- void initializePage();
- bool isComplete() const;
- bool isInterruptible() const { return true; }
-
-signals:
- void uninstallationRequested();
-
-private slots:
- void uninstallationStarted();
- void uninstallationFinished();
- void updateProgress();
-
-private:
- QProgressBar *m_progressBar;
- QLabel *m_progressLabel;
- QTimer *m_updateTimer;
-};
-
-
-class QInstallerFinishedPage : public QInstallerPage
-{
- Q_OBJECT
-
-public:
- explicit QInstallerFinishedPage(QInstaller *installer);
-
-public slots:
- void handleFinishClicked();
-
-protected:
- void entering();
- void leaving();
-
-private:
- QCheckBox *m_runItCheckBox;
-};
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QINSTALLERGUI_H
diff --git a/installer/resources/license.txt b/installer/resources/license.txt
deleted file mode 100644
index a55990fe3a..0000000000
--- a/installer/resources/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/installer/resources/logo.png b/installer/resources/logo.png
deleted file mode 100644
index 8a9562614b..0000000000
--- a/installer/resources/logo.png
+++ /dev/null
Binary files differ
diff --git a/installer/resources/watermark.png b/installer/resources/watermark.png
deleted file mode 100644
index b07780d9d0..0000000000
--- a/installer/resources/watermark.png
+++ /dev/null
Binary files differ