diff options
author | Vikas Pachdha <vikas.pachdha@qt.io> | 2017-11-20 12:26:19 +0100 |
---|---|---|
committer | Vikas Pachdha <vikas.pachdha@qt.io> | 2017-11-21 10:53:20 +0000 |
commit | 59e3d9af1e3197d29682e59c810ec7a40454feec (patch) | |
tree | 88555e3e930bc11a8f10889a49e97252d4af15bf /src/plugins | |
parent | 216e40b3f0fa2e6da85367e8620c8f93f6b3c5b8 (diff) | |
download | qt-creator-59e3d9af1e3197d29682e59c810ec7a40454feec.tar.gz |
Android: Enable emulator tool installationv4.5.0-rc1
Let Android sdk manager UI install the emulator tool. AVD needs this
tool to manage AVD's.
Task-number: QTCREATORBUG-19332
Change-Id: If836c511ca4a5673470d42c14115afa21b1b96fd
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/android/androidsdkmanager.cpp | 25 | ||||
-rw-r--r-- | src/plugins/android/androidsdkpackage.cpp | 16 | ||||
-rw-r--r-- | src/plugins/android/androidsdkpackage.h | 14 |
3 files changed, 53 insertions, 2 deletions
diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index f71e22d5cb..b01a971bb8 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -260,6 +260,7 @@ public: BuildToolsMarker = 0x080, SdkToolsMarker = 0x100, PlatformToolsMarker = 0x200, + EmulatorToolsMarker = 0x400, SectionMarkers = InstalledPackagesMarker | AvailablePackagesMarkers | AvailableUpdatesMarker }; @@ -278,6 +279,7 @@ private: BuildTools *parseBuildToolsPackage(const QStringList &data) const; SdkTools *parseSdkToolsPackage(const QStringList &data) const; PlatformTools *parsePlatformToolsPackage(const QStringList &data) const; + EmulatorTools *parseEmulatorToolsPackage(const QStringList &data) const; MarkerTag parseMarkers(const QString &line); MarkerTag m_currentSection = MarkerTag::None; @@ -292,7 +294,8 @@ const std::map<SdkManagerOutputParser::MarkerTag, const char *> markerTags { {SdkManagerOutputParser::MarkerTag::SystemImageMarker, "system-images"}, {SdkManagerOutputParser::MarkerTag::BuildToolsMarker, "build-tools"}, {SdkManagerOutputParser::MarkerTag::SdkToolsMarker, "tools"}, - {SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"} + {SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"}, + {SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"} }; AndroidSdkManager::AndroidSdkManager(const AndroidConfig &config, QObject *parent): @@ -543,6 +546,10 @@ void SdkManagerOutputParser::parsePackageData(MarkerTag packageMarker, const QSt createPackage(&SdkManagerOutputParser::parsePlatformToolsPackage); break; + case MarkerTag::EmulatorToolsMarker: + createPackage(&SdkManagerOutputParser::parseEmulatorToolsPackage); + break; + case MarkerTag::PlatformMarker: createPackage(&SdkManagerOutputParser::parsePlatform); break; @@ -705,6 +712,22 @@ PlatformTools *SdkManagerOutputParser::parsePlatformToolsPackage(const QStringLi return platformTools; } +EmulatorTools *SdkManagerOutputParser::parseEmulatorToolsPackage(const QStringList &data) const +{ + EmulatorTools *emulatorTools = nullptr; + GenericPackageData packageData; + if (parseAbstractData(packageData, data, 1, "Emulator-tools")) { + emulatorTools = new EmulatorTools(packageData.revision, data.at(0)); + emulatorTools->setDescriptionText(packageData.description); + emulatorTools->setDisplayText(packageData.description); + emulatorTools->setInstalledLocation(packageData.installedLocation); + } else { + qCDebug(sdkManagerLog) << "Emulator-tools: Parsing failed. Minimum required data " + "unavailable:" << data; + } + return emulatorTools; +} + SdkManagerOutputParser::MarkerTag SdkManagerOutputParser::parseMarkers(const QString &line) { if (line.isEmpty()) diff --git a/src/plugins/android/androidsdkpackage.cpp b/src/plugins/android/androidsdkpackage.cpp index b7d1510585..94b7a2b87b 100644 --- a/src/plugins/android/androidsdkpackage.cpp +++ b/src/plugins/android/androidsdkpackage.cpp @@ -253,4 +253,20 @@ AndroidSdkPackage::PackageType PlatformTools::type() const return AndroidSdkPackage::PlatformToolsPackage; } +EmulatorTools::EmulatorTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent): + AndroidSdkPackage(revision, sdkStylePathStr, parent) +{ + +} + +bool EmulatorTools::isValid() const +{ + return installedLocation().exists(); +} + +AndroidSdkPackage::PackageType EmulatorTools::type() const +{ + return AndroidSdkPackage::EmulatorToolsPackage; +} + } // namespace Android diff --git a/src/plugins/android/androidsdkpackage.h b/src/plugins/android/androidsdkpackage.h index 486c604b60..dac6a5662d 100644 --- a/src/plugins/android/androidsdkpackage.h +++ b/src/plugins/android/androidsdkpackage.h @@ -52,8 +52,9 @@ public: PlatformToolsPackage = 1 << 3, SdkPlatformPackage = 1 << 4, SystemImagePackage = 1 << 5, + EmulatorToolsPackage = 1 << 6, AnyValidType = SdkToolsPackage | BuildToolsPackage | PlatformToolsPackage | - SdkPlatformPackage | SystemImagePackage + SdkPlatformPackage | SystemImagePackage | EmulatorToolsPackage }; enum PackageState { @@ -169,6 +170,17 @@ public: PackageType type() const override; }; +class EmulatorTools : public AndroidSdkPackage +{ +public: + EmulatorTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + +// AndroidSdkPackage Overrides +public: + bool isValid() const override; + PackageType type() const override; +}; + class SdkTools : public AndroidSdkPackage { public: |