Skip to content

Commit 9944e8a

Browse files
committed
docs: 阶段四 更新架构文档,反映 dsfw-base 模块移除
- overview.md: 移除 dsfw-base 层、dstools-widgets INTERFACE 层 - 更新模块层次结构、依赖关系图、共享库列表、目录结构 - 将 JsonHelper 从 dsfw-base 移至 dsfw-core - human-decisions.md: 更新重构完成状态 - refactoring-plan.md: 标记为已完成 perf: 阶段三 保守性能优化 ChartConfigRegistry 重复编码转换 缓存 loadDefaults() 中的 chartId.toStdString() 和 saveConfig() 中 it.key().toStdString() 为局部变量,消除循环内重复编码转换。 refactor: 阶段一 消除 dsfw-base 幽灵模块 移除空的 dsfw-base 模块(无源码,仅传递依赖)。 dsfw-core 直接声明 dsfw::types + nlohmann_json 依赖(原本已声明)。 测试文件将 dsfw-base 替换为 dsfw-core。
1 parent 57c9fa7 commit 9944e8a

8 files changed

Lines changed: 18 additions & 59 deletions

File tree

docs/developer/architecture/overview.md

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,17 @@ Layer 3 ─ dsfw-ui-core AppShell, IconNavBar, Theme, FramelessHelper,
6969
Layer 2 ─ dstools-audio AudioDecoder (FFmpeg), AudioPlayback (SDL2)
7070
Layer 1 ─ dsfw-core AppSettings, ServiceLocator, AsyncTask, 接口集
7171
PipelineContext, PipelineRunner, ITaskProcessor
72-
含 infer-common 源文件 (OnnxEnv, OnnxModelBase)
73-
Layer 0.5─ dsfw-base JsonHelper (Qt-free 静态库)
72+
JsonHelper, 含 infer-common 源文件 (OnnxEnv, OnnxModelBase)
7473
Layer 0 ─ dsfw-types Result<T>, ExecutionProvider, TimePos (header-only)
7574
7675
此外层:
7776
dsfw-signal curve_tools, music_math, time_series (dsfw::signal 命名空间)
78-
dstools-widgets INTERFACE header-only 层
7977
```
8078

8179
### 依赖关系
8280

8381
```
84-
dsfw-widgets ─PUBLIC──→ dsfw-core ───→ dsfw-base ───→ dsfw-types
82+
dsfw-widgets ─PUBLIC──→ dsfw-core ───→ dsfw-types
8583
│ ↑
8684
├─PRIVATE→ dsfw-ui-core ┘
8785
└─PRIVATE→ dstools-audio
@@ -115,11 +113,6 @@ dstools-ui-core → dsfw-ui-core + dsfw-core + dstools-domain
115113
│ │ │ │ │ │
116114
▼ ▼ ▼ ▼ ▼ ▼
117115
┌──────────────────────────────────────────────────────────────────────────┐
118-
│ dstools-widgets (INTERFACE) │
119-
│ GpuSelector · ShortcutManager · 领域 UI 导出宏转发 │
120-
└────────────────────────────┬─────────────────────────────────────────────┘
121-
│ PUBLIC
122-
┌────────────────────────────┴─────────────────────────────────────────────┐
123116
│ dsfw-widgets (SHARED DLL) │
124117
│ PlayWidget · FileProgressTracker · ProgressDialog · PropertyEditor │
125118
│ SettingsDialog · LogViewer · RunProgressRow · PathSelector · ... │
@@ -164,13 +157,6 @@ dstools-ui-core → dsfw-ui-core + dsfw-core + dstools-domain
164157
└───────┬───────────┘ │
165158
│ PUBLIC │
166159
┌───────┴───────────┐ │
167-
│ dsfw-base │ │
168-
│ (STATIC, Qt-free)│ │
169-
│ │ │
170-
│ JsonHelper │ │
171-
└───────┬───────────┘ │
172-
│ PUBLIC │
173-
┌───────┴───────────┐ │
174160
│ dsfw-signal │ │
175161
│ (STATIC) │ │
176162
│ │ │
@@ -244,19 +230,13 @@ dstools-ui-core → dsfw-ui-core + dsfw-core + dstools-domain
244230

245231
## 6. 共享库
246232

247-
### dsfw-base (静态库, Qt-free)
248-
249-
JSON 工具 (JsonHelper,纯 nlohmann/json 封装)。无 Qt 依赖,可用于 CLI 工具。
250-
251-
依赖:nlohmann_json
252-
253233
### dsfw-core (静态库)
254234

