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

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2022-02-22 17:47:48 +0300
committerJaime van Kessel <nallath@gmail.com>2022-02-22 17:47:48 +0300
commitac6375d17bec0f73663e16851b7a6931cffa9531 (patch)
treefb1ca43a112f72ef26a914327e0e9e972725257f /plugins/Marketplace/resources
parenta05650f64c03fc9df8cb4bfb3afa2ac00be48414 (diff)
Don't nest all content in background rect
This way we don't have an extra identation depth, makes it a bit easier to read CURA-8726
Diffstat (limited to 'plugins/Marketplace/resources')
-rw-r--r--plugins/Marketplace/resources/qml/Marketplace.qml305
1 files changed, 152 insertions, 153 deletions
diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml
index 796c537640..e02995b1da 100644
--- a/plugins/Marketplace/resources/qml/Marketplace.qml
+++ b/plugins/Marketplace/resources/qml/Marketplace.qml
@@ -46,196 +46,195 @@ Window
{
anchors.fill: parent
color: UM.Theme.getColor("main_background")
+ }
+ //The Marketplace can have a page in front of everything with package details. The stack view controls its visibility.
+ StackView
+ {
+ id: contextStack
+ anchors.fill: parent
+
+ initialItem: packageBrowse
- //The Marketplace can have a page in front of everything with package details. The stack view controls its visibility.
- StackView
+ ColumnLayout
{
- id: contextStack
- anchors.fill: parent
+ id: packageBrowse
- initialItem: packageBrowse
+ spacing: UM.Theme.getSize("narrow_margin").height
- ColumnLayout
+ // Page title.
+ Item
{
- id: packageBrowse
+ implicitWidth: parent.width
+ implicitHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
- spacing: UM.Theme.getSize("narrow_margin").height
-
- // Page title.
- Item
+ Label
{
- Layout.preferredWidth: parent.width
- Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
-
- Label
+ id: pageTitle
+ anchors
{
- id: pageTitle
- anchors
- {
- left: parent.left
- leftMargin: UM.Theme.getSize("default_margin").width
- right: parent.right
- rightMargin: UM.Theme.getSize("default_margin").width
- bottom: parent.bottom
- }
-
- font: UM.Theme.getFont("large")
- color: UM.Theme.getColor("text")
- text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...")
+ left: parent.left
+ leftMargin: UM.Theme.getSize("default_margin").width
+ right: parent.right
+ rightMargin: UM.Theme.getSize("default_margin").width
+ bottom: parent.bottom
}
- }
- OnboardBanner
- {
- visible: content.item && content.item.bannerVisible
- text: content.item && content.item.bannerText
- icon: content.item && content.item.bannerIcon
- onRemove: content.item && content.item.onRemoveBanner
- readMoreUrl: content.item && content.item.bannerReadMoreUrl
-
- Layout.fillWidth: true
- Layout.leftMargin: UM.Theme.getSize("default_margin").width
- Layout.rightMargin: UM.Theme.getSize("default_margin").width
+ font: UM.Theme.getFont("large")
+ color: UM.Theme.getColor("text")
+ text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...")
}
+ }
+
+ OnboardBanner
+ {
+ visible: content.item && content.item.bannerVisible
+ text: content.item && content.item.bannerText
+ icon: content.item && content.item.bannerIcon
+ onRemove: content.item && content.item.onRemoveBanner
+ readMoreUrl: content.item && content.item.bannerReadMoreUrl
+
+ Layout.fillWidth: true
+ Layout.leftMargin: UM.Theme.getSize("default_margin").width
+ Layout.rightMargin: UM.Theme.getSize("default_margin").width
+ }
- // Search & Top-Level Tabs
- Item
+ // Search & Top-Level Tabs
+ Item
+ {
+ Layout.preferredHeight: childrenRect.height
+ Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width
+ Layout.alignment: Qt.AlignHCenter
+ RowLayout
{
- Layout.preferredHeight: childrenRect.height
- Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width
- Layout.alignment: Qt.AlignHCenter
- RowLayout
+ width: parent.width
+ height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height
+ spacing: UM.Theme.getSize("thin_margin").width
+
+ Cura.SearchBar
{
- width: parent.width
- height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height
- spacing: UM.Theme.getSize("thin_margin").width
+ id: searchBar
+ Layout.preferredHeight: UM.Theme.getSize("button_icon").height
+ Layout.fillWidth: true
+ onTextEdited: searchStringChanged(text)
+ }
- Cura.SearchBar
+ // Page selection.
+ TabBar
+ {
+ id: pageSelectionTabBar
+ Layout.alignment: Qt.AlignRight
+ height: UM.Theme.getSize("button_icon").height
+ spacing: 0
+ background: Rectangle { color: "transparent" }
+ currentIndex: manager.tabShown
+
+ onCurrentIndexChanged:
{
- id: searchBar
- Layout.preferredHeight: UM.Theme.getSize("button_icon").height
- Layout.fillWidth: true
- onTextEdited: searchStringChanged(text)
+ manager.tabShown = currentIndex
+ searchBar.text = "";
+ searchBar.visible = currentItem.hasSearch;
+ content.source = currentItem.sourcePage;
}
- // Page selection.
- TabBar
+ PackageTypeTab
{
- id: pageSelectionTabBar
- Layout.alignment: Qt.AlignRight
- height: UM.Theme.getSize("button_icon").height
- spacing: 0
- background: Rectangle { color: "transparent" }
- currentIndex: manager.tabShown
-
- onCurrentIndexChanged:
- {
- manager.tabShown = currentIndex
- searchBar.text = "";
- searchBar.visible = currentItem.hasSearch;
- content.source = currentItem.sourcePage;
- }
+ id: pluginTabText
+ width: implicitWidth
+ text: catalog.i18nc("@button", "Plugins")
+ property string sourcePage: "Plugins.qml"
+ property bool hasSearch: true
+ }
+ PackageTypeTab
+ {
+ id: materialsTabText
+ width: implicitWidth
+ text: catalog.i18nc("@button", "Materials")
+ property string sourcePage: "Materials.qml"
+ property bool hasSearch: true
+ }
+ ManagePackagesButton
+ {
+ property string sourcePage: "ManagedPackages.qml"
+ property bool hasSearch: false
- PackageTypeTab
- {
- id: pluginTabText
- width: implicitWidth
- text: catalog.i18nc("@button", "Plugins")
- property string sourcePage: "Plugins.qml"
- property bool hasSearch: true
- }
- PackageTypeTab
- {
- id: materialsTabText
- width: implicitWidth
- text: catalog.i18nc("@button", "Materials")
- property string sourcePage: "Materials.qml"
- property bool hasSearch: true
- }
- ManagePackagesButton
+ Cura.NotificationIcon
{
- property string sourcePage: "ManagedPackages.qml"
- property bool hasSearch: false
+ anchors
+ {
+ horizontalCenter: parent.right
+ verticalCenter: parent.top
+ }
+ visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
- Cura.NotificationIcon
+ labelText:
{
- anchors
- {
- horizontalCenter: parent.right
- verticalCenter: parent.top
- }
- visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
-
- labelText:
- {
- const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length
- return itemCount > 9 ? "9+" : itemCount
- }
+ const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length
+ return itemCount > 9 ? "9+" : itemCount
}
}
}
+ }
- TextMetrics
- {
- id: pluginTabTextMetrics
- text: pluginTabText.text
- font: pluginTabText.font
- }
- TextMetrics
- {
- id: materialsTabTextMetrics
- text: materialsTabText.text
- font: materialsTabText.font
- }
+ TextMetrics
+ {
+ id: pluginTabTextMetrics
+ text: pluginTabText.text
+ font: pluginTabText.font
+ }
+ TextMetrics
+ {
+ id: materialsTabTextMetrics
+ text: materialsTabText.text
+ font: materialsTabText.font
}
}
+ }
- FontMetrics
- {
- id: fontMetrics
- font: UM.Theme.getFont("default")
- }
+ FontMetrics
+ {
+ id: fontMetrics
+ font: UM.Theme.getFont("default")
+ }
- Cura.TertiaryButton
- {
- text: catalog.i18nc("@info", "Search in the browser")
- iconSource: UM.Theme.getIcon("LinkExternal")
- visible: pageSelectionTabBar.currentItem.hasSearch
- isIconOnRightSide: true
- height: fontMetrics.height
- textFont: fontMetrics.font
- textColor: UM.Theme.getColor("text")
-
- onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl)
- }
+ Cura.TertiaryButton
+ {
+ text: catalog.i18nc("@info", "Search in the browser")
+ iconSource: UM.Theme.getIcon("LinkExternal")
+ visible: pageSelectionTabBar.currentItem.hasSearch
+ isIconOnRightSide: true
+ height: fontMetrics.height
+ textFont: fontMetrics.font
+ textColor: UM.Theme.getColor("text")
+
+ onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl)
+ }
+
+ // Page contents.
+ Rectangle
+ {
+ Layout.preferredWidth: parent.width
+ Layout.fillHeight: true
+ color: UM.Theme.getColor("detail_background")
// Page contents.
- Rectangle
+ Loader
{
- Layout.preferredWidth: parent.width
- Layout.fillHeight: true
- color: UM.Theme.getColor("detail_background")
+ id: content
+ anchors.fill: parent
+ anchors.margins: UM.Theme.getSize("default_margin").width
+ source: "Plugins.qml"
- // Page contents.
- Loader
+ Connections
{
- id: content
- anchors.fill: parent
- anchors.margins: UM.Theme.getSize("default_margin").width
- source: "Plugins.qml"
-
- Connections
+ target: content
+ function onLoaded()
{
- target: content
- function onLoaded()
- {
- pageTitle.text = content.item.pageTitle
- searchStringChanged.connect(handleSearchStringChanged)
- }
- function handleSearchStringChanged(new_search)
- {
- content.item.model.searchString = new_search
- }
+ pageTitle.text = content.item.pageTitle
+ searchStringChanged.connect(handleSearchStringChanged)
+ }
+ function handleSearchStringChanged(new_search)
+ {
+ content.item.model.searchString = new_search
}
}
}