FlightDisplayWimaMenu.qml 5.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import QtQuick                  2.3
import QtQuick.Controls         1.2
import QtQuick.Controls.Styles  1.4
import QtQuick.Dialogs          1.2
import QtLocation               5.3
import QtPositioning            5.3
import QtQuick.Layouts          1.2

import QGroundControl               1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.FlightMap     1.0
import QGroundControl.Airspace      1.0
import QGroundControl.Airmap        1.0
17 18
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
19 20

Item {
21 22 23
    id:     _root
    height: 400
    width:  250
24

25 26 27
    property var wimaController // must be provided by the user

    // box containing all items
28
    Rectangle {
29 30
        anchors.left:   parent.left
        anchors.bottom: parent.bottom
31 32 33 34 35 36 37 38
        height:         enableWima.enableWimaBoolean ? parent.height : enableWima.height
        width:          enableWima.enableWimaBoolean ? parent.width : enableWima.width
        color:          enableWima.enableWimaBoolean ? qgcPal.window : "transparent"
        radius:         ScreenTools.defaultFontPixelHeight / 4
        anchors.topMargin:      ScreenTools.defaultFontPixelHeight * 0.5
        anchors.bottomMargin:   ScreenTools.defaultFontPixelHeight * 0.5
        anchors.rightMargin:    ScreenTools.defaultFontPixelHeight * 0.5
        anchors.leftMargin:     ScreenTools.defaultFontPixelHeight * 0.5
39

40
        // checkbox to enable/ disable wima
41
        SliderSwitch {
42
            id: enableWima
43
            anchors.horizontalCenter: parent.horizontalCenter
44
            anchors.topMargin:      ScreenTools.defaultFontPixelHeight * 0.25
45
            anchors.top: parent.top
46
            confirmText: enableWimaBoolean ? qsTr("disable WiMA") : qsTr("enable WiMA")
47

48 49
            property var enableWimaFact:        wimaController.enableWimaController
            property bool enableWimaBoolean:    enableWimaFact.value
50

51 52 53 54 55 56 57
            onAccept: {
                if (enableWimaBoolean) {
                    enableWimaFact.value = false
                } else {
                    enableWimaFact.value = true
                }
            }
58 59
        }

60 61 62 63 64 65 66 67 68 69 70 71 72
        Column {
            id: mainColumn
            anchors.top:        enableWima.bottom
            anchors.left:       parent.left
            anchors.right:      parent.right
            anchors.bottom:     parent.bottom
            anchors.margins:    ScreenTools.defaultFontPixelHeight * 0.4
            spacing:            ScreenTools.defaultFontPixelHeight * 0.25


            SectionHeader {
                id: settingsHeader
                text: qsTr("Settings")
73
            }
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
            GridLayout {
                columns: 2
                rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
                anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.25
                visible: settingsHeader.checked

                // Settings
                QGCLabel { text: qsTr("Next Waypoint") }
                FactTextField {
                    fact:               wimaController.startWaypointIndex
                    Layout.fillWidth:   true
                }

                QGCLabel { text: qsTr("Max Waypoints") }
                FactTextField {
                    fact:               wimaController.maxWaypointsPerPhase
                    Layout.fillWidth:   true
                }

                QGCLabel { text: qsTr("Overlap") }
                FactTextField {
                    fact:               wimaController.overlapWaypoints
                    Layout.fillWidth:   true
                }
98

99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
                FactCheckBox {
                    text:       qsTr("Show All")
                    fact:       wimaController.showAllMissionItems
                }

                FactCheckBox {
                    text:       qsTr("Show Current")
                    fact:       wimaController.showCurrentMissionItems
                }

            }

            SectionHeader{
                id: commandHeader
                text: qsTr("Commands")
114
            }
115 116 117 118 119 120 121 122
            GridLayout {
                columns: 2
                rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
                anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.25
                visible: commandHeader.checked

                // Buttons
                QGCButton {
123 124 125
                    id: buttonPreviousMissionPhase
                    text: qsTr("Reverse")
                    onClicked: wimaController.previousPhase();
126 127 128 129
                    Layout.fillWidth:   true
                }

                QGCButton {
130 131 132
                    id: buttonNextMissionPhase
                    text: qsTr("Forward")
                    onClicked: wimaController.nextPhase();
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
                    Layout.fillWidth:   true
                }

                QGCButton {
                    id: buttonResetPhase
                    text: qsTr("Reset Phase")
                    onClicked: wimaController.resetPhase();
                    Layout.fillWidth:   true
                }

                QGCButton {
                    id: buttonUpload
                    text: qsTr("Upload")
                    onClicked: wimaController.uploadToVehicle();
                    Layout.fillWidth:   true
                }
149

150 151 152 153 154 155
                QGCButton {
                    id: buttonRemoveFromVehicle
                    text: qsTr("Remove")
                    onClicked: wimaController.removeFromVehicle();
                    Layout.fillWidth:   true
                }
156 157 158 159
            }
        }


160 161
    }
}