diff options
author | Jelle Spijker <spijker.jelle@gmail.com> | 2021-12-07 20:25:46 +0300 |
---|---|---|
committer | Jelle Spijker <spijker.jelle@gmail.com> | 2021-12-07 20:25:46 +0300 |
commit | 3be6747e5dc9d0129878e9fe57556bb8be8df53a (patch) | |
tree | 1bd119fb39ba5774f15eaafad1e494bf0a5e5eda /plugins/Marketplace/resources | |
parent | 9e4258ef8b3d625178f34496e06dcf6f7eff4275 (diff) |
Trying to set a persistent install managebutton
Contributes to: CURA-8587
Diffstat (limited to 'plugins/Marketplace/resources')
-rw-r--r-- | plugins/Marketplace/resources/qml/ManageButton.qml | 57 | ||||
-rw-r--r-- | plugins/Marketplace/resources/qml/PackageCard.qml | 20 |
2 files changed, 33 insertions, 44 deletions
diff --git a/plugins/Marketplace/resources/qml/ManageButton.qml b/plugins/Marketplace/resources/qml/ManageButton.qml index 0b3008461b..a423e90ff6 100644 --- a/plugins/Marketplace/resources/qml/ManageButton.qml +++ b/plugins/Marketplace/resources/qml/ManageButton.qml @@ -17,16 +17,14 @@ RowLayout property string busySecondaryText: busyMessageText.text property string confirmedPrimaryText: confirmedMessageText.text property string confirmedSecondaryText: confirmedMessageText.text - property bool enabled: true - property bool busy: false - property bool confirmed: false + property bool busy + property bool confirmed signal clicked(bool primary_action) Cura.PrimaryButton { id: primaryButton - visible: false enabled: manageButton.enabled onClicked: @@ -40,7 +38,6 @@ RowLayout Cura.SecondaryButton { id: secondaryButton - visible: false enabled: manageButton.enabled onClicked: @@ -54,7 +51,6 @@ RowLayout Item { id: busyMessage - visible: false property alias text: busyMessageText.text height: UM.Theme.getSize("action_button").height width: childrenRect.width @@ -62,7 +58,6 @@ RowLayout UM.RecolorImage { id: busyIndicator - visible: busyMessage.visible width: height anchors.left: parent.left anchors.top: parent.top @@ -86,7 +81,6 @@ RowLayout Label { id: busyMessageText - visible: busyMessage.visible anchors.left: busyIndicator.right anchors.leftMargin: UM.Theme.getSize("narrow_margin").width anchors.verticalCenter: parent.verticalCenter @@ -101,14 +95,12 @@ RowLayout id: confirmedMessage property alias text: confirmedMessageText.text - visible: false height: UM.Theme.getSize("action_button").height width: childrenRect.width Label { id: confirmedMessageText - visible: parent.visible anchors.verticalCenter: parent.verticalCenter font: UM.Theme.getFont("medium_bold") @@ -123,12 +115,6 @@ RowLayout name: "primary" PropertyChanges { - target: manageButton - busy: false - confirmed: false - } - PropertyChanges - { target: primaryButton visible: true } @@ -153,12 +139,6 @@ RowLayout name: "secondary" PropertyChanges { - target: manageButton - busy: false - confirmed: false - } - PropertyChanges - { target: primaryButton visible: false } @@ -183,7 +163,22 @@ RowLayout name: "hidden" PropertyChanges { - target: manageButton + target: primaryButton + visible: false + } + PropertyChanges + { + target: secondaryButton + visible: false + } + PropertyChanges + { + target: busyMessage + visible: false + } + PropertyChanges + { + target: confirmedMessage visible: false } }, @@ -192,12 +187,6 @@ RowLayout name: "busy" PropertyChanges { - target: manageButton - busy: true - confirmed: false - } - PropertyChanges - { target: primaryButton visible: false } @@ -209,7 +198,7 @@ RowLayout PropertyChanges { target: busyMessage - visible: manageButton.visible + visible: true } PropertyChanges { @@ -222,12 +211,6 @@ RowLayout name: "confirmed" PropertyChanges { - target: manageButton - busy: false - confirmed: true - } - PropertyChanges - { target: primaryButton visible: false } @@ -244,7 +227,7 @@ RowLayout PropertyChanges { target: confirmedMessage - visible: manageButton.visible + visible: true } } ] diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 12f24f6f6f..667c645c61 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -323,7 +323,9 @@ Rectangle ManageButton { id: enableManageButton - state: packageData.stateManageEnableButton + state: !(installManageButton.confirmed || updateManageButton.confirmed) || enableManageButton.confirmed ? packageData.stateManageEnableButton : "hidden" + busy: packageData.enableManageButton == "busy" + confirmed: packageData.enableManageButton == "confirmed" Layout.alignment: Qt.AlignTop primaryText: catalog.i18nc("@button", "Enable") busyPrimaryText: catalog.i18nc("@button", "Enabling...") @@ -332,9 +334,9 @@ Rectangle busySecondaryText: catalog.i18nc("@button", "Disabling...") confirmedSecondaryText: catalog.i18nc("@button", "Disabled") enabled: !(installManageButton.busy || updateManageButton.busy) - visible: (root.manageableInListView || root.expanded) && !(installManageButton.confirmed || updateManageButton.confirmed) - onClicked: { + onClicked: + { if (primary_action) { packageData.enablePackageTriggered(packageData.packageId) @@ -349,7 +351,9 @@ Rectangle ManageButton { id: installManageButton - state: packageData.stateManageInstallButton + state: (root.manageableInListView || root.expanded || installManageButton.confirmed) && !(enableManageButton.confirmed || updateManageButton.confirmed) ? packageData.stateManageInstallButton : "hidden" + busy: packageData.stateManageInstallButton == "busy" + confirmed: packageData.stateManageInstallButton == "confirmed" Layout.alignment: Qt.AlignTop primaryText: catalog.i18nc("@button", "Install") busyPrimaryText: catalog.i18nc("@button", "Installing...") @@ -358,7 +362,8 @@ Rectangle busySecondaryText: catalog.i18nc("@button", "Uninstalling...") confirmedSecondaryText: catalog.i18nc("@button", "Uninstalled") enabled: !(enableManageButton.busy || updateManageButton.busy) - visible: (installManageButton.confirmed || root.manageableInListView || root.expanded) && !(updateManageButton.confirmed || enableManageButton.confirmed) + + onStateChanged: print(packageData.displayName + " " + state) // TODO: Cleanup once you find out why this happens onClicked: { @@ -376,13 +381,14 @@ Rectangle ManageButton { id: updateManageButton - state: packageData.stateManageUpdateButton + state: (root.manageableInListView || root.expanded) && (!installManageButton.confirmed || updateManageButton.confirmed) ? packageData.stateManageUpdateButton : "hidden" + busy: packageData.stateManageUpdateButton == "busy" + confirmed: packageData.stateManageUpdateButton == "confirmed" Layout.alignment: Qt.AlignTop primaryText: catalog.i18nc("@button", "Update") busyPrimaryText: catalog.i18nc("@button", "Updating...") confirmedPrimaryText: catalog.i18nc("@button", "Updated") enabled: !(installManageButton.busy || enableManageButton.busy) - visible: (root.manageableInListView || root.expanded) && !installManageButton.confirmed onClicked: packageData.updatePackageTriggered(packageData.packageId) } |