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

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

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

import UM 1.1 as UM
import Cura 1.6 as Cura


UM.Dialog
{
    visible: true
    title: catalog.i18nc("@title", "Changes from your account")
    width: UM.Theme.getSize("popup_dialog").width
    height: UM.Theme.getSize("popup_dialog").height
    minimumWidth: width
    maximumWidth: minimumWidth
    minimumHeight: height
    maximumHeight: minimumHeight
    margin: 0

    property string actionButtonText: subscribedPackagesModel.hasIncompatiblePackages && !subscribedPackagesModel.hasCompatiblePackages ? catalog.i18nc("@button", "Dismiss") : catalog.i18nc("@button", "Next")

    Rectangle
    {
        id: root
        anchors.fill: parent
        color: UM.Theme.getColor("main_background")

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

        ScrollView
        {
            width: parent.width
            height: parent.height - nextButton.height - nextButton.anchors.margins * 2 // We want some leftover space for the button at the bottom
            clip: true

            Column
            {
                anchors.fill: parent
                anchors.margins: UM.Theme.getSize("default_margin").width

                // Compatible packages
                Label
                {
                    font: UM.Theme.getFont("default")
                    text: catalog.i18nc("@label", "The following packages will be added:")
                    visible: subscribedPackagesModel.hasCompatiblePackages
                    color: UM.Theme.getColor("text")
                    height: contentHeight + UM.Theme.getSize("default_margin").height
                }
                Repeater
                {
                    model: subscribedPackagesModel
                    Component
                    {
                        Item
                        {
                            width: parent.width
                            property int lineHeight: 60
                            visible: model.is_compatible
                            height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the compatible packages here
                            Image
                            {
                                id: packageIcon
                                source: model.icon_url || "../../images/placeholder.svg"
                                height: lineHeight
                                width: height
                                sourceSize.height: height
                                sourceSize.width: width
                                mipmap: true
                                fillMode: Image.PreserveAspectFit
                            }
                            Label
                            {
                                text: model.display_name
                                font: UM.Theme.getFont("medium_bold")
                                anchors.left: packageIcon.right
                                anchors.leftMargin: UM.Theme.getSize("default_margin").width
                                anchors.verticalCenter: packageIcon.verticalCenter
                                color: UM.Theme.getColor("text")
                                elide: Text.ElideRight
                            }
                        }
                    }
                }

                // Incompatible packages
                Label
                {
                    font: UM.Theme.getFont("default")
                    text: catalog.i18nc("@label", "The following packages can not be installed because of an incompatible Cura version:")
                    visible: subscribedPackagesModel.hasIncompatiblePackages
                    color: UM.Theme.getColor("text")
                    height: contentHeight + UM.Theme.getSize("default_margin").height
                }
                Repeater
                {
                    model: subscribedPackagesModel
                    Component
                    {
                        Item
                        {
                            width: parent.width
                            property int lineHeight: 60
                            visible: !model.is_compatible && !model.is_dismissed
                            height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the incompatible packages here
                            Image
                            {
                                id: packageIcon
                                source: model.icon_url || "../../images/placeholder.svg"
                                height: lineHeight
                                width: height
                                sourceSize.height: height
                                sourceSize.width: width
                                mipmap: true
                                fillMode: Image.PreserveAspectFit
                            }
                            Label
                            {
                                text: model.display_name
                                font: UM.Theme.getFont("medium_bold")
                                anchors.left: packageIcon.right
                                anchors.leftMargin: UM.Theme.getSize("default_margin").width
                                anchors.verticalCenter: packageIcon.verticalCenter
                                color: UM.Theme.getColor("text")
                                elide: Text.ElideRight
                            }
                        }
                    }
                }
            }

        } // End of ScrollView

        Cura.PrimaryButton
        {
            id: nextButton
            anchors.bottom: parent.bottom
            anchors.right: parent.right
            anchors.margins: UM.Theme.getSize("default_margin").height
            text: actionButtonText
            onClicked: accept()
            leftPadding: UM.Theme.getSize("dialog_primary_button_padding").width
            rightPadding: UM.Theme.getSize("dialog_primary_button_padding").width
        }
    }
}