mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 20:15:54 +08:00
Ensure that the packagecard looks like the design
CURA-8561
This commit is contained in:
parent
c8491b4752
commit
4ae01df7f5
@ -12,9 +12,8 @@ Rectangle
|
|||||||
{
|
{
|
||||||
property var packageData
|
property var packageData
|
||||||
|
|
||||||
width: parent ? parent.width - UM.Theme.getSize("thin_margin").width : 0
|
width: parent ? parent.width - UM.Theme.getSize("default_margin").width : 0
|
||||||
height: childrenRect.height + UM.Theme.getSize("thin_margin").height * 2
|
height: UM.Theme.getSize("card").height
|
||||||
|
|
||||||
color: UM.Theme.getColor("main_background")
|
color: UM.Theme.getColor("main_background")
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
|
|
||||||
@ -25,11 +24,6 @@ Rectangle
|
|||||||
name: "Folded"
|
name: "Folded"
|
||||||
when: true // TODO
|
when: true // TODO
|
||||||
PropertyChanges
|
PropertyChanges
|
||||||
{
|
|
||||||
target: downloadCountRow
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
PropertyChanges
|
|
||||||
{
|
{
|
||||||
target: descriptionArea
|
target: descriptionArea
|
||||||
visible: true
|
visible: true
|
||||||
@ -40,11 +34,6 @@ Rectangle
|
|||||||
name: "Header"
|
name: "Header"
|
||||||
when: false // TODO
|
when: false // TODO
|
||||||
PropertyChanges
|
PropertyChanges
|
||||||
{
|
|
||||||
target: downloadCountRow
|
|
||||||
visible: true
|
|
||||||
}
|
|
||||||
PropertyChanges
|
|
||||||
{
|
{
|
||||||
target: descriptionArea
|
target: descriptionArea
|
||||||
visible: false
|
visible: false
|
||||||
@ -59,7 +48,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
margins: UM.Theme.getSize("thin_margin").width
|
margins: UM.Theme.getSize("default_margin").width
|
||||||
}
|
}
|
||||||
width: UM.Theme.getSize("card_icon").width
|
width: UM.Theme.getSize("card_icon").width
|
||||||
height: width
|
height: width
|
||||||
@ -67,25 +56,23 @@ Rectangle
|
|||||||
source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg"
|
source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
Column
|
|
||||||
{
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: parent.top
|
|
||||||
left: packageItem.right
|
|
||||||
right: parent.right
|
|
||||||
margins: UM.Theme.getSize("thin_margin").width
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout //Title row.
|
RowLayout //Title row.
|
||||||
{
|
{
|
||||||
width: parent.width
|
id: titleBar
|
||||||
spacing: UM.Theme.getSize("thin_margin").width
|
anchors
|
||||||
|
{
|
||||||
|
left: packageItem.right
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
rightMargin:UM.Theme.getSize("thick_margin").width
|
||||||
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
|
|
||||||
text: packageData.displayName
|
text: packageData.displayName
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("large_bold")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
verticalAlignment: Text.AlignTop
|
verticalAlignment: Text.AlignTop
|
||||||
}
|
}
|
||||||
@ -94,8 +81,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width
|
Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width
|
||||||
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
|
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
|
||||||
//width: UM.Theme.getSize("card_tiny_icon").width
|
|
||||||
//height: UM.Theme.getSize("card_tiny_icon").height
|
|
||||||
|
|
||||||
enabled: packageData.isVerified
|
enabled: packageData.isVerified
|
||||||
visible: packageData.isVerified
|
visible: packageData.isVerified
|
||||||
@ -151,6 +137,7 @@ Rectangle
|
|||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
|
id: packageVersionLabel
|
||||||
text: packageData.packageVersion
|
text: packageData.packageVersion
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
@ -161,48 +148,27 @@ Rectangle
|
|||||||
{
|
{
|
||||||
id: externalLinkButton
|
id: externalLinkButton
|
||||||
|
|
||||||
Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width
|
Layout.preferredWidth: packageVersionLabel.height
|
||||||
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
|
Layout.preferredHeight: packageVersionLabel.height
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
iconSource: UM.Theme.getIcon("LinkExternal")
|
iconSource: UM.Theme.getIcon("LinkExternal")
|
||||||
hoverColor: UM.Theme.getColor("text_link")
|
hoverColor: UM.Theme.getColor("text_link")
|
||||||
onClicked: Qt.openUrlExternally(packageData.packageInfoUrl)
|
onClicked: Qt.openUrlExternally(packageData.packageInfoUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout
|
|
||||||
{
|
|
||||||
id: downloadCountRow
|
|
||||||
|
|
||||||
x: UM.Theme.getSize("thin_margin").width
|
|
||||||
y: UM.Theme.getSize("thin_margin").height
|
|
||||||
|
|
||||||
spacing: UM.Theme.getSize("thin_margin").width
|
|
||||||
|
|
||||||
UM.RecolorImage
|
|
||||||
{
|
|
||||||
id: downloadCountIcon
|
|
||||||
width: UM.Theme.getSize("card_tiny_icon").width
|
|
||||||
height: UM.Theme.getSize("card_tiny_icon").height
|
|
||||||
color: UM.Theme.getColor("icon")
|
|
||||||
|
|
||||||
source: UM.Theme.getIcon("Download")
|
|
||||||
}
|
|
||||||
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
id: downloadCountLabel
|
|
||||||
text: packageData.downloadCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: descriptionArea
|
id: descriptionArea
|
||||||
width: parent.width
|
|
||||||
height: descriptionLabel.height
|
height: descriptionLabel.height
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: titleBar.bottom
|
||||||
|
left: packageItem.right
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
id: descriptionLabel
|
id: descriptionLabel
|
||||||
@ -220,7 +186,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
if(truncated && line.isLast)
|
if(truncated && line.isLast)
|
||||||
{
|
{
|
||||||
let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - UM.Theme.getSize("default_margin").width;
|
let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width;
|
||||||
if(line.implicitWidth > max_line_width)
|
if(line.implicitWidth > max_line_width)
|
||||||
{
|
{
|
||||||
line.width = max_line_width;
|
line.width = max_line_width;
|
||||||
@ -233,11 +199,22 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: tripleDotLabel
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: descriptionLabel.lastLineWidth
|
||||||
|
anchors.bottom: readMoreButton.bottom
|
||||||
|
|
||||||
|
text: "… "
|
||||||
|
font: descriptionLabel.font
|
||||||
|
color: descriptionLabel.color
|
||||||
|
visible: descriptionLabel.truncated
|
||||||
|
}
|
||||||
Cura.TertiaryButton
|
Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
id: readMoreButton
|
id: readMoreButton
|
||||||
anchors.right: parent.right
|
anchors.left: tripleDotLabel.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
height: fontMetrics.height //Height of a single line.
|
height: fontMetrics.height //Height of a single line.
|
||||||
|
|
||||||
@ -254,25 +231,19 @@ Rectangle
|
|||||||
// NOTE: Is this the right URL for this action?
|
// NOTE: Is this the right URL for this action?
|
||||||
onClicked: Qt.openUrlExternally(packageData.packageInfoUrl)
|
onClicked: Qt.openUrlExternally(packageData.packageInfoUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: descriptionLabel.lastLineWidth
|
|
||||||
anchors.bottom: readMoreButton.bottom
|
|
||||||
|
|
||||||
text: "… "
|
|
||||||
font: descriptionLabel.font
|
|
||||||
color: descriptionLabel.color
|
|
||||||
visible: descriptionLabel.truncated
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout //Author and action buttons.
|
RowLayout //Author and action buttons.
|
||||||
{
|
{
|
||||||
|
id: authorAndACtionButton
|
||||||
width: parent.width
|
width: parent.width
|
||||||
Layout.alignment: Qt.AlignTop
|
anchors
|
||||||
spacing: UM.Theme.getSize("thin_margin").width
|
{
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: packageItem.right
|
||||||
|
margins: UM.Theme.getSize("default_margin").height
|
||||||
|
}
|
||||||
|
spacing: UM.Theme.getSize("narrow_margin").width
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@ -325,7 +296,6 @@ Rectangle
|
|||||||
visible: false // not functional right now, also only when unfolding and required
|
visible: false // not functional right now, also only when unfolding and required
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FontMetrics
|
FontMetrics
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user