Opponent prep: which games by period or number, saved preparations

The report takes all the player's games, those of the last 1/2/5 years
before his newest game, or his last 50/100/200 of each colour; every
choice shows how many games it takes. Undated games count only with all.
«💾 Save» keeps a preparation with its errors in the program's data;
«📑 Preparations» in the library opens, renames and deletes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-31 18:11:58 +03:00
parent 1ac5645ef7
commit 57fa98241b
12 changed files with 1334 additions and 37 deletions

View file

@ -87,6 +87,8 @@ pub enum LibraryAction {
path: PathBuf,
index: usize,
},
/// «📑 Preparations»: the saved preparations against opponents.
Preparations,
/// «Prepare against…» for a player of this database (opponent-prep.md §2).
PrepareAgainst {
path: PathBuf,
@ -148,11 +150,24 @@ fn shelf_buttons_w(ui: &Ui, update: Option<&str>, icons: bool) -> f32 {
]
};
let play = crate::platform::CAPS.play;
let groups = if play { 2.0 } else { 1.0 };
let prep = crate::platform::CAPS.prep;
let groups = 1.0 + f32::from(u8::from(play)) + f32::from(u8::from(prep));
texts[..if play { 4 } else { 3 }]
.iter()
.map(|t| button_w(ui, t))
.sum::<f32>()
+ if prep {
button_w(
ui,
if icons {
"📑"
} else {
tr("📑 Preparations")
},
)
} else {
0.0
}
+ update.map_or(0.0, |v| button_w(ui, v))
+ groups * GROUP_GAP
}
@ -792,6 +807,25 @@ impl Library {
ui.separator();
self.play_button(ui, icons, actions);
}
if crate::platform::CAPS.prep {
ui.separator();
let label = if icons {
"📑"
} else {
tr("📑 Preparations")
};
if ui
.button(label)
.on_hover_text(shelf_hint(
icons,
tr("📑 Preparations"),
tr("Preparations against opponents: the saved ones and a new one"),
))
.clicked()
{
actions.push(LibraryAction::Preparations);
}
}
}
/// "♞ Play": a game against Maia, a group of its own.