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
065d8daf
Commit
065d8daf
authored
9 years ago
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding UDP, TCP and Log Replay Settings
parent
7e110aa4
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
357 additions
and
86 deletions
+357
-86
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
LinkConfiguration.h
src/comm/LinkConfiguration.h
+13
-5
LogReplayLink.h
src/comm/LogReplayLink.h
+12
-6
TCPLink.cc
src/comm/TCPLink.cc
+24
-19
TCPLink.h
src/comm/TCPLink.h
+9
-0
UDPLink.cc
src/comm/UDPLink.cc
+18
-3
UDPLink.h
src/comm/UDPLink.h
+18
-2
LinkSettings.qml
src/ui/preferences/LinkSettings.qml
+74
-51
UdpSettings.qml
src/ui/preferences/UdpSettings.qml
+188
-0
No files found.
qgroundcontrol.qrc
View file @
065d8daf
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="GeneralSettings.qml">src/ui/preferences/GeneralSettings.qml</file>
<file alias="GeneralSettings.qml">src/ui/preferences/GeneralSettings.qml</file>
<file alias="LinkSettings.qml">src/ui/preferences/LinkSettings.qml</file>
<file alias="LinkSettings.qml">src/ui/preferences/LinkSettings.qml</file>
<file alias="UdpSettings.qml">src/ui/preferences/UdpSettings.qml</file>
<file alias="JoystickConfig.qml">src/VehicleSetup/JoystickConfig.qml</file>
<file alias="JoystickConfig.qml">src/VehicleSetup/JoystickConfig.qml</file>
<file alias="MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
...
...
This diff is collapsed.
Click to expand it.
src/comm/LinkConfiguration.h
View file @
065d8daf
...
@@ -45,6 +45,7 @@ public:
...
@@ -45,6 +45,7 @@ public:
Q_PROPERTY
(
LinkType
linkType
READ
type
CONSTANT
)
Q_PROPERTY
(
LinkType
linkType
READ
type
CONSTANT
)
Q_PROPERTY
(
bool
dynamic
READ
isDynamic
WRITE
setDynamic
NOTIFY
dynamicChanged
)
Q_PROPERTY
(
bool
dynamic
READ
isDynamic
WRITE
setDynamic
NOTIFY
dynamicChanged
)
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
)
// Property accessors
// Property accessors
...
@@ -98,6 +99,13 @@ public:
...
@@ -98,6 +99,13 @@ public:
/// Virtual Methods
/// Virtual Methods
/*!
*
* Is Auto Connect allowed for this type?
* @return True if this type can be set as an Auto Connect configuration
*/
virtual
bool
isAutoConnectAllowed
()
{
return
true
;
}
/*!
/*!
* @brief Connection type
* @brief Connection type
*
*
...
...
This diff is collapsed.
Click to expand it.
src/comm/LogReplayLink.h
View file @
065d8daf
...
@@ -36,20 +36,26 @@ class LogReplayLinkConfiguration : public LinkConfiguration
...
@@ -36,20 +36,26 @@ class LogReplayLinkConfiguration : public LinkConfiguration
Q_OBJECT
Q_OBJECT
public:
public:
Q_PROPERTY
(
QString
fileName
READ
logFilename
WRITE
setLogFilename
NOTIFY
fileNameChanged
)
LogReplayLinkConfiguration
(
const
QString
&
name
);
LogReplayLinkConfiguration
(
const
QString
&
name
);
LogReplayLinkConfiguration
(
LogReplayLinkConfiguration
*
copy
);
LogReplayLinkConfiguration
(
LogReplayLinkConfiguration
*
copy
);
QString
logFilename
(
void
)
{
return
_logFilename
;
}
QString
logFilename
(
void
)
{
return
_logFilename
;
}
void
setLogFilename
(
const
QString
&
logFilename
)
{
_logFilename
=
logFilename
;
}
void
setLogFilename
(
const
QString
&
logFilename
)
{
_logFilename
=
logFilename
;
emit
fileNameChanged
();
}
QString
logFilenameShort
(
void
);
QString
logFilenameShort
(
void
);
// Virtuals from LinkConfiguration
// Virtuals from LinkConfiguration
virtual
LinkType
type
()
{
return
LinkConfiguration
::
TypeLogReplay
;
}
LinkType
type
()
{
return
LinkConfiguration
::
TypeLogReplay
;
}
virtual
void
copyFrom
(
LinkConfiguration
*
source
);
void
copyFrom
(
LinkConfiguration
*
source
);
virtual
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
virtual
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
virtual
void
updateSettings
();
void
updateSettings
();
bool
isAutoConnectAllowed
()
{
return
false
;
}
signals:
void
fileNameChanged
();
private:
private:
static
const
char
*
_logFilenameKey
;
static
const
char
*
_logFilenameKey
;
...
...
This diff is collapsed.
Click to expand it.
src/comm/TCPLink.cc
View file @
065d8daf
...
@@ -268,6 +268,11 @@ void TCPConfiguration::setAddress(const QHostAddress& address)
...
@@ -268,6 +268,11 @@ void TCPConfiguration::setAddress(const QHostAddress& address)
_address
=
address
;
_address
=
address
;
}
}
void
TCPConfiguration
::
setHost
(
const
QString
host
)
{
_address
=
host
;
}
void
TCPConfiguration
::
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
)
void
TCPConfiguration
::
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
)
{
{
settings
.
beginGroup
(
root
);
settings
.
beginGroup
(
root
);
...
...
This diff is collapsed.
Click to expand it.
src/comm/TCPLink.h
View file @
065d8daf
...
@@ -56,6 +56,9 @@ class TCPConfiguration : public LinkConfiguration
...
@@ -56,6 +56,9 @@ class TCPConfiguration : public LinkConfiguration
public:
public:
Q_PROPERTY
(
quint16
port
READ
port
WRITE
setPort
NOTIFY
portChanged
)
Q_PROPERTY
(
QString
host
READ
host
WRITE
setHost
NOTIFY
hostChanged
)
/*!
/*!
* @brief Regular constructor
* @brief Regular constructor
*
*
...
@@ -94,6 +97,7 @@ public:
...
@@ -94,6 +97,7 @@ public:
* @return Host address
* @return Host address
*/
*/
const
QHostAddress
&
address
()
{
return
_address
;
}
const
QHostAddress
&
address
()
{
return
_address
;
}
const
QString
host
()
{
return
_address
.
toString
();
}
/*!
/*!
* @brief Set the host address
* @brief Set the host address
...
@@ -101,6 +105,7 @@ public:
...
@@ -101,6 +105,7 @@ public:
* @param[in] address Host address
* @param[in] address Host address
*/
*/
void
setAddress
(
const
QHostAddress
&
address
);
void
setAddress
(
const
QHostAddress
&
address
);
void
setHost
(
const
QString
host
);
/// From LinkConfiguration
/// From LinkConfiguration
LinkType
type
()
{
return
LinkConfiguration
::
TypeTcp
;
}
LinkType
type
()
{
return
LinkConfiguration
::
TypeTcp
;
}
...
@@ -109,6 +114,10 @@ public:
...
@@ -109,6 +114,10 @@ public:
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
void
updateSettings
();
signals:
void
portChanged
();
void
hostChanged
();
private:
private:
QHostAddress
_address
;
QHostAddress
_address
;
quint16
_port
;
quint16
_port
;
...
...
This diff is collapsed.
Click to expand it.
src/comm/UDPLink.cc
View file @
065d8daf
...
@@ -406,9 +406,9 @@ UDPConfiguration::UDPConfiguration(const QString& name) : LinkConfiguration(name
...
@@ -406,9 +406,9 @@ UDPConfiguration::UDPConfiguration(const QString& name) : LinkConfiguration(name
UDPConfiguration
::
UDPConfiguration
(
UDPConfiguration
*
source
)
:
LinkConfiguration
(
source
)
UDPConfiguration
::
UDPConfiguration
(
UDPConfiguration
*
source
)
:
LinkConfiguration
(
source
)
{
{
_localPort
=
source
->
localPort
();
_localPort
=
source
->
localPort
();
_hosts
.
clear
();
QString
host
;
QString
host
;
int
port
;
int
port
;
_hostList
.
clear
();
if
(
source
->
firstHost
(
host
,
port
))
{
if
(
source
->
firstHost
(
host
,
port
))
{
do
{
do
{
addHost
(
host
,
port
);
addHost
(
host
,
port
);
...
@@ -435,7 +435,7 @@ void UDPConfiguration::copyFrom(LinkConfiguration *source)
...
@@ -435,7 +435,7 @@ void UDPConfiguration::copyFrom(LinkConfiguration *source)
/**
/**
* @param host Hostname in standard formatt, e.g. localhost:14551 or 192.168.1.1:14551
* @param host Hostname in standard formatt, e.g. localhost:14551 or 192.168.1.1:14551
*/
*/
void
UDPConfiguration
::
addHost
(
const
QString
&
host
)
void
UDPConfiguration
::
addHost
(
const
QString
host
)
{
{
// Handle x.x.x.x:p
// Handle x.x.x.x:p
if
(
host
.
contains
(
":"
))
if
(
host
.
contains
(
":"
))
...
@@ -495,9 +495,10 @@ void UDPConfiguration::addHost(const QString& host, int port)
...
@@ -495,9 +495,10 @@ void UDPConfiguration::addHost(const QString& host, int port)
}
}
}
}
}
}
_updateHostList
();
}
}
void
UDPConfiguration
::
removeHost
(
const
QString
&
host
)
void
UDPConfiguration
::
removeHost
(
const
QString
host
)
{
{
QMutexLocker
locker
(
&
_confMutex
);
QMutexLocker
locker
(
&
_confMutex
);
QString
tHost
=
host
;
QString
tHost
=
host
;
...
@@ -512,6 +513,7 @@ void UDPConfiguration::removeHost(const QString& host)
...
@@ -512,6 +513,7 @@ void UDPConfiguration::removeHost(const QString& host)
}
else
{
}
else
{
qWarning
()
<<
"UDP:"
<<
"Could not remove unknown host:"
<<
host
;
qWarning
()
<<
"UDP:"
<<
"Could not remove unknown host:"
<<
host
;
}
}
_updateHostList
();
}
}
bool
UDPConfiguration
::
firstHost
(
QString
&
host
,
int
&
port
)
bool
UDPConfiguration
::
firstHost
(
QString
&
host
,
int
&
port
)
...
@@ -579,6 +581,7 @@ void UDPConfiguration::loadSettings(QSettings& settings, const QString& root)
...
@@ -579,6 +581,7 @@ void UDPConfiguration::loadSettings(QSettings& settings, const QString& root)
}
}
}
}
settings
.
endGroup
();
settings
.
endGroup
();
_updateHostList
();
}
}
void
UDPConfiguration
::
updateSettings
()
void
UDPConfiguration
::
updateSettings
()
...
@@ -590,3 +593,15 @@ void UDPConfiguration::updateSettings()
...
@@ -590,3 +593,15 @@ void UDPConfiguration::updateSettings()
}
}
}
}
}
}
void
UDPConfiguration
::
_updateHostList
()
{
_hostList
.
clear
();
QMap
<
QString
,
int
>::
const_iterator
it
=
_hosts
.
begin
();
while
(
it
!=
_hosts
.
end
())
{
QString
host
=
QString
(
"%1"
).
arg
(
it
.
key
())
+
":"
+
QString
(
"%1"
).
arg
(
it
.
value
());
_hostList
+=
host
;
it
++
;
}
emit
hostListChanged
();
}
This diff is collapsed.
Click to expand it.
src/comm/UDPLink.h
View file @
065d8daf
...
@@ -56,6 +56,9 @@ class UDPConfiguration : public LinkConfiguration
...
@@ -56,6 +56,9 @@ class UDPConfiguration : public LinkConfiguration
public:
public:
Q_PROPERTY
(
quint16
localPort
READ
localPort
WRITE
setLocalPort
NOTIFY
localPortChanged
)
Q_PROPERTY
(
QStringList
hostList
READ
hostList
NOTIFY
hostListChanged
)
/*!
/*!
* @brief Regular constructor
* @brief Regular constructor
*
*
...
@@ -111,7 +114,7 @@ public:
...
@@ -111,7 +114,7 @@ public:
*
*
* @param[in] host Host name in standard formatt, e.g. localhost:14551 or 192.168.1.1:14551
* @param[in] host Host name in standard formatt, e.g. localhost:14551 or 192.168.1.1:14551
*/
*/
void
addHost
(
const
QString
&
host
);
Q_INVOKABLE
void
addHost
(
const
QString
host
);
/*!
/*!
* @brief Add a target host
* @brief Add a target host
...
@@ -126,7 +129,7 @@ public:
...
@@ -126,7 +129,7 @@ public:
*
*
* @param[in] host Host name, e.g. localhost or 192.168.1.1
* @param[in] host Host name, e.g. localhost or 192.168.1.1
*/
*/
void
removeHost
(
const
QString
&
host
);
Q_INVOKABLE
void
removeHost
(
const
QString
host
);
/*!
/*!
* @brief Set the UDP port we bind to
* @brief Set the UDP port we bind to
...
@@ -135,6 +138,11 @@ public:
...
@@ -135,6 +138,11 @@ public:
*/
*/
void
setLocalPort
(
quint16
port
);
void
setLocalPort
(
quint16
port
);
/*!
* @brief QML Interface
*/
QStringList
hostList
()
{
return
_hostList
;
}
/// From LinkConfiguration
/// From LinkConfiguration
LinkType
type
()
{
return
LinkConfiguration
::
TypeUdp
;
}
LinkType
type
()
{
return
LinkConfiguration
::
TypeUdp
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
copyFrom
(
LinkConfiguration
*
source
);
...
@@ -142,10 +150,18 @@ public:
...
@@ -142,10 +150,18 @@ public:
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
void
updateSettings
();
signals:
void
localPortChanged
();
void
hostListChanged
();
private:
void
_updateHostList
();
private:
private:
QMutex
_confMutex
;
QMutex
_confMutex
;
QMap
<
QString
,
int
>::
iterator
_it
;
QMap
<
QString
,
int
>::
iterator
_it
;
QMap
<
QString
,
int
>
_hosts
;
///< ("host", port)
QMap
<
QString
,
int
>
_hosts
;
///< ("host", port)
QStringList
_hostList
;
///< Exposed to QML
quint16
_localPort
;
quint16
_localPort
;
};
};
...
...
This diff is collapsed.
Click to expand it.
src/ui/preferences/LinkSettings.qml
View file @
065d8daf
...
@@ -263,7 +263,7 @@ Rectangle {
...
@@ -263,7 +263,7 @@ Rectangle {
if
(
index
===
LinkConfiguration
.
TypeSerial
)
if
(
index
===
LinkConfiguration
.
TypeSerial
)
linkSettingLoader
.
sourceComponent
=
serialLinkSettings
linkSettingLoader
.
sourceComponent
=
serialLinkSettings
if
(
index
===
LinkConfiguration
.
TypeUdp
)
if
(
index
===
LinkConfiguration
.
TypeUdp
)
linkSettingLoader
.
source
Component
=
udpLinkSettings
linkSettingLoader
.
source
=
"
UdpSettings.qml
"
if
(
index
===
LinkConfiguration
.
TypeTcp
)
if
(
index
===
LinkConfiguration
.
TypeTcp
)
linkSettingLoader
.
sourceComponent
=
tcpLinkSettings
linkSettingLoader
.
sourceComponent
=
tcpLinkSettings
if
(
index
===
LinkConfiguration
.
TypeMock
)
if
(
index
===
LinkConfiguration
.
TypeMock
)
...
@@ -284,6 +284,10 @@ Rectangle {
...
@@ -284,6 +284,10 @@ Rectangle {
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
onActivated
:
{
onActivated
:
{
if
(
index
!=
-
1
&&
index
!==
editConfig
.
linkType
)
{
if
(
index
!=
-
1
&&
index
!==
editConfig
.
linkType
)
{
// Destroy current panel
linkSettingLoader
.
sourceComponent
=
null
linkSettingLoader
.
source
=
""
linkSettingLoader
.
visible
=
false
// Save current name
// Save current name
var
name
=
editConfig
.
name
var
name
=
editConfig
.
name
// Discard link configuration (old type)
// Discard link configuration (old type)
...
@@ -291,17 +295,17 @@ Rectangle {
...
@@ -291,17 +295,17 @@ Rectangle {
// Create new link configuration
// Create new link configuration
editConfig
=
QGroundControl
.
linkManager
.
createConfiguration
(
index
,
name
)
editConfig
=
QGroundControl
.
linkManager
.
createConfiguration
(
index
,
name
)
// Load appropriate configuration panel
// Load appropriate configuration panel
linkSettingLoader
.
sourceComponent
=
null
if
(
index
===
LinkConfiguration
.
TypeSerial
)
if
(
index
===
LinkConfiguration
.
TypeSerial
)
linkSettingLoader
.
sourceComponent
=
serialLinkSettings
linkSettingLoader
.
sourceComponent
=
serialLinkSettings
if
(
index
===
LinkConfiguration
.
TypeUdp
)
if
(
index
===
LinkConfiguration
.
TypeUdp
)
linkSettingLoader
.
source
Component
=
udpLinkSettings
linkSettingLoader
.
source
=
"
UdpSettings.qml
"
if
(
index
===
LinkConfiguration
.
TypeTcp
)
if
(
index
===
LinkConfiguration
.
TypeTcp
)
linkSettingLoader
.
sourceComponent
=
tcpLinkSettings
linkSettingLoader
.
sourceComponent
=
tcpLinkSettings
if
(
index
===
LinkConfiguration
.
TypeMock
)
if
(
index
===
LinkConfiguration
.
TypeMock
)
linkSettingLoader
.
sourceComponent
=
mockLinkSettings
linkSettingLoader
.
sourceComponent
=
mockLinkSettings
if
(
index
===
LinkConfiguration
.
TypeLogReplay
)
if
(
index
===
LinkConfiguration
.
TypeLogReplay
)
linkSettingLoader
.
sourceComponent
=
logLinkSettings
linkSettingLoader
.
sourceComponent
=
logLinkSettings
linkSettingLoader
.
visible
=
true
}
}
}
}
Component
.
onCompleted
:
{
Component
.
onCompleted
:
{
...
@@ -311,7 +315,7 @@ Rectangle {
...
@@ -311,7 +315,7 @@ Rectangle {
if
(
index
===
LinkConfiguration
.
TypeSerial
)
if
(
index
===
LinkConfiguration
.
TypeSerial
)
linkSettingLoader
.
sourceComponent
=
serialLinkSettings
linkSettingLoader
.
sourceComponent
=
serialLinkSettings
if
(
index
===
LinkConfiguration
.
TypeUdp
)
if
(
index
===
LinkConfiguration
.
TypeUdp
)
linkSettingLoader
.
source
Component
=
udpLinkSettings
linkSettingLoader
.
source
=
"
UdpSettings.qml
"
if
(
index
===
LinkConfiguration
.
TypeTcp
)
if
(
index
===
LinkConfiguration
.
TypeTcp
)
linkSettingLoader
.
sourceComponent
=
tcpLinkSettings
linkSettingLoader
.
sourceComponent
=
tcpLinkSettings
if
(
index
===
LinkConfiguration
.
TypeMock
)
if
(
index
===
LinkConfiguration
.
TypeMock
)
...
@@ -331,6 +335,7 @@ Rectangle {
...
@@ -331,6 +335,7 @@ Rectangle {
QGCCheckBox
{
QGCCheckBox
{
text
:
"
Automatically Connect on Start
"
text
:
"
Automatically Connect on Start
"
checked
:
false
checked
:
false
enabled
:
editConfig
?
editConfig
.
autoConnectAllowed
:
false
onCheckedChanged
:
{
onCheckedChanged
:
{
if
(
editConfig
)
{
if
(
editConfig
)
{
editConfig
.
autoConnect
=
checked
editConfig
.
autoConnect
=
checked
...
@@ -362,8 +367,7 @@ Rectangle {
...
@@ -362,8 +367,7 @@ Rectangle {
QGCButton
{
QGCButton
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
"
OK
"
text
:
"
OK
"
//-- TODO: For now, only allow Serial (the only one completed)
enabled
:
nameField
.
text
!==
""
enabled
:
editConfig
&&
editConfig
.
linkType
===
LinkConfiguration
.
TypeSerial
onClicked
:
{
onClicked
:
{
// Save editting
// Save editting
editConfig
.
name
=
nameField
.
text
editConfig
.
name
=
nameField
.
text
...
@@ -599,42 +603,6 @@ Rectangle {
...
@@ -599,42 +603,6 @@ Rectangle {
}
}
}
}
//---------------------------------------------
//---------------------------------------------
// UDP Link Settings
Component
{
id
:
udpLinkSettings
Column
{
width
:
udpLinkSettings
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
id
:
udpLabel
text
:
"
UDP Link Settings
"
}
Rectangle
{
height
:
1
width
:
udpLabel
.
width
color
:
qgcPal
.
button
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
Listening Port:
"
width
:
_firstColumn
}
QGCLabel
{
text
:
"
14550
"
width
:
_secondColumn
}
}
QGCLabel
{
text
:
"
Target Hosts:
"
}
}
}
//---------------------------------------------
// TCP Link Settings
// TCP Link Settings
Component
{
Component
{
id
:
tcpLinkSettings
id
:
tcpLinkSettings
...
@@ -657,23 +625,40 @@ Rectangle {
...
@@ -657,23 +625,40 @@ Rectangle {
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
QGCLabel
{
text
:
"
TCP Port
:
"
text
:
"
Host Address
:
"
width
:
_firstColumn
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
QGCLabel
{
QGCTextField
{
text
:
"
5760
"
id
:
hostField
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeTcp
?
subEditConfig
.
host
:
""
width
:
_secondColumn
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
onTextChanged
:
{
if
(
subEditConfig
)
{
subEditConfig
.
host
=
hostField
.
text
}
}
}
}
}
}
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
QGCLabel
{
text
:
"
Host Address
:
"
text
:
"
TCP Port
:
"
width
:
_firstColumn
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCTextField
{
id
:
portField
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeTcp
?
subEditConfig
.
port
.
toString
()
:
""
width
:
_firstColumn
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
anchors.verticalCenter
:
parent
.
verticalCenter
onTextChanged
:
{
if
(
subEditConfig
)
{
subEditConfig
.
port
=
parseInt
(
portField
.
text
)
}
}
}
QGCLabel
{
text
:
"
0.0.0.0
"
width
:
_secondColumn
}
}
}
}
}
}
...
@@ -692,8 +677,46 @@ Rectangle {
...
@@ -692,8 +677,46 @@ Rectangle {
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
width
:
parent
.
width
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
Log File:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCTextField
{
id
:
logField
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeMock
?
subEditConfig
.
fileName
:
""
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
onTextChanged
:
{
if
(
subEditConfig
)
{
subEditConfig
.
filename
=
logField
.
text
}
}
}
QGCButton
{
QGCButton
{
text
:
"
Select Log File
"
text
:
"
Browse
"
onClicked
:
{
fileDialog
.
visible
=
true
}
}
}
FileDialog
{
id
:
fileDialog
title
:
"
Please choose a file
"
folder
:
shortcuts
.
home
visible
:
false
selectExisting
:
true
onAccepted
:
{
if
(
subEditConfig
)
{
subEditConfig
.
fileName
=
fileDialog
.
fileUrl
.
toString
().
replace
(
"
file://
"
,
""
)
}
fileDialog
.
visible
=
false
}
onRejected
:
{
fileDialog
.
visible
=
false
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/ui/preferences/UdpSettings.qml
0 → 100644
View file @
065d8daf
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
import
QtQuick
2.5
import
QtQuick
.
Controls
1.4
import
QtQuick
.
Dialogs
1.1
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
Item
{
id
:
_udpSetting
width
:
parent
?
parent
.
width
:
0
height
:
udpColumn
.
height
property
var
_currentHost
:
""
Column
{
id
:
udpColumn
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
ExclusiveGroup
{
id
:
linkGroup
}
QGCPalette
{
id
:
qgcPal
colorGroupEnabled
:
enabled
}
QGCLabel
{
id
:
udpLabel
text
:
"
UDP Link Settings
"
}
Rectangle
{
height
:
1
width
:
udpLabel
.
width
color
:
qgcPal
.
button
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
Listening Port:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCTextField
{
id
:
portField
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
?
subEditConfig
.
localPort
.
toString
()
:
""
focus
:
true
width
:
_firstColumn
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
anchors.verticalCenter
:
parent
.
verticalCenter
onTextChanged
:
{
if
(
subEditConfig
)
{
subEditConfig
.
localPort
=
parseInt
(
portField
.
text
)
}
}
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
QGCLabel
{
text
:
"
Target Hosts:
"
}
Item
{
width
:
hostRow
.
width
height
:
hostRow
.
height
Row
{
id
:
hostRow
spacing
:
ScreenTools
.
defaultFontPixelWidth
Item
{
height
:
1
width
:
_firstColumn
}
Column
{
id
:
hostColumn
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
Rectangle
{
height
:
1
width
:
_secondColumn
color
:
qgcPal
.
button
visible
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
&&
subEditConfig
.
hostList
.
length
>
0
}
Repeater
{
model
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeUdp
?
subEditConfig
.
hostList
:
""
delegate
:
QGCButton
{
text
:
modelData
width
:
_secondColumn
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
exclusiveGroup
:
linkGroup
onClicked
:
{
checked
=
true
_udpSetting
.
_currentHost
=
modelData
}
}
}
QGCTextField
{
id
:
hostField
focus
:
true
visible
:
false
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
onEditingFinished
:
{
if
(
subEditConfig
)
{
if
(
hostField
.
text
!==
""
)
{
subEditConfig
.
addHost
(
hostField
.
text
)
hostField
.
text
=
""
}
hostField
.
visible
=
false
}
}
Keys
.
onReleased
:
{
if
(
event
.
key
===
Qt
.
Key_Escape
)
{
hostField
.
text
=
""
hostField
.
visible
=
false
}
}
}
Rectangle
{
height
:
1
width
:
_secondColumn
color
:
qgcPal
.
button
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
Item
{
width
:
_secondColumn
height
:
udpButtonRow
.
height
Row
{
id
:
udpButtonRow
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCButton
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
"
Add
"
onClicked
:
{
if
(
hostField
.
visible
&&
hostField
.
text
!==
""
)
{
subEditConfig
.
addHost
(
hostField
.
text
)
hostField
.
text
=
""
hostField
.
visible
=
false
}
else
hostField
.
visible
=
true
}
}
QGCButton
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
enabled
:
_udpSetting
.
_currentHost
&&
_udpSetting
.
_currentHost
!==
""
text
:
"
Remove
"
onClicked
:
{
subEditConfig
.
removeHost
(
_udpSetting
.
_currentHost
)
}
}
}
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
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