slint/examples/printerdemo/ui/usb_page.60
Olivier Goffart 07e2532c0b Printer Demo: rename PrinterQueue component
PrinterQueue -> PrineterQueueView
PrinterQueueData -> PrinterQueue
2021-08-27 16:55:07 +02:00

100 lines
2.9 KiB
Text

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
import { DemoPalette, Page, SpinBox, Label, ComboBox, PushButton, CheckBox } from "./common.60";
import { StandardListView } from "sixtyfps_widgets.60";
import { PrinterQueue } from "./printer_queue.60";
export UsbPage := Page {
has-back-button: true;
header: "USB";
GridLayout {
padding-top: 46px /* header line height in design */
+ /* extra top-padding in design */ 27px;
spacing: 24px;
Image {
width: 50%;
source: @image-url("images/cat_preview_round.png");
image-fit: contain;
rowspan: 5;
}
Label {
col: 1;
row: 0;
text: "Select File:";
vertical-stretch: 0;
max-height: 32px;
}
list-view := StandardListView {
col: 1;
row: 1;
colspan: 2;
horizontal-stretch: 1;
vertical-stretch: 1;
model: [
{ text: ".." },
{ text: "cat.png" },
{ text: "dog.png" },
{ text: "elephant.png" },
{ text: "snake.png" },
];
}
Row {
Label { col: 1; text: "Copies"; }
SpinBox {
value: 1;
minimum: 1;
}
}
Row {
Label { col: 1; text: "Color"; }
ComboBox {
value: "Grayscale";
choices: ["Grayscale", "Color"];
}
}
HorizontalLayout {
row: 4;
col: 1;
colspan: 2;
Rectangle {
horizontal-stretch: 0;
width: 10%;
}
PushButton {
icon: @image-url("images/print.svg");
text: "Start printing";
clicked => {
//FIXME!
if (list-view.current-item == 2) {
PrinterQueue.start-job("dog.png");
} else if (list-view.current-item == 3) {
PrinterQueue.start-job("elephant.png");
} else if (list-view.current-item == 4) {
PrinterQueue.start-job("snake.png");
} else {
PrinterQueue.start-job("cat.png");
}
}
}
Rectangle {
horizontal-stretch: 0;
width: 10%;
}
}
}
}