ui: one clipboard path, and Copy invite link in the voice header
Copying went through a hidden text field on the phone's voice screen only. It moves into MainWindow: any screen calls Nav.copy(text), and Bridge.copied() confirms it in one toast, shown again when its text is the same as the last copy's. The invite leaves its own message for that toast (the channel and the link) instead of a status of its own, so a copy never shows two. The desktop voice channel view gets the same Invite as a Copy invite link button next to Chat only. Icons.channel is the speaker, for the channel spots that use it later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
1 parent
3c47bc682f
commit
61636b23c8
11 files changed
+67
-18
No files matched your search
@@ -341,6 +341,23 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
// Nav.copy: Slint copies only what is selected in a text field, so the
|
||||
// text goes through this hidden one. Rust confirms it in the toast,
|
||||
// shown again even when its text is the last one's.
|
||||
property <int> clip-requests: Nav.clip-requests;
|
||||
changed clip-requests => {
|
||||
clipboard.text = Nav.clip-text;
|
||||
clipboard.select-all();
|
||||
clipboard.copy();
|
||||
Bridge.copied();
|
||||
toast.shown = true;
|
||||
}
|
||||
clipboard := TextInput {
|
||||
visible: false;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
// Over the pop-ups, so their scrim does not dim it (a poke from the
|
||||
// member card says so here); under the dialogs.
|
||||
toast := Toast {
|
||||
|
||||
@@ -1030,8 +1030,10 @@ export global Bridge {
|
||||
callback dismiss-crash-notice();
|
||||
callback open-about();
|
||||
// A link to our voice channel (`ts3server://`) to hand to others; the
|
||||
// caller copies it.
|
||||
// caller copies it (Nav.copy).
|
||||
callback invite() -> string;
|
||||
// Nav.copy put text on the clipboard: Rust says so in the toast.
|
||||
callback copied();
|
||||
|
||||
// Home, friends, direct messages, notifications, search, events and
|
||||
// the settings pages.
|
||||
|
||||
@@ -116,6 +116,8 @@ export global Icons {
|
||||
out property <image> video-off: @image-url("assets/icons/video-off.svg");
|
||||
out property <image> video: @image-url("assets/icons/video.svg");
|
||||
out property <image> volume-2: @image-url("assets/icons/volume-2.svg");
|
||||
// The icon for channels (voice and chat in one): the speaker.
|
||||
out property <image> channel: @image-url("assets/icons/volume-2.svg");
|
||||
out property <image> volume-x: @image-url("assets/icons/volume-x.svg");
|
||||
out property <image> x: @image-url("assets/icons/x.svg");
|
||||
// Home, friends, messages, events and the settings pages (from
|
||||
|
||||
@@ -102,6 +102,11 @@ export global Nav {
|
||||
in-out property <int> dm-tab;
|
||||
in-out property <bool> join-open;
|
||||
|
||||
// Text for the clipboard, and a counter that changes with every copy:
|
||||
// MainWindow copies it through a hidden text field (`copy` below).
|
||||
in-out property <string> clip-text;
|
||||
in-out property <int> clip-requests;
|
||||
|
||||
// The phone layout (narrow windows).
|
||||
// The server's members as a page of their own (the desktop shows them
|
||||
// beside the chat).
|
||||
@@ -306,4 +311,13 @@ export global Nav {
|
||||
show(Page.server);
|
||||
Bridge.select-server(id);
|
||||
}
|
||||
|
||||
// Put text on the clipboard; a toast says so. Nothing to copy (an
|
||||
// invite without a channel, which Rust explains) does nothing.
|
||||
public function copy(text: string) {
|
||||
if text != "" {
|
||||
clip-text = text;
|
||||
clip-requests += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -631,11 +631,6 @@ export component MobileVoice inherits VerticalLayout {
|
||||
Nav.mobile-tab = MobileTab.chat;
|
||||
}
|
||||
}
|
||||
clip := TextInput {
|
||||
visible: false;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
ChannelBar { }
|
||||
sv := ScrollView {
|
||||
// The stream, the people and the chat header scroll away together
|
||||
@@ -678,13 +673,7 @@ export component MobileVoice inherits VerticalLayout {
|
||||
filled: true;
|
||||
size: 62px;
|
||||
icon-size: 24px;
|
||||
// Through a text field: Slint copies only
|
||||
// what is selected in one.
|
||||
clicked => {
|
||||
clip.text = Bridge.invite();
|
||||
clip.select-all();
|
||||
clip.copy();
|
||||
}
|
||||
clicked => { Nav.copy(Bridge.invite()); }
|
||||
}
|
||||
}
|
||||
Text {
|
||||
|
||||
@@ -244,6 +244,12 @@ export component VoiceView inherits VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.user-plus;
|
||||
label: @tr("Copy invite link");
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.copy(Bridge.invite()); }
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.message-square;
|
||||
label: @tr("Chat only");
|
||||
|
||||
Reference in new issue
Block a user