feat: replace the login screen's Exit button with an X in the corner
The full-width button under Connect took a row in a card that is close to filling an 800 px high screen. The X is a focus stop between the saved servers and the address field, so Up from the address field still reaches it from a controller. Bumps the version to 0.10.1.
This commit is contained in:
+18
-17
@@ -584,15 +584,15 @@ impl App {
|
||||
self.set_area(area);
|
||||
}
|
||||
|
||||
/// 0 to 2 are the fields and 3 and 4 the buttons. Below 0 are the saved
|
||||
/// servers in the card beside the form, from the top one at -n to the
|
||||
/// bottom one at -1, so Up from the address field reaches the list.
|
||||
/// Top to bottom: the saved servers in the card beside the form, from
|
||||
/// -n-1 to -2; the X in the form's corner at -1; the fields 0 to 2; and
|
||||
/// Connect at 3. So Up from the address field reaches the X, then the list.
|
||||
fn set_login_focus(&mut self, i: i32) {
|
||||
let known = self.logins.servers.len() as i32;
|
||||
self.login_focus = i.clamp(-known, 4);
|
||||
self.login_focus = i.clamp(-known - 1, 3);
|
||||
self.ui.set_login_focus(self.login_focus);
|
||||
self.ui.set_login_known_selected(if self.login_focus < 0 {
|
||||
known + self.login_focus
|
||||
self.ui.set_login_known_selected(if self.login_focus < -1 {
|
||||
known + 1 + self.login_focus
|
||||
} else {
|
||||
-1
|
||||
});
|
||||
@@ -606,16 +606,16 @@ impl App {
|
||||
Action::Down | Action::SectionNext => self.set_login_focus(self.login_focus + 1),
|
||||
// Across to the saved servers and back. A text field keeps Left
|
||||
// and Right on a keyboard for its cursor.
|
||||
Action::Left if self.login_focus >= 0 && !self.logins.servers.is_empty() => {
|
||||
self.set_login_focus(-(self.logins.servers.len() as i32))
|
||||
Action::Left if self.login_focus >= -1 && !self.logins.servers.is_empty() => {
|
||||
self.set_login_focus(-(self.logins.servers.len() as i32) - 1)
|
||||
}
|
||||
Action::Right if self.login_focus < 0 => self.set_login_focus(0),
|
||||
Action::Activate if self.login_focus < 0 => {
|
||||
self.pick_known((self.logins.servers.len() as i32 + self.login_focus) as usize)
|
||||
Action::Right if self.login_focus < -1 => self.set_login_focus(0),
|
||||
Action::Activate if self.login_focus < -1 => {
|
||||
self.pick_known((self.logins.servers.len() as i32 + 1 + self.login_focus) as usize)
|
||||
}
|
||||
Action::Activate if self.login_focus == -1 && self.client.is_some() => self.cancel_login(),
|
||||
Action::Activate if self.login_focus == -1 => self.action(Action::Quit),
|
||||
Action::Activate if self.login_focus < 2 => self.set_login_focus(self.login_focus + 1),
|
||||
Action::Activate if self.login_focus == 4 && self.client.is_some() => self.cancel_login(),
|
||||
Action::Activate if self.login_focus == 4 => self.action(Action::Quit),
|
||||
Action::Activate => self.login_submit(),
|
||||
Action::Back => self.cancel_login(),
|
||||
// The face button that queues elsewhere; a keyboard types into
|
||||
@@ -2051,10 +2051,10 @@ impl App {
|
||||
Screen::Login => {
|
||||
let adding = self.client.is_some();
|
||||
let label = match self.login_focus {
|
||||
..0 => "Use this server",
|
||||
..-1 => "Use this server",
|
||||
-1 if adding => "Cancel",
|
||||
-1 => "Exit",
|
||||
0 | 1 => "Next",
|
||||
4 if adding => "Cancel",
|
||||
4 => "Exit",
|
||||
_ => "Connect",
|
||||
};
|
||||
h(Control::Activate, label);
|
||||
@@ -2062,7 +2062,8 @@ impl App {
|
||||
let shown = self.ui.get_login_password_shown();
|
||||
h(Control::Queue, if shown { "Hide password" } else { "Show password" });
|
||||
}
|
||||
if adding {
|
||||
// Already the activate hint while the X has focus.
|
||||
if adding && self.login_focus != -1 {
|
||||
h(Control::Back, "Cancel");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user