Display package cards in the package list for packages that can't be found on the marketplace api.

When the final page of results is fetched, the list of all package_ids retrieved from the api will be compared with the ones we were searching for. Any that are missing have cards displayed with only basic information (name and version).

CURA-6990
This commit is contained in:
j.delarago 2022-06-02 16:54:08 +02:00
parent 812b728636
commit 511b10c084
4 changed files with 78 additions and 9 deletions

View file

@ -19,6 +19,8 @@ Item
property bool showInstallButton: false
property bool showUpdateButton: false
property string missingPackageReadMoreUrl: "https://support.ultimaker.com"
width: parent.width
height: UM.Theme.getSize("card").height
@ -109,6 +111,7 @@ Item
Button
{
id: externalLinkButton
visible: !packageData.isMissingPackageInformation
// For some reason if i set padding, they don't match up. If i set all of them explicitly, it does work?
leftPadding: UM.Theme.getSize("narrow_margin").width
@ -155,6 +158,7 @@ Item
UM.Label
{
id: authorBy
visible: !packageData.isMissingPackageInformation
Layout.alignment: Qt.AlignCenter
text: catalog.i18nc("@label Is followed by the name of an author", "By")
@ -165,6 +169,7 @@ Item
// clickable author name
Item
{
visible: !packageData.isMissingPackageInformation
Layout.fillWidth: true
implicitHeight: authorBy.height
Layout.alignment: Qt.AlignTop
@ -182,10 +187,29 @@ Item
}
}
Item
{
visible: packageData.isMissingPackageInformation
Layout.fillWidth: true
implicitHeight: readMoreButton.height
Layout.alignment: Qt.AlignTop
Cura.TertiaryButton
{
id: readMoreButton
text: catalog.i18nc("@button:label", "Learn More")
leftPadding: 0
rightPadding: 0
iconSource: UM.Theme.getIcon("LinkExternal")
isIconOnRightSide: true
onClicked: Qt.openUrlExternally(missingPackageReadMoreUrl)
}
}
ManageButton
{
id: enableManageButton
visible: showDisableButton && packageData.isInstalled && !packageData.isToBeInstalled && packageData.packageType != "material"
visible: showDisableButton && packageData.isInstalled && !packageData.isToBeInstalled && packageData.packageType != "material" && !packageData.isMissingPackageInformation
enabled: !packageData.busy
button_style: !packageData.isActive
@ -199,7 +223,7 @@ Item
ManageButton
{
id: installManageButton
visible: showInstallButton && (packageData.canDowngrade || !packageData.isBundled)
visible: showInstallButton && (packageData.canDowngrade || !packageData.isBundled) && !packageData.isMissingPackageInformation
enabled: !packageData.busy
busy: packageData.busy
button_style: !(packageData.isInstalled || packageData.isToBeInstalled)
@ -229,7 +253,7 @@ Item
ManageButton
{
id: updateManageButton
visible: showUpdateButton && packageData.canUpdate
visible: showUpdateButton && packageData.canUpdate && !packageData.isMissingPackageInformation
enabled: !packageData.busy
busy: packageData.busy
Layout.alignment: Qt.AlignTop