QmlDesigner: Collect usage statistics for contex help

Change-Id: Ie1a1250abc6e55c13d71d8545a50d539f4360392
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2022-02-08 16:47:08 +01:00
parent 9e1c2232a4
commit 46e2683f0d
4 changed files with 15 additions and 0 deletions

View File

@@ -633,7 +633,15 @@ void AbstractView::enableWidget()
void AbstractView::contextHelp(const Core::IContext::HelpCallback &callback) const
{
#ifndef QMLDESIGNER_TEST
const QString id = const_cast<AbstractView *>(this)->widgetInfo().uniqueId;
QString nodeId;
if (!selectedModelNodes().isEmpty())
nodeId = selectedModelNodes().first().simplifiedTypeName();
QmlDesignerPlugin::instance()->emitUsageStatisticsHelpRequested(id + " " + nodeId);
QmlDesignerPlugin::instance()->viewManager().qmlJSEditorContextHelp(callback);
#else
callback(QString());
#endif

View File

@@ -97,6 +97,7 @@ const char EVENT_PROPERTY_ADDED[] = "Property Added";
const char EVENT_ANNOTATION_ADDED[] = "Annotation Added";
const char EVENT_RESOURCE_IMPORTED[] = "Resource Imported ";
const char EVENT_ACTION_EXECUTED[] = "Action Executed ";
const char EVENT_HELP_REQUESTED[] = "Help Requested ";
const char EVENT_IMPORT_ADDED[] = "Import Added ";
const char EVENT_BINDINGEDITOR_OPENED[] = "Binding Editor Opened";
const char EVENT_RICHTEXT_OPENED[] = "Richtext Editor Opened";

View File

@@ -617,6 +617,11 @@ void QmlDesignerPlugin::emitUsageStatisticsContextAction(const QString &identifi
emitUsageStatistics(Constants::EVENT_ACTION_EXECUTED + identifier);
}
void QmlDesignerPlugin::emitUsageStatisticsHelpRequested(const QString &identifier)
{
emitUsageStatistics(Constants::EVENT_HELP_REQUESTED + identifier);
}
AsynchronousImageCache &QmlDesignerPlugin::imageCache()
{
return m_instance->d->viewManager.imageCache();

View File

@@ -87,6 +87,7 @@ public:
static void emitUsageStatistics(const QString &identifier);
static void emitUsageStatisticsContextAction(const QString &identifier);
static void emitUsageStatisticsHelpRequested(const QString &identifier);
static void emitUsageStatisticsTime(const QString &identifier, int elapsed);
static AsynchronousImageCache &imageCache();