ApmToolBar.qml 4.92 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 21
    onConnectedChanged: {
        if (connected){
            console.log("APM Tool BAR QML: connected")
            connectButton.image = "./resources/apmplanner/toolbar/disconnect.png"
22
            connectButton.label = "CONNECT"
23 24 25
        } else {
            console.log("APM Tool BAR QML: disconnected")
            connectButton.image = "./resources/apmplanner/toolbar/connect.png"
26
            connectButton.label = "DISCONNECT"
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 37 38 39 40 41 42 43 44
//    Connections {
//            target: globalObj
//            onMAVConnected: {
//                console.log("QML Change Connection " + connected)
//                if (connected){
//                    console.log("connected")
//                    connectButton.image = "./resources/apmplanner/toolbar/disconnect.png"
//                } else {
//                    console.log("disconnected")
//                    connectButton.image = "./resources/apmplanner/toolbar/connect.png"
//                }
//            }
//    }

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 58 59
        Button {
            id: flightDataView
            label: "FLIGHT DATA"
            image: "./resources/apmplanner/toolbar/flightdata.png"
            onClicked: {
60
                globalObj.triggerFlightView()
61 62 63 64 65 66 67
            }
        }

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

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

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

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

        Button {
            id: terminalView
            label: "TERMINAL"
            image: "./resources/apmplanner/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 171
        Button {
            id: connectButton
            label: "CONNECT"
            image: "./resources/apmplanner/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
        }
    }
}