slint/demos/printerdemo/ui/settings_page.slint
Simon Hausmann a98d4709be Move printer demo and energy-monitor into new top-level demos/ folder
These are showing off use-cases for Slint, but they're not examples showing individual Slint features.

Also removed the old printerdemo while at it.
2024-10-25 12:09:32 +02:00

97 lines
2.6 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { DemoPalette, Page, SpinBox, ComboBox, CheckBox, Label } from "common.slint";
export global PrinterSettings {
callback change-language(int);
}
export component SettingsPage inherits Page {
header: @tr("Settings");
GridLayout {
padding-top: 46px /* header line height in design */
+ /* extra top-padding in design */ 27px;
spacing: 24px;
Row {
Text {
colspan: 4;
text: @tr("General");
color: DemoPalette.secondary-foreground-color;
font-size: DemoPalette.base-font-size * 1.125;
font-weight: 800;
}
}
Row {
Label { text: @tr("TURBO mode"); }
CheckBox { checked: true; }
Rectangle {}
Label { text: @tr("Power Management"); }
CheckBox {
checked: false;
text: @tr("Eco Mode");
}
}
Row {
Text {
colspan: 4;
text: @tr("Defaults");
color: DemoPalette.secondary-foreground-color;
font-size: DemoPalette.base-font-size * 1.125;
font-weight: 800;
}
}
Row {
Label { text: @tr("Layout"); }
ComboBox {
value: @tr("Portrait");
choices: [@tr("Portrait"), @tr("Landscape")];
}
Rectangle {}
Label { text: @tr("Paper Tray"); }
ComboBox {
value: @tr("Special Tray");
choices: [@tr("Special Tray"), @tr("Normal Tray")];
}
}
Row {
Label { text: @tr("Quality"); }
ComboBox {
value: @tr("Best");
choices: [@tr("Best"), @tr("Medium"), @tr("Draft")];
}
Rectangle {}
Label { text: @tr("Language"); }
ComboBox {
value: @tr("English");
choices: [@tr("English"), @tr("French")];
selected(x) => { PrinterSettings.change-language(x); }
}
}
Row {
Label { text: @tr("Color Mode"); }
ComboBox {
value: @tr("Grayscale");
choices: [@tr("Grayscale"), @tr("RGB"), @tr("YCMB")];
}
Rectangle {}
Label { text: @tr("Paper Handling"); }
CheckBox {
checked: true;
text: @tr("Sort Pages");
}
}
Row { Rectangle {} }
}
}