refactor: 重构项目为 MVC 架构并移除全局变量

- 将原有扁平目录结构重构为 MVC 分层架构:
  * src/core/: 核心业务逻辑(Model),完全独立于 UI 框架
  * src/ui/: 界面组件构建(View),负责纯视觉展示
  * src/controller/: 用户交互处理(Controller),连接数据与界面
  * src/utils/: 底层工具函数,专注于系统调用和字符串处理
- 引入 AppContext 结构体统一管理应用状态,替代原有的全局变量模式
- 重命名并重新组织头文件,按功能模块划分到对应子目录
- 更新 CMakeLists.txt 以适配新的目录结构
- 同步更新 README.md 文档,说明新的架构设计
This commit is contained in:
2026-03-19 20:58:41 +08:00
parent 6509ef98e4
commit a769a6b9b3
30 changed files with 1351 additions and 1243 deletions
+8
View File
@@ -0,0 +1,8 @@
#ifndef DIALOGS_H
#define DIALOGS_H
// 自定义输入对话框
// 返回值:0-取消,1-确认
int custom_input_dialog(const char *title, const char *label_text, char *buffer, int buffer_size);
#endif // DIALOGS_H
+9
View File
@@ -0,0 +1,9 @@
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#include <iup.h>
// 创建主窗口
Ihandle* create_main_window(void);
#endif // MAIN_WINDOW_H
+13
View File
@@ -0,0 +1,13 @@
#ifndef UI_UTILS_H
#define UI_UTILS_H
#include <iup.h>
#include "utils/string_ext.h"
// 刷新单个列表框样式
void refresh_single_list_style(Ihandle *list);
// 同步字符串列表到 UI 列表框
void sync_string_list_to_ui(Ihandle *list_ui, const StringList *str_list);
#endif // UI_UTILS_H