更改埋点接口

This commit is contained in:
fanyuchen 2023-10-13 16:14:30 +08:00
parent e5c31a42cf
commit c0e929787e
7 changed files with 102 additions and 74 deletions

2
debian/control vendored
View File

@ -39,12 +39,14 @@ Build-Depends: debhelper-compat (=12),
libsnmp-dev,
libusb-1.0-0-dev,
libbsd-dev,
libkysdk-datacollect-dev
Standards-Version: 4.5.0
Rules-Requires-Root: no
Homepage: https://github.com/ubuntukylin/kylin-scanner
Vcs-Git: https://github.com/ubuntukylin/kylin-scanner.git
Vcs-Browser: https://github.com/ubuntukylin/kylin-scanner
Package: kylin-scanner
Architecture: any
Depends: ${misc:Depends},

View File

@ -11,7 +11,7 @@ QT += \
svg
# 配置kysdk
PKGCONFIG += kysdk-alm kysdk-qtwidgets kysdk-ukenv kysdk-diagnostics kysdk-powermanagement kysdk-waylandhelper kysdk-ocr
PKGCONFIG += kysdk-alm kysdk-qtwidgets kysdk-ukenv kysdk-datacollect kysdk-powermanagement kysdk-waylandhelper kysdk-ocr
INCLUDEPATH += /usr/include/kysdk/applications/kabase/
INCLUDEPATH += ./src/kabase/
INCLUDEPATH += ./src/kabase/Qt/

View File

