forked from qt-creator/qt-creator
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: Alessandro Portale <alessandro.portale@digia.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user