255235
通用框架核心。类型安全配置 (AppSettings)、服务定位器 (ServiceLocator)、异步任务 (AsyncTask)、结构化日志 (Logger)
256-
、编码统一接口 (TextEncoding)、文档/文件/导出/G2P 抽象接口 (IDocument, IG2PProvider, IExportFormat 等)
236+
、编码统一接口 (TextEncoding)、JSON 工具 (JsonHelper)、文档/文件/导出/G2P 抽象接口 (IDocument, IG2PProvider, IExportFormat 等)
257237
、后端服务接口 (IAlignmentService, IAsrService, IPitchService, ITranscriptionService)。
258238

259-
依赖:dsfw-base, dstools-types, Qt Core/Network, nlohmann_json
239+
依赖:dstools-types, Qt Core/Network, nlohmann_json
260240

261241
### dsfw-ui-core (静态库)
262242

@@ -284,12 +264,6 @@ AudioDecoder (FFmpeg)、AudioPlayback (SDL2)、AudioPlayer、WaveFormat。
284264

285265
依赖:dsfw-core (PUBLIC), dsfw-ui-core + dstools-audio (PRIVATE)
286266

287-
### dstools-widgets (INTERFACE header-only)
288-
289-
DiffSinger 领域 UI 组件。所有应用的公共 UI 基础设施(通过 dsfw-widgets 导出宏转发)。
290-
291-
依赖:dsfw-widgets (PUBLIC)
292-
293267
### 推理库
294268

