-
Notifications
You must be signed in to change notification settings - Fork 57
feat: improve icon size detection and duplicate handling #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Synchronize source files from linuxdeepin/dtkgui. Source-pull-request: linuxdeepin/dtkgui#348
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
1. Added foundSize function to parse icon size from directory names using multiple strategies 2. Implemented duplicate entry detection to skip existing icons in DCI files 3. Added QFileInfo and QLogging includes for new functionality 4. Removed debug-specific code that was adding unnecessary prefixes 5. Improved size detection logic to handle both numeric and "NxN" format directory names 6. Added fallback to parent directory when current directory name doesn't contain size information Log: Improved icon theme generation with better size detection and duplicate prevention Influence: 1. Test icon theme generation with various directory naming conventions 2. Verify that duplicate icons are properly skipped during generation 3. Test with directories containing numeric names vs "widthxheight" format 4. Verify fallback to parent directory size detection works correctly 5. Check that existing icons in DCI files are not overwritten 6. Test with different directory structures and naming patterns feat: 改进图标尺寸检测和重复项处理 1. 添加 foundSize 函数,使用多种策略从目录名解析图标尺寸 2. 实现重复条目检测,跳过 DCI 文件中已存在的图标 3. 添加 QFileInfo 和 QLogging 包含以支持新功能 4. 移除添加不必要前缀的调试专用代码 5. 改进尺寸检测逻辑,支持数字和"NxN"格式的目录名 6. 在当前目录名不包含尺寸信息时,添加回退到父目录的检测 Log: 改进图标主题生成,提供更好的尺寸检测和重复项预防 Influence: 1. 测试使用不同目录命名约定的图标主题生成 2. 验证在生成过程中重复图标是否被正确跳过 3. 测试包含数字名称与"宽x高"格式的目录 4. 验证回退到父目录尺寸检测是否正常工作 5. 检查 DCI 文件中现有图标是否不会被覆盖 6. 测试不同的目录结构和命名模式
Synchronize source files from linuxdeepin/dtkgui. Source-pull-request: linuxdeepin/dtkgui#348
|
/forcemerge |
deepin pr auto review代码审查报告语法逻辑
代码质量
代码性能
代码安全
具体改进建议
static uint parseSizeFromString(const QString &dirName) {
bool ok;
if (int size = dirName.toUInt(&ok); ok && size > 0 && size <= 512) { // 添加范围检查
return size;
}
if (dirName.contains('x') && dirName.split('x').size() == 2) {
if (int size = dirName.split('x').first().toUInt(&ok); ok && size > 0 && size <= 512) {
return size;
}
}
return 0;
}
static const uint MIN_ICON_SIZE = 16;
static const uint MAX_ICON_SIZE = 512;
// 使用 QtConcurrent 进行并行处理
QList<QFuture<void>> futures;
for (const QFileInfo &file : files) {
futures.append(QtConcurrent::run([&, file]() {
// 原有的文件处理逻辑
}));
}
// 等待所有任务完成
for (auto &future : futures) {
future.waitForFinished();
}
qDebug() << "Processing file:" << file.absoluteFilePath();
qDebug() << "Detected icon size:" << iconSize;总体而言,这段代码结构清晰,功能实现完整,但仍有优化空间,特别是在性能、安全性和代码组织方面。建议按照上述建议进行改进,以提高代码质量和可维护性。 |
|
This pr force merged! (status: blocked) |
Synchronize source files from linuxdeepin/dtkgui. Source-pull-request: linuxdeepin/dtkgui#348
Log: Improved icon theme generation with better size detection and duplicate prevention
Influence:
feat: 改进图标尺寸检测和重复项处理
Log: 改进图标主题生成,提供更好的尺寸检测和重复项预防
Influence: