moved handling of connection states from qml in connectionController
- added a check for already installed containers before installing the server/container - added a button to scan the server for installed containers - added separation for read/write and readonly servers for pageHome
This commit is contained in:
parent
3a264e6baf
commit
249be451f7
21 changed files with 466 additions and 245 deletions
|
|
@ -15,7 +15,7 @@ Button {
|
|||
}
|
||||
}
|
||||
|
||||
text: qsTr("Connect")
|
||||
text: ConnectionController.connectionStateText
|
||||
|
||||
background: Item {
|
||||
clip: true
|
||||
|
|
@ -26,13 +26,21 @@ Button {
|
|||
Image {
|
||||
id: border
|
||||
|
||||
source: connectionProccess.running ? "/images/connectionProgress.svg" :
|
||||
ConnectionController.isConnected ? "/images/connectionOff.svg" : "/images/connectionOn.svg"
|
||||
source: {
|
||||
if (ConnectionController.isConnectionInProgress) {
|
||||
return "/images/connectionProgress.svg"
|
||||
} else if (ConnectionController.isConnected) {
|
||||
return "/images/connectionOff.svg"
|
||||
} else {
|
||||
return "/images/connectionOn.svg"
|
||||
}
|
||||
}
|
||||
|
||||
RotationAnimator {
|
||||
id: connectionProccess
|
||||
|
||||
target: border
|
||||
running: false
|
||||
running: ConnectionController.isConnectionInProgress
|
||||
from: 0
|
||||
to: 360
|
||||
loops: Animation.Infinite
|
||||
|
|
@ -67,63 +75,12 @@ Button {
|
|||
}
|
||||
|
||||
onClicked: {
|
||||
connectionProccess.running ? ConnectionController.closeConnection() : ConnectionController.openConnection()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ConnectionController
|
||||
function onConnectionStateChanged(state) {
|
||||
switch(state) {
|
||||
case ConnectionState.Unknown: {
|
||||
console.log("Unknown")
|
||||
break
|
||||
}
|
||||
case ConnectionState.Disconnected: {
|
||||
console.log("Disconnected")
|
||||
connectionProccess.running = false
|
||||
root.text = qsTr("Connect")
|
||||
ConnectionController.isConnected = false
|
||||
break
|
||||
}
|
||||
case ConnectionState.Preparing: {
|
||||
console.log("Preparing")
|
||||
connectionProccess.running = true
|
||||
root.text = qsTr("Connection...")
|
||||
break
|
||||
}
|
||||
case ConnectionState.Connecting: {
|
||||
console.log("Connecting")
|
||||
connectionProccess.running = true
|
||||
root.text = qsTr("Connection...")
|
||||
break
|
||||
}
|
||||
case ConnectionState.Connected: {
|
||||
console.log("Connected")
|
||||
connectionProccess.running = false
|
||||
root.text = qsTr("Disconnect")
|
||||
ConnectionController.isConnected = true
|
||||
break
|
||||
}
|
||||
case ConnectionState.Disconnecting: {
|
||||
console.log("Disconnecting")
|
||||
connectionProccess.running = true
|
||||
root.text = qsTr("Disconnection...")
|
||||
break
|
||||
}
|
||||
case ConnectionState.Reconnecting: {
|
||||
console.log("Reconnecting")
|
||||
connectionProccess.running = true
|
||||
root.text = qsTr("Reconnection...")
|
||||
break
|
||||
}
|
||||
case ConnectionState.Error: {
|
||||
console.log("Error")
|
||||
connectionProccess.running = false
|
||||
root.text = qsTr("Connect")
|
||||
PageController.showErrorMessage(ConnectionController.getLastConnectionError())
|
||||
break
|
||||
}
|
||||
}
|
||||
if (ConnectionController.isConnectionInProgress) {
|
||||
ConnectionController.closeConnection()
|
||||
} else if (ConnectionController.isConnected) {
|
||||
ConnectionController.closeConnection()
|
||||
} else {
|
||||
ConnectionController.openConnection()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue