diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 75d4c3f56759d0300a91c688e71ae10c99765e08..67184e8e44e1a186c9a88a06595eae798705950d 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -11,22 +11,28 @@
src/AutoPilotPlugins/APM/APMAirframeComponent.qml
src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml
src/ViewWidgets/CustomCommandWidget.qml
- src/ui/preferences/DebugWindow.qml
src/VehicleSetup/FirmwareUpgrade.qml
src/FlightDisplay/FlightDisplayView.qml
src/AutoPilotPlugins/PX4/FlightModesComponent.qml
src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml
+
+ src/ui/preferences/DebugWindow.qml
src/ui/preferences/GeneralSettings.qml
src/ui/preferences/LinkSettings.qml
+ src/ui/preferences/LogReplaySettings.qml
+ src/ui/preferences/MavlinkSettings.qml
+ src/ui/preferences/MockLink.qml
+ src/ui/preferences/MockLinkSettings.qml
+ src/ui/preferences/SerialSettings.qml
+ src/ui/preferences/TcpSettings.qml
src/ui/preferences/UdpSettings.qml
+
src/VehicleSetup/JoystickConfig.qml
src/ui/toolbar/MainToolBar.qml
src/ui/MainWindow.qml
src/ui/MainWindowLeftPanel.qml
- src/ui/preferences/MavlinkSettings.qml
src/MissionEditor/MissionEditor.qml
src/MissionEditor/MissionEditorHelp.qml
- src/ui/preferences/MockLink.qml
src/AutoPilotPlugins/PX4/PowerComponent.qml
src/AutoPilotPlugins/PX4/PowerComponentSummary.qml
src/VehicleSetup/PX4FlowSensor.qml
diff --git a/src/comm/LinkConfiguration.h b/src/comm/LinkConfiguration.h
index f2f6aaee13783559a00efc5eca790666ef8ee5c1..ec277560139716101b32b749def235e091cd7577 100644
--- a/src/comm/LinkConfiguration.h
+++ b/src/comm/LinkConfiguration.h
@@ -42,10 +42,11 @@ public:
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(LinkInterface* link READ link WRITE setLink NOTIFY linkChanged)
- Q_PROPERTY(LinkType linkType READ type CONSTANT)
+ Q_PROPERTY(LinkType linkType READ type CONSTANT)
Q_PROPERTY(bool dynamic READ isDynamic WRITE setDynamic NOTIFY dynamicChanged)
Q_PROPERTY(bool autoConnect READ isAutoConnect WRITE setAutoConnect NOTIFY autoConnectChanged)
Q_PROPERTY(bool autoConnectAllowed READ isAutoConnectAllowed CONSTANT)
+ Q_PROPERTY(QString settingsURL READ settingsURL CONSTANT)
// Property accessors
@@ -132,6 +133,13 @@ public:
*/
virtual void saveSettings(QSettings& settings, const QString& root) = 0;
+ /*!
+ * @brief Settings URL
+ *
+ * Pure virtual method providing the URL for the (QML) settings dialog
+ */
+ virtual QString settingsURL() = 0;
+
/*!
* @brief Update settings
*
diff --git a/src/comm/LogReplayLink.h b/src/comm/LogReplayLink.h
index e586e25d4a7d02bcefb6f3ae4b9de1faa306b180..deb62f3a8026e1f5a5f771dc83a8b0891542d453 100644
--- a/src/comm/LogReplayLink.h
+++ b/src/comm/LogReplayLink.h
@@ -43,7 +43,7 @@ public:
LogReplayLinkConfiguration(LogReplayLinkConfiguration* copy);
QString logFilename(void) { return _logFilename; }
- void setLogFilename(const QString& logFilename) { _logFilename = logFilename; emit fileNameChanged(); }
+ void setLogFilename(const QString logFilename) { _logFilename = logFilename; emit fileNameChanged(); }
QString logFilenameShort(void);
@@ -54,6 +54,7 @@ public:
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed () { return false; }
+ QString settingsURL () { return "LogReplaySettings.qml"; }
signals:
void fileNameChanged();
diff --git a/src/comm/MockLink.h b/src/comm/MockLink.h
index ae0a02e0fd37cab7f4b425d71b25e01fc35434c9..f14b9c85193b11695a527120615c72c578d81f3e 100644
--- a/src/comm/MockLink.h
+++ b/src/comm/MockLink.h
@@ -40,25 +40,42 @@ class MockConfiguration : public LinkConfiguration
Q_OBJECT
public:
+
+ Q_PROPERTY(int firmware READ firmware WRITE setFirmware NOTIFY firmwareChanged)
+ Q_PROPERTY(int vehicle READ vehicle WRITE setVehicle NOTIFY vehicleChanged)
+ Q_PROPERTY(bool sendStatus READ sendStatusText WRITE setSendStatusText NOTIFY sendStatusChanged)
+
+ // QML Access
+ int firmware () { return (int)_firmwareType; }
+ void setFirmware (int type) { _firmwareType = (MAV_AUTOPILOT)type; emit firmwareChanged(); }
+ int vehicle () { return (int)_vehicleType; }
+ void setVehicle (int type) { _vehicleType = (MAV_TYPE)type; emit vehicleChanged(); }
+
MockConfiguration(const QString& name);
MockConfiguration(MockConfiguration* source);
MAV_AUTOPILOT firmwareType(void) { return _firmwareType; }
- void setFirmwareType(MAV_AUTOPILOT firmwareType) { _firmwareType = firmwareType; }
+ void setFirmwareType(MAV_AUTOPILOT firmwareType) { _firmwareType = firmwareType; emit firmwareChanged(); }
MAV_TYPE vehicleType(void) { return _vehicleType; }
- void setVehicleType(MAV_TYPE vehicleType) { _vehicleType = vehicleType; }
+ void setVehicleType(MAV_TYPE vehicleType) { _vehicleType = vehicleType; emit vehicleChanged(); }
/// @param sendStatusText true: mavlink status text messages will be sent for each severity, as well as voice output info message
- void setSendStatusText(bool sendStatusText) { _sendStatusText = sendStatusText; }
bool sendStatusText(void) { return _sendStatusText; }
+ void setSendStatusText(bool sendStatusText) { _sendStatusText = sendStatusText; emit sendStatusChanged(); }
// Overrides from LinkConfiguration
- LinkType type(void) { return LinkConfiguration::TypeMock; }
- void copyFrom(LinkConfiguration* source);
- void loadSettings(QSettings& settings, const QString& root);
- void saveSettings(QSettings& settings, const QString& root);
- void updateSettings(void);
+ LinkType type (void) { return LinkConfiguration::TypeMock; }
+ void copyFrom (LinkConfiguration* source);
+ void loadSettings (QSettings& settings, const QString& root);
+ void saveSettings (QSettings& settings, const QString& root);
+ void updateSettings (void);
+ QString settingsURL () { return "MockLinkSettings.qml"; }
+
+signals:
+ void firmwareChanged ();
+ void vehicleChanged ();
+ void sendStatusChanged ();
private:
MAV_AUTOPILOT _firmwareType;
diff --git a/src/comm/SerialLink.h b/src/comm/SerialLink.h
index dadc4f73a8742a664729a32bb9816f90c99c190a..12b360103768058aa0a32a660fdc8cbbf403ba11 100644
--- a/src/comm/SerialLink.h
+++ b/src/comm/SerialLink.h
@@ -94,11 +94,12 @@ public:
static QString cleanPortDisplayname(const QString name);
/// From LinkConfiguration
- LinkType type() { return LinkConfiguration::TypeSerial; }
- void copyFrom(LinkConfiguration* source);
- void loadSettings(QSettings& settings, const QString& root);
- void saveSettings(QSettings& settings, const QString& root);
- void updateSettings();
+ LinkType type () { return LinkConfiguration::TypeSerial; }
+ void copyFrom (LinkConfiguration* source);
+ void loadSettings (QSettings& settings, const QString& root);
+ void saveSettings (QSettings& settings, const QString& root);
+ void updateSettings ();
+ QString settingsURL () { return "SerialSettings.qml"; }
signals:
void baudChanged ();
diff --git a/src/comm/TCPLink.cc b/src/comm/TCPLink.cc
index a7acc341598690eeb7c66e7ae9e19f0ec552150a..a0c315e1c7c5b4cdc1946ef5eda85df0afb63ba2 100644
--- a/src/comm/TCPLink.cc
+++ b/src/comm/TCPLink.cc
@@ -237,6 +237,39 @@ void TCPLink::_restartConnection()
//--------------------------------------------------------------------------
//-- TCPConfiguration
+static bool is_ip(const QString& address)
+{
+ int a,b,c,d;
+ if (sscanf(address.toStdString().c_str(), "%d.%d.%d.%d", &a, &b, &c, &d) != 4
+ && strcmp("::1", address.toStdString().c_str())) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+static QString get_ip_address(const QString& address)
+{
+ if(is_ip(address))
+ return address;
+ // Need to look it up
+ QHostInfo info = QHostInfo::fromName(address);
+ if (info.error() == QHostInfo::NoError)
+ {
+ QList hostAddresses = info.addresses();
+ QHostAddress address;
+ for (int i = 0; i < hostAddresses.size(); i++)
+ {
+ // Exclude all IPv6 addresses
+ if (!hostAddresses.at(i).toString().contains(":"))
+ {
+ return hostAddresses.at(i).toString();
+ }
+ }
+ }
+ return QString("");
+}
+
TCPConfiguration::TCPConfiguration(const QString& name) : LinkConfiguration(name)
{
_port = QGC_TCP_PORT;
@@ -270,7 +303,12 @@ void TCPConfiguration::setAddress(const QHostAddress& address)
void TCPConfiguration::setHost(const QString host)
{
- _address = host;
+ QString ipAdd = get_ip_address(host);
+ if(ipAdd.isEmpty()) {
+ qWarning() << "TCP:" << "Could not resolve host:" << host;
+ } else {
+ _address = ipAdd;
+ }
}
void TCPConfiguration::saveSettings(QSettings& settings, const QString& root)
diff --git a/src/comm/TCPLink.h b/src/comm/TCPLink.h
index 2771824fc0aaeb1ad10e652e902d24df86ab8aa2..ff9ac78d4a19da077e54b8fda3c312954a39e1b6 100644
--- a/src/comm/TCPLink.h
+++ b/src/comm/TCPLink.h
@@ -108,11 +108,12 @@ public:
void setHost (const QString host);
/// From LinkConfiguration
- LinkType type() { return LinkConfiguration::TypeTcp; }
- void copyFrom(LinkConfiguration* source);
- void loadSettings(QSettings& settings, const QString& root);
- void saveSettings(QSettings& settings, const QString& root);
- void updateSettings();
+ LinkType type () { return LinkConfiguration::TypeTcp; }
+ void copyFrom (LinkConfiguration* source);
+ void loadSettings (QSettings& settings, const QString& root);
+ void saveSettings (QSettings& settings, const QString& root);
+ void updateSettings ();
+ QString settingsURL () { return "TcpSettings.qml"; }
signals:
void portChanged();
diff --git a/src/comm/UDPLink.h b/src/comm/UDPLink.h
index 9065eaf8f4ee5e7753d72ea3ff90148c49dfabe6..e354d1ad02a07c5ec54f17c09672d01fbd81612e 100644
--- a/src/comm/UDPLink.h
+++ b/src/comm/UDPLink.h
@@ -144,11 +144,12 @@ public:
QStringList hostList () { return _hostList; }
/// From LinkConfiguration
- LinkType type() { return LinkConfiguration::TypeUdp; }
- void copyFrom(LinkConfiguration* source);
- void loadSettings(QSettings& settings, const QString& root);
- void saveSettings(QSettings& settings, const QString& root);
- void updateSettings();
+ LinkType type () { return LinkConfiguration::TypeUdp; }
+ void copyFrom (LinkConfiguration* source);
+ void loadSettings (QSettings& settings, const QString& root);
+ void saveSettings (QSettings& settings, const QString& root);
+ void updateSettings ();
+ QString settingsURL () { return "UdpSettings.qml"; }
signals:
void localPortChanged ();
diff --git a/src/ui/preferences/LinkSettings.qml b/src/ui/preferences/LinkSettings.qml
index 25a71a56db78ba64d0e7b4e4ff76c3fec8ea9b14..6e386e4da74ade9c196f51100d3e285f19f5a935 100644
--- a/src/ui/preferences/LinkSettings.qml
+++ b/src/ui/preferences/LinkSettings.qml
@@ -259,17 +259,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: {
if(linkConfig != null) {
- var index = linkConfig.linkType
- if(index === LinkConfiguration.TypeSerial)
- linkSettingLoader.sourceComponent = serialLinkSettings
- if(index === LinkConfiguration.TypeUdp)
- linkSettingLoader.source = "UdpSettings.qml"
- if(index === LinkConfiguration.TypeTcp)
- linkSettingLoader.sourceComponent = tcpLinkSettings
- if(index === LinkConfiguration.TypeMock)
- linkSettingLoader.sourceComponent = mockLinkSettings
- if(index === LinkConfiguration.TypeLogReplay)
- linkSettingLoader.sourceComponent = logLinkSettings
+ linkSettingLoader.source = linkConfig.settingsURL
linkSettingLoader.visible = true
}
}
@@ -285,7 +275,6 @@ Rectangle {
onActivated: {
if (index != -1 && index !== editConfig.linkType) {
// Destroy current panel
- linkSettingLoader.sourceComponent = null
linkSettingLoader.source = ""
linkSettingLoader.visible = false
// Save current name
@@ -295,34 +284,15 @@ Rectangle {
// Create new link configuration
editConfig = QGroundControl.linkManager.createConfiguration(index, name)
// Load appropriate configuration panel
- if(index === LinkConfiguration.TypeSerial)
- linkSettingLoader.sourceComponent = serialLinkSettings
- if(index === LinkConfiguration.TypeUdp)
- linkSettingLoader.source = "UdpSettings.qml"
- if(index === LinkConfiguration.TypeTcp)
- linkSettingLoader.sourceComponent = tcpLinkSettings
- if(index === LinkConfiguration.TypeMock)
- linkSettingLoader.sourceComponent = mockLinkSettings
- if(index === LinkConfiguration.TypeLogReplay)
- linkSettingLoader.sourceComponent = logLinkSettings
+ linkSettingLoader.source = editConfig.settingsURL
linkSettingLoader.visible = true
}
}
Component.onCompleted: {
if(linkConfig == null) {
linkTypeCombo.currentIndex = 0
- var index = editConfig.linkType
- if(index === LinkConfiguration.TypeSerial)
- linkSettingLoader.sourceComponent = serialLinkSettings
- if(index === LinkConfiguration.TypeUdp)
- linkSettingLoader.source = "UdpSettings.qml"
- if(index === LinkConfiguration.TypeTcp)
- linkSettingLoader.sourceComponent = tcpLinkSettings
- if(index === LinkConfiguration.TypeMock)
- linkSettingLoader.sourceComponent = mockLinkSettings
- if(index === LinkConfiguration.TypeLogReplay)
- linkSettingLoader.sourceComponent = logLinkSettings
- linkSettingLoader.visible = true
+ linkSettingLoader.source = editConfig.settingsURL
+ linkSettingLoader.visible = true
}
}
}
@@ -370,6 +340,7 @@ Rectangle {
enabled: nameField.text !== ""
onClicked: {
// Save editting
+ linkSettingLoader.item.saveSettings()
editConfig.name = nameField.text
if(linkConfig) {
QGroundControl.linkManager.endConfigurationEditing(linkConfig, editConfig)
@@ -378,6 +349,7 @@ Rectangle {
editConfig.dynamic = false
QGroundControl.linkManager.endCreateConfiguration(editConfig)
}
+ linkSettingLoader.source = ""
editConfig = null
_linkRoot.closeCommSettings()
}
@@ -394,346 +366,4 @@ Rectangle {
}
}
}
- //---------------------------------------------
- // Serial Link Settings
- Component {
- id: serialLinkSettings
- Column {
- 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
- }
- }
- }
- }
- }
- //---------------------------------------------
- // TCP Link Settings
- Component {
- id: tcpLinkSettings
- Column {
- 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
- onTextChanged: {
- if(subEditConfig) {
- subEditConfig.host = hostField.text
- }
- }
- }
- }
- 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
- onTextChanged: {
- if(subEditConfig) {
- subEditConfig.port = parseInt(portField.text)
- }
- }
- }
- }
- }
- }
- //---------------------------------------------
- // Log Replay Settings
- Component {
- id: logLinkSettings
- Column {
- width: logLinkSettings.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.TypeMock ? subEditConfig.fileName : ""
- width: _secondColumn
- anchors.verticalCenter: parent.verticalCenter
- onTextChanged: {
- if(subEditConfig) {
- subEditConfig.filename = logField.text
- }
- }
- }
- 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
- }
- }
- }
- }
- //---------------------------------------------
- // Mock Link Settings
- Component {
- id: mockLinkSettings
- Column {
- width: mockLinkSettings.width
- spacing: ScreenTools.defaultFontPixelHeight / 2
- QGCLabel {
- text: "Mock Link Settings"
- }
- Item {
- height: ScreenTools.defaultFontPixelHeight / 2
- width: parent.width
- }
- }
- }
}
diff --git a/src/ui/preferences/LogReplaySettings.qml b/src/ui/preferences/LogReplaySettings.qml
new file mode 100644
index 0000000000000000000000000000000000000000..8c61dcd4b0dd7b69df8f45ed9c77fa60337dcb42
--- /dev/null
+++ b/src/ui/preferences/LogReplaySettings.qml
@@ -0,0 +1,91 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ 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 .
+
+ ======================================================================*/
+
+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
+ }
+ }
+ }
+}
diff --git a/src/ui/preferences/MockLinkSettings.qml b/src/ui/preferences/MockLinkSettings.qml
new file mode 100644
index 0000000000000000000000000000000000000000..3cbd89a8c51add50d43322ba02d3f26f03fc7520
--- /dev/null
+++ b/src/ui/preferences/MockLinkSettings.qml
@@ -0,0 +1,128 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ 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 .
+
+ ======================================================================*/
+
+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
+ }
+ }
+ }
+}
diff --git a/src/ui/preferences/SerialSettings.qml b/src/ui/preferences/SerialSettings.qml
new file mode 100644
index 0000000000000000000000000000000000000000..b15101c78b43448478077469f76e031fcca432c8
--- /dev/null
+++ b/src/ui/preferences/SerialSettings.qml
@@ -0,0 +1,246 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ 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 .
+
+ ======================================================================*/
+
+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
+ }
+ }
+ }
+ }
+}
diff --git a/src/ui/preferences/TcpSettings.qml b/src/ui/preferences/TcpSettings.qml
new file mode 100644
index 0000000000000000000000000000000000000000..d3ae6d33d6f8df433cfcf631f8c936e880c2ebd0
--- /dev/null
+++ b/src/ui/preferences/TcpSettings.qml
@@ -0,0 +1,92 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ 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 .
+
+ ======================================================================*/
+
+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
+ }
+ }
+ }
+}
diff --git a/src/ui/preferences/UdpSettings.qml b/src/ui/preferences/UdpSettings.qml
index 928a09ce396712b345e0387274811416ddc1804d..6fbcc3ea6368a6cb28635a1e4ccb4bedefb94aa1 100644
--- a/src/ui/preferences/UdpSettings.qml
+++ b/src/ui/preferences/UdpSettings.qml
@@ -35,6 +35,10 @@ Item {
width: parent ? parent.width : 0
height: udpColumn.height
+ function saveSettings() {
+ // No need
+ }
+
property var _currentHost: ""
Column {