DeviceManager: Add more telemetry points

Change-Id: Iaae2fe210a025102524ecd2d27a496b460438076
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Burak Hancerli
2025-03-18 10:30:03 +01:00
committed by Thomas Hartmann
parent 31a20eb762
commit 65724da8ac
2 changed files with 26 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/kitaspect.h> #include <projectexplorer/kitaspect.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qmldesigner/qmldesignerconstants.h>
#include <qmldesigner/qmldesignerplugin.h> #include <qmldesigner/qmldesignerplugin.h>
#include <qtsupport/qtkitaspect.h> #include <qtsupport/qtkitaspect.h>
@@ -198,6 +199,9 @@ std::optional<bool> DeviceManager::deviceIsConnected(const QString &deviceId) co
void DeviceManager::setDeviceAlias(const QString &deviceId, const QString &alias) void DeviceManager::setDeviceAlias(const QString &deviceId, const QString &alias)
{ {
QmlDesigner::QmlDesignerPlugin::emitUsageStatistics(
QmlDesigner::Constants::EVENT_DEVICE_MANAGER_ANDROID_SET_ALIAS);
auto device = findDevice(deviceId); auto device = findDevice(deviceId);
if (!device) if (!device)
return; return;
@@ -216,6 +220,8 @@ void DeviceManager::setDeviceAlias(const QString &deviceId, const QString &alias
void DeviceManager::setDeviceActive(const QString &deviceId, const bool active) void DeviceManager::setDeviceActive(const QString &deviceId, const bool active)
{ {
QmlDesigner::QmlDesignerPlugin::emitUsageStatistics(
QmlDesigner::Constants::EVENT_DEVICE_MANAGER_ANDROID_SET_ACTIVE);
auto device = findDevice(deviceId); auto device = findDevice(deviceId);
if (!device) if (!device)
return; return;
@@ -233,6 +239,8 @@ void DeviceManager::setDeviceActive(const QString &deviceId, const bool active)
void DeviceManager::setDeviceIP(const QString &deviceId, const QString &ip) void DeviceManager::setDeviceIP(const QString &deviceId, const QString &ip)
{ {
QmlDesigner::QmlDesignerPlugin::emitUsageStatistics(
QmlDesigner::Constants::EVENT_DEVICE_MANAGER_ANDROID_SET_DEVICE_IP);
auto device = findDevice(deviceId); auto device = findDevice(deviceId);
if (!device) if (!device)
return; return;
@@ -259,6 +267,8 @@ QString DeviceManager::generateDeviceAlias() const
bool DeviceManager::addDevice(const QString &ip) bool DeviceManager::addDevice(const QString &ip)
{ {
QmlDesigner::QmlDesignerPlugin::emitUsageStatistics(
QmlDesigner::Constants::EVENT_DEVICE_MANAGER_ANDROID_ADD_DEVICE);
if (ip.isEmpty()) if (ip.isEmpty())
return false; return false;
@@ -354,6 +364,8 @@ void DeviceManager::deviceInfoReceived(const QString &deviceId)
void DeviceManager::removeDevice(const QString &deviceId) void DeviceManager::removeDevice(const QString &deviceId)
{ {
QmlDesigner::QmlDesignerPlugin::emitUsageStatistics(
QmlDesigner::Constants::EVENT_DEVICE_MANAGER_ANDROID_REMOVE_DEVICE);
auto device = findDevice(deviceId); auto device = findDevice(deviceId);
if (!device) if (!device)
return; return;
@@ -407,6 +419,8 @@ void DeviceManager::handleError(const ErrTypes &errType, const QString &deviceId
void DeviceManager::runProject(const QString &deviceId) void DeviceManager::runProject(const QString &deviceId)
{ {
QmlDesigner::QmlDesignerPlugin::emitUsageStatistics(
QmlDesigner::Constants::EVENT_DEVICE_MANAGER_ANDROID_RUN_PROJECT);
auto device = findDevice(deviceId); auto device = findDevice(deviceId);
if (!device) { if (!device) {
handleError(ErrTypes::InternalError, deviceId, "Device not found"); handleError(ErrTypes::InternalError, deviceId, "Device not found");
@@ -472,6 +486,8 @@ void DeviceManager::projectPacked(const Utils::FilePath &filePath)
void DeviceManager::stopProject() void DeviceManager::stopProject()
{ {
QmlDesigner::QmlDesignerPlugin::emitUsageStatistics(
QmlDesigner::Constants::EVENT_DEVICE_MANAGER_ANDROID_STOP_PROJECT);
auto device = findDevice(m_currentDeviceId); auto device = findDevice(m_currentDeviceId);
if (!device) { if (!device) {
handleError(ErrTypes::InternalError, m_currentDeviceId, "Device not found"); handleError(ErrTypes::InternalError, m_currentDeviceId, "Device not found");

View File

@@ -153,6 +153,16 @@ inline constexpr char EVENT_DESIGNVIEWER_PROJECT_THUMBNAIL_DELETED[]
= "DesignViewerProjectThumbnailDeleted"; = "DesignViewerProjectThumbnailDeleted";
inline constexpr char EVENT_DESIGNVIEWER_PROJECT_THUMBNAIL_DOWNLOADED[] inline constexpr char EVENT_DESIGNVIEWER_PROJECT_THUMBNAIL_DOWNLOADED[]
= "DesignViewerProjectThumbnailDownloaded"; = "DesignViewerProjectThumbnailDownloaded";
inline constexpr char EVENT_DEVICE_MANAGER_ANDROID_SET_ALIAS[] = "DeviceManagerAndroidSetAlias";
inline constexpr char EVENT_DEVICE_MANAGER_ANDROID_SET_ACTIVE[] = "DeviceManagerAndroidSetActive";
inline constexpr char EVENT_DEVICE_MANAGER_ANDROID_SET_DEVICE_IP[]
= "DeviceManagerAndroidSetDeviceIP";
inline constexpr char EVENT_DEVICE_MANAGER_ANDROID_ADD_DEVICE[] = "DeviceManagerAndroidAddDevice";
inline constexpr char EVENT_DEVICE_MANAGER_ANDROID_REMOVE_DEVICE[]
= "DeviceManagerAndroidRemoveDevice";
inline constexpr char EVENT_DEVICE_MANAGER_ANDROID_RUN_PROJECT[] = "DeviceManagerAndroidRunProject";
inline constexpr char EVENT_DEVICE_MANAGER_ANDROID_STOP_PROJECT[]
= "DeviceManagerAndroidStopProject";
inline constexpr char PROPERTY_EDITOR_CLASSNAME_PROPERTY[] = "__classNamePrivateInternal"; inline constexpr char PROPERTY_EDITOR_CLASSNAME_PROPERTY[] = "__classNamePrivateInternal";