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

ActionPanelWidget.qml « ActionPanel « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6efa77518bd37f7ee4c41de03cb27a0da2271507 (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
// Copyright (c) 2019 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.2 as UM
import Cura 1.0 as Cura


// This element hold all the elements needed for the user to trigger the slicing process, and later
// to get information about the printing times, material consumption and the output process (such as
// saving to a file, printing over network, ...
Item
{
    id: base
    width: childrenRect.width
    height: childrenRect.height
    visible: CuraApplication.platformActivity

    property bool hasPreviewButton: true

    Rectangle
    {
        id: actionPanelWidget

        width: UM.Theme.getSize("action_panel_widget").width
        height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height
        anchors.right: parent.right
        color: UM.Theme.getColor("main_background")
        border.width: UM.Theme.getSize("default_lining").width
        border.color: UM.Theme.getColor("lining")
        radius: UM.Theme.getSize("default_radius").width
        z: 10

        property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled

        Loader
        {
            id: loader
            anchors
            {
                top: parent.top
                topMargin: UM.Theme.getSize("thick_margin").height
                left: parent.left
                leftMargin: UM.Theme.getSize("thick_margin").width
                right: parent.right
                rightMargin: UM.Theme.getSize("thick_margin").width
            }
            sourceComponent: actionPanelWidget.outputAvailable ? outputProcessWidget : sliceProcessWidget
            onLoaded:
            {
                if(actionPanelWidget.outputAvailable)
                {
                    loader.item.hasPreviewButton = base.hasPreviewButton;
                }
            }
        }

        Component
        {
            id: sliceProcessWidget
            SliceProcessWidget { }
        }

        Component
        {
            id: outputProcessWidget
            OutputProcessWidget { }
        }
    }

    Item
    {
        id: additionalComponents
        width: childrenRect.width
        anchors.right: actionPanelWidget.left
        anchors.rightMargin: UM.Theme.getSize("default_margin").width
        anchors.bottom: actionPanelWidget.bottom
        anchors.bottomMargin: UM.Theme.getSize("thick_margin").height * 2
        visible: actionPanelWidget.visible
        Row
        {
            id: additionalComponentsRow
            anchors.verticalCenter: parent.verticalCenter
            spacing: UM.Theme.getSize("default_margin").width
        }
    }

    Component.onCompleted: base.addAdditionalComponents()

    Connections
    {
        target: CuraApplication
        onAdditionalComponentsChanged: base.addAdditionalComponents()
    }

    function addAdditionalComponents()
    {
        for (var component in CuraApplication.additionalComponents["saveButton"])
        {
            CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
        }
    }
}