Cleanup gridTile

CURA-6013
This commit is contained in:
Jaime van Kessel 2018-12-07 15:57:52 +01:00
parent fed9e2b623
commit 4742db6fec

View File

@ -13,20 +13,9 @@ Item
id: toolboxDownloadsGridTile id: toolboxDownloadsGridTile
property int packageCount: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getTotalNumberOfMaterialPackagesByAuthor(model.id) : 1 property int packageCount: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getTotalNumberOfMaterialPackagesByAuthor(model.id) : 1
property int installedPackages: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getNumberOfInstalledPackagesByAuthor(model.id) : (toolbox.isInstalled(model.id) ? 1 : 0) property int installedPackages: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getNumberOfInstalledPackagesByAuthor(model.id) : (toolbox.isInstalled(model.id) ? 1 : 0)
height: childrenRect.height height: UM.Theme.getSize("toolbox_thumbnail_small").height
Layout.alignment: Qt.AlignTop | Qt.AlignLeft Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Rectangle
{
id: highlight
anchors.fill: parent
opacity: 0.0
color: UM.Theme.getColor("primary")
}
Row
{
width: parent.width
height: childrenRect.height
spacing: Math.floor(UM.Theme.getSize("narrow_margin").width)
Rectangle Rectangle
{ {
id: thumbnail id: thumbnail
@ -35,6 +24,7 @@ Item
color: "white" color: "white"
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining") border.color: UM.Theme.getColor("lining")
Image Image
{ {
anchors.centerIn: parent anchors.centerIn: parent
@ -43,6 +33,8 @@ Item
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: model.icon_url || "../images/logobot.svg" source: model.icon_url || "../images/logobot.svg"
mipmap: true mipmap: true
} }
UM.RecolorImage UM.RecolorImage
{ {
@ -95,18 +87,23 @@ Item
} }
} }
} }
Column Item
{ {
width: parent.width - thumbnail.width - parent.spacing anchors
spacing: Math.floor(UM.Theme.getSize("narrow_margin").width) {
anchors.top: parent.top left: thumbnail.right
//anchors.topMargin: UM.Theme.getSize("default_margin").height leftMargin: Math.floor(UM.Theme.getSize("narrow_margin").width)
right: parent.right
top: parent.top
bottom: parent.bottom
}
Label Label
{ {
id: name id: name
text: model.name text: model.name
width: parent.width width: parent.width
wrapMode: Text.WordWrap elide: Text.ElideRight
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
} }
@ -114,23 +111,25 @@ Item
{ {
id: info id: info
text: model.description text: model.description
maximumLineCount: 2
elide: Text.ElideRight elide: Text.ElideRight
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: UM.Theme.getColor("text_medium") color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
anchors.top: name.bottom
anchors.bottom: rating.top
verticalAlignment: Text.AlignVCenter
} }
RatingWidget RatingWidget
{ {
id: rating
visible: model.type == "plugin" visible: model.type == "plugin"
packageId: model.id packageId: model.id
rating: model.average_rating != undefined ? model.average_rating : 0 rating: model.average_rating != undefined ? model.average_rating : 0
numRatings: model.num_ratings != undefined ? model.num_ratings : 0 numRatings: model.num_ratings != undefined ? model.num_ratings : 0
userRating: model.user_rating userRating: model.user_rating
enabled: installedPackages != 0 && Cura.API.account.isLoggedIn enabled: installedPackages != 0 && Cura.API.account.isLoggedIn
} anchors.bottom: parent.bottom
} }
} }
} }