Commit 0ff8e646 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QtSupport: Additional parameter for QtVersion::restore().

This enables a QtVersionFactory to be able to create more than one
QtVersion, which can make sense e.g. if there are several closely
related ones.

Change-Id: I597f524abfc27c483c71bb6567ce7b77bc3d3041
Reviewed-on: http://codereview.qt.nokia.com/835

Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 930dbd6c
......@@ -58,8 +58,10 @@ bool DesktopQtVersionFactory::canRestore(const QString &type)
return type == QLatin1String(QtSupport::Constants::DESKTOPQT);
}
QtSupport::BaseQtVersion *DesktopQtVersionFactory::restore(const QVariantMap &data)
QtSupport::BaseQtVersion *DesktopQtVersionFactory::restore(const QString &type, const QVariantMap &data)
{
if (!canRestore(type))
return 0;
DesktopQtVersion *v = new DesktopQtVersion;
v->fromMap(data);
return v;
......
......@@ -45,7 +45,7 @@ public:
~DesktopQtVersionFactory();
virtual bool canRestore(const QString &type);
virtual QtSupport::BaseQtVersion *restore(const QVariantMap &data);
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString());
......
......@@ -58,8 +58,10 @@ bool SimulatorQtVersionFactory::canRestore(const QString &type)
return type == QLatin1String(QtSupport::Constants::SIMULATORQT);
}
QtSupport::BaseQtVersion *SimulatorQtVersionFactory::restore(const QVariantMap &data)
QtSupport::BaseQtVersion *SimulatorQtVersionFactory::restore(const QString &type, const QVariantMap &data)
{
if (!canRestore(type))
return 0;
QtSupport::BaseQtVersion *v = new SimulatorQtVersion;
v->fromMap(data);
return v;
......
......@@ -45,7 +45,7 @@ public:
~SimulatorQtVersionFactory();
virtual bool canRestore(const QString &type);
virtual QtSupport::BaseQtVersion *restore(const QVariantMap &data);
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString());
......
......@@ -59,8 +59,10 @@ bool SymbianQtVersionFactory::canRestore(const QString &type)
return type == QLatin1String(QtSupport::Constants::SYMBIANQT);
}
QtSupport::BaseQtVersion *SymbianQtVersionFactory::restore(const QVariantMap &data)
QtSupport::BaseQtVersion *SymbianQtVersionFactory::restore(const QString &type, const QVariantMap &data)
{
if (!canRestore(type))
return 0;
SymbianQtVersion *v = new SymbianQtVersion;
v->fromMap(data);
return v;
......
......@@ -45,7 +45,7 @@ public:
~SymbianQtVersionFactory();
virtual bool canRestore(const QString &type);
virtual QtSupport::BaseQtVersion *restore(const QVariantMap &data);
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString());
......
......@@ -55,8 +55,10 @@ bool WinCeQtVersionFactory::canRestore(const QString &type)
return type == QLatin1String(QtSupport::Constants::WINCEQT);
}
QtSupport::BaseQtVersion *WinCeQtVersionFactory::restore(const QVariantMap &data)
QtSupport::BaseQtVersion *WinCeQtVersionFactory::restore(const QString &type, const QVariantMap &data)
{
if (!canRestore(type))
return 0;
WinCeQtVersion *v = new WinCeQtVersion;
v->fromMap(data);
return v;
......
......@@ -44,7 +44,7 @@ public:
~WinCeQtVersionFactory();
virtual bool canRestore(const QString &type);
virtual QtSupport::BaseQtVersion *restore(const QVariantMap &data);
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
virtual int priority() const;
......
......@@ -49,7 +49,7 @@ public:
~QtVersionFactory();
virtual bool canRestore(const QString &type) = 0;
virtual BaseQtVersion *restore(const QVariantMap &data) = 0;
virtual BaseQtVersion *restore(const QString &type, const QVariantMap &data) = 0;
/// factories with higher priority are asked first to identify
/// a qtversion, the priority of the desktop factory is 0 and
......
......@@ -176,7 +176,7 @@ bool QtVersionManager::restoreQtVersions()
bool restored = false;
foreach (QtVersionFactory *f, factories) {
if (f->canRestore(type)) {
if (BaseQtVersion *qtv = f->restore(qtversionMap)) {
if (BaseQtVersion *qtv = f->restore(type, qtversionMap)) {
if (m_versions.contains(qtv->uniqueId())) {
// This shouldn't happen, we are restoring the same id multiple times?
qWarning() << "A Qt version with id"<<qtv->uniqueId()<<"already exists";
......@@ -292,7 +292,7 @@ void QtVersionManager::updateFromInstaller()
removeVersion(v);
qtversionMap[QLatin1String("Id")] = id;
if (BaseQtVersion *qtv = factory->restore(qtversionMap)) {
if (BaseQtVersion *qtv = factory->restore(type, qtversionMap)) {
Q_ASSERT(qtv->isAutodetected());
addVersion(qtv);
restored = true;
......@@ -303,7 +303,7 @@ void QtVersionManager::updateFromInstaller()
if (!restored) { // didn't replace any existing versions
if (debug)
qDebug() << " No Qt version found matching" << autoDetectionSource << " => Creating new version";
if (BaseQtVersion *qtv = factory->restore(qtversionMap)) {
if (BaseQtVersion *qtv = factory->restore(type, qtversionMap)) {
Q_ASSERT(qtv->isAutodetected());
addVersion(qtv);
restored = true;
......
......@@ -35,6 +35,7 @@
#include "maemoqtversion.h"
#include <qtsupport/qtsupportconstants.h>
#include <utils/qtcassert.h>
#include <QtCore/QFileInfo>
......@@ -57,8 +58,10 @@ bool MaemoQtVersionFactory::canRestore(const QString &type)
return type == QLatin1String(QtSupport::Constants::MAEMOQT);
}
QtSupport::BaseQtVersion *MaemoQtVersionFactory::restore(const QVariantMap &data)
QtSupport::BaseQtVersion *MaemoQtVersionFactory::restore(const QString &type,
const QVariantMap &data)
{
QTC_ASSERT(canRestore(type), return 0);
MaemoQtVersion *v = new MaemoQtVersion;
v->fromMap(data);
return v;
......
......@@ -45,7 +45,7 @@ public:
~MaemoQtVersionFactory();
virtual bool canRestore(const QString &type);
virtual QtSupport::BaseQtVersion *restore(const QVariantMap &data);
virtual QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
virtual int priority() const;
virtual QtSupport::BaseQtVersion *create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment