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

MachineSelectorList.qml « PrinterSelector « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 10458ea4a445971e227f18320398408c0bdb3158 (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
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.7
import QtQuick.Controls 2.3

import UM 1.5 as UM
import Cura 1.0 as Cura

ListView
{
    id: listView
    model: Cura.GlobalStacksModel {}
    section.property: "hasRemoteConnection"
    property real contentHeight: childrenRect.height

    section.delegate: UM.Label
    {
        text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers")
        width: parent.width
        height: UM.Theme.getSize("action_button").height
        leftPadding: UM.Theme.getSize("default_margin").width
        font: UM.Theme.getFont("medium")
        color: UM.Theme.getColor("text_medium")
    }

    delegate: MachineSelectorButton
    {
        text: model.name ? model.name : ""
        width: listView.width
        outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null

        checked: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.id == model.id : false

        onClicked:
        {
            toggleContent()
            Cura.MachineManager.setActiveMachine(model.id)
        }
    }
}