SimpleItemEditor.qml 6.19 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
                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
DonLakeFlyer's avatar
DonLakeFlyer committed
85 86
                        flow:           GridLayout.TopToBottom
                        rows:           missionItem.textFieldFacts.count + missionItem.nanFacts.count + (missionItem.speedSection.available ? 1 : 0)
87
                        columns:        2
88

89 90
                        Repeater {
                            model: missionItem.textFieldFacts
91

DonLakeFlyer's avatar
DonLakeFlyer committed
92 93 94 95 96 97 98
                            QGCLabel { text: object.name }
                        }

                        Repeater {
                            model: missionItem.nanFacts

                            QGCCheckBox {
99
                                text:           object.name
DonLakeFlyer's avatar
DonLakeFlyer committed
100 101
                                checked:        !isNaN(object.rawValue)
                                onClicked:      object.rawValue = checked ? 0 : NaN
102
                            }
103
                        }
104

DonLakeFlyer's avatar
DonLakeFlyer committed
105 106 107 108 109 110 111 112
                        QGCCheckBox {
                            id:         flightSpeedCheckbox
                            text:       qsTr("Flight Speed")
                            checked:    missionItem.speedSection.specifyFlightSpeed
                            onClicked:  missionItem.speedSection.specifyFlightSpeed = checked
                            visible:    missionItem.speedSection.available
                        }

113 114
                        Repeater {
                            model: missionItem.textFieldFacts
115

116 117
                            FactTextField {
                                showUnits:          true
118
                                fact:               object
119
                                Layout.fillWidth:   true
120 121
                            }
                        }
122 123 124 125 126 127 128 129 130 131 132

                        Repeater {
                            model: missionItem.nanFacts

                            FactTextField {
                                showUnits:          true
                                fact:               object
                                Layout.fillWidth:   true
                                enabled:            !isNaN(object.rawValue)
                            }
                        }
133 134 135 136 137

                        FactTextField {
                            fact:               missionItem.speedSection.flightSpeed
                            Layout.fillWidth:   true
                            enabled:            flightSpeedCheckbox.checked
DonLakeFlyer's avatar
DonLakeFlyer committed
138
                            visible:            missionItem.speedSection.available
139 140 141
                        }
                    }

142 143 144 145 146 147 148
                    Repeater {
                        model: missionItem.checkboxFacts

                        FactCheckBox {
                            text:   object.name
                            fact:   object
                        }
149
                    }
150 151 152 153 154

                    CameraSection {
                        checked:    missionItem.cameraSection.settingsSpecified
                        visible:    missionItem.cameraSection.available
                    }
155 156 157 158
                } // Column
            } // Item
        } // Component
    } // Loader
159
} // Rectangle