Unverified Commit 5ab7d32c authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #7080 from mavlink/commsCleanup

Comms cleanup
parents cafc8cee c40fc59e
...@@ -69,7 +69,6 @@ QGCView { ...@@ -69,7 +69,6 @@ QGCView {
height: generalLabel.height height: generalLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: QGroundControl.settingsManager.unitsSettings.visible
QGCLabel { QGCLabel {
id: generalLabel id: generalLabel
text: qsTr("General") text: qsTr("General")
......
...@@ -357,7 +357,7 @@ FlightMap { ...@@ -357,7 +357,7 @@ FlightMap {
// Used to show orbit status telemetry from the vehicle // Used to show orbit status telemetry from the vehicle
QGCMapCircleVisuals { QGCMapCircleVisuals {
mapControl: parent mapControl: parent
mapCircle: _activeVehicle.orbitMapCircle mapCircle: _activeVehicle ? _activeVehicle.orbitMapCircle : null
visible: _activeVehicle ? _activeVehicle.orbitActive : false visible: _activeVehicle ? _activeVehicle.orbitActive : false
} }
......
...@@ -24,7 +24,7 @@ Item { ...@@ -24,7 +24,7 @@ Item {
property var mapControl ///< Map control to place item in property var mapControl ///< Map control to place item in
property var mapCircle ///< QGCMapCircle object property var mapCircle ///< QGCMapCircle object
property bool interactive: mapCircle.interactive /// true: user can manipulate polygon property bool interactive: mapCircle ? mapCircle.interactive : 0 /// true: user can manipulate polygon
property color interiorColor: "transparent" property color interiorColor: "transparent"
property real interiorOpacity: 1 property real interiorOpacity: 1
property int borderWidth: 2 property int borderWidth: 2
...@@ -34,7 +34,7 @@ Item { ...@@ -34,7 +34,7 @@ Item {
property var _topRotationIndicatorComponent property var _topRotationIndicatorComponent
property var _bottomRotationIndicatorComponent property var _bottomRotationIndicatorComponent
property var _dragHandlesComponent property var _dragHandlesComponent
property real _radius: mapCircle.radius.rawValue property real _radius: mapCircle ? mapCircle.radius.rawValue : 0
function addVisuals() { function addVisuals() {
if (!_circleComponent) { if (!_circleComponent) {
......
...@@ -78,6 +78,7 @@ Item { ...@@ -78,6 +78,7 @@ Item {
property bool isTinyScreen: (Screen.width / realPixelDensity) < 120 // 120mm property bool isTinyScreen: (Screen.width / realPixelDensity) < 120 // 120mm
property bool isShortScreen: ScreenToolsController.isMobile && ((Screen.height / Screen.width) < 0.6) // Nexus 7 for example property bool isShortScreen: ScreenToolsController.isMobile && ((Screen.height / Screen.width) < 0.6) // Nexus 7 for example
property bool isHugeScreen: (Screen.width / realPixelDensity) >= (23.5 * 25.4) // 27" monitor property bool isHugeScreen: (Screen.width / realPixelDensity) >= (23.5 * 25.4) // 27" monitor
property bool isSerialAvailable: ScreenToolsController.isSerialAvailable
readonly property real minTouchMillimeters: 10 ///< Minimum touch size in millimeters readonly property real minTouchMillimeters: 10 ///< Minimum touch size in millimeters
property real minTouchPixels: 0 ///< Minimum touch size in pixels property real minTouchPixels: 0 ///< Minimum touch size in pixels
......
...@@ -36,6 +36,7 @@ public: ...@@ -36,6 +36,7 @@ public:
Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT) Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT)
Q_PROPERTY(bool isLinux READ isLinux CONSTANT) Q_PROPERTY(bool isLinux READ isLinux CONSTANT)
Q_PROPERTY(bool isWindows READ isWindows CONSTANT) Q_PROPERTY(bool isWindows READ isWindows CONSTANT)
Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT)
Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT) Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT)
Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT) Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT)
...@@ -87,6 +88,12 @@ public: ...@@ -87,6 +88,12 @@ public:
bool isWindows () { return false; } bool isWindows () { return false; }
#endif #endif
#if defined(NO_SERIAL_LINK)
bool isSerialAvailable () { return false; }
#else
bool isSerialAvailable () { return true; }
#endif
#ifdef QT_DEBUG #ifdef QT_DEBUG
bool isDebug () { return true; } bool isDebug () { return true; }
#else #else
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <QtBluetooth/QBluetoothUuid> #include <QtBluetooth/QBluetoothUuid>
#include <QtBluetooth/QBluetoothSocket> #include <QtBluetooth/QBluetoothSocket>
#include "QGCApplication.h"
#include "BluetoothLink.h" #include "BluetoothLink.h"
#include "QGC.h" #include "QGC.h"
...@@ -33,9 +34,9 @@ BluetoothLink::BluetoothLink(SharedLinkConfigurationPointer& config) ...@@ -33,9 +34,9 @@ BluetoothLink::BluetoothLink(SharedLinkConfigurationPointer& config)
: LinkInterface(config) : LinkInterface(config)
, _config(qobject_cast<BluetoothConfiguration*>(config.data())) , _config(qobject_cast<BluetoothConfiguration*>(config.data()))
, _connectState(false) , _connectState(false)
, _targetSocket(NULL) , _targetSocket(nullptr)
#ifdef __ios__ #ifdef __ios__
, _discoveryAgent(NULL) , _discoveryAgent(nullptr)
#endif #endif
, _shutDown(false) , _shutDown(false)
{ {
...@@ -50,7 +51,7 @@ BluetoothLink::~BluetoothLink() ...@@ -50,7 +51,7 @@ BluetoothLink::~BluetoothLink()
_shutDown = true; _shutDown = true;
_discoveryAgent->stop(); _discoveryAgent->stop();
_discoveryAgent->deleteLater(); _discoveryAgent->deleteLater();
_discoveryAgent = NULL; _discoveryAgent = nullptr;
} }
#endif #endif
} }
...@@ -104,13 +105,13 @@ void BluetoothLink::_disconnect(void) ...@@ -104,13 +105,13 @@ void BluetoothLink::_disconnect(void)
_shutDown = true; _shutDown = true;
_discoveryAgent->stop(); _discoveryAgent->stop();
_discoveryAgent->deleteLater(); _discoveryAgent->deleteLater();
_discoveryAgent = NULL; _discoveryAgent = nullptr;
} }
#endif #endif
if(_targetSocket) if(_targetSocket)
{ {
_targetSocket->deleteLater(); _targetSocket->deleteLater();
_targetSocket = NULL; _targetSocket = nullptr;
emit disconnected(); emit disconnected();
} }
_connectState = false; _connectState = false;
...@@ -129,7 +130,7 @@ bool BluetoothLink::_hardwareConnect() ...@@ -129,7 +130,7 @@ bool BluetoothLink::_hardwareConnect()
_shutDown = true; _shutDown = true;
_discoveryAgent->stop(); _discoveryAgent->stop();
_discoveryAgent->deleteLater(); _discoveryAgent->deleteLater();
_discoveryAgent = NULL; _discoveryAgent = nullptr;
} }
_discoveryAgent = new QBluetoothServiceDiscoveryAgent(this); _discoveryAgent = new QBluetoothServiceDiscoveryAgent(this);
QObject::connect(_discoveryAgent, &QBluetoothServiceDiscoveryAgent::serviceDiscovered, this, &BluetoothLink::serviceDiscovered); QObject::connect(_discoveryAgent, &QBluetoothServiceDiscoveryAgent::serviceDiscovered, this, &BluetoothLink::serviceDiscovered);
...@@ -149,7 +150,7 @@ void BluetoothLink::_createSocket() ...@@ -149,7 +150,7 @@ void BluetoothLink::_createSocket()
if(_targetSocket) if(_targetSocket)
{ {
delete _targetSocket; delete _targetSocket;
_targetSocket = NULL; _targetSocket = nullptr;
} }
_targetSocket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol, this); _targetSocket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol, this);
QObject::connect(_targetSocket, &QBluetoothSocket::connected, this, &BluetoothLink::deviceConnected); QObject::connect(_targetSocket, &QBluetoothSocket::connected, this, &BluetoothLink::deviceConnected);
...@@ -182,7 +183,7 @@ void BluetoothLink::discoveryFinished() ...@@ -182,7 +183,7 @@ void BluetoothLink::discoveryFinished()
{ {
_shutDown = true; _shutDown = true;
_discoveryAgent->deleteLater(); _discoveryAgent->deleteLater();
_discoveryAgent = NULL; _discoveryAgent = nullptr;
if(!_targetSocket) if(!_targetSocket)
{ {
_connectState = false; _connectState = false;
...@@ -236,14 +237,14 @@ qint64 BluetoothLink::getCurrentOutDataRate() const ...@@ -236,14 +237,14 @@ qint64 BluetoothLink::getCurrentOutDataRate() const
BluetoothConfiguration::BluetoothConfiguration(const QString& name) BluetoothConfiguration::BluetoothConfiguration(const QString& name)
: LinkConfiguration(name) : LinkConfiguration(name)
, _deviceDiscover(NULL) , _deviceDiscover(nullptr)
{ {
} }
BluetoothConfiguration::BluetoothConfiguration(BluetoothConfiguration* source) BluetoothConfiguration::BluetoothConfiguration(BluetoothConfiguration* source)
: LinkConfiguration(source) : LinkConfiguration(source)
, _deviceDiscover(NULL) , _deviceDiscover(nullptr)
, _device(source->device()) , _device(source->device())
{ {
} }
...@@ -257,11 +258,20 @@ BluetoothConfiguration::~BluetoothConfiguration() ...@@ -257,11 +258,20 @@ BluetoothConfiguration::~BluetoothConfiguration()
} }
} }
QString BluetoothConfiguration::settingsTitle()
{
if(qgcApp()->toolbox()->linkManager()->isBluetoothAvailable()) {
return tr("Bluetooth Link Settings");
} else {
return tr("Bluetooth Not Available");
}
}
void BluetoothConfiguration::copyFrom(LinkConfiguration *source) void BluetoothConfiguration::copyFrom(LinkConfiguration *source)
{ {
LinkConfiguration::copyFrom(source); LinkConfiguration::copyFrom(source);
BluetoothConfiguration* usource = dynamic_cast<BluetoothConfiguration*>(source); BluetoothConfiguration* usource = dynamic_cast<BluetoothConfiguration*>(source);
Q_ASSERT(usource != NULL); Q_ASSERT(usource != nullptr);
_device = usource->device(); _device = usource->device();
} }
...@@ -306,7 +316,7 @@ void BluetoothConfiguration::stopScan() ...@@ -306,7 +316,7 @@ void BluetoothConfiguration::stopScan()
{ {
_deviceDiscover->stop(); _deviceDiscover->stop();
_deviceDiscover->deleteLater(); _deviceDiscover->deleteLater();
_deviceDiscover = NULL; _deviceDiscover = nullptr;
emit scanningChanged(); emit scanningChanged();
} }
} }
...@@ -366,7 +376,7 @@ void BluetoothConfiguration::doneScanning() ...@@ -366,7 +376,7 @@ void BluetoothConfiguration::doneScanning()
if(_deviceDiscover) if(_deviceDiscover)
{ {
_deviceDiscover->deleteLater(); _deviceDiscover->deleteLater();
_deviceDiscover = NULL; _deviceDiscover = nullptr;
emit scanningChanged(); emit scanningChanged();
} }
} }
......
...@@ -104,6 +104,7 @@ public: ...@@ -104,6 +104,7 @@ public:
void saveSettings (QSettings& settings, const QString& root); void saveSettings (QSettings& settings, const QString& root);
void updateSettings (); void updateSettings ();
QString settingsURL () { return "BluetoothSettings.qml"; } QString settingsURL () { return "BluetoothSettings.qml"; }
QString settingsTitle ();
public slots: public slots:
void deviceDiscovered (QBluetoothDeviceInfo info); void deviceDiscovered (QBluetoothDeviceInfo info);
......
...@@ -31,6 +31,7 @@ public: ...@@ -31,6 +31,7 @@ public:
Q_PROPERTY(bool autoConnect READ isAutoConnect WRITE setAutoConnect NOTIFY autoConnectChanged) Q_PROPERTY(bool autoConnect READ isAutoConnect WRITE setAutoConnect NOTIFY autoConnectChanged)
Q_PROPERTY(bool autoConnectAllowed READ isAutoConnectAllowed CONSTANT) Q_PROPERTY(bool autoConnectAllowed READ isAutoConnectAllowed CONSTANT)
Q_PROPERTY(QString settingsURL READ settingsURL CONSTANT) Q_PROPERTY(QString settingsURL READ settingsURL CONSTANT)
Q_PROPERTY(QString settingsTitle READ settingsTitle CONSTANT)
Q_PROPERTY(bool highLatency READ isHighLatency WRITE setHighLatency NOTIFY highLatencyChanged) Q_PROPERTY(bool highLatency READ isHighLatency WRITE setHighLatency NOTIFY highLatencyChanged)
Q_PROPERTY(bool highLatencyAllowed READ isHighLatencyAllowed CONSTANT) Q_PROPERTY(bool highLatencyAllowed READ isHighLatencyAllowed CONSTANT)
...@@ -146,7 +147,14 @@ public: ...@@ -146,7 +147,14 @@ public:
* *
* Pure virtual method providing the URL for the (QML) settings dialog * Pure virtual method providing the URL for the (QML) settings dialog
*/ */
virtual QString settingsURL() = 0; virtual QString settingsURL () = 0;
/*!
* @brief Settings Title
*
* Pure virtual method providing the Title for the (QML) settings dialog
*/
virtual QString settingsTitle () = 0;
/*! /*!
* @brief Update settings * @brief Update settings
......
...@@ -40,6 +40,7 @@ public: ...@@ -40,6 +40,7 @@ public:
void saveSettings (QSettings& settings, const QString& root); void saveSettings (QSettings& settings, const QString& root);
void updateSettings (); void updateSettings ();
QString settingsURL () { return "LogReplaySettings.qml"; } QString settingsURL () { return "LogReplaySettings.qml"; }
QString settingsTitle () { return tr("Log Replay Link Settings"); }
signals: signals:
void fileNameChanged(); void fileNameChanged();
......
...@@ -70,6 +70,7 @@ public: ...@@ -70,6 +70,7 @@ public:
void saveSettings (QSettings& settings, const QString& root); void saveSettings (QSettings& settings, const QString& root);
void updateSettings (void); void updateSettings (void);
QString settingsURL () { return "MockLinkSettings.qml"; } QString settingsURL () { return "MockLinkSettings.qml"; }
QString settingsTitle () { return tr("Mock Link Settings"); }
signals: signals:
void firmwareChanged (); void firmwareChanged ();
......
...@@ -90,6 +90,7 @@ public: ...@@ -90,6 +90,7 @@ public:
void saveSettings (QSettings& settings, const QString& root); void saveSettings (QSettings& settings, const QString& root);
void updateSettings (); void updateSettings ();
QString settingsURL () { return "SerialSettings.qml"; } QString settingsURL () { return "SerialSettings.qml"; }
QString settingsTitle () { return tr("Serial Link Settings"); }
signals: signals:
void baudChanged (); void baudChanged ();
......
...@@ -101,6 +101,7 @@ public: ...@@ -101,6 +101,7 @@ public:
void saveSettings (QSettings& settings, const QString& root); void saveSettings (QSettings& settings, const QString& root);
void updateSettings (); void updateSettings ();
QString settingsURL () { return "TcpSettings.qml"; } QString settingsURL () { return "TcpSettings.qml"; }
QString settingsTitle () { return tr("TCP Link Settings"); }
signals: signals:
void portChanged(); void portChanged();
......
...@@ -127,6 +127,7 @@ public: ...@@ -127,6 +127,7 @@ public:
bool isAutoConnectAllowed () { return true; } bool isAutoConnectAllowed () { return true; }
bool isHighLatencyAllowed () { return true; } bool isHighLatencyAllowed () { return true; }
QString settingsURL () { return "UdpSettings.qml"; } QString settingsURL () { return "UdpSettings.qml"; }
QString settingsTitle () { return tr("UDP Link Settings"); }
signals: signals:
void localPortChanged (); void localPortChanged ();
......
...@@ -17,46 +17,15 @@ import QGroundControl.Controls 1.0 ...@@ -17,46 +17,15 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Item { Column {
id: _btSettings id: _btSettings
width: parent ? parent.width : 0 spacing: ScreenTools.defaultFontPixelHeight * 0.5
height: btColumn.height anchors.margins: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.linkManager.isBluetoothAvailable
function saveSettings() { function saveSettings() {
// No need // No need
} }
QGCLabel {
text: qsTr("Bluetooth Not Available")
visible: !QGroundControl.linkManager.isBluetoothAvailable
anchors.centerIn: parent
}
Column {
id: btColumn
spacing: ScreenTools.defaultFontPixelHeight / 2
visible: QGroundControl.linkManager.isBluetoothAvailable
ExclusiveGroup { id: linkGroup } ExclusiveGroup { id: linkGroup }
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
QGCLabel {
id: btLabel
text: qsTr("Bluetooth Link Settings")
}
Rectangle {
height: 1
width: btLabel.width
color: qgcPal.button
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
}
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
...@@ -160,5 +129,5 @@ Item { ...@@ -160,5 +129,5 @@ Item {
} }
} }
} }
}
} }
...@@ -150,18 +150,21 @@ Rectangle { ...@@ -150,18 +150,21 @@ Rectangle {
Component { Component {
id: commSettings id: commSettings
Rectangle { Rectangle {
id: settingsRect
color: qgcPal.window color: qgcPal.window
anchors.fill: parent anchors.fill: parent
property real _panelWidth: width * 0.8
Component.onCompleted: { Component.onCompleted: {
// If editing, create copy for editing // If editing, create copy for editing
if(linkConfig) { if(linkConfig) {
editConfig = QGroundControl.linkManager.startConfigurationEditing(linkConfig) editConfig = QGroundControl.linkManager.startConfigurationEditing(linkConfig)
} else { } else {
// Create new link configuration // Create new link configuration
if(ScreenTools.isiOS) if(ScreenTools.isSerialAvailable) {
editConfig = QGroundControl.linkManager.createConfiguration(LinkConfiguration.TypeUdp, "Unnamed")
else
editConfig = QGroundControl.linkManager.createConfiguration(LinkConfiguration.TypeSerial, "Unnamed") editConfig = QGroundControl.linkManager.createConfiguration(LinkConfiguration.TypeSerial, "Unnamed")
} else {
editConfig = QGroundControl.linkManager.createConfiguration(LinkConfiguration.TypeUdp, "Unnamed")
}
} }
} }
Component.onDestruction: { Component.onDestruction: {
...@@ -170,12 +173,25 @@ Rectangle { ...@@ -170,12 +173,25 @@ Rectangle {
editConfig = null editConfig = null
} }
} }
Column {
id: settingsTitle
spacing: ScreenTools.defaultFontPixelHeight * 0.5
QGCLabel {
text: linkConfig ? qsTr("Edit Link Configuration Settings") : qsTr("Create New Link Configuration")
font.pointSize: ScreenTools.mediumFontPointSize
}
Rectangle {
height: 1
width: settingsRect.width
color: qgcPal.button
}
}
QGCFlickable { QGCFlickable {
id: settingsFlick id: settingsFlick
clip: true clip: true
anchors.top: parent.top anchors.top: settingsTitle.bottom
anchors.bottom: commButtonRow.top
width: parent.width width: parent.width
height: parent.height - commButtonRow.height
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
contentHeight: commSettingsColumn.height contentHeight: commSettingsColumn.height
contentWidth: _linkRoot.width contentWidth: _linkRoot.width
...@@ -185,20 +201,31 @@ Rectangle { ...@@ -185,20 +201,31 @@ Rectangle {
id: commSettingsColumn id: commSettingsColumn
width: _linkRoot.width width: _linkRoot.width
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
spacing: ScreenTools.defaultFontPixelHeight / 2 spacing: ScreenTools.defaultFontPixelHeight * 0.5
//-----------------------------------------------------------------
//-- General
Item {
width: _panelWidth
height: generalLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { QGCLabel {
text: linkConfig ? qsTr("Edit Link Configuration Settings (WIP)") : qsTr("Create New Link Configuration (WIP)") id: generalLabel
font.pointSize: ScreenTools.mediumFontPointSize text: qsTr("General")
} font.family: ScreenTools.demiboldFontFamily
Rectangle {
height: 1
width: parent.width
color: qgcPal.button
} }
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
} }
Rectangle {
height: generalCol.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Column {
id: generalCol
anchors.centerIn: parent
anchors.margins: ScreenTools.defaultFontPixelWidth
spacing: ScreenTools.defaultFontPixelHeight * 0.5
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
...@@ -273,9 +300,9 @@ Rectangle { ...@@ -273,9 +300,9 @@ Rectangle {
} }
//-- Auto Connect on Start //-- Auto Connect on Start
QGCCheckBox { QGCCheckBox {
text: "Automatically Connect on Start" text: qsTr("Automatically Connect on Start")
checked: false checked: false
visible: editConfig ? editConfig.autoConnectAllowed : false enabled: editConfig ? editConfig.autoConnectAllowed : false
onCheckedChanged: { onCheckedChanged: {
if(editConfig) { if(editConfig) {
editConfig.autoConnect = checked editConfig.autoConnect = checked
...@@ -286,18 +313,59 @@ Rectangle { ...@@ -286,18 +313,59 @@ Rectangle {
checked = editConfig.autoConnect checked = editConfig.autoConnect
} }
} }
QGCCheckBox {
text: qsTr("High Latency")
checked: false
enabled: editConfig ? editConfig.highLatencyAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
}
}
}
Item { Item {
height: ScreenTools.defaultFontPixelHeight height: ScreenTools.defaultFontPixelHeight
width: parent.width width: parent.width
} }
//-----------------------------------------------------------------
//-- Link Specific Settings
Item {
width: _panelWidth
height: linkLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel {
id: linkLabel
text: editConfig ? editConfig.settingsTitle : ""
visible: linkSettingLoader.source != ""
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: linkSettingLoader.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
Item {
height: linkSettingLoader.height
width: linkSettingLoader.width
anchors.centerIn: parent
Loader { Loader {
id: linkSettingLoader id: linkSettingLoader
width: parent.width
visible: false visible: false
property var subEditConfig: editConfig property var subEditConfig: editConfig
} }
} }
} }
}
}
Row { Row {
id: commButtonRow id: commButtonRow
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
......
...@@ -17,27 +17,14 @@ import QGroundControl.Controls 1.0 ...@@ -17,27 +17,14 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Item { Column {
width: parent ? parent.width : 0 spacing: ScreenTools.defaultFontPixelHeight * 0.5
height: logColumn.height anchors.margins: ScreenTools.defaultFontPixelWidth
function saveSettings() { function saveSettings() {
if(subEditConfig) { if(subEditConfig) {
subEditConfig.filename = logField.text subEditConfig.filename = logField.text
} }
} }
Column {
id: logColumn
width: parent.width
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel {
text: qsTr("Log Replay Link Settings")
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
}
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
...@@ -74,5 +61,4 @@ Item { ...@@ -74,5 +61,4 @@ Item {
fileDialog.visible = false fileDialog.visible = false
} }
} }
}
} }
...@@ -17,11 +17,10 @@ import QGroundControl.Controls 1.0 ...@@ -17,11 +17,10 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Item { Column {
id: mockLinkSettings id: mockLinkSettings
width: parent ? parent.width : 0 spacing: ScreenTools.defaultFontPixelHeight * 0.5
height: mockColumn.height anchors.margins: ScreenTools.defaultFontPixelWidth
function saveSettings() { function saveSettings() {
if(px4Firmware.checked) if(px4Firmware.checked)
subEditConfig.firmware = 12 // Hardcoded MAV_AUTOPILOT_PX4 subEditConfig.firmware = 12 // Hardcoded MAV_AUTOPILOT_PX4
...@@ -35,9 +34,7 @@ Item { ...@@ -35,9 +34,7 @@ Item {
else else
subEditConfig.firmware = 0 subEditConfig.firmware = 0
subEditConfig.sendStatus = sendStatus.checked subEditConfig.sendStatus = sendStatus.checked
subEditConfig.highLatency = highLatency.checked
} }
Component.onCompleted: { Component.onCompleted: {
if(subEditConfig.firmware === 12) // Hardcoded MAV_AUTOPILOT_PX4 if(subEditConfig.firmware === 12) // Hardcoded MAV_AUTOPILOT_PX4
px4Firmware.checked = true px4Firmware.checked = true
...@@ -50,30 +47,12 @@ Item { ...@@ -50,30 +47,12 @@ Item {
else else
copterVehicle.checked = true copterVehicle.checked = true
sendStatus.checked = subEditConfig.sendStatus sendStatus.checked = subEditConfig.sendStatus
highLatency.checked = subEditConfig.highLatency
}
Column {
id: mockColumn
width: mockLinkSettings.width
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel {
text: qsTr("Mock Link Settings")
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
} }
QGCCheckBox { QGCCheckBox {
id: sendStatus id: sendStatus
text: qsTr("Send Status Text and Voice") text: qsTr("Send Status Text and Voice")
checked: false checked: false
} }
QGCCheckBox {
id: highLatency
text: qsTr("High latency")
checked: false
}
Item { Item {
height: ScreenTools.defaultFontPixelHeight / 2 height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width width: parent.width
...@@ -123,5 +102,4 @@ Item { ...@@ -123,5 +102,4 @@ Item {
exclusiveGroup: apmVehicleGroup exclusiveGroup: apmVehicleGroup
} }
} }
}
} }
...@@ -17,32 +17,13 @@ import QGroundControl.Controls 1.0 ...@@ -17,32 +17,13 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Item { Column {
id: serialLinkSettings id: serialLinkSettings
width: parent ? parent.width : 0 spacing: ScreenTools.defaultFontPixelHeight * 0.5
height: serialColumn.height anchors.margins: ScreenTools.defaultFontPixelWidth
function saveSettings() { function saveSettings() {
// No Need // No Need
} }
Column {
id: serialColumn
width: serialLinkSettings.width
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel {
id: serialLabel
text: qsTr("Serial Link Settings")
}
Rectangle {
height: 1
width: serialLabel.width
color: qgcPal.button
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
}
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
...@@ -52,14 +33,13 @@ Item { ...@@ -52,14 +33,13 @@ Item {
} }
QGCLabel { QGCLabel {
text: qsTr("No serial ports available"); text: qsTr("No serial ports available");
visible: QGroundControl.linkManager.serialPortStrings.length == 0 visible: QGroundControl.linkManager.serialPortStrings.length === 0
} }
QGCComboBox { QGCComboBox {
id: commPortCombo id: commPortCombo
anchors.verticalCenter: parent.verticalCenter
width: _secondColumn width: _secondColumn
visible: QGroundControl.linkManager.serialPortStrings.length > 0 visible: QGroundControl.linkManager.serialPortStrings.length > 0
anchors.verticalCenter: parent.verticalCenter
onActivated: { onActivated: {
if (index != -1) { if (index != -1) {
...@@ -74,11 +54,9 @@ Item { ...@@ -74,11 +54,9 @@ Item {
Component.onCompleted: { Component.onCompleted: {
var index var index
var serialPorts = [ ] var serialPorts = [ ]
for (var i=0; i<QGroundControl.linkManager.serialPortStrings.length; i++) { for (var i=0; i<QGroundControl.linkManager.serialPortStrings.length; i++) {
serialPorts.push(QGroundControl.linkManager.serialPortStrings[i]) serialPorts.push(QGroundControl.linkManager.serialPortStrings[i])
} }
if (subEditConfig != null) { if (subEditConfig != null) {
if (subEditConfig.portDisplayName === "" && QGroundControl.linkManager.serialPorts.length > 0) { if (subEditConfig.portDisplayName === "" && QGroundControl.linkManager.serialPorts.length > 0) {
subEditConfig.portName = QGroundControl.linkManager.serialPorts[0] subEditConfig.portName = QGroundControl.linkManager.serialPorts[0]
...@@ -91,7 +69,6 @@ Item { ...@@ -91,7 +69,6 @@ Item {
} else { } else {
index = 0 index = 0
} }
commPortCombo.model = serialPorts commPortCombo.model = serialPorts
commPortCombo.currentIndex = index commPortCombo.currentIndex = index
} }
...@@ -250,19 +227,4 @@ Item { ...@@ -250,19 +227,4 @@ Item {
} }
} }
} }
QGCCheckBox {
text: "High Latency"
checked: false
visible: editConfig ? editConfig.highLatencyAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
}
}
} }
...@@ -17,35 +17,16 @@ import QGroundControl.Controls 1.0 ...@@ -17,35 +17,16 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Item { Column {
id: tcpLinkSettings id: tcpLinkSettings
width: parent ? parent.width : 0 spacing: ScreenTools.defaultFontPixelHeight * 0.5
height: tcpColumn.height anchors.margins: ScreenTools.defaultFontPixelWidth
function saveSettings() { function saveSettings() {
if(subEditConfig) { if(subEditConfig) {
subEditConfig.host = hostField.text subEditConfig.host = hostField.text
subEditConfig.port = parseInt(portField.text) subEditConfig.port = parseInt(portField.text)
} }
} }
Column {
id: tcpColumn
width: tcpLinkSettings.width
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel {
id: tcpLabel
text: qsTr("TCP Link Settings")
}
Rectangle {
height: 1
width: tcpLabel.width
color: qgcPal.button
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
}
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
...@@ -75,19 +56,4 @@ Item { ...@@ -75,19 +56,4 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
QGCCheckBox {
text: "High Latency"
checked: false
visible: editConfig ? editConfig.highLatencyAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
}
}
} }
...@@ -17,41 +17,19 @@ import QGroundControl.Controls 1.0 ...@@ -17,41 +17,19 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Item { Column {
id: _udpSetting id: _udpSetting
width: parent ? parent.width : 0 spacing: ScreenTools.defaultFontPixelHeight * 0.5
height: udpColumn.height anchors.margins: ScreenTools.defaultFontPixelWidth
function saveSettings() { function saveSettings() {
// No need // No need
} }
property var _currentHost: "" property string _currentHost: ""
Column {
id: udpColumn
spacing: ScreenTools.defaultFontPixelHeight / 2
ExclusiveGroup { id: linkGroup } ExclusiveGroup { id: linkGroup }
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
QGCLabel {
id: udpLabel
text: qsTr("UDP Link Settings")
}
Rectangle {
height: 1
width: udpLabel.width
color: qgcPal.button
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
}
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
...@@ -175,19 +153,4 @@ Item { ...@@ -175,19 +153,4 @@ Item {
} }
} }
} }
QGCCheckBox {
text: "High Latency"
checked: false
visible: editConfig ? editConfig.highLatencyAllowed : false
onCheckedChanged: {
if(editConfig) {
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment