Skip to content

Commit 35baf43

Browse files
committed
feat: complete launchpad logging integration
Add optional dde-api detection and Debian build dependency updates, and finish launchpad-side logging support in the shared launcher controller. Keep the launchpad build configuration and packaging aligned with the new logging integration. feat: 完善启动器日志集成 增加可选 dde-api 检测与 Debian 构建依赖更新,并在共享启动器控制器中补全启动器侧日志支持。 同步更新启动器的构建配置与打包依赖,使新的日志集成能够正确构建和交付。 PMS: TASK-388657
1 parent d6f73a7 commit 35baf43

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 16 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,17 @@ if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10)
3131
find_package(Qt6 COMPONENTS GuiPrivate REQUIRED)
3232
endif()
3333

34+
# Check if dde-api eventlogger.hpp exists
35+
# Unset cache to force re-detection every time
36+
unset(DDE_API_EVENTLOGGER_INCLUDE_DIR CACHE)
37+
find_path(DDE_API_EVENTLOGGER_INCLUDE_DIR NAMES dde-api/eventlogger.hpp PATHS /usr/include)
38+
if(DDE_API_EVENTLOGGER_INCLUDE_DIR)
39+
set(HAVE_DDE_API_EVENTLOGGER ON)
40+
message(STATUS "Found dde-api eventlogger.hpp: ${DDE_API_EVENTLOGGER_INCLUDE_DIR}")
41+
else()
42+
message(STATUS "dde-api eventlogger.hpp not found, event logging will be disabled")
43+
endif()
44+
3445
set_package_properties(${ASQT_NS} PROPERTIES
3546
DESCRIPTION "Library that lists Appstream resources"
3647
URL "https://www.freedesktop.org"
@@ -140,6 +151,10 @@ target_link_libraries(launchpadcommon PUBLIC
140151
treeland-integration
141152
)
142153

154+
if (HAVE_DDE_API_EVENTLOGGER)
155+
target_compile_definitions(launchpadcommon PRIVATE HAVE_DDE_API_EVENTLOGGER)
156+
endif()
157+
143158
install(TARGETS launchpadcommon DESTINATION ${CMAKE_INSTALL_LIBDIR})
144159
install(
145160
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: 28 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+
#ifdef HAVE_DDE_API_EVENTLOGGER
30+
constexpr qint64 EVENT_LOGGER_LAUNCHPAD_MODE = 1000610012;
31+
32+
void logLaunchpadMode(const QString &mode, const char *description)
33+
{
34+
DDE_EventLogger::EventLogger::instance().writeEventLog(
35+
DDE_EventLogger::EventLoggerData(EVENT_LOGGER_LAUNCHPAD_MODE, QStringLiteral("launchpad_config"), {
36+
{QStringLiteral("launchpad_mode"), mode}
37+
}));
38+
qCInfo(logController) << "EventLogger: launchpad mode" << description << ":" << mode;
39+
}
40+
#endif
2441
}
2542

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

59+
#ifdef HAVE_DDE_API_EVENTLOGGER
60+
DDE_EventLogger::EventLogger::instance().init(QStringLiteral("org.deepin.dde.launchpad"), false);
61+
logLaunchpadMode(m_currentFrame, "on startup");
62+
#endif
63+
4264
// Interval set to 500=>1000ms for issue https://github.com/linuxdeepin/developer-center/issues/8137
4365
m_timer->setInterval(1000);
4466
m_timer->setSingleShot(true);
@@ -151,6 +173,11 @@ void LauncherController::setCurrentFrame(const QString &frame)
151173

152174
m_currentFrame = frame;
153175
qDebug() << "set current frame:" << m_currentFrame;
176+
177+
#ifdef HAVE_DDE_API_EVENTLOGGER
178+
logLaunchpadMode(m_currentFrame, "changed to");
179+
#endif
180+
154181
m_pendingHide = false;
155182
m_timer->start();
156183
emit currentFrameChanged();

0 commit comments

Comments
 (0)