| 1 |
import QtQuick 2.0 |
| 2 |
import FlightGear 1.0 as FG |
| 3 |
|
| 4 |
Item { |
| 5 |
Rectangle { |
| 6 |
id: hostPanel |
| 7 |
height: hostPanelContent.childrenRect.height + 16 |
| 8 |
width: parent.width - 8 |
| 9 |
|
| 10 |
anchors.top: parent.top |
| 11 |
anchors.topMargin: 8 |
| 12 |
anchors.horizontalCenter: parent.horizontalCenter |
| 13 |
|
| 14 |
border.color: "#9f9f9f" |
| 15 |
border.width: 1 |
| 16 |
color: "#5f5f5f" |
| 17 |
opacity: 0.8 |
| 18 |
|
| 19 |
Column { |
| 20 |
spacing: 8 |
| 21 |
|
| 22 |
id: hostPanelContent |
| 23 |
width: parent.width - 30 |
| 24 |
anchors.top: parent.top |
| 25 |
anchors.topMargin: 8 |
| 26 |
anchors.horizontalCenter: parent.horizontalCenter |
| 27 |
|
| 28 |
InputLine { |
| 29 |
id: hostInput |
| 30 |
width: parent.width |
| 31 |
label: "Hostname" |
| 32 |
text: _application.host |
| 33 |
onEditingFinished: { |
| 34 |
_application.host = text |
| 35 |
portInput.forceActiveFocus(); |
| 36 |
} |
| 37 |
|
| 38 |
KeyNavigation.tab: portInput |
| 39 |
} |
| 40 |
|
| 41 |
InputLine { |
| 42 |
id: portInput |
| 43 |
width: parent.width |
| 44 |
label: "Port" |
| 45 |
text: _application.port |
| 46 |
KeyNavigation.tab: queryButton |
| 47 |
|
| 48 |
onEditingFinished: { |
| 49 |
_application.port = text |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
Button { |
| 54 |
id: queryButton |
| 55 |
label: "Query" |
| 56 |
enabled: _application.host != "" |
| 57 |
visible: (_application.status == FG.Application.Idle) |
| 58 |
|
| 59 |
onClicked: { |
| 60 |
_application.query(); |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
Button { |
| 65 |
id: cancelButton |
| 66 |
label: "Cancel" |
| 67 |
anchors.right: parent.right |
| 68 |
|
| 69 |
visible: (_application.status == FG.Application.Querying) |
| 70 |
|
| 71 |
onClicked: { |
| 72 |
_application.cancelQuery(); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
Button { |
| 77 |
id: clearlButton |
| 78 |
label: "Clear" |
| 79 |
anchors.right: parent.right |
| 80 |
|
| 81 |
visible: (_application.status == FG.Application.SuccessfulQuery) | |
| 82 |
(_application.status == FG.Application.QueryFailed) |
| 83 |
|
| 84 |
onClicked: { |
| 85 |
_application.clearQuery(); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
Rectangle { |
| 93 |
id: canvasListPanel |
| 94 |
border.color: "#9f9f9f" |
| 95 |
border.width: 1 |
| 96 |
color: "#5f5f5f" |
| 97 |
opacity: 0.8 |
| 98 |
anchors.top: hostPanel.bottom |
| 99 |
anchors.topMargin: 8 |
| 100 |
anchors.horizontalCenter: parent.horizontalCenter |
| 101 |
width: 300 |
| 102 |
anchors.bottom: parent.bottom |
| 103 |
anchors.bottomMargin: 8 |
| 104 |
visible: _application.canvases.length > 0 |
| 105 |
|
| 106 |
ListView { |
| 107 |
id: canvasList |
| 108 |
model: _application.canvases |
| 109 |
visible: (_application.status == FG.Application.SuccessfulQuery) |
| 110 |
width: parent.width - 30 |
| 111 |
height: parent.height |
| 112 |
anchors.horizontalCenter: parent.horizontalCenter |
| 113 |
|
| 114 |
delegate: Rectangle { |
| 115 |
width: canvasLabel.implicitWidth |
| 116 |
height: canvasLabel.implicitHeight + 20 |
| 117 |
|
| 118 |
color: "#3f3f3f" |
| 119 |
|
| 120 |
Text { |
| 121 |
id: canvasLabel |
| 122 |
text: modelData['name'] |
| 123 |
|
| 124 |
// todo - different color if we already have a connection? |
| 125 |
color: "white" |
| 126 |
anchors.verticalCenter: parent.verticalCenter |
| 127 |
|
| 128 |
|
| 129 |
} |
| 130 |
|
| 131 |
MouseArea { |
| 132 |
anchors.fill: parent |
| 133 |
onClicked: { |
| 134 |
_application.openCanvas(modelData['path']); |
| 135 |
} |
| 136 |
} |
| 137 |
} |
| 138 |
} |
| 139 |
} |
| 140 |
} |