Files
Thing/src-tauri/src/constants.rs
T

66 lines
3.3 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";
}
/// 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_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 KERNEL_INSTALL_PROGRESS: &str = "kernel-install-progress";
// 后端自动切换节点完成(前端据以刷新节点列表并提示)
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 新增下载(前端需置前主窗口并跳到下载画面)
pub const DOWNLOAD_EXTENSION_ADDED: &str = "download-extension-added";
}