Commit 28c22a1d authored by dt's avatar dt
Browse files

Make TargetSetupDialog fast for Maemo

Task-Nr: QTCREATORBUG-4880
parent 38fc5adb
......@@ -145,9 +145,9 @@ public:
}
}
private:
static bool isValidMaemoQtVersion(const QString &qmakePath,
MaemoDeviceConfig::OsVersion maemoVersion);
private:
static QString madAdminCommand(const QString &qmakePath);
static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath,
const QString &command, const QStringList &args, bool useTarget);
......
......@@ -48,7 +48,9 @@ MaemoQtVersion::MaemoQtVersion()
}
MaemoQtVersion::MaemoQtVersion(const QString &path, bool isAutodetected, const QString &autodetectionSource)
: BaseQtVersion(path, isAutodetected, autodetectionSource)
: BaseQtVersion(path, isAutodetected, autodetectionSource),
m_osVersion(MaemoGlobal::version(path)),
m_isvalidVersion(MaemoGlobal::isValidMaemoQtVersion(path, m_osVersion))
{
}
......@@ -58,6 +60,14 @@ MaemoQtVersion::~MaemoQtVersion()
}
void MaemoQtVersion::fromMap(const QVariantMap &map)
{
BaseQtVersion::fromMap(map);
QString path = qmakeCommand();
m_osVersion = MaemoGlobal::version(path);
m_isvalidVersion = MaemoGlobal::isValidMaemoQtVersion(path, m_osVersion);
}
QString MaemoQtVersion::type() const
{
return Constants::MAEMOQT;
......@@ -93,16 +103,18 @@ QString MaemoQtVersion::systemRoot() const
QList<ProjectExplorer::Abi> MaemoQtVersion::qtAbis() const
{
QList<ProjectExplorer::Abi> result;
if (MaemoGlobal::isValidMaemo5QtVersion(qmakeCommand())) {
if (!m_isvalidVersion)
return result;
if (m_osVersion == MaemoDeviceConfig::Maemo5) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
32));
} else if (MaemoGlobal::isValidHarmattanQtVersion(qmakeCommand())) {
} else if (m_osVersion == MaemoDeviceConfig::Maemo6) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::HarmattanLinuxFlavor,
ProjectExplorer::Abi::ElfFormat,
32));
} else if (MaemoGlobal::isValidMeegoQtVersion(qmakeCommand())) {
} else if (m_osVersion == MaemoDeviceConfig::Meego) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MeegoLinuxFlavor,
ProjectExplorer::Abi::ElfFormat, 32));
......@@ -118,11 +130,13 @@ bool MaemoQtVersion::supportsTargetId(const QString &id) const
QSet<QString> MaemoQtVersion::supportedTargetIds() const
{
QSet<QString> result;
if (MaemoGlobal::isValidMaemo5QtVersion(qmakeCommand())) {
if (!m_isvalidVersion)
return result;
if (m_osVersion == MaemoDeviceConfig::Maemo5) {
result.insert(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID));
} else if (MaemoGlobal::isValidHarmattanQtVersion(qmakeCommand())) {
} else if (m_osVersion == MaemoDeviceConfig::Maemo6) {
result.insert(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID));
} else if (MaemoGlobal::isValidMeegoQtVersion(qmakeCommand())) {
} else if (m_osVersion == MaemoDeviceConfig::Meego) {
result.insert(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID));
}
return result;
......@@ -130,11 +144,11 @@ QSet<QString> MaemoQtVersion::supportedTargetIds() const
QString MaemoQtVersion::description() const
{
if (MaemoGlobal::isValidMaemo5QtVersion(qmakeCommand()))
if (m_osVersion == MaemoDeviceConfig::Maemo5)
return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5");
else if (MaemoGlobal::isValidHarmattanQtVersion(qmakeCommand()))
else if (m_osVersion == MaemoDeviceConfig::Maemo6)
return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan");
else if (MaemoGlobal::isValidMeegoQtVersion(qmakeCommand()))
else if (m_osVersion == MaemoDeviceConfig::Meego)
return QCoreApplication::translate("QtVersion", "Meego", "Qt Version is meant for Meego");
return QString();
}
......@@ -146,3 +160,8 @@ bool MaemoQtVersion::supportsShadowBuilds() const
#endif
return true;
}
MaemoDeviceConfig::OsVersion MaemoQtVersion::osVersion() const
{
return m_osVersion;
}
......@@ -33,6 +33,7 @@
#define MAEMOQTVERSION_H
#include "baseqtversion.h"
#include "maemodeviceconfigurations.h"
namespace Qt4ProjectManager {
namespace Internal {
......@@ -43,6 +44,8 @@ public:
MaemoQtVersion();
MaemoQtVersion(const QString &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
~MaemoQtVersion();
void fromMap(const QVariantMap &map);
MaemoQtVersion *clone() const;
virtual QString type() const;
......@@ -56,8 +59,11 @@ public:
virtual QString description() const;
virtual bool supportsShadowBuilds() const;
MaemoDeviceConfig::OsVersion osVersion() const;
private:
mutable QString m_systemRoot;
mutable MaemoDeviceConfig::OsVersion m_osVersion;
mutable bool m_isvalidVersion;
};
}
......
......@@ -183,14 +183,14 @@ void MaemoToolChain::setQtVersionId(int id)
return;
}
BaseQtVersion *version = QtVersionManager::instance()->version(id);
MaemoQtVersion *version = dynamic_cast<MaemoQtVersion *>(QtVersionManager::instance()->version(id));
Q_ASSERT(version);
ProjectExplorer::Abi::OSFlavor flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor;
if (MaemoGlobal::isValidMaemo5QtVersion(version->qmakeCommand()))
if (version->osVersion() == MaemoDeviceConfig::Maemo5)
flavour = ProjectExplorer::Abi::MaemoLinuxFlavor;
else if (MaemoGlobal::isValidHarmattanQtVersion(version->qmakeCommand()))
else if (version->osVersion() == MaemoDeviceConfig::Maemo6)
flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor;
else if (MaemoGlobal::isValidMeegoQtVersion(version->qmakeCommand()))
else if (version->osVersion() == MaemoDeviceConfig::Meego)
flavour = ProjectExplorer::Abi::MeegoLinuxFlavor;
else
return;
......
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