mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 18:29:04 +08:00
Refactor SyncState logic to SyncState.qml
CURA-7290
This commit is contained in:
parent
7322526791
commit
50ae2064b5
@ -78,4 +78,33 @@ Row // sync state icon + message
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal syncStateChanged(string newState)
|
||||||
|
|
||||||
|
onSyncStateChanged: {
|
||||||
|
if(newState == "syncing"){
|
||||||
|
syncRow.iconSource = UM.Theme.getIcon("update")
|
||||||
|
syncRow.labelText = catalog.i18nc("@label", "Checking...")
|
||||||
|
} else if (newState == "success") {
|
||||||
|
syncRow.iconSource = UM.Theme.getIcon("checked")
|
||||||
|
syncRow.labelText = catalog.i18nc("@label", "You are up to date")
|
||||||
|
} else if (newState == "error") {
|
||||||
|
syncRow.iconSource = UM.Theme.getIcon("warning-light")
|
||||||
|
syncRow.labelText = catalog.i18nc("@label", "Something went wrong...")
|
||||||
|
} else {
|
||||||
|
print("Error: unexpected sync state: " + newState)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newState == "syncing"){
|
||||||
|
syncRow.animateIconRotation = true
|
||||||
|
syncRow.syncButtonVisible = false
|
||||||
|
} else {
|
||||||
|
syncRow.animateIconRotation = false
|
||||||
|
syncRow.syncButtonVisible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: Cura.API.account.syncStateChanged.connect(syncStateChanged)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -77,31 +77,4 @@ Column
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signal syncStateChanged(string newState)
|
|
||||||
|
|
||||||
onSyncStateChanged: {
|
|
||||||
if(newState == "syncing"){
|
|
||||||
syncRow.iconSource = UM.Theme.getIcon("update")
|
|
||||||
syncRow.labelText = catalog.i18nc("@label", "Checking...")
|
|
||||||
} else if (newState == "success") {
|
|
||||||
syncRow.iconSource = UM.Theme.getIcon("checked")
|
|
||||||
syncRow.labelText = catalog.i18nc("@label", "You are up to date")
|
|
||||||
} else if (newState == "error") {
|
|
||||||
syncRow.iconSource = UM.Theme.getIcon("warning-light")
|
|
||||||
syncRow.labelText = catalog.i18nc("@label", "Something went wrong...")
|
|
||||||
} else {
|
|
||||||
print("Error: unexpected sync state: " + newState)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newState == "syncing"){
|
|
||||||
syncRow.animateIconRotation = true
|
|
||||||
syncRow.syncButtonVisible = false
|
|
||||||
} else {
|
|
||||||
syncRow.animateIconRotation = false
|
|
||||||
syncRow.syncButtonVisible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: Cura.API.account.syncStateChanged.connect(syncStateChanged)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user