// Settings screen: categories on the left, the selected page's rows on one // grouped platter on the right. // // Only text and icons are drawn here. The glass (platter, focus pills) 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, AudioIcon, PowerIcon, SignalIcon, LockIcon, ChevronIcon, StoreIcon, CheckIcon, LinkIcon } 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: AudioIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 3: WifiIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 4: PowerIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 5: InfoIcon { width: 100%; height: 100%; ink: root.ink; } // App Store mode: Felfedezés, Telepítve, Források. if root.index == 6: StoreIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 7: CheckIcon { width: 100%; height: 100%; ink: root.ink; } if root.index == 8: LinkIcon { 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; // The same pane serves the App Store (app.slint set-mode). in property heading: "Beállítások"; in property icon-base: 0; // Row text is inset from the platter edge by the focus pill's margin. property inset: 8 * root.u; property pad: 28 * root.u; // ---- left column ---------------------------------------------------- Text { x: root.nav-x; y: root.pane-y; width: root.nav-w; height: 88 * root.u; vertical-alignment: center; text: root.heading; font-weight: 700; font-size: 56 * root.u; letter-spacing: -1 * 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.62 + 0.38 * self.sel); x: root.nav-x; y: root.nav-y + i * root.nav-step; width: root.nav-w; height: root.nav-h; NavIcon { x: 24 * root.u; y: (parent.height - self.height) / 2; width: 32 * root.u; height: 32 * root.u; index: i + root.icon-base; ink: parent.ink; } Text { x: 76 * root.u; width: parent.width - 96 * root.u; height: parent.height; vertical-alignment: center; text: name; font-size: 26 * root.u; font-weight: 600; color: parent.ink; overflow: elide; } } // ---- right column --------------------------------------------------- Text { x: root.rows-x + root.inset + root.pad; y: root.nav-y; width: root.rows-w - 2 * (root.inset + root.pad); height: root.nav-h; vertical-alignment: center; text: root.title; font-weight: 700; font-size: 40 * root.u; color: #ffffff; overflow: elide; } Text { x: root.rows-x + root.inset + root.pad; y: root.nav-y + root.nav-h; width: root.rows-w - 2 * (root.inset + root.pad); height: root.rows-y - root.nav-y - root.nav-h - 24 * root.u; text: root.subtitle; wrap: word-wrap; overflow: elide; font-size: 24 * 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; // Focus on this row or the one above hides the hairline between them. property f-above: max(0, 1 - abs(root.row-pos - (j - 1))) * 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 + root.inset; y: self.top; width: root.rows-w - 2 * root.inset; height: root.row-h; opacity: self.vis; visible: self.vis > 0.01; if j > 0: Rectangle { x: root.pad; y: 0; width: parent.width - 2 * root.pad; height: 1.5 * root.u; background: #ffffff1f; opacity: 1 - clamp(max(r.f, r.f-above) * 2, 0, 1); } Text { x: root.pad; y: row.detail == "" ? (parent.height - self.height) / 2 : 14 * root.u; width: parent.width * 0.56; text: row.title; font-size: 26 * root.u; font-weight: 600; color: r.ink; overflow: elide; } if row.detail != "": Text { x: root.pad; y: 50 * root.u; width: parent.width * 0.56; text: row.detail; font-size: 21 * root.u; color: r.ink-dim; overflow: elide; } Text { x: parent.width * 0.4; width: parent.width * 0.6 - (r.network ? 120 : r.chevron ? 64 : root.pad / root.u) * root.u; height: parent.height; horizontal-alignment: right; vertical-alignment: center; text: row.value; font-size: row.kind == "option" ? 28 * root.u : 24 * 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: ChevronIcon { x: parent.width - root.pad - self.width + 4 * root.u; y: (parent.height - self.height) / 2; width: 24 * root.u; height: 24 * root.u; ink: r.ink-dim; } // Wi-Fi network: lock (protected) and signal strength on the right. if r.network && row.lock: LockIcon { x: parent.width - root.pad - 34 * root.u - 16 * root.u - self.width; 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 - root.pad - self.width; y: (parent.height - self.height) / 2; width: 34 * root.u; height: 34 * root.u; level: row.level; ink: r.ink; } } }