mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 21:44:01 -06:00
Improved structure and enabled display by author
This commit is contained in:
parent
dc00156410
commit
91001455ad
9 changed files with 310 additions and 91 deletions
|
@ -25,11 +25,10 @@ Window
|
|||
color: UM.Theme.getColor("sidebar")
|
||||
Item
|
||||
{
|
||||
id: view
|
||||
anchors.fill: parent
|
||||
ToolboxHeader
|
||||
{
|
||||
id: topBar
|
||||
id: header
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
|
@ -38,47 +37,49 @@ Window
|
|||
color: "transparent"
|
||||
anchors
|
||||
{
|
||||
top: topBar.bottom
|
||||
bottom: bottomBar.top
|
||||
top: header.bottom
|
||||
bottom: footer.top
|
||||
}
|
||||
ToolboxLoading
|
||||
// TODO: This could be improved using viewFilter instead of viewCategory
|
||||
ToolboxLoadingPage
|
||||
{
|
||||
id: loading
|
||||
visible: !dataReady && manager.currentView != "installed"
|
||||
id: viewLoading
|
||||
visible: manager.viewCategory != "installed" && !dataReady
|
||||
// TODO: Replace !dataReady with manager.viewPage == "loading"
|
||||
}
|
||||
ToolboxDownloadsPage
|
||||
{
|
||||
id: viewDownloads
|
||||
visible: manager.currentView != "installed" && !manager.detailView
|
||||
visible: manager.viewCategory != "installed" && manager.viewPage == "overview"
|
||||
}
|
||||
ToolboxDetailsPage
|
||||
ToolboxDetailPage
|
||||
{
|
||||
id: viewDetail
|
||||
visible: manager.currentView != "installed" && manager.detailView
|
||||
visible: manager.viewCategory != "installed" && manager.viewPage == "detail"
|
||||
}
|
||||
ToolboxAuthorPage
|
||||
{
|
||||
id: viewAuthor
|
||||
visible: manager.viewCategory != "installed" && manager.viewPage == "author"
|
||||
}
|
||||
ToolboxInstalledPage
|
||||
{
|
||||
id: installedPluginList
|
||||
visible: dataReady && manager.currentView == "installed"
|
||||
visible: manager.viewCategory == "installed" && dataReady
|
||||
// TODO: Replace !dataReady with manager.viewPage == "loading"
|
||||
}
|
||||
}
|
||||
ToolboxShadow
|
||||
{
|
||||
anchors
|
||||
{
|
||||
top: topBar.bottom
|
||||
}
|
||||
anchors.top: header.bottom
|
||||
}
|
||||
ToolboxFooter
|
||||
{
|
||||
id: bottomBar
|
||||
id: footer
|
||||
}
|
||||
ToolboxShadow
|
||||
{
|
||||
anchors
|
||||
{
|
||||
top: bottomBar.top
|
||||
}
|
||||
anchors.top: footer.top
|
||||
}
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
|
138
plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml
Normal file
138
plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml
Normal file
|
@ -0,0 +1,138 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// PluginBrowser is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import UM 1.1 as UM
|
||||
|
||||
// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
|
||||
|
||||
Item
|
||||
{
|
||||
id: base
|
||||
anchors.fill: parent
|
||||
Item
|
||||
{
|
||||
id: sidebar
|
||||
height: parent.height
|
||||
width: UM.Theme.getSize("base_unit").width * 6
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
topMargin: UM.Theme.getSize("double_margin").height
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
Button
|
||||
{
|
||||
text: "Back"
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: backArrow
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
width: UM.Theme.getSize("standard_arrow").width
|
||||
height: UM.Theme.getSize("standard_arrow").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: UM.Theme.getColor("text")
|
||||
source: UM.Theme.getIcon("arrow_left")
|
||||
}
|
||||
width: UM.Theme.getSize("base_unit").width * 4
|
||||
height: UM.Theme.getSize("base_unit").height * 2
|
||||
onClicked:
|
||||
{
|
||||
manager.viewPage = "overview"
|
||||
manager.filterPackages("type", manager.viewCategory)
|
||||
}
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
color: "transparent"
|
||||
}
|
||||
label: Label
|
||||
{
|
||||
text: control.text
|
||||
color: UM.Theme.getColor("text")
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
horizontalAlignment: Text.AlignRight
|
||||
width: control.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: header
|
||||
anchors
|
||||
{
|
||||
left: sidebar.right
|
||||
right: parent.right
|
||||
}
|
||||
height: UM.Theme.getSize("base_unit").height * 12
|
||||
Image
|
||||
{
|
||||
id: thumbnail
|
||||
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"
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
leftMargin: UM.Theme.getSize("double_margin").width
|
||||
topMargin: UM.Theme.getSize("double_margin").height
|
||||
}
|
||||
}
|
||||
Column
|
||||
{
|
||||
anchors
|
||||
{
|
||||
top: thumbnail.top
|
||||
left: thumbnail.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("double_margin").width
|
||||
}
|
||||
spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
|
||||
Label
|
||||
{
|
||||
text: manager.detailData["name"]
|
||||
font: UM.Theme.getFont("large")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: "HELLO THIS IS AN AUTHOR PAGE"
|
||||
font: UM.Theme.getFont("default")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: "Author: " + manager.detailData["author"]["name"]
|
||||
font: UM.Theme.getFont("small")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
// TODO: Add mail icon.
|
||||
}
|
||||
}
|
||||
}
|
||||
ToolboxDetailList {
|
||||
anchors
|
||||
{
|
||||
right: header.right
|
||||
top: header.bottom
|
||||
left: header.left
|
||||
bottom: base.bottom
|
||||
}
|
||||
}
|
||||
}
|
36
plugins/Toolbox/resources/qml/ToolboxDetailList.qml
Normal file
36
plugins/Toolbox/resources/qml/ToolboxDetailList.qml
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// PluginBrowser is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import UM 1.1 as UM
|
||||
|
||||
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
|
||||
}
|
||||
ScrollView
|
||||
{
|
||||
frameVisible: false
|
||||
anchors.fill: base
|
||||
style: UM.Theme.styles.scrollview
|
||||
Column
|
||||
{
|
||||
height: childrenRect.height
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
Repeater
|
||||
{
|
||||
model: manager.packagesModel
|
||||
delegate: ToolboxDetailTile {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,7 +44,11 @@ Item
|
|||
}
|
||||
width: UM.Theme.getSize("base_unit").width * 4
|
||||
height: UM.Theme.getSize("base_unit").height * 2
|
||||
onClicked: manager.detailView = false
|
||||
onClicked:
|
||||
{
|
||||
manager.viewPage = "overview"
|
||||
manager.filterPackages("type", manager.viewCategory)
|
||||
}
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
|
@ -100,7 +104,7 @@ Item
|
|||
spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
|
||||
Label
|
||||
{
|
||||
text: manager.detailData["type"] == "material" ? manager.detailData["author"] : manager.detailData["name"]
|
||||
text: manager.detailData["name"]
|
||||
font: UM.Theme.getFont("large")
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
|
@ -122,11 +126,7 @@ Item
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: scroll
|
||||
frameVisible: true
|
||||
ToolboxDetailList {
|
||||
anchors
|
||||
{
|
||||
right: header.right
|
||||
|
@ -134,38 +134,5 @@ Item
|
|||
left: header.left
|
||||
bottom: base.bottom
|
||||
}
|
||||
height: parent.height
|
||||
style: UM.Theme.styles.scrollview
|
||||
|
||||
/*
|
||||
ListView
|
||||
{
|
||||
id: contentColumn
|
||||
spacing: UM.Theme.getSize("base_unit").height
|
||||
height: childrenRect.height + (UM.Theme.getSize("double_margin").height * 2)
|
||||
anchors
|
||||
{
|
||||
left: scroll.left
|
||||
right: scroll.right
|
||||
top: scroll.top
|
||||
topMargin: UM.Theme.getSize("double_margin").height
|
||||
bottomMargin: UM.Theme.getSize("double_margin").height
|
||||
leftMargin: UM.Theme.getSize("double_margin").width
|
||||
rightMargin: UM.Theme.getSize("double_margin").width
|
||||
}
|
||||
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
ToolboxDetailsTile {}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -9,9 +9,9 @@ import UM 1.1 as UM
|
|||
|
||||
Rectangle
|
||||
{
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
color: "transparent"
|
||||
width: base.width
|
||||
height: UM.Theme.getSize("base_unit").height * 12
|
||||
color: "steelblue"
|
||||
Column
|
||||
{
|
||||
anchors
|
||||
|
@ -27,7 +27,7 @@ Rectangle
|
|||
{
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("base_unit").height * 2
|
||||
text: "DSM Abrasive"
|
||||
text: model.name
|
||||
wrapMode: Text.WordWrap
|
||||
color: UM.Theme.getColor("text")
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
|
@ -35,10 +35,10 @@ Rectangle
|
|||
Label
|
||||
{
|
||||
width: parent.width
|
||||
text: "DSM abrasive material provides extra stiffness. It’s suitable for printing \"Functional prototypes\" and \"End parts\"."
|
||||
text: model.description
|
||||
wrapMode: Text.WordWrap
|
||||
color: UM.Theme.getColor("text")
|
||||
font: UM.Theme.getFont("normal")
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
}
|
||||
Rectangle
|
|
@ -50,8 +50,7 @@ Item
|
|||
Label
|
||||
{
|
||||
id: info
|
||||
text:
|
||||
{
|
||||
text: {
|
||||
if (model.description.length > 50)
|
||||
{
|
||||
return model.description.substring(0, 50) + "..."
|
||||
|
@ -69,9 +68,19 @@ Item
|
|||
{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
console.log(model.id)
|
||||
manager.detailView = true
|
||||
manager.setDetailData(model.id)
|
||||
if ( manager.viewCategory == "material" )
|
||||
{
|
||||
console.log("filtering by " + model.author)
|
||||
manager.viewSelection = model.author.name
|
||||
manager.viewPage = "author"
|
||||
manager.filterPackages("author", model.author)
|
||||
}
|
||||
else
|
||||
{
|
||||
manager.viewSelection = model.id
|
||||
manager.viewPage = "detail"
|
||||
manager.filterPackages("id", model.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ Rectangle {
|
|||
implicitHeight: 48
|
||||
Rectangle
|
||||
{
|
||||
visible: manager.currentView == "plugins"
|
||||
visible: manager.viewCategory == "plugin"
|
||||
color: UM.Theme.getColor("primary")
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
|
@ -56,8 +56,8 @@ Rectangle {
|
|||
onClicked:
|
||||
{
|
||||
manager.filterPackagesByType("plugin")
|
||||
manager.currentView = "plugins"
|
||||
manager.detailView = false
|
||||
manager.viewCategory = "plugin"
|
||||
manager.viewPage = "overview"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ Rectangle {
|
|||
implicitHeight: 48
|
||||
Rectangle
|
||||
{
|
||||
visible: manager.currentView == "materials"
|
||||
visible: manager.viewCategory == "material"
|
||||
color: UM.Theme.getColor("primary")
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
|
@ -92,8 +92,8 @@ Rectangle {
|
|||
onClicked:
|
||||
{
|
||||
manager.filterPackagesByType("material")
|
||||
manager.currentView = "materials"
|
||||
manager.detailView = false
|
||||
manager.viewCategory = "material"
|
||||
manager.viewPage = "overview"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ Rectangle {
|
|||
implicitWidth: 96
|
||||
implicitHeight: 48
|
||||
Rectangle {
|
||||
visible: manager.currentView == "installed"
|
||||
visible: manager.viewCategory == "installed"
|
||||
color: UM.Theme.getColor("primary")
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
|
@ -127,6 +127,6 @@ Rectangle {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
onClicked: manager.currentView = "installed"
|
||||
onClicked: manager.viewCategory = "installed"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue