Make the progressButton use signals instead of functions

Although the naming is still a bit off, it's much cleaner to use signals instead of functions. It's
also more in line with how default QML components handle these kind of situations

CURA-6006
This commit is contained in:
Jaime van Kessel 2018-12-06 09:54:32 +01:00
parent 838949dac7
commit 6a466c99b2
4 changed files with 19 additions and 26 deletions

View file

@ -18,19 +18,15 @@ Column
id: installButton
active: toolbox.isDownloading && toolbox.activePackage == model
complete: installed
readyAction: function()
onReadyAction:
{
toolbox.activePackage = model
toolbox.startDownload(model.download_url)
}
activeAction: function()
{
toolbox.cancelDownload()
}
completeAction: function()
{
toolbox.viewCategory = "installed"
}
onActiveAction: toolbox.cancelDownload()
onCompleteAction: toolbox.viewCategory = "installed"
// Don't allow installing while another download is running
enabled: installed || !(toolbox.isDownloading && toolbox.activePackage != model)
opacity: enabled ? 1.0 : 0.5
@ -44,20 +40,19 @@ Column
readyLabel: catalog.i18nc("@action:button", "Update")
activeLabel: catalog.i18nc("@action:button", "Updating")
completeLabel: catalog.i18nc("@action:button", "Updated")
readyAction: function()
onReadyAction:
{
toolbox.activePackage = model
toolbox.update(model.id)
}
activeAction: function()
{
toolbox.cancelDownload()
}
onActiveAction: toolbox.cancelDownload()
// Don't allow installing while another download is running
enabled: !(toolbox.isDownloading && toolbox.activePackage != model)
opacity: enabled ? 1.0 : 0.5
visible: canUpdate
}
Connections
{
target: toolbox