Added misc_info_dialog to themes

This commit is contained in:
veeso
2021-09-19 10:48:16 +02:00
parent ed3225ed84
commit 88a0685097
16 changed files with 67 additions and 9 deletions

View File

@@ -556,6 +556,7 @@ mod tests {
auth_recents = "LightBlue"
auth_username = "LightMagenta"
misc_error_dialog = "Red"
misc_info_dialog = "LightYellow"
misc_input_dialog = "240,240,240"
misc_keys = "Cyan"
misc_quit_dialog = "Yellow"

View File

@@ -83,6 +83,11 @@ pub struct Theme {
deserialize_with = "deserialize_color",
serialize_with = "serialize_color"
)]
pub misc_info_dialog: Color,
#[serde(
deserialize_with = "deserialize_color",
serialize_with = "serialize_color"
)]
pub misc_input_dialog: Color,
#[serde(
deserialize_with = "deserialize_color",
@@ -183,6 +188,7 @@ impl Default for Theme {
auth_recents: Color::LightBlue,
auth_username: Color::LightMagenta,
misc_error_dialog: Color::Red,
misc_info_dialog: Color::LightYellow,
misc_input_dialog: Color::Reset,
misc_keys: Color::Cyan,
misc_quit_dialog: Color::Yellow,
@@ -245,6 +251,7 @@ mod test {
assert_eq!(theme.auth_recents, Color::LightBlue);
assert_eq!(theme.auth_username, Color::LightMagenta);
assert_eq!(theme.misc_error_dialog, Color::Red);
assert_eq!(theme.misc_info_dialog, Color::LightYellow);
assert_eq!(theme.misc_input_dialog, Color::Reset);
assert_eq!(theme.misc_keys, Color::Cyan);
assert_eq!(theme.misc_quit_dialog, Color::Yellow);

View File

@@ -254,6 +254,9 @@ impl SetupActivity {
super::COMPONENT_COLOR_MISC_ERROR => {
theme.misc_error_dialog = color;
}
super::COMPONENT_COLOR_MISC_INFO => {
theme.misc_info_dialog = color;
}
super::COMPONENT_COLOR_MISC_INPUT => {
theme.misc_input_dialog = color;
}

View File

@@ -75,6 +75,7 @@ const COMPONENT_COLOR_AUTH_PROTOCOL: &str = "COMPONENT_COLOR_AUTH_PROTOCOL";
const COMPONENT_COLOR_AUTH_RECENTS: &str = "COMPONENT_COLOR_AUTH_RECENTS";
const COMPONENT_COLOR_AUTH_USERNAME: &str = "COMPONENT_COLOR_AUTH_USERNAME";
const COMPONENT_COLOR_MISC_ERROR: &str = "COMPONENT_COLOR_MISC_ERROR";
const COMPONENT_COLOR_MISC_INFO: &str = "COMPONENT_COLOR_MISC_INFO";
const COMPONENT_COLOR_MISC_INPUT: &str = "COMPONENT_COLOR_MISC_INPUT";
const COMPONENT_COLOR_MISC_KEYS: &str = "COMPONENT_COLOR_MISC_KEYS";
const COMPONENT_COLOR_MISC_QUIT: &str = "COMPONENT_COLOR_MISC_QUIT";

View File

@@ -31,8 +31,8 @@ use super::{
SetupActivity, ViewLayout, COMPONENT_COLOR_AUTH_ADDR, COMPONENT_COLOR_AUTH_BOOKMARKS,
COMPONENT_COLOR_AUTH_PASSWORD, COMPONENT_COLOR_AUTH_PORT, COMPONENT_COLOR_AUTH_PROTOCOL,
COMPONENT_COLOR_AUTH_RECENTS, COMPONENT_COLOR_AUTH_USERNAME, COMPONENT_COLOR_MISC_ERROR,
COMPONENT_COLOR_MISC_INPUT, COMPONENT_COLOR_MISC_KEYS, COMPONENT_COLOR_MISC_QUIT,
COMPONENT_COLOR_MISC_SAVE, COMPONENT_COLOR_MISC_WARN,
COMPONENT_COLOR_MISC_INFO, COMPONENT_COLOR_MISC_INPUT, COMPONENT_COLOR_MISC_KEYS,
COMPONENT_COLOR_MISC_QUIT, COMPONENT_COLOR_MISC_SAVE, COMPONENT_COLOR_MISC_WARN,
COMPONENT_COLOR_TRANSFER_EXPLORER_LOCAL_BG, COMPONENT_COLOR_TRANSFER_EXPLORER_LOCAL_FG,
COMPONENT_COLOR_TRANSFER_EXPLORER_LOCAL_HG, COMPONENT_COLOR_TRANSFER_EXPLORER_REMOTE_BG,
COMPONENT_COLOR_TRANSFER_EXPLORER_REMOTE_FG, COMPONENT_COLOR_TRANSFER_EXPLORER_REMOTE_HG,
@@ -441,6 +441,10 @@ impl SetupActivity {
None
}
(COMPONENT_COLOR_MISC_ERROR, key) if key == &MSG_KEY_DOWN => {
self.view.active(COMPONENT_COLOR_MISC_INFO);
None
}
(COMPONENT_COLOR_MISC_INFO, key) if key == &MSG_KEY_DOWN => {
self.view.active(COMPONENT_COLOR_MISC_INPUT);
None
}
@@ -551,10 +555,14 @@ impl SetupActivity {
self.view.active(COMPONENT_COLOR_AUTH_RECENTS);
None
}
(COMPONENT_COLOR_MISC_INPUT, key) if key == &MSG_KEY_UP => {
(COMPONENT_COLOR_MISC_INFO, key) if key == &MSG_KEY_UP => {
self.view.active(COMPONENT_COLOR_MISC_ERROR);
None
}
(COMPONENT_COLOR_MISC_INPUT, key) if key == &MSG_KEY_UP => {
self.view.active(COMPONENT_COLOR_MISC_INFO);
None
}
(COMPONENT_COLOR_MISC_KEYS, key) if key == &MSG_KEY_UP => {
self.view.active(COMPONENT_COLOR_MISC_INPUT);
None

View File

@@ -70,6 +70,7 @@ impl SetupActivity {
// Misc
self.mount_title(super::COMPONENT_COLOR_MISC_TITLE, "Misc styles");
self.mount_color_picker(super::COMPONENT_COLOR_MISC_ERROR, "Error");
self.mount_color_picker(super::COMPONENT_COLOR_MISC_INFO, "Info dialogs");
self.mount_color_picker(super::COMPONENT_COLOR_MISC_INPUT, "Input fields");
self.mount_color_picker(super::COMPONENT_COLOR_MISC_KEYS, "Key strokes");
self.mount_color_picker(super::COMPONENT_COLOR_MISC_QUIT, "Quit dialogs");
@@ -222,12 +223,12 @@ impl SetupActivity {
[
Constraint::Length(1), // Title
Constraint::Length(3), // Error
Constraint::Length(3), // Info
Constraint::Length(3), // Input
Constraint::Length(3), // Keys
Constraint::Length(3), // Quit
Constraint::Length(3), // Save
Constraint::Length(3), // Warn
Constraint::Length(3), // Empty
]
.as_ref(),
)
@@ -237,15 +238,17 @@ impl SetupActivity {
self.view
.render(super::COMPONENT_COLOR_MISC_ERROR, f, misc_colors_layout[1]);
self.view
.render(super::COMPONENT_COLOR_MISC_INPUT, f, misc_colors_layout[2]);
.render(super::COMPONENT_COLOR_MISC_INFO, f, misc_colors_layout[2]);
self.view
.render(super::COMPONENT_COLOR_MISC_KEYS, f, misc_colors_layout[3]);
.render(super::COMPONENT_COLOR_MISC_INPUT, f, misc_colors_layout[3]);
self.view
.render(super::COMPONENT_COLOR_MISC_QUIT, f, misc_colors_layout[4]);
.render(super::COMPONENT_COLOR_MISC_KEYS, f, misc_colors_layout[4]);
self.view
.render(super::COMPONENT_COLOR_MISC_SAVE, f, misc_colors_layout[5]);
.render(super::COMPONENT_COLOR_MISC_QUIT, f, misc_colors_layout[5]);
self.view
.render(super::COMPONENT_COLOR_MISC_WARN, f, misc_colors_layout[6]);
.render(super::COMPONENT_COLOR_MISC_SAVE, f, misc_colors_layout[6]);
self.view
.render(super::COMPONENT_COLOR_MISC_WARN, f, misc_colors_layout[7]);
let transfer_colors_layout_col1 = Layout::default()
.direction(Direction::Vertical)
@@ -405,6 +408,7 @@ impl SetupActivity {
self.update_color(super::COMPONENT_COLOR_AUTH_RECENTS, theme.auth_recents);
self.update_color(super::COMPONENT_COLOR_AUTH_USERNAME, theme.auth_username);
self.update_color(super::COMPONENT_COLOR_MISC_ERROR, theme.misc_error_dialog);
self.update_color(super::COMPONENT_COLOR_MISC_INFO, theme.misc_info_dialog);
self.update_color(super::COMPONENT_COLOR_MISC_INPUT, theme.misc_input_dialog);
self.update_color(super::COMPONENT_COLOR_MISC_KEYS, theme.misc_keys);
self.update_color(super::COMPONENT_COLOR_MISC_QUIT, theme.misc_quit_dialog);
@@ -495,6 +499,9 @@ impl SetupActivity {
let misc_error_dialog: Color = self
.get_color(super::COMPONENT_COLOR_MISC_ERROR)
.map_err(|_| super::COMPONENT_COLOR_MISC_ERROR)?;
let misc_info_dialog: Color = self
.get_color(super::COMPONENT_COLOR_MISC_INFO)
.map_err(|_| super::COMPONENT_COLOR_MISC_INFO)?;
let misc_input_dialog: Color = self
.get_color(super::COMPONENT_COLOR_MISC_INPUT)
.map_err(|_| super::COMPONENT_COLOR_MISC_INPUT)?;
@@ -560,6 +567,7 @@ impl SetupActivity {
theme.auth_recents = auth_recents;
theme.auth_username = auth_username;
theme.misc_error_dialog = misc_error_dialog;
theme.misc_info_dialog = misc_info_dialog;
theme.misc_input_dialog = misc_input_dialog;
theme.misc_keys = misc_keys;
theme.misc_quit_dialog = misc_quit_dialog;