refactor(app-iced, presenter): M114 rebase 后守 400 行 —— 四处纯搬移(不动语义、不压注释、不挪断言)
主线六条合入后,四个被我碰过的文件越过 400 行;按模块拆开,只搬不改: - `presenter/host/mod.rs` 421→366:账户刷新/皮肤三段(refresh_accounts / attach_skins / request_skins)搬进 `host/accounts/refresh.rs`(`impl CoreHost`,pub(in crate::host)) - `presenter/state.rs` 410→392:`TileCell` + `grid_positions` 搬进 `state/tiles.rs`, `state.rs` 用 `pub use` 再导出,老路径不变 - `app-iced/app/state.rs` 401→394:账户页重建那一段搬进 `app/view/account_page.rs` 的 `App::rebuild_account_page` - `app-iced/app/update.rs` 407→388:`ULL_START_ROUTE` 取值表搬进 `app/update/boot_env.rs` (纯函数、无状态)
This commit is contained in:
1 parent
0f69eec64d
commit
a183adc072
12 files changed
+210
-120
No files matched your search
@@ -7,9 +7,24 @@ use crate::agent::AgentRail;
|
||||
use crate::dialogs::DialogQueue;
|
||||
use crate::dto::{
|
||||
// 主线(M105 的 `LoaderKind` / M113 的 `PackState`)与 M114 的 `AuthlibLoginView` 并集。
|
||||
AccountView, AgentEvent, AppEvent, AuthlibLoginView, CoreEvent, DeviceLoginView,
|
||||
DiagnosisReport, InstallProgressView, InstanceRuntime, InstanceSummary, JavaPageView,
|
||||
LoaderKind, LogLine, LogSession, NoticeView, PackState, Progress, SettingGroupView,
|
||||
AccountView,
|
||||
AgentEvent,
|
||||
AppEvent,
|
||||
AuthlibLoginView,
|
||||
CoreEvent,
|
||||
DeviceLoginView,
|
||||
DiagnosisReport,
|
||||
InstallProgressView,
|
||||
InstanceRuntime,
|
||||
InstanceSummary,
|
||||
JavaPageView,
|
||||
LoaderKind,
|
||||
LogLine,
|
||||
LogSession,
|
||||
NoticeView,
|
||||
PackState,
|
||||
Progress,
|
||||
SettingGroupView,
|
||||
VersionSummary,
|
||||
};
|
||||
use crate::prefs::UiPrefs;
|
||||
@@ -25,27 +40,9 @@ use crate::wizard::WizardState;
|
||||
// 所以这里没有 `mod ai;` / `pub use ai::AiSession;`——M114 r1 曾把旧结构搬到 `state/ai.rs`,
|
||||
// 该文件已随 rebase 删除,**以 main 的 agent 契约为准**。
|
||||
mod accounts;
|
||||
mod tiles;
|
||||
|
||||
/// 磁贴网格单元:位置由 [`grid_positions`] 算好,UI 侧只消费 row/col。
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct TileCell<'a> {
|
||||
/// 实例数据
|
||||
pub instance: &'a InstanceSummary,
|
||||
/// 网格行号(0 起)
|
||||
pub row: usize,
|
||||
/// 网格列号(0 起)
|
||||
pub col: usize,
|
||||
}
|
||||
|
||||
/// 纯函数:把 n 个磁贴摊到 `columns` 列的网格上,返回 `(row, col)`。
|
||||
///
|
||||
/// 特意放在 Rust 侧:声明式 UI 的表达式里做整数除法容易引出隐式浮点,且这段逻辑可以单测。
|
||||
pub fn grid_positions(count: usize, columns: usize) -> Vec<(usize, usize)> {
|
||||
let columns = columns.max(1);
|
||||
(0..count)
|
||||
.map(|index| (index / columns, index % columns))
|
||||
.collect()
|
||||
}
|
||||
pub use tiles::{grid_positions, TileCell};
|
||||
|
||||
/// 实时日志最多保留的行数(滚动窗口;更多行由日志页的筛选/历史会话承担)。
|
||||
pub const MAX_LIVE_LINES: usize = 2_000;
|
||||
|
||||
Reference in new issue
Block a user