forked from qt-creator/qt-creator
WinRt: Split WinRtQtVersionFactory
... to get a 1:1 relation with produced Qt versions. This looks wasteful right now, but will be simplified in follow-up patches. Change-Id: I6bb1c087751cc6acdd0293410c02e1656da36050 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
@@ -48,6 +48,7 @@ class WinRtPluginRunData
|
|||||||
public:
|
public:
|
||||||
WinRtRunConfigurationFactory runConfigFactory;
|
WinRtRunConfigurationFactory runConfigFactory;
|
||||||
WinRtQtVersionFactory qtVersionFactory;
|
WinRtQtVersionFactory qtVersionFactory;
|
||||||
|
WinRtPhoneQtVersionFactory phoneQtVersionFactory;
|
||||||
WinRtAppDeployConfigurationFactory appDeployConfigFactory;
|
WinRtAppDeployConfigurationFactory appDeployConfigFactory;
|
||||||
WinRtPhoneDeployConfigurationFactory phoneDeployConfigFactory;
|
WinRtPhoneDeployConfigurationFactory phoneDeployConfigFactory;
|
||||||
WinRtEmulatorDeployConfigurationFactory emulatorDeployFactory;
|
WinRtEmulatorDeployConfigurationFactory emulatorDeployFactory;
|
||||||
|
@@ -46,8 +46,7 @@ WinRtQtVersionFactory::~WinRtQtVersionFactory()
|
|||||||
|
|
||||||
bool WinRtQtVersionFactory::canRestore(const QString &type)
|
bool WinRtQtVersionFactory::canRestore(const QString &type)
|
||||||
{
|
{
|
||||||
return type == QLatin1String(Constants::WINRT_WINRTQT)
|
return type == QLatin1String(Constants::WINRT_WINRTQT);
|
||||||
|| type == QLatin1String(Constants::WINRT_WINPHONEQT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtSupport::BaseQtVersion *WinRtQtVersionFactory::restore(const QString &type,
|
QtSupport::BaseQtVersion *WinRtQtVersionFactory::restore(const QString &type,
|
||||||
@@ -55,11 +54,7 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::restore(const QString &type,
|
|||||||
{
|
{
|
||||||
if (!canRestore(type))
|
if (!canRestore(type))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
WinRtQtVersion *v = nullptr;
|
WinRtQtVersion *v = new WinRtQtVersion;
|
||||||
if (type == QLatin1String(Constants::WINRT_WINPHONEQT))
|
|
||||||
v = new WinRtPhoneQtVersion;
|
|
||||||
else
|
|
||||||
v = new WinRtQtVersion;
|
|
||||||
v->fromMap(data);
|
v->fromMap(data);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@@ -76,23 +71,54 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &q
|
|||||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
bool isWinRt = false;
|
|
||||||
bool isPhone = false;
|
|
||||||
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
|
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
|
||||||
if (value == QStringLiteral("winrt")) {
|
if (value == QStringLiteral("winrt"))
|
||||||
isWinRt = true;
|
return new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
} else if (value == QStringLiteral("winphone")) {
|
|
||||||
isWinRt = true;
|
|
||||||
isPhone = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isWinRt)
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WinRtPhoneQtVersionFactory::WinRtPhoneQtVersionFactory(QObject *parent)
|
||||||
|
: QtSupport::QtVersionFactory(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WinRtPhoneQtVersionFactory::canRestore(const QString &type)
|
||||||
|
{
|
||||||
|
return type == QLatin1String(Constants::WINRT_WINPHONEQT);
|
||||||
|
}
|
||||||
|
|
||||||
|
QtSupport::BaseQtVersion *WinRtPhoneQtVersionFactory::restore(const QString &type,
|
||||||
|
const QVariantMap &data)
|
||||||
|
{
|
||||||
|
if (!canRestore(type))
|
||||||
|
return nullptr;
|
||||||
|
WinRtQtVersion *v = new WinRtPhoneQtVersion;
|
||||||
|
v->fromMap(data);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WinRtPhoneQtVersionFactory::priority() const
|
||||||
|
{
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
QtSupport::BaseQtVersion *WinRtPhoneQtVersionFactory::create(const Utils::FileName &qmakePath,
|
||||||
|
ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
|
||||||
|
{
|
||||||
|
QFileInfo fi = qmakePath.toFileInfo();
|
||||||
|
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return isPhone ? new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource)
|
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
|
||||||
: new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
if (value == QStringLiteral("winphone"))
|
||||||
|
return new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
@@ -44,5 +44,18 @@ public:
|
|||||||
bool isAutoDetected = false, const QString &autoDetectionSource = QString());
|
bool isAutoDetected = false, const QString &autoDetectionSource = QString());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WinRtPhoneQtVersionFactory : public QtSupport::QtVersionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit WinRtPhoneQtVersionFactory(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
bool canRestore(const QString &type);
|
||||||
|
QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data);
|
||||||
|
|
||||||
|
int priority() const;
|
||||||
|
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator,
|
||||||
|
bool isAutoDetected = false, const QString &autoDetectionSource = QString());
|
||||||
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // WinRt
|
} // WinRt
|
||||||
|
Reference in New Issue
Block a user