forked from qt-creator/qt-creator
Android: Speed up project opening by caching the sdk version
The slowness is due to AndroidToolChain::addToEnvironment() being called a lot on project opening. Thus we need to avoid any file opening or process on loading. This patch does 2 things: a) It removes the call to sdkTargets() which is unneeded. That actually checks which avds are available. b) It caches the target sdk inside a named target setting. That means, we assume that the file does not change behind our backs. Task-number: QTCREATORBUG-9164 Change-Id: I9287934a0624db0b3e8318b8cf76e605418850c2 Reviewed-by: Aurindam Jana <aurindam.jana@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -64,6 +64,7 @@ const char DC_COUNT_KEY[] = "ProjectExplorer.Target.DeployConfigurationCount";
|
||||
const char ACTIVE_RC_KEY[] = "ProjectExplorer.Target.ActiveRunConfiguration";
|
||||
const char RC_KEY_PREFIX[] = "ProjectExplorer.Target.RunConfiguration.";
|
||||
const char RC_COUNT_KEY[] = "ProjectExplorer.Target.RunConfigurationCount";
|
||||
const char PLUGIN_SETTINGS_KEY[] = "ProjectExplorer.Target.PluginSettings";
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -93,6 +94,7 @@ public:
|
||||
RunConfiguration* m_activeRunConfiguration;
|
||||
DeploymentData m_deploymentData;
|
||||
BuildTargetInfoList m_appTargets;
|
||||
QVariantMap m_pluginSettings;
|
||||
|
||||
QPixmap m_connectedPixmap;
|
||||
QPixmap m_readyToUsePixmap;
|
||||
@@ -517,6 +519,8 @@ QVariantMap Target::toMap() const
|
||||
for (int i = 0; i < rcs.size(); ++i)
|
||||
map.insert(QString::fromLatin1(RC_KEY_PREFIX) + QString::number(i), rcs.at(i)->toMap());
|
||||
|
||||
map.insert(QLatin1String(PLUGIN_SETTINGS_KEY), d->m_pluginSettings);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -663,6 +667,19 @@ void Target::updateDefaultRunConfigurations()
|
||||
addRunConfiguration(rc);
|
||||
}
|
||||
|
||||
QVariant Target::namedSettings(const QString &name) const
|
||||
{
|
||||
return d->m_pluginSettings.value(name);
|
||||
}
|
||||
|
||||
void Target::setNamedSettings(const QString &name, const QVariant &value)
|
||||
{
|
||||
if (value.isNull())
|
||||
d->m_pluginSettings.remove(name);
|
||||
else
|
||||
d->m_pluginSettings.insert(name, value);
|
||||
}
|
||||
|
||||
static QString formatToolTip(const IDevice::DeviceInfo &input)
|
||||
{
|
||||
QStringList lines;
|
||||
@@ -824,6 +841,9 @@ bool Target::fromMap(const QVariantMap &map)
|
||||
setActiveRunConfiguration(rc);
|
||||
}
|
||||
|
||||
if (map.contains(QLatin1String(PLUGIN_SETTINGS_KEY)))
|
||||
d->m_pluginSettings = map.value(QLatin1String(PLUGIN_SETTINGS_KEY)).toMap();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user