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

import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.Controls      1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0

// Editor for Simple mission items
Rectangle {
    id:                 valuesRect
    width:              availableWidth
17
    height:             deferedload.status == Loader.Ready ? (visible ? deferedload.item.height : 0) : 0
18 19 20 21
    color:              qgcPal.windowShadeDark
    visible:            missionItem.isCurrentItem
    radius:             _radius

22 23 24 25 26 27 28 29
    Loader {
        id:              deferedload
        active:          valuesRect.visible
        asynchronous:    true
        anchors.margins: _margin
        anchors.left:    valuesRect.left
        anchors.right:   valuesRect.right
        anchors.top:     valuesRect.top
30

31 32 33 34 35 36 37 38 39 40 41
        sourceComponent: Component {
            Item {
                id:                 valuesItem
                height:             valuesColumn.height + (_margin * 2)

                Column {
                    id:             valuesColumn
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    anchors.top:    parent.top
                    spacing:        _margin
42 43

                    QGCLabel {
44 45 46
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
47 48 49
                        text:           missionItem.rawEdit ?
                                            qsTr("Provides advanced access to all commands/parameters. Be very careful!") :
                                            missionItem.commandDescription
50 51
                    }

52 53 54 55
                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columns:        2
56

57 58
                        Repeater {
                            model: missionItem.comboboxFacts
59 60

                            QGCLabel {
61 62 63 64
                                text:           object.name
                                visible:        object.name != ""
                                Layout.column:  0
                                Layout.row:     index
65
                            }
66 67 68 69
                        }

                        Repeater {
                            model: missionItem.comboboxFacts
70 71

                            FactComboBox {
72 73 74 75 76 77
                                indexModel:         false
                                model:              object.enumStrings
                                fact:               object
                                Layout.column:      1
                                Layout.row:         index
                                Layout.fillWidth:   true
78 79
                            }
                        }
80 81
                    }

82 83 84 85
                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columns:        2
86

87 88
                        Repeater {
                            model: missionItem.textFieldFacts
89 90

                            QGCLabel {
91 92 93
                                text:           object.name
                                Layout.column:  0
                                Layout.row:     index
94
                            }
95
                        }
96

97 98
                        Repeater {
                            model: missionItem.textFieldFacts
99

100 101
                            FactTextField {
                                showUnits:          true
102
                                fact:               object
103 104 105
                                Layout.column:      1
                                Layout.row:         index
                                Layout.fillWidth:   true
106 107
                            }
                        }
108 109
                    }

110 111 112 113 114 115 116 117 118 119 120 121
                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columns:        2

                        Repeater {
                            model: missionItem.nanFacts

                            QGCCheckBox {
                                text:           object.name
                                Layout.column:  0
                                Layout.row:     index
Don Gagne's avatar
Don Gagne committed
122 123
                                checked:        !isNaN(object.rawValue)
                                onClicked:      object.rawValue = checked ? 0 : NaN
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
                            }
                        }

                        Repeater {
                            model: missionItem.nanFacts

                            FactTextField {
                                showUnits:          true
                                fact:               object
                                Layout.column:      1
                                Layout.row:         index
                                Layout.fillWidth:   true
                                enabled:            !isNaN(object.rawValue)
                            }
                        }
                    }

141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
                    RowLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        ScreenTools.defaultFontPixelWidth
                        visible:        missionItem.speedSection.available

                        QGCCheckBox {
                            id:         flightSpeedCheckbox
                            text:       qsTr("Flight Speed")
                            checked:    missionItem.speedSection.specifyFlightSpeed
                            onClicked:  missionItem.speedSection.specifyFlightSpeed = checked
                        }

                        FactTextField {
                            fact:               missionItem.speedSection.flightSpeed
                            Layout.fillWidth:   true
                            enabled:            flightSpeedCheckbox.checked
                        }
                    }

161 162 163 164 165 166 167
                    Repeater {
                        model: missionItem.checkboxFacts

                        FactCheckBox {
                            text:   object.name
                            fact:   object
                        }
168
                    }
169 170 171 172 173

                    CameraSection {
                        checked:    missionItem.cameraSection.settingsSpecified
                        visible:    missionItem.cameraSection.available
                    }
174 175 176 177
                } // Column
            } // Item
        } // Component
    } // Loader
178
} // Rectangle