@ -12,6 +12,7 @@
#include <sane/sane.h>
#include <buriedpoint.hpp>
#include "base_info.h"
#include <libkydatacollect.h>
bool deviceFinder::checkDeviceExistInSane(DeviceInformation &deviceInformation)
{
@ -113,10 +114,12 @@ void deviceFinder::dowork()
buried_data.insert(std::make_pair("action", std::string("connect to ") + BaseInfo::instance().getServerAddress().toStdString() + " failed."));
buried_data.insert(std::make_pair("function", "in deviceFinder.cpp function dowork()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "address_connect", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
m_isServerAddressConnected = false;
qDebug() << "cannot connect to server address!";
@ -126,10 +129,11 @@ void deviceFinder::dowork()
buried_data.insert(std::make_pair("action", std::string("connect to ") + BaseInfo::instance().getServerAddress().toStdString() + " succeed."));
buried_data.insert(std::make_pair("function", "in deviceFinder.cpp function dowork()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "address_connect", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
m_isServerAddressConnected = true;
}
@ -207,9 +211,10 @@ void deviceFinder::buriedDeviceInfomation(QList<DeviceInformation> list)
}
buried_data.insert(std::make_pair("packageNameList", pkg.toLocal8Bit().data()));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::StabilityType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "device_info", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
}

View File

@ -20,6 +20,7 @@
#include "device_information.h"
#include "base_info.h"
#include <libkydatacollect.h>
QString devInfoPrint(const DeviceInformation &debugInfo)
{
@ -188,9 +189,10 @@ void buriedNoDriverDevice(DeviceInformation device)
buried_data.insert(std::make_pair("device_VID", device.VID.toLocal8Bit().data()));
buried_data.insert(std::make_pair("device_PID", device.PID.toLocal8Bit().data()));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::StabilityType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "DeviceNoDriver", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}

View File

@ -2,6 +2,7 @@
#include "Qt/windowmanage.hpp"
#include <QHeaderView>
#include "buriedpoint.hpp"
#include <libkydatacollect.h>
newDeviceListPage::newDeviceListPage(QList<DeviceInformation> devInfoList, QWidget *parent)
: QDialog(parent),
@ -189,10 +190,12 @@ void newDeviceListPage::nextButtonClickSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerDriverCanAutoInstall)));
buried_data.insert(std::make_pair("action", "has driver, auto install"));
buried_data.insert(std::make_pair("function", "in newdevicelistpage.cpp function nextButtonClickSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "DriverCanAutoInstall", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
// 找到了对应驱动
m_selectedDriverName->setText(driverName);
@ -204,10 +207,13 @@ void newDeviceListPage::nextButtonClickSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerNoDriver)));
buried_data.insert(std::make_pair("action", "no driver, manual install"));
buried_data.insert(std::make_pair("function", "in newdevicelistpage.cpp function nextButtonClickSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "NoDriverDevice", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
// 未找到对应驱动程序
m_msg = new QMessageBox();
m_msg->setFixedSize(450, 210);

View File

@ -35,6 +35,7 @@
#include "include/theme.h"
#include "thumbnailwidget.h"
#include "newdevicelistpage.h"
#include <libkydatacollect.h>
ScanSettingsWidget::ScanSettingsWidget(QWidget *parent) :
QWidget(parent),
@ -217,10 +218,11 @@ void ScanSettingsWidget::pageNumberCurrentTextChangedSlot(QString text)
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerMultiPageScan)));
buried_data.insert(std::make_pair("action", "multipage scan"));
buried_data.insert(std::make_pair("function", "in scansettingswidget.cpp function pageNumberCurrentTextChangedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "MultiPageScan", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
} else {
g_sane_object->userInfo.pageNumber = tr("Single");
@ -230,10 +232,11 @@ void ScanSettingsWidget::pageNumberCurrentTextChangedSlot(QString text)
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerSinglePageScan)));
buried_data.insert(std::make_pair("action", "SinglePage scan"));
buried_data.insert(std::make_pair("function", "in scansettingswidget.cpp function pageNumberCurrentTextChangedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "SinglePageScan", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
}
@ -338,10 +341,11 @@ void ScanSettingsWidget::sendMailButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerSendMail)));
buried_data.insert(std::make_pair("action", "Send Mail"));
buried_data.insert(std::make_pair("function", "in scansettingswidget.cpp function sendMailButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "SendMail", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
int retDialog;
AppList *maillist = getAppIdList(MailType);
@ -375,10 +379,11 @@ void ScanSettingsWidget::saveAsButtonClickedSlot(bool exitApp)
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerSaveAs)));
buried_data.insert(std::make_pair("action", "save in user designed path"));
buried_data.insert(std::make_pair("function", "in scansettingswidget.cpp function saveAsButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "ScannerSaveAs", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
QString filename = m_saveNameEdit->text();
QString fileFormat = m_formatComboBox->currentText();
@ -578,11 +583,11 @@ void ScanSettingsWidget::showWaittingDialogSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerFindNoDriverDevice)));
buried_data.insert(std::make_pair("action", "Show waitting dialog and make deviceFinder start work."));
buried_data.insert(std::make_pair("function", "in scansettingswidget.cpp function ShowWaittingDialogSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "FindNoDriverDevice", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
m_devFinder = new deviceFinder();
QObject::connect(m_devFinder, &deviceFinder::succeed, this, &ScanSettingsWidget::showNewDeviceListPageSuccessSlot);

View File

@ -7,6 +7,7 @@
#include <QMessageBox>
#include "globalsignal.h"
#include "buriedpoint.hpp"
#include <libkydatacollect.h>
ToolBarWidget::ToolBarWidget(QWidget *parent) : QWidget(parent),
m_beautyButton(new kdk::KBorderlessButton),
@ -415,10 +416,11 @@ void ToolBarWidget::beautyButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerOneClickBeautification)));
buried_data.insert(std::make_pair("action", "beauty image"));
buried_data.insert(std::make_pair("function", "in toolbarwidget.cpp function beautyButtonClickedSlots()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
};
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "ClickBeautification", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
void ToolBarWidget::rectifyButtonClickedSlot()
@ -435,10 +437,11 @@ void ToolBarWidget::rectifyButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerRectification)));
buried_data.insert(std::make_pair("action", "image rectify"));
buried_data.insert(std::make_pair("function", "in toolbarwidget.cpp function rectifyButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
}
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "Rectification", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
@ -462,10 +465,11 @@ void ToolBarWidget::ocrButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerTextRecognition)));
buried_data.insert(std::make_pair("action", "OCR"));
buried_data.insert(std::make_pair("function", "in toolbarwidget.cpp function ocrButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
}
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "TextRecognition", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
ocrOtherIconState(false);
g_user_signal->toolbarOcrOperationStart();
@ -489,10 +493,11 @@ void ToolBarWidget::cropButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerCutting)));
buried_data.insert(std::make_pair("action", "image cutting"));
buried_data.insert(std::make_pair("function", "in toolbarwidget.cpp function cropButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
}
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "Cutting", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
@ -518,10 +523,11 @@ void ToolBarWidget::rotateButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerRotate)));
buried_data.insert(std::make_pair("action", "image rotate"));
buried_data.insert(std::make_pair("function", "in toolbarwidget.cpp function rotateButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
}
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "Rotate", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
void ToolBarWidget::mirrorButtonClickedSlot()
@ -540,10 +546,11 @@ void ToolBarWidget::mirrorButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerMirror)));
buried_data.insert(std::make_pair("action", "image mirror"));
buried_data.insert(std::make_pair("function", "in toolbarwidget.cpp function mirrorButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
}
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "Mirror", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
void ToolBarWidget::watermarkButtonClickedSlot()
@ -562,10 +569,11 @@ void ToolBarWidget::watermarkButtonClickedSlot()
buried_data.insert(std::make_pair("FunctionName", kabase::BuriedPoint::convertPTtoString(kabase::BuriedPoint::PT::KylinScannerAddWatermark)));
buried_data.insert(std::make_pair("action", "image add watermark"));
buried_data.insert(std::make_pair("function", "in toolbarwidget.cpp function watermarkButtonClickedSlot()"));
kabase::BuriedPoint buriedPointTest;
if (buriedPointTest.buriedPoint(kabase::AppName::KylinScanner, kabase::BuriedPoint::BuriedPointType::FunctionType, buried_data)) {
qCritical() << "Error : buried point fail !";
}
auto *p = new KCustomProperty[buried_data.size()];
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP, KEVENT_CUSTOM);
kdk_dia_append_custom_property(node, p, buried_data.size());
kdk_dia_upload_default(node, "AddWatermark", const_cast<char *>("mainPage"));
kdk_dia_data_free(node);
}
void ToolBarWidget::zoomoutButtonClickedSlot()