| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: MIT |
| 3 | |
| 4 | import { Switch, GridBox, ListView, ScrollView, HorizontalBox, VerticalBox, Palette } from "std-widgets.slint" ; |
| 5 | |
| 6 | import { GallerySettings } from "../gallery_settings.slint" ; |
| 7 | |
| 8 | export component Page inherits VerticalBox { |
| 9 | in property<string> title: "title" ; |
| 10 | in property<string> description: "description" ; |
| 11 | in property<bool> show-enable-switch: true; |
| 12 | |
| 13 | accessible-role: tab-panel; |
| 14 | accessible-label: root.title; |
| 15 | |
| 16 | HorizontalBox { |
| 17 | Text { |
| 18 | font-size: 20px; |
| 19 | text <=> root.title; |
| 20 | } |
| 21 | |
| 22 | // Spacer |
| 23 | Rectangle {} |
| 24 | |
| 25 | if show-enable-switch: Switch { |
| 26 | horizontal-stretch: 0; |
| 27 | text: @tr("Widgets enabled" ); |
| 28 | checked <=> GallerySettings.widgets-enabled; |
| 29 | enabled: true; |
| 30 | } |
| 31 | |
| 32 | Switch { |
| 33 | horizontal-stretch: 0; |
| 34 | text: @tr("Dark Mode" ); |
| 35 | checked: Palette.color-scheme == ColorScheme.dark; |
| 36 | toggled => { |
| 37 | Palette.color-scheme = self.checked ? ColorScheme.dark : ColorScheme.light; |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | @children |
| 43 | } |