2026-02-05 06:13:27 +00:00
|
|
|
|
Host 121.196.200.148
|
|
|
|
|
|
HostName 121.196.200.148
|
|
|
|
|
|
Port 2222
|
|
|
|
|
|
User git
|
2026-02-05 06:21:57 +00:00
|
|
|
|
IdentityFile C:\Users\Klein\.ssh\id_rsa_kylin_Klein
|
|
|
|
|
|
|
2026-02-05 07:06:31 +00:00
|
|
|
|
在将 `ku2d-hmi` 转化为 Qt 工程的过程中,第一步“环境搭建与 CMake 改造”决定了后续开发的底层逻辑。其核心目标是:**在保留原有业务逻辑编译能力的基础上,引入 Qt 的构建套件。**
|
2026-02-05 06:21:57 +00:00
|
|
|
|
|
2026-02-05 07:06:31 +00:00
|
|
|
|
以下是该阶段的大方向实施步骤:
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
### 1. 开发环境基准对齐
|
|
|
|
|
|
|
|
|
|
|
|
在进行代码改动前,必须确保编译器与 Qt 库的版本兼容。
|
|
|
|
|
|
|
|
|
|
|
|
* **编译器确认**:根据 Qt 版本选择合适的 C++ 标准(Qt 6 建议使用 C++17 或更高)。
|
|
|
|
|
|
* **Qt 插件安装**:安装 Qt 本身及其对应的构建工具(如 Ninja 或 Make)。
|
|
|
|
|
|
* **IDE 准备**:配置 VS Code (配合 CMake 插件) 或 Qt Creator,使其能够正确识别项目的 `CMakeLists.txt`。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
### 2. 核心逻辑的“库化”分离
|
|
|
|
|
|
|
|
|
|
|
|
为了不破坏原有的业务逻辑,需在构建层面将“计算逻辑”与“界面展示”解耦。
|
|
|
|
|
|
|
|
|
|
|
|
* **创建 Core 静态库**:修改 `src/CMakeLists.txt`,将 `protocol`, `business`, `infra`, `transport` 等非 UI 目录打包成一个名为 `ku2d_core` 的静态库。
|
|
|
|
|
|
* **清理依赖关系**:确保 `ku2d_core` 仅依赖 Protobuf、YAML-CPP 等基础库,而不依赖任何 Qt 组件。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
### 3. 根目录 CMake 配置“Qt 化”
|
|
|
|
|
|
|
|
|
|
|
|
在顶级 `CMakeLists.txt` 中注入 Qt 的生命周期管理逻辑。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* **声明 Qt 依赖**:使用 `find_package` 指令显式引入 `Qt6` 的 `Core`, `Widgets`, `Gui` 模块。
|
|
|
|
|
|
* **开启自动处理机制**:
|
|
|
|
|
|
* `set(CMAKE_AUTOMOC ON)`:处理 Qt 信号槽宏。
|
|
|
|
|
|
* `set(CMAKE_AUTOUIC ON)`:处理 `.ui` 界面文件。
|
|
|
|
|
|
* `set(CMAKE_AUTORCC ON)`:处理图标等资源文件。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
### 4. 创建 Qt 专用可执行程序目标
|
|
|
|
|
|
|
|
|
|
|
|
在 `src/app` 或新建的 UI 目录中,定义新的构建目标。
|
|
|
|
|
|
|
|
|
|
|
|
* **定义可执行文件**:创建一个新的编译目标(如 `ku2d-gui`),将其源文件指向新的 Qt `main.cpp` 和 UI 类。
|
|
|
|
|
|
* **执行目标链接**:将该目标与 `ku2d_core` 库以及 `Qt6::Widgets` 等库进行链接(Target Link Libraries)。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
### 5. 入口函数重定向
|
|
|
|
|
|
|
|
|
|
|
|
将程序的控制权从原有的 C++ 循环移交给 Qt 事件循环。
|
|
|
|
|
|
|
|
|
|
|
|
* **主入口切换**:废弃原有的 `src/main.cpp` 启动逻辑,编写符合 Qt 规范的 `QApplication` 启动代码。
|
|
|
|
|
|
* **后台线程初始化**:在 Qt 启动前,确保原有的后端 `Coordinator` 能在非主线程中正确初始化。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
### 6. 环境冒烟测试
|
|
|
|
|
|
|
|
|
|
|
|
验证构建系统是否闭环。
|
|
|
|
|
|
|
|
|
|
|
|
* **编译验证**:尝试执行 CMake Configure 和 Build,确保没有因库冲突导致的链接错误。
|
|
|
|
|
|
* **空窗运行**:启动程序,若能成功弹出一个空白的 `QMainWindow` 且后台日志正常滚动,则表示第一步环境搭建完成。
|
2026-02-05 06:21:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
// ==================== [ 核心功能与安全 ] ====================
|
|
|
|
|
|
// 文件自动保存 - 延迟后自动保存
|
|
|
|
|
|
"files.autoSave": "afterDelay",
|
|
|
|
|
|
// 自动检测文件编码
|
|
|
|
|
|
"files.autoGuessEncoding": true,
|
|
|
|
|
|
// 保存时删除行尾空格
|
|
|
|
|
|
"files.trimTrailingWhitespace": true,
|
|
|
|
|
|
// 文件末尾插入最终换行符
|
|
|
|
|
|
"files.insertFinalNewline": true,
|
|
|
|
|
|
// 删除文件末尾多余换行符
|
|
|
|
|
|
"files.trimFinalNewlines": true,
|
|
|
|
|
|
// ==================== [ 代码格式化与缩进 (强制 4 空格) ] ====================
|
|
|
|
|
|
// 强制使用空格进行缩进
|
|
|
|
|
|
"editor.insertSpaces": true,
|
|
|
|
|
|
// 强制设置缩进宽度为 4 个空格
|
|
|
|
|
|
"editor.tabSize": 4,
|
|
|
|
|
|
// 禁用自动检测,以确保 4 个空格的全局设置覆盖所有文件 (从 true 修正为 false,以确保强制执行)
|
|
|
|
|
|
"editor.detectIndentation": true,
|
|
|
|
|
|
// 启用保存时自动格式化
|
|
|
|
|
|
"editor.formatOnSave": true,
|
|
|
|
|
|
// ==================== [ 编辑器可视化与人体工学优化 ] ====================
|
|
|
|
|
|
// **字体系列:** 整合新设置,并保留中文字体后备
|
|
|
|
|
|
"editor.fontFamily": "JetBrains Mono",
|
|
|
|
|
|
// 字体大小 (统一为 18)
|
|
|
|
|
|
"editor.fontSize": 16,
|
|
|
|
|
|
// 行高 (来自新设置,提升可读性)
|
|
|
|
|
|
"editor.lineHeight": 26,
|
|
|
|
|
|
// 字间距 (来自新设置,缓解视觉疲劳)
|
|
|
|
|
|
"editor.letterSpacing": 0.7,
|
|
|
|
|
|
// 启用字体连字 (来自笔记本设置)
|
|
|
|
|
|
"editor.fontLigatures": true,
|
|
|
|
|
|
// 显示空格/制表符边界:设置为 all 以便查看 4 个点表示一个制表符
|
|
|
|
|
|
"editor.renderWhitespace": "all",
|
|
|
|
|
|
// 启用缩进引导线(即制表位上的竖线)
|
|
|
|
|
|
"editor.guides.indentation": true,
|
|
|
|
|
|
// 行状光标更容易定位 (来自新设置)
|
|
|
|
|
|
"editor.cursorStyle": "line",
|
|
|
|
|
|
// 平滑闪烁,减少视觉疲劳 (来自新设置)
|
|
|
|
|
|
"editor.cursorBlinking": "smooth",
|
|
|
|
|
|
// 平滑滚动 (来自新设置)
|
|
|
|
|
|
"editor.smoothScrolling": true,
|
|
|
|
|
|
// 高亮活动括号对 (来自新设置)
|
|
|
|
|
|
"editor.guides.bracketPairs": "active",
|
|
|
|
|
|
// 显示标尺线
|
|
|
|
|
|
"editor.rulers": [
|
|
|
|
|
|
100,
|
|
|
|
|
|
120
|
|
|
|
|
|
],
|
|
|
|
|
|
// 禁用自动换行
|
|
|
|
|
|
"editor.wordWrap": "off",
|
|
|
|
|
|
// 启用 Tab 补全
|
|
|
|
|
|
"editor.tabCompletion": "on",
|
|
|
|
|
|
// 启用内联建议
|
|
|
|
|
|
"editor.inlineSuggest.enabled": true,
|
|
|
|
|
|
// ==================== [ 工作台与界面 ] ====================
|
|
|
|
|
|
// 禁用预览模式 (来自笔记本设置)
|
|
|
|
|
|
"workbench.editor.enablePreview": true,
|
|
|
|
|
|
// 快速打开时禁用预览
|
|
|
|
|
|
"workbench.editor.enablePreviewFromQuickOpen": false,
|
|
|
|
|
|
// 始终显示缩略图滑块 (来自笔记本设置)
|
|
|
|
|
|
"editor.minimap.showSlider": "always",
|
|
|
|
|
|
// 只显示单个标签页
|
|
|
|
|
|
"workbench.editor.showTabs": "multiple",
|
|
|
|
|
|
// 隐藏空编辑器提示
|
|
|
|
|
|
"workbench.editor.empty.hint": "hidden",
|
|
|
|
|
|
// 颜色主题:默认采用新设置的 Monokai,如果喜欢 Dracular 请自行修改
|
|
|
|
|
|
"workbench.colorTheme": "Monokai",
|
|
|
|
|
|
// 启动时不打开编辑器
|
|
|
|
|
|
"workbench.startupEditor": "none",
|
|
|
|
|
|
// 文件图标主题
|
|
|
|
|
|
"workbench.iconTheme": "vs-seti",
|
|
|
|
|
|
// 文件树缩进
|
|
|
|
|
|
"workbench.tree.indent": 24,
|
|
|
|
|
|
// 文件树渲染缩进引导线
|
|
|
|
|
|
"workbench.tree.renderIndentGuides": "always",
|
|
|
|
|
|
// ==================== [ 终端配置 ] ====================
|
|
|
|
|
|
// 终端字体系列 (来自新设置)
|
|
|
|
|
|
"terminal.integrated.fontFamily": "Consolas",
|
|
|
|
|
|
// 终端字体大小 (统一为 16)
|
|
|
|
|
|
"terminal.integrated.fontSize": 16,
|
|
|
|
|
|
// 终端行高 (来自新设置)
|
|
|
|
|
|
"terminal.integrated.lineHeight": 1.4,
|
|
|
|
|
|
// 终端平滑滚动 (来自笔记本设置)
|
|
|
|
|
|
"terminal.integrated.smoothScrolling": true,
|
|
|
|
|
|
// 终端光标样式
|
|
|
|
|
|
"terminal.integrated.cursorStyle": "line",
|
|
|
|
|
|
// 选择时自动复制 (来自笔记本设置)
|
|
|
|
|
|
"terminal.integrated.copyOnSelection": true,
|
|
|
|
|
|
// 右键粘贴 (来自笔记本设置)
|
|
|
|
|
|
"terminal.integrated.rightClickBehavior": "paste",
|
|
|
|
|
|
// 终端配置文件(保留 Windows 特定配置)
|
|
|
|
|
|
"terminal.integrated.profiles.windows": {
|
|
|
|
|
|
"PowerShell": {
|
|
|
|
|
|
"source": "PowerShell",
|
|
|
|
|
|
"icon": "terminal-powershell"
|
|
|
|
|
|
},
|
|
|
|
|
|
"Command Prompt": {
|
|
|
|
|
|
"path": [
|
|
|
|
|
|
"${env:windir}\\Sysnative\\cmd.exe",
|
|
|
|
|
|
"${env:windir}\\System32\\cmd.exe"
|
|
|
|
|
|
],
|
|
|
|
|
|
"args": [],
|
|
|
|
|
|
"icon": "terminal-cmd"
|
|
|
|
|
|
},
|
|
|
|
|
|
"Git Bash": {
|
|
|
|
|
|
"source": "Git Bash"
|
|
|
|
|
|
},
|
|
|
|
|
|
// 保留 PowerShell 7 路径,但建议使用 'source'
|
|
|
|
|
|
"PowerShell 7 (pwsh)": {
|
|
|
|
|
|
"path": "D:\\Software\\PowerShell\\7\\pwsh.exe",
|
|
|
|
|
|
"args": []
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// ==================== [ 扩展与 AI 助手 ] ====================
|
|
|
|
|
|
// Copilot 启用状态 (保留笔记本设置)
|
|
|
|
|
|
"github.copilot.enable": {
|
|
|
|
|
|
"*": true,
|
|
|
|
|
|
"plaintext": false,
|
|
|
|
|
|
"markdown": true,
|
|
|
|
|
|
"scminput": false,
|
|
|
|
|
|
"c": true,
|
|
|
|
|
|
"cpp": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"github.copilot.chat.codesearch.enabled": true,
|
|
|
|
|
|
"github.copilot.nextEditSuggestions.enabled": true,
|
|
|
|
|
|
// DeepSeek 语言设置 (保留,但密钥和 URL 已移除)
|
|
|
|
|
|
"deepseek.lang": "cn",
|
|
|
|
|
|
// Emmet 启用 Tab 展开 (保留)
|
|
|
|
|
|
"emmet.triggerExpansionOnTab": true,
|
|
|
|
|
|
// ==================== [ 性能与杂项优化 ] ====================
|
|
|
|
|
|
// 文件资源管理器不确认删除/拖放
|
|
|
|
|
|
"explorer.confirmDelete": false,
|
|
|
|
|
|
"explorer.confirmDragAndDrop": false,
|
|
|
|
|
|
"explorer.confirmPasteNative": false,
|
|
|
|
|
|
// Git 自动拉取
|
|
|
|
|
|
"git.autofetch": true,
|
|
|
|
|
|
// ==================== [ 语言特定设置 ] ====================
|
|
|
|
|
|
"[json]": {
|
|
|
|
|
|
"editor.defaultFormatter": "vscode.json-language-features",
|
|
|
|
|
|
"editor.formatOnSave": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"[jsonc]": {
|
|
|
|
|
|
"editor.defaultFormatter": "vscode.json-language-features",
|
|
|
|
|
|
"editor.formatOnSave": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"[javascript]": {
|
|
|
|
|
|
"editor.defaultFormatter": "vscode.typescript-language-features",
|
|
|
|
|
|
"editor.formatOnSave": true,
|
|
|
|
|
|
"editor.codeActionsOnSave": {
|
|
|
|
|
|
"source.organizeImports": "explicit"
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"[typescript]": {
|
|
|
|
|
|
"editor.defaultFormatter": "vscode.typescript-language-features",
|
|
|
|
|
|
"editor.formatOnSave": true,
|
|
|
|
|
|
"editor.codeActionsOnSave": {
|
|
|
|
|
|
"source.organizeImports": "explicit"
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"[html]": {
|
|
|
|
|
|
"editor.defaultFormatter": "vscode.html-language-features",
|
|
|
|
|
|
"editor.formatOnSave": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"[css]": {
|
|
|
|
|
|
"editor.defaultFormatter": "vscode.css-language-features",
|
|
|
|
|
|
"editor.formatOnSave": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"[markdown]": {
|
|
|
|
|
|
"editor.defaultFormatter": "yzhang.markdown-all-in-one",
|
|
|
|
|
|
"editor.formatOnSave": false
|
|
|
|
|
|
},
|
|
|
|
|
|
"markdown-preview-enhanced.previewTheme": "github-light.css",
|
|
|
|
|
|
"geminicodeassist.project": "peta-tea-jrc5w",
|
|
|
|
|
|
"chat.tools.terminal.autoApprove": {
|
|
|
|
|
|
"git add": true,
|
|
|
|
|
|
"/^Get-Command ninja -ErrorAction SilentlyContinue \\| Format-List; Get-Command cl -ErrorAction SilentlyContinue \\| Format-List; Get-Command nvcc -ErrorAction SilentlyContinue \\| Format-List$/": {
|
|
|
|
|
|
"approve": true,
|
|
|
|
|
|
"matchCommandLine": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"docker build": true
|
|
|
|
|
|
},
|
|
|
|
|
|
"[cpp]": {
|
|
|
|
|
|
"files.encoding": "utf8bom"
|
|
|
|
|
|
},
|
|
|
|
|
|
"[c]": {
|
|
|
|
|
|
"files.encoding": "utf8bom"
|
|
|
|
|
|
},
|
|
|
|
|
|
"[h]": {
|
|
|
|
|
|
"files.encoding": "utf8bom"
|
|
|
|
|
|
},
|
|
|
|
|
|
"terminal.integrated.shellArgs.windows": [
|
|
|
|
|
|
"/k",
|
|
|
|
|
|
"chcp 65001"
|
|
|
|
|
|
],
|
|
|
|
|
|
"powershell.promptToUpdatePowerShell": false,
|
|
|
|
|
|
"jdk.telemetry.enabled": true,
|
|
|
|
|
|
"gitlens.ai.model": "vscode",
|
|
|
|
|
|
"gitlens.ai.vscode.model": "copilot:gpt-5-mini",
|
|
|
|
|
|
"security.workspace.trust.untrustedFiles": "open",
|
|
|
|
|
|
"remote.SSH.remotePlatform": {
|
|
|
|
|
|
"aliyun-dev-host": "linux",
|
|
|
|
|
|
"home-dev-server": "linux"
|
|
|
|
|
|
},
|
|
|
|
|
|
"Lingma.aI Chat.commandAllowlistInAgentMode": "",
|
|
|
|
|
|
"http.proxy": "http://127.0.0.1:7897",
|
|
|
|
|
|
"makefile.configureOnOpen": true,
|
|
|
|
|
|
"cmake.showOptionsMovedNotification": false,
|
|
|
|
|
|
"cmake.pinnedCommands": [
|
|
|
|
|
|
"workbench.action.tasks.configureTaskRunner",
|
|
|
|
|
|
"workbench.action.tasks.runTask"
|
|
|
|
|
|
],
|
|
|
|
|
|
"terminal.integrated.enableMultiLinePasteWarning": "auto",
|
|
|
|
|
|
"cmake.configureOnOpen": false,
|
|
|
|
|
|
"git.confirmSync": false,
|
|
|
|
|
|
"python.analysis.typeCheckingMode": "standard",
|
|
|
|
|
|
"diffEditor.codeLens": true,
|
|
|
|
|
|
"gopls": {},
|
|
|
|
|
|
"workbench.settings.applyToAllProfiles": [],
|
|
|
|
|
|
"chat.agent.maxRequests": 100,
|
|
|
|
|
|
"go.testTags": "integration",
|
|
|
|
|
|
"editor.codeActionsOnSave": {},
|
|
|
|
|
|
"roo-cline.allowedCommands": [
|
|
|
|
|
|
"git log",
|
|
|
|
|
|
"git diff",
|
|
|
|
|
|
"git show"
|
|
|
|
|
|
],
|
|
|
|
|
|
"roo-cline.deniedCommands": [],
|
|
|
|
|
|
"http.systemCertificatesNode": true,
|
|
|
|
|
|
"geminicodeassist.inlineSuggestions.enableAuto": false,
|
|
|
|
|
|
"Lingma.aI Chat.webToolsInAsk/AgentMode": "Ask every time",
|
|
|
|
|
|
"workbench.secondarySideBar.showLabels": false,
|
|
|
|
|
|
"git.openRepositoryInParentFolders": "never",
|
|
|
|
|
|
"markdown-preview-enhanced.codeBlockTheme": "vue.css",
|
|
|
|
|
|
"window.customTitleBarVisibility": "windowed",
|
|
|
|
|
|
"chatgpt.localeOverride": "zh-CN",
|
|
|
|
|
|
"chatgpt.runCodexInWindowsSubsystemForLinux": false,
|
|
|
|
|
|
"chat.viewSessions.orientation": "stacked",
|
|
|
|
|
|
}
|