summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/scripting.qdoc9
-rw-r--r--installerbuilder/libinstaller/init.cpp2
-rw-r--r--installerbuilder/libinstaller/libinstaller.pro2
-rw-r--r--installerbuilder/libinstaller/registerqtv2operation.cpp188
-rw-r--r--installerbuilder/libinstaller/registerqtv2operation.h48
5 files changed, 249 insertions, 0 deletions
diff --git a/doc/scripting.qdoc b/doc/scripting.qdoc
index ece1e0fce..5a94aba8c 100644
--- a/doc/scripting.qdoc
+++ b/doc/scripting.qdoc
@@ -202,6 +202,15 @@
a \a description, a \a contentType and an \a icon. This is currently only supported on Windows.
+ \section2 RegisterQtInCreatorV2
+
+ \bold Syntax: "RegisterQtInCreatorV2", \a displayname, \a qt_or_qmake_path, [\a system_root, [\a sbs_path]].
+
+ Registers the Qt version \a displayname to Qt Creator with \a qt_or_qmake_path (if the path does not end with the qmake binary, it will add bin/qmake to the path automatically). Optionally, you can specify a\ system_root which. For Symbian SDKs the instance root will be where Qt Creator will find the Symbian SDK root (EPOCROOT).  For Symbian SDKs supporting sbs, you add the \a sbs_path .
+
+ \note The minimum Qt Creator version it supports is 2.2
+
+
\section1 Custom Operations
It is possible to register custom installation operations in the Installer. This works by deriving KDUpdater::UpdateOperation.
diff --git a/installerbuilder/libinstaller/init.cpp b/installerbuilder/libinstaller/init.cpp
index df4f89477..150a0bd65 100644
--- a/installerbuilder/libinstaller/init.cpp
+++ b/installerbuilder/libinstaller/init.cpp
@@ -55,6 +55,7 @@
#include "linereplaceoperation.h"
#include "registerdocumentationoperation.h"
#include "registerqtoperation.h"
+#include "registerqtv2operation.h"
#include "setqtcreatorvalueoperation.h"
#include "simplemovefileoperation.h"
#include "registertoolchainoperation.h"
@@ -176,6 +177,7 @@ void QInstaller::init()
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::CopyDirectoryOperation >( QLatin1String( "CopyDirectory") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterDocumentationOperation >( QLatin1String( "RegisterDocumentation") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterQtInCreatorOperation>( QLatin1String( "RegisterQtInCreator") );
+ KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterQtInCreatorV2Operation>( QLatin1String( "RegisterQtInCreatorV2") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterToolChainOperation>( QLatin1String( "RegisterToolChain") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::SetDemosPathOnQtOperation>( QLatin1String( "SetDemosPathOnQt") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::SetExamplesPathOnQtOperation>( QLatin1String( "SetExamplesPathOnQt") );
diff --git a/installerbuilder/libinstaller/libinstaller.pro b/installerbuilder/libinstaller/libinstaller.pro
index c5f71fbc4..2440caa9f 100644
--- a/installerbuilder/libinstaller/libinstaller.pro
+++ b/installerbuilder/libinstaller/libinstaller.pro
@@ -58,6 +58,7 @@ HEADERS += $$PWD/qinstaller.h \
linereplaceoperation.h \
registerdocumentationoperation.h \
registerqtoperation.h \
+ registerqtv2operation.h \
registertoolchainoperation.h \
setqtcreatorvalueoperation.h \
copydirectoryoperation.h \
@@ -121,6 +122,7 @@ SOURCES += $$PWD/qinstaller.cpp \
linereplaceoperation.cpp \
registerdocumentationoperation.cpp \
registerqtoperation.cpp \
+ registerqtv2operation.cpp \
registertoolchainoperation.cpp \
setqtcreatorvalueoperation.cpp \
copydirectoryoperation.cpp \
diff --git a/installerbuilder/libinstaller/registerqtv2operation.cpp b/installerbuilder/libinstaller/registerqtv2operation.cpp
new file mode 100644
index 000000000..42b1f28e1
--- /dev/null
+++ b/installerbuilder/libinstaller/registerqtv2operation.cpp
@@ -0,0 +1,188 @@
+/**************************************************************************
+**
+** This file is part of Qt SDK**
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** Contact: Nokia Corporation qt-info@nokia.com**
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception version
+** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you are unsure which license is appropriate for your use, please contact
+** (qt-info@nokia.com).
+**
+**************************************************************************/
+#include "registerqtv2operation.h"
+#include "qinstaller.h"
+
+#include <QString>
+#include <QFileInfo>
+#include <QDir>
+#include <QSettings>
+#include <QDebug>
+
+using namespace QInstaller;
+
+#if defined ( Q_OS_MAC )
+ static const char *QtCreatorSettingsSuffixPath =
+ "/Qt Creator.app/Contents/Resources/Nokia/QtCreator.ini";
+#else
+ static const char *QtCreatorSettingsSuffixPath =
+ "/QtCreator/share/qtcreator/Nokia/QtCreator.ini";
+#endif
+
+RegisterQtInCreatorV2Operation::RegisterQtInCreatorV2Operation()
+{
+ setName(QLatin1String("RegisterQtInCreatorV2"));
+}
+
+RegisterQtInCreatorV2Operation::~RegisterQtInCreatorV2Operation()
+{
+}
+
+void RegisterQtInCreatorV2Operation::backup()
+{
+}
+
+bool RegisterQtInCreatorV2Operation::performOperation()
+{
+ const QStringList args = arguments();
+
+ if( args.count() < 2) {
+ setError( InvalidArguments );
+ setErrorString( tr("Invalid arguments in %0: %1 arguments given, minimum 2 expected.")
+ .arg(name()).arg( args.count() ) );
+ return false;
+ }
+
+ const Installer* const installer = qVariantValue< Installer* >( value( QLatin1String( "installer" ) ) );
+ const QString &rootInstallPath = installer->value(QLatin1String("TargetDir"));
+
+ int argCounter = 0;
+ const QString &versionName = args.value(argCounter++);
+ const QString &path = args.value(argCounter++);
+ QString qmakePath = QDir(path).absolutePath();
+ if ( !qmakePath.endsWith(QLatin1String("qmake"))
+ || !qmakePath.endsWith(QLatin1String("qmake.exe")))
+ {
+#if defined ( Q_OS_WIN )
+ qmakePath.append(QLatin1String("/bin/qmake.exe"));
+#elif defined( Q_OS_UNIX )
+ qmakePath.append(QLatin1String("/bin/qmake"));
+#endif
+ }
+
+ const QString &systemRoot = args.value(argCounter++); //Symbian SDK root for example
+ const QString &sbsPath = args.value(argCounter++);
+
+ QSettings settings(rootInstallPath + QLatin1String(QtCreatorSettingsSuffixPath),
+ QSettings::IniFormat);
+
+ QString newVersions;
+ QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions")
+ ).toString().split(QLatin1String(";"));
+
+ //remove not existing Qt versions and the current new one(because its added after this)
+ if (!oldNewQtVersions.isEmpty()) {
+ foreach (const QString &qtVersion, oldNewQtVersions) {
+ QStringList splitedQtConfiguration = qtVersion.split(QLatin1String("="));
+ if (splitedQtConfiguration.value(1).contains(QLatin1String("qmake"),
+ Qt::CaseInsensitive)) {
+ QString foundVersionName = splitedQtConfiguration.at(0);
+ QString foundQmakePath = splitedQtConfiguration.at(1);
+ if (qmakePath != foundQmakePath && versionName != foundVersionName
+ && QFile::exists(foundQmakePath)) {
+ newVersions.append(qtVersion + QLatin1String(";"));
+ }
+ }
+ }
+ }
+
+ QString addedVersion = versionName;
+
+ addedVersion += QLatin1Char('=') + qmakePath;
+ addedVersion += QLatin1Char('=') + systemRoot;
+ addedVersion += QLatin1Char('=') + sbsPath;
+ newVersions += addedVersion;
+ settings.setValue(QLatin1String("NewQtVersions"), newVersions);
+
+ return true;
+}
+
+bool RegisterQtInCreatorV2Operation::undoOperation()
+{
+ const QStringList args = arguments();
+
+ if( args.count() < 3) {
+ setError( InvalidArguments );
+ setErrorString( tr("Invalid arguments in %0: %1 arguments given, minimum 3 expected.")
+ .arg(name()).arg( args.count() ) );
+ return false;
+ }
+
+ const QString &rootInstallPath = args.value(0); //for example "C:\\QtSDK\\"
+ const QString &versionName = args.value(1);
+ const QString &path = args.value(2);
+ QString qmakePath = QDir(path).absolutePath();
+ if (!qmakePath.endsWith(QLatin1String("qmake"))
+ || !qmakePath.endsWith(QLatin1String("qmake.exe"))) {
+ #if defined ( Q_OS_WIN )
+ qmakePath.append(QLatin1String("bin/qmake.exe"));
+ #elif defined( Q_OS_UNIX )
+ qmakePath.append(QLatin1String("bin/qmake"));
+ #endif
+ }
+
+ QSettings settings( rootInstallPath + QLatin1String(QtCreatorSettingsSuffixPath),
+ QSettings::IniFormat );
+
+ QString newVersions;
+ QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions")
+ ).toString().split(QLatin1String(";"));
+
+ //remove the removed Qt version from "NewQtVersions" setting
+ if (!oldNewQtVersions.isEmpty()) {
+ foreach (const QString &qtVersion, oldNewQtVersions) {
+ QStringList splitedQtConfiguration = qtVersion.split(QLatin1String("="));
+ if (splitedQtConfiguration.value(1).contains(QLatin1String("qmake"),
+ Qt::CaseInsensitive)) {
+ QString foundVersionName = splitedQtConfiguration.at(0);
+ QString foundQmakePath = splitedQtConfiguration.at(1);
+ if (qmakePath != foundQmakePath &&versionName != foundVersionName
+ && QFile::exists(foundQmakePath)) {
+ newVersions.append(qtVersion + QLatin1String(";"));
+ }
+ }
+ }
+ }
+ settings.setValue(QLatin1String("NewQtVersions"), newVersions);
+ return true;
+}
+
+bool RegisterQtInCreatorV2Operation::testOperation()
+{
+ return true;
+}
+
+KDUpdater::UpdateOperation* RegisterQtInCreatorV2Operation::clone() const
+{
+ return new RegisterQtInCreatorV2Operation();
+}
diff --git a/installerbuilder/libinstaller/registerqtv2operation.h b/installerbuilder/libinstaller/registerqtv2operation.h
new file mode 100644
index 000000000..86cb7a16a
--- /dev/null
+++ b/installerbuilder/libinstaller/registerqtv2operation.h
@@ -0,0 +1,48 @@
+/**************************************************************************
+**
+** This file is part of Qt SDK**
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** Contact: Nokia Corporation qt-info@nokia.com**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception version
+** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you are unsure which license is appropriate for your use, please contact
+** (qt-info@nokia.com).
+**
+**************************************************************************/
+#ifndef REGISTERQTINCREATORV2OPERATION_H
+#define REGISTERQTINCREATORV2OPERATION_H
+
+#include <KDUpdater/UpdateOperation>
+
+namespace QInstaller {
+
+class RegisterQtInCreatorV2Operation : public KDUpdater::UpdateOperation
+{
+public:
+ RegisterQtInCreatorV2Operation();
+ ~RegisterQtInCreatorV2Operation();
+
+ void backup();
+ bool performOperation();
+ bool undoOperation();
+ bool testOperation();
+ KDUpdater::UpdateOperation* clone() const;
+};
+
+}; // namespace
+
+#endif // REGISTERQTINCREATORV2OPERATION_H