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
} }
...@@ -396,7 +396,7 @@ FlightMap { ...@@ -396,7 +396,7 @@ FlightMap {
onClicked: { onClicked: {
if (guidedActionsController.guidedUIVisible || (!guidedActionsController.showGotoLocation && !guidedActionsController.showOrbit)) { if (guidedActionsController.guidedUIVisible || (!guidedActionsController.showGotoLocation && !guidedActionsController.showOrbit)) {
return return
} }
orbitMapCircle.hide() orbitMapCircle.hide()
gotoLocationItem.hide() gotoLocationItem.hide()
var clickCoord = flightMap.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */) var clickCoord = flightMap.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
......
...@@ -22,9 +22,9 @@ import QGroundControl.FlightMap 1.0 ...@@ -22,9 +22,9 @@ import QGroundControl.FlightMap 1.0
Item { Item {
id: _root id: _root
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) {
......
...@@ -69,18 +69,19 @@ Item { ...@@ -69,18 +69,19 @@ Item {
return Screen.pixelDensity return Screen.pixelDensity
} }
property bool isAndroid: ScreenToolsController.isAndroid property bool isAndroid: ScreenToolsController.isAndroid
property bool isiOS: ScreenToolsController.isiOS property bool isiOS: ScreenToolsController.isiOS
property bool isMobile: ScreenToolsController.isMobile property bool isMobile: ScreenToolsController.isMobile
property bool isWindows: ScreenToolsController.isWindows property bool isWindows: ScreenToolsController.isWindows
property bool isDebug: ScreenToolsController.isDebug property bool isDebug: ScreenToolsController.isDebug
property bool isMac: ScreenToolsController.isMacOS property bool isMac: ScreenToolsController.isMacOS
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
property real minTouchPixels: 0 ///< Minimum touch size in pixels readonly property real minTouchMillimeters: 10 ///< Minimum touch size in millimeters
property real minTouchPixels: 0 ///< Minimum touch size in pixels
// The implicit heights/widths for our custom control set // The implicit heights/widths for our custom control set
property real implicitButtonWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0)) property real implicitButtonWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0))
......
...@@ -29,15 +29,16 @@ class ScreenToolsController : public QQuickItem ...@@ -29,15 +29,16 @@ class ScreenToolsController : public QQuickItem
public: public:
ScreenToolsController(); ScreenToolsController();
Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT) Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT)
Q_PROPERTY(bool isiOS READ isiOS CONSTANT) Q_PROPERTY(bool isiOS READ isiOS CONSTANT)
Q_PROPERTY(bool isMobile READ isMobile CONSTANT) Q_PROPERTY(bool isMobile READ isMobile CONSTANT)
Q_PROPERTY(bool isDebug READ isDebug CONSTANT) Q_PROPERTY(bool isDebug READ isDebug CONSTANT)
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(QString iOSDevice READ iOSDevice CONSTANT) Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT)
Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT) Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT)
Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT)
// Returns current mouse position // Returns current mouse position
Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); } Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); }
...@@ -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,143 +17,111 @@ import QGroundControl.Controls 1.0 ...@@ -17,143 +17,111 @@ 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
} }
ExclusiveGroup { id: linkGroup }
QGCLabel { Row {
text: qsTr("Bluetooth Not Available") spacing: ScreenTools.defaultFontPixelWidth
visible: !QGroundControl.linkManager.isBluetoothAvailable
anchors.centerIn: parent
}
Column {
id: btColumn
spacing: ScreenTools.defaultFontPixelHeight / 2
visible: QGroundControl.linkManager.isBluetoothAvailable
ExclusiveGroup { id: linkGroup }
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
QGCLabel { QGCLabel {
id: btLabel text: qsTr("Device:")
text: qsTr("Bluetooth Link Settings") width: _firstColumn
} }
Rectangle { QGCLabel {
height: 1 id: deviceField
width: btLabel.width text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth ? subEditConfig.devName : ""
color: qgcPal.button
} }
Item { }
height: ScreenTools.defaultFontPixelHeight / 2 Row {
width: parent.width visible: !ScreenTools.isiOS
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("Address:")
width: _firstColumn
} }
Row { QGCLabel {
spacing: ScreenTools.defaultFontPixelWidth id: addressField
QGCLabel { text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth ? subEditConfig.address : ""
text: qsTr("Device:")
width: _firstColumn
}
QGCLabel {
id: deviceField
text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth ? subEditConfig.devName : ""
}
} }
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
}
QGCLabel {
text: qsTr("Bluetooth Devices:")
}
Item {
width: hostRow.width
height: hostRow.height
Row { Row {
visible: !ScreenTools.isiOS id: hostRow
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { Item {
text: qsTr("Address:") height: 1
width: _firstColumn width: _firstColumn
} }
QGCLabel { Column {
id: addressField id: hostColumn
text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth ? subEditConfig.address : "" spacing: ScreenTools.defaultFontPixelHeight / 2
} Rectangle {
} height: 1
Item { width: _secondColumn
height: ScreenTools.defaultFontPixelHeight / 2 color: qgcPal.button
width: parent.width visible: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth && subEditConfig.nameList.length > 0
}
QGCLabel {
text: qsTr("Bluetooth Devices:")
}
Item {
width: hostRow.width
height: hostRow.height
Row {
id: hostRow
spacing: ScreenTools.defaultFontPixelWidth
Item {
height: 1
width: _firstColumn
} }
Column { Repeater {
id: hostColumn model: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth ? subEditConfig.nameList : ""
spacing: ScreenTools.defaultFontPixelHeight / 2 delegate:
Rectangle { QGCButton {
height: 1 text: modelData
width: _secondColumn width: _secondColumn
color: qgcPal.button anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
visible: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth && subEditConfig.nameList.length > 0 exclusiveGroup: linkGroup
onClicked: {
checked = true
if(subEditConfig && modelData !== "")
subEditConfig.devName = modelData
}
} }
Repeater { }
model: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth ? subEditConfig.nameList : "" Rectangle {
delegate: 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 { QGCButton {
text: modelData width: ScreenTools.defaultFontPixelWidth * 10
width: _secondColumn text: qsTr("Scan")
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2 enabled: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth && !subEditConfig.scanning
exclusiveGroup: linkGroup
onClicked: { onClicked: {
checked = true if(subEditConfig)
if(subEditConfig && modelData !== "") subEditConfig.startScan()
subEditConfig.devName = modelData
} }
} }
} QGCButton {
Rectangle { width: ScreenTools.defaultFontPixelWidth * 10
height: 1 text: qsTr("Stop")
width: _secondColumn enabled: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth && subEditConfig.scanning
color: qgcPal.button onClicked: {
} if(subEditConfig)
Item { subEditConfig.stopScan()
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: qsTr("Scan")
enabled: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth && !subEditConfig.scanning
onClicked: {
if(subEditConfig)
subEditConfig.startScan()
}
}
QGCButton {
width: ScreenTools.defaultFontPixelWidth * 10
text: qsTr("Stop")
enabled: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeBluetooth && subEditConfig.scanning
onClicked: {
if(subEditConfig)
subEditConfig.stopScan()
}
} }
} }
} }
...@@ -162,3 +130,4 @@ Item { ...@@ -162,3 +130,4 @@ Item {
} }
} }
} }
This diff is collapsed.
...@@ -17,62 +17,48 @@ import QGroundControl.Controls 1.0 ...@@ -17,62 +17,48 @@ 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
} }
} }
Row {
Column { spacing: ScreenTools.defaultFontPixelWidth
id: logColumn
width: parent.width
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel { QGCLabel {
text: qsTr("Log Replay Link Settings") text: qsTr("Log File:")
width: _firstColumn
anchors.verticalCenter: parent.verticalCenter
} }
Item { QGCTextField {
height: ScreenTools.defaultFontPixelHeight / 2 id: logField
width: parent.width text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeLogReplay ? subEditConfig.fileName : ""
width: _secondColumn
anchors.verticalCenter: parent.verticalCenter
} }
Row { QGCButton {
spacing: ScreenTools.defaultFontPixelWidth text: qsTr("Browse")
QGCLabel { onClicked: {
text: qsTr("Log File:") fileDialog.visible = true
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: qsTr("Browse")
onClicked: {
fileDialog.visible = true
}
} }
} }
FileDialog { }
id: fileDialog FileDialog {
title: qsTr("Please choose a file") id: fileDialog
folder: shortcuts.home title: qsTr("Please choose a file")
visible: false folder: shortcuts.home
selectExisting: true visible: false
onAccepted: { selectExisting: true
if(subEditConfig) { onAccepted: {
subEditConfig.fileName = fileDialog.fileUrl.toString().replace("file://", "") if(subEditConfig) {
} subEditConfig.fileName = fileDialog.fileUrl.toString().replace("file://", "")
fileDialog.visible = false
}
onRejected: {
fileDialog.visible = false
} }
fileDialog.visible = false
}
onRejected: {
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,78 +47,59 @@ Item { ...@@ -50,78 +47,59 @@ Item {
else else
copterVehicle.checked = true copterVehicle.checked = true
sendStatus.checked = subEditConfig.sendStatus sendStatus.checked = subEditConfig.sendStatus
highLatency.checked = subEditConfig.highLatency
} }
QGCCheckBox {
Column { id: sendStatus
id: mockColumn text: qsTr("Send Status Text and Voice")
width: mockLinkSettings.width checked: false
spacing: ScreenTools.defaultFontPixelHeight / 2 }
QGCLabel { Item {
text: qsTr("Mock Link Settings") height: ScreenTools.defaultFontPixelHeight / 2
} width: parent.width
Item { }
height: ScreenTools.defaultFontPixelHeight / 2 ColumnLayout {
width: parent.width ExclusiveGroup { id: autoPilotGroup }
} QGCRadioButton {
QGCCheckBox { id: px4Firmware
id: sendStatus text: qsTr("PX4 Firmware")
text: qsTr("Send Status Text and Voice")
checked: false checked: false
exclusiveGroup: autoPilotGroup
} }
QGCCheckBox { QGCRadioButton {
id: highLatency id: apmFirmware
text: qsTr("High latency") text: qsTr("APM Firmware")
checked: false checked: false
exclusiveGroup: autoPilotGroup
} }
Item { QGCRadioButton {
height: ScreenTools.defaultFontPixelHeight / 2 id: genericFirmware
width: parent.width text: qsTr("Generic Firmware")
} checked: false
ColumnLayout { exclusiveGroup: autoPilotGroup
ExclusiveGroup { id: autoPilotGroup }
QGCRadioButton {
id: px4Firmware
text: qsTr("PX4 Firmware")
checked: false
exclusiveGroup: autoPilotGroup
}
QGCRadioButton {
id: apmFirmware
text: qsTr("APM Firmware")
checked: false
exclusiveGroup: autoPilotGroup
}
QGCRadioButton {
id: genericFirmware
text: qsTr("Generic Firmware")
checked: false
exclusiveGroup: autoPilotGroup
}
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
} }
QGCLabel { }
text: qsTr("APM Vehicle Type") Item {
visible: apmFirmware.checked height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
}
QGCLabel {
text: qsTr("APM Vehicle Type")
visible: apmFirmware.checked
}
ColumnLayout {
visible: apmFirmware.checked
ExclusiveGroup { id: apmVehicleGroup }
QGCRadioButton {
id: copterVehicle
text: qsTr("ArduCopter")
checked: false
exclusiveGroup: apmVehicleGroup
} }
ColumnLayout { QGCRadioButton {
visible: apmFirmware.checked id: planeVehicle
ExclusiveGroup { id: apmVehicleGroup } text: qsTr("ArduPlane")
QGCRadioButton { checked: false
id: copterVehicle exclusiveGroup: apmVehicleGroup
text: qsTr("ArduCopter")
checked: false
exclusiveGroup: apmVehicleGroup
}
QGCRadioButton {
id: planeVehicle
text: qsTr("ArduPlane")
checked: false
exclusiveGroup: apmVehicleGroup
}
} }
} }
} }
This diff is collapsed.
...@@ -17,77 +17,43 @@ import QGroundControl.Controls 1.0 ...@@ -17,77 +17,43 @@ 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)
} }
} }
Row {
Column { spacing: ScreenTools.defaultFontPixelWidth
id: tcpColumn
width: tcpLinkSettings.width
spacing: ScreenTools.defaultFontPixelHeight / 2
QGCLabel { QGCLabel {
id: tcpLabel text: qsTr("Host Address:")
text: qsTr("TCP Link Settings") width: _firstColumn
} anchors.verticalCenter: parent.verticalCenter
Rectangle {
height: 1
width: tcpLabel.width
color: qgcPal.button
} }
Item { QGCTextField {
height: ScreenTools.defaultFontPixelHeight / 2 id: hostField
width: parent.width text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeTcp ? subEditConfig.host : ""
width: _secondColumn
anchors.verticalCenter: parent.verticalCenter
} }
Row { }
spacing: ScreenTools.defaultFontPixelWidth Row {
QGCLabel { spacing: ScreenTools.defaultFontPixelWidth
text: qsTr("Host Address:") QGCLabel {
width: _firstColumn text: qsTr("TCP Port:")
anchors.verticalCenter: parent.verticalCenter 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: qsTr("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
}
} }
QGCCheckBox { QGCTextField {
text: "High Latency" id: portField
checked: false text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeTcp ? subEditConfig.port.toString() : ""
visible: editConfig ? editConfig.highLatencyAllowed : false width: _firstColumn
onCheckedChanged: { inputMethodHints: Qt.ImhFormattedNumbersOnly
if(editConfig) { anchors.verticalCenter: parent.verticalCenter
editConfig.highLatency = checked
}
}
Component.onCompleted: {
if(editConfig)
checked = editConfig.highLatency
}
} }
} }
} }
This diff is collapsed.
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