Tweaked the key mappings so that it is now easier to change key mappings and update the corresponding UI elements as well
This commit is contained in:
+7
-7
@@ -284,12 +284,12 @@ impl HorizontallyScrollableText {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct TabRoute {
|
||||
pub title: &'static str,
|
||||
pub route: Route,
|
||||
pub help: &'static str,
|
||||
pub contextual_help: Option<&'static str>,
|
||||
pub help: String,
|
||||
pub contextual_help: Option<String>,
|
||||
}
|
||||
|
||||
pub struct TabState {
|
||||
@@ -313,12 +313,12 @@ impl TabState {
|
||||
&self.tabs[self.index].route
|
||||
}
|
||||
|
||||
pub fn get_active_tab_help(&self) -> &'static str {
|
||||
self.tabs[self.index].help
|
||||
pub fn get_active_tab_help(&self) -> &str {
|
||||
&self.tabs[self.index].help
|
||||
}
|
||||
|
||||
pub fn get_active_tab_contextual_help(&self) -> Option<&'static str> {
|
||||
self.tabs[self.index].contextual_help
|
||||
pub fn get_active_tab_contextual_help(&self) -> Option<String> {
|
||||
self.tabs[self.index].contextual_help.clone()
|
||||
}
|
||||
|
||||
pub fn next(&mut self) {
|
||||
|
||||
@@ -533,7 +533,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_tab_state_get_active_tab_help() {
|
||||
let tabs = create_test_tab_routes();
|
||||
let second_tab_help = tabs[1].help;
|
||||
let second_tab_help = tabs[1].help.clone();
|
||||
let tab_state = TabState { tabs, index: 1 };
|
||||
|
||||
let tab_help = tab_state.get_active_tab_help();
|
||||
@@ -544,7 +544,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_tab_state_get_active_tab_contextual_help() {
|
||||
let tabs = create_test_tab_routes();
|
||||
let second_tab_contextual_help = tabs[1].contextual_help.unwrap();
|
||||
let second_tab_contextual_help = tabs[1].contextual_help.clone().unwrap();
|
||||
let tab_state = TabState { tabs, index: 1 };
|
||||
|
||||
let tab_contextual_help = tab_state.get_active_tab_contextual_help();
|
||||
@@ -648,14 +648,14 @@ mod tests {
|
||||
TabRoute {
|
||||
title: "Test 1",
|
||||
route: ActiveRadarrBlock::Movies.into(),
|
||||
help: "Help for Test 1",
|
||||
contextual_help: Some("Contextual Help for Test 1"),
|
||||
help: "Help for Test 1".to_owned(),
|
||||
contextual_help: Some("Contextual Help for Test 1".to_owned()),
|
||||
},
|
||||
TabRoute {
|
||||
title: "Test 2",
|
||||
route: ActiveRadarrBlock::Collections.into(),
|
||||
help: "Help for Test 2",
|
||||
contextual_help: Some("Contextual Help for Test 2"),
|
||||
help: "Help for Test 2".to_owned(),
|
||||
contextual_help: Some("Contextual Help for Test 2".to_owned()),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user