feat(files): 新增外置系统文件管理器 os.meow.files (agent-183) — 目录浏览(虚拟化列表/空态)+文本预览(≤256KB截断)+删除/重命名/新建/属性(BottomSheet+IME);路径写操作限 TF 卡内(拒 .. 越界);多文件结构(app.c+ui/{browser,viewer}.c+ui/common/chrome.c+logic/fsx.c) 按批次②范本

files md5 6f6b0a6d; 0 warning; 宿主 test_fsx 全过(路径安全/格式化/排序/虚拟化/写操作/文本嗅探); qemu 离屏冒烟通过
SDK 缺口记录: listview 仅单行 label(本 App 用 custom 画布自绘行); common 档字库中文缺字(未声明 fonts:full)
真机待验证: 列表渲染/滚动手感/IME 重命名/弹窗交互
This commit is contained in:
MeowOS committed 2026-08-31 04:03:56 +08:00
1 parent b5038f8673
commit c187b7bce3
12 files changed
+1741

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
/* files_internal.h — files 应用内部共享头(UI 各页 + app 装配层 + 宿主测试面)。
*
* 层级(对齐 hello_app 的批次②拆分规范):
* - ui/browser.c 目录浏览页(ACT_BROWSER,根页):列表虚拟化渲染 + 进/退目录 + 行操作
* - ui/viewer.c 文本预览页(ACT_VIEWER,子页):只读、可滚动、≤256KB 截断
* - ui/common/chrome.c 共享 chrome(TopAppBar 建置 / 内容区几何 / 空态/页脚绘制)
* - logic/fsx.* 纯业务(路径安全/格式化/枚举/写操作),不依赖 meow_ui
* - app.c main + 装配 + 事件分发(把 meow_ui_run 的平铺回调路由到各页)
*
* 页面生命周期用 meow_view_page_push/pop 驱动 on_enter/on_leave;目录进退不换页(留在 browser
* 页改 cur_dir 重扫)。物理键不映射(§3.4.1):本 App 不做任何 on_key 映射,返回=左缘手势/返回钮/
* request_exit。
*/
#ifndef FILES_INTERNAL_H
#define FILES_INTERNAL_H
#include <stdint.h>
#include "meow_ui.h"
#include "meow_ui_view.h"
#include "logic/fsx.h"
/* ---- Activity 归属(§6.1 ①)---- */
#define ACT_BROWSER 0
#define ACT_VIEWER 1
/* ---- 布局 ---- */
#define APP_W 480
#define APP_H 720
#define APP_TOPBAR_H 56
#define APP_ROW_H 56 /* 列表行高 */
#define APP_PAD 16
#define APP_ICON_W 26 /* 图标占宽 */
#define APP_OP_W 52 /* 右侧操作钮占宽(触达区) */
#define APP_FOOTER_H 26 /* 底部信息行高(列表/文本内容在其之上滚动) */
#define APP_READ_MAX (256 * 1024) /* 文本预览读取上限 */
/* ---- App 级复用矩形/几何 ---- */
typedef struct { int x, y, w, h; } app_rect_t;
#define AR(x,y,w,h) ((app_rect_t){ (x),(y),(w),(h) })
/* ---- chrome(ui/common/chrome.c)---- */
int app_statusbar(void); /* 状态栏高度 inset(0=无) */
app_rect_t app_topbar_rect(void); /* 顶部栏几何(含状态栏偏移) */
app_rect_t app_content_rect(void); /* topbar 之下 → 屏底(列表/文本内容区) */
/* 建 topbar(owner=当前活动:调用方须在正确 activity 下建);返回 widget 供命中/置顶。 */
meow_widget *app_topbar_create(const char *title, int back, const char *action_label);
void app_draw_empty(app_rect_t r, const char *kind, const char *what); /* 空态/错误居中 */
void app_draw_footer(app_rect_t r, const char *text); /* 底部信息(项数/路径) */
/* ---- browser 页(ui/browser.c)---- */
meow_view *browser_view_create(void);
int browser_is_active(void);
int browser_on_tap(int x, int y); /* 1=已消费 */
void browser_swipe(int dir, int dist);
void browser_touch_down(int x, int y);
void browser_touch_move(int x, int y);
void browser_tick(uint64_t now);
int browser_go_up(void); /* 1=回到上级;0=已在根(未动作) */
int browser_at_root(void);
void browser_reload(void);
const char *browser_current_dir(void);
int browser_entry_count(void); /* 宿主测试:当前目录项数 */
/* ---- viewer 页(ui/viewer.c)---- */
meow_view *viewer_view_create(void);
int viewer_is_active(void);
int viewer_open_file(const char *path); /* 读文件+进预览页;0=成功 */
void viewer_swipe(int dir, int dist);
void viewer_touch_down(int x, int y);
void viewer_touch_move(int x, int y);
int viewer_on_tap(int x, int y);
void viewer_load(const char *path); /* 宿主测试:读入 buffer 并解析行 */
#endif /* FILES_INTERNAL_H */