ApmToolBar.qml 4.82 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: 1024 < parent.width ? 1024 : parent.width
14 15 16 17
    height: 72
    color: "black"
    border.color: "black"

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

Bill Bonney's avatar
Bill Bonney committed
28
// [BB] The code below should work, not sure why. replaced with code above
29 30 31 32 33 34 35 36 37 38 39 40 41 42
//    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"
//                }
//            }
//    }

43 44 45 46
    Row {
        anchors.left: parent.left
        spacing: 2

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

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

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

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

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

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

        Button {
            id: terminalView
            label: "TERMINAL"
            image: "./resources/apmplanner/toolbar/terminal.png"
96
            onClicked: globalObj.triggerTerminalView()
97
        }
Bill Bonney's avatar
Bill Bonney committed
98 99 100 101 102 103 104 105 106 107 108 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

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

//            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"
//            }

136 137 138
    }

    Row {
139
        anchors.right: parent.right
140 141
        spacing: 2

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
        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"
        }

164 165 166 167
        Button {
            id: connectButton
            label: "CONNECT"
            image: "./resources/apmplanner/toolbar/connect.png"
168 169 170
            onClicked: globalObj.connectMAV()
        }

Bill Bonney's avatar
Bill Bonney committed
171
        Rectangle { // Spacer
172 173 174 175
            anchors.right: parent.right
            width: 5
            height: parent.height
            color: "black"
176 177 178
        }
    }
}