295269
|| 类型 | 功能 | 特有依赖 |
@@ -447,8 +421,6 @@ dataset-tools/
447421
│ ├── types/ # dstools-types (HEADER-ONLY)
448422
│ │ └── include/dstools/ # Result<T>, ExecutionProvider, TimePos
449423
│ ├── framework/
450-
│ │ ├── base/ # dsfw-base (STATIC, Qt-free)
451-
│ │ │ └── include/dsfw/ # JsonHelper
452424
│ │ ├── core/ # dsfw-core (STATIC)
453425
│ │ │ ├── include/dsfw/ # AppSettings, ServiceLocator, Logger, ...
454426
│ │ │ └── src/
@@ -462,7 +434,7 @@ dataset-tools/
462434
│ ├── domain/ # dstools-domain (STATIC)
463435
│ │ ├── include/dstools/ # DsDocument, DsProject, CsvToDsConverter, ...
464436
│ │ └── src/
465-
│ ├── ui-core/ # dstools-widgets (INTERFACE, header-only)
437+
│ ├── ui-core/ # dstools-ui-core (STATIC, 包装 dsfw-ui-core + dsfw-core + dstools-domain)
466438
│ ├── libs/
467439
│ │ ├── textgrid/ # header-only
468440
│ │ ├── hubert-fa/ # HuBERT 强制对齐处理器
@@ -510,9 +482,9 @@ dataset-tools/
510482
```
511483
~42 CMake targets (excluding tests):
512484
513-
Framework (6): dsfw-base → dsfw-signal → dsfw-core → dsfw-ui-core → dsfw-widgets + dstools-audio (infer-common 源文件编译入 dsfw-core)
485+
Framework (5): dsfw-signal → dsfw-core → dsfw-ui-core → dsfw-widgets + dstools-audio (infer-common 源文件编译入 dsfw-core)
514486
Domain (1): dstools-domain
515-
App-Lib (2): dstools-ui-core, dstools-widgets (INTERFACE, header-only)
487+
App-Lib (1): dstools-ui-core
516488
Infer (6): audio-util, FunAsr, game-infer, hubert-infer, rmvpe-infer, moe-infer
517489
Libs (8): slicer-lib, lyricfa-lib, hubertfa-lib, gameinfer-lib, rmvpepitch-lib, minlabel-lib, moelib, infer-bridge
518490
App-Shared (9): data-sources, audio-visualizer, phoneme-editor, pitch-editor, min-label-editor, settings, log-page, model-init, mouth-curve-chart

docs/developer/architecture/refactoring-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> 版本:4.1.0
44
> 日期:2026-06-08
5-
> 状态:方案阶段
5+
> 状态:已完成(2026-06-08)
66
> 取代:v4.0.0(已废除,因多处错误:错误地将 infer-bridge/unified-editor 判定为可合并薄模块、错误地认为 FileDialogHelper/PathSelector 与 FilePathSelector 功能重叠、错误地认为 JsonHelper 归属不当、错误地将 data-sources 目录重组作为必要项)
77
88
---

docs/human-decisions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
> 合并自 `docs/decisions/principles.md`、原 `docs/human-decisions.md`,按领域分类整理为完整体系。
55
> 与任何其他设计文档冲突时,以本文档为准。
66
>
7-
> 最后更新:2026-06-08(重构阶段一完成:消除 33 个头文件的 using namespace dsfw 命名空间污染;阶段二完成:更新 audio-library-design.md 文档状态
7+
> 最后更新:2026-06-08(重构 v4.1.0 完成:阶段一消除 dsfw-base 幽灵模块、阶段二清理空 include/dstools/ 目录、阶段三保守性能优化 ChartConfigRegistry、阶段四更新架构文档
88
99
---
1010

src/apps/shared/chart-framework/ChartConfigRegistry.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ void ChartConfigRegistry::setValue(const QString &chartId, const QString &paramK
7979
void ChartConfigRegistry::loadDefaults() {
8080
if (!m_settings) return;
8181
for (const auto &chartId : chartIds()) {
82-
QString raw = m_settings->getRawString(chartId.toStdString().c_str(), QStringLiteral("{}"));
82+
std::string chartIdStr = chartId.toStdString();
83+
QString raw = m_settings->getRawString(chartIdStr.c_str(), QStringLiteral("{}"));
8384
auto chartJson = nlohmann::json::parse(raw.toStdString(), nullptr, false);
8485
if (chartJson.is_null() || !chartJson.is_object()) continue;
8586

@@ -105,10 +106,11 @@ void ChartConfigRegistry::saveConfig(const QString &chartId) {
105106
if (overrideIt == m_overrides.end()) return;
106107

107108
for (auto it = overrideIt->begin(); it != overrideIt->end(); ++it) {
109+
std::string key = it.key().toStdString();
108110
if (it->typeId() == QMetaType::Double) {
109-
chartJson[it.key().toStdString()] = it->toDouble();
111+
chartJson[key] = it->toDouble();
110112
} else {
111-
chartJson[it.key().toStdString()] = it->toInt();
113+
chartJson[key] = it->toInt();
112114
}
113115
}
114116
m_settings->setRawString(chartId.toStdString().c_str(), QString::fromStdString(chartJson.dump()));

src/framework/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(DSFW_VERSION "${DSFW_VERSION_MAJOR}.${DSFW_VERSION_MINOR}.${DSFW_VERSION_PAT
66

77
set(CMAKE_FOLDER "Libraries/Framework")
88
add_subdirectory(types)
9-
add_subdirectory(base)
9+
1010
add_subdirectory(signal)
1111
add_subdirectory(infer)
1212
add_subdirectory(core)

src/framework/base/CMakeLists.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/framework/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dstools_add_library(${PROJECT_NAME}
2323
NAMESPACE dsfw::core
2424
EXPORT_SET dsfwTargets
2525
DEPENDS
26-
PUBLIC dsfw-base dsfw::types Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network nlohmann_json::nlohmann_json
26+
PUBLIC dsfw::types Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network nlohmann_json::nlohmann_json
2727
PRIVATE $<$<PLATFORM_ID:Windows>:dbghelp> Qt${QT_VERSION_MAJOR}::Widgets
2828
INCLUDE_DIRS
2929
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>

src/tests/domain/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ foreach (test_name ${DOMAIN_TESTS})
2929
add_executable(${test_name} ${test_name}.cpp)
3030
target_link_libraries(${test_name} PRIVATE
3131
dstools-domain
32-
dsfw-base
32+
dsfw-core
3333
dsfw-signal
3434
Qt${QT_VERSION_MAJOR}::Test
3535
)
@@ -75,7 +75,7 @@ set_tests_properties(TestSlicerService PROPERTIES
7575
add_executable(TestDsTextDocBridgeRoundtrip TestDsTextDocBridgeRoundtrip.cpp)
7676
target_link_libraries(TestDsTextDocBridgeRoundtrip PRIVATE
7777
dstools-domain
78-
dsfw-base
78+
dsfw-core
7979
dstools::shared::bridges
8080
Qt${QT_VERSION_MAJOR}::Test
8181
)

0 commit comments

Comments
 (0)