// Settings screen: categories on the left, rows on the right. // // Only text and icons are drawn here. The glass (pane, rows, chips) comes from // `settings_screen::glass` in Rust, which mirrors the geometry below: keep the // row/nav formulas (position, focus `f`, visibility `vis`) in sync with it. import { WifiIcon, BluetoothIcon, InfoIcon, DisplayIcon, PowerIcon, SignalIcon, LockIcon } from "icons.slint"; export struct SettingRow { title: string, value: string, detail: string, // info | choice | device | action | danger | option | network kind: string, // network rows: signal bars (1-4) and a lock for protected networks level: int, lock: bool, } component NavIcon inherits Rectangle { in property index; in property ink; if root.index == 0: DisplayIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 1: BluetoothIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 2: WifiIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 3: PowerIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 4: InfoIcon { width: 100%; height: 100%; ink: root.ink; } } export component SettingsView inherits Rectangle { in property u; in property pane-x; in property pane-y; in property pane-h; in property nav-x; in property nav-y; in property nav-w; in property nav-h; in property nav-step; in property rows-x; in property rows-y; in property rows-w; in property row-h; in property row-step; in property rows-view-h; in property rows-scroll; in property nav-pos; in property nav-active; in property row-pos; in property content-active; in property title; in property subtitle; in property <[SettingRow]> rows; in property <[string]> categories; // ---- left column ---------------------------------------------------- Text { x: root.nav-x + 8 * root.u; y: root.pane-y + 50 * root.u; text: "Beállítások"; font-family: "Inter Display"; font-weight: 800; font-size: 50 * root.u; letter-spacing: -1.5 * root.u; color: #ffffff; } for name[i] in root.categories: Rectangle { property f: max(0, 1 - abs(root.nav-pos - i)) * root.nav-active; property sel: max(0, 1 - abs(root.nav-pos - i)); property ink: self.f > 0.5 ? #121317 : #ffffff.with-alpha(0.72 + 0.28 * self.sel); x: root.nav-x; y: root.nav-y + i * root.nav-step; width: root.nav-w; height: root.nav-h; NavIcon { x: 28 * root.u; y: (parent.height - self.height) / 2; width: 34 * root.u; height: 34 * root.u; index: i; ink: parent.ink; } Text { x: 82 * root.u; width: parent.width - 100 * root.u; height: parent.height; vertical-alignment: center; text: name; font-size: 26 * root.u; font-weight: 600; color: parent.ink; overflow: elide; } } Text { x: root.nav-x; y: root.pane-y + root.pane-h - 92 * root.u; width: 300 * root.u; height: 56 * root.u; horizontal-alignment: center; vertical-alignment: center; text: "‹ Vissza · Esc"; font-size: 21 * root.u; font-weight: 500; color: #ffffffc0; } // ---- right column --------------------------------------------------- Text { x: root.rows-x + 8 * root.u; y: root.pane-y + 44 * root.u; width: root.rows-w - 16 * root.u; text: root.title; font-family: "Inter Display"; font-weight: 800; font-size: 40 * root.u; letter-spacing: -1 * root.u; color: #ffffff; overflow: elide; } Text { x: root.rows-x + 8 * root.u; y: root.pane-y + 102 * root.u; width: root.rows-w - 16 * root.u; height: 64 * root.u; text: root.subtitle; wrap: word-wrap; overflow: elide; font-size: 21 * root.u; color: #ffffffa8; } for row[j] in root.rows: r := Rectangle { property f: max(0, 1 - abs(root.row-pos - j)) * root.content-active; property top: root.rows-y + j * root.row-step - root.rows-scroll; property over: max(root.rows-y - self.top, self.top + root.row-h - (root.rows-y + root.rows-view-h)) / root.row-h; property vis: clamp(1 - self.over, 0, 1); property hot: self.f > 0.5; property danger: row.kind == "danger"; property ink: self.hot ? (self.danger ? #ffffff : #121317) : (self.danger ? #ff8278 : #ffffff); property ink-dim: self.hot ? (self.danger ? #ffffffd0 : #121317b0) : #ffffff99; property chevron: row.kind == "choice" || row.kind == "device"; property network: row.kind == "network"; x: root.rows-x; y: self.top; width: root.rows-w; height: root.row-h; opacity: self.vis; visible: self.vis > 0.01; Text { x: 30 * root.u; y: row.detail == "" ? (parent.height - self.height) / 2 : 15 * root.u; width: parent.width * 0.55; text: row.title; font-size: 26 * root.u; font-weight: 600; color: r.ink; overflow: elide; } if row.detail != "": Text { x: 30 * root.u; y: 51 * root.u; width: parent.width * 0.55; text: row.detail; font-size: 19 * root.u; color: r.ink-dim; overflow: elide; } Text { x: parent.width * 0.4; width: parent.width * 0.6 - (r.network ? 124 : r.chevron ? 64 : 32) * root.u; height: parent.height; horizontal-alignment: right; vertical-alignment: center; text: row.value; font-size: row.kind == "option" ? 30 * root.u : 23 * root.u; font-weight: row.kind == "option" ? 700 : 400; color: row.kind == "option" ? (r.hot ? #121317 : #ff9a5c) : r.ink-dim; overflow: elide; } if r.chevron: Text { x: parent.width - 50 * root.u; width: 24 * root.u; height: parent.height; vertical-alignment: center; text: "›"; font-size: 36 * root.u; color: r.ink-dim; } // Wi-Fi network: lock (protected) and signal strength on the right. if r.network && row.lock: LockIcon { x: parent.width - 104 * root.u; y: (parent.height - self.height) / 2; width: 24 * root.u; height: 24 * root.u; ink: r.ink-dim; } if r.network: SignalIcon { x: parent.width - 66 * root.u; y: (parent.height - self.height) / 2; width: 34 * root.u; height: 34 * root.u; level: row.level; ink: r.ink; } } }