From 4c7a57bf2ad06a6983257485428d46e7ac81b655 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 27 Jun 2013 14:25:19 +0200 Subject: Remove deprecated Qt specific operations Change-Id: Iac895970420cfe1d70b1b0fde5f5a7c33dd1bbb0 Reviewed-by: Tim Jenssen Reviewed-by: Niels Weber Reviewed-by: Karsten Heimrich --- src/libs/installer/component.cpp | 5 +- src/libs/installer/init.cpp | 16 -- src/libs/installer/installer.pro | 21 -- src/libs/installer/persistentsettings.cpp | 221 ------------------ src/libs/installer/persistentsettings.h | 84 ------- src/libs/installer/projectexplorer_export.h | 1 - src/libs/installer/qtcreatorpersistentsettings.cpp | 236 -------------------- src/libs/installer/qtcreatorpersistentsettings.h | 88 -------- .../installer/registerdefaultdebuggeroperation.cpp | 180 --------------- .../installer/registerdefaultdebuggeroperation.h | 63 ------ .../installer/registerqtincreatorqnxoperation.cpp | 248 --------------------- .../installer/registerqtincreatorqnxoperation.h | 63 ------ src/libs/installer/registertoolchainoperation.cpp | 198 ---------------- src/libs/installer/registertoolchainoperation.h | 81 ------- src/libs/installer/setdemospathonqtoperation.cpp | 135 ----------- src/libs/installer/setdemospathonqtoperation.h | 63 ------ .../installer/setexamplespathonqtoperation.cpp | 136 ----------- src/libs/installer/setexamplespathonqtoperation.h | 63 ------ .../installer/setimportspathonqtcoreoperation.cpp | 162 -------------- .../installer/setimportspathonqtcoreoperation.h | 63 ------ src/libs/installer/setpathonqtcoreoperation.cpp | 186 ---------------- src/libs/installer/setpathonqtcoreoperation.h | 63 ------ .../installer/setpluginpathonqtcoreoperation.cpp | 160 ------------- .../installer/setpluginpathonqtcoreoperation.h | 63 ------ 24 files changed, 3 insertions(+), 2596 deletions(-) delete mode 100644 src/libs/installer/persistentsettings.cpp delete mode 100644 src/libs/installer/persistentsettings.h delete mode 100644 src/libs/installer/projectexplorer_export.h delete mode 100644 src/libs/installer/qtcreatorpersistentsettings.cpp delete mode 100644 src/libs/installer/qtcreatorpersistentsettings.h delete mode 100644 src/libs/installer/registerdefaultdebuggeroperation.cpp delete mode 100644 src/libs/installer/registerdefaultdebuggeroperation.h delete mode 100644 src/libs/installer/registerqtincreatorqnxoperation.cpp delete mode 100644 src/libs/installer/registerqtincreatorqnxoperation.h delete mode 100644 src/libs/installer/registertoolchainoperation.cpp delete mode 100644 src/libs/installer/registertoolchainoperation.h delete mode 100644 src/libs/installer/setdemospathonqtoperation.cpp delete mode 100644 src/libs/installer/setdemospathonqtoperation.h delete mode 100644 src/libs/installer/setexamplespathonqtoperation.cpp delete mode 100644 src/libs/installer/setexamplespathonqtoperation.h delete mode 100644 src/libs/installer/setimportspathonqtcoreoperation.cpp delete mode 100644 src/libs/installer/setimportspathonqtcoreoperation.h delete mode 100644 src/libs/installer/setpathonqtcoreoperation.cpp delete mode 100644 src/libs/installer/setpathonqtcoreoperation.h delete mode 100644 src/libs/installer/setpluginpathonqtcoreoperation.cpp delete mode 100644 src/libs/installer/setpluginpathonqtcoreoperation.h (limited to 'src/libs/installer') diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 6bc3e803a..5889c67ce 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -935,8 +935,9 @@ void Component::addOperation(Operation *operation) void Component::addElevatedOperation(Operation *operation) { if (value(scRequiresAdminRights, scFalse) != scTrue) { - qWarning() << QString::fromLatin1("component %1 uses addElevatedOperation in the script, but it does not" - "have the needed RequiresAdminRights tag").arg(name()); + qWarning() << QString::fromLatin1("Component %1 uses addElevatedOperation in the script, " + "but it does not have the needed RequiresAdminRights tag" + ).arg(name()); } addOperation(operation); operation->setValue(QLatin1String("admin"), true); diff --git a/src/libs/installer/init.cpp b/src/libs/installer/init.cpp index a8a7f54d8..9ef72b4dd 100644 --- a/src/libs/installer/init.cpp +++ b/src/libs/installer/init.cpp @@ -63,16 +63,8 @@ // QtSDK specific #include "qtpatchoperation.h" #include "consumeoutputoperation.h" -#include "setdemospathonqtoperation.h" -#include "setexamplespathonqtoperation.h" -#include "setpluginpathonqtcoreoperation.h" -#include "setimportspathonqtcoreoperation.h" -#include "setpathonqtcoreoperation.h" -#include "registerqtincreatorqnxoperation.h" #include "setqtcreatorvalueoperation.h" #include "addqtcreatorarrayvalueoperation.h" -#include "registertoolchainoperation.h" -#include "registerdefaultdebuggeroperation.h" #ifdef Q_OS_MAC # include "macreplaceinstallnamesoperation.h" @@ -247,14 +239,6 @@ void QInstaller::init() factory.registerUpdateOperation(QLatin1String("ConsumeOutput")); // QtSDK specific - factory.registerUpdateOperation(QLatin1String("RegisterQtInCreatorQNX")); - factory.registerUpdateOperation(QLatin1String("RegisterToolChain")); - factory.registerUpdateOperation(QLatin1String("RegisterDefaultDebugger")); - factory.registerUpdateOperation(QLatin1String("SetDemosPathOnQt")); - factory.registerUpdateOperation(QLatin1String("SetExamplesPathOnQt")); - factory.registerUpdateOperation(QLatin1String("SetPluginPathOnQtCore")); - factory.registerUpdateOperation(QLatin1String("SetImportsPathOnQtCore")); - factory.registerUpdateOperation(QLatin1String("SetPathOnQtCore")); factory.registerUpdateOperation(QLatin1String("SetQtCreatorValue")); factory.registerUpdateOperation(QLatin1String("AddQtCreatorArrayValue")); factory.registerUpdateOperation(QLatin1String("QtPatch")); diff --git a/src/libs/installer/installer.pro b/src/libs/installer/installer.pro index ab28aa72b..5ae0b1afb 100644 --- a/src/libs/installer/installer.pro +++ b/src/libs/installer/installer.pro @@ -52,18 +52,10 @@ HEADERS += packagemanagercore.h \ componentmodel.h \ qinstallerglobal.h \ qtpatch.h \ - persistentsettings.h \ - projectexplorer_export.h \ qtpatchoperation.h \ consumeoutputoperation.h \ - setpathonqtcoreoperation.h \ - setdemospathonqtoperation.h \ - setexamplespathonqtoperation.h \ - setpluginpathonqtcoreoperation.h \ - setimportspathonqtcoreoperation.h \ replaceoperation.h \ linereplaceoperation.h \ - registertoolchainoperation.h \ setqtcreatorvalueoperation.h \ addqtcreatorarrayvalueoperation.h \ copydirectoryoperation.h \ @@ -98,8 +90,6 @@ HEADERS += packagemanagercore.h \ licenseoperation.h \ component_p.h \ qtcreator_constants.h \ - qtcreatorpersistentsettings.h \ - registerdefaultdebuggeroperation.h \ qprocesswrapper.h \ qsettingswrapper.h \ constants.h \ @@ -109,7 +99,6 @@ HEADERS += packagemanagercore.h \ link.h \ createlinkoperation.h \ packagemanagercoredata.h \ - registerqtincreatorqnxoperation.h \ applyproductkeyoperation.h \ globals.h @@ -127,17 +116,10 @@ HEADERS += packagemanagercore.h \ scriptengine.cpp \ componentmodel.cpp \ qtpatch.cpp \ - persistentsettings.cpp \ qtpatchoperation.cpp \ consumeoutputoperation.cpp \ - setpathonqtcoreoperation.cpp \ - setdemospathonqtoperation.cpp \ - setexamplespathonqtoperation.cpp \ - setpluginpathonqtcoreoperation.cpp \ - setimportspathonqtcoreoperation.cpp \ replaceoperation.cpp \ linereplaceoperation.cpp \ - registertoolchainoperation.cpp \ setqtcreatorvalueoperation.cpp \ addqtcreatorarrayvalueoperation.cpp \ copydirectoryoperation.cpp \ @@ -169,8 +151,6 @@ HEADERS += packagemanagercore.h \ getrepositoriesmetainfojob.cpp \ licenseoperation.cpp \ component_p.cpp \ - qtcreatorpersistentsettings.cpp \ - registerdefaultdebuggeroperation.cpp \ qprocesswrapper.cpp \ templates.cpp \ qsettingswrapper.cpp \ @@ -181,7 +161,6 @@ HEADERS += packagemanagercore.h \ link.cpp \ createlinkoperation.cpp \ packagemanagercoredata.cpp \ - registerqtincreatorqnxoperation.cpp \ applyproductkeyoperation.cpp \ globals.cpp diff --git a/src/libs/installer/persistentsettings.cpp b/src/libs/installer/persistentsettings.cpp deleted file mode 100644 index ecafe7682..000000000 --- a/src/libs/installer/persistentsettings.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "persistentsettings.h" - -#include -#include -#include -#include -#include -#include - - -using namespace ProjectExplorer; - -PersistentSettingsReader::PersistentSettingsReader() -{ -} - -QVariant PersistentSettingsReader::restoreValue(const QString &variable) const -{ - if (m_valueMap.contains(variable)) - return m_valueMap.value(variable); - return QVariant(); -} - -QVariantMap PersistentSettingsReader::restoreValues() const -{ - return m_valueMap; -} - -bool PersistentSettingsReader::load(const QString &fileName) -{ - m_valueMap.clear(); - - QFile file(fileName); - if (!file.open(QIODevice::ReadOnly)) - return false; - - QDomDocument doc; - if (!doc.setContent(&file)) - return false; - - QDomElement root = doc.documentElement(); - if (root.nodeName() != QLatin1String("qtcreator")) - return false; - - QDomElement child = root.firstChildElement(); - for (; !child.isNull(); child = child.nextSiblingElement()) { - if (child.nodeName() == QLatin1String("data")) - readValues(child); - } - - file.close(); - return true; -} - -QVariant PersistentSettingsReader::readValue(const QDomElement &valElement) const -{ - QString name = valElement.nodeName(); - QString type = valElement.attribute(QLatin1String("type")); - QVariant v; - - if (name == QLatin1String("value")) { - if(type == QLatin1String("QChar")) { - //Workaround: QTBUG-12345 - v.setValue(QChar(valElement.text().at(0))); - } else { - v.setValue(valElement.text()); - v.convert(QVariant::nameToType(type.toLatin1().data())); - } - } else if (name == QLatin1String("valuelist")) { - QDomElement child = valElement.firstChildElement(); - QList valList; - for (; !child.isNull(); child = child.nextSiblingElement()) { - valList << readValue(child); - } - v.setValue(valList); - } else if (name == QLatin1String("valuemap")) { - QDomElement child = valElement.firstChildElement(); - QMap valMap; - for (; !child.isNull(); child = child.nextSiblingElement()) { - QString key = child.attribute(QLatin1String("key")); - valMap.insert(key, readValue(child)); - } - v.setValue(valMap); - } - - return v; -} - -void PersistentSettingsReader::readValues(const QDomElement &data) -{ - QString variable; - QVariant v; - - QDomElement child = data.firstChildElement(); - for (; !child.isNull(); child = child.nextSiblingElement()) { - if (child.nodeName() == QLatin1String("variable")) - variable = child.text(); - else - v = readValue(child); - } - - m_valueMap.insert(variable, v); -} - -/// -/// PersistentSettingsWriter -/// - -PersistentSettingsWriter::PersistentSettingsWriter() -{ -} - -void PersistentSettingsWriter::writeValue(QDomElement &ps, const QVariant &variant) -{ - if (variant.type() == QVariant::StringList || variant.type() == QVariant::List) { - QDomElement values = ps.ownerDocument().createElement(QLatin1String("valuelist")); - values.setAttribute(QLatin1String("type"), QLatin1String(QVariant::typeToName(QVariant::List))); - QList varList = variant.toList(); - foreach (const QVariant &var, varList) { - writeValue(values, var); - } - ps.appendChild(values); - } else if (variant.type() == QVariant::Map) { - QDomElement values = ps.ownerDocument().createElement(QLatin1String("valuemap")); - values.setAttribute(QLatin1String("type"), QLatin1String(QVariant::typeToName(QVariant::Map))); - - QMap varMap = variant.toMap(); - QMap::const_iterator i = varMap.constBegin(); - while (i != varMap.constEnd()) { - writeValue(values, i.value()); - values.lastChild().toElement(). - setAttribute(QLatin1String("key"), i.key()); - ++i; - } - - ps.appendChild(values); - } else { - QDomElement value = ps.ownerDocument().createElement(QLatin1String("value")); - ps.appendChild(value); - QDomText valueText = ps.ownerDocument().createTextNode(variant.toString()); - value.appendChild(valueText); - value.setAttribute(QLatin1String("type"), QLatin1String(variant.typeName())); - ps.appendChild(value); - } -} - -void PersistentSettingsWriter::saveValue(const QString &variable, const QVariant &value) -{ - m_valueMap[variable] = value; -} - -bool PersistentSettingsWriter::save(const QString &fileName, const QString &docType) -{ - QFile file(fileName); - if (!file.open(QIODevice::WriteOnly)) - return false; - - QDomDocument doc(docType); - - QDomElement root = doc.createElement(QLatin1String("qtcreator")); - doc.appendChild(root); - - QMap::const_iterator i = m_valueMap.constBegin(); - while (i != m_valueMap.constEnd()) { - QDomElement ps = doc.createElement(QLatin1String("data")); - root.appendChild(ps); - - QDomElement variable = doc.createElement(QLatin1String("variable")); - ps.appendChild(variable); - QDomText variableText = doc.createTextNode(i.key()); - variable.appendChild(variableText); - - writeValue(ps, i.value()); - ++i; - } - - file.write(doc.toByteArray()); - file.close(); - return true; -} diff --git a/src/libs/installer/persistentsettings.h b/src/libs/installer/persistentsettings.h deleted file mode 100644 index 71249cd70..000000000 --- a/src/libs/installer/persistentsettings.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef PERSISTENTSETTINGS_H -#define PERSISTENTSETTINGS_H - -#include "projectexplorer_export.h" - -#include -#include - -QT_BEGIN_NAMESPACE -class QDomElement; -QT_END_NAMESPACE - -namespace ProjectExplorer { - -class PROJECTEXPLORER_EXPORT PersistentSettingsReader -{ -public: - PersistentSettingsReader(); - QVariant restoreValue(const QString &variable) const; - QVariantMap restoreValues() const; - bool load(const QString & fileName); - -private: - QVariant readValue(const QDomElement &valElement) const; - void readValues(const QDomElement &data); - QMap m_valueMap; -}; - -class PROJECTEXPLORER_EXPORT PersistentSettingsWriter -{ -public: - PersistentSettingsWriter(); - void saveValue(const QString &variable, const QVariant &value); - bool save(const QString &fileName, const QString &docType); - -private: - void writeValue(QDomElement &ps, const QVariant &value); - QMap m_valueMap; -}; - -} // namespace ProjectExplorer - -#endif // PERSISTENTSETTINGS_H diff --git a/src/libs/installer/projectexplorer_export.h b/src/libs/installer/projectexplorer_export.h deleted file mode 100644 index 0e8cb470b..000000000 --- a/src/libs/installer/projectexplorer_export.h +++ /dev/null @@ -1 +0,0 @@ -#define PROJECTEXPLORER_EXPORT diff --git a/src/libs/installer/qtcreatorpersistentsettings.cpp b/src/libs/installer/qtcreatorpersistentsettings.cpp deleted file mode 100644 index bc035b422..000000000 --- a/src/libs/installer/qtcreatorpersistentsettings.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "qtcreatorpersistentsettings.h" -#include "qtcreator_constants.h" - -#include -#include -#include -#include - -QtCreatorPersistentSettings::QtCreatorPersistentSettings() -{ -} - -bool QtCreatorPersistentSettings::init(const QString &fileName) -{ - Q_ASSERT(!fileName.isEmpty()); - if (fileName.isEmpty()) - return false; - m_fileName = fileName; - if (m_reader.load(m_fileName) && !versionCheck()) - return false; - - m_toolChains = readValidToolChains(); - m_abiToDebuggerHash = readAbiToDebuggerHash(); - - return true; -} - -bool QtCreatorPersistentSettings::versionCheck() -{ - QVariantMap data = m_reader.restoreValues(); - - // Check version: - int version = data.value(QLatin1String(TOOLCHAIN_FILE_VERSION_KEY), 0).toInt(); - if (version < 1) - return false; - return true; -} - - -QHash QtCreatorPersistentSettings::readValidToolChains() -{ - if (m_fileName.isEmpty()) - return QHash(); - - QHash toolChainHash; - - QVariantMap data = m_reader.restoreValues(); - - int count = data.value(QLatin1String(TOOLCHAIN_COUNT_KEY), 0).toInt(); - for (int i = 0; i < count; ++i) { - const QString key = QLatin1String(TOOLCHAIN_DATA_KEY) + QString::number(i); - - const QVariantMap toolChainMap = data.value(key).toMap(); - - //gets the path variable, hope ".Path" will stay in QtCreator - QStringList pathContainingKeyList = QStringList(toolChainMap.keys()).filter(QLatin1String( - ".Path")); - foreach (const QString& pathKey, pathContainingKeyList) { - QString path = toolChainMap.value(pathKey).toString(); - if (!path.isEmpty() && QFile::exists(path)) { - toolChainHash.insert(path, toolChainMap); - } - } - } - return toolChainHash; -} - -QHash QtCreatorPersistentSettings::abiToDebuggerHash() -{ - return m_abiToDebuggerHash; -} - -QHash QtCreatorPersistentSettings::readAbiToDebuggerHash() -{ - if (m_fileName.isEmpty()) - return QHash(); - - QHash abiToDebuggerHash; - - QVariantMap data = m_reader.restoreValues(); - - // Read default debugger settings (if any) - int count = data.value(QLatin1String(DEFAULT_DEBUGGER_COUNT_KEY)).toInt(); - for (int i = 0; i < count; ++i) { - const QString abiKey = QString::fromLatin1(DEFAULT_DEBUGGER_ABI_KEY) + QString::number(i); - if (!data.contains(abiKey)) - continue; - const QString pathKey = QString::fromLatin1(DEFAULT_DEBUGGER_PATH_KEY) + QString::number(i); - if (!data.contains(pathKey)) - continue; - abiToDebuggerHash.insert(data.value(abiKey).toString(), data.value(pathKey).toString()); - } - return abiToDebuggerHash; -} - -bool QtCreatorPersistentSettings::addToolChain(const QtCreatorToolChain &toolChain) -{ - if (toolChain.key.isEmpty()) - return false; - if (toolChain.type.isEmpty()) - return false; - if (toolChain.displayName.isEmpty()) - return false; - if (toolChain.abiString.isEmpty()) - return false; - if (toolChain.compilerPath.isEmpty()) - return false; - - QVariantMap newToolChainVariantMap; - - newToolChainVariantMap.insert(QLatin1String(ID_KEY), - QString::fromLatin1("%1:%2.%3").arg(toolChain.type, QFileInfo(toolChain.compilerPath - ).absoluteFilePath(), toolChain.abiString)); - newToolChainVariantMap.insert(QLatin1String(DISPLAY_NAME_KEY), toolChain.displayName); - newToolChainVariantMap.insert(QString::fromLatin1("ProjectExplorer.%1.Path").arg(toolChain.key), - QFileInfo(toolChain.compilerPath).absoluteFilePath()); - newToolChainVariantMap.insert(QString::fromLatin1("ProjectExplorer.%1.TargetAbi").arg(toolChain.key), - toolChain.abiString); - newToolChainVariantMap.insert(QString::fromLatin1("ProjectExplorer.%1.Debugger").arg(toolChain.key), - QFileInfo(toolChain.debuggerPath).absoluteFilePath()); - - m_toolChains.insert(QFileInfo(toolChain.compilerPath).absoluteFilePath(), newToolChainVariantMap); - return true; -} - -bool QtCreatorPersistentSettings::removeToolChain(const QtCreatorToolChain &toolChain) -{ - m_toolChains.remove(QFileInfo(toolChain.compilerPath).absoluteFilePath()); - return true; -} - -void QtCreatorPersistentSettings::addDefaultDebugger(const QString &abiString, const QString &debuggerPath) -{ - m_abiToDebuggerHash.insert(abiString, debuggerPath); -} - -void QtCreatorPersistentSettings::removeDefaultDebugger(const QString &abiString) -{ - m_abiToDebuggerHash.remove(abiString); -} - -bool QtCreatorPersistentSettings::save() -{ - if (m_fileName.isEmpty()) - return false; - - m_writer.saveValue(QLatin1String(DEFAULT_DEBUGGER_COUNT_KEY), m_abiToDebuggerHash.count()); - - QHashIterator it(m_abiToDebuggerHash); - int debuggerCounter = 0; - while (it.hasNext()) { - it.next(); - const QString abiKey = QString::fromLatin1(DEFAULT_DEBUGGER_ABI_KEY) + QString::number( - debuggerCounter); - const QString pathKey = QString::fromLatin1(DEFAULT_DEBUGGER_PATH_KEY) + QString::number( - debuggerCounter); - m_writer.saveValue(abiKey, it.key()); - m_writer.saveValue(pathKey, it.value()); - debuggerCounter++; - } - - m_writer.saveValue(QLatin1String(TOOLCHAIN_COUNT_KEY), m_toolChains.count()); - - int toolChainCounter = 0; - - foreach (QVariantMap toolChainMap, m_toolChains.values()) { - if (toolChainMap.isEmpty()) - continue; - - //if we added a new debugger we need to adjust the tool chains - QString abiString; - //find the abiString - foreach (const QString &key, toolChainMap.keys()) { - if (key.contains(QLatin1String(".TargetAbi"))) { - abiString = toolChainMap.value(key).toString(); - break; - } - } - //adjust debugger path - foreach (const QString &key, toolChainMap.keys()) { - if (key.contains(QLatin1String(".Debugger"))) { - toolChainMap.insert(key, m_abiToDebuggerHash.value(abiString)); - break; - } - } - - m_writer.saveValue(QLatin1String(TOOLCHAIN_DATA_KEY) + QString::number(toolChainCounter++), - toolChainMap); - } - - m_writer.saveValue(QLatin1String(TOOLCHAIN_FILE_VERSION_KEY), 1); - - QDir().mkpath(QFileInfo(m_fileName).absolutePath()); - return m_writer.save(m_fileName, QLatin1String("QtCreatorToolChains")); -} diff --git a/src/libs/installer/qtcreatorpersistentsettings.h b/src/libs/installer/qtcreatorpersistentsettings.h deleted file mode 100644 index 4e299475a..000000000 --- a/src/libs/installer/qtcreatorpersistentsettings.h +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef QTCREATORPERSISTENTSETTINGS_H -#define QTCREATORPERSISTENTSETTINGS_H - -#include "persistentsettings.h" - -#include -#include -#include - -struct QtCreatorToolChain -{ - QString key; - QString type; - QString displayName; - QString abiString; - QString compilerPath; - QString debuggerPath; - QString armVersion; - QString force32Bit; -}; - -class QtCreatorPersistentSettings -{ -public: - QtCreatorPersistentSettings(); - bool init(const QString &fileName); - bool addToolChain(const QtCreatorToolChain &toolChain); - bool removeToolChain(const QtCreatorToolChain &toolChain); - void addDefaultDebugger(const QString &abiString, const QString &debuggerPath); - void removeDefaultDebugger(const QString &abiString); - bool save(); - QHash abiToDebuggerHash(); - -private: - QHash readValidToolChains(); - QHash readAbiToDebuggerHash(); - bool versionCheck(); - - QString m_fileName; - QHash m_toolChains; - QHash m_abiToDebuggerHash; - ProjectExplorer::PersistentSettingsReader m_reader; - ProjectExplorer::PersistentSettingsWriter m_writer; - -}; - -#endif // QTCREATORPERSISTENTSETTINGS_H diff --git a/src/libs/installer/registerdefaultdebuggeroperation.cpp b/src/libs/installer/registerdefaultdebuggeroperation.cpp deleted file mode 100644 index b076ad33e..000000000 --- a/src/libs/installer/registerdefaultdebuggeroperation.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "registerdefaultdebuggeroperation.h" - -#include "persistentsettings.h" -#include "packagemanagercore.h" -#include "qtcreator_constants.h" -#include "qtcreatorpersistentsettings.h" - -#include -#include -#include -#include -#include - -using namespace QInstaller; - -using namespace ProjectExplorer; - -//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; -} - -RegisterDefaultDebuggerOperation::RegisterDefaultDebuggerOperation() -{ - setName(QLatin1String("RegisterDefaultDebugger")); -} - -void RegisterDefaultDebuggerOperation::backup() -{ -} - -/** application binary interface - this is an internal creator typ as a String CPU-OS-OS_FLAVOR-BINARY_FORMAT-WORD_WIDTH - * CPU: arm x86 mips ppc itanium - * OS: linux macos symbian unix windows - * OS_FLAVOR: generic maemo meego generic device emulator generic msvc2005 msvc2008 msvc2010 msys ce - * BINARY_FORMAT: elf pe mach_o qml_rt - * WORD_WIDTH: 8 16 32 64 - */ - -bool RegisterDefaultDebuggerOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 2) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("exactly 2"), QLatin1String(""))); - return false; - } - - QString toolChainsXmlFilePath; - - 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(scQtCreatorInstallerToolchainsFile).isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerToolchainsFile)); - return false; - } - toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); - - int argCounter = 0; - const QString &abiString = args.at(argCounter++); //for example x86-windows-msys-pe-32bit - const QString &debuggerPath = fromNativeSeparatorsAllOS(args.at(argCounter++)); - - QtCreatorPersistentSettings creatorToolChainSettings; - - if (!creatorToolChainSettings.init(toolChainsXmlFilePath)) { - setError(UserDefinedError); - setErrorString(tr("Cannot read from tool chains xml file(%1) correctly.") - .arg(toolChainsXmlFilePath)); - return false; - } - - creatorToolChainSettings.addDefaultDebugger(abiString, debuggerPath); - return creatorToolChainSettings.save(); -} - -bool RegisterDefaultDebuggerOperation::undoOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 2) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, 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; - } - - // default value is the old value to keep the possibility that old saved operations can run undo -#ifdef Q_OS_MAC - QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile, - QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/QtProject/toolChains.xml").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/QtProject/toolChains.xml").arg(core->value( - QLatin1String("TargetDir")))); -#endif - - int argCounter = 0; - const QString &abiString = args.at(argCounter++); //for example x86-windows-msys-pe-32bit - const QString &debuggerPath = fromNativeSeparatorsAllOS(args.at(argCounter++)); - Q_UNUSED(debuggerPath) - - QtCreatorPersistentSettings creatorToolChainSettings; - - creatorToolChainSettings.init(toolChainsXmlFilePath); - creatorToolChainSettings.removeDefaultDebugger(abiString); - return creatorToolChainSettings.save(); -} - -bool RegisterDefaultDebuggerOperation::testOperation() -{ - return true; -} - -Operation *RegisterDefaultDebuggerOperation::clone() const -{ - return new RegisterDefaultDebuggerOperation(); -} diff --git a/src/libs/installer/registerdefaultdebuggeroperation.h b/src/libs/installer/registerdefaultdebuggeroperation.h deleted file mode 100644 index 87712e5d8..000000000 --- a/src/libs/installer/registerdefaultdebuggeroperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef REGISTERDEFAULTDEBUGGEROPERATION_H -#define REGISTERDEFAULTDEBUGGEROPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class RegisterDefaultDebuggerOperation : public Operation -{ -public: - RegisterDefaultDebuggerOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // REGISTERDEFAULTDEBUGGEROPERATION_H diff --git a/src/libs/installer/registerqtincreatorqnxoperation.cpp b/src/libs/installer/registerqtincreatorqnxoperation.cpp deleted file mode 100644 index be99de4c7..000000000 --- a/src/libs/installer/registerqtincreatorqnxoperation.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "registerqtincreatorqnxoperation.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); -} - -RegisterQtInCreatorQNXOperation::RegisterQtInCreatorQNXOperation() -{ - setName(QLatin1String("RegisterQtInCreatorQNX")); -} - -void RegisterQtInCreatorQNXOperation::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 RegisterQtInCreatorQNXOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() < 5) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("at least 5"), QLatin1String(""))); - 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 &sdkPath = args.at(argCounter++); - 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("Arch"), 1); - map.insert(QLatin1String("Name"), versionName); - map.insert(QLatin1String("QMakePath"), versionQmakePath); - map.insert(QLatin1String("SDKPath"), sdkPath); - 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 RegisterQtInCreatorQNXOperation::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/QtProject/qtversion.xml").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/QtProject/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 RegisterQtInCreatorQNXOperation::testOperation() -{ - return true; -} - -Operation *RegisterQtInCreatorQNXOperation::clone() const -{ - return new RegisterQtInCreatorQNXOperation(); -} diff --git a/src/libs/installer/registerqtincreatorqnxoperation.h b/src/libs/installer/registerqtincreatorqnxoperation.h deleted file mode 100644 index 5b6a3c9b1..000000000 --- a/src/libs/installer/registerqtincreatorqnxoperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef REGISTERQTINCREATORQNXOPERATION_H -#define REGISTERQTINCREATORQNXOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class RegisterQtInCreatorQNXOperation : public Operation -{ -public: - RegisterQtInCreatorQNXOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // REGISTERQTINCREATORQNXOPERATION_H diff --git a/src/libs/installer/registertoolchainoperation.cpp b/src/libs/installer/registertoolchainoperation.cpp deleted file mode 100644 index 89d104212..000000000 --- a/src/libs/installer/registertoolchainoperation.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "registertoolchainoperation.h" - -#include "persistentsettings.h" -#include "packagemanagercore.h" -#include "qtcreator_constants.h" -#include "qtcreatorpersistentsettings.h" - -#include -#include -#include -#include -#include - -using namespace QInstaller; - -using namespace ProjectExplorer; - -RegisterToolChainOperation::RegisterToolChainOperation() -{ - setName(QLatin1String("RegisterToolChain")); -} - -void RegisterToolChainOperation::backup() -{ -} - -bool RegisterToolChainOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() < 4) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("at least 4"), QLatin1String(""))); - return false; - } - - QString toolChainsXmlFilePath; - - 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(scQtCreatorInstallerToolchainsFile).isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for '%1' on the installer object.").arg( - scQtCreatorInstallerToolchainsFile)); - return false; - } - toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); - - QtCreatorToolChain toolChain; - - int argCounter = 0; - toolChain.key = args.at(argCounter++); //Qt SDK:gccPath - toolChain.type = args.at(argCounter++); //where this toolchain is defined in QtCreator - toolChain.displayName = args.at(argCounter++); //nice special Toolchain (Qt SDK) - toolChain.abiString = args.at(argCounter++); //x86-windows-msys-pe-32bit - toolChain.compilerPath = QDir::toNativeSeparators(args.at(argCounter++)); //gccPath - if (args.count() > argCounter) - toolChain.debuggerPath = QDir::toNativeSeparators(args.at(argCounter++)); - if (args.count() > argCounter) - toolChain.armVersion = args.at(argCounter++); - if (args.count() > argCounter) - toolChain.force32Bit = args.at(argCounter++); - - QtCreatorPersistentSettings creatorToolChainSettings; - - if (!creatorToolChainSettings.init(toolChainsXmlFilePath)) { - setError(UserDefinedError); - setErrorString(tr("Cannot read from tool chains xml file(%1) correctly.") - .arg(toolChainsXmlFilePath)); - return false; - } - - if (!creatorToolChainSettings.addToolChain(toolChain)) { - setError(InvalidArguments); - setErrorString(tr("Some arguments are not right in %1 operation.") - .arg(name()).arg(args.count())); - return false; - } - return creatorToolChainSettings.save(); -} - -bool RegisterToolChainOperation::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 toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile, - QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/QtProject/toolChains.xml").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/QtProject/toolChains.xml").arg(core->value( - QLatin1String("TargetDir")))); -#endif - - QtCreatorToolChain toolChain; - - int argCounter = 0; - toolChain.key = args.at(argCounter++); //Qt SDK:gccPath - toolChain.type = args.at(argCounter++); //where this toolchain is defined in QtCreator - toolChain.displayName = args.at(argCounter++); //nice special Toolchain (Qt SDK) - toolChain.abiString = args.at(argCounter++); //x86-windows-msys-pe-32bit - toolChain.compilerPath = QDir::toNativeSeparators(args.at(argCounter++)); //gccPath - if (args.count() > argCounter) - toolChain.debuggerPath = QDir::toNativeSeparators(args.at(argCounter++)); - if (args.count() > argCounter) - toolChain.armVersion = args.at(argCounter++); - if (args.count() > argCounter) - toolChain.force32Bit = args.at(argCounter++); - - QtCreatorPersistentSettings creatorToolChainSettings; - - if (!creatorToolChainSettings.init(toolChainsXmlFilePath)) { - setError(UserDefinedError); - setErrorString(tr("Cannot read from tool chains xml file(%1) correctly.") - .arg(toolChainsXmlFilePath)); - return false; - } - - if (!creatorToolChainSettings.removeToolChain(toolChain)) { - setError(InvalidArguments); - setErrorString(tr("Some arguments are not right in %1 operation.") - .arg(name()).arg(args.count())); - return false; - } - return creatorToolChainSettings.save(); -} - -bool RegisterToolChainOperation::testOperation() -{ - return true; -} - -Operation *RegisterToolChainOperation::clone() const -{ - return new RegisterToolChainOperation(); -} diff --git a/src/libs/installer/registertoolchainoperation.h b/src/libs/installer/registertoolchainoperation.h deleted file mode 100644 index bd745adfb..000000000 --- a/src/libs/installer/registertoolchainoperation.h +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef REGISTERTOOLCHAINOPERATION_H -#define REGISTERTOOLCHAINOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -/*! - Arguments: - * SDK Path - to find the QtCreator installation - * ToolChainKey - is the internal QtCreator settings key usually: GccToolChain - * toolchain type - where this toolchain is defined in QtCreator - * ProjectExplorer.ToolChain.Gcc ProjectExplorer.ToolChain.Mingw - * ProjectExplorer.ToolChain.LinuxIcc ProjectExplorer.ToolChain.Msvc - * Qt4ProjectManager.ToolChain.GCCE Qt4ProjectManager.ToolChain.Maemo - * display name - the name how it will be displayed in QtCreator - * application binary interface - this is an internal creator typ as a String CPU-OS-OS_FLAVOR-BINARY_FORMAT-WORD_WIDTH - * CPU: arm x86 mips ppc itanium - * OS: linux macos symbian unix windows - * OS_FLAVOR: generic maemo meego generic device emulator generic msvc2005 msvc2008 msvc2010 msys ce - * BINARY_FORMAT: elf pe mach_o qml_rt - * WORD_WIDTH: 8 16 32 64 - * compiler path - the binary which is used as the compiler - * debugger path - the binary which is used as the debugger -*/ -class RegisterToolChainOperation : public Operation -{ -public: - RegisterToolChainOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // REGISTERTOOLCHAINOPERATION_H diff --git a/src/libs/installer/setdemospathonqtoperation.cpp b/src/libs/installer/setdemospathonqtoperation.cpp deleted file mode 100644 index d558b3e21..000000000 --- a/src/libs/installer/setdemospathonqtoperation.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "setdemospathonqtoperation.h" - -#include "qtpatch.h" - -#include -#include -#include - -using namespace QInstaller; - -SetDemosPathOnQtOperation::SetDemosPathOnQtOperation() -{ - setName(QLatin1String("SetDemosPathOnQt")); -} - -void SetDemosPathOnQtOperation::backup() -{ -} - -bool SetDemosPathOnQtOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 2) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("exactly 2"), QLatin1String(""))); - return false; - } - - const QString qtDir = args.at(0); - QByteArray newValue = QDir::toNativeSeparators(args.at(1)).toUtf8(); - - QString qmakePath = qtDir + QLatin1String("/bin/qmake"); -#ifdef Q_OS_WIN - qmakePath = qmakePath + QLatin1String(".exe"); -#endif - - QByteArray qmakeOutput; - QHash qmakeValueHash = QtPatch::qmakeValues(qmakePath, &qmakeOutput); - - if (qmakeValueHash.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("The output of \n'%1 -query'\nis not parseable. Please file a bugreport with this " - "dialog at https://bugreports.qt-project.org.\noutput: %2").arg(QDir::toNativeSeparators(qmakePath), - QString::fromUtf8(qmakeOutput))); - return false; - } - - QByteArray oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_DEMOS")); - bool oldQtPathFromQMakeIsEmpty = oldValue.isEmpty(); - if (oldQtPathFromQMakeIsEmpty) { - qDebug() << "qpatch: warning: It was not possible to get the old values from" << qmakePath; - } - - if (newValue.size() >= 255) { - setError(UserDefinedError); - setErrorString(tr("Qt patch error: new Qt demo path '%1'\nneeds to be less than 255 characters.") - .arg(QString::fromLocal8Bit(newValue)) ); - return false; - } - - QString qtConfPath = qtDir + QLatin1String("/bin/qt.conf"); - if (QFile::exists(qtConfPath)) { - QSettings settings(qtConfPath, QSettings::IniFormat); - settings.setValue(QLatin1String("Paths/Demos"), QString::fromUtf8(newValue)); - } - - oldValue = QByteArray("qt_demopath=%1").replace("%1", oldValue); - newValue = QByteArray("qt_demopath=%1").replace("%1", newValue); - - bool isPatched = QtPatch::patchBinaryFile(qmakePath, oldValue, newValue); - if (!isPatched) { - qDebug() << "qpatch: warning: could not patch the demo path in" << qmakePath; - } - - return true; -} - -bool SetDemosPathOnQtOperation::undoOperation() -{ - return true; -} - -bool SetDemosPathOnQtOperation::testOperation() -{ - return true; -} - -Operation *SetDemosPathOnQtOperation::clone() const -{ - return new SetDemosPathOnQtOperation(); -} - diff --git a/src/libs/installer/setdemospathonqtoperation.h b/src/libs/installer/setdemospathonqtoperation.h deleted file mode 100644 index 27d25c9f9..000000000 --- a/src/libs/installer/setdemospathonqtoperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef SETDEMOSPATHONQTOPERATION_H -#define SETDEMOSPATHONQTOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class SetDemosPathOnQtOperation : public Operation -{ -public: - SetDemosPathOnQtOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace - -#endif // SETDEMOSPATHONQTOPERATION_H diff --git a/src/libs/installer/setexamplespathonqtoperation.cpp b/src/libs/installer/setexamplespathonqtoperation.cpp deleted file mode 100644 index e73aed25a..000000000 --- a/src/libs/installer/setexamplespathonqtoperation.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "setexamplespathonqtoperation.h" - -#include "qtpatch.h" - -#include -#include -#include - -using namespace QInstaller; - -SetExamplesPathOnQtOperation::SetExamplesPathOnQtOperation() -{ - setName(QLatin1String("SetExamplesPathOnQt")); -} - -void SetExamplesPathOnQtOperation::backup() -{ -} - -bool SetExamplesPathOnQtOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 2) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("exactly 2"), QLatin1String(""))); - return false; - } - - const QString qtDir = args.at(0); - QByteArray newValue = QDir::toNativeSeparators(args.at(1)).toUtf8(); - - QString qmakePath = qtDir + QLatin1String("/bin/qmake"); -#ifdef Q_OS_WIN - qmakePath = qmakePath + QLatin1String(".exe"); -#endif - - QByteArray qmakeOutput; - QHash qmakeValueHash = QtPatch::qmakeValues(qmakePath, &qmakeOutput); - - if (qmakeValueHash.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("The output of \n'%1 -query'\nis not parseable. Please file a bugreport with this " - "dialog at https://bugreports.qt-project.org.\noutput: %2").arg(QDir::toNativeSeparators(qmakePath), - QString::fromUtf8(qmakeOutput))); - return false; - } - - QByteArray oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_EXAMPLES")); - bool oldQtPathFromQMakeIsEmpty = oldValue.isEmpty(); - if (oldQtPathFromQMakeIsEmpty) { - qDebug() << "qpatch: warning: It was not possible to get the old values from" << qmakePath; - } - - if (newValue.size() >= 255) { - setError(UserDefinedError); - setErrorString(tr("Qt patch error: new Qt example path '%1'\nneeds to be less than 255 characters.") - .arg(QString::fromLocal8Bit(newValue))); - return false; - } - - QString qtConfPath = qtDir + QLatin1String("/bin/qt.conf"); - - if (QFile::exists(qtConfPath)) { - QSettings settings(qtConfPath, QSettings::IniFormat); - settings.setValue( QLatin1String("Paths/Examples"), QString::fromUtf8(newValue)); - } - - oldValue = QByteArray("qt_xmplpath=%1").replace("%1", oldValue); - newValue = QByteArray("qt_xmplpath=%1").replace("%1", newValue); - - bool isPatched = QtPatch::patchBinaryFile(qmakePath, oldValue, newValue); - if (!isPatched) { - qDebug() << "qpatch: warning: could not patch the example path in" << qmakePath; - } - - return true; -} - -bool SetExamplesPathOnQtOperation::undoOperation() -{ - return true; -} - -bool SetExamplesPathOnQtOperation::testOperation() -{ - return true; -} - -Operation *SetExamplesPathOnQtOperation::clone() const -{ - return new SetExamplesPathOnQtOperation(); -} - diff --git a/src/libs/installer/setexamplespathonqtoperation.h b/src/libs/installer/setexamplespathonqtoperation.h deleted file mode 100644 index 7f2df6b4e..000000000 --- a/src/libs/installer/setexamplespathonqtoperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef SETEXAMPLESPATHONQTOPERATION_H -#define SETEXAMPLESPATHONQTOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class SetExamplesPathOnQtOperation : public Operation -{ -public: - SetExamplesPathOnQtOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace - -#endif // SETEXAMPLESPATHONQTOPERATION_H diff --git a/src/libs/installer/setimportspathonqtcoreoperation.cpp b/src/libs/installer/setimportspathonqtcoreoperation.cpp deleted file mode 100644 index 685aee846..000000000 --- a/src/libs/installer/setimportspathonqtcoreoperation.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "setimportspathonqtcoreoperation.h" - -#include "qtpatch.h" - -#include -#include -#include - -using namespace QInstaller; - -namespace { - QByteArray getOldValue(const QString &binaryPath) - { - QFileInfo fileInfo(binaryPath); - - if (!fileInfo.exists()) { - qDebug() << QString::fromLatin1("qpatch: warning: file '%1' not found").arg(binaryPath); - return QByteArray(); - } - - - QFile file(binaryPath); - int readOpenCount = 0; - while (!file.open(QFile::ReadOnly) && readOpenCount < 20000) { - ++readOpenCount; - qApp->processEvents(); - } - Q_ASSERT(file.isOpen()); - if (!file.isOpen()) { - qDebug() << QString::fromLatin1("qpatch: warning: file '%1' can not be opened as ReadOnly.").arg( - binaryPath); - qDebug() << file.errorString(); - return QByteArray(); - } - - const QByteArray source = file.readAll(); - file.close(); - - int offset = 0; - QByteArray searchValue("qt_impspath="); - QByteArrayMatcher byteArrayMatcher(searchValue); - offset = byteArrayMatcher.indexIn(source, offset); - Q_ASSERT(offset > 0); - if (offset == -1) - return QByteArray(); - - int stringEndPosition = offset; - while(source.at(stringEndPosition++) != '\0') {} - // between the search string and the first \0 is the QByteArray we are looking for - return source.mid(offset + searchValue.size(), stringEndPosition - offset); - } -} - -SetImportsPathOnQtCoreOperation::SetImportsPathOnQtCoreOperation() -{ - setName(QLatin1String("SetImportsPathOnQtCore")); -} - -void SetImportsPathOnQtCoreOperation::backup() -{ -} - -bool SetImportsPathOnQtCoreOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 2) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("exactly 2"), QLatin1String(""))); - return false; - } - - const QString qtCoreLibraryDir = args.at(0); - const QByteArray newValue = QDir::toNativeSeparators(args.at(1)).toUtf8(); - - if (newValue.size() >= 255) { - setError(UserDefinedError); - setErrorString(tr("Qt patch error: new Qt imports path '%1'\nneeds to be less than 255 characters.") - .arg(QString::fromLocal8Bit(newValue))); - return false; - } - QStringList libraryFiles; -#ifdef Q_OS_WIN - libraryFiles << QString::fromLatin1("%1/QtCore4.dll").arg(qtCoreLibraryDir); - libraryFiles << QString::fromLatin1("%1/QtCore4d.dll").arg(qtCoreLibraryDir); -#else - libraryFiles << qtCoreLibraryDir + QLatin1String("/libQtCore.so"); -#endif - foreach (const QString coreLibrary, libraryFiles) { - if (QFile::exists(coreLibrary)) { - QByteArray oldValue(getOldValue(coreLibrary)); - Q_ASSERT(!oldValue.isEmpty()); - oldValue = QByteArray("qt_impspath=%1").replace("%1", oldValue); - QByteArray adjutedNewValue = QByteArray("qt_impspath=%1").replace("%1", newValue); - - bool isPatched = QtPatch::patchBinaryFile(coreLibrary, oldValue, adjutedNewValue); - if (!isPatched) { - qDebug() << "qpatch: warning: could not patch the imports path in" << coreLibrary; - } - } - } - - return true; -} - -bool SetImportsPathOnQtCoreOperation::undoOperation() -{ - return true; -} - -bool SetImportsPathOnQtCoreOperation::testOperation() -{ - return true; -} - -Operation *SetImportsPathOnQtCoreOperation::clone() const -{ - return new SetImportsPathOnQtCoreOperation(); -} - diff --git a/src/libs/installer/setimportspathonqtcoreoperation.h b/src/libs/installer/setimportspathonqtcoreoperation.h deleted file mode 100644 index 7dbb9c7d3..000000000 --- a/src/libs/installer/setimportspathonqtcoreoperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef SETIMPORTSPATHONQTCOREOPERATION_H -#define SETIMPORTSPATHONQTCOREOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class SetImportsPathOnQtCoreOperation : public Operation -{ -public: - SetImportsPathOnQtCoreOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace - -#endif // SETIMPORTSPATHONQTCOREOPERATION_H diff --git a/src/libs/installer/setpathonqtcoreoperation.cpp b/src/libs/installer/setpathonqtcoreoperation.cpp deleted file mode 100644 index c6950246d..000000000 --- a/src/libs/installer/setpathonqtcoreoperation.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "setpathonqtcoreoperation.h" - -#include "qtpatch.h" - -#include -#include -#include - -using namespace QInstaller; - -namespace { - QByteArray getOldValue(const QString &binaryPath, const QByteArray &typeValue) - { - QFileInfo fileInfo(binaryPath); - - if (!fileInfo.exists()) { - qDebug() << QString::fromLatin1("qpatch: warning: file '%1' not found.").arg( - binaryPath); - return QByteArray(); - } - - QFile file(binaryPath); - int readOpenCount = 0; - while (!file.open(QFile::ReadOnly) && readOpenCount < 20000) { - ++readOpenCount; - qApp->processEvents(); - } - Q_ASSERT(file.isOpen()); - if (!file.isOpen()) { - qDebug() << QString::fromLatin1("qpatch: warning: file '%1' can not be opened as ReadOnly.").arg( - binaryPath); - qDebug() << file.errorString(); - return QByteArray(); - } - - const QByteArray source = file.readAll(); - file.close(); - - int offset = 0; - QByteArray searchValue = typeValue; - searchValue.append("="); - QByteArrayMatcher byteArrayMatcher(searchValue); - offset = byteArrayMatcher.indexIn(source, offset); - Q_ASSERT(offset > 0); - if (offset == -1) - return QByteArray(); - - int stringEndPosition = offset; - - // go to the position where the other data starts - while (source.at(stringEndPosition++) != '\0') {} - - // between the search string and the first \0 is the QByteArray we are looking for - return source.mid(offset + searchValue.size(), stringEndPosition - offset); - } -} - -SetPathOnQtCoreOperation::SetPathOnQtCoreOperation() -{ - setName(QLatin1String("SetPathOnQtCore")); -} - -void SetPathOnQtCoreOperation::backup() -{ -} - -bool SetPathOnQtCoreOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 3) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("exactly 3"), QLatin1String(""))); - return false; - } - - const QString qtCoreLibraryDir = args.at(0); - const QByteArray typeValue(args.at(1).toUtf8()); - const QByteArray newValue = QDir::toNativeSeparators(args.at(2)).toUtf8(); - - QStringList possibleTypes; - possibleTypes << QLatin1String("qt_prfxpath") - << QLatin1String("qt_docspath") - << QLatin1String("qt_hdrspath") - << QLatin1String("qt_libspath") - << QLatin1String("qt_binspath") - << QLatin1String("qt_plugpath") - << QLatin1String("qt_impspath") - << QLatin1String("qt_datapath") - << QLatin1String("qt_trnspath") - << QLatin1String("qt_xmplpath") - << QLatin1String("qt_demopath"); - - if (!possibleTypes.contains(QString::fromUtf8(typeValue))) { - setError(InvalidArguments); - setErrorString(tr("The second type/value needs to be one of: %1").arg(possibleTypes.join( - QLatin1String(", ")))); - return false; - } - - if (newValue.size() >= 255) { - qDebug() << "qpatch: error: newQtDir needs to be less than 255 characters."; - return false; - } - QStringList libraryFiles; -#ifdef Q_OS_WIN - libraryFiles << QString::fromLatin1("%1/QtCore4.dll").arg(qtCoreLibraryDir); - libraryFiles << QString::fromLatin1("%1/QtCore4d.dll").arg(qtCoreLibraryDir); -#else - libraryFiles << qtCoreLibraryDir + QLatin1String("/libQtCore.so"); -#endif - foreach (const QString coreLibrary, libraryFiles) { - if (QFile::exists(coreLibrary)) { - QByteArray oldValue(getOldValue(coreLibrary, typeValue)); - Q_ASSERT(!oldValue.isEmpty()); - oldValue = QByteArray("%0=%1").replace("%0", typeValue).replace("%1", oldValue); - QByteArray adjutedNewValue = - QByteArray("%0=%1").replace("%0", typeValue).replace("%1", newValue); - - bool isPatched = QtPatch::patchBinaryFile(coreLibrary, oldValue, adjutedNewValue); - if (!isPatched) { - qDebug() << "qpatch: warning: could not patch the plugin path in" << coreLibrary; - } - } - } - - return true; -} - -bool SetPathOnQtCoreOperation::undoOperation() -{ - return true; -} - -bool SetPathOnQtCoreOperation::testOperation() -{ - return true; -} - -Operation *SetPathOnQtCoreOperation::clone() const -{ - return new SetPathOnQtCoreOperation(); -} - diff --git a/src/libs/installer/setpathonqtcoreoperation.h b/src/libs/installer/setpathonqtcoreoperation.h deleted file mode 100644 index 1b63c7ede..000000000 --- a/src/libs/installer/setpathonqtcoreoperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef SETPATHONQTCOREOPERATION_H -#define SETPATHONQTCOREOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class SetPathOnQtCoreOperation : public Operation -{ -public: - SetPathOnQtCoreOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace - -#endif // SETPATHONQTCOREOPERATION_H diff --git a/src/libs/installer/setpluginpathonqtcoreoperation.cpp b/src/libs/installer/setpluginpathonqtcoreoperation.cpp deleted file mode 100644 index cafdda24c..000000000 --- a/src/libs/installer/setpluginpathonqtcoreoperation.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "setpluginpathonqtcoreoperation.h" - -#include "qtpatch.h" - -#include -#include -#include - -using namespace QInstaller; - -namespace { - QByteArray getOldValue(const QString &binaryPath) - { - QFileInfo fileInfo(binaryPath); - - if (!fileInfo.exists()) { - qDebug() << QString::fromLatin1("qpatch: warning: file '%1' not found").arg(binaryPath); - return QByteArray(); - } - - QFile file(binaryPath); - int readOpenCount = 0; - while (!file.open(QFile::ReadOnly) && readOpenCount < 20000) { - ++readOpenCount; - qApp->processEvents(); - } - Q_ASSERT(file.isOpen()); - if (!file.isOpen()) { - qDebug() << QString::fromLatin1("qpatch: warning: file '%1' can not be opened as ReadOnly.").arg( - binaryPath); - qDebug() << file.errorString(); - return QByteArray(); - } - - const QByteArray source = file.readAll(); - file.close(); - - int offset = 0; - QByteArray searchValue("qt_plugpath="); - QByteArrayMatcher byteArrayMatcher(searchValue); - offset = byteArrayMatcher.indexIn(source, offset); - Q_ASSERT(offset > 0); - if (offset == -1) - return QByteArray(); - - int stringEndPosition = offset; - while(source.at(stringEndPosition++) != '\0') {} - // between the search string and the first \0 is the QByteArray we are looking for - return source.mid(offset + searchValue.size(), stringEndPosition - offset); - } -} - -SetPluginPathOnQtCoreOperation::SetPluginPathOnQtCoreOperation() -{ - setName(QLatin1String("SetPluginPathOnQtCore")); -} - -void SetPluginPathOnQtCoreOperation::backup() -{ -} - -bool SetPluginPathOnQtCoreOperation::performOperation() -{ - const QStringList args = arguments(); - - if (args.count() != 2) { - setError(InvalidArguments); - setErrorString(tr("Invalid arguments in %0: %1 arguments given, %2 expected%3.") - .arg(name()).arg(arguments().count()).arg(tr("exactly 2"), QLatin1String(""))); - return false; - } - - const QString qtCoreLibraryDir = args.at(0); - const QByteArray newValue = QDir::toNativeSeparators(args.at(1)).toUtf8(); - - if (newValue.size() >= 255) { - setError(UserDefinedError); - setErrorString(tr("Qt patch error: new Qt plugin path '%1'\nneeds to be less than 255 characters.") - .arg(QString::fromLocal8Bit(newValue))); - return false; - } - QStringList libraryFiles; -#ifdef Q_OS_WIN - libraryFiles << QString::fromLatin1("%1/QtCore4.dll").arg(qtCoreLibraryDir); - libraryFiles << QString::fromLatin1("%1/QtCore4d.dll").arg(qtCoreLibraryDir); -#else - libraryFiles << qtCoreLibraryDir + QLatin1String("/libQtCore.so"); -#endif - foreach (const QString &coreLibrary, libraryFiles) { - if (QFile::exists(coreLibrary)) { - QByteArray oldValue(getOldValue(coreLibrary)); - Q_ASSERT(!oldValue.isEmpty()); - oldValue = QByteArray("qt_plugpath=%1").replace("%1", oldValue); - QByteArray adjutedNewValue = QByteArray("qt_plugpath=%1").replace("%1", newValue); - - bool isPatched = QtPatch::patchBinaryFile(coreLibrary, oldValue, adjutedNewValue); - if (!isPatched) - qDebug() << "qpatch: warning: could not patch the plugin path in" << coreLibrary; - } - } - - return true; -} - -bool SetPluginPathOnQtCoreOperation::undoOperation() -{ - return true; -} - -bool SetPluginPathOnQtCoreOperation::testOperation() -{ - return true; -} - -Operation *SetPluginPathOnQtCoreOperation::clone() const -{ - return new SetPluginPathOnQtCoreOperation(); -} - diff --git a/src/libs/installer/setpluginpathonqtcoreoperation.h b/src/libs/installer/setpluginpathonqtcoreoperation.h deleted file mode 100644 index 99d9c4bfe..000000000 --- a/src/libs/installer/setpluginpathonqtcoreoperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Installer Framework. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef SETPLUGINPATHONQTCOREOPERATION_H -#define SETPLUGINPATHONQTCOREOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class SetPluginPathOnQtCoreOperation : public Operation -{ -public: - SetPluginPathOnQtCoreOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace - -#endif // SETPLUGINPATHONQTCOREOPERATION_H -- cgit v1.2.3