From 20f94add47835ace7d5c16d37ff88ef1f6318d9f Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 26 Nov 2021 10:10:09 +0100 Subject: [PATCH] Display different content on each of the marketplace onboarding banners --- .../resources/qml/ManagedPackages.qml | 1 + .../Marketplace/resources/qml/Marketplace.qml | 1 + .../Marketplace/resources/qml/Materials.qml | 1 + .../resources/qml/OnboardBanner.qml | 20 +++++++++++++++++-- .../Marketplace/resources/qml/Packages.qml | 2 ++ plugins/Marketplace/resources/qml/Plugins.qml | 1 + 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index 243d5bf12e..c53384bf77 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -10,6 +10,7 @@ import UM 1.4 as UM Packages { pageTitle: catalog.i18nc("@header", "Manage packages") + bannerType: "__MANAGE_PACKAGES__" model: Marketplace.LocalPackageList { } diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 3fcc0bb3fd..7293a61a80 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -50,6 +50,7 @@ Window OnboardBanner { + bannerType: content.item && content.item.bannerType } // Page title. diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index 1d1572976a..dff63305bf 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -6,6 +6,7 @@ import Marketplace 1.0 as Marketplace Packages { pageTitle: catalog.i18nc("@header", "Install Materials") + bannerType: "__MATERIALS__" model: Marketplace.RemotePackageList { packageTypeFilter: "material" diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index b91a9a52f7..8a1048018c 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -11,6 +11,8 @@ import Cura 1.6 as Cura // Onboarding banner. Rectangle { + property var bannerType + Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height anchors { @@ -39,7 +41,14 @@ Rectangle { anchors.fill: parent color: UM.Theme.getColor("primary_text") - source: UM.Theme.getIcon("Shop") + source: { + switch (bannerType) { + case "__PLUGINS__" : return UM.Theme.getIcon("Shop"); + case "__MATERIALS__" : return UM.Theme.getIcon("Spool"); + case "__MANAGE_PACKAGES__" : return UM.Theme.getIcon("ArrowDoubleCircleRight"); + default: return ""; + } + } } } @@ -74,6 +83,13 @@ Rectangle font: UM.Theme.getFont("medium") color: UM.Theme.getColor("primary_text") wrapMode: Text.WordWrap - text: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") + text: { + switch (bannerType) { + case "__PLUGINS__" : return catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users."); + case "__MATERIALS__" : return catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers."); + case "__MANAGE_PACKAGES__" : return 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."); + default: return ""; + } + } } } \ No newline at end of file diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 79b4bf23a5..345aecf822 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -11,6 +11,8 @@ ListView id: packages property string pageTitle + property string bannerType + width: parent.width clip: true diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index ef5d92c2e8..24381e3027 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -6,6 +6,7 @@ import Marketplace 1.0 as Marketplace Packages { pageTitle: catalog.i18nc("@header", "Install Plugins") + bannerType: "__PLUGINS__" model: Marketplace.RemotePackageList { packageTypeFilter: "plugin"