MeasurementItemEditor.qml 4.19 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import QtQuick          2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs  1.2
import QtQuick.Extras   1.4
import QtQuick.Layouts  1.2

import QGroundControl               1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.Controls      1.0
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0
import QGroundControl.FlightMap     1.0
16
import MeasurementComplexItem 1.0 as MCI
17 18 19

Rectangle {
    id:         _root
20
    height:     visible ? (mainColumn.height + (_margin * 2)) : 0
21 22 23 24 25 26 27 28 29 30 31 32 33
    width:      availableWidth
    color:      qgcPal.windowShadeDark
    radius:     _radius

    // The following properties must be available up the hierarchy chain
    //property real   availableWidth    ///< Width for control
    //property var    missionItem       ///< Mission Item for editor

    property real   _margin:                    ScreenTools.defaultFontPixelWidth / 2
    property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 10.5
    property var    _vehicle:                   QGroundControl.multiVehicleManager.activeVehicle ?
                                                    QGroundControl.multiVehicleManager.activeVehicle :
                                                    QGroundControl.multiVehicleManager.offlineEditingVehicle
34 35
    property var _missionItem: missionItem
    property var _areaData: missionItem.areaData
36 37 38

    QGCPalette { id: qgcPal; colorGroupEnabled: true }

39 40
    ColumnLayout { // main Column
        id:                 mainColumn
41 42 43 44 45 46
        anchors.margins:    _margin
        anchors.top:        parent.top
        anchors.left:       parent.left
        anchors.right:      parent.right


47 48 49 50 51 52 53 54
        QGCLabel {
            id: tipLabel
            Layout.fillWidth:       true
            wrapMode:               Text.WordWrap
            horizontalAlignment:    Text.AlignHCenter
            text:                   qsTr("Use the Area Editor to modify areas.")
            visible:                areaDataEditor.visible
        }
55

56 57 58 59 60 61 62 63 64 65 66 67 68
        GridLayout {
            id: editorSelector
            Layout.fillWidth: true
            columnSpacing:    _margin
            rowSpacing:       _margin

            QGCButton{
                text: "Open Area Editor"
                visible: parameterEditor.visible
                Layout.fillWidth: true
                Layout.columnSpan: 2
                onClicked:{
                    areaDataEditor.checked = true
69
                }
70
            }
71

72 73 74 75 76 77 78
            QGCButton{
                text: "Done"
                Layout.fillWidth: true
                visible: areaDataEditor.visible
                onClicked: {
                    if (_areaData.isCorrect()){
                        parameterEditor.checked = true
79
                    }
80 81
                }
            }
82

83 84 85 86 87 88 89 90 91
            QGCButton{
                text: "Abort"
                visible: areaDataEditor.visible
                Layout.fillWidth: true
                onClicked:{
                    missionItem.abortEditing()
                    parameterEditor.checked = true
                }
            }
Valentin Platzgummer's avatar
Valentin Platzgummer committed
92

93
        } // editorSelector
Valentin Platzgummer's avatar
Valentin Platzgummer committed
94

95
        ExclusiveGroup { id:editorGroup}
Valentin Platzgummer's avatar
Valentin Platzgummer committed
96

97 98
        MCI.ParameterEditor{
            id:parameterEditor
Valentin Platzgummer's avatar
Valentin Platzgummer committed
99

100 101 102
            missionItem: _root._missionItem
            availableWidth: mainColumn.width
            visible: checked
Valentin Platzgummer's avatar
Valentin Platzgummer committed
103

104
            property ExclusiveGroup group: editorGroup
105

106 107 108
            onGroupChanged: {
                if (group){
                    group.bindCheckable(parameterEditor)
109
                }
110
            }
111

112 113 114 115
            Component.onCompleted: {
                checked = false
            }
        }
116

117 118
        MCI.AreaDataEditor{
            id:areaDataEditor
119

120 121 122
            missionItem: _root._missionItem
            availableWidth: mainColumn.width
            visible: checked
123

124
            property ExclusiveGroup group: editorGroup
125

126 127 128
            onGroupChanged: {
                if (group){
                    group.bindCheckable(areaDataEditor)
129
                }
130
            }
131

132 133
            Component.onCompleted: {
                checked = true
134 135 136
            }
        }

137
    } // main Column
138
} // Rectangle