Commit Graph

414 Commits

Author SHA1 Message Date
yeshanshan 72c74eec4b refactor: replace QtDBus with libdbus-1 in dsgapplication
The changes replace QtDBus implementation with direct libdbus-1 calls
in dsgapplication.cpp for better control and performance. Key changes
include:
1. Added libdbus-1-dev as build dependency in debian/control
2. Updated CMakeLists.txt to find and link against libdbus-1
3. Implemented new utility functions checkDBusServiceActivatable and
callDBusIdentifyMethod using libdbus-1 API
4. Removed QtDBus dependencies and replaced with direct D-Bus calls
5. Added proper error handling and resource cleanup for D-Bus
connections

This change provides more direct control over D-Bus interactions
and removes QtDBus dependency overhead while maintaining the same
functionality.

refactor: 在 dsgapplication 中用 libdbus-1 替换 QtDBus

这些更改用直接的 libdbus-1 调用替换了 dsgapplication.cpp 中的 QtDBus 实
现,以获得更好的控制和性能。主要变更包括:
1. 在 debian/control 中添加了 libdbus-1-dev 作为构建依赖
2. 更新 CMakeLists.txt 以查找并链接 libdbus-1
3. 使用 libdbus-1 API 实现了新的实用函数 checkDBusServiceActivatable 和
callDBusIdentifyMethod
4. 移除了 QtDBus 依赖项并替换为直接的 D-Bus 调用
5. 为 D-Bus 连接添加了适当的错误处理和资源清理

此变更提供了对 D-Bus 交互更直接的控制,在保持相同功能的同时移除了 QtDBus
依赖开销。
2025-07-03 20:38:54 +08:00
yeshanshan 7bf69bc64d fix: copy cachePrefix in DConfigFile copy constructor
1. Added missing copy of cachePrefix member when copying DConfigFile
objects
2. The cachePrefix was being lost during copy operations which could
lead to incorrect cache behavior
3. This ensures complete and proper copying of all cache-related data

fix: 在 DConfigFile 拷贝构造函数中复制 cachePrefix

1. 添加了对 cachePrefix 成员的拷贝操作,在复制 DConfigFile 对象时该成员
之前被遗漏
2. 之前拷贝操作会丢失 cachePrefix,可能导致缓存行为异常
3. 此修改确保所有缓存相关数据都能被完整正确地拷贝
2025-06-27 07:12:55 +00:00
yeshanshan 3446cbed57 fix: improve logging rules environment variable handling
1. Modified condition to check for both DTK_DISABLED_LOGGING_RULES and
QT_LOGGING_RULES environment variables
2. This change prevents logging rules from being initialized when either
variable is set
3. Ensures better compatibility with Qt's standard logging configuration
system
4. Maintains backward compatibility while adding support for standard Qt
logging control

fix: 改进日志规则环境变量处理

1. 修改条件以同时检查 DTK_DISABLED_LOGGING_RULES 和 QT_LOGGING_RULES 环
境变量
2. 当任一变量设置时,阻止日志规则初始化
3. 确保与 Qt 标准日志配置系统更好的兼容性
4. 在添加对标准 Qt 日志控制支持的同时保持向后兼容
2025-06-27 12:20:14 +08:00
Ye ShanShan cac44391a0 fix: add missing UosMilitary edition type cases
Added case 9 to return UosMilitary/UosMilitaryS in uosEditionType
function
The change was necessary because the system needs to recognize edition
type 9 as a valid military edition variant
This ensures proper handling of all supported UOS edition types in the
system

fix: 添加缺失的 UosMilitary 版本类型处理

在 uosEditionType 函数中添加了 case 9 返回 UosMilitary/UosMilitaryS 的
处理
此变更是必要的,因为系统需要将类型9识别为有效的军事版本变体
这确保了系统中对所有支持的 UOS 版本类型的正确处理

pms: BUG-316837
2025-05-19 09:04:06 +00:00
Ye ShanShan 579d86a5f1 fix: correct bitwise operation in dconfig status tracking
1. Fixed incorrect bitwise AND operation in property status tracking
2. Changed `fetchAndAndOrdered(1 << index)` to `fetchAndAndOrdered(~(1
<< index))`
3. This ensures proper bit clearing when unsetting property flags
4. The change was made in both the generated header and the generator
tool
5. Without this fix, status tracking would incorrectly set bits instead
of clearing them

fix: 修正 dconfig 状态跟踪中的位操作

1. 修复了属性状态跟踪中错误的位与操作
2. 将 `fetchAndAndOrdered(1 << index)` 改为 `fetchAndAndOrdered(~(1
<< index))`
3. 确保在取消设置属性标志时能正确清除位
4. 修改同时应用于生成的头部文件和生成器工具
5. 若不修复此问题,状态跟踪会错误地设置位而非清除它们
2025-05-08 09:46:40 +00:00
Ye ShanShan 7319297676 fix: add QPointer check for parent object safety
1. Added QPointer include for tracking parent object lifecycle
2. Changed parent initialization to nullptr in constructor for safety
3. Implemented parent object tracking using QPointer to prevent dangling
pointers
4. Added logic to handle parent object deletion during async operation
5. Added proper parent reassignment if parent still exists after
operation

These changes prevent potential crashes when parent objects are deleted
during asynchronous configuration operations, particularly important in
multi-threaded scenarios where parent objects might be destroyed while
operations are pending.

fix: 添加 QPointer 检查确保父对象安全

1. 添加 QPointer 头文件用于跟踪父对象生命周期
2. 构造函数中将父对象初始化为 nullptr 提高安全性
3. 使用 QPointer 实现父对象跟踪,防止悬垂指针
4. 添加处理异步操作期间父对象被删除的逻辑
5. 操作完成后如果父对象仍存在则正确重新设置父对象

这些修改防止了在异步配置操作期间父对象被删除时可能导致的崩溃,对于多线程
场景下父对象可能在操作挂起时被销毁的情况尤为重要。
2025-05-07 03:45:01 +00:00
JiDe Zhang e8eedb9efe feat: supports create generic config by dconfig2cpp 2025-03-06 20:59:55 +08:00
JiDe Zhang c250cf2111 fix: build failed on Qt6
create dconfig2cpp's config failed if not assign application id.
Add missing parameter in dconfig2cpp generated code.
2025-03-06 20:59:55 +08:00
JiDe Zhang e6985b9351 feat: dconfig2cpp always add bindableFoo functions on Qt6
Direct string literal for the property name, because the literal was
use on the Q_PROPERTY macro, so use the hex encode for the property name
strings can't avoid the Chinese text codec problems.
2025-03-06 17:18:56 +08:00
JiDe Zhang 8b8bb8512c feat: dconfig2cpp generated codes supports qml
On the DtkDeclarative's DConfigWrapper, it needs know whether the value
is default, so always create the *IsDefaultValue functions.
2025-02-25 09:53:04 +08:00
JiDe Zhang 6dfb3c767a feat: async get dconfig value for DLog
Avoid block the application if DConfig's IO is slow.
2025-02-20 19:45:06 +08:00
JiDe Zhang a9a569b42a feat: support auto generate the Qt code from a dconfig's json
To help developer get/set dconfig in the non GUI thread.
2025-02-20 19:45:06 +08:00
Ye ShanShan 951314d59c fix: double value is converted to int for DConfig
MetaType of 1.0 is qlonglong instead of double in json file.
We don't convert if source value is double.
2024-12-12 17:58:32 +08:00
Ye ShanShan 53be287abf fix: pidfd leak
pidfd must be closed by caller according QDBusUnixFileDescriptor.

pms: BUG-293049
2024-12-10 09:10:47 +08:00
Yixue Wang e1f300f68c fix: compilation on Qt 6.8.1
Fix beginEntryList.
2024-12-03 14:13:18 +08:00
Ye ShanShan ca52ff7a2c fix: hasVtable is incorrect when destructing
Destruct function should be called by 'autoCleanVtable' instead of
'callOriginalFun'.
'glostVtable' should be delete before calling origin destruct,
because 'resetVtable' maybe called when destructing origin destruct.

pms: BUG-368399
2024-12-02 17:45:48 +08:00
Zhang Dingyuan 2e0b67ec2d feat: support Qt 6.8
support qt 6.8

Log:
2024-10-22 11:20:33 +00:00
ck 918c40f616 fix(dlog): JournalAppender not work
BUILD_WITH_SYSTEMD not defined
2024-10-18 14:14:35 +08:00
Robert Lv 40cbafcf8f fix: DDBusInterface signal loss
Fix the issue of no signal when DDBusInterface object properties change
2024-09-09 10:37:49 +08:00
renbin b0efc5a796 fix: remove unnecessary link libraries
These two libraries are used to detect text encoding,
but they are actually loaded dynamiclly.
Not need to link libraries.
2024-09-09 10:37:18 +08:00
ck 1a6e919cc5 refactor: log files move to dtklog
Issue: linuxdeepin/dtk#182

dtklog: https://github.com/linuxdeepin/dtklog
2024-07-05 14:13:31 +08:00
ck 6f02ee5d78 chore: add nullptr check
nullptr check
2024-05-30 10:56:46 +08:00
ck 10bd3842bb fix(build): build faild on Qt 6.7.1
QAbstractFileEngine::FileTime ==> QFile::FileTime
2024-05-28 13:13:09 +08:00
ck 052f52ba00 chore: fallback to dsgconfig value
fallback to default dsgconfig value
2024-05-21 16:25:34 +08:00
Ye ShanShan c56b7ea891 fix: crashed when access DSGApplication::id early
Add fallback, using fileName or cmdline as AppId.
Remove assert for empty appId.
2024-05-21 10:13:51 +08:00
ck 653f6dce7e refactor: remove LoggingRules interface
- 移除相关接口, 默认启用(可以用 DTK_DISABLED_LOGGING_RULES 禁用)
- 优先使用 dsgAppId , 用户可以通过 DTK_LOGGING_FALLBACK_APPID 指定
  fallbackAppId
- 有配置过 rules 时, 优先使用(即非默认值优先)
- fallbackConfig 发生变化时会检查 dsgConfig 是否修改过,是则忽略
2024-05-17 09:56:39 +08:00
ck c876a2a2a9 chore: loggingrules config move to preference
org.deepin.dtk.logginerules ==> org.deepin.dtk.preference
如果 DConfig 无效就不清空环境变量
2024-05-17 09:56:39 +08:00
覃本学 f21de0440b fix: 修复日志格式时间戳显示异常问题
适配qt的日志格式
%{time yyyy-MM-ddTHH:mm:ss.zzz} ==> %{time}{yyyy-MM-ddTHH:mm:ss.zzz}

Log: 修复日志格式时间戳显示异常问题
Bug: https://pms.uniontech.com/bug-view-236239.html
Influence: 使用DLogManager的应用日志输出格式
2024-05-17 09:56:39 +08:00
tanfeng 830c444024 feat: DeepinType类型增加军用版
DeepinType类型增加军用版

Log: DeepinType类型增加军用版
Task: https://pms.uniontech.com/task-view-316703.html
Influence: DeepinType类型
Change-Id: I9db5a3d14eebab69b5cac44fbfb0d2a09d8d84c3
2024-05-17 09:56:39 +08:00
YinJie 8ba05a2f80 feat: 增加registerLoggingRulesWatcher接口
功能:监听 dconfig 的值然后设置应用的日志级别
目的:
1.取消QT_LOGGING_RULES需要在创建 application之前处理
因为QLoggingRegistry在构造函数中获取环境变量的值后不会监听环境变量的变化.
目前直接使用applicationName当做appId 的做法不可行.
2.不和应用的 applicationName耦合目前大部分应用的applicationName和dconfig
的appId是不一样的,需要修改应用的名字
可能存在多个 application 使用通过一个 dconfig
的情况,修改applicantionName的方法不可行.
PS:从 DConfig 获取默认 appId 的逻辑上看, DSGApplication应用会有问题
3.开发者可以选择是否需要设置以及监听日志级别变动

Log:
Task: https://pms.uniontech.com/task-view-303379.html
2024-05-17 09:56:39 +08:00
chenjun 63a62b14f4 fix: 从文件中读取deepinType和productType值时因为权限问题会失败
安装了三方管控应用时,从文件中读取deepinType和productType值时因为权限问题会失败,需要重新读取一次

Log: 修复第一次读取配置文件失败导致无法显示系统版本和说明问题
Influence: 正常显示版本和说明
2024-05-17 09:56:39 +08:00
xuxin af83f1b4a8 fix: lshw查询内存大小时返回多元素数组,修正解析过程
调整json结果解析过程

