From 004ba0b129a701ad9bc29f2350c723641416c69f Mon Sep 17 00:00:00 2001 From: tjenssen Date: Mon, 19 Nov 2012 18:47:28 +0100 Subject: remove unneeded register qt operations Change-Id: Id7289cf34b26b795a8e5d99bbda6377e527897c1 Reviewed-by: Karsten Heimrich --- src/libs/installer/init.cpp | 8 - src/libs/installer/installer.pro | 8 - src/libs/installer/registerqtoperation.cpp | 259 ---------------- src/libs/installer/registerqtoperation.h | 54 ---- src/libs/installer/registerqtv23operation.cpp | 236 --------------- src/libs/installer/registerqtv23operation.h | 54 ---- src/libs/installer/registerqtv2operation.cpp | 208 ------------- src/libs/installer/registerqtv2operation.h | 54 ---- src/libs/installer/setqtcreatorvalueoperation.cpp | 20 +- .../updatecreatorsettingsfrom21to22operation.cpp | 337 --------------------- .../updatecreatorsettingsfrom21to22operation.h | 54 ---- 11 files changed, 1 insertion(+), 1291 deletions(-) delete mode 100644 src/libs/installer/registerqtoperation.cpp delete mode 100644 src/libs/installer/registerqtoperation.h delete mode 100644 src/libs/installer/registerqtv23operation.cpp delete mode 100644 src/libs/installer/registerqtv23operation.h delete mode 100644 src/libs/installer/registerqtv2operation.cpp delete mode 100644 src/libs/installer/registerqtv2operation.h delete mode 100644 src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp delete mode 100644 src/libs/installer/updatecreatorsettingsfrom21to22operation.h diff --git a/src/libs/installer/init.cpp b/src/libs/installer/init.cpp index cb700ccee..f731e7a5a 100644 --- a/src/libs/installer/init.cpp +++ b/src/libs/installer/init.cpp @@ -54,16 +54,12 @@ #include "replaceoperation.h" #include "licenseoperation.h" #include "linereplaceoperation.h" -#include "registerqtoperation.h" -#include "registerqtv2operation.h" -#include "registerqtv23operation.h" #include "registerqtvqnxoperation.h" #include "setqtcreatorvalueoperation.h" #include "addqtcreatorarrayvalueoperation.h" #include "simplemovefileoperation.h" #include "registertoolchainoperation.h" #include "registerdefaultdebuggeroperation.h" -#include "updatecreatorsettingsfrom21to22operation.h" #include "createlinkoperation.h" #include "minimumprogressoperation.h" @@ -212,9 +208,6 @@ void QInstaller::init() // added for NDK factory.registerUpdateOperation(QLatin1String("SimpleMoveFile")); factory.registerUpdateOperation(QLatin1String("CopyDirectory")); - factory.registerUpdateOperation(QLatin1String("RegisterQtInCreator")); - factory.registerUpdateOperation(QLatin1String("RegisterQtInCreatorV2")); - factory.registerUpdateOperation(QLatin1String("RegisterQtInCreatorV23")); factory.registerUpdateOperation(QLatin1String("RegisterQtInCreatorQNX")); factory.registerUpdateOperation(QLatin1String("RegisterToolChain") ); factory.registerUpdateOperation(QLatin1String( "RegisterDefaultDebugger")); @@ -228,7 +221,6 @@ void QInstaller::init() factory.registerUpdateOperation(QLatin1String("QtPatch")); factory.registerUpdateOperation(QLatin1String("Replace")); factory.registerUpdateOperation(QLatin1String( "LineReplace" ) ); - factory.registerUpdateOperation(QLatin1String("UpdateCreatorSettingsFrom21To22")); factory.registerUpdateOperation(QLatin1String("CreateLink")); factory.registerUpdateOperation(QLatin1String("MinimumProgress")); diff --git a/src/libs/installer/installer.pro b/src/libs/installer/installer.pro index c0eb50629..57c3e3777 100644 --- a/src/libs/installer/installer.pro +++ b/src/libs/installer/installer.pro @@ -39,10 +39,7 @@ HEADERS += packagemanagercore.h \ setimportspathonqtcoreoperation.h \ replaceoperation.h \ linereplaceoperation.h \ - registerqtoperation.h \ registertoolchainoperation.h \ - registerqtv2operation.h \ - registerqtv23operation.h \ registerqtvqnxoperation.h \ setqtcreatorvalueoperation.h \ addqtcreatorarrayvalueoperation.h \ @@ -80,7 +77,6 @@ HEADERS += packagemanagercore.h \ qtcreator_constants.h \ qtcreatorpersistentsettings.h \ registerdefaultdebuggeroperation.h \ - updatecreatorsettingsfrom21to22operation.h \ qprocesswrapper.h \ qsettingswrapper.h \ constants.h \ @@ -113,10 +109,7 @@ HEADERS += packagemanagercore.h \ setimportspathonqtcoreoperation.cpp \ replaceoperation.cpp \ linereplaceoperation.cpp \ - registerqtoperation.cpp \ registertoolchainoperation.cpp \ - registerqtv2operation.cpp \ - registerqtv23operation.cpp \ registerqtvqnxoperation.cpp \ setqtcreatorvalueoperation.cpp \ addqtcreatorarrayvalueoperation.cpp \ @@ -151,7 +144,6 @@ HEADERS += packagemanagercore.h \ component_p.cpp \ qtcreatorpersistentsettings.cpp \ registerdefaultdebuggeroperation.cpp \ - updatecreatorsettingsfrom21to22operation.cpp \ qprocesswrapper.cpp \ templates.cpp \ qsettingswrapper.cpp \ diff --git a/src/libs/installer/registerqtoperation.cpp b/src/libs/installer/registerqtoperation.cpp deleted file mode 100644 index 13c926c19..000000000 --- a/src/libs/installer/registerqtoperation.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "registerqtoperation.h" - -#include "component.h" -#include "packagemanagercore.h" -#include "qtcreator_constants.h" -#include "qtcreatorpersistentsettings.h" -#include "registertoolchainoperation.h" -#include "registerqtv2operation.h" - -#include -#include -#include -#include -#include - -using namespace QInstaller; - - -RegisterQtInCreatorOperation::RegisterQtInCreatorOperation() -{ - setName(QLatin1String("RegisterQtInCreator")); -} - -void RegisterQtInCreatorOperation::backup() -{ -} - -bool RegisterQtInCreatorOperation::performOperation() -{ - 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:\\Nokia_SDK\\" - if (!rootInstallPath.isEmpty()) { - qWarning() << QString::fromLatin1("Because of internal changes the first argument(\"%1\") on %2 "\ - "operation is just ignored, please be aware of that").arg(rootInstallPath, name()); - } - - const QString &versionName = args.value(1); - const QString &path = args.value(2); - QString mingwPath = args.value(3); - QString s60SdkPath = args.value(4); - QString gccePath = args.value(5); - QString carbidePath = args.value(6); - QString msvcPath = args.value(7); - QString sbsPath = args.value(8); - -//this is for creator 2.2 - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); - return false; - } - - QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); - if (toolChainsXmlFilePath.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerToolchainsFile)); - return false; - } - bool isCreator22 = false; - //in case of the fake installer this component doesn't exist - Component *creatorComponent = - core->componentByName(QLatin1String("com.nokia.ndk.tools.qtcreator.application")); - if (creatorComponent) { - const QString creatorVersion = creatorComponent->value(scInstalledVersion); - isCreator22 = PackageManagerCore::versionMatches(creatorVersion, QLatin1String("2.2")); - } - - if (QFileInfo(toolChainsXmlFilePath).exists() || isCreator22) { - QtCreatorPersistentSettings creatorToolChainSettings; - - if (!creatorToolChainSettings.init(toolChainsXmlFilePath)) { - setError(UserDefinedError); - setErrorString(tr("Can't read from tool chains xml file(%1) correctly.") - .arg(toolChainsXmlFilePath)); - return false; - } - if (!mingwPath.isEmpty()) { - RegisterToolChainOperation operation; - operation.setValue(QLatin1String("installer"), QVariant::fromValue(core)); - operation.setArguments(QStringList() - << QLatin1String("GccToolChain") - << QLatin1String("ProjectExplorer.ToolChain.Mingw") - << QLatin1String("Mingw as a GCC for Windows targets") - << QLatin1String("x86-windows-msys-pe-32bit") - << mingwPath + QLatin1String("\\bin\\g++.exe") - << creatorToolChainSettings.abiToDebuggerHash().value(QLatin1String - ("x86-windows-msys-pe-32bit")) - ); - if (!operation.performOperation()) { - setError(operation.error()); - setErrorString(operation.errorString()); - return false; - } - } - if (!gccePath.isEmpty()) { - RegisterToolChainOperation operation; - operation.setValue(QLatin1String("installer"), QVariant::fromValue(core)); - operation.setArguments(QStringList() - << QLatin1String("GccToolChain") - << QLatin1String("Qt4ProjectManager.ToolChain.GCCE") - << QLatin1String("GCCE 4 for Symbian targets") - << QLatin1String("arm-symbian-device-elf-32bit") - << gccePath + QLatin1String("\\bin\\arm-none-symbianelf-g++.exe") - << creatorToolChainSettings.abiToDebuggerHash().value(QLatin1String( - "arm-symbian-device-elf-32bit")) - ); - if (!operation.performOperation()) { - setError(operation.error()); - setErrorString(operation.errorString()); - return false; - } - } - RegisterQtInCreatorV2Operation registerQtInCreatorV2Operation; - registerQtInCreatorV2Operation.setValue(QLatin1String("installer"), QVariant::fromValue(core)); - registerQtInCreatorV2Operation.setArguments(QStringList() << versionName << path << s60SdkPath - << sbsPath); - if (!registerQtInCreatorV2Operation.performOperation()) { - setError(registerQtInCreatorV2Operation.error()); - setErrorString(registerQtInCreatorV2Operation.errorString()); - return false; - } - return true; - } -//END - this is for creator 2.2 - if (core->value(scQtCreatorInstallerSettingsFile).isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerSettingsFile)); - return false; - } - QSettings settings(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); - const QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions")).toString() - .split(QLatin1String(";")); - - QString newVersions; - //remove not existing Qt versions - if (!oldNewQtVersions.isEmpty()) { - foreach (const QString &qtVersion, oldNewQtVersions) { - QStringList splitedQtConfiguration = qtVersion.split(QLatin1String("=")); - if (splitedQtConfiguration.count() > 1 - && splitedQtConfiguration.at(1).contains(QLatin1String("qmake"), Qt::CaseInsensitive)) { - QString qmakePath = splitedQtConfiguration.at(1); - if (QFile::exists(qmakePath)) - newVersions.append(qtVersion + QLatin1String(";")); - } - } - } -#if defined (Q_OS_WIN ) - QString addedVersion = versionName + QLatin1Char('=') + QDir(path) - .absoluteFilePath(QLatin1String("bin/qmake.exe")).replace(QLatin1String("/"), QLatin1String("\\")); -#elif defined(Q_OS_UNIX ) - QString addedVersion = versionName + QLatin1Char('=') + QDir(path) - .absoluteFilePath(QLatin1String("bin/qmake")); -#endif - addedVersion += QLatin1Char('=') + mingwPath.replace(QLatin1String("/"), QLatin1String("\\")); - addedVersion += QLatin1Char('=') + s60SdkPath.replace(QLatin1String("/"), QLatin1String("\\")); - addedVersion += QLatin1Char('=') + gccePath.replace(QLatin1String("/"), QLatin1String("\\")); - addedVersion += QLatin1Char('=') + carbidePath.replace(QLatin1String("/"), QLatin1String("\\")); - addedVersion += QLatin1Char('=') + msvcPath.replace(QLatin1String("/"), QLatin1String("\\")); - addedVersion += QLatin1Char('=') + sbsPath.replace(QLatin1String("/"), QLatin1String("\\")); - newVersions += addedVersion; - settings.setValue(QLatin1String("NewQtVersions"), newVersions); - - return true; -} - -//works with creator 2.1 and 2.2 -bool RegisterQtInCreatorOperation::undoOperation() -{ - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); - return false; - } - - // default value is the old value to keep the possibility that old saved operations can run undo -#ifdef Q_OS_MAC - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/QtCreator.ini").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/QtCreator.ini").arg(core->value( - QLatin1String("TargetDir")))); -#endif - - QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); - const QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions")).toString() - .split(QLatin1String(";")); - - QString newVersions; - //remove not existing Qt versions, the current to remove Qt version has an already removed qmake - if (!oldNewQtVersions.isEmpty()) { - foreach (const QString &qtVersion, oldNewQtVersions) { - QStringList splitedQtConfiguration = qtVersion.split(QLatin1String("=")); - if (splitedQtConfiguration.count() > 1 - && splitedQtConfiguration.at(1).contains(QLatin1String("qmake"), Qt::CaseInsensitive)) { - QString qmakePath = splitedQtConfiguration.at(1); - if (QFile::exists(qmakePath)) - newVersions.append(qtVersion + QLatin1String(";")); - } - } - } - settings.setValue(QLatin1String("NewQtVersions"), newVersions); - return true; -} - -bool RegisterQtInCreatorOperation::testOperation() -{ - return true; -} - -Operation *RegisterQtInCreatorOperation::clone() const -{ - return new RegisterQtInCreatorOperation(); -} diff --git a/src/libs/installer/registerqtoperation.h b/src/libs/installer/registerqtoperation.h deleted file mode 100644 index 62f9b0a94..000000000 --- a/src/libs/installer/registerqtoperation.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef REGISTERQTINCREATOROPERATION_H -#define REGISTERQTINCREATOROPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class RegisterQtInCreatorOperation : public Operation -{ -public: - RegisterQtInCreatorOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // REGISTERQTINCREATOROPERATION_H diff --git a/src/libs/installer/registerqtv23operation.cpp b/src/libs/installer/registerqtv23operation.cpp deleted file mode 100644 index 1faf9431f..000000000 --- a/src/libs/installer/registerqtv23operation.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "registerqtv23operation.h" - -#include "packagemanagercore.h" -#include "qtcreator_constants.h" -#include "persistentsettings.h" - -#include -#include -#include -#include -#include - - -using namespace QInstaller; - -// TODO: move this to a general location it is used on some classes -static QString fromNativeSeparatorsAllOS(const QString &pathName) -{ - QString n = pathName; - for (int i = 0; i < n.size(); ++i) { - if (n.at(i) == QLatin1Char('\\')) - n[i] = QLatin1Char('/'); - } - return n; -} - -static QString absoluteQmakePath(const QString &path) -{ - QString versionQmakePath = QDir(path).absolutePath(); - if (!versionQmakePath.endsWith(QLatin1String("qmake")) - && !versionQmakePath.endsWith(QLatin1String("qmake.exe"))) { -#if defined (Q_OS_WIN) - versionQmakePath.append(QLatin1String("/bin/qmake.exe")); -#elif defined(Q_OS_UNIX) - versionQmakePath.append(QLatin1String("/bin/qmake")); -#endif - } - return fromNativeSeparatorsAllOS(versionQmakePath); -} - -RegisterQtInCreatorV23Operation::RegisterQtInCreatorV23Operation() -{ - setName(QLatin1String("RegisterQtInCreatorV23")); -} - -void RegisterQtInCreatorV23Operation::backup() -{ -} - -// Parameter List: -// Name - String displayed as name in Qt Creator -// qmake path - location of the qmake binary -// Type identifier - Desktop, Simulator, Symbian, ... -// SDK identifier - unique string to identify Qt version inside of the SDK (eg. desk473, simu11, ...) -// System Root Path -// sbs path -bool RegisterQtInCreatorV23Operation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() < 4) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, minimum 4 expected.") - .arg(name()).arg(args.count())); - return false; - } - - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); - return false; - } - - if (core->value(scQtCreatorInstallerQtVersionFile).isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerQtVersionFile)); - return false; - } - const QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile); - int argCounter = 0; - const QString &versionName = args.at(argCounter++); - const QString &path = QDir::toNativeSeparators(args.value(argCounter++)); - const QString versionQmakePath = absoluteQmakePath(path); - - const QString &versionTypeIdentifier = args.at(argCounter++); - const QString &versionSDKIdentifier = args.at(argCounter++); - const QString &versionSystemRoot = fromNativeSeparatorsAllOS(args.value(argCounter++)); - const QString &versionSbsPath = fromNativeSeparatorsAllOS(args.value(argCounter++)); - - ProjectExplorer::PersistentSettingsReader reader; - int qtVersionCount = 0; - QVariantMap map; - if (reader.load(qtVersionsFileName)) { - map = reader.restoreValues(); - qtVersionCount = map.value(QLatin1String("QtVersion.Count")).toInt(); - map.remove(QLatin1String("QtVersion.Count")); - map.remove(QLatin1String("Version")); - } - - ProjectExplorer::PersistentSettingsWriter writer; - // Store old qt versions - if (!map.isEmpty()) { - for (int i = 0; i < qtVersionCount; ++i) { - writer.saveValue(QString::fromLatin1("QtVersion.%1").arg(i) - , map[QLatin1String("QtVersion.") + QString::number(i)].toMap()); - } - map.clear(); - } - // Enter new version - map.insert(QLatin1String("Id"), -1); - map.insert(QLatin1String("Name"), versionName); - map.insert(QLatin1String("QMakePath"), versionQmakePath); - map.insert(QLatin1String("QtVersion.Type"), - QLatin1String("Qt4ProjectManager.QtVersion.") + versionTypeIdentifier); - map.insert(QLatin1String("isAutodetected"), true); - map.insert(QLatin1String("autodetectionSource"), - QLatin1String("SDK.") + versionSDKIdentifier); - if (!versionSystemRoot.isEmpty()) - map.insert(QLatin1String("SystemRoot"), versionSystemRoot); - if (!versionSbsPath.isEmpty()) - map.insert(QLatin1String("SBSv2Directory"), versionSbsPath); - - writer.saveValue(QLatin1String("QtVersion.") + QString::number(qtVersionCount), map); - - writer.saveValue(QLatin1String("Version"), 1); - writer.saveValue(QLatin1String("QtVersion.Count"), qtVersionCount + 1); - QDir().mkpath(QFileInfo(qtVersionsFileName).absolutePath()); - writer.save(qtVersionsFileName, QLatin1String("QtCreatorQtVersions")); - - return true; -} - -bool RegisterQtInCreatorV23Operation::undoOperation() -{ - const QStringList args = arguments(); - - if (args.count() < 4) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, minimum 4 expected.") - .arg(name()).arg(args.count())); - return false; - } - - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); - return false; - } - - // default value is the old value to keep the possibility that old saved operations can run undo -#ifdef Q_OS_MAC - QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile, - QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/qtversion.xml").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/qtversion.xml").arg(core->value( - QLatin1String("TargetDir")))); -#endif - - ProjectExplorer::PersistentSettingsReader reader; - // If no file, then it has been removed already - if (!reader.load(qtVersionsFileName)) - return true; - - const QVariantMap map = reader.restoreValues(); - - ProjectExplorer::PersistentSettingsWriter writer; - const int qtVersionCount = map.value(QLatin1String("QtVersion.Count")).toInt(); - - int currentVersionIndex = 0; - for (int i = 0; i < qtVersionCount; ++i) { - QVariantMap versionMap = map[QLatin1String("QtVersion.") + QString::number(i)].toMap(); - - const QString path = QDir::toNativeSeparators(args.value(1)); - const QString versionQmakePath = absoluteQmakePath(path); - - //use absoluteQmakePath function to normalize the path string, for example // - const QString existingQtQMakePath = absoluteQmakePath( - versionMap[QLatin1String("QMakePath")].toString()); - if (existingQtQMakePath == versionQmakePath) - continue; - writer.saveValue(QString::fromLatin1("QtVersion.%1").arg(currentVersionIndex++), versionMap); - } - - writer.saveValue(QLatin1String("QtVersion.Count"), currentVersionIndex); - writer.saveValue(QLatin1String("Version"), map[QLatin1String("Version")].toInt()); - - writer.save(qtVersionsFileName, QLatin1String("QtCreatorQtVersions")); - return true; -} - -bool RegisterQtInCreatorV23Operation::testOperation() -{ - return true; -} - -Operation *RegisterQtInCreatorV23Operation::clone() const -{ - return new RegisterQtInCreatorV23Operation(); -} diff --git a/src/libs/installer/registerqtv23operation.h b/src/libs/installer/registerqtv23operation.h deleted file mode 100644 index 5e4f383b8..000000000 --- a/src/libs/installer/registerqtv23operation.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef REGISTERQTINCREATORV23OPERATION_H -#define REGISTERQTINCREATORV23OPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class RegisterQtInCreatorV23Operation : public Operation -{ -public: - RegisterQtInCreatorV23Operation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // REGISTERQTINCREATORV2OPERATION_H diff --git a/src/libs/installer/registerqtv2operation.cpp b/src/libs/installer/registerqtv2operation.cpp deleted file mode 100644 index 2b00e50aa..000000000 --- a/src/libs/installer/registerqtv2operation.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "registerqtv2operation.h" - -#include "packagemanagercore.h" -#include "qtcreator_constants.h" - -#include -#include -#include -#include -#include - -using namespace QInstaller; - -RegisterQtInCreatorV2Operation::RegisterQtInCreatorV2Operation() -{ - setName(QLatin1String("RegisterQtInCreatorV2")); -} - -void RegisterQtInCreatorV2Operation::backup() -{ -} - -//version name; qmake path; system root path; sbs path -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; - } - - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); - return false; - } - - int argCounter = 0; - const QString &versionName = args.value(argCounter++); - const QString &path = QDir::toNativeSeparators(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 - } - qmakePath = QDir::toNativeSeparators(qmakePath); - - const QString &systemRoot = QDir::toNativeSeparators(args.value(argCounter++)); //Symbian SDK root for example - const QString &sbsPath = QDir::toNativeSeparators(args.value(argCounter++)); - - if (core->value(scQtCreatorInstallerSettingsFile).isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerSettingsFile)); - return false; - } - QSettings settings(core->value(scQtCreatorInstallerSettingsFile), 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 (QFileInfo(qmakePath) != QFileInfo(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() < 2) { - setError(InvalidArguments); - setErrorString( tr("Invalid arguments in %0: %1 arguments given, minimum 2 expected.") - .arg(name()).arg( args.count() ) ); - return false; - } - - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); - return false; - } - - int argCounter = 0; - const QString &versionName = args.value(argCounter++); - const QString &path = QDir::toNativeSeparators(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 - } - qmakePath = QDir::toNativeSeparators(qmakePath); - - // default value is the old value to keep the possibility that old saved operations can run undo -#ifdef Q_OS_MAC - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/QtCreator.ini").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/QtCreator.ini").arg(core->value( - QLatin1String("TargetDir")))); -#endif - - QSettings settings(qtCreatorInstallerSettingsFileName, 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 (QFileInfo(qmakePath) != QFileInfo(foundQmakePath) &&versionName != foundVersionName - && QFile::exists(foundQmakePath)) { - newVersions.append(qtVersion + QLatin1String(";")); - } - } - } - } - settings.setValue(QLatin1String("NewQtVersions"), newVersions); - return true; -} - -bool RegisterQtInCreatorV2Operation::testOperation() -{ - return true; -} - -Operation *RegisterQtInCreatorV2Operation::clone() const -{ - return new RegisterQtInCreatorV2Operation(); -} diff --git a/src/libs/installer/registerqtv2operation.h b/src/libs/installer/registerqtv2operation.h deleted file mode 100644 index 9dc726f6c..000000000 --- a/src/libs/installer/registerqtv2operation.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef REGISTERQTINCREATORV2OPERATION_H -#define REGISTERQTINCREATORV2OPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class RegisterQtInCreatorV2Operation : public Operation -{ -public: - RegisterQtInCreatorV2Operation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // REGISTERQTINCREATORV2OPERATION_H diff --git a/src/libs/installer/setqtcreatorvalueoperation.cpp b/src/libs/installer/setqtcreatorvalueoperation.cpp index c7cfc62ca..8fbfdd950 100644 --- a/src/libs/installer/setqtcreatorvalueoperation.cpp +++ b/src/libs/installer/setqtcreatorvalueoperation.cpp @@ -33,7 +33,6 @@ #include "setqtcreatorvalueoperation.h" #include "qtcreator_constants.h" -#include "updatecreatorsettingsfrom21to22operation.h" #include "packagemanagercore.h" #include @@ -82,7 +81,7 @@ bool SetQtCreatorValueOperation::performOperation() const QString &group = groupName(args.at(1)); const QString &key = args.at(2); const QString &settingsValue = args.at(3); -{ + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile); if (qtCreatorInstallerSettingsFileName.isEmpty()) { setError(UserDefinedError); @@ -103,23 +102,6 @@ bool SetQtCreatorValueOperation::performOperation() settings.endGroup(); settings.sync(); //be save ;) -} //destruct QSettings - - if (group == QLatin1String("GdbBinaries21")) { - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in %1 operation is empty.").arg(name())); - return false; - } - UpdateCreatorSettingsFrom21To22Operation updateCreatorSettingsOperation; - updateCreatorSettingsOperation.setValue(QLatin1String("installer"), QVariant::fromValue(core)); - if (!updateCreatorSettingsOperation.performOperation()) { - setError(updateCreatorSettingsOperation.error()); - setErrorString(updateCreatorSettingsOperation.errorString()); - return false; - } - } return true; } diff --git a/src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp b/src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp deleted file mode 100644 index d04339c74..000000000 --- a/src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp +++ /dev/null @@ -1,337 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "updatecreatorsettingsfrom21to22operation.h" - -#include "registerdefaultdebuggeroperation.h" -#include "registertoolchainoperation.h" -#include "qtcreatorpersistentsettings.h" -#include "packagemanagercore.h" -#include "qtcreator_constants.h" - -#include -#include -#include -#include -#include - -using namespace QInstaller; - -using namespace ProjectExplorer; - -QStringList getQmakePathesOfAllInstallerRegisteredQtVersions(const QSettings &settings) -{ - QStringList qmakePathes; - - QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions")).toString().split( - QLatin1String(";")); - - foreach (const QString &qtVersion, oldNewQtVersions) { - QStringList splitedQtConfiguration = qtVersion.split(QLatin1String("=")); - if (splitedQtConfiguration.count() > 1 - && splitedQtConfiguration.at(1).contains(QLatin1String("qmake"), Qt::CaseInsensitive)) { - QString qmakePath = splitedQtConfiguration.at(1); - qmakePathes.append(qmakePath); - } - } - return qmakePathes; -} - -bool removeInstallerRegisteredQtVersions(QSettings &settings, const QStringList &qmakePathes) -{ - return true; - qDebug() << Q_FUNC_INFO << settings.fileName(); - settings.beginGroup(QLatin1String(QtVersionsSectionName)); - int qtVersionSizeValue = settings.value(QLatin1String("size")).toInt(); - qDebug() << "qtVersionSizeValue:" << qtVersionSizeValue; - - //read all settings for Qt Versions - QHash oldSettingsAsHash; - foreach (const QString &key, settings.allKeys()) - oldSettingsAsHash.insert(key, settings.value(key)); - qDebug() << "settings.allKeys():" << settings.allKeys(); - - //get the installer added Qt Version settings ids - QList toRemoveIds; - QHashIterator it(oldSettingsAsHash); - while (it.hasNext()) { - it.next(); - if (it.key().endsWith(QLatin1String("QMakePath")) && !it.value().toString().isEmpty()) { - foreach (const QString &toRemoveQmakePath, qmakePathes) { - if (QFileInfo(it.value().toString()) == QFileInfo(toRemoveQmakePath)) { - int firstNoDigitCharIndex = it.key().indexOf(QRegExp(QLatin1String("[^0-9]"))); - QString numberAtTheBeginning = it.key().left(firstNoDigitCharIndex); - toRemoveIds << numberAtTheBeginning.toInt(); - } - } - } - } - qDebug() << "toRemoveIds:" << toRemoveIds; - - //now write only the other Qt Versions to QtCreator settings - it.toFront(); - QHash qtVersionIdMapper; //old, new - int newVersionId = 1; - while (it.hasNext()) { - it.next(); - settings.remove(it.key()); - int firstNoDigitCharIndex = it.key().indexOf(QRegExp(QLatin1String("[^0-9]"))); - QString numberAtTheBeginningAsString = it.key().left(firstNoDigitCharIndex); - QString restOfTheKey = it.key().mid(firstNoDigitCharIndex); - bool isNumber = false; - //check that it is a nummer - for example "size" value of the settings array is not - int numberAtTheBeginning = numberAtTheBeginningAsString.toInt(&isNumber); - if (isNumber && !toRemoveIds.contains(numberAtTheBeginning)) { - if (!qtVersionIdMapper.contains(numberAtTheBeginning)) { - qtVersionIdMapper.insert(numberAtTheBeginning, newVersionId); - newVersionId++; - } - QString newKey = QString::number(qtVersionIdMapper.value(numberAtTheBeginning)) + restOfTheKey; - if (newKey.endsWith(QLatin1String("Id"))) { - settings.setValue(newKey, qtVersionIdMapper.value(numberAtTheBeginning)); - } else { - settings.setValue(newKey, it.value()); - } - } - } - - settings.setValue(QLatin1String("size"), qtVersionIdMapper.count()); - settings.endGroup(); //QtVersionsSectionName - - if (qtVersionIdMapper.count() != qtVersionSizeValue - toRemoveIds.count()) { - return false; - } - return true; -} - -bool convertQtInstallerSettings(QSettings &settings, const QString &toolChainsXmlFilePath, - QInstaller::PackageManagerCore *const core) -{ - QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions")).toString().split( - QLatin1String(";")); - - QSet mingwToolChains; - QSet gcceToolChains; - QString newQtVersions; - foreach (const QString &qtVersion, oldNewQtVersions) { - QStringList splitedQtConfiguration = qtVersion.split(QLatin1String("=")); - if (splitedQtConfiguration.count() == 8) { - int positionCounter = 0; - const QString &versionName = splitedQtConfiguration.at(positionCounter++); - const QString &qmakePath = splitedQtConfiguration.at(positionCounter++); - mingwToolChains.insert(splitedQtConfiguration.at(positionCounter++)); - QString systemRoot = splitedQtConfiguration.at(positionCounter++); - QString gccePath = splitedQtConfiguration.at(positionCounter++); - gcceToolChains.insert(gccePath); - QString carbidePath = splitedQtConfiguration.at(positionCounter++); - Q_UNUSED(carbidePath) - QString msvcPath = splitedQtConfiguration.at(positionCounter++); - Q_UNUSED(msvcPath) - QString sbsPath = splitedQtConfiguration.at(positionCounter++); - - QString addedQtVersion = versionName; - - addedQtVersion += QLatin1Char('=') + qmakePath; - addedQtVersion += QLatin1Char('=') + systemRoot; - addedQtVersion += QLatin1Char('=') + sbsPath; - newQtVersions.append(addedQtVersion + QLatin1Char(';')); - } else { - newQtVersions.append(qtVersion + QLatin1Char(';')); - } - } - settings.setValue(QLatin1String("NewQtVersions"), newQtVersions); - - QtCreatorPersistentSettings creatorToolChainSettings; - - if (!creatorToolChainSettings.init(toolChainsXmlFilePath)) - return false; - - foreach (const QString &mingwPath, mingwToolChains) { - if (mingwPath.isEmpty()) - continue; - QInstaller::RegisterToolChainOperation operation; - operation.setValue(QLatin1String("installer"), QVariant::fromValue(core)); - operation.setArguments(QStringList() - << QLatin1String("GccToolChain") - << QLatin1String("ProjectExplorer.ToolChain.Mingw") - << QLatin1String("Mingw as a GCC for Windows targets") - << QLatin1String("x86-windows-msys-pe-32bit") - << mingwPath + QLatin1String("\\bin\\g++.exe") - << creatorToolChainSettings.abiToDebuggerHash().value(QLatin1String - ("x86-windows-msys-pe-32bit")) - ); - bool result = operation.performOperation(); - Q_UNUSED(result); - Q_ASSERT(result); - } - foreach (const QString gccePath, gcceToolChains) { - if (gccePath.isEmpty()) - continue; - QInstaller::RegisterToolChainOperation operation; - operation.setValue(QLatin1String("installer"), QVariant::fromValue(core)); - operation.setArguments(QStringList() - << QLatin1String("GccToolChain") - << QLatin1String("Qt4ProjectManager.ToolChain.GCCE") - << QLatin1String("GCCE 4 for Symbian targets") - << QLatin1String("arm-symbian-device-elf-32bit") - << gccePath + QLatin1String("\\bin\\arm-none-symbianelf-g++.exe") - << creatorToolChainSettings.abiToDebuggerHash().value(QLatin1String( - "arm-symbian-device-elf-32bit")) - ); - bool result = operation.performOperation(); - Q_UNUSED(result); - Q_ASSERT(result); - } - return true; -} - -void convertDefaultGDBInstallerSettings(QSettings &settings, QInstaller::PackageManagerCore *const core) -{ - settings.beginGroup(QLatin1String("GdbBinaries21")); - - //read all settings for GDBs - QHash abiToDefaultDebuggerHash; - foreach (const QString &key, settings.allKeys()) { - QVariant oldValue = settings.value(key); - if (oldValue.type() != QVariant::StringList) - continue; - QStringList oldGdbEntry = oldValue.toStringList(); - QString gdbBinaryPath = oldGdbEntry.takeFirst(); - - QStringList gdbTypeList = oldGdbEntry; - foreach (const QString &gdbType, gdbTypeList) { - if (gdbType == QLatin1String("0")) { - abiToDefaultDebuggerHash.insert(QLatin1String("x86-linux-generic-elf-64bit"), gdbBinaryPath); - abiToDefaultDebuggerHash.insert(QLatin1String("x86-linux-generic-elf-32bit"), gdbBinaryPath); - } - if (gdbType == QLatin1String("2")) { - abiToDefaultDebuggerHash.insert(QLatin1String("x86-windows-msys-pe-32bit"), gdbBinaryPath); - } - if (gdbType == QLatin1String("6")) { - abiToDefaultDebuggerHash.insert(QLatin1String("arm-symbian-device-elf-32bit"), gdbBinaryPath); - } - if (gdbType == QLatin1String("9")) { - abiToDefaultDebuggerHash.insert(QLatin1String("arm-linux-harmattan-elf-32bit"), gdbBinaryPath); - abiToDefaultDebuggerHash.insert(QLatin1String("arm-linux-maemo-elf-32bit"), gdbBinaryPath); - abiToDefaultDebuggerHash.insert(QLatin1String("arm-linux-meego-elf-32bit"), gdbBinaryPath); - } - } - } - QInstaller::RegisterDefaultDebuggerOperation operation; - operation.setValue(QLatin1String("installer"), QVariant::fromValue(core)); - - QHashIterator it(abiToDefaultDebuggerHash); - while (it.hasNext()) { - it.next(); - operation.setArguments(QStringList() << it.key() << it.value()); - bool result = operation.performOperation(); - Q_UNUSED(result); - Q_ASSERT(result); - } - - settings.endGroup(); //"GdbBinaries21" -} - -UpdateCreatorSettingsFrom21To22Operation::UpdateCreatorSettingsFrom21To22Operation() -{ - setName(QLatin1String("UpdateCreatorSettingsFrom21To22")); -} - -void UpdateCreatorSettingsFrom21To22Operation::backup() -{ -} - -bool UpdateCreatorSettingsFrom21To22Operation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 0) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, exactly 0 expected.") - .arg(name()).arg(args.count())); - return false; - } - - PackageManagerCore *const core = value(QLatin1String("installer")).value(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in %1 operation is empty.").arg(name())); - return false; - } - - QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); - if (toolChainsXmlFilePath.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerToolchainsFile)); - return false; - } - - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile); - if (qtCreatorInstallerSettingsFileName.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerSettingsFile)); - return false; - } - QSettings sdkSettings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); - - convertDefaultGDBInstallerSettings(sdkSettings, core); - - QString userSettingsFileName = core->value(QLatin1String("QtCreatorSettingsFile")); - if (QFile::exists(userSettingsFileName)) { - QSettings userSettings(userSettingsFileName, QSettings::IniFormat); - QStringList qmakePathes = getQmakePathesOfAllInstallerRegisteredQtVersions(sdkSettings); - if (!removeInstallerRegisteredQtVersions(userSettings, qmakePathes)) { - setError(UserDefinedError); - setErrorString(tr("Can not remove previous registered Qt Versions in %1 operation.").arg(name())); - return false; - } - } - - return convertQtInstallerSettings(sdkSettings, toolChainsXmlFilePath, core); -} - -bool UpdateCreatorSettingsFrom21To22Operation::undoOperation() -{ - return true; -} - -bool UpdateCreatorSettingsFrom21To22Operation::testOperation() -{ - return true; -} - -Operation *UpdateCreatorSettingsFrom21To22Operation::clone() const -{ - return new UpdateCreatorSettingsFrom21To22Operation(); -} diff --git a/src/libs/installer/updatecreatorsettingsfrom21to22operation.h b/src/libs/installer/updatecreatorsettingsfrom21to22operation.h deleted file mode 100644 index f0e2b343c..000000000 --- a/src/libs/installer/updatecreatorsettingsfrom21to22operation.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************** -** -** This file is part of Installer Framework -** -** Copyright (c) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef UPDATECREATORSETTINGSFROM21TO22OPERATION_H -#define UPDATECREATORSETTINGSFROM21TO22OPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class UpdateCreatorSettingsFrom21To22Operation : public Operation -{ -public: - UpdateCreatorSettingsFrom21To22Operation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // UPDATECREATORSETTINGSFROM21TO22OPERATION_H -- cgit v1.2.3