QmlDesigner: Track time spend in design mode

Change-Id: Iabe982dcf2fc8c4ef3d10cf3d3df5b9e9b826548
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-05-19 19:06:24 +02:00
parent 72b6673069
commit c977dee6fe
3 changed files with 7 additions and 0 deletions

View File

@@ -123,6 +123,7 @@ const char EVENT_PROPERTYEDITOR_TIME[] = "propertyEditor";
const char EVENT_ASSETSLIBRARY_TIME[] = "assetsLibrary"; const char EVENT_ASSETSLIBRARY_TIME[] = "assetsLibrary";
const char EVENT_ITEMLIBRARY_TIME[] = "itemLibrary"; const char EVENT_ITEMLIBRARY_TIME[] = "itemLibrary";
const char EVENT_TRANSLATIONVIEW_TIME[] = "translationView"; const char EVENT_TRANSLATIONVIEW_TIME[] = "translationView";
const char EVENT_DESIGNMODE_TIME[] = "designMode";
const char PROPERTY_EDITOR_CLASSNAME_PROPERTY[] = "__classNamePrivateInternal"; const char PROPERTY_EDITOR_CLASSNAME_PROPERTY[] = "__classNamePrivateInternal";

View File

@@ -482,6 +482,8 @@ void QmlDesignerPlugin::showDesigner()
} }
d->shortCutManager.updateUndoActions(currentDesignDocument()); d->shortCutManager.updateUndoActions(currentDesignDocument());
m_usageTimer.restart();
} }
void QmlDesignerPlugin::hideDesigner() void QmlDesignerPlugin::hideDesigner()
@@ -494,6 +496,7 @@ void QmlDesignerPlugin::hideDesigner()
d->shortCutManager.disconnectUndoActions(currentDesignDocument()); d->shortCutManager.disconnectUndoActions(currentDesignDocument());
d->documentManager.setCurrentDesignDocument(nullptr); d->documentManager.setCurrentDesignDocument(nullptr);
d->shortCutManager.updateUndoActions(nullptr); d->shortCutManager.updateUndoActions(nullptr);
emitUsageStatisticsTime(QmlDesigner::Constants::EVENT_DESIGNMODE_TIME, m_usageTimer.elapsed());
} }
void QmlDesignerPlugin::changeEditor() void QmlDesignerPlugin::changeEditor()

View File

@@ -35,6 +35,8 @@
#include "shortcutmanager.h" #include "shortcutmanager.h"
#include <designeractionmanager.h> #include <designeractionmanager.h>
#include <QElapsedTimer>
QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QQmlEngine)
namespace Core { namespace Core {
@@ -116,6 +118,7 @@ private: // functions
private: // variables private: // variables
QmlDesignerPluginPrivate *d = nullptr; QmlDesignerPluginPrivate *d = nullptr;
static QmlDesignerPlugin *m_instance; static QmlDesignerPlugin *m_instance;
QElapsedTimer m_usageTimer;
}; };
} // namespace QmlDesigner } // namespace QmlDesigner