diff options
author | Jaime van Kessel <nallath@gmail.com> | 2021-12-13 17:13:00 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2021-12-13 17:13:00 +0300 |
commit | d50dc59aacb66ebeb2f82333e40f589898997414 (patch) | |
tree | 7141f028f65212cd1752b0cd6b9cf19eaa265534 /plugins/Marketplace/resources | |
parent | d422e0d4eeb014350f4c9ba029f064ed3c21bf72 (diff) |
Simplifications and cleanup
CURA-8587
Diffstat (limited to 'plugins/Marketplace/resources')
-rw-r--r-- | plugins/Marketplace/resources/qml/ManageButton.qml | 2 | ||||
-rw-r--r-- | plugins/Marketplace/resources/qml/PackageCardHeader.qml | 62 |
2 files changed, 14 insertions, 50 deletions
diff --git a/plugins/Marketplace/resources/qml/ManageButton.qml b/plugins/Marketplace/resources/qml/ManageButton.qml index 87c72d8710..36022ffd54 100644 --- a/plugins/Marketplace/resources/qml/ManageButton.qml +++ b/plugins/Marketplace/resources/qml/ManageButton.qml @@ -11,7 +11,7 @@ import Cura 1.6 as Cura Item { id: manageButton - property bool button_style + property bool button_style: true property string text property bool busy: false property bool confirmed: false diff --git a/plugins/Marketplace/resources/qml/PackageCardHeader.qml b/plugins/Marketplace/resources/qml/PackageCardHeader.qml index fa45a4d0bb..5a661e32fb 100644 --- a/plugins/Marketplace/resources/qml/PackageCardHeader.qml +++ b/plugins/Marketplace/resources/qml/PackageCardHeader.qml @@ -181,7 +181,7 @@ Item ManageButton { id: enableManageButton - visible: showManageButtons && !(installManageButton.confirmed || updateManageButton.confirmed || packageData.packageType == "material") + visible: showManageButtons && packageData.packageType != "material" enabled: !(installManageButton.busy || updateManageButton.busy) button_style: !packageData.isActive @@ -189,23 +189,13 @@ Item text: button_style ? catalog.i18nc("@button", "Enable") : catalog.i18nc("@button", "Disable") - onClicked: - { - if(packageData.isActive) - { - packageData.disablePackageTriggered(packageData.packageId) - } - else - { - packageData.enablePackageTriggered(packageData.packageId) - } - } + onClicked: packageData.isActive ? packageData.disable(): packageData.enable() } ManageButton { id: installManageButton - visible: (showManageButtons || confirmed) && ((packageData.isBundled && packageData.canDowngrade) || !packageData.isBundled) && !updateManageButton.confirmed + visible: showManageButtons && (packageData.canDowngrade || !packageData.isBundled) enabled: !updateManageButton.busy busy: packageData.busy button_style: !packageData.isInstalled @@ -213,6 +203,11 @@ Item text: { + if (packageData.canDowngrade) + { + if (busy) { return catalog.i18nc("@button", "Downgrading..."); } + else { return catalog.i18nc("@button", "Downgrade"); } + } if (!packageData.isInstalled) { if (busy) { return catalog.i18nc("@button", "Installing..."); } @@ -220,56 +215,25 @@ Item } else { - if (packageData.canDowngrade) - { - if (busy) { return catalog.i18nc("@button", "Downgrading..."); } - else { return catalog.i18nc("@button", "Downgrade"); } - } - else - { - return catalog.i18nc("@button", "Uninstall"); - } + return catalog.i18nc("@button", "Uninstall"); } } onClicked: packageData.isInstalled ? packageData.uninstall(): packageData.install() - } ManageButton { id: updateManageButton - visible: (showManageButtons || confirmed) && (packageData.canUpdate || confirmed) && !installManageButton.confirmed + visible: showManageButtons && packageData.canUpdate enabled: !installManageButton.busy - confirmed: packageData.isRecentlyUpdatedChanged - - button_style: true + busy: packageData.busy Layout.alignment: Qt.AlignTop - text: - { - if (busy) { return catalog.i18nc("@button", "Updating..."); } - else if (confirmed) { return catalog.i18nc("@button", "Updated"); } - else { return catalog.i18nc("@button", "Update"); } - } - - onClicked: - { - busy = true - packageData.updatePackageTriggered(packageData.packageId); - } + text: busy ? catalog.i18nc("@button", "Updating..."): catalog.i18nc("@button", "Update") - Connections - { - target: packageData - - function updated(succes) - { - updateManageButton.busy = false; - updateManageButton.confirmed = succes; - } - } + onClicked: packageData.updatePackageTriggered(packageData.packageId); } } } |