SyslinkComponent.qml 4.95 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/


Dennis Shtatnov's avatar
Dennis Shtatnov committed
11 12

import QtQuick          2.2
13 14 15 16
import QtQuick.Controls 1.2
import QtQuick.Dialogs  1.2
import QtQuick.Layouts  1.2

Dennis Shtatnov's avatar
Dennis Shtatnov committed
17 18
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
19 20 21 22
import QGroundControl.Controls      1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Controllers   1.0

Dennis Shtatnov's avatar
Dennis Shtatnov committed
23 24 25
SetupPage {
    id:             syslinkPage
    pageComponent:  pageComponent
26

Dennis Shtatnov's avatar
Dennis Shtatnov committed
27 28
    Component {
        id: pageComponent
29

Dennis Shtatnov's avatar
Dennis Shtatnov committed
30 31 32 33
        Column {
            id:         innerColumn
            width:      availableWidth
            spacing:    ScreenTools.defaultFontPixelHeight * 0.5
34

Dennis Shtatnov's avatar
Dennis Shtatnov committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
            property int textEditWidth:    ScreenTools.defaultFontPixelWidth * 12


            SyslinkComponentController {
                id:         controller
            }

            QGCLabel {
                text: qsTr("Radio Settings")
                font.family: ScreenTools.demiboldFontFamily
            }

            Rectangle {
                width:  parent.width
                height: radioGrid.height + ScreenTools.defaultFontPixelHeight
                color:  qgcPal.windowShade
51

Dennis Shtatnov's avatar
Dennis Shtatnov committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
                GridLayout {
                    id:                 radioGrid
                    anchors.margins:    ScreenTools.defaultFontPixelHeight / 2
                    anchors.left:       parent.left
                    anchors.top:        parent.top
                    columns:            2
                    columnSpacing:      ScreenTools.defaultFontPixelWidth

                    QGCLabel {
                        text:               qsTr("Channel")
                    }

                    QGCTextField {
                        id:                     channelField
                        width:                  textEditWidth
                        text:                   controller.radioChannel
                        validator:              IntValidator {bottom: 0; top: 125;}
                        inputMethodHints:       Qt.ImhDigitsOnly
                        onEditingFinished: {
                            controller.radioChannel = text
72 73 74
                        }
                    }

Dennis Shtatnov's avatar
Dennis Shtatnov committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 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 136
                    QGCLabel {
                        id:                 channelHelp
                        Layout.columnSpan:  radioGrid.columns
                        Layout.fillWidth:   true
                        font.pointSize:     ScreenTools.smallFontPointSize
                        wrapMode:           Text.WordWrap
                        text:               "Channel can be between 0 and 125"
                    }

                    QGCLabel {
                        id:                 addressLabel
                        text:               qsTr("Address")
                    }

                    QGCTextField {
                        id:                     addressField
                        width:                  textEditWidth
                        text:                   controller.radioAddress
                        maximumLength:          10
                        validator:              RegExpValidator { regExp: /^[0-9A-Fa-f]*$/ }
                        onEditingFinished: {
                            controller.radioAddress = text
                        }
                    }

                    QGCLabel {
                        id:                 addressHelp
                        Layout.columnSpan:  radioGrid.columns
                        Layout.fillWidth:   true
                        font.pointSize:     ScreenTools.smallFontPointSize
                        wrapMode:           Text.WordWrap
                        text:               "Address in hex. Default is E7E7E7E7E7."
                    }


                    QGCLabel {
                        id:                 rateLabel
                        text:               qsTr("Data Rate")
                    }

                    QGCComboBox {
                        id:                     rateField
                        Layout.fillWidth:       true
                        model:                  controller.radioRates
                        currentIndex:           controller.radioRate
                        onActivated: {
                            controller.radioRate = index
                        }
                    }

                    QGCButton {
                        text:                           "Restore Defaults"
                        width:                          textEditWidth
                        onClicked: {
                            controller.resetDefaults()
                        }
                    }

                } // Grid
            } // Rectangle - Radio Settings


137 138 139
        }
    }
}