feat(client): redesign native UI, themes, settings and avatars
Separate conversation drafts and voice view state, add native settings and restricted CSS themes, implement validated avatar cropping, and refresh dependencies with documented desktop compatibility backports.
This commit is contained in:
parent
44d284a568
commit
8e5ab56611
276 changed files with 53546 additions and 3399 deletions
|
|
@ -1,21 +1,42 @@
|
|||
import { Theme } from "theme.slint";
|
||||
import { Sidebar, ChannelItem, GuildItem } from "sidebar.slint";
|
||||
export { UnlockWindow } from "unlock.slint";
|
||||
export { Theme } from "theme.slint";
|
||||
import { Theme, ActionButton } from "theme.slint";
|
||||
import { Sidebar, ChannelItem, GuildItem, DmItem } from "sidebar.slint";
|
||||
import { ChatPanel, MessageItem, MemberItem } from "chat.slint";
|
||||
import { FriendsPanel, FriendItem } from "friends.slint";
|
||||
import { VoicePanel, VoiceMemberItem } from "voice.slint";
|
||||
import { BookmarkItem, ConnectScreen } from "connect.slint";
|
||||
import { SettingsWindow } from "settings.slint";
|
||||
import { AvatarCropper } from "avatar-cropper.slint";
|
||||
|
||||
export component MainWindow inherits Window {
|
||||
in-out property <[ChannelItem]> channels;
|
||||
in-out property <[GuildItem]> guilds;
|
||||
in-out property <[string]> dm-conversations;
|
||||
in-out property <[DmItem]> dm-conversations;
|
||||
in-out property <string> username;
|
||||
in-out property <string> user-status;
|
||||
in-out property <string> active-channel-id;
|
||||
in-out property <int> active-guild-idx;
|
||||
in-out property <bool> show-dms;
|
||||
|
||||
in-out property <image> own-avatar;
|
||||
in-out property <bool> has-avatar;
|
||||
in-out property <bool> avatar-crop-open;
|
||||
in-out property <image> avatar-source;
|
||||
in-out property <float> avatar-source-width: 1;
|
||||
in-out property <float> avatar-source-height: 1;
|
||||
in-out property <float> avatar-zoom: 1;
|
||||
in-out property <float> avatar-offset-x;
|
||||
in-out property <float> avatar-offset-y;
|
||||
in-out property <string> avatar-error;
|
||||
private property <string> pending-delete-id;
|
||||
in-out property <string> active-dm-id;
|
||||
in-out property <bool> voice-connected;
|
||||
in-out property <bool> members-visible: true;
|
||||
in-out property <[string]> input-devices;
|
||||
in-out property <[string]> output-devices;
|
||||
in-out property <int> input-device-index;
|
||||
in-out property <int> output-device-index;
|
||||
in-out property <string> active-channel-name;
|
||||
in-out property <[MessageItem]> messages;
|
||||
in-out property <[MemberItem]> members;
|
||||
|
|
@ -56,6 +77,13 @@ export component MainWindow inherits Window {
|
|||
in-out property <float> voice-bitrate: 64.0;
|
||||
in-out property <int> vad-mode: 0;
|
||||
in-out property <float> volume: 100.0;
|
||||
in-out property <string> theme-mode: "dark";
|
||||
in-out property <string> theme-css;
|
||||
in-out property <string> theme-file-path;
|
||||
in-out property <float> text-size: 16;
|
||||
in-out property <string> theme-error;
|
||||
in-out property <string> theme-status;
|
||||
in-out property <bool> theme-preview;
|
||||
in-out property <string> active-tab: "audio";
|
||||
in-out property <bool> settings-open;
|
||||
|
||||
|
|
@ -75,6 +103,30 @@ export component MainWindow inherits Window {
|
|||
in-out property <string> import-pass-input;
|
||||
in-out property <string> import-error;
|
||||
|
||||
callback choose-avatar();
|
||||
callback remove-avatar();
|
||||
callback avatar-crop-moved(float, float);
|
||||
callback avatar-zoom-changed(float);
|
||||
callback confirm-avatar();
|
||||
callback cancel-avatar();
|
||||
callback theme-selected(string);
|
||||
callback text-size-changed(float);
|
||||
callback preview-theme(string);
|
||||
callback apply-theme(string);
|
||||
callback reset-theme();
|
||||
callback import-theme(string);
|
||||
callback export-theme(string);
|
||||
callback dismiss-status();
|
||||
callback ptt-held(bool);
|
||||
callback input-edited(string);
|
||||
callback address-edited(string);
|
||||
callback auto-reconnect-changed(bool);
|
||||
callback friends-tab-changed(string);
|
||||
callback friend-input-edited(string);
|
||||
callback open-settings();
|
||||
callback show-voice-view();
|
||||
callback show-friends-view();
|
||||
callback audio-settings-changed(int, int, float, int, float);
|
||||
callback channel-selected(string);
|
||||
callback guild-selected(int);
|
||||
callback dm-selected(string);
|
||||
|
|
@ -103,18 +155,25 @@ export component MainWindow inherits Window {
|
|||
callback export-keyfile(string, string);
|
||||
callback import-keyfile(string, string);
|
||||
|
||||
min-width: 900px;
|
||||
min-height: 560px;
|
||||
preferred-width: 1280px;
|
||||
preferred-height: 800px;
|
||||
min-width: 920px;
|
||||
min-height: 640px;
|
||||
title: "Vnox";
|
||||
icon: @image-url("assets/vnox-mark.svg");
|
||||
background: Theme.bg-base;
|
||||
|
||||
|
||||
if node-name == "" : ConnectScreen {
|
||||
bookmarks: root.bookmarks;
|
||||
address-input: root.address-input;
|
||||
address-input <=> root.address-input;
|
||||
status-text: root.status-text;
|
||||
connecting: root.connecting;
|
||||
auto-reconnect: root.auto-reconnect;
|
||||
auto-reconnect <=> root.auto-reconnect;
|
||||
node-name: root.node-name;
|
||||
open-settings => { root.open-settings(); }
|
||||
address-edited(text) => { root.address-edited(text); }
|
||||
auto-reconnect-changed(value) => { root.auto-reconnect-changed(value); }
|
||||
connect(address) => { root.connect(address); }
|
||||
disconnect => { root.disconnect(); }
|
||||
remove-bookmark(address) => { root.remove-bookmark(address); }
|
||||
|
|
@ -125,6 +184,20 @@ export component MainWindow inherits Window {
|
|||
channels: root.channels;
|
||||
guilds: root.guilds;
|
||||
dm-conversations: root.dm-conversations;
|
||||
node-name: root.node-name;
|
||||
active-dm-id: root.active-dm-id;
|
||||
voice-connected: root.voice-connected;
|
||||
voice-channel-name: root.voice-channel-name;
|
||||
mic-enabled: root.mic-enabled;
|
||||
deafened: root.deafened;
|
||||
open-settings => { root.open-settings(); }
|
||||
toggle-mic => { root.toggle-mic(); }
|
||||
toggle-deafen => { root.toggle-deafen(); }
|
||||
leave-voice => { root.leave-voice(); }
|
||||
show-voice => { root.show-voice-view(); }
|
||||
show-friends => { root.show-friends-view(); }
|
||||
own-avatar: root.own-avatar;
|
||||
has-avatar: root.has-avatar;
|
||||
username: root.username;
|
||||
user-status: root.user-status;
|
||||
active-channel-id: root.active-channel-id;
|
||||
|
|
@ -135,13 +208,27 @@ export component MainWindow inherits Window {
|
|||
dm-selected(id) => { root.dm-selected(id); }
|
||||
disconnect => { root.disconnect(); }
|
||||
}
|
||||
chat-panel := ChatPanel {
|
||||
visible: show-chat;
|
||||
active-channel-id: root.active-channel-id;
|
||||
VerticalLayout {
|
||||
spacing: 0;
|
||||
if root.status-text != "" : Rectangle {
|
||||
height: 42px; background: Theme.bg-elevated;
|
||||
HorizontalLayout {
|
||||
padding-left: 16px; padding-right: 10px; spacing: 12px;
|
||||
Text { text: root.status-text; color: Theme.text-secondary; font-size: Math.max(11px, Theme.font-size * 0.75); wrap: word-wrap; vertical-alignment: center; horizontal-stretch: 1; }
|
||||
ActionButton { text: "×"; width: 28px; quiet: true; clicked => { root.dismiss-status(); } }
|
||||
}
|
||||
}
|
||||
if root.show-chat : ChatPanel {
|
||||
own-avatar: root.own-avatar;
|
||||
has-own-avatar: root.has-avatar;
|
||||
active-channel-id: root.is-dm ? "" : root.active-channel-id;
|
||||
active-channel-name: root.active-channel-name;
|
||||
messages: root.messages;
|
||||
members: root.members;
|
||||
input-text: root.input-text;
|
||||
input-text <=> root.input-text;
|
||||
members-visible: root.members-visible && root.width > 1100px;
|
||||
toggle-members => { root.members-visible = !root.members-visible; }
|
||||
input-edited(text) => { root.input-edited(text); }
|
||||
is-dm: root.is-dm;
|
||||
e2ee-enabled: root.e2ee-enabled;
|
||||
dm-partner-name: root.dm-partner-name;
|
||||
|
|
@ -153,63 +240,86 @@ export component MainWindow inherits Window {
|
|||
react(id, emoji) => { root.react(id, emoji); }
|
||||
reply-to-msg(id) => { root.reply-to-msg(id); }
|
||||
edit-msg(id) => { root.edit-msg(id); }
|
||||
delete-msg(id) => { root.delete-msg(id); }
|
||||
delete-msg(id) => { root.pending-delete-id = id; }
|
||||
cancel-reply => { root.cancel-reply(); }
|
||||
}
|
||||
friends-panel := FriendsPanel {
|
||||
visible: show-friends;
|
||||
if root.show-friends : FriendsPanel {
|
||||
friends: root.friends;
|
||||
pending-requests: root.pending-requests;
|
||||
blocked-users: root.blocked-users;
|
||||
active-tab: root.friends-active-tab;
|
||||
add-friend-input: root.add-friend-input;
|
||||
active-tab <=> root.friends-active-tab;
|
||||
add-friend-input <=> root.add-friend-input;
|
||||
tab-changed(tab) => { root.friends-tab-changed(tab); }
|
||||
input-edited(text) => { root.friend-input-edited(text); }
|
||||
add-friend(id) => { root.add-friend(id); }
|
||||
accept-friend(id) => { root.accept-friend(id); }
|
||||
decline-friend(id) => { root.decline-friend(id); }
|
||||
remove-friend(id) => { root.remove-friend(id); }
|
||||
start-dm(id) => { root.start-dm(id); }
|
||||
}
|
||||
voice-panel := VoicePanel {
|
||||
visible: show-voice;
|
||||
if root.show-voice : VoicePanel {
|
||||
members: root.voice-members;
|
||||
mic-enabled: root.mic-enabled;
|
||||
deafened: root.deafened;
|
||||
channel-name: root.voice-channel-name;
|
||||
activity-banner: root.activity-banner;
|
||||
push-to-talk: root.vad-mode == 0;
|
||||
ptt-held(held) => { root.ptt-held(held); }
|
||||
toggle-mic => { root.toggle-mic(); }
|
||||
toggle-deafen => { root.toggle-deafen(); }
|
||||
leave-voice => { root.leave-voice(); }
|
||||
}
|
||||
|
||||
if root.settings-open : Rectangle {
|
||||
background: #00000080;
|
||||
TouchArea { }
|
||||
SettingsWindow {
|
||||
y: (parent.height - 480px) / 2;
|
||||
x: (parent.width - 640px) / 2;
|
||||
}
|
||||
}
|
||||
if root.settings-open : SettingsWindow {
|
||||
own-avatar: root.own-avatar;
|
||||
has-avatar: root.has-avatar;
|
||||
avatar-error: root.avatar-error;
|
||||
choose-avatar => { root.choose-avatar(); }
|
||||
remove-avatar => { root.remove-avatar(); }
|
||||
theme-mode <=> root.theme-mode;
|
||||
theme-css <=> root.theme-css;
|
||||
theme-file-path <=> root.theme-file-path;
|
||||
text-size <=> root.text-size;
|
||||
theme-error: root.theme-error;
|
||||
theme-status: root.theme-status;
|
||||
theme-preview: root.theme-preview;
|
||||
theme-selected(mode) => { root.theme-selected(mode); }
|
||||
text-size-changed(size) => { root.text-size-changed(size); }
|
||||
preview-theme(css) => { root.preview-theme(css); }
|
||||
apply-theme(css) => { root.apply-theme(css); }
|
||||
reset-theme => { root.reset-theme(); }
|
||||
import-theme(path) => { root.import-theme(path); }
|
||||
export-theme(path) => { root.export-theme(path); }
|
||||
input-devices: root.input-devices;
|
||||
output-devices: root.output-devices;
|
||||
input-device-index <=> root.input-device-index;
|
||||
output-device-index <=> root.output-device-index;
|
||||
audio-changed => { root.audio-settings-changed(root.input-device-index, root.output-device-index, root.voice-bitrate, root.vad-mode, root.volume); }
|
||||
identity-pubkey: root.identity-pubkey;
|
||||
vault-enabled: root.vault-enabled;
|
||||
voice-input-device: root.voice-input-device;
|
||||
voice-output-device: root.voice-output-device;
|
||||
voice-bitrate: root.voice-bitrate;
|
||||
vad-mode: root.vad-mode;
|
||||
volume: root.volume;
|
||||
active-tab: root.active-tab;
|
||||
voice-bitrate <=> root.voice-bitrate;
|
||||
vad-mode <=> root.vad-mode;
|
||||
volume <=> root.volume;
|
||||
active-tab <=> root.active-tab;
|
||||
|
||||
passphrase-modal-open: root.passphrase-modal-open;
|
||||
passphrase-input: root.passphrase-input;
|
||||
passphrase-confirm: root.passphrase-confirm;
|
||||
passphrase-modal-open <=> root.passphrase-modal-open;
|
||||
passphrase-input <=> root.passphrase-input;
|
||||
passphrase-confirm <=> root.passphrase-confirm;
|
||||
passphrase-error: root.passphrase-error;
|
||||
|
||||
export-modal-open: root.export-modal-open;
|
||||
export-pass-input: root.export-pass-input;
|
||||
export-pass-confirm: root.export-pass-confirm;
|
||||
export-modal-open <=> root.export-modal-open;
|
||||
export-pass-input <=> root.export-pass-input;
|
||||
export-pass-confirm <=> root.export-pass-confirm;
|
||||
export-output: root.export-output;
|
||||
export-error: root.export-error;
|
||||
|
||||
import-modal-open: root.import-modal-open;
|
||||
import-keyfile-input: root.import-keyfile-input;
|
||||
import-pass-input: root.import-pass-input;
|
||||
import-modal-open <=> root.import-modal-open;
|
||||
import-keyfile-input <=> root.import-keyfile-input;
|
||||
import-pass-input <=> root.import-pass-input;
|
||||
import-error: root.import-error;
|
||||
|
||||
close => { root.close-settings(); }
|
||||
|
|
@ -218,6 +328,36 @@ export component MainWindow inherits Window {
|
|||
export-keyfile(pass, confirm) => { root.export-keyfile(pass, confirm); }
|
||||
import-keyfile(input, pass) => { root.import-keyfile(input, pass); }
|
||||
}
|
||||
|
||||
if root.pending-delete-id != "" : Rectangle {
|
||||
background: Theme.overlay;
|
||||
TouchArea { }
|
||||
Rectangle {
|
||||
width: 420px; height: 170px;
|
||||
x: (parent.width - self.width) / 2; y: (parent.height - self.height) / 2;
|
||||
background: Theme.bg-surface; border-radius: 10px;
|
||||
VerticalLayout {
|
||||
padding: 22px; spacing: 12px;
|
||||
Text { text: "Удалить сообщение?"; font-size: Math.max(11px, Theme.font-size * 1.1875); color: Theme.text-primary; }
|
||||
Text { text: "Это действие нельзя отменить."; font-size: Math.max(11px, Theme.font-size * 0.8125); color: Theme.text-muted; }
|
||||
HorizontalLayout {
|
||||
ActionButton { text: "Отмена"; clicked => { root.pending-delete-id = ""; } }
|
||||
ActionButton { text: "Удалить"; danger: true; clicked => { root.delete-msg(root.pending-delete-id); root.pending-delete-id = ""; } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if root.avatar-crop-open : AvatarCropper {
|
||||
avatar-source: root.avatar-source;
|
||||
source-width: root.avatar-source-width;
|
||||
source-height: root.avatar-source-height;
|
||||
zoom <=> root.avatar-zoom;
|
||||
offset-x: root.avatar-offset-x;
|
||||
offset-y: root.avatar-offset-y;
|
||||
error: root.avatar-error;
|
||||
crop-moved(x,y) => { root.avatar-crop-moved(x,y); }
|
||||
zoom-changed(value) => { root.avatar-zoom-changed(value); }
|
||||
confirm => { root.confirm-avatar(); }
|
||||
cancel => { root.cancel-avatar(); }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue