added ConnectionController error handling
This commit is contained in:
parent
420c33d3ba
commit
80fca589af
11 changed files with 134 additions and 140 deletions
|
|
@ -7,27 +7,48 @@ import ConnectionState 1.0
|
|||
Button {
|
||||
id: root
|
||||
|
||||
Connections {
|
||||
target: ConnectionController
|
||||
|
||||
function onConnectionErrorOccurred(errorMessage) {
|
||||
PageController.showErrorMessage(errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
text: qsTr("Connect")
|
||||
|
||||
background: Image {
|
||||
id: border
|
||||
background: Item {
|
||||
clip: true
|
||||
|
||||
source: connectionProccess.running ? "/images/connectionProgress.svg" :
|
||||
ConnectionController.isConnected ? "/images/connectionOff.svg" : "/images/connectionOn.svg"
|
||||
implicitHeight: border.implicitHeight
|
||||
implicitWidth: border.implicitWidth
|
||||
|
||||
RotationAnimator {
|
||||
id: connectionProccess
|
||||
Image {
|
||||
id: border
|
||||
|
||||
target: border
|
||||
running: false
|
||||
from: 0
|
||||
to: 360
|
||||
loops: Animation.Infinite
|
||||
duration: 1250
|
||||
source: connectionProccess.running ? "/images/connectionProgress.svg" :
|
||||
ConnectionController.isConnected ? "/images/connectionOff.svg" : "/images/connectionOn.svg"
|
||||
RotationAnimator {
|
||||
id: connectionProccess
|
||||
|
||||
target: border
|
||||
running: false
|
||||
from: 0
|
||||
to: 360
|
||||
loops: Animation.Infinite
|
||||
duration: 1250
|
||||
}
|
||||
|
||||
Behavior on source {
|
||||
PropertyAnimation { duration: 200 }
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on source {
|
||||
PropertyAnimation { duration: 200 }
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +67,7 @@ Button {
|
|||
}
|
||||
|
||||
onClicked: {
|
||||
ConnectionController.isConnected ? ConnectionController.closeConnection() : ConnectionController.openConnection()
|
||||
connectionProccess.running ? ConnectionController.closeConnection() : ConnectionController.openConnection()
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
@ -98,6 +119,8 @@ Button {
|
|||
case ConnectionState.Error: {
|
||||
console.log("Error")
|
||||
connectionProccess.running = false
|
||||
root.text = qsTr("Connect")
|
||||
PageController.showErrorMessage(ConnectionController.getLastConnectionError())
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ PageType {
|
|||
Layout.fillWidth: true
|
||||
|
||||
text: name
|
||||
descriptionText: "description"
|
||||
descriptionText: hostName
|
||||
|
||||
checked: index === serversMenuContent.currentIndex
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ PageType {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
spacing: 16
|
||||
|
||||
ListView {
|
||||
// todo change id naming
|
||||
id: containers
|
||||
|
|
@ -63,6 +61,8 @@ PageType {
|
|||
anchors.leftMargin: 16
|
||||
|
||||
BackButtonType {
|
||||
id: backButton
|
||||
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
|
||||
|
|
@ -136,6 +136,7 @@ PageType {
|
|||
id: port
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 16
|
||||
headerText: "Port"
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +144,7 @@ PageType {
|
|||
// todo make it dynamic
|
||||
implicitHeight: root.height - port.implicitHeight -
|
||||
transportProtoBackground.implicitHeight - transportProtoHeader.implicitHeight -
|
||||
header.implicitHeight - installButton.implicitHeight - 100
|
||||
header.implicitHeight - backButton.implicitHeight - installButton.implicitHeight - 116
|
||||
|
||||
color: "transparent"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import QtQuick.Window
|
|||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import PageType 1.0
|
||||
import PageEnum 1.0
|
||||
|
||||
import "Config"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue