Files
Thing/src-tauri/src/constants.rs
T
2026-09-12 11:05:26 +08:00

82 lines
4.4 KiB
Rust
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.
//! 全局常量集中定义。
//! 窗口 label / Tauri 事件名,避免魔法字符串散布各处。
//! 与前端 `src/lib/constants.ts` 保持对应。
/// 窗口 label(对应 capabilities/*.json 与前端 constants::WINDOWS
pub mod windows {
pub const MAIN: &str = "main";
// 以下窗口由前端创建,Rust 侧仅作双端对应声明(无直接引用)
#[allow(dead_code)]
pub const OSD_OVERLAY: &str = "osd-overlay";
#[allow(dead_code)]
pub const SCREENSHOT_OVERLAY: &str = "screenshot-overlay";
#[allow(dead_code)]
pub const SCREENSHOT_PIN: &str = "screenshot-pin";
#[allow(dead_code)]
pub const SCREENSHOT_SCROLL: &str = "screenshot-scroll";
}
/// Tauri 事件名(与前端 constants::EVENTS 对应)
pub mod events {
// 托盘菜单
pub const TRAY_MENU_SHOW: &str = "tray-menu-show";
pub const TRAY_MENU_STATE_UPDATED: &str = "tray-menu-state-updated";
pub const TRAY_TOGGLE_OSD: &str = "tray:toggle-osd";
pub const TRAY_NEW_DOWNLOAD: &str = "tray:new-download";
pub const TRAY_OPEN_SETTINGS: &str = "tray:open-settings";
// 剪贴板
pub const CLIPBOARD_CHANGED: &str = "clipboard-changed";
pub const CLIPBOARD_POPUP_SHOW: &str = "clipboard-popup-show";
pub const CLIPBOARD_POPUP_HIDE: &str = "clipboard-popup-hide";
pub const CLIPBOARD_PREVIEW_SHOW: &str = "clipboard-preview-show";
pub const CLIPBOARD_PREVIEW_HIDE: &str = "clipboard-preview-hide";
// 快速面板
pub const QUICKPANEL_SHOW: &str = "quickpanel-show";
pub const QUICKPANEL_HIDE: &str = "quickpanel-hide";
pub const QUICKPANEL_EXTRACT_PROGRESS: &str = "quickpanel-extract-progress";
/// 文件索引构建完成(闲时自动建立/重建、手动构建),负载为条目数
pub const QUICKPANEL_INDEX_UPDATED: &str = "quickpanel-index-updated";
// 监控
pub const MONITOR_DATA: &str = "monitor-data";
pub const MONITOR_NETWORK: &str = "monitor-network";
pub const MONITOR_ERROR: &str = "monitor-error";
pub const MONITOR_LOADING: &str = "monitor-loading";
pub const MONITOR_READY: &str = "monitor-ready";
pub const MONITOR_DISCONNECTED: &str = "monitor-disconnected";
// OSD 窗口
pub const OSD_SYSTEM_UI_ACTIVE: &str = "osd-system-ui-active";
pub const OSD_SYSTEM_UI_INACTIVE: &str = "osd-system-ui-inactive";
pub const OSD_GAME_ACTIVE: &str = "osd-game-active";
pub const OSD_GAME_INACTIVE: &str = "osd-game-inactive";
pub const OSD_START_DRAG: &str = "osd-start-drag";
pub const OSD_END_DRAG: &str = "osd-end-drag";
// 截图
pub const SCREENSHOT_SHORTCUT: &str = "screenshot-shortcut";
pub const SCREENSHOT_PIN_SHORTCUT: &str = "screenshot-pin-shortcut";
/// 截图结果导出(含覆盖层/编辑器/滚动截图会话)
pub const SCREENSHOT_EXPORTED: &str = "screenshot-exported";
/// 滚动截图会话:实时进度 { width, height, auto }
pub const SCROLL_PROGRESS: &str = "screenshot-scroll-progress";
/// 滚动截图会话:完成并导出(负载与 SCREENSHOT_EXPORTED 相同)
pub const SCROLL_COMPLETE: &str = "screenshot-scroll-complete";
/// 滚动截图会话:已取消(无负载)
pub const SCROLL_CANCELLED: &str = "screenshot-scroll-cancelled";
// 内核安装进度
pub const KERNEL_INSTALL_PROGRESS: &str = "kernel-install-progress";
// 音乐模块:Python 便携运行时安装进度
pub const MUSIC_RUNTIME_INSTALL_PROGRESS: &str = "music-runtime-install-progress";
// 音乐模块:下载任务事件(桥接事件行 → 前端,负载见 bridge.py _emit_event
pub const MUSIC_DOWNLOAD_EVENT: &str = "music-download-event";
// 后端自动切换节点完成(前端据以刷新节点列表并提示)
pub const PROXY_AUTO_SWITCH: &str = "proxy-auto-switch";
// 应用更新进度
pub const UPDATE_PROGRESS: &str = "update-progress";
// 进程与下载
pub const PROCESS_STATUS_CHANGED: &str = "process-status-changed";
pub const DOWNLOAD_ADDED: &str = "download-added";
/// 任务被删除(浏览器扩展通过 HTTP API 删除任务时发出,前端据此刷新任务列表)
pub const DOWNLOAD_REMOVED: &str = "download-removed";
/// 浏览器扩展通过 HTTP API 新增下载(负载 { id },前端据以为该任务创建专属下载窗口)
pub const DOWNLOAD_EXTENSION_ADDED: &str = "download-extension-added";
}