Commit befd041d authored by Daniel Teske's avatar Daniel Teske

Android: Add/Remove Android Device on configuring android sdk path

Task-number: QTCREATORBUG-9017

Change-Id: I5adf4be57b76cf8d0f8e0afebe9540a9f92a29a2
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
parent 5a3dfb76
......@@ -198,6 +198,7 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
save();
updateAvailablePlatforms();
updateAutomaticKitList();
updateAndroidDevice();
emit updated();
}
......@@ -697,6 +698,17 @@ void AndroidConfigurations::load()
settings->beginGroup(SettingsGroup);
m_config = AndroidConfig(*settings);
settings->endGroup();
updateAndroidDevice();
}
void AndroidConfigurations::updateAndroidDevice()
{
if (adbToolPath().toFileInfo().exists())
ProjectExplorer::DeviceManager::instance()
->addDevice(ProjectExplorer::IDevice::Ptr(new Internal::AndroidDevice));
else
ProjectExplorer::DeviceManager::instance()
->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID));
}
AndroidConfigurations *AndroidConfigurations::m_instance = 0;
......
......@@ -132,6 +132,7 @@ private:
int getSDKVersion(const QString &device) const;
void updateAvailablePlatforms();
void updateAndroidDevice();
static AndroidConfigurations *m_instance;
......
......@@ -33,9 +33,8 @@
#include <projectexplorer/devicesupport/idevice.h>
namespace Android {
class AndroidPlugin; // needed for friend declaration
namespace Internal {
class AndroidConfigurations; // needed for friend declaration
class AndroidDevice : public ProjectExplorer::IDevice
{
......@@ -52,7 +51,7 @@ public:
protected:
friend class AndroidDeviceFactory;
friend class Android::AndroidPlugin;
friend class AndroidConfigurations;
AndroidDevice();
AndroidDevice(const AndroidDevice &other);
};
......
......@@ -74,9 +74,6 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
addAutoReleasedObject(new Internal::AndroidDeviceFactory);
ProjectExplorer::KitManager::instance()->registerKitInformation(new Internal::AndroidGdbServerKitInformation);
ProjectExplorer::DeviceManager::instance()
->addDevice(ProjectExplorer::IDevice::Ptr(new Internal::AndroidDevice));
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
this, SLOT(kitsRestored()));
......
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