Skip to content

Commit b0c62f2

Browse files
committed
feat: use multi-field event logger with cmake find_package
使用多字段事件日志记录器并迁移到 cmake find_package - Migrate from find_path to find_package(DDEAPI) - Link DDEAPI::EventLogger to dde-control-center - Fix pt_BR translation for control center name PMS: TASK-388657
1 parent ca88a70 commit b0c62f2

3 files changed

Lines changed: 39 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
1+
# SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
22
#
33
# SPDX-License-Identifier: CC0-1.0
44

@@ -31,6 +31,15 @@ if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10)
3131
find_package(Qt6 COMPONENTS GuiPrivate REQUIRED)
3232
endif()
3333

34+
# Check if dde-api provides EventLogger (header-only)
35+
find_package(DDEAPI QUIET)
36+
if(DDEAPI_FOUND)
37+
set(HAVE_DDE_API_EVENTLOGGER ON)
38+
message(STATUS "Found DDEAPI: EventLogger available")
39+
else()
40+
message(STATUS "DDEAPI not found, event logging will be disabled")
41+
endif()
42+
3443
set_package_properties(${ASQT_NS} PROPERTIES
3544
DESCRIPTION "Library that lists Appstream resources"
3645
URL "https://www.freedesktop.org"
@@ -140,6 +149,11 @@ target_link_libraries(launchpadcommon PUBLIC
140149
treeland-integration
141150
)
142151

152+
if (HAVE_DDE_API_EVENTLOGGER)
153+
target_compile_definitions(launchpadcommon PRIVATE HAVE_DDE_API_EVENTLOGGER)
154+
target_link_libraries(launchpadcommon PRIVATE DDEAPI::EventLogger)
155+
endif()
156+
143157
install(TARGETS launchpadcommon DESTINATION ${CMAKE_INSTALL_LIBDIR})
144158
install(
145159
FILES dist/org.deepin.dde.shell.launchpad.appdata.xml

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Build-Depends:
2424
# v-- provides DHiDPIHelper
2525
libdtk6gui-dev (>= 6.0.19),
2626
libdtk6declarative-dev (>> 6.7.33),
27+
dde-api-dev (>> 6.0.39),
2728
libdde-shell-dev (>= 0.0.10),
2829
libappstreamqt-dev (>= 1.0.0)
2930
Standards-Version: 4.6.0

launchercontroller.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -15,12 +15,29 @@
1515
#include <QDBusConnection>
1616
#include <QLoggingCategory>
1717

18+
#ifdef HAVE_DDE_API_EVENTLOGGER
19+
#include <dde-api/eventlogger.hpp>
20+
#endif
21+
1822
#include <private/qguiapplication_p.h>
1923

2024
DGUI_USE_NAMESPACE
2125

2226
namespace {
2327
Q_LOGGING_CATEGORY(logController, "org.deepin.dde.launchpad.controller")
28+
29+
constexpr qint64 EVENT_LOGGER_LAUNCHPAD_MODE = 1000610012;
30+
31+
void logLaunchpadMode(const QString &mode, const char *description)
32+
{
33+
#ifdef HAVE_DDE_API_EVENTLOGGER
34+
DDE_EventLogger::EventLogger::instance().writeEventLog(
35+
DDE_EventLogger::EventLoggerData(EVENT_LOGGER_LAUNCHPAD_MODE, QStringLiteral("launchpad_config"), {
36+
{QStringLiteral("launchpad_mode"), mode}
37+
}));
38+
#endif
39+
qCInfo(logController) << "EventLogger: launchpad mode" << description << ":" << mode;
40+
}
2441
}
2542

2643
LauncherController::LauncherController(QObject *parent)
@@ -39,6 +56,8 @@ LauncherController::LauncherController(QObject *parent)
3956
m_currentFrame = settings.value("current_frame", "WindowedFrame").toString();
4057
qCInfo(logController) << "Current frame mode:" << m_currentFrame;
4158

59+
logLaunchpadMode(m_currentFrame, "on startup");
60+
4261
// Interval set to 500=>1000ms for issue https://github.com/linuxdeepin/developer-center/issues/8137
4362
m_timer->setInterval(1000);
4463
m_timer->setSingleShot(true);
@@ -151,6 +170,9 @@ void LauncherController::setCurrentFrame(const QString &frame)
151170

152171
m_currentFrame = frame;
153172
qDebug() << "set current frame:" << m_currentFrame;
173+
174+
logLaunchpadMode(m_currentFrame, "changed to");
175+
154176
m_pendingHide = false;
155177
m_timer->start();
156178
emit currentFrameChanged();

0 commit comments

Comments
 (0)