ApmToolBar.qml 5.74 KB
Newer Older
1
import QtQuick 2.1
2 3 4 5 6
import "./components"


Rectangle {
    id: toolbar
7 8 9 10

    property alias backgroundColor : toolbar.color
    property alias linkNameLabel: linkDevice.label
    property alias baudrateLabel: baudrate.label
11
    property bool connected: false
12
    property bool armed: false
13
    property string armedstr: "DISARMED"
14

15
    width: toolbar.width
16 17 18 19
    height: 72
    color: "black"
    border.color: "black"

20 21
    onArmedChanged: {
        if (armed) {
22 23 24
            statusDisplay.statusText = "ARMED"
            statusDisplay.statusTextColor = "red"
            statusDisplay.statusBackgroundColor = "#FF880000"
25 26
        }
        else {
27 28 29
            statusDisplay.statusText = "DISARMED"
            statusDisplay.statusTextColor = "yellow"
            statusDisplay.statusBackgroundColor = "black"
30 31 32
        }
    }

33 34 35
    onConnectedChanged: {
        if (connected){
            console.log("APM Tool BAR QML: connected")
36
            connectButton.image = "./resources/qgroundcontrol/toolbar/disconnect.png"
37
            connectButton.label = "DISCONNECT"
38 39
        } else {
            console.log("APM Tool BAR QML: disconnected")
40
            connectButton.image = "./resources/qgroundcontrol/toolbar/connect.png"
41
            connectButton.label = "CONNECT"
42
        }
43 44
    }

Bill Bonney's avatar
Bill Bonney committed
45
// [BB] The code below should work, not sure why. replaced with code above
46 47 48 49 50 51
//    Connections {
//            target: globalObj
//            onMAVConnected: {
//                console.log("QML Change Connection " + connected)
//                if (connected){
//                    console.log("connected")
52
//                    connectButton.image = "./resources/qgroundcontrol/toolbar/disconnect.png"
53 54
//                } else {
//                    console.log("disconnected")
55
//                    connectButton.image = "./resources/qgroundcontrol/toolbar/connect.png"
56 57 58 59
//                }
//            }
//    }

60 61
    Row {
        anchors.left: parent.left
62
        spacing: 10
63

Bill Bonney's avatar
Bill Bonney committed
64
        Rectangle { // Spacer
65 66 67 68 69
            width: 5
            height: parent.height
            color: "black"
        }

70 71 72
        Button {
            id: flightDataView
            label: "FLIGHT DATA"
73
            image: "./resources/qgroundcontrol/toolbar/flightdata.png"
74
            onClicked: {
75
                globalObj.triggerFlightView()
76 77 78 79 80 81
            }
        }

        Button {
            id: flightPlanView
            label: "FLIGHT PLAN"
82
            image: "./resources/qgroundcontrol/toolbar/flightplanner.png"
83
            onClicked: globalObj.triggerFlightPlanView()
84 85 86 87 88
        }

        Button {
            id: hardwareConfigView
            label: "HARDWARE"
89
            image: "./resources/qgroundcontrol/toolbar/hardwareconfig.png"
90
            margins: 8
91
            onClicked: globalObj.triggerHardwareView()
92 93 94 95 96
        }

        Button {
            id: softwareConfigView
            label: "SOFTWARE"
97
            image: "./resources/qgroundcontrol/toolbar/softwareconfig.png"
98
            margins: 8
99
            onClicked: globalObj.triggerSoftwareView()
100 101 102
        }

        Button {
103
            id: simulationView
104
            label: "SIMULATION"
105
            image: "./resources/qgroundcontrol/toolbar/simulation.png"
106
            onClicked: globalObj.triggerSimulationView()
107 108 109 110 111
        }

        Button {
            id: terminalView
            label: "TERMINAL"
112
            image: "./resources/qgroundcontrol/toolbar/terminal.png"
113
            onClicked: globalObj.triggerTerminalView()
114
        }
Bill Bonney's avatar
Bill Bonney committed
115 116

        Rectangle { // Spacer
117
            width: 5
118
            height: parent.height
119 120 121 122 123 124 125 126 127
            color: "black"
        }

        StatusDisplay {
            id: statusDisplay
            width: 110
            statusText: "DISARMED"
            statusTextColor: "yellow"
            statusBackgroundColor: "black"
128
        }
Bill Bonney's avatar
Bill Bonney committed
129 130 131 132 133 134 135

        Rectangle { // Spacer
            width: 5
            height: parent.height
            color: "black"
        }

136 137
// [BB] Commented out ToolBar Status info work.
//      WIP: To be fixed later
Bill Bonney's avatar
Bill Bonney committed
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
//            DigitalDisplay { // Information Pane
//                title:"Mode"
//                textValue: "Stabilize"
//                color: "black"
//            }
//            DigitalDisplay { // Information Pane
//                title: "Speed"
//                textValue: "11.0m/s"
//                color: "black"
//            }
//            DigitalDisplay { // Information Pane
//                title: "Alt"
//                textValue: "20.0m"
//                color: "black"
//            }
//            DigitalDisplay { // Information Pane
//                title: "Volts"
//                textValue: "14.8V"
//                color: "black"
//            }
//            DigitalDisplay { // Information Pane
//                title: "Current"
//                textValue: "12.0A"
//                color: "black"
//            }
//            DigitalDisplay { // Information Pane
//                title: "Level"
//                textValue: "77%"
//                color: "black"
//            }

169 170 171
    }

    Row {
172
        anchors.right: parent.right
173 174
        spacing: 2

175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
        TextButton {
            id: linkDevice
            label: "none"
            minWidth: 100

            onClicked: globalObj.showConnectionDialog()
        }

        TextButton {
            id: baudrate
            label: "none"
            minWidth: 100

            onClicked: globalObj.showConnectionDialog()
        }

        Rectangle {
            width: 5
            height: parent.height
            color: "black"
        }

197 198 199
        Button {
            id: connectButton
            label: "CONNECT"
200
            image: "./resources/qgroundcontrol/toolbar/connect.png"
201 202 203
            onClicked: globalObj.connectMAV()
        }

Bill Bonney's avatar
Bill Bonney committed
204
        Rectangle { // Spacer
205 206 207
            width: 5
            height: parent.height
            color: "black"
208 209 210
        }
    }
}