diff options
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | src/libs/installer/addqtcreatorarrayvalueoperation.cpp | 186 | ||||
-rw-r--r-- | src/libs/installer/addqtcreatorarrayvalueoperation.h | 56 | ||||
-rw-r--r-- | src/libs/installer/init.cpp | 4 | ||||
-rw-r--r-- | src/libs/installer/installer.pro | 5 | ||||
-rw-r--r-- | src/libs/installer/qtcreator_constants.h | 62 | ||||
-rw-r--r-- | src/libs/installer/setqtcreatorvalueoperation.cpp | 162 | ||||
-rw-r--r-- | src/libs/installer/setqtcreatorvalueoperation.h | 56 |
8 files changed, 1 insertions, 531 deletions
@@ -37,6 +37,7 @@ - Removed some deprecated things. - Improved documentation. (QTIFW-526) - Updated and improved translations. +- Removed SetQtCreatorArrayValue, AddQtCreatorArrayValue operations. Thanks go to Christoph VogtlÃĪnder, Sze Howe Koh, Ray Donnelly, Tasuku Suzuki and Sascha Cunz for contributions. diff --git a/src/libs/installer/addqtcreatorarrayvalueoperation.cpp b/src/libs/installer/addqtcreatorarrayvalueoperation.cpp deleted file mode 100644 index c0c4fed50..000000000 --- a/src/libs/installer/addqtcreatorarrayvalueoperation.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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** 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. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "addqtcreatorarrayvalueoperation.h" - -#include "qtcreator_constants.h" -#include "packagemanagercore.h" - -#include <QtCore/QSettings> -#include <QtCore/QSet> - -using namespace QInstaller; - -static QString groupName(const QString &groupName) -{ - return groupName == QLatin1String("General") ? QString() : groupName; -} - -AddQtCreatorArrayValueOperation::AddQtCreatorArrayValueOperation() -{ - setName(QLatin1String("AddQtCreatorArrayValue")); -} - -void AddQtCreatorArrayValueOperation::backup() -{ -} - -bool AddQtCreatorArrayValueOperation::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("exactly 4"), tr(" (group, arrayname, key, value)"))); - return false; - } - - PackageManagerCore *const core = value(QLatin1String("installer")).value<PackageManagerCore*>(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in %1 operation is empty.").arg(name())); - return false; - } - - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile); - if (qtCreatorInstallerSettingsFileName.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerSettingsFile)); - return false; - } - - QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); - - const QString &group = groupName(args.at(0)); - const QString &arrayName = args.at(1); - const QString &key = args.at(2); - const QString &value = args.at(3); - - if (!group.isEmpty()) - settings.beginGroup(group); - - QList<QString> oldArrayValues; - int arraySize = settings.beginReadArray(arrayName); - for (int i = 0; i < arraySize; ++i) { - settings.setArrayIndex(i); - //if it is already there we have nothing to do - if (settings.value(key).toString() == value) - return true; - oldArrayValues.append(settings.value(key).toString()); - } - settings.endArray(); - - - settings.beginWriteArray(arrayName); - - for (int i = 0; i < oldArrayValues.size(); ++i) { - settings.setArrayIndex(i); - settings.setValue(key, oldArrayValues.value(i)); - } - settings.setArrayIndex(oldArrayValues.size()); //means next index after the last insert - settings.setValue(key, value); - settings.endArray(); - - settings.sync(); //be safe ;) - setValue(QLatin1String("ArrayValueSet"), true); - return true; -} - -bool AddQtCreatorArrayValueOperation::undoOperation() -{ - if (value(QLatin1String("ArrayValueSet")).isNull()) - return true; - const QStringList args = arguments(); - - PackageManagerCore *const core = value(QLatin1String("installer")).value<PackageManagerCore*>(); - 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_OSX - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/QtProject/QtCreator.ini").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/QtProject/QtCreator.ini").arg(core->value( - QLatin1String("TargetDir")))); -#endif - - QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); - - const QString &group = groupName(args.at(0)); - const QString &arrayName = args.at(1); - const QString &key = args.at(2); - const QString &value = args.at(3); - - if (!group.isEmpty()) - settings.beginGroup(group); - - QList<QString> oldArrayValues; - int arraySize = settings.beginReadArray(arrayName); - for (int i = 0; i < arraySize; ++i) { - settings.setArrayIndex(i); - if (settings.value(key).toString() != value) - oldArrayValues.append(settings.value(key).toString()); - } - settings.endArray(); - - - settings.beginWriteArray(arrayName); - - for (int i = 0; i < oldArrayValues.size(); ++i) { - settings.setArrayIndex(i); - settings.setValue(key, oldArrayValues.value(i)); - } - settings.endArray(); - - settings.sync(); //be safe ;) - return true; -} - -bool AddQtCreatorArrayValueOperation::testOperation() -{ - return true; -} - -Operation *AddQtCreatorArrayValueOperation::clone() const -{ - return new AddQtCreatorArrayValueOperation(); -} diff --git a/src/libs/installer/addqtcreatorarrayvalueoperation.h b/src/libs/installer/addqtcreatorarrayvalueoperation.h deleted file mode 100644 index e552f5db5..000000000 --- a/src/libs/installer/addqtcreatorarrayvalueoperation.h +++ /dev/null @@ -1,56 +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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** 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. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef ADDQTCREATORARRAYVALUEOPERATION_H -#define ADDQTCREATORARRAYVALUEOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class AddQtCreatorArrayValueOperation : public Operation -{ -public: - AddQtCreatorArrayValueOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace QInstaller - -#endif // ADDQTCREATORARRAYVALUEOPERATION_H diff --git a/src/libs/installer/init.cpp b/src/libs/installer/init.cpp index 97e00a54f..fcd14f3f2 100644 --- a/src/libs/installer/init.cpp +++ b/src/libs/installer/init.cpp @@ -57,8 +57,6 @@ // QtSDK specific #include "qtpatchoperation.h" #include "consumeoutputoperation.h" -#include "setqtcreatorvalueoperation.h" -#include "addqtcreatorarrayvalueoperation.h" #ifdef Q_OS_OSX # include "macreplaceinstallnamesoperation.h" @@ -235,8 +233,6 @@ void QInstaller::init() factory.registerUpdateOperation<SettingsOperation>(QLatin1String("Settings")); // QtSDK specific - factory.registerUpdateOperation<SetQtCreatorValueOperation>(QLatin1String("SetQtCreatorValue")); - factory.registerUpdateOperation<AddQtCreatorArrayValueOperation>(QLatin1String("AddQtCreatorArrayValue")); factory.registerUpdateOperation<QtPatchOperation>(QLatin1String("QtPatch")); FileDownloaderFactory::setFollowRedirects(true); diff --git a/src/libs/installer/installer.pro b/src/libs/installer/installer.pro index 445a2a05b..3e69b4e1b 100644 --- a/src/libs/installer/installer.pro +++ b/src/libs/installer/installer.pro @@ -55,8 +55,6 @@ HEADERS += packagemanagercore.h \ consumeoutputoperation.h \ replaceoperation.h \ linereplaceoperation.h \ - setqtcreatorvalueoperation.h \ - addqtcreatorarrayvalueoperation.h \ copydirectoryoperation.h \ simplemovefileoperation.h \ extractarchiveoperation.h \ @@ -81,7 +79,6 @@ HEADERS += packagemanagercore.h \ messageboxhandler.h \ licenseoperation.h \ component_p.h \ - qtcreator_constants.h \ qprocesswrapper.h \ qsettingswrapper.h \ constants.h \ @@ -142,8 +139,6 @@ SOURCES += packagemanagercore.cpp \ consumeoutputoperation.cpp \ replaceoperation.cpp \ linereplaceoperation.cpp \ - setqtcreatorvalueoperation.cpp \ - addqtcreatorarrayvalueoperation.cpp \ copydirectoryoperation.cpp \ simplemovefileoperation.cpp \ extractarchiveoperation.cpp \ diff --git a/src/libs/installer/qtcreator_constants.h b/src/libs/installer/qtcreator_constants.h deleted file mode 100644 index 51efd7525..000000000 --- a/src/libs/installer/qtcreator_constants.h +++ /dev/null @@ -1,62 +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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** 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. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef QTCREATOR_CONSTANTS_H -#define QTCREATOR_CONSTANTS_H - -// Begin - copied from Creator src\plugins\projectexplorer\toolchainmanager.cpp -static const char TOOLCHAIN_DATA_KEY[] = "ToolChain."; -static const char TOOLCHAIN_COUNT_KEY[] = "ToolChain.Count"; -static const char TOOLCHAIN_FILE_VERSION_KEY[] = "Version"; -static const char DEFAULT_DEBUGGER_COUNT_KEY[] = "DefaultDebugger.Count"; -static const char DEFAULT_DEBUGGER_ABI_KEY[] = "DefaultDebugger.Abi."; -static const char DEFAULT_DEBUGGER_PATH_KEY[] = "DefaultDebugger.Path."; - -static const char ID_KEY[] = "ProjectExplorer.ToolChain.Id"; -static const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ToolChain.DisplayName"; -// End - copied from Creator - -// Begin - copied from Creator src\plugins\qt4projectmanager\qtversionmanager.cpp -static const char QtVersionsSectionName[] = "QtVersions"; -static const char newQtVersionsKey[] = "NewQtVersions"; -// End - copied from Creator - -//the values for these keys are built in packagemanagercore->value() on the fly -//so it is possible that the installer creator can choose the location for these settings files -static const QLatin1String scQtCreatorInstallerSettingsFile("QtCreatorInstallerSettingsFile"); -static const QLatin1String scQtCreatorInstallerToolchainsFile("QtCreatorInstallerToolchainsFile"); -static const QLatin1String scQtCreatorInstallerQtVersionFile("QtCreatorInstallerQtVersionFile"); - - -#endif // QTCREATOR_CONSTANTS_H diff --git a/src/libs/installer/setqtcreatorvalueoperation.cpp b/src/libs/installer/setqtcreatorvalueoperation.cpp deleted file mode 100644 index cfa79c821..000000000 --- a/src/libs/installer/setqtcreatorvalueoperation.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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** 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. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#include "setqtcreatorvalueoperation.h" - -#include "qtcreator_constants.h" -#include "packagemanagercore.h" - -#include <QtCore/QSettings> -#include <QDebug> - -using namespace QInstaller; - -static QString groupName(const QString &groupName) -{ - return groupName == QLatin1String("General") ? QString() : groupName; -} - -SetQtCreatorValueOperation::SetQtCreatorValueOperation() -{ - setName(QLatin1String("SetQtCreatorValue")); -} - -void SetQtCreatorValueOperation::backup() -{ -} - -bool SetQtCreatorValueOperation::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("exactly 4"), tr(" (rootInstallPath, group, key, value)"))); - return false; - } - - PackageManagerCore *const core = value(QLatin1String("installer")).value<PackageManagerCore*>(); - if (!core) { - setError(UserDefinedError); - setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); - return false; - } - - const QString &rootInstallPath = args.at(0); //for example "C:\\Nokia_SDK\\" - if (!rootInstallPath.isEmpty()) { - qWarning() << QString::fromLatin1("Because of internal changes the first argument '%1' on '%2' "\ - "operation is just ignored, please be aware of that.").arg(rootInstallPath, name()); - } - - const QString &group = groupName(args.at(1)); - const QString &key = args.at(2); - const QString &settingsValue = args.at(3); - - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile); - if (qtCreatorInstallerSettingsFileName.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for '%1' on the installer object.").arg( - scQtCreatorInstallerSettingsFile)); - return false; - } - QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); - if (!group.isEmpty()) - settings.beginGroup(group); - - if (settingsValue.contains(QLatin1String(","))) // comma separated list of strings - settings.setValue(key, settingsValue.split(QRegExp(QLatin1String("\\s*,\\s*")), QString::SkipEmptyParts)); - else - settings.setValue(key, settingsValue); - - if (!group.isEmpty()) - settings.endGroup(); - - settings.sync(); //be safe ;) - - return true; -} - -bool SetQtCreatorValueOperation::undoOperation() -{ - const QStringList args = arguments(); - - const QString &rootInstallPath = args.at(0); //for example "C:\\Nokia_SDK\\" - if (!rootInstallPath.isEmpty()) { - qWarning() << QString::fromLatin1("Because of internal changes the first argument '%1' on '%2' "\ - "operation is just ignored, please be aware of that.").arg(rootInstallPath, name()); - } - - const QString &group = groupName(args.at(1)); - const QString &key = args.at(2); - - PackageManagerCore *const core = value(QLatin1String("installer")).value<PackageManagerCore*>(); - 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_OSX - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/QtProject/QtCreator.ini").arg( - core->value(QLatin1String("TargetDir")))); -#else - QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, - QString::fromLatin1("%1/QtCreator/share/qtcreator/QtProject/QtCreator.ini").arg(core->value( - QLatin1String("TargetDir")))); -#endif - - QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); - if (!group.isEmpty()) - settings.beginGroup(group); - - settings.remove(key); - - if (!group.isEmpty()) - settings.endGroup(); - - return true; -} - -bool SetQtCreatorValueOperation::testOperation() -{ - return true; -} - -Operation *SetQtCreatorValueOperation::clone() const -{ - return new SetQtCreatorValueOperation(); -} diff --git a/src/libs/installer/setqtcreatorvalueoperation.h b/src/libs/installer/setqtcreatorvalueoperation.h deleted file mode 100644 index 6639956f8..000000000 --- a/src/libs/installer/setqtcreatorvalueoperation.h +++ /dev/null @@ -1,56 +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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** 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. -** -** -** $QT_END_LICENSE$ -** -**************************************************************************/ - -#ifndef SETQTCREATORVALUEOPERATION_H -#define SETQTCREATORVALUEOPERATION_H - -#include "qinstallerglobal.h" - -namespace QInstaller { - -class SetQtCreatorValueOperation : public Operation -{ -public: - SetQtCreatorValueOperation(); - - void backup(); - bool performOperation(); - bool undoOperation(); - bool testOperation(); - Operation *clone() const; -}; - -} // namespace - -#endif // SETQTCREATORVALUEOPERATION_H |