User requested a checkpoint and stopped all agents. Deployed artifacts remain the last verified releases; unfinished settings/categories/forums are preserved as WIP. See TODO/roadmap for verification and remaining release/updater work.
73 lines
4.8 KiB
Text
73 lines
4.8 KiB
Text
import { Theme, ActionButton } from "theme.slint";
|
|
import { ThemeInput, ThemeEditor } from "controls.slint";
|
|
import { ChannelItem } from "sidebar.slint";
|
|
export component ServerSettingsDialog inherits Rectangle {
|
|
in-out property <string> name;
|
|
in-out property <string> description;
|
|
in property <bool> busy;
|
|
in property <bool> loaded;
|
|
in property <string> error;
|
|
in property <bool> structure;
|
|
in property <bool> forums;
|
|
in property <[ChannelItem]> channels;
|
|
callback name-edited(string);
|
|
callback description-edited(string);
|
|
callback save(); callback reload(); callback close();
|
|
callback create(string); callback rename(string); callback remove(string);
|
|
background: Theme.overlay;
|
|
TouchArea { }
|
|
keyboard := FocusScope {
|
|
init => { self.focus(); }
|
|
key-pressed(event) => {if event.text == Key.Escape {root.close();return accept;} return reject;}
|
|
Rectangle {
|
|
x: (root.width - self.width) / 2; y: 24px;
|
|
width: Math.min(700px,root.width - 40px); height: root.height - 48px;
|
|
background: Theme.bg-surface; border-radius: 12px; border-width: 1px; border-color: Theme.border;
|
|
VerticalLayout {
|
|
padding: 22px; spacing: 14px;
|
|
HorizontalLayout {
|
|
Text {text:@tr("Server settings");color:Theme.text-primary;font-size:Theme.font-size + 5px;font-weight:600;horizontal-stretch:1;vertical-alignment:center;}
|
|
ActionButton{text:@tr("Close");icon:"x";quiet:true;clicked=>{root.close();}}
|
|
}
|
|
Text {text:@tr("Changes apply to everyone on this server.");color:Theme.text-muted;font-size:Theme.font-size - 3px;wrap:word-wrap;}
|
|
Flickable {
|
|
content-width:self.width;
|
|
VerticalLayout {
|
|
spacing:10px;
|
|
Text{text:@tr("Server name");color:Theme.text-secondary;font-size:Theme.font-size - 2px;}
|
|
ThemeInput {read-only:root.busy;text<=>root.name;edited(value)=>{root.name-edited(value);}accepted=>{if !root.busy && root.loaded {root.save();}}}
|
|
Text{text:@tr("Description");color:Theme.text-secondary;font-size:Theme.font-size - 2px;}
|
|
ThemeEditor {monospace:false;read-only:root.busy;text<=>root.description;height:100px;edited(value)=>{if !root.busy {root.description-edited(value);}}}
|
|
HorizontalLayout {
|
|
spacing:10px;
|
|
ActionButton{text:@tr("Reload");clicked=>{if !root.busy{root.reload();}}}
|
|
Rectangle{horizontal-stretch:1;}
|
|
if root.loaded && !root.busy :ActionButton{text:@tr("Save changes");icon:"check";labeled:true;primary:true;clicked=>{root.save();}}
|
|
}
|
|
Text{text:root.busy ? @tr("Waiting for the server…") :root.error;color:root.error!=""?Theme.danger:Theme.text-muted;font-size:Theme.font-size - 3px;wrap:word-wrap;}
|
|
Rectangle{height:1px;background:Theme.border;}
|
|
Text{text:@tr("Channels and categories");color:Theme.text-primary;font-size:Theme.font-size + 1px;font-weight:600;}
|
|
HorizontalLayout {
|
|
spacing:8px;
|
|
ActionButton{text:@tr("Text");icon:"hash";labeled:true;clicked=>{root.create("text");}}
|
|
ActionButton{text:@tr("Voice");icon:"volume-2";labeled:true;clicked=>{root.create("voice");}}
|
|
if root.structure:ActionButton{text:@tr("Category");icon:"folder";labeled:true;clicked=>{root.create("category");}}
|
|
if root.forums:ActionButton{text:@tr("Forum");icon:"messages-square";labeled:true;clicked=>{root.create("forum");}}
|
|
Rectangle{horizontal-stretch:1;}
|
|
}
|
|
for channel in root.channels:Rectangle {
|
|
visible:channel.is-global;height:self.visible?38px:0px;
|
|
background:Theme.bg-interactive;border-radius:5px;
|
|
HorizontalLayout {
|
|
padding-left:10px;padding-right:6px;spacing:8px;
|
|
Text{text:channel.name;color:Theme.text-primary;vertical-alignment:center;overflow:elide;horizontal-stretch:1;font-size:Theme.font-size - 2px;}
|
|
ActionButton{text:@tr("Rename channel");icon:"pencil";quiet:true;clicked=>{root.rename(channel.channel_id);}}
|
|
ActionButton{text:@tr("Delete channel");icon:"trash-2";danger:true;quiet:true;clicked=>{root.remove(channel.channel_id);}}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|