Skip to content

chore: update license info handling and add default loading#552

Open
mhduiy wants to merge 1 commit intolinuxdeepin:masterfrom
mhduiy:license
Open

chore: update license info handling and add default loading#552
mhduiy wants to merge 1 commit intolinuxdeepin:masterfrom
mhduiy:license

Conversation

@mhduiy
Copy link
Copy Markdown
Contributor

@mhduiy mhduiy commented Mar 26, 2026

  1. Updated copyright year range from 2023 to 2023-2026 in header
  2. Replaced DObject include with QObject for better compatibility
  3. Added loadDefault() and clear() public methods to DLicenseInfo class
  4. Enhanced license content search to use QStandardPaths for cross- platform compatibility
  5. Added support for both system licenses (/usr/share/spdx-licenses) and custom licenses
  6. Implemented automatic loading of application-specific license config from standard data locations
  7. Improved error handling with clearer warning messages

Log: Improved license information management with better path handling and default configuration loading

chore: 更新许可证信息处理并添加默认加载功能

  1. 将头文件中的版权年份范围从2023更新为2023-2026
  2. 将DObject引用替换为QObject以提高兼容性
  3. 为DLicenseInfo类添加了loadDefault()和clear()公共方法
  4. 使用QStandardPaths增强许可证内容搜索,提高跨平台兼容性
  5. 添加了对系统许可证(/usr/share/spdx-licenses)和自定义许可证的支持
  6. 实现了从标准数据位置自动加载应用程序特定的许可证配置
  7. 改进了错误处理,提供更清晰的警告信息

Log: 改进了许可证信息管理,提供更好的路径处理和默认配置加载功能

PMS: TASK-387863

@mhduiy mhduiy requested a review from 18202781743 March 26, 2026 08:05
return d->licenseContent(licenseName);
}

bool DLicenseInfo::loadDefault()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能不加这个接口么,需要的话path判空来处理逻辑?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本来是想在构造函数直接加载的, 但是考虑到可能会有懒加载的需求,就作为一个接口,而且语义比loadFile传入一个空更好一些;

@mhduiy mhduiy force-pushed the license branch 2 times, most recently from fe97c7e to 3f3d43a Compare March 27, 2026 02:25
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不需要了,

@mhduiy mhduiy force-pushed the license branch 2 times, most recently from deec269 to a98a77d Compare March 27, 2026 03:38
1. Extended copyright year range from 2023 to 2023-2026
2. Added support for automatic license file discovery in standard data
locations
3. When no file path is provided, now searches for application-specific
JSON config in deepin/credits directory
4. Enhanced license content search to check both custom-licenses and
spdx-licenses directories in all standard data locations
5. Improved code organization with constants for directory names
6. Simplified license content loading logic with early returns

chore: 更新许可证信息加载和搜索路径

1. 将版权年份范围从2023年扩展到2023-2026年
2. 添加对标准数据位置中自动发现许可证文件的支持
3. 当未提供文件路径时,现在会在deepin/credits目录中搜索应用程序特定的
JSON配置
4. 增强许可证内容搜索,在所有标准数据位置中检查custom-licenses和spdx-
licenses目录
5. 使用常量优化目录名称的代码组织
6. 通过提前返回简化许可证内容加载逻辑

PMS: TASK-387863
@deepin-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

{
QByteArray content;
QStringList dirs{"/usr/share/spdx-license"};
const QStringList dataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以用dtk的DStandardPaths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants