From 1b29359f5832f9c536a6b738d0e55d301a7e1c66 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 30 Oct 2026 10:15:11 +0800 Subject: [PATCH] feat: add dconfig meta org.deepin.ocr.json and install rule - Add log_rules meta (default: warning-only, matching shell script) - Extend INSTALL_DCONFIG cmake helper with optional APPID parameter - Install meta to share/dsg/configs/org.deepin.ocr/ --- assets/configs/org.deepin.ocr.json | 17 +++++++++++++++++ install_dconfig.cmake | 11 +++++++++-- src/CMakeLists.txt | 4 +++- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 assets/configs/org.deepin.ocr.json diff --git a/assets/configs/org.deepin.ocr.json b/assets/configs/org.deepin.ocr.json new file mode 100644 index 00000000..8c183c2b --- /dev/null +++ b/assets/configs/org.deepin.ocr.json @@ -0,0 +1,17 @@ +{ + "magic": "dsg.config.meta", + "version": "1.0", + "contents": { + "log_rules": { + "value": "org.deepin.ocr*.debug=false;org.deepin.ocr*.info=false;org.deepin.ocr*.warning=true", + "serial": 0, + "flags": ["global"], + "name": "log rules", + "name[zh_CN]": "日志规则", + "description": "log rules", + "description[zh_CN]": "日志规则", + "permissions": "readwrite", + "visibility": "public" + } + } +} diff --git a/install_dconfig.cmake b/install_dconfig.cmake index 14db8265..85d0f918 100644 --- a/install_dconfig.cmake +++ b/install_dconfig.cmake @@ -1,12 +1,19 @@ -# SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +# SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. # # SPDX-License-Identifier: CC0-1.0 # expect that all dconfigs of plugin is saved in ./assets/configs +# usage: INSTALL_DCONFIG( [APPID ]) +# 不传 APPID 时默认使用 deepin-ocr function(INSTALL_DCONFIG CONFIG_NAME) + cmake_parse_arguments(DCFG "" "APPID" "" ${ARGN}) set(DConfigPath ${CMAKE_SOURCE_DIR}/assets/configs) message("DConfigPath: ${DConfigPath}") - set(AppId "deepin-ocr") + if(DCFG_APPID) + set(AppId ${DCFG_APPID}) + else() + set(AppId "deepin-ocr") + endif() set(ConfigName ${CONFIG_NAME}) if (DEFINED DSG_DATA_DIR) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea84ed7d..d8f2a0a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -236,4 +236,6 @@ install(FILES ../assets/deepin-ocr.svg DESTINATION ${AppIconDir}) install(FILES ../com.deepin.Ocr.service DESTINATION ${DBusServiceDir}) include(${CMAKE_SOURCE_DIR}/install_dconfig.cmake) -INSTALL_DCONFIG("deepin-ocr.common.json") \ No newline at end of file +INSTALL_DCONFIG("deepin-ocr.common.json") +# 调试模式动态日志规则的 DConfig meta,appId 与 shell/监听代码保持一致 +INSTALL_DCONFIG("org.deepin.ocr.json" APPID "org.deepin.ocr") \ No newline at end of file