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.
218 lines
17 KiB
Text
218 lines
17 KiB
Text
import { Theme, ActionButton, Symbol } from "../theme.slint";
|
|
import { AudioSlider, ThemeInput, ThemeEditor } from "../controls.slint";
|
|
|
|
component ThemeChoice inherits Rectangle {
|
|
in property <string> label;
|
|
in property <bool> selected;
|
|
in property <color> preview-background;
|
|
in property <color> preview-sidebar;
|
|
in property <color> preview-rail;
|
|
in property <color> preview-selected;
|
|
in property <color> preview-input;
|
|
in property <color> preview-ink;
|
|
in property <color> preview-accent: #bba583;
|
|
callback clicked();
|
|
height: 160px;
|
|
min-width: 0px;
|
|
preferred-width: 0px;
|
|
horizontal-stretch: 1;
|
|
border-radius: 9px;
|
|
border-width: keyboard.has-focus || root.selected ? 2px : 1px;
|
|
border-color: root.selected || keyboard.has-focus ? Theme.accent : Theme.border;
|
|
background: pointer.has-hover ? Theme.bg-hover : Theme.bg-surface;
|
|
accessible-role: radio-button;
|
|
accessible-checked: root.selected;
|
|
accessible-label: root.label;
|
|
VerticalLayout {
|
|
padding: 8px; spacing: 10px;
|
|
mini := Rectangle {
|
|
height: 108px;
|
|
background: root.preview-background;
|
|
border-radius: 5px;
|
|
border-width: 1px;
|
|
border-color: root.preview-ink.with-alpha(0.1);
|
|
clip: true;
|
|
// A miniature client: server rail, channel list, conversation and composer.
|
|
rail := Rectangle {
|
|
x: 0px; y: 0px;
|
|
width: 17px; height: parent.height; background: root.preview-rail;
|
|
Rectangle { x: 4px; y: 8px; width: 9px; height: 9px; border-radius: 3px; background: root.preview-accent;
|
|
Image { source: @image-url("../assets/vnox-mark.svg"); width: 9px; height: 9px; image-fit: contain; }
|
|
}
|
|
Rectangle { x: 4px; y: 24px; width: 9px; height: 9px; border-radius: 4px; background: root.preview-ink.with-alpha(0.14); }
|
|
Rectangle { x: 4px; y: 38px; width: 9px; height: 9px; border-radius: 4px; background: root.preview-ink.with-alpha(0.08); }
|
|
Rectangle { x: 4px; y: parent.height - 13px; width: 8px; height: 8px; border-radius: 4px; background: root.preview-ink.with-alpha(0.3); }
|
|
}
|
|
side := Rectangle {
|
|
x: 17px; y: 0px; width: parent.width * 0.27; height: parent.height; background: root.preview-sidebar;
|
|
Text { x: 5px; y: 7px; text: "Vnox"; color: root.preview-ink; font-size: 7px; font-weight: 700; }
|
|
Rectangle { x: 3px; y: 24px; width: parent.width - 6px; height: 13px; border-radius: 2px; background: root.preview-selected;
|
|
Text { x: 4px; text: "#"; color: root.preview-accent; font-size: 9px; vertical-alignment: center; }
|
|
Rectangle { x: 14px; y: 5px; width: Math.max(parent.width - 21px, 3px); height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.65); }
|
|
}
|
|
Text { x: 7px; y: 42px; text: "#"; color: root.preview-ink.with-alpha(0.4); font-size: 8px; }
|
|
Rectangle { x: 7px; y: 60px; width: 7px; height: 7px; border-radius: 3px; background: root.preview-ink.with-alpha(0.4); }
|
|
Rectangle { x: 7px; y: 80px; width: 4px; height: 4px; border-radius: 2px; background: root.preview-accent; }
|
|
Rectangle { x: 15px; y: 81px; width: Math.max(parent.width - 24px, 3px); height: 2px; background: root.preview-ink.with-alpha(0.3); }
|
|
}
|
|
thread := Rectangle {
|
|
x: side.x + side.width; y: 0px; width: parent.width - self.x; height: parent.height; background: transparent;
|
|
Text { x: 7px; y: 5px; text: "#"; color: root.preview-ink.with-alpha(0.65); font-size: 10px; }
|
|
Rectangle { x: 21px; y: 10px; width: parent.width * 0.29; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.65); }
|
|
Rectangle { y: 23px; width: parent.width; height: 1px; background: root.preview-ink.with-alpha(0.08); }
|
|
Rectangle { x: 7px; y: 33px; width: 10px; height: 10px; border-radius: 4px; background: root.preview-accent; }
|
|
Rectangle { x: 23px; y: 34px; width: parent.width * 0.35; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.75); }
|
|
Rectangle { x: 23px; y: 42px; width: parent.width - 32px; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.25); }
|
|
Rectangle { x: 7px; y: 56px; width: 10px; height: 10px; border-radius: 4px; background: root.preview-ink.with-alpha(0.22); }
|
|
Rectangle { x: 23px; y: 57px; width: parent.width * 0.25; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.65); }
|
|
Rectangle { x: 23px; y: 65px; width: parent.width * 0.4; height: 3px; border-radius: 1px; background: root.preview-ink.with-alpha(0.25); }
|
|
Rectangle { x: 6px; y: parent.height - 23px; width: parent.width - 12px; height: 16px; border-radius: 4px; background: root.preview-input;
|
|
Text { x: 4px; text: "+"; color: root.preview-ink.with-alpha(0.45); font-size: 10px; vertical-alignment: center; }
|
|
Rectangle { x: parent.width - 12px; y: 5px; width: 6px; height: 6px; border-radius: 2px; background: root.preview-accent; }
|
|
}
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
Text { text: root.label; color: Theme.text-primary; font-size: Math.max(Theme.font-size - 3px, 11px); font-weight: 500; overflow: elide; horizontal-stretch: 1; }
|
|
Rectangle { width: 16px; Symbol { visible: root.selected; kind: "check"; ink: Theme.accent; width: 16px; height: 16px; y: (parent.height - self.height) / 2; } }
|
|
}
|
|
}
|
|
pointer := TouchArea { clicked => { keyboard.focus(); root.clicked(); } }
|
|
keyboard := FocusScope { focus-on-click: false; key-pressed(event) => { if event.text == " " || event.text == "\n" { root.clicked(); return accept; } return reject; } }
|
|
}
|
|
|
|
export component AppearanceSettings inherits Rectangle {
|
|
in-out property <string> language-choice: "system";
|
|
callback language-selected(string);
|
|
in-out property <string> theme-mode;
|
|
private property <bool> selected-theme-is-light: root.theme-mode == "light" || root.theme-mode == "mist" || root.theme-mode == "glacier" || root.theme-mode == "sage" || root.theme-mode == "rose" || root.theme-mode == "sand";
|
|
private property <bool> light-group: root.selected-theme-is-light;
|
|
// Browsing a group does not apply a theme. Restores/reset still reveal the saved selection.
|
|
changed theme-mode => {
|
|
if root.theme-mode != "custom" { root.light-group = root.selected-theme-is-light; }
|
|
}
|
|
in-out property <string> theme-css;
|
|
in-out property <string> theme-file-path;
|
|
in-out property <float> text-size;
|
|
in property <string> theme-error;
|
|
in property <string> theme-status;
|
|
in property <bool> theme-preview;
|
|
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);
|
|
VerticalLayout {
|
|
x: 0px;
|
|
width: Math.min(root.width, 1080px);
|
|
spacing: 0; alignment: start;
|
|
Text { text: @tr("Language"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
|
|
Text { text: @tr("Choose your language. Changes apply immediately."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
|
|
Rectangle { height: 10px; }
|
|
HorizontalLayout {
|
|
spacing: 9px;
|
|
ActionButton { text: @tr("System default"); active: root.language-choice == "system"; clicked => { root.language-selected("system"); } }
|
|
ActionButton { text: "Русский"; active: root.language-choice == "ru"; clicked => { root.language-selected("ru"); } }
|
|
ActionButton { text: "English"; active: root.language-choice == "en"; clicked => { root.language-selected("en"); } }
|
|
Rectangle { horizontal-stretch: 1; }
|
|
}
|
|
Rectangle { height: 24px; }
|
|
Text { text: @tr("App theme"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
|
|
Text { text: @tr("One theme for chat, rooms and settings. Change it at any time."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
|
|
Rectangle { height: 20px; }
|
|
HorizontalLayout {
|
|
spacing: 9px;
|
|
ActionButton { text: @tr("Dark themes"); icon: root.light-group ? "circle" : "check"; labeled: true; active: !root.light-group; clicked => { root.light-group = false; } }
|
|
ActionButton { text: @tr("Light themes"); icon: root.light-group ? "check" : "circle"; labeled: true; active: root.light-group; clicked => { root.light-group = true; } }
|
|
Rectangle { horizontal-stretch: 1; }
|
|
ActionButton { text: @tr("Custom"); icon: "palette"; labeled: true; active: root.theme-mode == "custom"; clicked => { root.theme-selected("custom"); } }
|
|
}
|
|
Rectangle { height: 12px; }
|
|
Rectangle {
|
|
height: 332px;
|
|
if !root.light-group : VerticalLayout {
|
|
x: 0px; y: 0px;
|
|
width: Math.min(parent.width, 1080px);
|
|
height: parent.height;
|
|
spacing: 12px;
|
|
HorizontalLayout {
|
|
spacing: 12px;
|
|
ThemeChoice { label: @tr("Extra dark"); selected: root.theme-mode == "black"; preview-background: #090909; preview-sidebar: #111111; preview-rail: #000000; preview-selected: #303030; preview-input: #202020; preview-ink: #f8f6fa; preview-accent: #d5b58a; clicked => { root.theme-selected("black"); } }
|
|
ThemeChoice { label: @tr("Graphite"); selected: root.theme-mode == "dark"; preview-background: #292b31; preview-sidebar: #1d1f25; preview-rail: #121419; preview-selected: #3b4251; preview-input: #323641; preview-ink: #f8f6fa; preview-accent: #d5b58a; clicked => { root.theme-selected("dark"); } }
|
|
ThemeChoice { label: @tr("Midnight"); selected: root.theme-mode == "midnight"; preview-background: #151f32; preview-sidebar: #10192a; preview-rail: #0b1220; preview-selected: #30425c; preview-input: #25334b; preview-ink: #f8f6fa; preview-accent: #9fc5ff; clicked => { root.theme-selected("midnight"); } }
|
|
}
|
|
HorizontalLayout {
|
|
spacing: 12px;
|
|
ThemeChoice { label: @tr("Pine"); selected: root.theme-mode == "pine"; preview-background: #172b26; preview-sidebar: #11231e; preview-rail: #0b1915; preview-selected: #304b40; preview-input: #253c34; preview-ink: #f8f6fa; preview-accent: #91d6af; clicked => { root.theme-selected("pine"); } }
|
|
ThemeChoice { label: @tr("Aubergine"); selected: root.theme-mode == "aubergine"; preview-background: #2a2031; preview-sidebar: #211827; preview-rail: #170f1c; preview-selected: #493650; preview-input: #3b2d45; preview-ink: #f8f6fa; preview-accent: #dfb0eb; clicked => { root.theme-selected("aubergine"); } }
|
|
ThemeChoice { label: @tr("Espresso"); selected: root.theme-mode == "espresso"; preview-background: #2d241f; preview-sidebar: #241c17; preview-rail: #1b140f; preview-selected: #4b3b30; preview-input: #3e3129; preview-ink: #f8f6fa; preview-accent: #e8bd8d; clicked => { root.theme-selected("espresso"); } }
|
|
}
|
|
}
|
|
if root.light-group : VerticalLayout {
|
|
x: 0px; y: 0px;
|
|
width: Math.min(parent.width, 1080px);
|
|
height: parent.height;
|
|
spacing: 12px;
|
|
HorizontalLayout {
|
|
spacing: 12px;
|
|
ThemeChoice { label: @tr("Porcelain"); selected: root.theme-mode == "light"; preview-background: #f5f4f2; preview-sidebar: #eae8e5; preview-rail: #dedbd6; preview-selected: #d8d3cb; preview-input: #ffffff; preview-ink: #28252c; preview-accent: #76532b; clicked => { root.theme-selected("light"); } }
|
|
ThemeChoice { label: @tr("Mist"); selected: root.theme-mode == "mist"; preview-background: #f2f3f7; preview-sidebar: #e7e9f0; preview-rail: #dadee9; preview-selected: #cfd5e5; preview-input: #ffffff; preview-ink: #28252c; preview-accent: #43578c; clicked => { root.theme-selected("mist"); } }
|
|
ThemeChoice { label: @tr("Glacier"); selected: root.theme-mode == "glacier"; preview-background: #eff6fa; preview-sidebar: #e0edf4; preview-rail: #d1e3ee; preview-selected: #c8e0ec; preview-input: #ffffff; preview-ink: #28252c; preview-accent: #23617e; clicked => { root.theme-selected("glacier"); } }
|
|
}
|
|
HorizontalLayout {
|
|
spacing: 12px;
|
|
ThemeChoice { label: @tr("Sage"); selected: root.theme-mode == "sage"; preview-background: #f0f6ef; preview-sidebar: #e2ecdf; preview-rail: #d3e1ce; preview-selected: #cbdcc4; preview-input: #ffffff; preview-ink: #28252c; preview-accent: #3f653b; clicked => { root.theme-selected("sage"); } }
|
|
ThemeChoice { label: @tr("Rose"); selected: root.theme-mode == "rose"; preview-background: #faf2f4; preview-sidebar: #f0e3e8; preview-rail: #e7d4dc; preview-selected: #e3ccd6; preview-input: #ffffff; preview-ink: #28252c; preview-accent: #873e5a; clicked => { root.theme-selected("rose"); } }
|
|
ThemeChoice { label: @tr("Sand"); selected: root.theme-mode == "sand"; preview-background: #faf5e9; preview-sidebar: #f0e7d3; preview-rail: #e6d9bd; preview-selected: #dfd0ae; preview-input: #ffffff; preview-ink: #28252c; preview-accent: #705018; clicked => { root.theme-selected("sand"); } }
|
|
}
|
|
}
|
|
}
|
|
Rectangle { height: 29px; }
|
|
Rectangle { height: 1px; background: Theme.border; }
|
|
Rectangle { height: 24px; }
|
|
HorizontalLayout {
|
|
Text { text: @tr("Text size"); color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; horizontal-stretch: 1; }
|
|
Text { text: Math.round(root.text-size) + " px"; color: Theme.text-secondary; font-size: Math.max(Theme.font-size - 2px, 11px); horizontal-alignment: right; }
|
|
}
|
|
Rectangle { height: 9px; }
|
|
AudioSlider { minimum: 12; maximum: 22; value <=> root.text-size; changed(value) => { root.text-size-changed(value); } }
|
|
Text { text: @tr("Adjust text size throughout the app."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
|
|
Rectangle { height: 29px; }
|
|
if root.theme-mode == "custom" : VerticalLayout {
|
|
spacing: 12px; alignment: start;
|
|
Rectangle { height: 1px; background: Theme.border; }
|
|
Rectangle { height: 8px; }
|
|
HorizontalLayout {
|
|
Text { text: @tr("Theme editor"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; horizontal-stretch: 1; }
|
|
if root.theme-preview : Text { text: @tr("Preview"); color: Theme.accent; font-size: Math.max(Theme.font-size - 3px, 11px); }
|
|
}
|
|
Text { text: @tr("CSS variables in :root control colours and text size. CSS selectors, layout rules and external resources are not supported."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
|
|
ThemeEditor { text <=> root.theme-css; height: 220px; }
|
|
HorizontalLayout {
|
|
spacing: 9px;
|
|
ActionButton { text: @tr("Preview"); clicked => { root.preview-theme(root.theme-css); } }
|
|
ActionButton { text: @tr("Apply"); active: true; clicked => { root.apply-theme(root.theme-css); } }
|
|
Rectangle { horizontal-stretch: 1; }
|
|
ActionButton { text: @tr("Reset"); quiet: true; clicked => { root.reset-theme(); } }
|
|
}
|
|
Text { text: @tr("Main variables: --vnox-bg, --vnox-surface, --vnox-text, --vnox-accent, --vnox-font-size. See the theme documentation for the full list."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 4px, 11px); wrap: word-wrap; }
|
|
Rectangle { height: 8px; }
|
|
Rectangle { height: 1px; background: Theme.border; }
|
|
Rectangle { height: 8px; }
|
|
Text { text: @tr("Theme file"); color: Theme.text-primary; font-size: Theme.font-size - 1px; font-weight: 600; }
|
|
Text { text: @tr("Enter a local .css path to import or export a theme."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
|
|
ThemeInput { text <=> root.theme-file-path; placeholder-text: @tr("For example: /home/user/themes/my-vnox.css"); accepted => { root.import-theme(root.theme-file-path); } }
|
|
HorizontalLayout {
|
|
spacing: 9px;
|
|
ActionButton { text: @tr("Import"); clicked => { root.import-theme(root.theme-file-path); } }
|
|
ActionButton { text: @tr("Export"); clicked => { root.export-theme(root.theme-file-path); } }
|
|
Rectangle { horizontal-stretch: 1; }
|
|
}
|
|
}
|
|
if root.theme-error != "" : Text { text: root.theme-error; color: Theme.danger; font-size: Math.max(Theme.font-size - 2px, 11px); wrap: word-wrap; }
|
|
if root.theme-status != "" : Text { text: root.theme-status; color: Theme.success; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
|
|
Rectangle { height: 26px; }
|
|
}
|
|
}
|