Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
c6f4d7fb
Commit
c6f4d7fb
authored
Dec 09, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up comm link settings
parent
cafc8cee
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
706 additions
and
782 deletions
+706
-782
ScreenTools.qml
src/QmlControls/ScreenTools.qml
+13
-12
ScreenToolsController.h
src/QmlControls/ScreenToolsController.h
+16
-9
BluetoothLink.cc
src/comm/BluetoothLink.cc
+23
-13
BluetoothLink.h
src/comm/BluetoothLink.h
+1
-0
LinkConfiguration.h
src/comm/LinkConfiguration.h
+9
-1
LogReplayLink.h
src/comm/LogReplayLink.h
+1
-0
MockLink.h
src/comm/MockLink.h
+1
-0
SerialLink.h
src/comm/SerialLink.h
+1
-0
TCPLink.h
src/comm/TCPLink.h
+1
-0
UDPLink.h
src/comm/UDPLink.h
+1
-0
BluetoothSettings.qml
src/ui/preferences/BluetoothSettings.qml
+89
-120
LinkSettings.qml
src/ui/preferences/LinkSettings.qml
+166
-98
LogReplaySettings.qml
src/ui/preferences/LogReplaySettings.qml
+31
-45
MockLinkSettings.qml
src/ui/preferences/MockLinkSettings.qml
+50
-72
SerialSettings.qml
src/ui/preferences/SerialSettings.qml
+170
-208
TcpSettings.qml
src/ui/preferences/TcpSettings.qml
+27
-61
UdpSettings.qml
src/ui/preferences/UdpSettings.qml
+106
-143
No files found.
src/QmlControls/ScreenTools.qml
View file @
c6f4d7fb
...
@@ -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
))
...
...
src/QmlControls/ScreenToolsController.h
View file @
c6f4d7fb
...
@@ -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
...
...
src/comm/BluetoothLink.cc
View file @
c6f4d7fb
...
@@ -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
();
}
}
}
}
...
...
src/comm/BluetoothLink.h
View file @
c6f4d7fb
...
@@ -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
);
...
...
src/comm/LinkConfiguration.h
View file @
c6f4d7fb
...
@@ -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
...
...
src/comm/LogReplayLink.h
View file @
c6f4d7fb
...
@@ -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
();
...
...
src/comm/MockLink.h
View file @
c6f4d7fb
...
@@ -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
();
...
...
src/comm/SerialLink.h
View file @
c6f4d7fb
...
@@ -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
();
...
...
src/comm/TCPLink.h
View file @
c6f4d7fb
...
@@ -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
();
...
...
src/comm/UDPLink.h
View file @
c6f4d7fb
...
@@ -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
();
...
...
src/ui/preferences/BluetoothSettings.qml
View file @
c6f4d7fb
...
@@ -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 {
}
}
}
}
}
}
src/ui/preferences/LinkSettings.qml
View file @
c6f4d7fb
...
@@ -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,116 +201,168 @@ Rectangle {
...
@@ -185,116 +201,168 @@ 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
QGCLabel
{
//-----------------------------------------------------------------
text
:
linkConfig
?
qsTr
(
"
Edit Link Configuration Settings (WIP)
"
)
:
qsTr
(
"
Create New Link Configuration (WIP)
"
)
//-- General
font.pointSize
:
ScreenTools
.
mediumFontPointSize
}
Rectangle
{
height
:
1
width
:
parent
.
width
color
:
qgcPal
.
button
}
Item
{
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
_panelWidth
width
:
parent
.
width
height
:
generalLabel
.
height
}
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
Row
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
QGCLabel
{
text
:
qsTr
(
"
Name:
"
)
id
:
generalLabel
width
:
_firstColumn
text
:
qsTr
(
"
General
"
)
anchors.verticalCenter
:
parent
.
verticalCenter
font.family
:
ScreenTools
.
demiboldFontFamily
}
QGCTextField
{
id
:
nameField
text
:
editConfig
?
editConfig
.
name
:
""
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
}
Row
{
Rectangle
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
height
:
generalCol
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
QGCLabel
{
width
:
_panelWidth
text
:
qsTr
(
"
Type:
"
)
color
:
qgcPal
.
windowShade
width
:
_firstColumn
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
Column
{
//-----------------------------------------------------
id
:
generalCol
// When editing, you can't change the link type
anchors.centerIn
:
parent
QGCLabel
{
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
text
:
linkConfig
?
QGroundControl
.
linkManager
.
linkTypeStrings
[
linkConfig
.
linkType
]
:
""
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
visible
:
linkConfig
!=
null
Row
{
width
:
_secondColumn
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
Component.onCompleted
:
{
text
:
qsTr
(
"
Name:
"
)
if
(
linkConfig
!=
null
)
{
width
:
_firstColumn
linkSettingLoader
.
source
=
linkConfig
.
settingsURL
anchors.verticalCenter
:
parent
.
verticalCenter
linkSettingLoader
.
visible
=
true
}
QGCTextField
{
id
:
nameField
text
:
editConfig
?
editConfig
.
name
:
""
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
}
}
Row
{
//-----------------------------------------------------
spacing
:
ScreenTools
.
defaultFontPixelWidth
// When creating, select a link type
QGCLabel
{
QGCComboBox
{
text
:
qsTr
(
"
Type:
"
)
id
:
linkTypeCombo
width
:
_firstColumn
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
visible
:
linkConfig
==
null
}
model
:
QGroundControl
.
linkManager
.
linkTypeStrings
//-----------------------------------------------------
anchors.verticalCenter
:
parent
.
verticalCenter
// When editing, you can't change the link type
onActivated
:
{
QGCLabel
{
if
(
index
!=
-
1
&&
index
!==
editConfig
.
linkType
)
{
text
:
linkConfig
?
QGroundControl
.
linkManager
.
linkTypeStrings
[
linkConfig
.
linkType
]
:
""
// Destroy current panel
visible
:
linkConfig
!=
null
linkSettingLoader
.
source
=
""
width
:
_secondColumn
linkSettingLoader
.
visible
=
false
anchors.verticalCenter
:
parent
.
verticalCenter
// Save current name
Component.onCompleted
:
{
var
name
=
editConfig
.
name
if
(
linkConfig
!=
null
)
{
// Discard link configuration (old type)
linkSettingLoader
.
source
=
linkConfig
.
settingsURL
QGroundControl
.
linkManager
.
cancelConfigurationEditing
(
editConfig
)
linkSettingLoader
.
visible
=
true
// Create new link configuration
}
editConfig
=
QGroundControl
.
linkManager
.
createConfiguration
(
index
,
name
)
}
// Load appropriate configuration panel
linkSettingLoader
.
source
=
editConfig
.
settingsURL
linkSettingLoader
.
visible
=
true
}
}
//-----------------------------------------------------
// When creating, select a link type
QGCComboBox
{
id
:
linkTypeCombo
width
:
_secondColumn
visible
:
linkConfig
==
null
model
:
QGroundControl
.
linkManager
.
linkTypeStrings
anchors.verticalCenter
:
parent
.
verticalCenter
onActivated
:
{
if
(
index
!=
-
1
&&
index
!==
editConfig
.
linkType
)
{
// Destroy current panel
linkSettingLoader
.
source
=
""
linkSettingLoader
.
visible
=
false
// Save current name
var
name
=
editConfig
.
name
// Discard link configuration (old type)
QGroundControl
.
linkManager
.
cancelConfigurationEditing
(
editConfig
)
// Create new link configuration
editConfig
=
QGroundControl
.
linkManager
.
createConfiguration
(
index
,
name
)
// Load appropriate configuration panel
linkSettingLoader
.
source
=
editConfig
.
settingsURL
linkSettingLoader
.
visible
=
true
}
}
Component
.
onCompleted
:
{
if
(
linkConfig
==
null
)
{
linkTypeCombo
.
currentIndex
=
0
linkSettingLoader
.
source
=
editConfig
.
settingsURL
linkSettingLoader
.
visible
=
true
}
}
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
width
:
parent
.
width
}
}
Component
.
onCompleted
:
{
//-- Auto Connect on Start
if
(
linkConfig
==
null
)
{
QGCCheckBox
{
linkTypeCombo
.
currentIndex
=
0
text
:
qsTr
(
"
Automatically Connect on Start
"
)
linkSettingLoader
.
source
=
editConfig
.
settingsURL
checked
:
false
linkSettingLoader
.
visible
=
true
enabled
:
editConfig
?
editConfig
.
autoConnectAllowed
:
false
onCheckedChanged
:
{
if
(
editConfig
)
{
editConfig
.
autoConnect
=
checked
}
}
Component
.
onCompleted
:
{
if
(
editConfig
)
checked
=
editConfig
.
autoConnect
}
}
}
}
}
QGCCheckBox
{
}
text
:
qsTr
(
"
High Latency
"
)
Item
{
checked
:
false
height
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
enabled
:
editConfig
?
editConfig
.
highLatencyAllowed
:
false
width
:
parent
.
width
onCheckedChanged
:
{
}
if
(
editConfig
)
{
//-- Auto Connect on Start
editConfig
.
highLatency
=
checked
QGCCheckBox
{
}
text
:
"
Automatically Connect on Start
"
}
checked
:
false
Component
.
onCompleted
:
{
visible
:
editConfig
?
editConfig
.
autoConnectAllowed
:
false
if
(
editConfig
)
onCheckedChanged
:
{
checked
=
editConfig
.
highLatency
if
(
editConfig
)
{
}
editConfig
.
autoConnect
=
checked
}
}
}
}
Component
.
onCompleted
:
{
if
(
editConfig
)
checked
=
editConfig
.
autoConnect
}
}
}
Item
{
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
parent
.
width
width
:
parent
.
width
}
}
Loader
{
//-----------------------------------------------------------------
id
:
linkSettingLoader
//-- Link Specific Settings
width
:
parent
.
width
Item
{
visible
:
false
width
:
_panelWidth
property
var
subEditConfig
:
editConfig
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
{
id
:
linkSettingLoader
visible
:
false
property
var
subEditConfig
:
editConfig
}
}
}
}
}
}
}
}
...
...
src/ui/preferences/LogReplaySettings.qml
View file @
c6f4d7fb
...
@@ -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
}
}
}
}
}
}
src/ui/preferences/MockLinkSettings.qml
View file @
c6f4d7fb
...
@@ -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
}
}
QGC
CheckBox
{
QGC
RadioButton
{
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
}
}
}
}
}
}
}
src/ui/preferences/SerialSettings.qml
View file @
c6f4d7fb
...
@@ -17,251 +17,213 @@ import QGroundControl.Controls 1.0
...
@@ -17,251 +17,213 @@ 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
}
}
Row
{
Column
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
id
:
serialColumn
width
:
serialLinkSettings
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
QGCLabel
{
id
:
serialLabel
text
:
qsTr
(
"
Serial Port:
"
)
text
:
qsTr
(
"
Serial Link Settings
"
)
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Rectangle
{
QGCLabel
{
height
:
1
text
:
qsTr
(
"
No serial ports available
"
);
width
:
serialLabel
.
width
visible
:
QGroundControl
.
linkManager
.
serialPortStrings
.
length
===
0
color
:
qgcPal
.
button
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
}
Row
{
QGCComboBox
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
id
:
commPortCombo
QGCLabel
{
width
:
_secondColumn
text
:
qsTr
(
"
Serial Port:
"
)
visible
:
QGroundControl
.
linkManager
.
serialPortStrings
.
length
>
0
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCLabel
{
text
:
qsTr
(
"
No serial ports available
"
);
visible
:
QGroundControl
.
linkManager
.
serialPortStrings
.
length
==
0
}
QGCComboBox
{
id
:
commPortCombo
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
_secondColumn
visible
:
QGroundControl
.
linkManager
.
serialPortStrings
.
length
>
0
onActivated
:
{
onActivated
:
{
if
(
index
!=
-
1
)
{
if
(
index
!=
-
1
)
{
if
(
index
>=
QGroundControl
.
linkManager
.
serialPortStrings
.
length
)
{
if
(
index
>=
QGroundControl
.
linkManager
.
serialPortStrings
.
length
)
{
// This item was adding at the end, must use added text as name
// This item was adding at the end, must use added text as name
subEditConfig
.
portName
=
commPortCombo
.
textAt
(
index
)
subEditConfig
.
portName
=
commPortCombo
.
textAt
(
index
)
}
else
{
subEditConfig
.
portName
=
QGroundControl
.
linkManager
.
serialPorts
[
index
]
}
}
}
Component
.
onCompleted
:
{
var
index
var
serialPorts
=
[
]
for
(
var
i
=
0
;
i
<
QGroundControl
.
linkManager
.
serialPortStrings
.
length
;
i
++
)
{
serialPorts
.
push
(
QGroundControl
.
linkManager
.
serialPortStrings
[
i
])
}
if
(
subEditConfig
!=
null
)
{
if
(
subEditConfig
.
portDisplayName
===
""
&&
QGroundControl
.
linkManager
.
serialPorts
.
length
>
0
)
{
subEditConfig
.
portName
=
QGroundControl
.
linkManager
.
serialPorts
[
0
]
}
index
=
serialPorts
.
indexOf
(
subEditConfig
.
portDisplayName
)
if
(
index
===
-
1
)
{
serialPorts
.
push
(
subEditConfig
.
portName
)
index
=
serialPorts
.
indexOf
(
subEditConfig
.
portName
)
}
}
else
{
}
else
{
index
=
0
subEditConfig
.
portName
=
QGroundControl
.
linkManager
.
serialPorts
[
index
]
}
}
commPortCombo
.
model
=
serialPorts
commPortCombo
.
currentIndex
=
index
}
}
}
}
}
Component
.
onCompleted
:
{
Row
{
var
index
spacing
:
ScreenTools
.
defaultFontPixelWidth
var
serialPorts
=
[
]
QGCLabel
{
for
(
var
i
=
0
;
i
<
QGroundControl
.
linkManager
.
serialPortStrings
.
length
;
i
++
)
{
text
:
qsTr
(
"
Baud Rate:
"
)
serialPorts
.
push
(
QGroundControl
.
linkManager
.
serialPortStrings
[
i
])
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
:
{
if
(
subEditConfig
!=
null
)
{
var
baud
=
"
57600
"
if
(
subEditConfig
.
portDisplayName
===
""
&&
QGroundControl
.
linkManager
.
serialPorts
.
length
>
0
)
{
if
(
subEditConfig
!=
null
)
{
subEditConfig
.
portName
=
QGroundControl
.
linkManager
.
serialPorts
[
0
]
baud
=
subEditConfig
.
baud
.
toString
()
}
}
var
index
=
baudCombo
.
find
(
baud
)
index
=
serialPorts
.
indexOf
(
subEditConfig
.
portDisplayName
)
if
(
index
===
-
1
)
{
if
(
index
===
-
1
)
{
console
.
warn
(
qsTr
(
"
Baud rate name not in combo box
"
),
baud
)
serialPorts
.
push
(
subEditConfig
.
portName
)
}
else
{
index
=
serialPorts
.
indexOf
(
subEditConfig
.
portName
)
baudCombo
.
currentIndex
=
index
}
}
}
else
{
index
=
0
}
}
commPortCombo
.
model
=
serialPorts
commPortCombo
.
currentIndex
=
index
}
}
}
}
Item
{
}
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
Row
{
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelWidth
}
QGCLabel
{
//-----------------------------------------------------------------
text
:
qsTr
(
"
Baud Rate:
"
)
//-- Advanced Serial Settings
width
:
_firstColumn
QGCCheckBox
{
anchors.verticalCenter
:
parent
.
verticalCenter
id
:
showAdvanced
text
:
qsTr
(
"
Show Advanced Serial Settings
"
)
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
}
//-- Flow Control
QGCComboBox
{
QGCCheckBox
{
id
:
baudCombo
text
:
qsTr
(
"
Enable Flow Control
"
)
width
:
_secondColumn
checked
:
subEditConfig
?
subEditConfig
.
flowControl
!==
0
:
false
model
:
QGroundControl
.
linkManager
.
serialBaudRates
visible
:
showAdvanced
.
checked
anchors.verticalCenter
:
parent
.
verticalCenter
on
CheckedChang
ed
:
{
on
Activat
ed
:
{
if
(
subEditConfig
)
{
if
(
index
!=
-
1
)
{
subEditConfig
.
flowControl
=
checked
?
1
:
0
subEditConfig
.
baud
=
parseInt
(
QGroundControl
.
linkManager
.
serialBaudRates
[
index
])
}
}
}
}
}
Component
.
onCompleted
:
{
//-- Parity
var
baud
=
"
57600
"
Row
{
if
(
subEditConfig
!=
null
)
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
baud
=
subEditConfig
.
baud
.
toString
()
visible
:
showAdvanced
.
checked
QGCLabel
{
text
:
qsTr
(
"
Parity:
"
)
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCComboBox
{
id
:
parityCombo
width
:
_firstColumn
model
:
[
qsTr
(
"
None
"
),
qsTr
(
"
Even
"
),
qsTr
(
"
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
=
baudCombo
.
find
(
baud
)
var
index
=
0
if
(
index
===
-
1
)
{
if
(
subEditConfig
!=
null
)
{
console
.
warn
(
qsTr
(
"
Baud rate name not in combo box
"
),
baud
)
index
=
subEditConfig
.
parity
}
else
{
}
baudCombo
.
currentIndex
=
index
if
(
index
>
1
)
{
index
=
index
-
2
}
parityCombo
.
currentIndex
=
index
}
}
}
}
}
}
//-- Data Bits
}
Row
{
Item
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
visible
:
showAdvanced
.
checked
width
:
parent
.
width
QGCLabel
{
}
text
:
"
Data Bits:
"
//-----------------------------------------------------------------
width
:
_firstColumn
//-- Advanced Serial Settings
anchors.verticalCenter
:
parent
.
verticalCenter
QGCCheckBox
{
id
:
showAdvanced
text
:
qsTr
(
"
Show Advanced Serial Settings
"
)
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
//-- Flow Control
QGCCheckBox
{
text
:
qsTr
(
"
Enable Flow Control
"
)
checked
:
subEditConfig
?
subEditConfig
.
flowControl
!==
0
:
false
visible
:
showAdvanced
.
checked
onCheckedChanged
:
{
if
(
subEditConfig
)
{
subEditConfig
.
flowControl
=
checked
?
1
:
0
}
}
QGCComboBox
{
}
id
:
dataCombo
}
width
:
_firstColumn
//-- Parity
model
:
[
"
5
"
,
"
6
"
,
"
7
"
,
"
8
"
]
Row
{
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
ScreenTools
.
defaultFontPixelWidth
onActivated
:
{
visible
:
showAdvanced
.
checked
if
(
index
!=
-
1
)
{
QGCLabel
{
subEditConfig
.
dataBits
=
index
+
5
text
:
qsTr
(
"
Parity:
"
)
}
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCComboBox
{
id
:
parityCombo
width
:
_firstColumn
model
:
[
qsTr
(
"
None
"
),
qsTr
(
"
Even
"
),
qsTr
(
"
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
=
3
Component
.
onCompleted
:
{
if
(
subEditConfig
!=
null
)
{
var
index
=
0
index
=
subEditConfig
.
parity
-
5
if
(
subEditConfig
!=
null
)
{
if
(
index
<
0
)
index
=
subEditConfig
.
parity
index
=
3
}
}
if
(
index
>
1
)
{
dataCombo
.
currentIndex
=
index
index
=
index
-
2
}
}
parityCombo
.
currentIndex
=
index
}
}
}
}
//-- Stop Bits
}
Row
{
//-- Data Bits
spacing
:
ScreenTools
.
defaultFontPixelWidth
Row
{
visible
:
showAdvanced
.
checked
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
visible
:
showAdvanced
.
checked
text
:
qsTr
(
"
Stop Bits:
"
)
QGCLabel
{
width
:
_firstColumn
text
:
"
Data Bits:
"
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
_firstColumn
}
anchors.verticalCenter
:
parent
.
verticalCenter
QGCComboBox
{
}
id
:
stopCombo
QGCComboBox
{
width
:
_firstColumn
id
:
dataCombo
model
:
[
"
1
"
,
"
2
"
]
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
model
:
[
"
5
"
,
"
6
"
,
"
7
"
,
"
8
"
]
onActivated
:
{
anchors.verticalCenter
:
parent
.
verticalCenter
if
(
index
!=
-
1
)
{
onActivated
:
{
subEditConfig
.
stopBits
=
index
+
1
if
(
index
!=
-
1
)
{
}
subEditConfig
.
dataBits
=
index
+
5
}
}
Component
.
onCompleted
:
{
}
var
index
=
0
Component
.
onCompleted
:
{
if
(
subEditConfig
!=
null
)
{
var
index
=
3
index
=
subEditConfig
.
stopBits
-
1
if
(
subEditConfig
!=
null
)
{
if
(
index
<
0
)
index
=
subEditConfig
.
parity
-
5
index
=
0
if
(
index
<
0
)
}
index
=
3
stopCombo
.
currentIndex
=
index
}
}
dataCombo
.
currentIndex
=
index
}
}
}
}
QGCCheckBox
{
}
text
:
"
High Latency
"
//-- Stop Bits
checked
:
false
Row
{
visible
:
editConfig
?
editConfig
.
highLatencyAllowed
:
false
spacing
:
ScreenTools
.
defaultFontPixelWidth
onCheckedChanged
:
{
visible
:
showAdvanced
.
checked
if
(
editConfig
)
{
QGCLabel
{
editConfig
.
highLatency
=
checked
text
:
qsTr
(
"
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
:
{
Component
.
onCompleted
:
{
if
(
editConfig
)
var
index
=
0
checked
=
editConfig
.
highLatency
if
(
subEditConfig
!=
null
)
{
index
=
subEditConfig
.
stopBits
-
1
if
(
index
<
0
)
index
=
0
}
stopCombo
.
currentIndex
=
index
}
}
}
}
}
}
...
...
src/ui/preferences/TcpSettings.qml
View file @
c6f4d7fb
...
@@ -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
}
}
}
}
}
}
}
src/ui/preferences/UdpSettings.qml
View file @
c6f4d7fb
...
@@ -17,177 +17,140 @@ import QGroundControl.Controls 1.0
...
@@ -17,177 +17,140 @@ 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
{
ExclusiveGroup
{
id
:
linkGroup
}
id
:
udpColumn
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
ExclusiveGroup
{
id
:
linkGroup
}
QGCPalette
{
id
:
qgcPal
colorGroupEnabled
:
enabled
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
QGCLabel
{
id
:
udpLabel
text
:
qsTr
(
"
Listening Port:
"
)
text
:
qsTr
(
"
UDP Link Settings
"
)
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Rectangle
{
QGCTextField
{
height
:
1
id
:
portField
width
:
udpLabel
.
width
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
?
subEditConfig
.
localPort
.
toString
()
:
""
color
:
qgcPal
.
button
focus
:
true
}
width
:
_firstColumn
Item
{
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
parent
.
width
onTextChanged
:
{
if
(
subEditConfig
)
{
subEditConfig
.
localPort
=
parseInt
(
portField
.
text
)
}
}
}
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
QGCLabel
{
text
:
qsTr
(
"
Target Hosts:
"
)
}
Item
{
width
:
hostRow
.
width
height
:
hostRow
.
height
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
id
:
hostRow
QGCLabel
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
text
:
qsTr
(
"
Listening Port:
"
)
Item
{
height
:
1
width
:
_firstColumn
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
QGCTextField
{
Column
{
id
:
portField
id
:
hostColumn
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
?
subEditConfig
.
localPort
.
toString
()
:
""
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
focus
:
true
Rectangle
{
width
:
_firstColumn
height
:
1
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
qgcPal
.
button
onTextChanged
:
{
visible
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
&&
subEditConfig
.
hostList
.
length
>
0
if
(
subEditConfig
)
{
}
subEditConfig
.
localPort
=
parseInt
(
portField
.
text
)
Repeater
{
model
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
?
subEditConfig
.
hostList
:
""
delegate
:
QGCButton
{
text
:
modelData
width
:
_secondColumn
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
exclusiveGroup
:
linkGroup
onClicked
:
{
checked
=
true
_udpSetting
.
_currentHost
=
modelData
}
}
}
}
}
}
QGCTextField
{
}
id
:
hostField
Item
{
focus
:
true
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
visible
:
false
width
:
parent
.
width
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
}
onEditingFinished
:
{
QGCLabel
{
if
(
subEditConfig
)
{
text
:
qsTr
(
"
Target Hosts:
"
)
if
(
hostField
.
text
!==
""
)
{
}
subEditConfig
.
addHost
(
hostField
.
text
)
Item
{
hostField
.
text
=
""
width
:
hostRow
.
width
}
height
:
hostRow
.
height
hostField
.
visible
=
false
Row
{
}
id
:
hostRow
}
spacing
:
ScreenTools
.
defaultFontPixelWidth
Keys
.
onReleased
:
{
Item
{
if
(
event
.
key
===
Qt
.
Key_Escape
)
{
hostField
.
text
=
""
hostField
.
visible
=
false
}
}
}
Rectangle
{
height
:
1
height
:
1
width
:
_firstColumn
width
:
_secondColumn
color
:
qgcPal
.
button
}
}
Column
{
Item
{
id
:
hostColumn
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
Rectangle
{
}
height
:
1
Item
{
width
:
_secondColumn
width
:
_secondColumn
color
:
qgcPal
.
button
height
:
udpButtonRow
.
height
visible
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
&&
subEditConfig
.
hostList
.
length
>
0
Row
{
}
id
:
udpButtonRow
Repeater
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
model
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
?
subEditConfig
.
hostList
:
""
anchors.horizontalCenter
:
parent
.
horizontalCenter
delegate
:
QGCButton
{
QGCButton
{
text
:
modelData
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
width
:
_secondColumn
text
:
qsTr
(
"
Add
"
)
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
exclusiveGroup
:
linkGroup
onClicked
:
{
onClicked
:
{
checked
=
true
if
(
hostField
.
visible
&&
hostField
.
text
!==
""
)
{
_udpSetting
.
_currentHost
=
modelData
}
}
}
QGCTextField
{
id
:
hostField
focus
:
true
visible
:
false
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
onEditingFinished
:
{
if
(
subEditConfig
)
{
if
(
hostField
.
text
!==
""
)
{
subEditConfig
.
addHost
(
hostField
.
text
)
subEditConfig
.
addHost
(
hostField
.
text
)
hostField
.
text
=
""
hostField
.
text
=
""
}
hostField
.
visible
=
false
hostField
.
visible
=
false
}
else
}
hostField
.
visible
=
true
}
Keys
.
onReleased
:
{
if
(
event
.
key
===
Qt
.
Key_Escape
)
{
hostField
.
text
=
""
hostField
.
visible
=
false
}
}
}
}
}
QGCButton
{
Rectangle
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
height
:
1
enabled
:
_udpSetting
.
_currentHost
&&
_udpSetting
.
_currentHost
!==
""
width
:
_secondColumn
text
:
qsTr
(
"
Remove
"
)
color
:
qgcPal
.
button
onClicked
:
{
}
subEditConfig
.
removeHost
(
_udpSetting
.
_currentHost
)
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
Item
{
width
:
_secondColumn
height
:
udpButtonRow
.
height
Row
{
id
:
udpButtonRow
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCButton
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
qsTr
(
"
Add
"
)
onClicked
:
{
if
(
hostField
.
visible
&&
hostField
.
text
!==
""
)
{
subEditConfig
.
addHost
(
hostField
.
text
)
hostField
.
text
=
""
hostField
.
visible
=
false
}
else
hostField
.
visible
=
true
}
}
QGCButton
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
enabled
:
_udpSetting
.
_currentHost
&&
_udpSetting
.
_currentHost
!==
""
text
:
qsTr
(
"
Remove
"
)
onClicked
:
{
subEditConfig
.
removeHost
(
_udpSetting
.
_currentHost
)
}
}
}
}
}
}
}
}
}
}
}
}
}
QGCCheckBox
{
text
:
"
High Latency
"
checked
:
false
visible
:
editConfig
?
editConfig
.
highLatencyAllowed
:
false
onCheckedChanged
:
{
if
(
editConfig
)
{
editConfig
.
highLatency
=
checked
}
}
Component
.
onCompleted
:
{
if
(
editConfig
)
checked
=
editConfig
.
highLatency
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment