feat: 记录界面功能使用频率
This commit is contained in:
parent
13f880e373
commit
e4fb123f61
|
@ -29,7 +29,7 @@ find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
set(UKUI_MENU_EXTERNAL_LIBS "")
|
set(UKUI_MENU_EXTERNAL_LIBS "")
|
||||||
# glib-2.0 gio-unix-2.0 gsettings-qt x11 kysdk-waylandhelper
|
# glib-2.0 gio-unix-2.0 gsettings-qt x11 kysdk-waylandhelper
|
||||||
set(UKUI_MENU_PC_PKGS glib-2.0 gsettings-qt x11 kysdk-waylandhelper ukui-search)
|
set(UKUI_MENU_PC_PKGS glib-2.0 gsettings-qt x11 kysdk-waylandhelper ukui-search kysdk-datacollect)
|
||||||
|
|
||||||
foreach(external_lib IN ITEMS ${UKUI_MENU_PC_PKGS})
|
foreach(external_lib IN ITEMS ${UKUI_MENU_PC_PKGS})
|
||||||
pkg_check_modules(${external_lib} REQUIRED ${external_lib})
|
pkg_check_modules(${external_lib} REQUIRED ${external_lib})
|
||||||
|
@ -115,6 +115,7 @@ set(SOURCE_FILES
|
||||||
src/utils/app-page-header-utils.cpp src/utils/app-page-header-utils.h
|
src/utils/app-page-header-utils.cpp src/utils/app-page-header-utils.h
|
||||||
src/utils/power-button.cpp src/utils/power-button.h
|
src/utils/power-button.cpp src/utils/power-button.h
|
||||||
src/utils/app-manager.cpp src/utils/app-manager.h
|
src/utils/app-manager.cpp src/utils/app-manager.h
|
||||||
|
src/utils/event-track.cpp src/utils/event-track.h
|
||||||
src/menu/menu-provider.h
|
src/menu/menu-provider.h
|
||||||
src/menu/menu-manager.cpp src/menu/menu-manager.h
|
src/menu/menu-manager.cpp src/menu/menu-manager.h
|
||||||
src/items/theme-icon.h src/items/theme-icon.cpp
|
src/items/theme-icon.h src/items/theme-icon.cpp
|
||||||
|
|
|
@ -100,12 +100,14 @@ SwipeView {
|
||||||
appPageHeader.title = folderName;
|
appPageHeader.title = folderName;
|
||||||
appPageHeader.content = folderPageHeader;
|
appPageHeader.content = folderPageHeader;
|
||||||
root.currentIndex = SwipeView.index;
|
root.currentIndex = SwipeView.index;
|
||||||
|
EventTrack.sendClickEvent("EnterFolderPage", "AppView");
|
||||||
}
|
}
|
||||||
function hideFolderPage() {
|
function hideFolderPage() {
|
||||||
root.currentIndex = appListBase.SwipeView.index;
|
root.currentIndex = appListBase.SwipeView.index;
|
||||||
appPageHeader.title = appList.title;
|
appPageHeader.title = appList.title;
|
||||||
appPageHeader.content = null;
|
appPageHeader.content = null;
|
||||||
//active = false;
|
//active = false;
|
||||||
|
EventTrack.sendClickEvent("ExitFolderPage", "AppView");
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
|
@ -249,6 +249,7 @@ Item {
|
||||||
function select() {
|
function select() {
|
||||||
if (extensionLoader.source !== model.url) {
|
if (extensionLoader.source !== model.url) {
|
||||||
extensionLoader.setSource(model.url, {extensionData: extensionData});
|
extensionLoader.setSource(model.url, {extensionData: extensionData});
|
||||||
|
EventTrack.sendClickEvent("Switch Plugin: " + model.name, "Sidebar");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "app-data-manager.h"
|
#include "app-data-manager.h"
|
||||||
#include "model-manager.h"
|
#include "model-manager.h"
|
||||||
#include "app-model.h"
|
#include "app-model.h"
|
||||||
|
#include "event-track.h"
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
@ -219,6 +220,8 @@ void AppFolderHelper::addAppToFolder(const QString &appId, const int &folderId)
|
||||||
|
|
||||||
forceSync();
|
forceSync();
|
||||||
Q_EMIT folderDataChanged(folderId);
|
Q_EMIT folderDataChanged(folderId);
|
||||||
|
|
||||||
|
EventTrack::instance()->sendDefaultEvent("AddAppToFolder", "AppView");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFolderHelper::addAppToNewFolder(const QString &appId, const QString &folderName)
|
void AppFolderHelper::addAppToNewFolder(const QString &appId, const QString &folderName)
|
||||||
|
@ -241,6 +244,8 @@ void AppFolderHelper::addAppToNewFolder(const QString &appId, const QString &fol
|
||||||
|
|
||||||
insertFolder(folder);
|
insertFolder(folder);
|
||||||
Q_EMIT folderAdded(folder.id);
|
Q_EMIT folderAdded(folder.id);
|
||||||
|
|
||||||
|
EventTrack::instance()->sendDefaultEvent("AddAppToNewFolder", "AppView");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFolderHelper::addAppsToNewFolder(const QString &appIdA, const QString &appIdB, const QString &folderName)
|
void AppFolderHelper::addAppsToNewFolder(const QString &appIdA, const QString &appIdB, const QString &folderName)
|
||||||
|
@ -306,6 +311,7 @@ bool AppFolderHelper::deleteFolder(const int& folderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT folderDeleted(folderId);
|
Q_EMIT folderDeleted(folderId);
|
||||||
|
EventTrack::instance()->sendDefaultEvent("DeleteFolder", "AppView");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "data-provider-manager.h"
|
#include "data-provider-manager.h"
|
||||||
|
#include "event-track.h"
|
||||||
#include "plugin/all-app-data-provider.h"
|
#include "plugin/all-app-data-provider.h"
|
||||||
#include "plugin/app-search-plugin.h"
|
#include "plugin/app-search-plugin.h"
|
||||||
#include "plugin/app-category-plugin.h"
|
#include "plugin/app-category-plugin.h"
|
||||||
|
@ -159,6 +160,7 @@ void DataProviderManager::activateProvider(const QString &id)
|
||||||
|
|
||||||
m_activatedPlugin = id;
|
m_activatedPlugin = id;
|
||||||
Q_EMIT pluginChanged(m_activatedPlugin, m_providers.value(m_activatedPlugin)->group());
|
Q_EMIT pluginChanged(m_activatedPlugin, m_providers.value(m_activatedPlugin)->group());
|
||||||
|
EventTrack::instance()->sendClickEvent("Switch AppView: " + id, "AppView");
|
||||||
}
|
}
|
||||||
|
|
||||||
DataProviderManager::~DataProviderManager()
|
DataProviderManager::~DataProviderManager()
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "app-manager.h"
|
#include "app-manager.h"
|
||||||
#include "commons.h"
|
#include "commons.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "event-track.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
@ -218,11 +219,13 @@ FavoriteMenuProvider::generateActions(QObject *parent, const QVariant &data, con
|
||||||
list << new QAction(QObject::tr("Fix to favorite"), parent);
|
list << new QAction(QObject::tr("Fix to favorite"), parent);
|
||||||
QObject::connect(list.last(), &QAction::triggered, parent, [app] {
|
QObject::connect(list.last(), &QAction::triggered, parent, [app] {
|
||||||
Q_EMIT AppDataManager::instance()->fixToFavoriteSignal(app.id(), 1);
|
Q_EMIT AppDataManager::instance()->fixToFavoriteSignal(app.id(), 1);
|
||||||
|
EventTrack::instance()->sendDefaultEvent("Fix to favorite", "Right-click Menu");
|
||||||
});
|
});
|
||||||
} else if (locationId == "favorite") {
|
} else if (locationId == "favorite") {
|
||||||
list << new QAction(QObject::tr("Remove from favorite"), parent);
|
list << new QAction(QObject::tr("Remove from favorite"), parent);
|
||||||
QObject::connect(list.last(), &QAction::triggered, parent, [app] {
|
QObject::connect(list.last(), &QAction::triggered, parent, [app] {
|
||||||
Q_EMIT AppDataManager::instance()->fixToFavoriteSignal(app.id(), 0);
|
Q_EMIT AppDataManager::instance()->fixToFavoriteSignal(app.id(), 0);
|
||||||
|
EventTrack::instance()->sendDefaultEvent("Remove from favorite", "Right-click Menu");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "app-manager.h"
|
#include "app-manager.h"
|
||||||
#include "menu-manager.h"
|
#include "menu-manager.h"
|
||||||
#include "data-provider-manager.h"
|
#include "data-provider-manager.h"
|
||||||
|
#include "event-track.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
@ -78,6 +79,7 @@ void UkuiMenuApplication::registerQmlTypes()
|
||||||
qRegisterMetaType<Palette::ColorRole>("Palette::ColorRole");
|
qRegisterMetaType<Palette::ColorRole>("Palette::ColorRole");
|
||||||
qRegisterMetaType<Palette::ColorGroup>("Palette::ColorGroup");
|
qRegisterMetaType<Palette::ColorGroup>("Palette::ColorGroup");
|
||||||
qmlRegisterUncreatableType<Palette>(uri, versionMajor, versionMinor, "Palette", "Use enums only.");
|
qmlRegisterUncreatableType<Palette>(uri, versionMajor, versionMinor, "Palette", "Use enums only.");
|
||||||
|
qmlRegisterUncreatableType<EventTrack>(uri, versionMajor, versionMinor, "EventTrack", "Attached only.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UkuiMenuApplication::initQmlEngine()
|
void UkuiMenuApplication::initQmlEngine()
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "event-track.h"
|
||||||
|
|
||||||
|
#include <kysdk/diagnosetest/libkydatacollect.h>
|
||||||
|
|
||||||
|
namespace UkuiMenu {
|
||||||
|
|
||||||
|
EventTrack::EventTrack(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EventTrack *EventTrack::qmlAttachedProperties(QObject *object)
|
||||||
|
{
|
||||||
|
Q_UNUSED(object)
|
||||||
|
return EventTrack::instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
EventTrack *EventTrack::instance()
|
||||||
|
{
|
||||||
|
static EventTrack eventTrack;
|
||||||
|
return &eventTrack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventTrack::sendClickEvent(const QString &event, const QString &page)
|
||||||
|
{
|
||||||
|
KTrackData* data = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CLICK);
|
||||||
|
kdk_dia_upload_default(data, event.toUtf8().data(), page.toUtf8().data());
|
||||||
|
kdk_dia_data_free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventTrack::sendDefaultEvent(const QString& event, const QString& page)
|
||||||
|
{
|
||||||
|
KTrackData* data = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
|
||||||
|
kdk_dia_upload_default(data, event.toUtf8().data(), page.toUtf8().data());
|
||||||
|
kdk_dia_data_free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventTrack::sendSearchEvent(const QString &event, const QString &page, const QString &content)
|
||||||
|
{
|
||||||
|
KTrackData* data = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_SEARCH);
|
||||||
|
kdk_dia_upload_search_content(data, event.toUtf8().data(), page.toUtf8().data(), content.toUtf8().data());
|
||||||
|
kdk_dia_data_free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Sidebar
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UKUI_MENU_EVENT_TRACK_H
|
||||||
|
#define UKUI_MENU_EVENT_TRACK_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <qqml.h>
|
||||||
|
|
||||||
|
namespace UkuiMenu {
|
||||||
|
|
||||||
|
class EventTrack : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static EventTrack *qmlAttachedProperties(QObject *object);
|
||||||
|
static EventTrack *instance();
|
||||||
|
|
||||||
|
explicit EventTrack(QObject *parent = nullptr);
|
||||||
|
Q_INVOKABLE void sendClickEvent(const QString& event, const QString& page);
|
||||||
|
Q_INVOKABLE void sendDefaultEvent(const QString& event, const QString& page);
|
||||||
|
Q_INVOKABLE void sendSearchEvent(const QString& event, const QString& page, const QString& content);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Sidebar
|
||||||
|
|
||||||
|
QML_DECLARE_TYPEINFO(UkuiMenu::EventTrack, QML_HAS_ATTACHED_PROPERTIES)
|
||||||
|
|
||||||
|
#endif //UKUI_MENU_EVENT_TRACK_H
|
Loading…
Reference in New Issue