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

OutputProcessWidget.qml « ActionPanel « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6ab8dc6fbb8583871bb1b9e7e84a1e8d3fcb838e (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// 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.1
import QtQuick.Layouts 1.3

import UM 1.1 as UM
import Cura 1.0 as Cura


// This element contains all the elements the user needs to visualize the data
// that is gather after the slicing process, such as printint time, material usage, ...
// There are also two buttons: one to previsualize the output layers, and the other to
// select what to do with it (such as print over network, save to file, ...)
Column
{
    id: widget

    spacing: UM.Theme.getSize("thin_margin").height
    property bool preSlicedData: PrintInformation.preSliced

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

    Item
    {
        id: information
        width: parent.width
        height: childrenRect.height

        Column
        {
            id: timeAndCostsInformation
            spacing: UM.Theme.getSize("thin_margin").height

            anchors
            {
                left: parent.left
                right: printInformationPanel.left
                rightMargin: UM.Theme.getSize("thin_margin").height
            }

            Cura.IconLabel
            {
                id: estimatedTime
                width: parent.width

                text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long)
                source: UM.Theme.getIcon("clock")
                font: UM.Theme.getFont("small")
            }

            Cura.IconLabel
            {
                id: estimatedCosts
                width: parent.width

                property var printMaterialLengths: PrintInformation.materialLengths
                property var printMaterialWeights: PrintInformation.materialWeights

                text:
                {
                    if (preSlicedData)
                    {
                        return catalog.i18nc("@label", "No cost estimation available")
                    }
                    var totalLengths = 0
                    var totalWeights = 0
                    if (printMaterialLengths)
                    {
                        for(var index = 0; index < printMaterialLengths.length; index++)
                        {
                            if(printMaterialLengths[index] > 0)
                            {
                                totalLengths += printMaterialLengths[index]
                                totalWeights += Math.round(printMaterialWeights[index])
                            }
                        }
                    }
                    return totalWeights + "g · " + totalLengths.toFixed(2) + "m"
                }
                source: UM.Theme.getIcon("spool")
                font: UM.Theme.getFont("very_small")
            }
        }

        PrintInformationWidget
        {
            id: printInformationPanel
            visible: !preSlicedData

            anchors
            {
                right: parent.right
                verticalCenter: timeAndCostsInformation.verticalCenter
            }
        }
    }

    Row
    {
        id: buttonRow
        spacing: UM.Theme.getSize("default_margin").width
        width: parent.width

        Cura.SecondaryButton
        {
            id: previewStageShortcut

            height: UM.Theme.getSize("action_panel_button").height
            leftPadding: UM.Theme.getSize("default_margin").width
            rightPadding: UM.Theme.getSize("default_margin").width
            text: catalog.i18nc("@button", "Preview")

            onClicked: UM.Controller.setActiveStage("PreviewStage")
            visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage"

            shadowEnabled: true
            shadowColor: UM.Theme.getColor("action_button_disabled_shadow")
        }

        Cura.OutputDevicesActionButton
        {
            width: previewStageShortcut.visible ? UM.Theme.getSize("action_panel_button").width : parent.width
            height: UM.Theme.getSize("action_panel_button").height
        }
    }
}