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

ProjectSummaryCard.qml « qml « resources « DigitalLibrary « plugins - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4374b2f99868785fbeb728574a72c378e41f3161 (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
// Copyright (C) 2021 Ultimaker B.V.
import QtQuick 2.10
import QtQuick.Controls 2.3

import UM 1.2 as UM
import Cura 1.6 as Cura

Cura.RoundedRectangle
{
    id: base
    width: parent.width
    height: projectImage.height + 2 * UM.Theme.getSize("default_margin").width
    cornerSide: Cura.RoundedRectangle.Direction.All
    border.color: UM.Theme.getColor("lining")
    border.width: UM.Theme.getSize("default_lining").width
    radius: UM.Theme.getSize("default_radius").width
    color: UM.Theme.getColor("main_background")
    signal clicked()
    property alias imageSource: projectImage.source
    property alias projectNameText: displayNameLabel.text
    property alias projectUsernameText: usernameLabel.text
    property alias projectLastUpdatedText: lastUpdatedLabel.text
    property alias cardMouseAreaEnabled: cardMouseArea.enabled

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

    MouseArea
    {
        id: cardMouseArea
        anchors.fill: parent
        hoverEnabled: true
        onEntered: base.color = UM.Theme.getColor("action_button_hovered")
        onExited: base.color = UM.Theme.getColor("main_background")
        onClicked: base.clicked()
    }
    Row
    {
        id: projectInformationRow
        width: parent.width
        padding: UM.Theme.getSize("default_margin").width
        spacing: UM.Theme.getSize("default_margin").width

        Image
        {
            id: projectImage
            anchors.verticalCenter: parent.verticalCenter
            width: UM.Theme.getSize("toolbox_thumbnail_small").width
            height: Math.round(width * 3/4)
            sourceSize.width: width
            sourceSize.height: height
            fillMode: Image.PreserveAspectFit
            mipmap: true
        }
        Column
        {
            id: projectLabelsColumn
            height: projectImage.height
            width: parent.width - x - UM.Theme.getSize("default_margin").width
            anchors.verticalCenter: parent.verticalCenter

            Label
            {
                id: displayNameLabel
                width: parent.width
                height: Math.round(parent.height / 3)
                elide: Text.ElideRight
                color: UM.Theme.getColor("text")
                font: UM.Theme.getFont("default_bold")
            }

            Label
            {
                id: usernameLabel
                width: parent.width
                height: Math.round(parent.height / 3)
                elide: Text.ElideRight
                color: UM.Theme.getColor("small_button_text")
                font: UM.Theme.getFont("default")
            }

            Label
            {
                id: lastUpdatedLabel
                width: parent.width
                height: Math.round(parent.height / 3)
                elide: Text.ElideRight
                color: UM.Theme.getColor("small_button_text")
                font: UM.Theme.getFont("default")
            }
        }
    }
}