Added author and material views

This commit is contained in:
Ian Paschal 2018-04-09 15:55:56 +02:00
parent 91001455ad
commit 817b724994
10 changed files with 172 additions and 43 deletions

View file

@ -12,10 +12,8 @@ Item
id: base
anchors
{
topMargin: UM.Theme.getSize("default_margin").height
bottomMargin: UM.Theme.getSize("default_margin").height
leftMargin: UM.Theme.getSize("double_margin").width
rightMargin: UM.Theme.getSize("double_margin").width
topMargin: UM.Theme.getSize("double_margin").height
bottomMargin: UM.Theme.getSize("double_margin").height
}
ScrollView
{
@ -24,6 +22,8 @@ Item
style: UM.Theme.styles.scrollview
Column
{
anchors.right: base.right
anchors.rightMargin: UM.Theme.getSize("double_margin").width
height: childrenRect.height
spacing: UM.Theme.getSize("default_margin").height
Repeater

View file

@ -11,6 +11,7 @@ import UM 1.1 as UM
Item
{
property var details: manager.packagesModel.items[0]
id: base
anchors.fill: parent
Item
@ -82,7 +83,7 @@ Item
width: UM.Theme.getSize("toolbox_thumbnail_medium").width
height: UM.Theme.getSize("toolbox_thumbnail_medium").height
fillMode: Image.PreserveAspectFit
source: manager.detailData["icon_url"] || "../images/logobot.svg"
source: details.icon_url || "../images/logobot.svg"
anchors
{
top: parent.top
@ -104,21 +105,21 @@ Item
spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
Label
{
text: manager.detailData["name"]
text: details.name
font: UM.Theme.getFont("large")
wrapMode: Text.WordWrap
width: parent.width
}
Label
{
text: manager.detailData["description"]
text: details.description
font: UM.Theme.getFont("default")
wrapMode: Text.WordWrap
width: parent.width
}
Label
{
text: "Author: " + manager.detailData["author"]["name"]
text: "Author: " + details.author_name
font: UM.Theme.getFont("small")
wrapMode: Text.WordWrap
width: parent.width
@ -131,8 +132,10 @@ Item
{
right: header.right
top: header.bottom
left: header.left
bottom: base.bottom
}
}
}

View file

@ -9,9 +9,9 @@ import UM 1.1 as UM
Rectangle
{
width: base.width
height: UM.Theme.getSize("base_unit").height * 12
color: "steelblue"
width: base.width - UM.Theme.getSize("double_margin").width
height: UM.Theme.getSize("base_unit").height * 8
color: "transparent"
Column
{
anchors
@ -20,7 +20,6 @@ Rectangle
right: controls.left
rightMargin: UM.Theme.getSize("default_margin").width
top: parent.top
leftMargin: UM.Theme.getSize("default_margin").width
topMargin: UM.Theme.getSize("default_margin").height
}
Label

View file

@ -34,7 +34,7 @@ Column
Repeater
{
model: manager.packagesModel
model: manager.viewCategory == "material" ? manager.authorsModel : manager.packagesModel
delegate: ToolboxDownloadsGridTile
{
Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns

View file

@ -70,16 +70,16 @@ Item
onClicked: {
if ( manager.viewCategory == "material" )
{
console.log("filtering by " + model.author)
manager.viewSelection = model.author.name
manager.viewSelection = model.name
manager.viewPage = "author"
manager.filterPackages("author", model.author)
manager.filterPackages("author_name", model.name)
}
else
{
manager.viewSelection = model.id
manager.viewPage = "detail"
manager.filterPackages("id", model.id)
}
}
}

View file

@ -18,7 +18,7 @@ Column
Label
{
id: heading
text: "Top Downloads"
text: "Showcase"
width: parent.width
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("medium")

View file

@ -55,7 +55,8 @@ Rectangle {
}
onClicked:
{
manager.filterPackagesByType("plugin")
manager.filterPackages("type", "plugin")
manager.filterAuthors("type", "plugin")
manager.viewCategory = "plugin"
manager.viewPage = "overview"
}
@ -91,7 +92,8 @@ Rectangle {
}
onClicked:
{
manager.filterPackagesByType("material")
manager.filterPackages("type", "material")
manager.filterAuthors("type", "material")
manager.viewCategory = "material"
manager.viewPage = "overview"
}