Commit e433b83f authored by Daniel Teske's avatar Daniel Teske
Browse files

AndroidSettingsWidget::apply(): Fix order of applying the changes



Create the device first, as otherwise no kits are generated and
create toolchains next. This should fix that the AndroidPotentialKit
 doesn't vanish in some cases.

Change-Id: Ia9141f72a146da157dc713c1e2f293747fa369bd
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
parent 9c2cdc89
......@@ -884,8 +884,9 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
m_instance->m_config = devConfigs;
m_instance->save();
m_instance->updateAutomaticKitList();
m_instance->updateAndroidDevice();
m_instance->updateToolChainList();
m_instance->updateAutomaticKitList();
emit m_instance->updated();
}
......@@ -944,6 +945,32 @@ static bool equalKits(Kit *a, Kit *b)
&& QtSupport::QtKitInformation::qtVersion(a) == QtSupport::QtKitInformation::qtVersion(b);
}
void AndroidConfigurations::updateToolChainList()
{
QList<ToolChain *> existingToolChains = ToolChainManager::toolChains();
QList<ToolChain *> toolchains = AndroidToolChainFactory::createToolChainsForNdk(AndroidConfigurations::currentConfig().ndkLocation());
foreach (ToolChain *tc, toolchains) {
bool found = false;
for (int i = 0; i < existingToolChains.count(); ++i) {
if (*(existingToolChains.at(i)) == *tc) {
found = true;
break;
}
}
if (found)
delete tc;
else
ToolChainManager::registerToolChain(tc);
}
foreach (ToolChain *tc, existingToolChains) {
if (tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) {
if (!tc->isValid())
ToolChainManager::deregisterToolChain(tc);
}
}
}
void AndroidConfigurations::updateAutomaticKitList()
{
QList<AndroidToolChain *> toolchains;
......
......@@ -185,6 +185,7 @@ public:
static QString defaultDevice(ProjectExplorer::Project *project, const QString &abi); // serial number or avd name
public slots:
static void clearDefaultDevices(ProjectExplorer::Project *project);
static void updateToolChainList();
static void updateAutomaticKitList();
signals:
......
......@@ -62,31 +62,6 @@ QWidget *AndroidSettingsPage::widget()
void AndroidSettingsPage::apply()
{
m_widget->saveSettings();
QList<ToolChain *> existingToolChains = ToolChainManager::toolChains();
QList<ToolChain *> toolchains = AndroidToolChainFactory::createToolChainsForNdk(AndroidConfigurations::currentConfig().ndkLocation());
foreach (ToolChain *tc, toolchains) {
bool found = false;
for (int i = 0; i < existingToolChains.count(); ++i) {
if (*(existingToolChains.at(i)) == *tc) {
found = true;
break;
}
}
if (found)
delete tc;
else
ToolChainManager::registerToolChain(tc);
}
foreach (ToolChain *tc, existingToolChains) {
if (tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) {
if (!tc->isValid())
ToolChainManager::deregisterToolChain(tc);
}
}
AndroidConfigurations::updateAutomaticKitList();
}
void AndroidSettingsPage::finish()
......
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