remove unused installer code to avoid confusion

This commit is contained in:
hjk
2009-01-06 16:08:14 +01:00
parent c88245ac08
commit aa3b488e79
11 changed files with 0 additions and 3792 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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>

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB