Add shortcut to reload database and/or library #116

Merged
wojtek merged 14 commits from 105---add-shortcut-to-reload-database-and/or-library into main 2024-02-03 14:32:13 +01:00
2 changed files with 5 additions and 6 deletions
Showing only changes of commit 9ccaab563a - Show all commits

View File

@ -65,7 +65,7 @@ pub trait IAppInteractInfo {
pub trait IAppInteractReload {
fn reload_library(&mut self);
fn reload_database(&mut self);
fn go_back(&mut self);
fn hide_reload_menu(&mut self);
}
pub trait IAppInteractError {
@ -201,8 +201,7 @@ impl<MH: IMusicHoard> IAppInteractReload for App<MH> {
self.refresh(previous, result);
}
// FIXME: Rename to hide_reload_menu
fn go_back(&mut self) {
fn hide_reload_menu(&mut self) {
assert!(self.state.is_reload());
self.state = AppState::Browse(());
}
@ -581,14 +580,14 @@ mod tests {
}
#[test]
fn reload_go_back() {
fn reload_hide_menu() {
let mut app = App::new(music_hoard(COLLECTION.to_owned()));
assert!(app.state().is_browse());
app.show_reload_menu();
assert!(app.state().is_reload());
app.go_back();
app.hide_reload_menu();
assert!(app.state().is_browse());
}

View File

@ -109,7 +109,7 @@ impl<APP: IAppInteract> IEventHandlerPrivate<APP> for EventHandler {
KeyCode::Char('l') | KeyCode::Char('L') => app.reload_library(),
KeyCode::Char('d') | KeyCode::Char('D') => app.reload_database(),
// Return.
KeyCode::Char('g') | KeyCode::Char('G') => app.go_back(),
KeyCode::Char('g') | KeyCode::Char('G') => app.hide_reload_menu(),
// Othey keys.
_ => {}
}