Log: 在不同场景下lshw可能返回多个元素
Influence: DSysInfo::memoryInstalledSize解析过程
Bug: https://pms.uniontech.com/bug-view-228681.html
Change-Id: I51030f037fa272ef9d510265524e5ec934c1f9bd
2024-05-17 09:56:39 +08:00
覃本学 bc498f61fe feat: 允许基于dtk开发的应用动态控制其日志输出等级
在运行中,不需要重启应用,也可以通过配置项控制日志输出等级
注: 应用的applicationName 需要和dconfig安装时的appid等同方可识别
配置规则等同于QT_LOGGING_RULES

注意:由于 dtk/dtk6 的存在 meta 文件 在 libdtkdata 中安装

Log: 允许基于dtk开发的应用动态控制其日志输出等级
Influence: 允许基于dtk开发的应用动态控制其日志输出等级
Task: https://pms.uniontech.com/task-view-307567.html
      https://pms.uniontech.com/task-view-305899.html
2024-05-17 09:56:39 +08:00
Ye ShanShan 861a35a935 fix: DConfigFile is invalid when AppId is empty
Empty is used in dde-dconfig-daemon, and it is valid.
2024-05-14 11:06:37 +08:00
Ye ShanShan 5f6d336933 fix: DConfig add check for AppId
user can open non-root controlled files when `appId` is relative path.

Issue: https://bugzilla.suse.com/show_bug.cgi?id=1211374
2024-05-13 13:15:57 +08:00
hillwoodroc 45e8e60649 fix: fix undefined reference errors on spdlog 1.14.0
Support spdlog 1.14.0

Log: spdlog 1.14.0 add string view overloads for logger accessor. We should include
more headers for this change in dtkcore.
2024-04-29 14:16:25 +08:00
Ye ShanShan 70d034165c fix: lossing value when save DConfig
Blocking caller until it's finished, otherwise
it maybe lose value when application is quit early.
2024-03-27 19:04:52 +08:00
YeShanShan d35b71e346 fix: DConfig add check for name
user can open non-root controlled files when `name` is relative path.

Issue: https://bugzilla.suse.com/show_bug.cgi?id=1211374
2024-03-05 15:20:58 +08:00
YeShanShan 101e1f2dd3 feat: support to set appId for DConfig
It's useful for generic config to explicitly specify application id.
2024-03-05 11:46:31 +08:00
ck 8c4f4364b6 chore: remove unused code
remove unused global functions
2024-01-10 11:14:25 +08:00
YeShanShan af8b7666ff fix: app blocked when AM is unavailable
We don't block application when AM is unavailable.
2023-12-08 19:12:59 +08:00
ck f790bab887 fix: log files limit not work
type convert failed
2023-11-14 15:52:35 +08:00
ck c51d1af37c chore: keep order when deduplication
set is unordered, results are inconsistent
2023-11-09 15:35:53 +08:00
chenhongtao 75c9a19f66 feat(dstandardpaths): add XDG_STATE_HOME
this folder is used to storage history and logs

Log:
2023-11-03 13:19:18 +08:00
ck a7dd2a8678 chore: Implement DSGApplication::getId
- Get appid from dde-application-manager
 Also available in the linglong box due to using pidfd
2023-10-30 14:05:03 +08:00
wangfei 9c3e18ebf3 chore: add flag UserPublic
add flag UserPublic to Meta file for managing permission among users.

Issue: https://github.com/linuxdeepin/developer-center/issues/5928
2023-10-23 10:26:11 +08:00
ck 5f8a646ba3 chore: dpinyin tweak
- remove duplicate results when permuting and combining Pinyin
- limit the number of results to avoid of OOM
- ch2py print elapsed time

Issue: https://github.com/linuxdeepin/dtk/issues/109
2023-10-09 14:54:15 +08:00
Shiroko f8cf655d95 fix: Compiling failed in libspdlog-dev before 1.4.0
spdlog::memory_but_t and spdlog::wmemory_but_t are introduced after
1.4.0.
2023-09-25 10:49:07 +08:00
ck 844a68df95 fix(build): skip failed unit test
- gsettings schema remvove from dtkcommon, Skip
- if DSYSINFO_PREFIX empty, Skip
- add_definitions ==> target_compile_definitions
- setting cache variable move to dtkcore.cmake
2023-09-19 16:56:18 +08:00
YeShanShan ff6d5d7990 fix: Compiling failed in lower libspdlog-dev
fmt_lib introduced after v1.9.2 in spdlog.
2023-09-19 09:45:10 +08:00