Commit 7e09b907 authored by hjk's avatar hjk

Android: De-noise androidconfigurations.cpp

Change-Id: Iba945476c4534c2901232f22b4510d023b929ebd
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 54d2d6ba
...@@ -375,7 +375,7 @@ FileName AndroidConfigurations::jarsignerPath() const ...@@ -375,7 +375,7 @@ FileName AndroidConfigurations::jarsignerPath() const
FileName AndroidConfigurations::zipalignPath() const FileName AndroidConfigurations::zipalignPath() const
{ {
Utils::FileName path = m_config.sdkLocation; FileName path = m_config.sdkLocation;
return path.appendPath(QLatin1String("tools/zipalign" QTC_HOST_EXE_SUFFIX)); return path.appendPath(QLatin1String("tools/zipalign" QTC_HOST_EXE_SUFFIX));
} }
...@@ -733,7 +733,7 @@ void AndroidConfigurations::updateAutomaticKitList() ...@@ -733,7 +733,7 @@ void AndroidConfigurations::updateAutomaticKitList()
if (AndroidConfigurations::instance().config().automaticKitCreation) { if (AndroidConfigurations::instance().config().automaticKitCreation) {
// having a empty toolchains list will remove all autodetected kits for android // having a empty toolchains list will remove all autodetected kits for android
// exactly what we want in that case // exactly what we want in that case
foreach (ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) { foreach (ToolChain *tc, ToolChainManager::instance()->toolChains()) {
if (!tc->isAutoDetected()) if (!tc->isAutoDetected())
continue; continue;
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
...@@ -744,8 +744,8 @@ void AndroidConfigurations::updateAutomaticKitList() ...@@ -744,8 +744,8 @@ void AndroidConfigurations::updateAutomaticKitList()
QList<Kit *> existingKits; QList<Kit *> existingKits;
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::kits()) { foreach (Kit *k, KitManager::kits()) {
if (ProjectExplorer::DeviceKitInformation::deviceId(k) != Core::Id(Constants::ANDROID_DEVICE_ID)) if (DeviceKitInformation::deviceId(k) != Core::Id(Constants::ANDROID_DEVICE_ID))
continue; continue;
if (!k->isAutoDetected()) if (!k->isAutoDetected())
continue; continue;
...@@ -755,17 +755,17 @@ void AndroidConfigurations::updateAutomaticKitList() ...@@ -755,17 +755,17 @@ void AndroidConfigurations::updateAutomaticKitList()
existingKits << k; existingKits << k;
} }
QMap<ProjectExplorer::Abi::Architecture, QList<QtSupport::BaseQtVersion *> > qtVersionsForArch; QMap<Abi::Architecture, QList<QtSupport::BaseQtVersion *> > qtVersionsForArch;
foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::instance()->versions()) { foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::instance()->versions()) {
if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT)) if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT))
continue; continue;
QList<ProjectExplorer::Abi> qtAbis = qtVersion->qtAbis(); QList<Abi> qtAbis = qtVersion->qtAbis();
if (qtAbis.empty()) if (qtAbis.empty())
continue; continue;
qtVersionsForArch[qtAbis.first().architecture()].append(qtVersion); qtVersionsForArch[qtAbis.first().architecture()].append(qtVersion);
} }
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance(); DeviceManager *dm = DeviceManager::instance();
IDevice::ConstPtr device = dm->find(Core::Id(Constants::ANDROID_DEVICE_ID)); // should always exist IDevice::ConstPtr device = dm->find(Core::Id(Constants::ANDROID_DEVICE_ID)); // should always exist
// register new kits // register new kits
...@@ -859,25 +859,25 @@ void AndroidConfigurations::load() ...@@ -859,25 +859,25 @@ void AndroidConfigurations::load()
m_config = AndroidConfig(*settings); m_config = AndroidConfig(*settings);
if (m_config.antLocation.isEmpty()) { if (m_config.antLocation.isEmpty()) {
Utils::Environment env = Utils::Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
QString location = env.searchInPath(QLatin1String("ant")); QString location = env.searchInPath(QLatin1String("ant"));
QFileInfo fi(location); QFileInfo fi(location);
if (fi.exists() && fi.isExecutable() && !fi.isDir()) { if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
m_config.antLocation = Utils::FileName::fromString(location); m_config.antLocation = FileName::fromString(location);
saveSettings = true; saveSettings = true;
} }
} }
if (m_config.openJDKLocation.isEmpty()) { if (m_config.openJDKLocation.isEmpty()) {
Utils::Environment env = Utils::Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
QString location = env.searchInPath(QLatin1String("javac")); QString location = env.searchInPath(QLatin1String("javac"));
QFileInfo fi(location); QFileInfo fi(location);
if (fi.exists() && fi.isExecutable() && !fi.isDir()) { if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
QDir parentDirectory = fi.canonicalPath(); QDir parentDirectory = fi.canonicalPath();
parentDirectory.cdUp(); // one up from bin parentDirectory.cdUp(); // one up from bin
m_config.openJDKLocation = Utils::FileName::fromString(parentDirectory.absolutePath()); m_config.openJDKLocation = FileName::fromString(parentDirectory.absolutePath());
saveSettings = true; saveSettings = true;
} else if (Utils::HostOsInfo::isWindowsHost()) { } else if (HostOsInfo::isWindowsHost()) {
QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Javasoft\\Java Development Kit"), QSettings::NativeFormat); QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Javasoft\\Java Development Kit"), QSettings::NativeFormat);
QStringList allVersions = settings.childGroups(); QStringList allVersions = settings.childGroups();
QString javaHome; QString javaHome;
...@@ -907,7 +907,7 @@ void AndroidConfigurations::load() ...@@ -907,7 +907,7 @@ void AndroidConfigurations::load()
} }
} }
if (!javaHome.isEmpty()) { if (!javaHome.isEmpty()) {
m_config.openJDKLocation = Utils::FileName::fromString(javaHome); m_config.openJDKLocation = FileName::fromString(javaHome);
saveSettings = true; saveSettings = true;
} }
} }
...@@ -921,9 +921,9 @@ void AndroidConfigurations::load() ...@@ -921,9 +921,9 @@ void AndroidConfigurations::load()
void AndroidConfigurations::updateAndroidDevice() void AndroidConfigurations::updateAndroidDevice()
{ {
ProjectExplorer::DeviceManager * const devMgr = ProjectExplorer::DeviceManager::instance(); DeviceManager * const devMgr = DeviceManager::instance();
if (adbToolPath().toFileInfo().exists()) if (adbToolPath().toFileInfo().exists())
devMgr->addDevice(ProjectExplorer::IDevice::Ptr(new Internal::AndroidDevice)); devMgr->addDevice(IDevice::Ptr(new Internal::AndroidDevice));
else if (devMgr->find(Constants::ANDROID_DEVICE_ID)) else if (devMgr->find(Constants::ANDROID_DEVICE_ID))
devMgr->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID)); devMgr->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID));
} }
......
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