Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PrintWindow.qml « qml « resources « UM3NetworkPrinting « plugins - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1c561ccaeeb2dbe1b3c580ddae5f74839c88aff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Window 2.2
import QtQuick.Controls 2.15

import UM 1.5 as UM

UM.Dialog {

    id: base;
    title: catalog.i18nc("@title:window", "Print over network");
    width: minimumWidth;
    height: minimumHeight;
    maximumHeight: minimumHeight;
    maximumWidth: minimumWidth;
    minimumHeight: 140 * screenScaleFactor;
    minimumWidth: 500 * screenScaleFactor;
    modality: Qt.ApplicationModal;

    Component.onCompleted: {
        populateComboBox()
    }

    // populates the combo box with the correct printer values
    function populateComboBox() {
        comboBoxPrintersModel.clear();
        comboBoxPrintersModel.append({ name: "Automatic", key: "" });  // Connect will just do it's thing
        for (var i in OutputDevice.printers) {
            comboBoxPrintersModel.append({
                name: OutputDevice.printers[i].name,
                key: OutputDevice.printers[i].uniqueName
            });
        }
    }

    leftButtons: [
        Button {
            enabled: true;
            onClicked: {
                base.close();
            }
            text: catalog.i18nc("@action:button","Cancel");
        }
    ]
    rightButtons: [
        Button {
            enabled: true;
            onClicked: {
                OutputDevice.selectTargetPrinter(printerComboBox.model.get(printerComboBox.currentIndex).key);
                base.close();
            }
            text: catalog.i18nc("@action:button","Print");
        }
    ]

    Column {
        id: printerSelection;
        anchors {
            fill: parent;
            leftMargin: UM.Theme.getSize("default_margin").width;
            rightMargin: UM.Theme.getSize("default_margin").width;
            top: parent.top;
            topMargin: UM.Theme.getSize("default_margin").height;
        }
        height: 50 * screenScaleFactor;

        UM.I18nCatalog {
            id: catalog;
            name: "cura";
        }

        UM.Label {
            id: manualPrinterSelectionLabel;
            anchors {
                left: parent.left;
                right: parent.right;
                topMargin: UM.Theme.getSize("default_margin").height;
            }
            height: 20 * screenScaleFactor;
            text: catalog.i18nc("@label", "Printer selection");
        }

        ComboBox {
            id: printerComboBox;
            currentIndex: 0;
            Behavior on height { NumberAnimation { duration: 100 } }
            height: 40 * screenScaleFactor;
            model: ListModel {
                id: comboBoxPrintersModel;
            }
            textRole: "name";
            width: parent.width;
        }
    }
}