Android: Support "android-desktop" device definitions in AvdDialog

Change-Id: Iec80fe8b46302adeb1308d41da77e0a489c9c95e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Alessandro Portale
2024-05-08 13:51:06 +02:00
parent be222eaff4
commit 6fea65f029
2 changed files with 27 additions and 1 deletions

View File

@@ -111,6 +111,7 @@ AvdDialog::AvdDialog(QWidget *parent)
m_deviceTypeToStringMap.insert(AvdDialog::Automotive, "Automotive"); m_deviceTypeToStringMap.insert(AvdDialog::Automotive, "Automotive");
m_deviceTypeToStringMap.insert(AvdDialog::TV, "TV"); m_deviceTypeToStringMap.insert(AvdDialog::TV, "TV");
m_deviceTypeToStringMap.insert(AvdDialog::Wear, "Wear"); m_deviceTypeToStringMap.insert(AvdDialog::Wear, "Wear");
m_deviceTypeToStringMap.insert(AvdDialog::Desktop, "Desktop");
parseDeviceDefinitionsList(); parseDeviceDefinitionsList();
for (const QString &type : m_deviceTypeToStringMap) for (const QString &type : m_deviceTypeToStringMap)
@@ -211,6 +212,8 @@ AvdDialog::DeviceType AvdDialog::tagToDeviceType(const QString &type_tag)
return AvdDialog::TV; return AvdDialog::TV;
else if (type_tag.contains("android-automotive")) else if (type_tag.contains("android-automotive"))
return AvdDialog::Automotive; return AvdDialog::Automotive;
else if (type_tag.contains("android-desktop"))
return AvdDialog::Desktop;
else else
return AvdDialog::PhoneOrTablet; return AvdDialog::PhoneOrTablet;
} }
@@ -225,6 +228,29 @@ void AvdDialog::parseDeviceDefinitionsList()
return; return;
} }
/* Example output:
Available devices definitions:
id: 0 or "automotive_1024p_landscape"
Name: Automotive (1024p landscape)
OEM : Google
Tag : android-automotive-playstore
---------
id: 1 or "automotive_1080p_landscape"
Name: Automotive (1080p landscape)
OEM : Google
Tag : android-automotive
---------
id: 2 or "Galaxy Nexus"
Name: Galaxy Nexus
OEM : Google
---------
id: 3 or "desktop_large"
Name: Large Desktop
OEM : Google
Tag : android-desktop
...
*/
QStringList avdDeviceInfo; QStringList avdDeviceInfo;
const auto lines = output.split('\n'); const auto lines = output.split('\n');

View File

@@ -33,7 +33,7 @@ public:
explicit AvdDialog(QWidget *parent = nullptr); explicit AvdDialog(QWidget *parent = nullptr);
int exec() override; int exec() override;
enum DeviceType { Phone, Tablet, Automotive, TV, Wear, PhoneOrTablet }; enum DeviceType { Phone, Tablet, Automotive, TV, Wear, Desktop, PhoneOrTablet };
ProjectExplorer::IDevice::Ptr device() const; ProjectExplorer::IDevice::Ptr device() const;