2010-01-19 16:59:18 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2010-01-19 16:59:18 +01:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "userfileaccessor.h"
|
|
|
|
|
|
|
|
|
|
#include "buildconfiguration.h"
|
|
|
|
|
#include "persistentsettings.h"
|
|
|
|
|
#include "project.h"
|
2010-07-08 13:40:19 +02:00
|
|
|
#include "projectexplorer.h"
|
|
|
|
|
#include "projectexplorersettings.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "target.h"
|
2010-01-19 16:59:18 +01:00
|
|
|
#include "toolchain.h"
|
|
|
|
|
|
2010-05-19 15:17:12 +02:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <coreplugin/mainwindow.h>
|
2010-01-19 16:59:18 +01:00
|
|
|
#include <coreplugin/ifile.h>
|
|
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2010-05-19 15:17:12 +02:00
|
|
|
#include <QtGui/QApplication>
|
2010-01-19 16:59:18 +01:00
|
|
|
#include <QtCore/QFile>
|
2010-05-19 15:17:12 +02:00
|
|
|
#include <QtGui/QMessageBox>
|
|
|
|
|
#include <QtNetwork/QHostInfo>
|
2010-01-19 16:59:18 +01:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
|
|
|
|
namespace {
|
2010-05-19 15:17:12 +02:00
|
|
|
const char * const USER_FILE_VERSION = "ProjectExplorer.Project.Updater.FileVersion";
|
2010-07-08 13:40:19 +02:00
|
|
|
const char * const USER_FILE_ENVIRONMENT_ID = "ProjectExplorer.Project.Updater.EnvironmentId";
|
2010-05-19 15:17:12 +02:00
|
|
|
const char * const WAS_UPDATED = "ProjectExplorer.Project.Updater.DidUpdate";
|
2010-01-19 16:59:18 +01:00
|
|
|
const char * const PROJECT_FILE_POSTFIX(".user");
|
|
|
|
|
|
|
|
|
|
// Version 0 is used in Qt Creator 1.3.x and
|
2010-03-11 17:47:09 +01:00
|
|
|
// (in a slighly different flavour) post 1.3 master.
|
2010-01-19 16:59:18 +01:00
|
|
|
class Version0Handler : public UserFileVersionHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int userFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString displayUserFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String("1.3");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap update(Project *project, const QVariantMap &map);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QVariantMap convertBuildConfigurations(Project *project, const QVariantMap &map);
|
|
|
|
|
QVariantMap convertRunConfigurations(Project *project, const QVariantMap &map);
|
|
|
|
|
QVariantMap convertBuildSteps(Project *project, const QVariantMap &map);
|
|
|
|
|
};
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
// Version 1 is used in master post Qt Creator 1.3.x.
|
|
|
|
|
// It was never used in any official release but is required for the
|
|
|
|
|
// transition to later versions (which introduce support for targets).
|
|
|
|
|
class Version1Handler : public UserFileVersionHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int userFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString displayUserFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String("1.3+git");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap update(Project *project, const QVariantMap &map);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct TargetDescription
|
|
|
|
|
{
|
|
|
|
|
TargetDescription(QString tid, QString dn) :
|
|
|
|
|
id(tid),
|
|
|
|
|
displayName(dn)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TargetDescription(const TargetDescription &td) :
|
|
|
|
|
id(td.id),
|
|
|
|
|
displayName(td.displayName)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString id;
|
|
|
|
|
QString displayName;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
// Version 2 is used in master post Qt Creator 2.0 alpha.
|
|
|
|
|
class Version2Handler : public UserFileVersionHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int userFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString displayUserFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String("2.0-alpha+git");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap update(Project *project, const QVariantMap &map);
|
|
|
|
|
};
|
|
|
|
|
|
2010-03-24 13:33:54 +01:00
|
|
|
// Version 3 reflect the move of symbian signing from run to build step.
|
|
|
|
|
class Version3Handler : public UserFileVersionHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int userFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString displayUserFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String("2.0-alpha2+git");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap update(Project *project, const QVariantMap &map);
|
|
|
|
|
};
|
|
|
|
|
|
2010-07-06 17:56:01 +02:00
|
|
|
// Version 4 reflects the introduction of deploy steps
|
|
|
|
|
class Version4Handler : public UserFileVersionHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int userFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString displayUserFileVersion() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String("2.2pre1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap update(Project *project, const QVariantMap &map);
|
|
|
|
|
};
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
//
|
|
|
|
|
// Helper functions:
|
|
|
|
|
//
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
static QString fileNameFor(const QString &name)
|
|
|
|
|
{
|
2010-02-03 12:49:32 +01:00
|
|
|
QString baseName(name);
|
|
|
|
|
QString environmentExtension(QString::fromLocal8Bit(qgetenv("QTC_EXTENSION")));
|
|
|
|
|
if (!environmentExtension.isEmpty()) {
|
|
|
|
|
// replace fishy characters:
|
|
|
|
|
environmentExtension = environmentExtension.replace(QRegExp("[^a-zA-Z0-9_.-]"), QChar('_'));
|
|
|
|
|
|
|
|
|
|
if (!environmentExtension.startsWith('.'))
|
|
|
|
|
environmentExtension = environmentExtension.prepend(QLatin1Char('.'));
|
|
|
|
|
return baseName + environmentExtension;
|
|
|
|
|
}
|
|
|
|
|
return baseName + QLatin1String(PROJECT_FILE_POSTFIX);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-19 16:59:18 +01:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// UserFileVersionHandler
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
UserFileVersionHandler::UserFileVersionHandler()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UserFileVersionHandler::~UserFileVersionHandler()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
/**
|
|
|
|
|
* Performs a simple renaming of the listed keys in \a changes recursively on \a map.
|
|
|
|
|
*/
|
|
|
|
|
QVariantMap UserFileVersionHandler::renameKeys(const QList<Change> &changes, QVariantMap map)
|
|
|
|
|
{
|
|
|
|
|
foreach (const Change &change, changes) {
|
|
|
|
|
QVariantMap::iterator oldSetting = map.find(change.first);
|
|
|
|
|
if (oldSetting != map.end()) {
|
|
|
|
|
map.insert(change.second, oldSetting.value());
|
|
|
|
|
map.erase(oldSetting);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap::iterator i = map.begin();
|
|
|
|
|
while (i != map.end()) {
|
|
|
|
|
QVariant v = i.value();
|
|
|
|
|
if (v.type() == QVariant::Map)
|
|
|
|
|
i.value() = renameKeys(changes, v.toMap());
|
|
|
|
|
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-19 16:59:18 +01:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// UserFileAccessor
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
UserFileAccessor::UserFileAccessor() :
|
|
|
|
|
m_firstVersion(-1),
|
|
|
|
|
m_lastVersion(-1)
|
|
|
|
|
{
|
|
|
|
|
addVersionHandler(new Version0Handler);
|
2010-02-08 15:50:06 +01:00
|
|
|
addVersionHandler(new Version1Handler);
|
2010-03-11 17:47:09 +01:00
|
|
|
addVersionHandler(new Version2Handler);
|
2010-03-24 13:33:54 +01:00
|
|
|
addVersionHandler(new Version3Handler);
|
2010-07-06 17:56:01 +02:00
|
|
|
addVersionHandler(new Version4Handler);
|
2010-01-19 16:59:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UserFileAccessor::~UserFileAccessor()
|
|
|
|
|
{
|
|
|
|
|
qDeleteAll(m_handlers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap UserFileAccessor::restoreSettings(Project *project)
|
|
|
|
|
{
|
|
|
|
|
if (m_lastVersion < 0 || !project)
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
|
2010-05-19 15:17:12 +02:00
|
|
|
QString fileName = fileNameFor(project->file()->fileName());
|
2010-02-18 18:35:40 +01:00
|
|
|
if (!QFile::exists(fileName))
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
|
|
|
|
|
PersistentSettingsReader reader;
|
2010-01-19 16:59:18 +01:00
|
|
|
reader.load(fileName);
|
|
|
|
|
|
|
|
|
|
QVariantMap map(reader.restoreValues());
|
|
|
|
|
|
|
|
|
|
// Get and verify file version:
|
2010-05-19 15:17:12 +02:00
|
|
|
const int fileVersion = map.value(QLatin1String(USER_FILE_VERSION), 0).toInt();
|
2010-01-19 16:59:18 +01:00
|
|
|
if (fileVersion < m_firstVersion || fileVersion > m_lastVersion + 1) {
|
|
|
|
|
qWarning() << "File version" << fileVersion << "is not supported.";
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-08 13:40:19 +02:00
|
|
|
// Verify environment Id:
|
|
|
|
|
QUuid fileEnvironmentId(map.value(QLatin1String(USER_FILE_ENVIRONMENT_ID)).toString());
|
|
|
|
|
if (!fileEnvironmentId.isNull()
|
|
|
|
|
&& fileEnvironmentId != ProjectExplorerPlugin::instance()->projectExplorerSettings().environmentId) {
|
2010-05-19 15:17:12 +02:00
|
|
|
// TODO tr, casing check
|
|
|
|
|
QMessageBox msgBox(QMessageBox::Question,
|
|
|
|
|
QApplication::translate("ProjectExplorer::UserFileAccessor",
|
2010-07-08 13:40:19 +02:00
|
|
|
"Project Settings File from a different Environment?"),
|
2010-05-19 15:17:12 +02:00
|
|
|
QApplication::translate("ProjectExplorer::UserFileAccessor",
|
2010-07-08 13:40:19 +02:00
|
|
|
"Qt Creator has found a .user settings file which was "
|
|
|
|
|
"created for another development setup, maybe "
|
|
|
|
|
"originating from another machine.\n\n"
|
|
|
|
|
"The .user settings files contain environment specific "
|
|
|
|
|
"settings. They should not be copied to a different "
|
|
|
|
|
"environment. \n\n"
|
|
|
|
|
"Do you still want to load the settings file?"),
|
2010-05-19 15:17:12 +02:00
|
|
|
QMessageBox::Yes | QMessageBox::No,
|
|
|
|
|
Core::ICore::instance()->mainWindow());
|
|
|
|
|
msgBox.setDefaultButton(QMessageBox::No);
|
|
|
|
|
msgBox.setEscapeButton(QMessageBox::No);
|
|
|
|
|
int result = msgBox.exec();
|
|
|
|
|
if (result == QMessageBox::No)
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
// Do we need to do a update?
|
|
|
|
|
if (fileVersion != m_lastVersion + 1) {
|
|
|
|
|
map.insert(QLatin1String(WAS_UPDATED), true);
|
2010-03-12 12:23:57 +01:00
|
|
|
const QString backupFileName = fileName + '.' + m_handlers.value(fileVersion)->displayUserFileVersion();
|
|
|
|
|
QFile::remove(backupFileName); // Remove because copy doesn't overwrite
|
|
|
|
|
QFile::copy(fileName, backupFileName);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
2010-01-19 16:59:18 +01:00
|
|
|
|
|
|
|
|
// Update:
|
|
|
|
|
for (int i = fileVersion; i <= m_lastVersion; ++i)
|
|
|
|
|
map = m_handlers.value(i)->update(project, map);
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
map.insert(QLatin1String(USER_FILE_VERSION), m_lastVersion + 1);
|
|
|
|
|
|
2010-01-19 16:59:18 +01:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UserFileAccessor::saveSettings(Project *project, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!project || map.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
PersistentSettingsWriter writer;
|
|
|
|
|
|
|
|
|
|
for (QVariantMap::const_iterator i = map.constBegin(); i != map.constEnd(); ++i)
|
|
|
|
|
writer.saveValue(i.key(), i.value());
|
|
|
|
|
|
|
|
|
|
writer.saveValue(QLatin1String(USER_FILE_VERSION), m_lastVersion + 1);
|
2010-07-08 13:40:19 +02:00
|
|
|
writer.saveValue(QLatin1String(USER_FILE_ENVIRONMENT_ID),
|
|
|
|
|
ProjectExplorerPlugin::instance()->projectExplorerSettings().environmentId.toString());
|
2010-01-19 16:59:18 +01:00
|
|
|
|
2010-02-03 12:49:32 +01:00
|
|
|
return writer.save(fileNameFor(project->file()->fileName()), "QtCreatorProject");
|
2010-01-19 16:59:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UserFileAccessor::addVersionHandler(UserFileVersionHandler *handler)
|
|
|
|
|
{
|
|
|
|
|
const int version(handler->userFileVersion());
|
|
|
|
|
QTC_ASSERT(handler, return);
|
|
|
|
|
QTC_ASSERT(version >= 0, return);
|
|
|
|
|
QTC_ASSERT(!m_handlers.contains(version), return);
|
|
|
|
|
QTC_ASSERT(m_handlers.isEmpty() ||
|
|
|
|
|
(version == m_lastVersion + 1 || version == m_firstVersion - 1), return);
|
|
|
|
|
|
|
|
|
|
if (m_handlers.isEmpty()) {
|
|
|
|
|
m_firstVersion = version;
|
|
|
|
|
m_lastVersion = version;
|
|
|
|
|
} else {
|
|
|
|
|
if (version < m_firstVersion)
|
|
|
|
|
m_firstVersion = version;
|
|
|
|
|
if (version > m_lastVersion)
|
|
|
|
|
m_lastVersion = version;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_handlers.insert(version, handler);
|
|
|
|
|
|
|
|
|
|
// Postconditions:
|
|
|
|
|
Q_ASSERT(m_lastVersion >= 0);
|
|
|
|
|
Q_ASSERT(m_firstVersion >= 0);
|
|
|
|
|
Q_ASSERT(m_lastVersion >= m_firstVersion);
|
|
|
|
|
Q_ASSERT(m_handlers.count() == m_lastVersion - m_firstVersion + 1);
|
|
|
|
|
for (int i = m_firstVersion; i < m_lastVersion; ++i)
|
|
|
|
|
Q_ASSERT(m_handlers.contains(i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Version0Handler
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
QVariantMap Version0Handler::convertBuildConfigurations(Project *project, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT(project);
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
|
|
|
|
|
// Find a valid Id to use:
|
|
|
|
|
QString id;
|
|
|
|
|
if (project->id() == QLatin1String("GenericProjectManager.GenericProject"))
|
|
|
|
|
id = QLatin1String("GenericProjectManager.GenericBuildConfiguration");
|
|
|
|
|
else if (project->id() == QLatin1String("CMakeProjectManager.CMakeProject"))
|
|
|
|
|
id = QLatin1String("CMakeProjectManager.CMakeBuildConfiguration");
|
|
|
|
|
else if (project->id() == QLatin1String("Qt4ProjectManager.Qt4Project"))
|
|
|
|
|
id = QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration");
|
|
|
|
|
else
|
|
|
|
|
return QVariantMap(); // QmlProjects do not(/no longer) have BuildConfigurations,
|
|
|
|
|
// or we do not know how to handle this.
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), id);
|
|
|
|
|
|
|
|
|
|
for (QVariantMap::const_iterator i = map.constBegin(); i != map.constEnd(); ++i) {
|
|
|
|
|
if (i.key() == QLatin1String("ProjectExplorer.BuildConfiguration.DisplayName")) {
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName"),
|
|
|
|
|
i.value());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (id == QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration") ||
|
|
|
|
|
id.startsWith(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration."))) {
|
|
|
|
|
// Qt4BuildConfiguration:
|
|
|
|
|
if (i.key() == QLatin1String("QtVersionId")) {
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId"),
|
|
|
|
|
i.value().toInt());
|
|
|
|
|
} else if (i.key() == QLatin1String("ToolChain")) {
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.ToolChain"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (i.key() == QLatin1String("buildConfiguration")) {
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (i.key() == QLatin1String("userEnvironmentChanges")) {
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.UserEnvironmentChanges"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (i.key() == QLatin1String("useShadowBuild")) {
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (i.key() == QLatin1String("clearSystemEnvironment")) {
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.ClearSystemEnvironment"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (i.key() == QLatin1String("buildDirectory")) {
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else {
|
|
|
|
|
qWarning() << "Unknown Qt4BuildConfiguration Key found:" << i.key() << i.value();
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
} else if (id == QLatin1String("CMakeProjectManager.CMakeBuildConfiguration")) {
|
|
|
|
|
if (i.key() == QLatin1String("userEnvironmentChanges")) {
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.UserEnvironmentChanges"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (i.key() == QLatin1String("msvcVersion")) {
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.MsvcVersion"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (i.key() == QLatin1String("buildDirectory")) {
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else {
|
|
|
|
|
qWarning() << "Unknown CMakeBuildConfiguration Key found:" << i.key() << i.value();
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
} else if (id == QLatin1String("GenericProjectManager.GenericBuildConfiguration")) {
|
|
|
|
|
if (i.key() == QLatin1String("buildDirectory")) {
|
|
|
|
|
result.insert(QLatin1String("GenericProjectManager.GenericBuildConfiguration.BuildDirectory"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else {
|
|
|
|
|
qWarning() << "Unknown GenericBuildConfiguration Key found:" << i.key() << i.value();
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
qWarning() << "Unknown BuildConfiguration Key found:" << i.key() << i.value();
|
|
|
|
|
qWarning() << "BuildConfiguration Id is:" << id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap Version0Handler::convertRunConfigurations(Project *project, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(project);
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
QString id;
|
|
|
|
|
|
|
|
|
|
// Convert Id:
|
|
|
|
|
id = map.value(QLatin1String("Id")).toString();
|
|
|
|
|
if (id.isEmpty())
|
|
|
|
|
id = map.value(QLatin1String("type")).toString();
|
|
|
|
|
if (id.isEmpty())
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
|
|
|
|
|
if (QLatin1String("Qt4ProjectManager.DeviceRunConfiguration") == id)
|
|
|
|
|
id = QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration");
|
|
|
|
|
if (QLatin1String("Qt4ProjectManager.EmulatorRunConfiguration") == id)
|
|
|
|
|
id = QLatin1String("Qt4ProjectManager.S60EmulatorRunConfiguration");
|
|
|
|
|
// no need to change the CMakeRunConfiguration, CustomExecutableRunConfiguration,
|
|
|
|
|
// MaemoRunConfiguration or Qt4RunConfiguration
|
|
|
|
|
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), id);
|
|
|
|
|
|
|
|
|
|
// Convert everything else:
|
|
|
|
|
for (QVariantMap::const_iterator i = map.constBegin(); i != map.constEnd(); ++i) {
|
|
|
|
|
if (i.key() == QLatin1String("Id") || i.key() == QLatin1String("type"))
|
|
|
|
|
continue;
|
|
|
|
|
if (i.key() == QLatin1String("RunConfiguration.name")) {
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName"),
|
|
|
|
|
i.value());
|
|
|
|
|
} else if (QLatin1String("CMakeProjectManager.CMakeRunConfiguration") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("CMakeRunConfiguration.Target"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeRunConfiguration.Target"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CMakeRunConfiguration.WorkingDirectory"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeRunConfiguration.WorkingDirectory"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CMakeRunConfiguration.UserWorkingDirectory"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CMakeRunConfiguration.UseTerminal"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeRunConfiguration.UseTerminal"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CMakeRunConfiguation.Title"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeRunConfiguation.Title"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CMakeRunConfiguration.Arguments"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeRunConfiguration.Arguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CMakeRunConfiguration.UserEnvironmentChanges"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.CMakeRunConfiguration.UserEnvironmentChanges"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("BaseEnvironmentBase"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.BaseEnvironmentBase"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown CMakeRunConfiguration key found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("ProFile"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.ProFile"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("SigningMode"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.SigningMode"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CustomSignaturePath"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CustomSignaturePath"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CustomKeyPath"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CustomKeyPath"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("SerialPortName"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.SerialPortName"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CommunicationType"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CommunicationType"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CommandLineArguments"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CommandLineArguments"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown S60DeviceRunConfiguration key found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("Qt4ProjectManager.S60EmulatorRunConfiguration") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("ProFile"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.S60EmulatorRunConfiguration.ProFile"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown S60EmulatorRunConfiguration key found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("Qt4ProjectManager.Qt4RunConfiguration") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("ProFile"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.ProFile"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("CommandLineArguments"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UserSetName"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.UserSetName"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UseTerminal"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UseDyldImageSuffix"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UserEnvironmentChanges"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("BaseEnvironmentBase"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UserSetWorkingDirectory"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UserWorkingDirectory"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown Qt4RunConfiguration key found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("Qt4ProjectManager.MaemoRunConfiguration") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("ProFile"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.ProFile"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("Arguments"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.Arguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("Simulator"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.Simulator"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("DeviceId"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.DeviceId"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("LastDeployed"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.LastDeployed"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("DebuggingHelpersLastDeployed"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.DebuggingHelpersLastDeployed"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown MaemoRunConfiguration key found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("Executable"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.Executable"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("Arguments"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.Arguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("WorkingDirectory"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UseTerminal"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UserSetName"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.UserSetName"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UserName"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.UserName"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("UserEnvironmentChanges"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("BaseEnvironmentBase"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown CustomExecutableRunConfiguration key found:" << i.key() << i.value();
|
|
|
|
|
} else {
|
|
|
|
|
result.insert(i.key(), i.value());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap Version0Handler::convertBuildSteps(Project *project, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(project);
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
|
|
|
|
|
QString id(map.value(QLatin1String("Id")).toString());
|
|
|
|
|
if (QLatin1String("GenericProjectManager.MakeStep") == id)
|
|
|
|
|
id = QLatin1String("GenericProjectManager.GenericMakeStep");
|
|
|
|
|
if (QLatin1String("projectexplorer.processstep") == id)
|
|
|
|
|
id = QLatin1String("ProjectExplorer.ProcessStep");
|
|
|
|
|
if (QLatin1String("trolltech.qt4projectmanager.make") == id)
|
|
|
|
|
id = QLatin1String("Qt4ProjectManager.MakeStep");
|
|
|
|
|
if (QLatin1String("trolltech.qt4projectmanager.qmake") == id)
|
|
|
|
|
id = QLatin1String("QtProjectManager.QMakeBuildStep");
|
|
|
|
|
// No need to change the CMake MakeStep.
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), id);
|
|
|
|
|
|
|
|
|
|
for (QVariantMap::const_iterator i = map.constBegin(); i != map.constEnd(); ++i) {
|
|
|
|
|
if (i.key() == QLatin1String("Id"))
|
|
|
|
|
continue;
|
|
|
|
|
if (i.key() == QLatin1String("ProjectExplorer.BuildConfiguration.DisplayName")) {
|
|
|
|
|
// skip this: Not needed.
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (QLatin1String("GenericProjectManager.GenericMakeStep") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("buildTargets"))
|
|
|
|
|
result.insert(QLatin1String("GenericProjectManager.GenericMakeStep.BuildTargets"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("makeArguments"))
|
|
|
|
|
result.insert(QLatin1String("GenericProjectManager.GenericMakeStep.MakeArguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("makeCommand"))
|
|
|
|
|
result.insert(QLatin1String("GenericProjectManager.GenericMakeStep.MakeCommand"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown GenericMakeStep value found:" << i.key() << i.value();
|
|
|
|
|
continue;
|
|
|
|
|
} else if (QLatin1String("ProjectExplorer.ProcessStep") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("ProjectExplorer.ProcessStep.DisplayName"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("abstractProcess.command"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProcessStep.Command"), i.value());
|
|
|
|
|
else if ((i.key() == QLatin1String("abstractProcess.workingDirectory") ||
|
|
|
|
|
i.key() == QLatin1String("workingDirectory")) &&
|
|
|
|
|
!i.value().toString().isEmpty())
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProcessStep.WorkingDirectory"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("abstractProcess.arguments"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProcessStep.Arguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("abstractProcess.enabled"))
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.ProcessStep.Enabled"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown ProcessStep value found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("Qt4ProjectManager.MakeStep") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("makeargs"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MakeStep.MakeArguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("makeCmd"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MakeStep.MakeCommand"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("clean"))
|
|
|
|
|
result.insert(QLatin1String("Qt4ProjectManager.MakeStep.Clean"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown Qt4MakeStep value found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("QtProjectManager.QMakeBuildStep") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("qmakeArgs"))
|
|
|
|
|
result.insert(QLatin1String("QtProjectManager.QMakeBuildStep.QMakeArguments"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown Qt4QMakeStep value found:" << i.key() << i.value();
|
|
|
|
|
} else if (QLatin1String("CMakeProjectManager.MakeStep") == id) {
|
|
|
|
|
if (i.key() == QLatin1String("buildTargets"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.MakeStep.BuildTargets"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("additionalArguments"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.MakeStep.AdditionalArguments"), i.value());
|
|
|
|
|
else if (i.key() == QLatin1String("clean"))
|
|
|
|
|
result.insert(QLatin1String("CMakeProjectManager.MakeStep.Clean"), i.value());
|
|
|
|
|
else
|
|
|
|
|
qWarning() << "Unknown CMakeMakeStep value found:" << i.key() << i.value();
|
|
|
|
|
} else {
|
|
|
|
|
result.insert(i.key(), i.value());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap Version0Handler::update(Project *project, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
|
|
|
|
|
// "project": section is unused, just ignore it.
|
|
|
|
|
|
|
|
|
|
// "buildconfigurations" and "buildConfiguration-":
|
|
|
|
|
QStringList bcs(map.value(QLatin1String("buildconfigurations")).toStringList());
|
|
|
|
|
QString active(map.value(QLatin1String("activebuildconfiguration")).toString());
|
|
|
|
|
|
|
|
|
|
int count(0);
|
|
|
|
|
foreach (const QString &bc, bcs) {
|
|
|
|
|
// convert buildconfiguration:
|
|
|
|
|
QString oldBcKey(QString::fromLatin1("buildConfiguration-") + bc);
|
|
|
|
|
if (bc == active)
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.Project.ActiveBuildConfiguration"), count);
|
|
|
|
|
|
|
|
|
|
QVariantMap tmp(map.value(oldBcKey).toMap());
|
|
|
|
|
QVariantMap bcMap(convertBuildConfigurations(project, tmp));
|
|
|
|
|
if (bcMap.isEmpty())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
// buildsteps
|
|
|
|
|
QStringList buildSteps(map.value(oldBcKey + QLatin1String("-buildsteps")).toStringList());
|
2010-02-01 16:13:40 +01:00
|
|
|
|
|
|
|
|
if (buildSteps.isEmpty())
|
|
|
|
|
// try lowercase version, too:-(
|
|
|
|
|
buildSteps = map.value(QString::fromLatin1("buildconfiguration-") + bc + QLatin1String("-buildsteps")).toStringList();
|
2010-01-19 16:59:18 +01:00
|
|
|
if (buildSteps.isEmpty())
|
2010-02-01 16:13:40 +01:00
|
|
|
buildSteps = map.value(QLatin1String("buildsteps")).toStringList();
|
2010-01-19 16:59:18 +01:00
|
|
|
|
|
|
|
|
int pos(0);
|
|
|
|
|
foreach (const QString &bs, buildSteps) {
|
|
|
|
|
// Watch out: Capitalization differs from oldBcKey!
|
|
|
|
|
const QString localKey(QLatin1String("buildconfiguration-") + bc + QString::fromLatin1("-buildstep") + QString::number(pos));
|
|
|
|
|
const QString globalKey(QString::fromLatin1("buildstep") + QString::number(pos));
|
|
|
|
|
|
|
|
|
|
QVariantMap local(map.value(localKey).toMap());
|
|
|
|
|
QVariantMap global(map.value(globalKey).toMap());
|
|
|
|
|
|
|
|
|
|
for (QVariantMap::const_iterator i = global.constBegin(); i != global.constEnd(); ++i) {
|
|
|
|
|
if (!local.contains(i.key()))
|
|
|
|
|
local.insert(i.key(), i.value());
|
|
|
|
|
if (i.key() == QLatin1String("ProjectExplorer.BuildConfiguration.DisplayName") &&
|
|
|
|
|
local.value(i.key()).toString().isEmpty())
|
|
|
|
|
local.insert(i.key(), i.value());
|
|
|
|
|
}
|
|
|
|
|
local.insert(QLatin1String("Id"), bs);
|
|
|
|
|
|
|
|
|
|
bcMap.insert(QString::fromLatin1("ProjectExplorer.BuildConfiguration.BuildStep.") + QString::number(pos),
|
|
|
|
|
convertBuildSteps(project, local));
|
|
|
|
|
++pos;
|
|
|
|
|
}
|
|
|
|
|
bcMap.insert(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepsCount"), pos);
|
|
|
|
|
|
|
|
|
|
// cleansteps
|
|
|
|
|
QStringList cleanSteps(map.value(oldBcKey + QLatin1String("-cleansteps")).toStringList());
|
|
|
|
|
if (cleanSteps.isEmpty())
|
2010-02-01 16:13:40 +01:00
|
|
|
// try lowercase version, too:-(
|
|
|
|
|
cleanSteps = map.value(QString::fromLatin1("buildconfiguration-") + bc + QLatin1String("-cleansteps")).toStringList();
|
|
|
|
|
if (cleanSteps.isEmpty())
|
|
|
|
|
cleanSteps = map.value(QLatin1String("cleansteps")).toStringList();
|
2010-01-19 16:59:18 +01:00
|
|
|
|
|
|
|
|
pos = 0;
|
|
|
|
|
foreach (const QString &bs, cleanSteps) {
|
|
|
|
|
// Watch out: Capitalization differs from oldBcKey!
|
|
|
|
|
const QString localKey(QLatin1String("buildconfiguration-") + bc + QString::fromLatin1("-cleanstep") + QString::number(pos));
|
|
|
|
|
const QString globalKey(QString::fromLatin1("cleanstep") + QString::number(pos));
|
|
|
|
|
|
|
|
|
|
QVariantMap local(map.value(localKey).toMap());
|
|
|
|
|
QVariantMap global(map.value(globalKey).toMap());
|
|
|
|
|
|
|
|
|
|
for (QVariantMap::const_iterator i = global.constBegin(); i != global.constEnd(); ++i) {
|
|
|
|
|
if (!local.contains(i.key()))
|
|
|
|
|
local.insert(i.key(), i.value());
|
|
|
|
|
if (i.key() == QLatin1String("ProjectExplorer.BuildConfiguration.DisplayName") &&
|
|
|
|
|
local.value(i.key()).toString().isEmpty())
|
|
|
|
|
local.insert(i.key(), i.value());
|
|
|
|
|
}
|
|
|
|
|
local.insert(QLatin1String("Id"), bs);
|
|
|
|
|
bcMap.insert(QString::fromLatin1("ProjectExplorer.BuildConfiguration.CleanStep.") + QString::number(pos),
|
|
|
|
|
convertBuildSteps(project, local));
|
|
|
|
|
++pos;
|
|
|
|
|
}
|
|
|
|
|
bcMap.insert(QLatin1String("ProjectExplorer.BuildConfiguration.CleanStepsCount"), pos);
|
|
|
|
|
|
|
|
|
|
// Merge into result set:
|
|
|
|
|
result.insert(QString::fromLatin1("ProjectExplorer.Project.BuildConfiguration.") + QString::number(count), bcMap);
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.Project.BuildConfigurationCount"), count);
|
|
|
|
|
|
|
|
|
|
// "RunConfiguration*":
|
|
|
|
|
active = map.value(QLatin1String("activeRunConfiguration")).toString();
|
|
|
|
|
count = 0;
|
|
|
|
|
forever {
|
|
|
|
|
QString prefix(QLatin1String("RunConfiguration") + QString::number(count) + '-');
|
|
|
|
|
QVariantMap rcMap;
|
|
|
|
|
for (QVariantMap::const_iterator i = map.constBegin(); i != map.constEnd(); ++i) {
|
|
|
|
|
if (!i.key().startsWith(prefix))
|
|
|
|
|
continue;
|
|
|
|
|
QString newKey(i.key().mid(prefix.size()));
|
|
|
|
|
rcMap.insert(newKey, i.value());
|
|
|
|
|
}
|
|
|
|
|
if (rcMap.isEmpty()) {
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.Project.RunConfigurationCount"), count);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.insert(QString::fromLatin1("ProjectExplorer.Project.RunConfiguration.") + QString::number(count),
|
|
|
|
|
convertRunConfigurations(project, rcMap));
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// "defaultFileEncoding" (EditorSettings):
|
|
|
|
|
QVariant codecVariant(map.value(QLatin1String("defaultFileEncoding")));
|
|
|
|
|
if (codecVariant.isValid()) {
|
|
|
|
|
QByteArray codec(codecVariant.toByteArray());
|
|
|
|
|
QVariantMap editorSettingsMap;
|
|
|
|
|
editorSettingsMap.insert(QLatin1String("EditorConfiguration.Codec"), codec);
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.Project.EditorSettings"),
|
|
|
|
|
editorSettingsMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant toolchain(map.value("toolChain"));
|
|
|
|
|
if (toolchain.isValid()) {
|
|
|
|
|
bool ok;
|
|
|
|
|
int type(toolchain.toInt(&ok));
|
|
|
|
|
if (!ok) {
|
|
|
|
|
QString toolChainName(toolchain.toString());
|
|
|
|
|
if (toolChainName == QLatin1String("gcc"))
|
|
|
|
|
type = ToolChain::GCC;
|
|
|
|
|
else if (toolChainName == QLatin1String("mingw"))
|
|
|
|
|
type = ToolChain::MinGW;
|
|
|
|
|
else if (toolChainName == QLatin1String("msvc"))
|
|
|
|
|
type = ToolChain::MSVC;
|
|
|
|
|
else if (toolChainName == QLatin1String("wince"))
|
|
|
|
|
type = ToolChain::WINCE;
|
|
|
|
|
}
|
|
|
|
|
result.insert(QLatin1String("GenericProjectManager.GenericProject.Toolchain"), type);
|
|
|
|
|
}
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Version1Handler
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
QVariantMap Version1Handler::update(Project *project, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
|
|
|
|
|
// The only difference between version 1 and 2 of the user file is that
|
|
|
|
|
// we need to add targets.
|
|
|
|
|
|
|
|
|
|
// Generate a list of all possible targets for the project:
|
|
|
|
|
QList<TargetDescription> targets;
|
|
|
|
|
if (project->id() == QLatin1String("GenericProjectManager.GenericProject"))
|
|
|
|
|
targets << TargetDescription(QString::fromLatin1("GenericProjectManager.GenericTarget"),
|
|
|
|
|
QCoreApplication::translate("GenericProjectManager::GenericTarget",
|
|
|
|
|
"Desktop",
|
|
|
|
|
"Generic desktop target display name"));
|
|
|
|
|
else if (project->id() == QLatin1String("CMakeProjectManager.CMakeProject"))
|
|
|
|
|
targets << TargetDescription(QString::fromLatin1("CMakeProjectManager.DefaultCMakeTarget"),
|
|
|
|
|
QCoreApplication::translate("CMakeProjectManager::Internal::CMakeTarget",
|
|
|
|
|
"Desktop",
|
|
|
|
|
"CMake Default target display name"));
|
|
|
|
|
else if (project->id() == QLatin1String("Qt4ProjectManager.Qt4Project"))
|
|
|
|
|
targets << TargetDescription(QString::fromLatin1("Qt4ProjectManager.Target.DesktopTarget"),
|
|
|
|
|
QCoreApplication::translate("Qt4ProjectManager::Internal::Qt4Target",
|
|
|
|
|
"Desktop",
|
|
|
|
|
"Qt4 Desktop target display name"))
|
|
|
|
|
<< TargetDescription(QString::fromLatin1("Qt4ProjectManager.Target.S60EmulatorTarget"),
|
|
|
|
|
QCoreApplication::translate("Qt4ProjectManager::Internal::Qt4Target",
|
2010-02-10 12:16:01 +01:00
|
|
|
"Symbian Emulator",
|
|
|
|
|
"Qt4 Symbian Emulator target display name"))
|
2010-02-08 15:50:06 +01:00
|
|
|
<< TargetDescription(QString::fromLatin1("Qt4ProjectManager.Target.S60DeviceTarget"),
|
|
|
|
|
QCoreApplication::translate("Qt4ProjectManager::Internal::Qt4Target",
|
2010-02-10 12:16:01 +01:00
|
|
|
"Symbian Device",
|
|
|
|
|
"Qt4 Symbian Device target display name"))
|
2010-02-08 15:50:06 +01:00
|
|
|
<< TargetDescription(QString::fromLatin1("Qt4ProjectManager.Target.MaemoEmulatorTarget"),
|
|
|
|
|
QCoreApplication::translate("Qt4ProjectManager::Internal::Qt4Target",
|
|
|
|
|
"Maemo Emulator",
|
|
|
|
|
"Qt4 Maemo Emulator target display name"))
|
|
|
|
|
<< TargetDescription(QString::fromLatin1("Qt4ProjectManager.Target.MaemoDeviceTarget"),
|
|
|
|
|
QCoreApplication::translate("Qt4ProjectManager::Internal::Qt4Target",
|
|
|
|
|
"Maemo Device",
|
|
|
|
|
"Qt4 Maemo Device target display name"));
|
|
|
|
|
else if (project->id() == QLatin1String("QmlProjectManager.QmlProject"))
|
|
|
|
|
targets << TargetDescription(QString::fromLatin1("QmlProjectManager.QmlTarget"),
|
|
|
|
|
QCoreApplication::translate("QmlProjectManager::QmlTarget",
|
2010-05-20 11:59:42 +02:00
|
|
|
"QML Viewer",
|
|
|
|
|
"QML Viewer target display name"));
|
2010-02-08 15:50:06 +01:00
|
|
|
else
|
|
|
|
|
return QVariantMap(); // We do not know how to handle this.
|
|
|
|
|
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.Project.ActiveTarget"), 0);
|
|
|
|
|
result.insert(QLatin1String("ProjectExplorer.Project.TargetCount"), targets.count());
|
|
|
|
|
int pos(0);
|
|
|
|
|
foreach (const TargetDescription &td, targets) {
|
|
|
|
|
QVariantMap targetMap;
|
|
|
|
|
// Do not set displayName or icon!
|
|
|
|
|
targetMap.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), td.id);
|
|
|
|
|
|
|
|
|
|
int count = map.value(QLatin1String("ProjectExplorer.Project.BuildConfigurationCount")).toInt();
|
|
|
|
|
targetMap.insert(QLatin1String("ProjectExplorer.Target.BuildConfigurationCount"), count);
|
|
|
|
|
for (int i = 0; i < count; ++i) {
|
|
|
|
|
QString key(QString::fromLatin1("ProjectExplorer.Project.BuildConfiguration.") + QString::number(i));
|
|
|
|
|
if (map.contains(key))
|
|
|
|
|
targetMap.insert(QString::fromLatin1("ProjectExplorer.Target.BuildConfiguration.") + QString::number(i),
|
|
|
|
|
map.value(key));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
count = map.value(QLatin1String("ProjectExplorer.Project.RunConfigurationCount")).toInt();
|
|
|
|
|
for (int i = 0; i < count; ++i) {
|
|
|
|
|
QString key(QString::fromLatin1("ProjectExplorer.Project.RunConfiguration.") + QString::number(i));
|
|
|
|
|
if (map.contains(key))
|
|
|
|
|
targetMap.insert(QString::fromLatin1("ProjectExplorer.Target.RunConfiguration.") + QString::number(i),
|
|
|
|
|
map.value(key));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (map.contains(QLatin1String("ProjectExplorer.Project.ActiveBuildConfiguration")))
|
|
|
|
|
targetMap.insert(QLatin1String("ProjectExplorer.Target.ActiveBuildConfiguration"),
|
|
|
|
|
map.value(QLatin1String("ProjectExplorer.Project.ActiveBuildConfiguration")));
|
|
|
|
|
if (map.contains(QLatin1String("ProjectExplorer.Project.ActiveRunConfiguration")))
|
|
|
|
|
targetMap.insert(QLatin1String("ProjectExplorer.Target.ActiveRunConfiguration"),
|
|
|
|
|
map.value(QLatin1String("ProjectExplorer.Project.ActiveRunConfiguration")));
|
|
|
|
|
if (map.contains(QLatin1String("ProjectExplorer.Project.RunConfigurationCount")))
|
|
|
|
|
targetMap.insert(QLatin1String("ProjectExplorer.Target.RunConfigurationCount"),
|
|
|
|
|
map.value(QLatin1String("ProjectExplorer.Project.RunConfigurationCount")));
|
|
|
|
|
|
|
|
|
|
result.insert(QString::fromLatin1("ProjectExplorer.Project.Target.") + QString::number(pos), targetMap);
|
|
|
|
|
++pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// copy everything else:
|
|
|
|
|
for (QVariantMap::const_iterator i = map.constBegin(); i != map.constEnd(); ++i) {
|
|
|
|
|
if (i.key() == QLatin1String("ProjectExplorer.Project.ActiveBuildConfiguration") ||
|
|
|
|
|
i.key() == QLatin1String("ProjectExplorer.Project.BuildConfigurationCount") ||
|
|
|
|
|
i.key() == QLatin1String("ProjectExplorer.Project.ActiveRunConfiguration") ||
|
|
|
|
|
i.key() == QLatin1String("ProjectExplorer.Project.RunConfigurationCount") ||
|
|
|
|
|
i.key().startsWith(QLatin1String("ProjectExplorer.Project.BuildConfiguration.")) ||
|
|
|
|
|
i.key().startsWith(QLatin1String("ProjectExplorer.Project.RunConfiguration.")))
|
|
|
|
|
continue;
|
|
|
|
|
result.insert(i.key(), i.value());
|
|
|
|
|
}
|
2010-01-19 16:59:18 +01:00
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2010-03-11 17:47:09 +01:00
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Version2Handler
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
QVariantMap Version2Handler::update(Project *, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
QList<Change> changes;
|
|
|
|
|
changes.append(qMakePair(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.UserEnvironmentChanges"),
|
|
|
|
|
QLatin1String("ProjectExplorer.BuildConfiguration.UserEnvironmentChanges")));
|
|
|
|
|
changes.append(qMakePair(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.ClearSystemEnvironment"),
|
|
|
|
|
QLatin1String("ProjectExplorer.BuildConfiguration.ClearSystemEnvironment")));
|
|
|
|
|
changes.append(qMakePair(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.UserEnvironmentChanges"),
|
|
|
|
|
QLatin1String("ProjectExplorer.BuildConfiguration.UserEnvironmentChanges")));
|
|
|
|
|
changes.append(qMakePair(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.ClearSystemEnvironment"),
|
|
|
|
|
QLatin1String("ProjectExplorer.BuildConfiguration.ClearSystemEnvironment")));
|
|
|
|
|
|
|
|
|
|
return renameKeys(changes, QVariantMap(map));
|
|
|
|
|
}
|
2010-03-24 13:33:54 +01:00
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Version3Handler
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// insert the additional build step:
|
|
|
|
|
//<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
|
|
|
|
|
// <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Create sis Package</value>
|
|
|
|
|
// <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.S60SignBuildStep</value>
|
|
|
|
|
// <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
|
|
|
|
|
// <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
|
|
|
|
|
// <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60CreatePackageStep.Certificate" type="QString"></value>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60CreatePackageStep.Keyfile" type="QString"></value>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60CreatePackageStep.SignMode" type="int">0</value>
|
|
|
|
|
//</valuemap>
|
|
|
|
|
|
|
|
|
|
// remove the deprecated sign run settings from
|
|
|
|
|
//<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
|
|
|
|
|
// <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">untitled1 on Symbian Device</value>
|
|
|
|
|
// <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.S60DeviceRunConfiguration</value>
|
|
|
|
|
// <valuelist key="Qt4ProjectManager.S60DeviceRunConfiguration.CommandLineArguments" type="QVariantList"/>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60DeviceRunConfiguration.CustomKeyPath" type="QString"></value>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60DeviceRunConfiguration.CustomSignaturePath" type="QString"></value>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60DeviceRunConfiguration.ProFile" type="QString">untitled1.pro</value>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60DeviceRunConfiguration.SerialPortName" type="QString">COM3</value>
|
|
|
|
|
// <value key="Qt4ProjectManager.S60DeviceRunConfiguration.SigningMode" type="int">0</value>
|
|
|
|
|
//</valuemap>
|
|
|
|
|
|
|
|
|
|
QVariantMap Version3Handler::update(Project *, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
QMapIterator<QString, QVariant> it(map);
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
it.next();
|
|
|
|
|
const QString &targetKey = it.key();
|
|
|
|
|
// check for target info
|
|
|
|
|
if (!targetKey.startsWith(QLatin1String("ProjectExplorer.Project.Target."))) {
|
|
|
|
|
result.insert(targetKey, it.value());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
const QVariantMap &originalTarget = it.value().toMap();
|
|
|
|
|
// check for symbian device target
|
|
|
|
|
if (originalTarget.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"))
|
|
|
|
|
!= QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget")) {
|
|
|
|
|
result.insert(targetKey, originalTarget);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
QVariantMap newTarget;
|
|
|
|
|
// first iteration: search run configurations, get signing info, remove old signing keys
|
|
|
|
|
QString customKeyPath;
|
|
|
|
|
QString customSignaturePath;
|
|
|
|
|
int signingMode;
|
|
|
|
|
QMapIterator<QString, QVariant> targetIt(originalTarget);
|
|
|
|
|
while (targetIt.hasNext()) {
|
|
|
|
|
targetIt.next();
|
|
|
|
|
const QString &key = targetIt.key();
|
|
|
|
|
if (key.startsWith(QLatin1String("ProjectExplorer.Target.BuildConfiguration."))) {
|
|
|
|
|
// build configurations are handled in second iteration
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (!key.startsWith(QLatin1String("ProjectExplorer.Target.RunConfiguration."))) {
|
|
|
|
|
newTarget.insert(key, targetIt.value());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
QVariantMap runConfig = targetIt.value().toMap();
|
|
|
|
|
if (runConfig.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"))
|
|
|
|
|
!= QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration")) {
|
|
|
|
|
newTarget.insert(key, runConfig);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// get signing info
|
|
|
|
|
customKeyPath = runConfig.value(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CustomKeyPath")).toString();
|
|
|
|
|
customSignaturePath = runConfig.value(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CustomSignaturePath")).toString();
|
|
|
|
|
signingMode = runConfig.value(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.SigningMode")).toInt();
|
|
|
|
|
// remove old signing keys
|
|
|
|
|
runConfig.remove(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CustomKeyPath"));
|
|
|
|
|
runConfig.remove(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.CustomSignaturePath"));
|
|
|
|
|
runConfig.remove(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.SigningMode"));
|
|
|
|
|
newTarget.insert(key, runConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// second iteration: add new signing build step
|
|
|
|
|
targetIt.toFront();
|
|
|
|
|
while (targetIt.hasNext()) {
|
|
|
|
|
targetIt.next();
|
|
|
|
|
const QString &key = targetIt.key();
|
|
|
|
|
if (!key.startsWith(QLatin1String("ProjectExplorer.Target.BuildConfiguration."))) {
|
|
|
|
|
// everything except build configs already handled
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
QVariantMap buildConfig = targetIt.value().toMap();
|
|
|
|
|
int stepCount = buildConfig.value(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepsCount")).toInt();
|
|
|
|
|
QVariantMap signBuildStep;
|
|
|
|
|
signBuildStep.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName"), QLatin1String("Create sis package"));
|
|
|
|
|
signBuildStep.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), QLatin1String("Qt4ProjectManager.S60SignBuildStep"));
|
|
|
|
|
signBuildStep.insert(QLatin1String("Qt4ProjectManager.MakeStep.Clean"), false);
|
|
|
|
|
signBuildStep.insert(QLatin1String("Qt4ProjectManager.S60CreatePackageStep.Certificate"), customSignaturePath);
|
|
|
|
|
signBuildStep.insert(QLatin1String("Qt4ProjectManager.S60CreatePackageStep.Keyfile"), customKeyPath);
|
|
|
|
|
signBuildStep.insert(QLatin1String("Qt4ProjectManager.S60CreatePackageStep.SignMode"), signingMode);
|
|
|
|
|
buildConfig.insert(QString::fromLatin1("ProjectExplorer.BuildConfiguration.BuildStep.%1").arg(stepCount), signBuildStep);
|
|
|
|
|
buildConfig.insert(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepsCount"), stepCount + 1);
|
|
|
|
|
newTarget.insert(key, buildConfig);
|
|
|
|
|
}
|
|
|
|
|
result.insert(targetKey, newTarget);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2010-07-06 17:56:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Version4Handler
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// Move packaging steps from build steps into deploy steps
|
|
|
|
|
QVariantMap Version4Handler::update(Project *, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
QVariantMap result;
|
|
|
|
|
QMapIterator<QString, QVariant> it(map);
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
it.next();
|
|
|
|
|
const QString &globalKey = it.key();
|
|
|
|
|
// check for target info
|
|
|
|
|
if (!globalKey.startsWith(QLatin1String("ProjectExplorer.Project.Target."))) {
|
|
|
|
|
result.insert(globalKey, it.value());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
const QVariantMap &originalTarget = it.value().toMap();
|
|
|
|
|
// check for symbian and maemo device target
|
|
|
|
|
if (originalTarget.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"))
|
|
|
|
|
!= QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget")
|
|
|
|
|
&& originalTarget.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"))
|
|
|
|
|
!= QLatin1String("Qt4ProjectManager.Target.MaemoDeviceTarget"))
|
|
|
|
|
{
|
|
|
|
|
result.insert(globalKey, originalTarget);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap newTarget;
|
|
|
|
|
QMapIterator<QString, QVariant> targetIt(originalTarget);
|
|
|
|
|
while (targetIt.hasNext()) {
|
|
|
|
|
targetIt.next();
|
|
|
|
|
const QString &targetKey = targetIt.key();
|
|
|
|
|
if (!targetKey.startsWith(QLatin1String("ProjectExplorer.Target.BuildConfiguration."))) {
|
|
|
|
|
newTarget.insert(targetKey, targetIt.value());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool movedBs = false;
|
|
|
|
|
const QVariantMap &originalBc = targetIt.value().toMap();
|
|
|
|
|
QVariantMap newBc;
|
|
|
|
|
QMapIterator<QString, QVariant> bcIt(originalBc);
|
|
|
|
|
while(bcIt.hasNext()) {
|
|
|
|
|
bcIt.next();
|
|
|
|
|
const QString &bcKey = bcIt.key();
|
|
|
|
|
if (!bcKey.startsWith(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStep."))) {
|
|
|
|
|
newBc.insert(bcKey, bcIt.value());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QVariantMap &buildStep = bcIt.value().toMap();
|
|
|
|
|
if ((buildStep.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString() ==
|
|
|
|
|
QLatin1String("Qt4ProjectManager.S60SignBuildStep"))
|
|
|
|
|
|| (buildStep.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString() ==
|
|
|
|
|
QLatin1String("Qt4ProjectManager.MaemoPackageCreationStep"))) {
|
|
|
|
|
movedBs = true;
|
|
|
|
|
newBc.insert(QLatin1String("ProjectExplorer.BuildConfiguration.DeployStep.0"), buildStep);
|
|
|
|
|
} else {
|
|
|
|
|
newBc.insert(bcKey, buildStep);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (movedBs) {
|
|
|
|
|
// adjust counts:
|
|
|
|
|
newBc.insert(QLatin1String("ProjectExplorer.BuildConfiguration.DeployStepsCount"), 1);
|
|
|
|
|
newBc.insert(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepsCount"),
|
|
|
|
|
newBc.value(QLatin1String("ProjectExplorer.BuildConfiguration.BuildStepsCount")).toInt() - 1);
|
|
|
|
|
}
|
|
|
|
|
newTarget.insert(targetKey, newBc);
|
|
|
|
|
}
|
|
|
|
|
result.insert(globalKey, newTarget);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|