@ -21,10 +21,8 @@
@@ -21,10 +21,8 @@
=== === === === === === === === === === === === === === === === === === === === === === === = * /
import QtQuick 2.5
import QtQuick . Controls 1.2
import QtQuick . Controls . Styles 1.2
import QtQuick . Dialogs 1.1
import QtQuick 2.5
import QtQuick . Controls 1.4
import QGroundControl 1.0
import QGroundControl . Controls 1.0
@ -32,10 +30,14 @@ import QGroundControl.ScreenTools 1.0
@@ -32,10 +30,14 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl . Palette 1.0
Rectangle {
id: _linkRoot
color: __qgcPal . window
id: _linkRoot
color: __qgcPal . window
anchors.fill: parent
anchors.margins: ScreenTools . defaultFontPixelWidth
property var _currentSelection : null
property int _firstColumn : ScreenTools . defaultFontPixelWidth * 12
property int _secondColumn : ScreenTools . defaultFontPixelWidth * 30
ExclusiveGroup { id: linkGroup }
@ -44,12 +46,22 @@ Rectangle {
@@ -44,12 +46,22 @@ Rectangle {
colorGroupEnabled: enabled
}
function openCommSettings ( lconf ) {
settingLoader . linkConfig = lconf
settingLoader . sourceComponent = commSettings
settingLoader . visible = true
}
function closeCommSettings ( ) {
settingLoader . visible = false
settingLoader . sourceComponent = null
}
Flickable {
clip: true
anchors.top: parent . top
width: parent . width
height: parent . height - buttonRow . height
anchors.margins: ScreenTools . defaultFontPixelWidth
contentHeight: settingsColumn . height
contentWidth: _linkRoot . width
flickableDirection: Flickable . VerticalFlick
@ -60,14 +72,14 @@ Rectangle {
@@ -60,14 +72,14 @@ Rectangle {
width: _linkRoot . width
anchors.margins: ScreenTools . defaultFontPixelWidth
spacing: ScreenTools . defaultFontPixelHeight / 2
Item {
height: ScreenTools . defaultFontPixelHeight / 2
width: parent . width
}
QGCLabel {
text: "WIP: Not fully functional"
color: __qgcPal . warningText
anchors.horizontalCenter: parent . horizontalCenter
text: "Comm Link Settings (WIP)"
font.pixelSize: ScreenTools . mediumFontPixelSize
}
Rectangle {
height: 1
width: parent . width
color: qgcPal . button
}
Item {
height: ScreenTools . defaultFontPixelHeight / 2
@ -99,22 +111,23 @@ Rectangle {
@@ -99,22 +111,23 @@ Rectangle {
QGCButton {
width: ScreenTools . defaultFontPixelWidth * 10
text: "Delete"
enabled: false
enabled: _currentSelection && ! _currentSelection . link
onClicked: {
}
}
QGCButton {
width: ScreenTools . defaultFontPixelWidth * 10
text: "Edit"
enabled: false
enabled: _currentSelection && ! _currentSelection . link
onClicked: {
_linkRoot . openCommSettings ( _currentSelection )
}
}
QGCButton {
width: ScreenTools . defaultFontPixelWidth * 10
text: "Add"
enabled: false
onClicked: {
_linkRoot . openCommSettings ( null )
}
}
QGCButton {
@ -135,4 +148,338 @@ Rectangle {
@@ -135,4 +148,338 @@ Rectangle {
}
}
}
Loader {
id: settingLoader
anchors.fill: parent
visible: false
property var linkConfig: null
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / C o m m S e t t i n g s
Component {
id: commSettings
Rectangle {
color: __qgcPal . window
anchors.fill: parent
Flickable {
clip: true
anchors.top: parent . top
width: parent . width
height: parent . height - commButtonRow . height
anchors.margins: ScreenTools . defaultFontPixelWidth
contentHeight: commSettingsColumn . height
contentWidth: _linkRoot . width
flickableDirection: Flickable . VerticalFlick
boundsBehavior: Flickable . StopAtBounds
Column {
id: commSettingsColumn
width: _linkRoot . width
anchors.margins: ScreenTools . defaultFontPixelWidth
spacing: ScreenTools . defaultFontPixelHeight / 2
QGCLabel {
text: linkConfig ? "Edit Link Configuration Settings (WIP)" : "Create New Link Configuration (WIP)"
font.pixelSize: ScreenTools . mediumFontPixelSize
}
Rectangle {
height: 1
width: parent . width
color: qgcPal . button
}
Item {
height: ScreenTools . defaultFontPixelHeight / 2
width: parent . width
}
Row {
spacing: ScreenTools . defaultFontPixelWidth
QGCLabel {
text: "Name:"
width: _firstColumn
anchors.verticalCenter: parent . verticalCenter
}
QGCTextField {
text: linkConfig ? linkConfig.name : "Untitled"
width: _secondColumn
anchors.verticalCenter: parent . verticalCenter
}
}
Row {
spacing: ScreenTools . defaultFontPixelWidth
QGCLabel {
text: "Type:"
width: _firstColumn
anchors.verticalCenter: parent . verticalCenter
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / W h e n e d i t i n g , y o u c a n ' t c h a n g e t h e l i n k t y p e
QGCLabel {
text: linkConfig ? QGroundControl . linkManager . linkTypeStrings [ linkConfig . linkType ] : ""
visible: linkConfig != null
width: _secondColumn
anchors.verticalCenter: parent . verticalCenter
Component.onCompleted: {
if ( linkConfig != null ) {
if ( linkConfig . linkType === LinkConfiguration . TypeSerial )
linkSettingLoader . sourceComponent = serialLinkSettings
linkSettingLoader . visible = true
}
}
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / W h e n c r e a t i n g , s e l e c t a l i n k t y p e
QGCComboBox {
id: linkTypeCombo
width: _secondColumn
visible: linkConfig == null
model: QGroundControl . linkManager . linkTypeStrings
anchors.verticalCenter: parent . verticalCenter
onActivated: {
if ( index != - 1 ) {
linkSettingLoader . sourceComponent = null
if ( index === LinkConfiguration . TypeSerial )
linkSettingLoader . sourceComponent = serialLinkSettings
if ( index === LinkConfiguration . TypeUdp )
linkSettingLoader . sourceComponent = udpLinkSettings
if ( index === LinkConfiguration . TypeTcp )
linkSettingLoader . sourceComponent = tcpLinkSettings
if ( index === LinkConfiguration . TypeMock )
linkSettingLoader . sourceComponent = mockLinkSettings
if ( index === LinkConfiguration . TypeLogReplay )
linkSettingLoader . sourceComponent = logLinkSettings
}
}
Component.onCompleted: {
if ( linkConfig == null ) {
linkTypeCombo . currentIndex = 0
linkSettingLoader . sourceComponent = serialLinkSettings
linkSettingLoader . visible = true
}
}
}
}
Item {
height: ScreenTools . defaultFontPixelHeight
width: parent . width
}
Loader {
id: linkSettingLoader
width: parent . width
visible: false
property var config: linkConfig
}
}
}
Row {
id: commButtonRow
spacing: ScreenTools . defaultFontPixelWidth
anchors.margins: ScreenTools . defaultFontPixelWidth
anchors.bottom: parent . bottom
anchors.horizontalCenter: parent . horizontalCenter
QGCButton {
width: ScreenTools . defaultFontPixelWidth * 10
text: "OK"
onClicked: {
_linkRoot . closeCommSettings ( )
}
}
QGCButton {
width: ScreenTools . defaultFontPixelWidth * 10
text: "Cancel"
onClicked: {
_linkRoot . closeCommSettings ( )
}
}
}
}
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / S e r i a l L i n k S e t t i n g s
Component {
id: serialLinkSettings
Column {
width: parent . width
spacing: ScreenTools . defaultFontPixelHeight / 2
QGCLabel {
id: serialLabel
text: "Serial Link Settings"
}
Rectangle {
height: 1
width: serialLabel . width
color: qgcPal . button
}
Item {
height: ScreenTools . defaultFontPixelHeight / 2
width: parent . width
}
Row {
spacing: ScreenTools . defaultFontPixelWidth
QGCLabel {
text: "Serial Port:"
width: _firstColumn
anchors.verticalCenter: parent . verticalCenter
}
QGCComboBox {
id: commPortCombo
width: _secondColumn
model: QGroundControl . linkManager . serialPortStrings
anchors.verticalCenter: parent . verticalCenter
onActivated: {
if ( index != - 1 ) {
}
}
Component.onCompleted: {
if ( config != null ) {
}
}
}
}
Row {
spacing: ScreenTools . defaultFontPixelWidth
QGCLabel {
text: "Baud Rate:"
width: _firstColumn
anchors.verticalCenter: parent . verticalCenter
}
QGCComboBox {
id: baudCombo
width: _secondColumn
model: QGroundControl . linkManager . serialBaudRates
anchors.verticalCenter: parent . verticalCenter
onActivated: {
if ( index != - 1 ) {
}
}
Component.onCompleted: {
var baud = "57600"
if ( config != null ) {
/ / G e t b a u d f r o m c o n f i g
}
var index = baudCombo . find ( baud )
if ( index == - 1 ) {
console . warn ( "Baud rate name not in combo box" , baud )
} else {
baudCombo . currentIndex = index
}
}
}
}
}
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / U D P L i n k S e t t i n g s
Component {
id: udpLinkSettings
Column {
width: parent . width
spacing: ScreenTools . defaultFontPixelHeight / 2
QGCLabel {
id: udpLabel
text: "UDP Link Settings"
}
Rectangle {
height: 1
width: udpLabel . width
color: qgcPal . button
}
Item {
height: ScreenTools . defaultFontPixelHeight / 2
width: parent . width
}
Row {
spacing: ScreenTools . defaultFontPixelWidth
QGCLabel {
text: "Listening Port:"
width: _firstColumn
}
QGCLabel {
text: "14550"
width: _secondColumn
}
}
QGCLabel {
text: "Target Hosts:"
}
}
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / T C P L i n k S e t t i n g s
Component {
id: tcpLinkSettings
Column {
width: parent . width
spacing: ScreenTools . defaultFontPixelHeight / 2
QGCLabel {
id: tcpLabel
text: "TCP Link Settings"
}
Rectangle {
height: 1
width: tcpLabel . width
color: qgcPal . button
}
Item {
height: ScreenTools . defaultFontPixelHeight / 2
width: parent . width
}
Row {
spacing: ScreenTools . defaultFontPixelWidth
QGCLabel {
text: "TCP Port:"
width: _firstColumn
}
QGCLabel {
text: "5760"
width: _secondColumn
}
}
Row {
spacing: ScreenTools . defaultFontPixelWidth
QGCLabel {
text: "Host Address:"
width: _firstColumn
}
QGCLabel {
text: "0.0.0.0"
width: _secondColumn
}
}
}
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / L o g R e p l a y S e t t i n g s
Component {
id: logLinkSettings
Column {
width: parent . width
spacing: ScreenTools . defaultFontPixelHeight / 2
QGCLabel {
text: "Log Replay Link Settings"
}
Item {
height: ScreenTools . defaultFontPixelHeight / 2
width: parent . width
}
QGCButton {
text: "Select Log File"
}
}
}
/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ / M o c k L i n k S e t t i n g s
Component {
id: mockLinkSettings
Column {
width: parent . width
spacing: ScreenTools . defaultFontPixelHeight / 2
QGCLabel {
text: "Mock Link Settings"
}
Item {
height: ScreenTools . defaultFontPixelHeight / 2
width: parent . width
}
}
}
}