From 80f99b0a598bcd6b9cf5e39a3d6f25e219cad9c6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 15:03:57 +0100 Subject: [PATCH 01/15] Fix positioning of marketplace searchbar CURA-8762 --- plugins/Marketplace/resources/qml/Marketplace.qml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index fc6d3cd755..a2ffd9fa25 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -98,20 +98,14 @@ Window Item { Layout.preferredHeight: childrenRect.height - Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("thin_margin").width + 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 - Item - { - Layout.preferredHeight: parent.height - Layout.preferredWidth: searchBar.visible ? UM.Theme.getSize("thin_margin").width : 0 - Layout.fillWidth: ! searchBar.visible - } - Cura.SearchBar { id: searchBar From adfb78e38abf54e0e95c42007cca3f44137a7345 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 15:11:11 +0100 Subject: [PATCH 02/15] Fix spacing CURA-8762 --- plugins/Marketplace/resources/qml/Marketplace.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index a2ffd9fa25..ebb3bd26a5 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -59,7 +59,7 @@ Window { id: packageBrowse - spacing: UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("narrow_margin").height // Page title. Item From 0b39fb1c916861fbab9a1c21225449b29ff01751 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 15:18:49 +0100 Subject: [PATCH 03/15] Hide download count in manage page CURA-8726 --- plugins/Marketplace/resources/qml/PackageCardHeader.qml | 2 +- plugins/Marketplace/resources/qml/PackagePage.qml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCardHeader.qml b/plugins/Marketplace/resources/qml/PackageCardHeader.qml index 3a76f7a959..d6289f8ce1 100644 --- a/plugins/Marketplace/resources/qml/PackageCardHeader.qml +++ b/plugins/Marketplace/resources/qml/PackageCardHeader.qml @@ -12,7 +12,7 @@ import Cura 1.6 as Cura // are combined into the reusable "PackageCardHeader" component Item { - default property alias contents: contentItem.children; + default property alias contents: contentItem.children property var packageData property bool showManageButtons: false diff --git a/plugins/Marketplace/resources/qml/PackagePage.qml b/plugins/Marketplace/resources/qml/PackagePage.qml index 21c400fff2..00e022dc20 100644 --- a/plugins/Marketplace/resources/qml/PackagePage.qml +++ b/plugins/Marketplace/resources/qml/PackagePage.qml @@ -40,7 +40,7 @@ Rectangle id: downloadCount Layout.preferredWidth: parent.width Layout.fillHeight: true - + visible: packageData.downloadCount != "0" UM.RecolorImage { id: downloadsIcon @@ -53,6 +53,7 @@ Rectangle Label { + anchors.verticalCenter: downloadsIcon.verticalCenter color: UM.Theme.getColor("text") From a05650f64c03fc9df8cb4bfb3afa2ac00be48414 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 15:44:30 +0100 Subject: [PATCH 04/15] Fix margins for OnboardBanner Re-usable components shouldn't really be setting layout themselves. This should be done by whomever creates them. The actual fix is that the banner no longe sets all margins, only left & right CURA-8726 --- plugins/Marketplace/resources/qml/Marketplace.qml | 4 ++++ plugins/Marketplace/resources/qml/OnboardBanner.qml | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index ebb3bd26a5..796c537640 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -92,6 +92,10 @@ Window 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 diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 25e4b53241..7d973cb74a 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -16,10 +16,7 @@ Rectangle property var onRemove property string readMoreUrl - Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height - Layout.fillWidth: true - Layout.margins: UM.Theme.getSize("default_margin").width - + implicitHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height color: UM.Theme.getColor("action_panel_secondary") // Icon From ac6375d17bec0f73663e16851b7a6931cffa9531 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 15:47:48 +0100 Subject: [PATCH 05/15] 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 --- .../Marketplace/resources/qml/Marketplace.qml | 303 +++++++++--------- 1 file changed, 151 insertions(+), 152 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 - //The Marketplace can have a page in front of everything with package details. The stack view controls its visibility. - StackView + initialItem: packageBrowse + + 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 } + + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...") } + } - OnboardBanner + 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 + { + Layout.preferredHeight: childrenRect.height + Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width + Layout.alignment: Qt.AlignHCenter + RowLayout { - 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 + width: parent.width + height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("thin_margin").width - Layout.fillWidth: true - Layout.leftMargin: UM.Theme.getSize("default_margin").width - Layout.rightMargin: UM.Theme.getSize("default_margin").width - } - - // 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 + 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 + 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 - onCurrentIndexChanged: + Cura.NotificationIcon { - manager.tabShown = currentIndex - searchBar.text = ""; - searchBar.visible = currentItem.hasSearch; - content.source = currentItem.sourcePage; - } - - 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 - { - property string sourcePage: "ManagedPackages.qml" - property bool hasSearch: false - - Cura.NotificationIcon + anchors { - anchors - { - horizontalCenter: parent.right - verticalCenter: parent.top - } - visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0 + horizontalCenter: parent.right + verticalCenter: parent.top + } + visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0 - labelText: - { - const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length - return itemCount > 9 ? "9+" : itemCount - } + labelText: + { + 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") + 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) - } + 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 } } } From a36fedabe5a7aa3a6abec462905f16ee6c51a678 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 15:53:07 +0100 Subject: [PATCH 06/15] Remove unused fontMetrics objects CURA-8762 --- .../Marketplace/resources/qml/Marketplace.qml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index e02995b1da..5a30141b32 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -101,8 +101,8 @@ Window // Search & Top-Level Tabs Item { - Layout.preferredHeight: childrenRect.height - Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width + implicitHeight: childrenRect.height + implicitWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width Layout.alignment: Qt.AlignHCenter RowLayout { @@ -113,7 +113,7 @@ Window Cura.SearchBar { id: searchBar - Layout.preferredHeight: UM.Theme.getSize("button_icon").height + implicitHeight: UM.Theme.getSize("button_icon").height Layout.fillWidth: true onTextEdited: searchStringChanged(text) } @@ -174,19 +174,6 @@ Window } } } - - TextMetrics - { - id: pluginTabTextMetrics - text: pluginTabText.text - font: pluginTabText.font - } - TextMetrics - { - id: materialsTabTextMetrics - text: materialsTabText.text - font: materialsTabText.font - } } } From 0d85b2be7f1df479b2619000732febcb0f3db0b7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 16:07:11 +0100 Subject: [PATCH 07/15] Ensure that scrollbar is centered CURA-8762 --- plugins/Marketplace/resources/qml/Packages.qml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 194c90c248..17fa884ad7 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -53,8 +53,8 @@ ListView // Vertical ScrollBar, styled similarly to the scrollBar in the settings panel id: verticalScrollBar visible: packages.contentHeight > packages.height - - background: Item{} + anchors.right: parent.right + background: Item {} contentItem: Rectangle { @@ -83,7 +83,16 @@ ListView { manageableInListView: packages.packagesManageableInListView packageData: model.package - width: parent.width - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("narrow_margin").width + width: { + if(verticalScrollBar.visible) + { + return parent.width - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("default_margin").width + } + else + { + return parent.width - UM.Theme.getSize("default_margin").width + } + } color: cardMouseArea.containsMouse ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("main_background") } } From 7926a2bbdcc781f857029c56612890fb2cd8beda Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 16:33:52 +0100 Subject: [PATCH 08/15] Add placeholders for material & plugin icons CURA-8762 --- .../Marketplace/resources/images/Plugin.svg | 3 +++ .../Marketplace/resources/images/Spool.svg | 3 +++ .../resources/qml/PackageCardHeader.qml | 20 +++++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 plugins/Marketplace/resources/images/Plugin.svg create mode 100644 plugins/Marketplace/resources/images/Spool.svg diff --git a/plugins/Marketplace/resources/images/Plugin.svg b/plugins/Marketplace/resources/images/Plugin.svg new file mode 100644 index 0000000000..51356d842c --- /dev/null +++ b/plugins/Marketplace/resources/images/Plugin.svg @@ -0,0 +1,3 @@ + + + diff --git a/plugins/Marketplace/resources/images/Spool.svg b/plugins/Marketplace/resources/images/Spool.svg new file mode 100644 index 0000000000..dae9b43030 --- /dev/null +++ b/plugins/Marketplace/resources/images/Spool.svg @@ -0,0 +1,3 @@ + + + diff --git a/plugins/Marketplace/resources/qml/PackageCardHeader.qml b/plugins/Marketplace/resources/qml/PackageCardHeader.qml index d6289f8ce1..ed5cce8485 100644 --- a/plugins/Marketplace/resources/qml/PackageCardHeader.qml +++ b/plugins/Marketplace/resources/qml/PackageCardHeader.qml @@ -32,8 +32,24 @@ Item } width: UM.Theme.getSize("card_icon").width height: width - - source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg" + sourceSize.height: height + sourceSize.width: width + source: + { + if(packageData.iconUrl != "") + { + return packageData.iconUrl + } + if(packageData.packageType == "plugin") + { + return "../images/Plugin.svg" + } + if(packageData.packageType == "material") + { + return "../images/Spool.svg" + } + return "../images/placeholder.svg" + } } ColumnLayout From d29b00b4be188fdb366a5bc4b8581e613313e8e4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 22 Feb 2022 16:38:47 +0100 Subject: [PATCH 09/15] Let readmore point towards marketplace URL CURA-8762 --- plugins/Marketplace/PackageModel.py | 5 +++++ plugins/Marketplace/resources/qml/PackageCard.qml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 7c2a5d9ae1..29c8abe653 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -39,6 +39,7 @@ class PackageModel(QObject): self._package_type = package_data.get("package_type", "") self._is_bundled = package_data.get("is_bundled", False) self._icon_url = package_data.get("icon_url", "") + self._marketplace_url = package_data.get("marketplace_url", "") self._display_name = package_data.get("display_name", catalog.i18nc("@label:property", "Unknown Package")) tags = package_data.get("tags", []) self._is_checked_by_ultimaker = (self._package_type == "plugin" and "verified" in tags) or ( @@ -210,6 +211,10 @@ class PackageModel(QObject): def packageId(self) -> str: return self._package_id + @pyqtProperty(str, constant=True) + def marketplaceURL(self)-> str: + return self._marketplace_url + @pyqtProperty(str, constant = True) def packageType(self) -> str: return self._package_type diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 633d2b25b9..db1a0874e1 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -88,7 +88,7 @@ Rectangle textFont: descriptionLabel.font isIconOnRightSide: true - onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) + onClicked: Qt.openUrlExternally(packageData.marketplaceURL) } } } From 3b801e9f180158571ff335c7a1425ef1ccdfb7af Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 23 Feb 2022 09:57:04 +0100 Subject: [PATCH 10/15] Change top external button to point to marketplace website CURA-8762 --- plugins/Marketplace/resources/qml/PackageCardHeader.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageCardHeader.qml b/plugins/Marketplace/resources/qml/PackageCardHeader.qml index ed5cce8485..ca4165b97a 100644 --- a/plugins/Marketplace/resources/qml/PackageCardHeader.qml +++ b/plugins/Marketplace/resources/qml/PackageCardHeader.qml @@ -119,7 +119,7 @@ Item color: externalLinkButton.hovered ? UM.Theme.getColor("action_button_hovered"): "transparent" radius: externalLinkButton.width / 2 } - onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) + onClicked: Qt.openUrlExternally(packageData.marketplaceURL) } } From 35f1ad4097b97501c9736e2135490e59d5cbcc86 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 23 Feb 2022 09:59:12 +0100 Subject: [PATCH 11/15] Remove read more button on packagecard CURA-8762 --- .../Marketplace/resources/qml/PackageCard.qml | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index db1a0874e1..1b4c4c354e 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -41,54 +41,6 @@ Rectangle wrapMode: Text.Wrap elide: Text.ElideRight visible: text !== "" - - onLineLaidOut: - { - if(truncated && line.isLast) - { - let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width; - if(line.implicitWidth > max_line_width) - { - line.width = max_line_width; - } - else - { - line.width = line.implicitWidth - fontMetrics.advanceWidth("…"); //Truncate the ellipsis. We're adding this ourselves. - } - descriptionLabel.lastLineWidth = line.implicitWidth; - } - } - } - Label - { - id: tripleDotLabel - anchors.left: parent.left - anchors.leftMargin: descriptionLabel.lastLineWidth - anchors.bottom: descriptionLabel.bottom - - text: "… " - font: descriptionLabel.font - color: descriptionLabel.color - visible: descriptionLabel.truncated && descriptionLabel.text !== "" - } - Cura.TertiaryButton - { - id: readMoreButton - anchors.right: parent.right - anchors.bottom: descriptionLabel.bottom - height: fontMetrics.height //Height of a single line. - - text: catalog.i18nc("@info", "Read more") - iconSource: UM.Theme.getIcon("LinkExternal") - - visible: descriptionLabel.truncated && descriptionLabel.text !== "" - enabled: visible - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("wide_margin").width - textFont: descriptionLabel.font - isIconOnRightSide: true - - onClicked: Qt.openUrlExternally(packageData.marketplaceURL) } } } From df9d2d85c43dc4d25a7bfafa0bf4b36c5cfff602 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 23 Feb 2022 10:12:21 +0100 Subject: [PATCH 12/15] Add help links to banners CURA-8762 --- plugins/Marketplace/resources/qml/ManagedPackages.qml | 2 +- plugins/Marketplace/resources/qml/Materials.qml | 2 +- plugins/Marketplace/resources/qml/Plugins.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index 8ccaacea46..3eb77d8485 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -13,7 +13,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_manage_packages_banner"); bannerIcon: UM.Theme.getIcon("ArrowDoubleCircleRight") bannerText: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") - bannerReadMoreUrl: "" // TODO add when support page is ready + bannerReadMoreUrl: "https://support.ultimaker.com/hc/en-us/articles/4411125921426/?utm_source=cura&utm_medium=software&utm_campaign=marketplace-learn-manage" onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_manage_packages_banner", false); bannerVisible = false; diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index 39fae7042a..ddac8b0bbe 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -10,7 +10,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_material_banner") bannerIcon: UM.Theme.getIcon("Spool") bannerText: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") - bannerReadMoreUrl: "" // TODO add when support page is ready + bannerReadMoreUrl: "https://support.ultimaker.com/hc/en-us/articles/360011968360/?utm_source=cura&utm_medium=software&utm_campaign=marketplace-learn-materials" onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_material_banner", false); bannerVisible = false; diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 9983a827d8..f1a524c029 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -10,7 +10,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_plugin_banner") bannerIcon: UM.Theme.getIcon("Shop") bannerText: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") - bannerReadMoreUrl: "" // TODO add when support page is ready + bannerReadMoreUrl: "https://support.ultimaker.com/hc/en-us/articles/360011968360/?utm_source=cura&utm_medium=software&utm_campaign=marketplace-learn-plugins" onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_plugin_banner", false) bannerVisible = false; From 19e43e8b663b3c40afe7a1e314e32bf410ae8a09 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 24 Feb 2022 13:26:28 +0100 Subject: [PATCH 13/15] Apply suggestions from code review CURA-8762 Co-authored-by: Casper Lamboo --- .../Marketplace/resources/qml/PackageCardHeader.qml | 13 +++++-------- plugins/Marketplace/resources/qml/Packages.qml | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCardHeader.qml b/plugins/Marketplace/resources/qml/PackageCardHeader.qml index ca4165b97a..9e3e673ea2 100644 --- a/plugins/Marketplace/resources/qml/PackageCardHeader.qml +++ b/plugins/Marketplace/resources/qml/PackageCardHeader.qml @@ -36,19 +36,16 @@ Item sourceSize.width: width source: { - if(packageData.iconUrl != "") + if (packageData.iconUrl != "") { return packageData.iconUrl } - if(packageData.packageType == "plugin") + switch (packageData.packageType) { - return "../images/Plugin.svg" + case "plugin": return "../images/Plugin.svg"; + case "material": return "../images/Spool.svg"; + default: return "../images/placeholder.svg"; } - if(packageData.packageType == "material") - { - return "../images/Spool.svg" - } - return "../images/placeholder.svg" } } diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 17fa884ad7..5cd52e5628 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -84,7 +84,7 @@ ListView manageableInListView: packages.packagesManageableInListView packageData: model.package width: { - if(verticalScrollBar.visible) + if (verticalScrollBar.visible) { return parent.width - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("default_margin").width } From 0d2c8777c548fdc7f63d61b61e2f5799f03af421 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 24 Feb 2022 13:28:39 +0100 Subject: [PATCH 14/15] Add clarifying comment to a small hack CURA-8762 --- plugins/Marketplace/resources/qml/PackagePage.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/Marketplace/resources/qml/PackagePage.qml b/plugins/Marketplace/resources/qml/PackagePage.qml index 00e022dc20..4384d2843f 100644 --- a/plugins/Marketplace/resources/qml/PackagePage.qml +++ b/plugins/Marketplace/resources/qml/PackagePage.qml @@ -40,6 +40,9 @@ Rectangle id: downloadCount Layout.preferredWidth: parent.width Layout.fillHeight: true + // It's not the perfect way to handle this, since a package really can have 0 downloads + // But we re-use the package page for the manage plugins as well. The one user that doesn't see + // the num downloads is an acceptable "sacrifice" to make this easy to fix. visible: packageData.downloadCount != "0" UM.RecolorImage { From 26c027cbdf5930174c06136b117258e39983baf7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 24 Feb 2022 13:30:25 +0100 Subject: [PATCH 15/15] Remove unneeded properties from package card As per review. CURA-8762 --- plugins/Marketplace/resources/qml/PackageCard.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 1b4c4c354e..9a5f9beab6 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -31,10 +31,8 @@ Rectangle { id: descriptionLabel width: parent.width - property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. text: packageData.description - textFormat: Text.PlainText //Must be plain text, or we won't get onLineLaidOut signals. Don't auto-detect! font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") maximumLineCount: 2