ApmToolBar.qml 4.96 KB
Newer Older
1 2 3 4 5 6
import QtQuick 1.1
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

13
    width: toolbar.width
14 15 16 17
    height: 72
    color: "black"
    border.color: "black"

18 19 20
    onConnectedChanged: {
        if (connected){
            console.log("APM Tool BAR QML: connected")
21
            connectButton.image = "./resources/qgroundcontrol/toolbar/disconnect.png"
22
            connectButton.label = "DISCONNECT"
23 24
        } else {
            console.log("APM Tool BAR QML: disconnected")
25
            connectButton.image = "./resources/qgroundcontrol/toolbar/connect.png"
26
            connectButton.label = "CONNECT"
27
        }
28 29
    }

Bill Bonney's avatar
Bill Bonney committed
30
// [BB] The code below should work, not sure why. replaced with code above
31 32 33 34 35 36
//    Connections {
//            target: globalObj
//            onMAVConnected: {
//                console.log("QML Change Connection " + connected)
//                if (connected){
//                    console.log("connected")
37
//                    connectButton.image = "./resources/qgroundcontrol/toolbar/disconnect.png"
38 39
//                } else {
//                    console.log("disconnected")
40
//                    connectButton.image = "./resources/qgroundcontrol/toolbar/connect.png"
41 42 43 44
//                }
//            }
//    }

45 46 47 48
    Row {
        anchors.left: parent.left
        spacing: 2

Bill Bonney's avatar
Bill Bonney committed
49
        Rectangle { // Spacer
50 51 52 53 54
            width: 5
            height: parent.height
            color: "black"
        }

55 56 57
        Button {
            id: flightDataView
            label: "FLIGHT DATA"
58
            image: "./resources/qgroundcontrol/toolbar/flightdata.png"
59
            onClicked: {
60
                globalObj.triggerFlightView()
61 62 63 64 65 66
            }
        }

        Button {
            id: flightPlanView
            label: "FLIGHT PLAN"
67
            image: "./resources/qgroundcontrol/toolbar/flightplanner.png"
68
            onClicked: globalObj.triggerFlightPlanView()
69 70 71 72 73
        }

        Button {
            id: hardwareConfigView
            label: "HARDWARE"
74
            image: "./resources/qgroundcontrol/toolbar/hardwareconfig.png"
75
            margins: 8
76
            onClicked: globalObj.triggerHardwareView()
77 78 79 80 81
        }

        Button {
            id: softwareConfigView
            label: "SOFTWARE"
82
            image: "./resources/qgroundcontrol/toolbar/softwareconfig.png"
83
            margins: 8
84
            onClicked: globalObj.triggerSoftwareView()
85 86 87
        }

        Button {
88
            id: simulationView
89
            label: "SIMULATION"
90
            image: "./resources/qgroundcontrol/toolbar/simulation.png"
91
            onClicked: globalObj.triggerSimulationView()
92 93 94 95 96
        }

        Button {
            id: terminalView
            label: "TERMINAL"
97
            image: "./resources/qgroundcontrol/toolbar/terminal.png"
98
            onClicked: globalObj.triggerTerminalView()
99
        }
Bill Bonney's avatar
Bill Bonney committed
100 101 102 103 104 105 106

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

107 108
// [BB] Commented out ToolBar Status info work.
//      WIP: To be fixed later
Bill Bonney's avatar
Bill Bonney committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
//            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"
//            }

140 141 142
    }

    Row {
143
        anchors.right: parent.right
144 145
        spacing: 2

146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
        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"
        }

168 169 170
        Button {
            id: connectButton
            label: "CONNECT"
171
            image: "./resources/qgroundcontrol/toolbar/connect.png"
172 173 174
            onClicked: globalObj.connectMAV()
        }

Bill Bonney's avatar
Bill Bonney committed
175
        Rectangle { // Spacer
176 177 178
            width: 5
            height: parent.height
            color: "black"
179 180 181
        }
    }
}