15 changed files with 955 additions and 420 deletions
@ -0,0 +1,91 @@
@@ -0,0 +1,91 @@
|
||||
/*===================================================================== |
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> |
||||
|
||||
This file is part of the QGROUNDCONTROL project |
||||
|
||||
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
======================================================================*/ |
||||
|
||||
import QtQuick 2.5 |
||||
import QtQuick.Controls 1.4 |
||||
import QtQuick.Dialogs 1.1 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
|
||||
Item { |
||||
width: parent ? parent.width : 0 |
||||
height: logColumn.height |
||||
|
||||
function saveSettings() { |
||||
if(subEditConfig) { |
||||
subEditConfig.filename = logField.text |
||||
} |
||||
} |
||||
|
||||
Column { |
||||
id: logColumn |
||||
width: parent.width |
||||
spacing: ScreenTools.defaultFontPixelHeight / 2 |
||||
QGCLabel { |
||||
text: "Log Replay Link Settings" |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
Row { |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
QGCLabel { |
||||
text: "Log File:" |
||||
width: _firstColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCTextField { |
||||
id: logField |
||||
text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeLogReplay ? subEditConfig.fileName : "" |
||||
width: _secondColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCButton { |
||||
text: "Browse" |
||||
onClicked: { |
||||
fileDialog.visible = true |
||||
} |
||||
} |
||||
} |
||||
FileDialog { |
||||
id: fileDialog |
||||
title: "Please choose a file" |
||||
folder: shortcuts.home |
||||
visible: false |
||||
selectExisting: true |
||||
onAccepted: { |
||||
if(subEditConfig) { |
||||
subEditConfig.fileName = fileDialog.fileUrl.toString().replace("file://", "") |
||||
} |
||||
fileDialog.visible = false |
||||
} |
||||
onRejected: { |
||||
fileDialog.visible = false |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,128 @@
@@ -0,0 +1,128 @@
|
||||
/*===================================================================== |
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> |
||||
|
||||
This file is part of the QGROUNDCONTROL project |
||||
|
||||
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
======================================================================*/ |
||||
|
||||
import QtQuick 2.5 |
||||
import QtQuick.Controls 1.4 |
||||
import QtQuick.Layouts 1.2 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
|
||||
Item { |
||||
id: mockLinkSettings |
||||
width: parent ? parent.width : 0 |
||||
height: mockColumn.height |
||||
|
||||
function saveSettings() { |
||||
if(px4Firmware.checked) |
||||
subEditConfig.firmware = 12 |
||||
else if(apmFirmware.checked) |
||||
subEditConfig.firmware = 3 |
||||
else |
||||
subEditConfig.firmware = 0 |
||||
subEditConfig.sendStatus = sendStatus.checked |
||||
} |
||||
|
||||
Component.onCompleted: { |
||||
if(subEditConfig.firmware === 12) // Hardcoded MAV_AUTOPILOT_PX4 |
||||
px4Firmware.checked = true |
||||
else if(subEditConfig.firmware === 3) // Hardcoded MAV_AUTOPILOT_ARDUPILOTMEGA |
||||
apmFirmware.checked = true |
||||
else |
||||
genericFirmware.checked = true |
||||
if(subEditConfig.vehicle === 1) // Hardcoded MAV_TYPE_FIXED_WING |
||||
planeVehicle.checked = true |
||||
else |
||||
copterVehicle.checked = true |
||||
sendStatus.checked = subEditConfig.sendStatus |
||||
} |
||||
|
||||
Column { |
||||
id: mockColumn |
||||
width: mockLinkSettings.width |
||||
spacing: ScreenTools.defaultFontPixelHeight / 2 |
||||
QGCLabel { |
||||
text: "Mock Link Settings" |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
QGCCheckBox { |
||||
id: sendStatus |
||||
text: "Send Status Text and Voice" |
||||
checked: false |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
ColumnLayout { |
||||
ExclusiveGroup { id: autoPilotGroup } |
||||
QGCRadioButton { |
||||
id: px4Firmware |
||||
text: "PX4 Firmware" |
||||
checked: false |
||||
exclusiveGroup: autoPilotGroup |
||||
} |
||||
QGCRadioButton { |
||||
id: apmFirmware |
||||
text: "APM Firmware" |
||||
checked: false |
||||
exclusiveGroup: autoPilotGroup |
||||
} |
||||
QGCRadioButton { |
||||
id: genericFirmware |
||||
text: "Generic Firmware" |
||||
checked: false |
||||
exclusiveGroup: autoPilotGroup |
||||
} |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
QGCLabel { |
||||
text: "APM Vehicle Type" |
||||
visible: apmFirmware.checked |
||||
} |
||||
ColumnLayout { |
||||
visible: apmFirmware.checked |
||||
ExclusiveGroup { id: apmVehicleGroup } |
||||
QGCRadioButton { |
||||
id: copterVehicle |
||||
text: "ArduCopter" |
||||
checked: false |
||||
exclusiveGroup: apmVehicleGroup |
||||
} |
||||
QGCRadioButton { |
||||
id: planeVehicle |
||||
text: "ArduPlane" |
||||
checked: false |
||||
exclusiveGroup: apmVehicleGroup |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,246 @@
@@ -0,0 +1,246 @@
|
||||
/*===================================================================== |
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> |
||||
|
||||
This file is part of the QGROUNDCONTROL project |
||||
|
||||
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
======================================================================*/ |
||||
|
||||
import QtQuick 2.5 |
||||
import QtQuick.Controls 1.4 |
||||
import QtQuick.Dialogs 1.1 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
|
||||
Item { |
||||
id: serialLinkSettings |
||||
width: parent ? parent.width : 0 |
||||
height: serialColumn.height |
||||
|
||||
function saveSettings() { |
||||
// No Need |
||||
} |
||||
|
||||
Column { |
||||
id: serialColumn |
||||
width: serialLinkSettings.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) { |
||||
subEditConfig.portName = QGroundControl.linkManager.serialPorts[index] |
||||
} |
||||
} |
||||
Component.onCompleted: { |
||||
if(subEditConfig != null) { |
||||
if(subEditConfig.portDisplayName === "") |
||||
subEditConfig.portName = QGroundControl.linkManager.serialPorts[0] |
||||
var index = commPortCombo.find(subEditConfig.portDisplayName) |
||||
if (index === -1) { |
||||
console.warn("Serial Port not present", subEditConfig.portName) |
||||
} else { |
||||
commPortCombo.currentIndex = index |
||||
} |
||||
} else { |
||||
commPortCombo.currentIndex = 0 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
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) { |
||||
subEditConfig.baud = parseInt(QGroundControl.linkManager.serialBaudRates[index]) |
||||
} |
||||
} |
||||
Component.onCompleted: { |
||||
var baud = "57600" |
||||
if(subEditConfig != null) { |
||||
baud = subEditConfig.baud.toString() |
||||
} |
||||
var index = baudCombo.find(baud) |
||||
if (index === -1) { |
||||
console.warn("Baud rate name not in combo box", baud) |
||||
} else { |
||||
baudCombo.currentIndex = index |
||||
} |
||||
} |
||||
} |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
//----------------------------------------------------------------- |
||||
//-- Advanced Serial Settings |
||||
QGCCheckBox { |
||||
id: showAdvanced |
||||
text: "Show Advanced Serial Settings" |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
//-- Flow Control |
||||
QGCCheckBox { |
||||
text: "Enable Flow Control" |
||||
checked: subEditConfig ? subEditConfig.flowControl !== 0 : false |
||||
visible: showAdvanced.checked |
||||
onCheckedChanged: { |
||||
if(subEditConfig) { |
||||
subEditConfig.flowControl = checked ? 1 : 0 |
||||
} |
||||
} |
||||
} |
||||
//-- Parity |
||||
Row { |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
visible: showAdvanced.checked |
||||
QGCLabel { |
||||
text: "Parity:" |
||||
width: _firstColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCComboBox { |
||||
id: parityCombo |
||||
width: _firstColumn |
||||
model: ["None", "Even", "Odd"] |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
onActivated: { |
||||
if (index != -1) { |
||||
// Hard coded values from qserialport.h |
||||
if(index == 0) |
||||
subEditConfig.parity = 0 |
||||
else if(index == 1) |
||||
subEditConfig.parity = 2 |
||||
else |
||||
subEditConfig.parity = 3 |
||||
} |
||||
} |
||||
Component.onCompleted: { |
||||
var index = 0 |
||||
if(subEditConfig != null) { |
||||
index = subEditConfig.parity |
||||
} |
||||
if(index > 1) { |
||||
index = index - 2 |
||||
} |
||||
parityCombo.currentIndex = index |
||||
} |
||||
} |
||||
} |
||||
//-- Data Bits |
||||
Row { |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
visible: showAdvanced.checked |
||||
QGCLabel { |
||||
text: "Data Bits:" |
||||
width: _firstColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCComboBox { |
||||
id: dataCombo |
||||
width: _firstColumn |
||||
model: ["5", "6", "7", "8"] |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
onActivated: { |
||||
if (index != -1) { |
||||
subEditConfig.dataBits = index + 5 |
||||
} |
||||
} |
||||
Component.onCompleted: { |
||||
var index = 3 |
||||
if(subEditConfig != null) { |
||||
index = subEditConfig.parity - 5 |
||||
if(index < 0) |
||||
index = 3 |
||||
} |
||||
dataCombo.currentIndex = index |
||||
} |
||||
} |
||||
} |
||||
//-- Stop Bits |
||||
Row { |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
visible: showAdvanced.checked |
||||
QGCLabel { |
||||
text: "Stop Bits:" |
||||
width: _firstColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCComboBox { |
||||
id: stopCombo |
||||
width: _firstColumn |
||||
model: ["1", "2"] |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
onActivated: { |
||||
if (index != -1) { |
||||
subEditConfig.stopBits = index + 1 |
||||
} |
||||
} |
||||
Component.onCompleted: { |
||||
var index = 0 |
||||
if(subEditConfig != null) { |
||||
index = subEditConfig.stopBits - 1 |
||||
if(index < 0) |
||||
index = 0 |
||||
} |
||||
stopCombo.currentIndex = index |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
/*===================================================================== |
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> |
||||
|
||||
This file is part of the QGROUNDCONTROL project |
||||
|
||||
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
======================================================================*/ |
||||
|
||||
import QtQuick 2.5 |
||||
import QtQuick.Controls 1.4 |
||||
import QtQuick.Dialogs 1.1 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
|
||||
Item { |
||||
id: tcpLinkSettings |
||||
width: parent ? parent.width : 0 |
||||
height: tcpColumn.height |
||||
|
||||
function saveSettings() { |
||||
if(subEditConfig) { |
||||
subEditConfig.host = hostField.text |
||||
subEditConfig.port = parseInt(portField.text) |
||||
} |
||||
} |
||||
|
||||
Column { |
||||
id: tcpColumn |
||||
width: tcpLinkSettings.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: "Host Address:" |
||||
width: _firstColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCTextField { |
||||
id: hostField |
||||
text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeTcp ? subEditConfig.host : "" |
||||
width: _secondColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
} |
||||
Row { |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
QGCLabel { |
||||
text: "TCP Port:" |
||||
width: _firstColumn |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCTextField { |
||||
id: portField |
||||
text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeTcp ? subEditConfig.port.toString() : "" |
||||
width: _firstColumn |
||||
inputMethodHints: Qt.ImhFormattedNumbersOnly |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,192 @@
@@ -0,0 +1,192 @@
|
||||
/*===================================================================== |
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> |
||||
|
||||
This file is part of the QGROUNDCONTROL project |
||||
|
||||
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
======================================================================*/ |
||||
|
||||
import QtQuick 2.5 |
||||
import QtQuick.Controls 1.4 |
||||
import QtQuick.Dialogs 1.1 |
||||
|
||||
import QGroundControl 1.0 |
||||
import QGroundControl.Controls 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
import QGroundControl.Palette 1.0 |
||||
|
||||
Item { |
||||
id: _udpSetting |
||||
width: parent ? parent.width : 0 |
||||
height: udpColumn.height |
||||
|
||||
function saveSettings() { |
||||
// No need |
||||
} |
||||
|
||||
property var _currentHost: "" |
||||
|
||||
Column { |
||||
id: udpColumn |
||||
spacing: ScreenTools.defaultFontPixelHeight / 2 |
||||
|
||||
ExclusiveGroup { id: linkGroup } |
||||
|
||||
QGCPalette { |
||||
id: qgcPal |
||||
colorGroupEnabled: enabled |
||||
} |
||||
|
||||
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 |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
} |
||||
QGCTextField { |
||||
id: portField |
||||
text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeUdp ? subEditConfig.localPort.toString() : "" |
||||
focus: true |
||||
width: _firstColumn |
||||
inputMethodHints: Qt.ImhFormattedNumbersOnly |
||||
anchors.verticalCenter: parent.verticalCenter |
||||
onTextChanged: { |
||||
if(subEditConfig) { |
||||
subEditConfig.localPort = parseInt(portField.text) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
QGCLabel { |
||||
text: "Target Hosts:" |
||||
} |
||||
Item { |
||||
width: hostRow.width |
||||
height: hostRow.height |
||||
Row { |
||||
id: hostRow |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
Item { |
||||
height: 1 |
||||
width: _firstColumn |
||||
} |
||||
Column { |
||||
id: hostColumn |
||||
spacing: ScreenTools.defaultFontPixelHeight / 2 |
||||
Rectangle { |
||||
height: 1 |
||||
width: _secondColumn |
||||
color: qgcPal.button |
||||
visible: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeUdp && subEditConfig.hostList.length > 0 |
||||
} |
||||
Repeater { |
||||
model: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeUdp ? subEditConfig.hostList : "" |
||||
delegate: |
||||
QGCButton { |
||||
text: modelData |
||||
width: _secondColumn |
||||
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2 |
||||
exclusiveGroup: linkGroup |
||||
onClicked: { |
||||
checked = true |
||||
_udpSetting._currentHost = modelData |
||||
} |
||||
} |
||||
} |
||||
QGCTextField { |
||||
id: hostField |
||||
focus: true |
||||
visible: false |
||||
width: ScreenTools.defaultFontPixelWidth * 30 |
||||
onEditingFinished: { |
||||
if(subEditConfig) { |
||||
if(hostField.text !== "") { |
||||
subEditConfig.addHost(hostField.text) |
||||
hostField.text = "" |
||||
} |
||||
hostField.visible = false |
||||
} |
||||
} |
||||
Keys.onReleased: { |
||||
if (event.key === Qt.Key_Escape) { |
||||
hostField.text = "" |
||||
hostField.visible = false |
||||
} |
||||
} |
||||
} |
||||
Rectangle { |
||||
height: 1 |
||||
width: _secondColumn |
||||
color: qgcPal.button |
||||
} |
||||
Item { |
||||
height: ScreenTools.defaultFontPixelHeight / 2 |
||||
width: parent.width |
||||
} |
||||
Item { |
||||
width: _secondColumn |
||||
height: udpButtonRow.height |
||||
Row { |
||||
id: udpButtonRow |
||||
spacing: ScreenTools.defaultFontPixelWidth |
||||
anchors.horizontalCenter: parent.horizontalCenter |
||||
QGCButton { |
||||
width: ScreenTools.defaultFontPixelWidth * 10 |
||||
text: "Add" |
||||
onClicked: { |
||||
if(hostField.visible && hostField.text !== "") { |
||||
subEditConfig.addHost(hostField.text) |
||||
hostField.text = "" |
||||
hostField.visible = false |
||||
} else |
||||
hostField.visible = true |
||||
} |
||||
} |
||||
QGCButton { |
||||
width: ScreenTools.defaultFontPixelWidth * 10 |
||||
enabled: _udpSetting._currentHost && _udpSetting._currentHost !== "" |
||||
text: "Remove" |
||||
onClicked: { |
||||
subEditConfig.removeHost(_udpSetting._currentHost) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue