feat: keep several logins and switch between them
config.toml now holds a list of [[server]] logins and the active one. The single-login file of earlier versions loads as the only entry. Settings lists the servers first: confirm switches, the queue button pressed twice removes, and Add server opens the login form, which can now be cancelled. Removing the last login returns to the login screen. A switch saves the queue of the server being left, stops the player and restores the other server's saved queue paused. Player events sent before the stop are dropped by an epoch, and cover loads started for the old server by a generation, so nothing of one server shows on the other. Covers are cached on disk per server, keyed like the saved queue. The shoulder triggers wrap around the sections, which puts Settings one press from the first section.
This commit is contained in:
+6
-2
@@ -841,6 +841,8 @@ component LoginView inherits Rectangle {
|
||||
in property <int> focus-index;
|
||||
in property <string> error;
|
||||
in property <bool> busy;
|
||||
// Adding a server from inside the app: the bottom button goes back.
|
||||
in property <bool> can-cancel;
|
||||
callback submit;
|
||||
callback exit;
|
||||
callback field-clicked(int);
|
||||
@@ -920,7 +922,7 @@ component LoginView inherits Rectangle {
|
||||
border-width: 2px * Theme.s;
|
||||
border-color: root.focus-index == 4 ? Theme.focus : Theme.line;
|
||||
Text {
|
||||
text: "Exit";
|
||||
text: root.can-cancel ? "Cancel" : "Exit";
|
||||
font-size: 17px * Theme.s;
|
||||
color: root.focus-index == 4 ? Theme.text : Theme.muted;
|
||||
}
|
||||
@@ -1144,6 +1146,7 @@ export component AppWindow inherits Window {
|
||||
in property <int> login-focus;
|
||||
in property <string> login-error;
|
||||
in property <bool> login-busy;
|
||||
in property <bool> login-can-cancel;
|
||||
|
||||
// Browse
|
||||
in property <[string]> sections;
|
||||
@@ -1267,7 +1270,8 @@ export component AppWindow inherits Window {
|
||||
error: root.login-error;
|
||||
busy: root.login-busy;
|
||||
submit => { root.login-submit(); }
|
||||
exit => { root.action(Action.quit); }
|
||||
can-cancel: root.login-can-cancel;
|
||||
exit => { root.action(root.login-can-cancel ? Action.back : Action.quit); }
|
||||
field-clicked(i) => { root.login-field-clicked(i); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user