diff options
author | Tim Jenssen <tim.jenssen@nokia.com> | 2012-05-24 17:10:58 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2012-05-25 09:03:49 +0200 |
commit | b62f1ab053b5ed26b8e883481c6dae5561fad7b6 (patch) | |
tree | e576da3f6e266633cb9516c79a6027c13df4db0c /src/libs/installer | |
parent | fb396036ccf3a0fd75d57c68e1e301b291245371 (diff) |
add a fallback for alreadys installed installations
Change-Id: Ib7dd955cb89e307d557b7a4706a885c031d6289f
Reviewed-by: Alexander Lenhardt <alexander.lenhardt@nokia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com>
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/addqtcreatorarrayvalueoperation.cpp | 20 | ||||
-rw-r--r-- | src/libs/installer/registerdefaultdebuggeroperation.cpp | 14 | ||||
-rw-r--r-- | src/libs/installer/registerqtoperation.cpp | 18 | ||||
-rw-r--r-- | src/libs/installer/registerqtv23operation.cpp | 12 | ||||
-rw-r--r-- | src/libs/installer/registerqtv2operation.cpp | 13 | ||||
-rw-r--r-- | src/libs/installer/registerqtvqnxoperation.cpp | 12 | ||||
-rw-r--r-- | src/libs/installer/registertoolchainoperation.cpp | 14 | ||||
-rw-r--r-- | src/libs/installer/setqtcreatorvalueoperation.cpp | 24 | ||||
-rw-r--r-- | src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp | 10 |
9 files changed, 109 insertions, 28 deletions
diff --git a/src/libs/installer/addqtcreatorarrayvalueoperation.cpp b/src/libs/installer/addqtcreatorarrayvalueoperation.cpp index 8c1ead997..43520b7b3 100644 --- a/src/libs/installer/addqtcreatorarrayvalueoperation.cpp +++ b/src/libs/installer/addqtcreatorarrayvalueoperation.cpp @@ -71,14 +71,16 @@ bool AddQtCreatorArrayValueOperation::performOperation() setErrorString(tr("Needed installer object in %1 operation is empty.").arg(name())); return false; } - if (core->value(scQtCreatorInstallerSettingsFile).isEmpty()) { + + 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(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); + QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); const QString &group = groupName(args.at(0)); const QString &arrayName = args.at(1); @@ -127,7 +129,19 @@ bool AddQtCreatorArrayValueOperation::undoOperation() setErrorString(tr("Needed installer object in %1 operation is empty.").arg(name())); return false; } - QSettings settings(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); + + // default value is the old value to keep the possibility that old saved operations can run undo +#ifdef Q_OS_MAC + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/QtCreator.ini").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/QtCreator.ini").arg(core->value( + QLatin1String("TargetDir")))); +#endif + + QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); const QString &group = groupName(args.at(0)); const QString &arrayName = args.at(1); diff --git a/src/libs/installer/registerdefaultdebuggeroperation.cpp b/src/libs/installer/registerdefaultdebuggeroperation.cpp index b9a790757..3b8c97250 100644 --- a/src/libs/installer/registerdefaultdebuggeroperation.cpp +++ b/src/libs/installer/registerdefaultdebuggeroperation.cpp @@ -130,15 +130,23 @@ bool RegisterDefaultDebuggerOperation::undoOperation() return false; } - QString toolChainsXmlFilePath; - PackageManagerCore *const core = qVariantValue<PackageManagerCore *>(value(QLatin1String("installer"))); if (!core) { setError(UserDefinedError); setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); return false; } - toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); + + // 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/Nokia/toolChains.xml").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/toolChains.xml").arg(core->value( + QLatin1String("TargetDir")))); +#endif int argCounter = 0; const QString &abiString = args.at(argCounter++); //for example x86-windows-msys-pe-32bit diff --git a/src/libs/installer/registerqtoperation.cpp b/src/libs/installer/registerqtoperation.cpp index e8f073470..ba5083be6 100644 --- a/src/libs/installer/registerqtoperation.cpp +++ b/src/libs/installer/registerqtoperation.cpp @@ -90,13 +90,14 @@ bool RegisterQtInCreatorOperation::performOperation() setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); return false; } - if (core->value(scQtCreatorInstallerToolchainsFile).isEmpty()) { + + QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); + if (toolChainsXmlFilePath.isEmpty()) { setError(UserDefinedError); setErrorString(tr("There is no value set for %1 on the installer object.").arg( scQtCreatorInstallerToolchainsFile)); return false; } - QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); bool isCreator22 = false; //in case of the fake installer this component doesn't exist Component *creatorComponent = @@ -215,7 +216,18 @@ bool RegisterQtInCreatorOperation::undoOperation() return false; } - QSettings settings(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); + // default value is the old value to keep the possibility that old saved operations can run undo +#ifdef Q_OS_MAC + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/QtCreator.ini").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/QtCreator.ini").arg(core->value( + QLatin1String("TargetDir")))); +#endif + + QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); const QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions")).toString() .split(QLatin1String(";")); diff --git a/src/libs/installer/registerqtv23operation.cpp b/src/libs/installer/registerqtv23operation.cpp index 4b966a8a5..fc3720c2c 100644 --- a/src/libs/installer/registerqtv23operation.cpp +++ b/src/libs/installer/registerqtv23operation.cpp @@ -181,7 +181,17 @@ bool RegisterQtInCreatorV23Operation::undoOperation() setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); return false; } - const QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile); + + // default value is the old value to keep the possibility that old saved operations can run undo +#ifdef Q_OS_MAC + QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile, + QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/qtversion.xml").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/qtversion.xml").arg(core->value( + QLatin1String("TargetDir")))); +#endif ProjectExplorer::PersistentSettingsReader reader; // If no file, then it has been removed already diff --git a/src/libs/installer/registerqtv2operation.cpp b/src/libs/installer/registerqtv2operation.cpp index 618fbd83f..63d484a9a 100644 --- a/src/libs/installer/registerqtv2operation.cpp +++ b/src/libs/installer/registerqtv2operation.cpp @@ -161,7 +161,18 @@ bool RegisterQtInCreatorV2Operation::undoOperation() } qmakePath = QDir::toNativeSeparators(qmakePath); - QSettings settings(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); + // default value is the old value to keep the possibility that old saved operations can run undo +#ifdef Q_OS_MAC + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/QtCreator.ini").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/QtCreator.ini").arg(core->value( + QLatin1String("TargetDir")))); +#endif + + QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); QString newVersions; QStringList oldNewQtVersions = settings.value(QLatin1String("NewQtVersions") diff --git a/src/libs/installer/registerqtvqnxoperation.cpp b/src/libs/installer/registerqtvqnxoperation.cpp index 1b0a6ab68..1cce3c7dc 100644 --- a/src/libs/installer/registerqtvqnxoperation.cpp +++ b/src/libs/installer/registerqtvqnxoperation.cpp @@ -183,7 +183,17 @@ bool RegisterQtInCreatorQNXOperation::undoOperation() setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); return false; } - const QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile); + + // default value is the old value to keep the possibility that old saved operations can run undo +#ifdef Q_OS_MAC + QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile, + QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/qtversion.xml").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString qtVersionsFileName = core->value(scQtCreatorInstallerQtVersionFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/qtversion.xml").arg(core->value( + QLatin1String("TargetDir")))); +#endif ProjectExplorer::PersistentSettingsReader reader; // If no file, then it has been removed already diff --git a/src/libs/installer/registertoolchainoperation.cpp b/src/libs/installer/registertoolchainoperation.cpp index ff088c04a..414f8ba14 100644 --- a/src/libs/installer/registertoolchainoperation.cpp +++ b/src/libs/installer/registertoolchainoperation.cpp @@ -127,15 +127,23 @@ bool RegisterToolChainOperation::undoOperation() return false; } - QString toolChainsXmlFilePath; - PackageManagerCore *const core = qVariantValue<PackageManagerCore*>(value(QLatin1String("installer"))); if (!core) { setError(UserDefinedError); setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); return false; } - toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); + + // 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/Nokia/toolChains.xml").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/toolChains.xml").arg(core->value( + QLatin1String("TargetDir")))); +#endif QtCreatorToolChain toolChain; diff --git a/src/libs/installer/setqtcreatorvalueoperation.cpp b/src/libs/installer/setqtcreatorvalueoperation.cpp index dc5e6fd0a..d1fb074d1 100644 --- a/src/libs/installer/setqtcreatorvalueoperation.cpp +++ b/src/libs/installer/setqtcreatorvalueoperation.cpp @@ -83,13 +83,14 @@ bool SetQtCreatorValueOperation::performOperation() const QString &key = args.at(2); const QString &settingsValue = args.at(3); { - if (core->value(scQtCreatorInstallerSettingsFile).isEmpty()) { + 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(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); + QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); if (!group.isEmpty()) settings.beginGroup(group); @@ -143,13 +144,18 @@ bool SetQtCreatorValueOperation::undoOperation() return false; } - if (core->value(scQtCreatorInstallerSettingsFile).isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("There is no value set for %1 on the installer object.").arg( - scQtCreatorInstallerSettingsFile)); - return false; - } - QSettings settings(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); + // default value is the old value to keep the possibility that old saved operations can run undo +#ifdef Q_OS_MAC + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/Qt Creator.app/Contents/Resources/Nokia/QtCreator.ini").arg( + core->value(QLatin1String("TargetDir")))); +#else + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile, + QString::fromLatin1("%1/QtCreator/share/qtcreator/Nokia/QtCreator.ini").arg(core->value( + QLatin1String("TargetDir")))); +#endif + + QSettings settings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); if (!group.isEmpty()) settings.beginGroup(group); diff --git a/src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp b/src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp index 9172f2b89..289ef404e 100644 --- a/src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp +++ b/src/libs/installer/updatecreatorsettingsfrom21to22operation.cpp @@ -288,20 +288,22 @@ bool UpdateCreatorSettingsFrom21To22Operation::performOperation() return false; } - if (core->value(scQtCreatorInstallerToolchainsFile).isEmpty()) { + QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); + if (toolChainsXmlFilePath.isEmpty()) { setError(UserDefinedError); setErrorString(tr("There is no value set for %1 on the installer object.").arg( scQtCreatorInstallerToolchainsFile)); return false; } - QString toolChainsXmlFilePath = core->value(scQtCreatorInstallerToolchainsFile); - if (core->value(scQtCreatorInstallerSettingsFile).isEmpty()) { + + QString qtCreatorInstallerSettingsFileName = core->value(scQtCreatorInstallerSettingsFile); + if (qtCreatorInstallerSettingsFileName.isEmpty()) { setError(UserDefinedError); setErrorString(tr("There is no value set for %1 on the installer object.").arg( scQtCreatorInstallerSettingsFile)); return false; } - QSettings sdkSettings(core->value(scQtCreatorInstallerSettingsFile), QSettings::IniFormat); + QSettings sdkSettings(qtCreatorInstallerSettingsFileName, QSettings::IniFormat); convertDefaultGDBInstallerSettings(sdkSettings, core); |