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

MoreInfoWindow.qml « SliceInfoPlugin « plugins - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f60089343b4166efae3cc31652aacf8e807f086 (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Window 2.2

import UM 1.5 as UM
import Cura 1.1 as Cura

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

    id: baseDialog
    title: catalog.i18nc("@title:window", "More information on anonymous data collection")
    visible: false

    modality: Qt.ApplicationModal

    minimumWidth: 500 * screenScaleFactor
    minimumHeight: 400 * screenScaleFactor
    width: minimumWidth
    height: minimumHeight

    color: UM.Theme.getColor("main_background")

    property bool allowSendData: true  // for saving the user's choice

    onVisibilityChanged:
    {
        if (visible)
        {
            baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info")
            if (baseDialog.allowSendData)
            {
                allowSendButton.checked = true
            }
            else
            {
                dontSendButton.checked = true
            }
        }
    }

    // Main content area
    Item
    {
        anchors.fill: parent
        anchors.margins: UM.Theme.getSize("default_margin").width

        Item  // Text part
        {
            id: textRow
            anchors
            {
                top: parent.top
                bottom: radioButtonsRow.top
                bottomMargin: UM.Theme.getSize("default_margin").height
                left: parent.left
                right: parent.right
            }

            Label
            {
                id: headerText
                anchors
                {
                    top: parent.top
                    left: parent.left
                    right: parent.right
                }
                text: catalog.i18nc("@text:window", "Ultimaker Cura collects anonymous data in order to improve the print quality and user experience. Below is an example of all the data that is shared:")
                color: UM.Theme.getColor("text")
                wrapMode: Text.WordWrap
                renderType: Text.NativeRendering
            }

            Cura.ScrollableTextArea
            {
                anchors
                {
                    top: headerText.bottom
                    topMargin: UM.Theme.getSize("default_margin").height
                    bottom: parent.bottom
                    bottomMargin: UM.Theme.getSize("default_margin").height
                    left: parent.left
                    right: parent.right
                }

                textArea.text: (manager === null) ? "" : manager.getExampleData()
                textArea.textFormat: Text.RichText
                textArea.wrapMode: Text.Wrap
                textArea.readOnly: true
            }
        }

        Column  // Radio buttons for agree and disagree
        {
            id: radioButtonsRow
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: buttonRow.top
            anchors.bottomMargin: UM.Theme.getSize("default_margin").height

            Cura.RadioButton
            {
                id: dontSendButton
                text: catalog.i18nc("@text:window", "I don't want to send anonymous data")
                onClicked:
                {
                    baseDialog.allowSendData = !checked
                }
            }
            Cura.RadioButton
            {
                id: allowSendButton
                text: catalog.i18nc("@text:window", "Allow sending anonymous data")
                onClicked:
                {
                    baseDialog.allowSendData = checked
                }
            }
        }

        Item  // Bottom buttons
        {
            id: buttonRow
            anchors.bottom: parent.bottom
            anchors.left: parent.left
            anchors.right: parent.right

            height: childrenRect.height

            Cura.PrimaryButton
            {
                anchors.right: parent.right
                text: catalog.i18nc("@action:button", "OK")
                onClicked:
                {
                    manager.setSendSliceInfo(allowSendData)
                    baseDialog.hide()
                }
            }

            Cura.SecondaryButton
            {
                anchors.left: parent.left
                text: catalog.i18nc("@action:button", "Cancel")
                onClicked:
                {
                    baseDialog.hide()
                }
            }
        }
    }
}