บทที่ 9 ไฟล์การตั้งค่า
บทที่ 9 ไฟล์การตั้งค่า
ข้อมูลผู้ใช้ของ wxreader ทั้งหมดอยู่รวมในไดเรกทอรีเดียว แยกจาก wxterm / wxeditor โดยสิ้นเชิง:
| แพลตฟอร์ม | ไดเรกทอรีข้อมูล |
|---|---|
| Linux / FreeBSD | ~/.wxreader/ |
| macOS | ~/Library/Application Support/wxreader/ |
| Windows | %APPDATA%\wxreader\ |
9.1 ไฟล์ทั้งหมด
| ไฟล์ | การใช้งาน |
|---|---|
data.dat |
ฐานข้อมูล SQLite ของคลังหนังสือ (โหมด WAL): ตาราง shelf / books / notes / mark |
cover/{book-id}.png |
แคชปก (240×320) |
settings.json |
การตั้งค่าทั้งหมด: options (ธีม/ภาษา/ฟอนต์ UI/การสลับธีม/ภาพพื้นหลัง) + editor (สไตล์ตัวอ่านในโหนด reader) |
logs/app_{date}.log |
บันทึกล็อกการทำงานแบบหมุนเวียนตามวันที่ (ใช้ตรวจสอบเมื่อมีปัญหา) |
9.2 โครงสร้าง data.dat
| ตาราง | คอลัมน์ |
|---|---|
| shelf | id, name (unique), added_time, sort_order (ลำดับจากการลาก) |
| books | id, shelf_id (0 = ไม่ได้จัดกลุ่ม), title, path (unique, คีย์ลบรายการซ้ำ), cover, added_time, last_read, read_seconds, progress, favorite, author, format, note |
| notes | id, book_id, page, selected_text, note_content, added_time |
| mark | id, book_id, page, selected_text, added_time |
ค่าของ format: pdf / epub / mobi (รวม azw3, prc) / md / txt / chm / img (โฟลเดอร์การ์ตูน)
9.3 โครงสร้าง settings.json
{
"options": {
"theme": "Tokyo Night",
"lang": "th",
"themeFontFamily": "Noto Sans Thai",
"themeFontSize": 12,
"themeSwitchMode": "by-time",
"uiDarkTheme": "Dark",
"uiLightTheme": "Light",
"darkThemeStartTime": "19:00",
"lightThemeStartTime": "07:00",
"backgroundImage": "/path/to/img.jpg",
"backgroundImageMode": 2,
"backgroundImageOpacity": 0.3
},
"editor": {
"reader": {
"fontSize": 18,
"lineHeight": 1.5,
"paraSpacing": 1.0,
"textAlign": 0,
"invert": false,
"brightness": 1.0,
"autoScroll": false,
"scrollInterval": 3,
"viewMode": 0
}
}
}
9.4 ความหมายของความคืบหน้า
books.progress (นับจาก 1) มีความหมายต่างกันตามรูปแบบ:
| format | ความหมายของ progress |
|---|---|
| epub / mobi / md / txt | หมายเลขบท |
| หมายเลขหน้า | |
| img | ลำดับภาพในลำดับการอ่านแบบรีเคอร์ซีฟ |
| chm | เป็น 1 เสมอ |
read_seconds คือเวลาอ่านสะสมเป็นวินาที (+60 ทุก 60 วินาทีขณะหน้าต่างตัวอ่านยังเปิดอยู่)