opening trainer: no «0 left» on the summary; «Learned X of Y · learning Z»; S0 shows the repertoire's start; «Switch colour to …» in the menu
This commit is contained in:
parent
f717644b6d
commit
358e1bf08e
5 changed files with 50 additions and 51 deletions
|
|
@ -1119,26 +1119,26 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"Бұл репертуарды оқу мүмкін болмады",
|
||||
],
|
||||
[
|
||||
"Play as Black",
|
||||
"Играть чёрными",
|
||||
"Jouer les Noirs",
|
||||
"Mit Schwarz spielen",
|
||||
"Jugar con negras",
|
||||
"Gioca con il Nero",
|
||||
"Jogar de pretas",
|
||||
"Qora bilan o‘ynash",
|
||||
"Қарамен ойнау",
|
||||
"Switch colour to Black",
|
||||
"Сменить цвет на чёрные",
|
||||
"Passer aux Noirs",
|
||||
"Farbe auf Schwarz wechseln",
|
||||
"Cambiar a negras",
|
||||
"Passa al Nero",
|
||||
"Mudar para pretas",
|
||||
"Rangni qoraga almashtirish",
|
||||
"Түсті қараға ауыстыру",
|
||||
],
|
||||
[
|
||||
"Play as White",
|
||||
"Играть белыми",
|
||||
"Jouer les Blancs",
|
||||
"Mit Weiß spielen",
|
||||
"Jugar con blancas",
|
||||
"Gioca con il Bianco",
|
||||
"Jogar de brancas",
|
||||
"Oq bilan o‘ynash",
|
||||
"Ақпен ойнау",
|
||||
"Switch colour to White",
|
||||
"Сменить цвет на белые",
|
||||
"Passer aux Blancs",
|
||||
"Farbe auf Weiß wechseln",
|
||||
"Cambiar a blancas",
|
||||
"Passa al Bianco",
|
||||
"Mudar para brancas",
|
||||
"Rangni oqqa almashtirish",
|
||||
"Түсті аққа ауыстыру",
|
||||
],
|
||||
[
|
||||
"Lines…",
|
||||
|
|
@ -1482,15 +1482,15 @@ const ROWS: &[[&str; 9]] = &[
|
|||
"{y} жүрістің {x} үйренілді",
|
||||
],
|
||||
[
|
||||
"{k} in progress",
|
||||
"учится: {k}",
|
||||
"{k} en cours",
|
||||
"{k} in Arbeit",
|
||||
"{k} en curso",
|
||||
"{k} in corso",
|
||||
"{k} em andamento",
|
||||
"o‘rganilmoqda: {k}",
|
||||
"үйренілуде: {k}",
|
||||
"learning {k}",
|
||||
"учится {k}",
|
||||
"en cours {k}",
|
||||
"in Arbeit {k}",
|
||||
"en curso {k}",
|
||||
"in corso {k}",
|
||||
"em andamento {k}",
|
||||
"o‘rganilmoqda {k}",
|
||||
"үйренілуде {k}",
|
||||
],
|
||||
[
|
||||
"Add PGN to “{name}”",
|
||||
|
|
|
|||
|
|
@ -1766,12 +1766,11 @@ impl OpeningSessionUi {
|
|||
fn counter(&self, state: &State) -> (String, &'static str) {
|
||||
match &self.kind {
|
||||
SessionKind::Daily => {
|
||||
let left = if matches!(state, State::Summary) && !self.stopped {
|
||||
0
|
||||
} else {
|
||||
self.session.remaining()
|
||||
};
|
||||
(left.to_string(), tr("left"))
|
||||
// A finished session has nothing left: no «0 left» on its summary.
|
||||
if matches!(state, State::Summary) && !self.stopped {
|
||||
return (String::new(), "");
|
||||
}
|
||||
(self.session.remaining().to_string(), tr("left"))
|
||||
}
|
||||
SessionKind::ReviewAll | SessionKind::Branch { .. } => {
|
||||
let k = if self.is_finished() {
|
||||
|
|
|
|||
|
|
@ -1423,11 +1423,11 @@ fn a_daily_session_brings_mistakes_and_hints_back_and_its_numbers_agree() {
|
|||
// e4 wrong, e4 right, Nf3 right, Bb5 right.
|
||||
assert_eq!(independent, 4);
|
||||
f.ui.compute_summary();
|
||||
f.ui.compute_summary();
|
||||
let summary = f.ui.summary.as_ref().unwrap();
|
||||
assert_eq!(summary.more_new, 0);
|
||||
assert!(!summary.next_review.is_empty());
|
||||
assert_eq!(f.ui.counter(&State::Summary).0, "0");
|
||||
// A finished session shows no «0 left».
|
||||
assert_eq!(f.ui.counter(&State::Summary).0, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ static NEXT_JOB: AtomicU64 = AtomicU64::new(1);
|
|||
#[derive(Clone)]
|
||||
struct RowIndex {
|
||||
start: Chess,
|
||||
/// The position a session starts from (S0 shows it, not the library's preview).
|
||||
initial: Chess,
|
||||
last_move: Option<(Square, Square)>,
|
||||
has_moves: bool,
|
||||
}
|
||||
|
|
@ -452,6 +454,7 @@ impl RepertoireUi {
|
|||
r.id.clone(),
|
||||
RowIndex {
|
||||
start: layout::position_of(&game, start),
|
||||
initial: layout::position_of(&game, NodeId::ROOT),
|
||||
last_move: layout::last_move(&game, start),
|
||||
has_moves: !game.children(NodeId::ROOT).is_empty(),
|
||||
},
|
||||
|
|
@ -1103,7 +1106,7 @@ impl RepertoireUi {
|
|||
{
|
||||
let side = layout::side_of(settings, &preparing.id);
|
||||
let index = self.index.get(&preparing.id);
|
||||
let start = index.map(|row| row.start.clone()).unwrap_or_default();
|
||||
let start = index.map(|row| row.initial.clone()).unwrap_or_default();
|
||||
let subtitle = preparing.kind.subtitle(side);
|
||||
let view = PreparingView {
|
||||
name: &preparing.name,
|
||||
|
|
@ -1115,7 +1118,7 @@ impl RepertoireUi {
|
|||
},
|
||||
position: &start,
|
||||
orientation: layout::orientation(side),
|
||||
last_move: index.and_then(|row| row.last_move),
|
||||
last_move: None,
|
||||
lines: preparing.kind != SessionKind::Daily,
|
||||
};
|
||||
for action in show_preparing(ui, settings, &mut self.board, &view) {
|
||||
|
|
@ -2433,8 +2436,8 @@ fn main_button(state: &CardState, side: LearningSide) -> (String, bool, Option<M
|
|||
CardState::Empty => (tr("Add PGN…").to_owned(), true, Some(MenuItem::AddPgn)),
|
||||
CardState::OtherColor => (
|
||||
match side {
|
||||
LearningSide::White => tr("Play as Black"),
|
||||
LearningSide::Black => tr("Play as White"),
|
||||
LearningSide::White => tr("Switch colour to Black"),
|
||||
LearningSide::Black => tr("Switch colour to White"),
|
||||
}
|
||||
.to_owned(),
|
||||
true,
|
||||
|
|
@ -2474,15 +2477,12 @@ fn progress(ui: &mut Ui, stats: Option<&RowStats>) {
|
|||
(stats.learnt, stats.total, stats.learning)
|
||||
});
|
||||
if stats.is_some() {
|
||||
layout::line(
|
||||
ui,
|
||||
trf("Learned {x} of {y} moves", &[("x", &learnt), ("y", &total)]),
|
||||
);
|
||||
}
|
||||
if learning > 0 {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
ui.label(RichText::new(trf("{k} in progress", &[("k", &learning)])).weak());
|
||||
});
|
||||
let mut text = trf("Learned {x} of {y} moves", &[("x", &learnt), ("y", &total)]);
|
||||
// The bar's second segment, named where the bar is read.
|
||||
if learning > 0 {
|
||||
text = format!("{text} · {}", trf("learning {k}", &[("k", &learning)]));
|
||||
}
|
||||
layout::line(ui, text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -2509,8 +2509,8 @@ fn menu_items(
|
|||
ui,
|
||||
true,
|
||||
match side {
|
||||
LearningSide::White => tr("Play as Black"),
|
||||
LearningSide::Black => tr("Play as White"),
|
||||
LearningSide::White => tr("Switch colour to Black"),
|
||||
LearningSide::Black => tr("Switch colour to White"),
|
||||
},
|
||||
MenuItem::SwitchColor,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ fn the_card_says_what_to_do_in_every_state() {
|
|||
assert!(!main_button(&CardState::Counting, LearningSide::White).1);
|
||||
assert_eq!(
|
||||
main_button(&CardState::OtherColor, LearningSide::White).0,
|
||||
tr("Play as Black")
|
||||
tr("Switch colour to Black")
|
||||
);
|
||||
assert_eq!(
|
||||
card_texts(&CardState::Review { due: 3, new: 10 }, LearningSide::White),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue