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
8cb7fcd6
Commit
8cb7fcd6
authored
Dec 02, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Completed Link Settings (QML)
parent
065d8daf
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
669 additions
and
405 deletions
+669
-405
qgroundcontrol.qrc
qgroundcontrol.qrc
+9
-3
LinkConfiguration.h
src/comm/LinkConfiguration.h
+9
-1
LogReplayLink.h
src/comm/LogReplayLink.h
+2
-1
MockLink.h
src/comm/MockLink.h
+25
-8
SerialLink.h
src/comm/SerialLink.h
+6
-5
TCPLink.cc
src/comm/TCPLink.cc
+39
-1
TCPLink.h
src/comm/TCPLink.h
+6
-5
UDPLink.h
src/comm/UDPLink.h
+6
-5
LinkSettings.qml
src/ui/preferences/LinkSettings.qml
+6
-376
LogReplaySettings.qml
src/ui/preferences/LogReplaySettings.qml
+91
-0
MockLinkSettings.qml
src/ui/preferences/MockLinkSettings.qml
+128
-0
SerialSettings.qml
src/ui/preferences/SerialSettings.qml
+246
-0
TcpSettings.qml
src/ui/preferences/TcpSettings.qml
+92
-0
UdpSettings.qml
src/ui/preferences/UdpSettings.qml
+4
-0
No files found.
qgroundcontrol.qrc
View file @
8cb7fcd6
...
...
@@ -11,22 +11,28 @@
<file alias="APMAirframeComponent.qml">src/AutoPilotPlugins/APM/APMAirframeComponent.qml</file>
<file alias="APMAirframeComponentSummary.qml">src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file>
<file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file>
<file alias="DebugWindow.qml">src/ui/preferences/DebugWindow.qml</file>
<file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file>
<file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="FlightModesComponent.qml">src/AutoPilotPlugins/PX4/FlightModesComponent.qml</file>
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="DebugWindow.qml">src/ui/preferences/DebugWindow.qml</file>
<file alias="GeneralSettings.qml">src/ui/preferences/GeneralSettings.qml</file>
<file alias="LinkSettings.qml">src/ui/preferences/LinkSettings.qml</file>
<file alias="LogReplaySettings.qml">src/ui/preferences/LogReplaySettings.qml</file>
<file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file>
<file alias="MockLink.qml">src/ui/preferences/MockLink.qml</file>
<file alias="MockLinkSettings.qml">src/ui/preferences/MockLinkSettings.qml</file>
<file alias="SerialSettings.qml">src/ui/preferences/SerialSettings.qml</file>
<file alias="TcpSettings.qml">src/ui/preferences/TcpSettings.qml</file>
<file alias="UdpSettings.qml">src/ui/preferences/UdpSettings.qml</file>
<file alias="JoystickConfig.qml">src/VehicleSetup/JoystickConfig.qml</file>
<file alias="MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
<file alias="MainWindowLeftPanel.qml">src/ui/MainWindowLeftPanel.qml</file>
<file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file>
<file alias="MissionEditor.qml">src/MissionEditor/MissionEditor.qml</file>
<file alias="MissionEditorHelp.qml">src/MissionEditor/MissionEditorHelp.qml</file>
<file alias="MockLink.qml">src/ui/preferences/MockLink.qml</file>
<file alias="PowerComponent.qml">src/AutoPilotPlugins/PX4/PowerComponent.qml</file>
<file alias="PowerComponentSummary.qml">src/AutoPilotPlugins/PX4/PowerComponentSummary.qml</file>
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
...
...
src/comm/LinkConfiguration.h
View file @
8cb7fcd6
...
...
@@ -42,10 +42,11 @@ public:
Q_PROPERTY
(
QString
name
READ
name
WRITE
setName
NOTIFY
nameChanged
)
Q_PROPERTY
(
LinkInterface
*
link
READ
link
WRITE
setLink
NOTIFY
linkChanged
)
Q_PROPERTY
(
LinkType
linkType
READ
type
CONSTANT
)
Q_PROPERTY
(
LinkType
linkType
READ
type
CONSTANT
)
Q_PROPERTY
(
bool
dynamic
READ
isDynamic
WRITE
setDynamic
NOTIFY
dynamicChanged
)
Q_PROPERTY
(
bool
autoConnect
READ
isAutoConnect
WRITE
setAutoConnect
NOTIFY
autoConnectChanged
)
Q_PROPERTY
(
bool
autoConnectAllowed
READ
isAutoConnectAllowed
CONSTANT
)
Q_PROPERTY
(
QString
settingsURL
READ
settingsURL
CONSTANT
)
// Property accessors
...
...
@@ -132,6 +133,13 @@ public:
*/
virtual
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
)
=
0
;
/*!
* @brief Settings URL
*
* Pure virtual method providing the URL for the (QML) settings dialog
*/
virtual
QString
settingsURL
()
=
0
;
/*!
* @brief Update settings
*
...
...
src/comm/LogReplayLink.h
View file @
8cb7fcd6
...
...
@@ -43,7 +43,7 @@ public:
LogReplayLinkConfiguration
(
LogReplayLinkConfiguration
*
copy
);
QString
logFilename
(
void
)
{
return
_logFilename
;
}
void
setLogFilename
(
const
QString
&
logFilename
)
{
_logFilename
=
logFilename
;
emit
fileNameChanged
();
}
void
setLogFilename
(
const
QString
logFilename
)
{
_logFilename
=
logFilename
;
emit
fileNameChanged
();
}
QString
logFilenameShort
(
void
);
...
...
@@ -54,6 +54,7 @@ public:
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
bool
isAutoConnectAllowed
()
{
return
false
;
}
QString
settingsURL
()
{
return
"LogReplaySettings.qml"
;
}
signals:
void
fileNameChanged
();
...
...
src/comm/MockLink.h
View file @
8cb7fcd6
...
...
@@ -40,25 +40,42 @@ class MockConfiguration : public LinkConfiguration
Q_OBJECT
public:
Q_PROPERTY
(
int
firmware
READ
firmware
WRITE
setFirmware
NOTIFY
firmwareChanged
)
Q_PROPERTY
(
int
vehicle
READ
vehicle
WRITE
setVehicle
NOTIFY
vehicleChanged
)
Q_PROPERTY
(
bool
sendStatus
READ
sendStatusText
WRITE
setSendStatusText
NOTIFY
sendStatusChanged
)
// QML Access
int
firmware
()
{
return
(
int
)
_firmwareType
;
}
void
setFirmware
(
int
type
)
{
_firmwareType
=
(
MAV_AUTOPILOT
)
type
;
emit
firmwareChanged
();
}
int
vehicle
()
{
return
(
int
)
_vehicleType
;
}
void
setVehicle
(
int
type
)
{
_vehicleType
=
(
MAV_TYPE
)
type
;
emit
vehicleChanged
();
}
MockConfiguration
(
const
QString
&
name
);
MockConfiguration
(
MockConfiguration
*
source
);
MAV_AUTOPILOT
firmwareType
(
void
)
{
return
_firmwareType
;
}
void
setFirmwareType
(
MAV_AUTOPILOT
firmwareType
)
{
_firmwareType
=
firmwareType
;
}
void
setFirmwareType
(
MAV_AUTOPILOT
firmwareType
)
{
_firmwareType
=
firmwareType
;
emit
firmwareChanged
();
}
MAV_TYPE
vehicleType
(
void
)
{
return
_vehicleType
;
}
void
setVehicleType
(
MAV_TYPE
vehicleType
)
{
_vehicleType
=
vehicleType
;
}
void
setVehicleType
(
MAV_TYPE
vehicleType
)
{
_vehicleType
=
vehicleType
;
emit
vehicleChanged
();
}
/// @param sendStatusText true: mavlink status text messages will be sent for each severity, as well as voice output info message
void
setSendStatusText
(
bool
sendStatusText
)
{
_sendStatusText
=
sendStatusText
;
}
bool
sendStatusText
(
void
)
{
return
_sendStatusText
;
}
void
setSendStatusText
(
bool
sendStatusText
)
{
_sendStatusText
=
sendStatusText
;
emit
sendStatusChanged
();
}
// Overrides from LinkConfiguration
LinkType
type
(
void
)
{
return
LinkConfiguration
::
TypeMock
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
(
void
);
LinkType
type
(
void
)
{
return
LinkConfiguration
::
TypeMock
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
(
void
);
QString
settingsURL
()
{
return
"MockLinkSettings.qml"
;
}
signals:
void
firmwareChanged
();
void
vehicleChanged
();
void
sendStatusChanged
();
private:
MAV_AUTOPILOT
_firmwareType
;
...
...
src/comm/SerialLink.h
View file @
8cb7fcd6
...
...
@@ -94,11 +94,12 @@ public:
static
QString
cleanPortDisplayname
(
const
QString
name
);
/// From LinkConfiguration
LinkType
type
()
{
return
LinkConfiguration
::
TypeSerial
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
LinkType
type
()
{
return
LinkConfiguration
::
TypeSerial
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
QString
settingsURL
()
{
return
"SerialSettings.qml"
;
}
signals:
void
baudChanged
();
...
...
src/comm/TCPLink.cc
View file @
8cb7fcd6
...
...
@@ -237,6 +237,39 @@ void TCPLink::_restartConnection()
//--------------------------------------------------------------------------
//-- TCPConfiguration
static
bool
is_ip
(
const
QString
&
address
)
{
int
a
,
b
,
c
,
d
;
if
(
sscanf
(
address
.
toStdString
().
c_str
(),
"%d.%d.%d.%d"
,
&
a
,
&
b
,
&
c
,
&
d
)
!=
4
&&
strcmp
(
"::1"
,
address
.
toStdString
().
c_str
()))
{
return
false
;
}
else
{
return
true
;
}
}
static
QString
get_ip_address
(
const
QString
&
address
)
{
if
(
is_ip
(
address
))
return
address
;
// Need to look it up
QHostInfo
info
=
QHostInfo
::
fromName
(
address
);
if
(
info
.
error
()
==
QHostInfo
::
NoError
)
{
QList
<
QHostAddress
>
hostAddresses
=
info
.
addresses
();
QHostAddress
address
;
for
(
int
i
=
0
;
i
<
hostAddresses
.
size
();
i
++
)
{
// Exclude all IPv6 addresses
if
(
!
hostAddresses
.
at
(
i
).
toString
().
contains
(
":"
))
{
return
hostAddresses
.
at
(
i
).
toString
();
}
}
}
return
QString
(
""
);
}
TCPConfiguration
::
TCPConfiguration
(
const
QString
&
name
)
:
LinkConfiguration
(
name
)
{
_port
=
QGC_TCP_PORT
;
...
...
@@ -270,7 +303,12 @@ void TCPConfiguration::setAddress(const QHostAddress& address)
void
TCPConfiguration
::
setHost
(
const
QString
host
)
{
_address
=
host
;
QString
ipAdd
=
get_ip_address
(
host
);
if
(
ipAdd
.
isEmpty
())
{
qWarning
()
<<
"TCP:"
<<
"Could not resolve host:"
<<
host
;
}
else
{
_address
=
ipAdd
;
}
}
void
TCPConfiguration
::
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
)
...
...
src/comm/TCPLink.h
View file @
8cb7fcd6
...
...
@@ -108,11 +108,12 @@ public:
void
setHost
(
const
QString
host
);
/// From LinkConfiguration
LinkType
type
()
{
return
LinkConfiguration
::
TypeTcp
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
LinkType
type
()
{
return
LinkConfiguration
::
TypeTcp
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
QString
settingsURL
()
{
return
"TcpSettings.qml"
;
}
signals:
void
portChanged
();
...
...
src/comm/UDPLink.h
View file @
8cb7fcd6
...
...
@@ -144,11 +144,12 @@ public:
QStringList
hostList
()
{
return
_hostList
;
}
/// From LinkConfiguration
LinkType
type
()
{
return
LinkConfiguration
::
TypeUdp
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
LinkType
type
()
{
return
LinkConfiguration
::
TypeUdp
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
void
loadSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
);
void
updateSettings
();
QString
settingsURL
()
{
return
"UdpSettings.qml"
;
}
signals:
void
localPortChanged
();
...
...
src/ui/preferences/LinkSettings.qml
View file @
8cb7fcd6
This diff is collapsed.
Click to expand it.
src/ui/preferences/LogReplaySettings.qml
0 → 100644
View file @
8cb7fcd6
/*=====================================================================
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
{
width
:
parent
?
parent
.
width
:
0
height
:
logColumn
.
height
function
saveSettings
()
{
if
(
subEditConfig
)
{
subEditConfig
.
filename
=
logField
.
text
}
}
Column
{
id
:
logColumn
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
text
:
"
Log Replay Link Settings
"
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
Log File:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCTextField
{
id
:
logField
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeLogReplay
?
subEditConfig
.
fileName
:
""
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCButton
{
text
:
"
Browse
"
onClicked
:
{
fileDialog
.
visible
=
true
}
}
}
FileDialog
{
id
:
fileDialog
title
:
"
Please choose a file
"
folder
:
shortcuts
.
home
visible
:
false
selectExisting
:
true
onAccepted
:
{
if
(
subEditConfig
)
{
subEditConfig
.
fileName
=
fileDialog
.
fileUrl
.
toString
().
replace
(
"
file://
"
,
""
)
}
fileDialog
.
visible
=
false
}
onRejected
:
{
fileDialog
.
visible
=
false
}
}
}
}
src/ui/preferences/MockLinkSettings.qml
0 → 100644
View file @
8cb7fcd6
/*=====================================================================
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
.
Layouts
1.2
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
Item
{
id
:
mockLinkSettings
width
:
parent
?
parent
.
width
:
0
height
:
mockColumn
.
height
function
saveSettings
()
{
if
(
px4Firmware
.
checked
)
subEditConfig
.
firmware
=
12
else
if
(
apmFirmware
.
checked
)
subEditConfig
.
firmware
=
3
else
subEditConfig
.
firmware
=
0
subEditConfig
.
sendStatus
=
sendStatus
.
checked
}
Component.onCompleted
:
{
if
(
subEditConfig
.
firmware
===
12
)
// Hardcoded MAV_AUTOPILOT_PX4
px4Firmware
.
checked
=
true
else
if
(
subEditConfig
.
firmware
===
3
)
// Hardcoded MAV_AUTOPILOT_ARDUPILOTMEGA
apmFirmware
.
checked
=
true
else
genericFirmware
.
checked
=
true
if
(
subEditConfig
.
vehicle
===
1
)
// Hardcoded MAV_TYPE_FIXED_WING
planeVehicle
.
checked
=
true
else
copterVehicle
.
checked
=
true
sendStatus
.
checked
=
subEditConfig
.
sendStatus
}
Column
{
id
:
mockColumn
width
:
mockLinkSettings
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
text
:
"
Mock Link Settings
"
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
QGCCheckBox
{
id
:
sendStatus
text
:
"
Send Status Text and Voice
"
checked
:
false
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
ColumnLayout
{
ExclusiveGroup
{
id
:
autoPilotGroup
}
QGCRadioButton
{
id
:
px4Firmware
text
:
"
PX4 Firmware
"
checked
:
false
exclusiveGroup
:
autoPilotGroup
}
QGCRadioButton
{
id
:
apmFirmware
text
:
"
APM Firmware
"
checked
:
false
exclusiveGroup
:
autoPilotGroup
}
QGCRadioButton
{
id
:
genericFirmware
text
:
"
Generic Firmware
"
checked
:
false
exclusiveGroup
:
autoPilotGroup
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
QGCLabel
{
text
:
"
APM Vehicle Type
"
visible
:
apmFirmware
.
checked
}
ColumnLayout
{
visible
:
apmFirmware
.
checked
ExclusiveGroup
{
id
:
apmVehicleGroup
}
QGCRadioButton
{
id
:
copterVehicle
text
:
"
ArduCopter
"
checked
:
false
exclusiveGroup
:
apmVehicleGroup
}
QGCRadioButton
{
id
:
planeVehicle
text
:
"
ArduPlane
"
checked
:
false
exclusiveGroup
:
apmVehicleGroup
}
}
}
}
src/ui/preferences/SerialSettings.qml
0 → 100644
View file @
8cb7fcd6
/*=====================================================================
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
:
serialLinkSettings
width
:
parent
?
parent
.
width
:
0
height
:
serialColumn
.
height
function
saveSettings
()
{
// No Need
}
Column
{
id
:
serialColumn
width
:
serialLinkSettings
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
id
:
serialLabel
text
:
"
Serial Link Settings
"
}
Rectangle
{
height
:
1
width
:
serialLabel
.
width
color
:
qgcPal
.
button
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
Serial Port:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCComboBox
{
id
:
commPortCombo
width
:
_secondColumn
model
:
QGroundControl
.
linkManager
.
serialPortStrings
anchors.verticalCenter
:
parent
.
verticalCenter
onActivated
:
{
if
(
index
!=
-
1
)
{
subEditConfig
.
portName
=
QGroundControl
.
linkManager
.
serialPorts
[
index
]
}
}
Component
.
onCompleted
:
{
if
(
subEditConfig
!=
null
)
{
if
(
subEditConfig
.
portDisplayName
===
""
)
subEditConfig
.
portName
=
QGroundControl
.
linkManager
.
serialPorts
[
0
]
var
index
=
commPortCombo
.
find
(
subEditConfig
.
portDisplayName
)
if
(
index
===
-
1
)
{
console
.
warn
(
"
Serial Port not present
"
,
subEditConfig
.
portName
)
}
else
{
commPortCombo
.
currentIndex
=
index
}
}
else
{
commPortCombo
.
currentIndex
=
0
}
}
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
Baud Rate:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCComboBox
{
id
:
baudCombo
width
:
_secondColumn
model
:
QGroundControl
.
linkManager
.
serialBaudRates
anchors.verticalCenter
:
parent
.
verticalCenter
onActivated
:
{
if
(
index
!=
-
1
)
{
subEditConfig
.
baud
=
parseInt
(
QGroundControl
.
linkManager
.
serialBaudRates
[
index
])
}
}
Component
.
onCompleted
:
{
var
baud
=
"
57600
"
if
(
subEditConfig
!=
null
)
{
baud
=
subEditConfig
.
baud
.
toString
()
}
var
index
=
baudCombo
.
find
(
baud
)
if
(
index
===
-
1
)
{
console
.
warn
(
"
Baud rate name not in combo box
"
,
baud
)
}
else
{
baudCombo
.
currentIndex
=
index
}
}
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
//-----------------------------------------------------------------
//-- Advanced Serial Settings
QGCCheckBox
{
id
:
showAdvanced
text
:
"
Show Advanced Serial Settings
"
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
//-- Flow Control
QGCCheckBox
{
text
:
"
Enable Flow Control
"
checked
:
subEditConfig
?
subEditConfig
.
flowControl
!==
0
:
false
visible
:
showAdvanced
.
checked
onCheckedChanged
:
{
if
(
subEditConfig
)
{
subEditConfig
.
flowControl
=
checked
?
1
:
0
}
}
}
//-- Parity
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
showAdvanced
.
checked
QGCLabel
{
text
:
"
Parity:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCComboBox
{
id
:
parityCombo
width
:
_firstColumn
model
:
[
"
None
"
,
"
Even
"
,
"
Odd
"
]
anchors.verticalCenter
:
parent
.
verticalCenter
onActivated
:
{
if
(
index
!=
-
1
)
{
// Hard coded values from qserialport.h
if
(
index
==
0
)
subEditConfig
.
parity
=
0
else
if
(
index
==
1
)
subEditConfig
.
parity
=
2
else
subEditConfig
.
parity
=
3
}
}
Component
.
onCompleted
:
{
var
index
=
0
if
(
subEditConfig
!=
null
)
{
index
=
subEditConfig
.
parity
}
if
(
index
>
1
)
{
index
=
index
-
2
}
parityCombo
.
currentIndex
=
index
}
}
}
//-- Data Bits
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
showAdvanced
.
checked
QGCLabel
{
text
:
"
Data Bits:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCComboBox
{
id
:
dataCombo
width
:
_firstColumn
model
:
[
"
5
"
,
"
6
"
,
"
7
"
,
"
8
"
]
anchors.verticalCenter
:
parent
.
verticalCenter
onActivated
:
{
if
(
index
!=
-
1
)
{
subEditConfig
.
dataBits
=
index
+
5
}
}
Component
.
onCompleted
:
{
var
index
=
3
if
(
subEditConfig
!=
null
)
{
index
=
subEditConfig
.
parity
-
5
if
(
index
<
0
)
index
=
3
}
dataCombo
.
currentIndex
=
index
}
}
}
//-- Stop Bits
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
showAdvanced
.
checked
QGCLabel
{
text
:
"
Stop Bits:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCComboBox
{
id
:
stopCombo
width
:
_firstColumn
model
:
[
"
1
"
,
"
2
"
]
anchors.verticalCenter
:
parent
.
verticalCenter
onActivated
:
{
if
(
index
!=
-
1
)
{
subEditConfig
.
stopBits
=
index
+
1
}
}
Component
.
onCompleted
:
{
var
index
=
0
if
(
subEditConfig
!=
null
)
{
index
=
subEditConfig
.
stopBits
-
1
if
(
index
<
0
)
index
=
0
}
stopCombo
.
currentIndex
=
index
}
}
}
}
}
src/ui/preferences/TcpSettings.qml
0 → 100644
View file @
8cb7fcd6
/*=====================================================================
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
:
tcpLinkSettings
width
:
parent
?
parent
.
width
:
0
height
:
tcpColumn
.
height
function
saveSettings
()
{
if
(
subEditConfig
)
{
subEditConfig
.
host
=
hostField
.
text
subEditConfig
.
port
=
parseInt
(
portField
.
text
)
}
}
Column
{
id
:
tcpColumn
width
:
tcpLinkSettings
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
id
:
tcpLabel
text
:
"
TCP Link Settings
"
}
Rectangle
{
height
:
1
width
:
tcpLabel
.
width
color
:
qgcPal
.
button
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
Host Address:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCTextField
{
id
:
hostField
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeTcp
?
subEditConfig
.
host
:
""
width
:
_secondColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
"
TCP Port:
"
width
:
_firstColumn
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCTextField
{
id
:
portField
text
:
subEditConfig
&&
subEditConfig
.
linkType
===
LinkConfiguration
.
TypeTcp
?
subEditConfig
.
port
.
toString
()
:
""
width
:
_firstColumn
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
}
src/ui/preferences/UdpSettings.qml
View file @
8cb7fcd6
...
...
@@ -35,6 +35,10 @@ Item {
width
:
parent
?
parent
.
width
:
0
height
:
udpColumn
.
height
function
saveSettings
()
{
// No need
}
property
var
_currentHost
:
""
Column
{
...
...
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