[feat] add random password refresh to the main window

This commit is contained in:
dijunkun
2026-09-22 10:33:28 +08:00
parent b610a0ec7e
commit 7e3e050edf
7 changed files with 135 additions and 74 deletions
+4
View File
@@ -41,6 +41,7 @@ export global FontAwesomeIcons {
out property <string> keyboard: "\u{f11c}";
out property <string> minus: "\u{f068}";
out property <string> pen: "\u{f304}";
out property <string> rotate: "\u{f2f1}";
out property <string> signal: "\u{f012}";
out property <string> shield-halved: "\u{f3ed}";
out property <string> square-full: "\u{f45c}";
@@ -54,6 +55,7 @@ export global FontAwesomeIcons {
export component IconButton inherits Rectangle {
in property <string> icon;
in property <string> tooltip;
in property <bool> enabled: true;
in property <bool> danger: false;
in property <length> icon-size: 16px;
in property <color> icon-color: #24272d;
@@ -69,6 +71,7 @@ export component IconButton inherits Rectangle {
: touch.has-hover ? (danger ? #f04438 : root.hover-background)
: root.normal-background;
border-radius: 4px;
opacity: root.enabled ? 1 : 0.4;
Text {
text: root.icon;
@@ -90,6 +93,7 @@ export component IconButton inherits Rectangle {
}
touch := TouchArea {
enabled: root.enabled;
clicked => { root.clicked(); }
}
+18 -3
View File
@@ -24,6 +24,7 @@ export global UiStrings {
in-out property <string> online: "Online";
in-out property <string> offline: "Offline";
in-out property <string> password: "Password";
in-out property <string> refresh-password: "Refresh random password";
in-out property <string> copied: "Local ID copied to clipboard";
in-out property <string> connect: "Connect";
in-out property <string> settings: "Settings";
@@ -208,6 +209,7 @@ export component MainWindow inherits Window {
in property <string> local-password: "";
in-out property <string> remote-id-input: "";
in property <bool> password-visible: true;
in property <bool> password-change-pending: false;
in property <bool> signal-connected: false;
in property <bool> signal-tls-error: false;
in property <[RecentConnection]> recent-connections;
@@ -262,6 +264,7 @@ export component MainWindow inherits Window {
callback copy-local-id;
callback toggle-password-visibility;
callback refresh-password;
callback reset-password(string) -> bool;
callback format-remote-id(string) -> string;
callback connect-requested(string);
@@ -676,19 +679,31 @@ export component MainWindow inherits Window {
IconButton {
x: 174px;
y: 133px;
width: 29px;
width: 24px;
height: 30px;
icon: root.password-visible ? FontAwesomeIcons.eye : FontAwesomeIcons.eye-slash;
icon-size: 17px;
clicked => { root.toggle-password-visibility(); }
}
IconButton {
x: 214px;
x: 198px;
y: 133px;
width: 29px;
width: 24px;
height: 30px;
icon: FontAwesomeIcons.rotate;
icon-size: 15px;
tooltip: UiStrings.refresh-password;
enabled: !root.password-change-pending;
clicked => { root.refresh-password(); }
}
IconButton {
x: 222px;
y: 133px;
width: 24px;
height: 30px;
icon: FontAwesomeIcons.pen;
icon-size: 15px;
enabled: !root.password-change-pending;
clicked => { root.reset-password-open = true; }
}
}
@@ -36,6 +36,7 @@ inline int ApplyMainWindowStrings(
strings.set_online(Text(localization::online[language]));
strings.set_offline(Text(localization::offline[language]));
strings.set_password(Text(localization::password[language]));
strings.set_refresh_password(Text(localization::refresh_password[language]));
strings.set_copied(
Text(localization::local_id_copied_to_clipboard[language]));
strings.set_connect(Text(localization::connect[language]));