Files
MeowOS-For-R3P2/patch_v2/reader_app/app/reader_conf.h
T
AskaEth 409fd1edf7 feat(reader): M27 书架按目录分组(ui.shelf_group=folder|format,默认 format 不变)
- 新增 shelf_model.c/.h:扫描/行序列从 shelf.c 拆出(纯 C,宿主可测);shelf_book 加 group[96](相对 Books/ 的目录路径,根下空串),path 语义/内容完全不变(进度键仍为 rdprog_hash(path))
- folder 模式:目录段头(根下=未分类),未分类置顶、其余按目录名排序;组内沿用最近阅读优先/其次书名;空目录不产生段头
- format 模式逐行保持旧行为;新增 reader.conf ui.shelf_group,缺键默认 format
- 上限 256→2048(SHELF_MAX_ROWS=2N=4096,段头≤书数),超限置可读提示,不再静默截断
- 顶栏加「目录/格式」切换,设置页加「书架分组」;UTF-8 安全截断长中文目录名
- 单测 test/shelf_group_smoke.c(38 断言)+ 计时 test/shelf_scan_bench.c
- build_reader.sh:链 meow_ui.a 解析冒烟 stbi_*;无 qemu 时跳过执行而非失败
2026-11-09 21:55:33 +08:00

48 lines
2.0 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* app/reader_conf.h — 阅读器 App 私有配置(reader.conf,key=value 文本)。
*
* 存储域:<TF>/MeowData/os.meow.reader/reader.conf(复用 progress.c 的 meow_config_dir()
* 去皮 /data 派生包根;无 env/宿主回退 /tmp/meowcfg_<pid>/)。不进系统 settings.conf。
*
* 键(本模块常量):
* ui.shelf_layout = list|grid 书架默认布局(shelf.c 读)
* ui.shelf_group = format|folder 书架分段:按格式(默认)或按目录(M27)
* rd.fs = int (14..40) 全局默认字号(无进度书时 reader_open 用)
* rd.ls = int (100..200) 全局默认行距
* rd.bg = auto|black|white|sepia 阅读页底色预设(默认 black;B 定案)
* rd.theme= auto|light|dark 明暗(auto=跟随系统)
* rd.header= 0|1 阅读页顶条(书名+章节名)显隐
* rd.footer= 0|1 阅读页底条(章节+页码)显隐
* rd.font = <路径>|空 字体(进阶;空=resolve_font 自动)
*/
#ifndef READER_CONF_H
#define READER_CONF_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct rdconf {
int fs; /* 默认字号 14..40 */
int ls; /* 默认行距 100..200 */
char bg[8]; /* auto|black|white|sepia */
char theme[8]; /* auto|light|dark */
char shelf[8]; /* list|grid */
char shelf_group[10]; /* format|folder(默认 format=旧行为) */
int header; /* 1=阅读页顶条 */
int footer; /* 1=阅读页底条 */
char font[400]; /* 字体路径(空=自动) */
} rdconf;
/* 惰性载入 + 缓存(首次调用读盘;无档=默认)。返回指向静态副本,勿改字段外部生命周期。 */
rdconf *rdconf_get(void);
/* 把当前缓存写回 reader.conf。0=成功;负值=IO/路径错(不崩)。 */
int rdconf_persist(void);
#ifdef __cplusplus
}
#endif
#endif /* READER_CONF_H */