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
c1768f51
Commit
c1768f51
authored
Nov 12, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MockLink Start/Stop to Preferences
Preparation for auto-connect having no connect/disconnect buttons.
parent
ebfb5af7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
0 deletions
+176
-0
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+80
-0
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+14
-0
MainWindowLeftPanel.qml
src/ui/MainWindowLeftPanel.qml
+14
-0
MockLink.qml
src/ui/preferences/MockLink.qml
+67
-0
No files found.
qgroundcontrol.qrc
View file @
c1768f51
...
...
@@ -24,6 +24,7 @@
<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/QmlControls/QGroundControlQmlGlobal.cc
View file @
c1768f51
...
...
@@ -66,3 +66,83 @@ bool QGroundControlQmlGlobal::loadBoolGlobalSetting (const QString& key, bool de
settings
.
beginGroup
(
kQmlGlobalKeyName
);
return
settings
.
value
(
key
,
defaultValue
).
toBool
();
}
#ifdef QT_DEBUG
void
QGroundControlQmlGlobal
::
_startMockLink
(
MockConfiguration
*
mockConfig
)
{
MockLink
*
mockLink
=
new
MockLink
(
mockConfig
);
LinkManager
*
linkManager
=
qgcApp
()
->
toolbox
()
->
linkManager
();
linkManager
->
_addLink
(
mockLink
);
linkManager
->
connectLink
(
mockLink
);
}
#endif
void
QGroundControlQmlGlobal
::
startPX4MockLink
(
bool
sendStatusText
)
{
#ifdef QT_DEBUG
MockConfiguration
mockConfig
(
"PX4 MockLink"
);
mockConfig
.
setFirmwareType
(
MAV_AUTOPILOT_PX4
);
mockConfig
.
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
.
setSendStatusText
(
sendStatusText
);
_startMockLink
(
&
mockConfig
);
#endif
}
void
QGroundControlQmlGlobal
::
startGenericMockLink
(
bool
sendStatusText
)
{
#ifdef QT_DEBUG
MockConfiguration
mockConfig
(
"Generic MockLink"
);
mockConfig
.
setFirmwareType
(
MAV_AUTOPILOT_GENERIC
);
mockConfig
.
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
.
setSendStatusText
(
sendStatusText
);
_startMockLink
(
&
mockConfig
);
#endif
}
void
QGroundControlQmlGlobal
::
startAPMArduCopterMockLink
(
bool
sendStatusText
)
{
#ifdef QT_DEBUG
MockConfiguration
mockConfig
(
"APM ArduCopter MockLink"
);
mockConfig
.
setFirmwareType
(
MAV_AUTOPILOT_ARDUPILOTMEGA
);
mockConfig
.
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
.
setSendStatusText
(
sendStatusText
);
_startMockLink
(
&
mockConfig
);
#endif
}
void
QGroundControlQmlGlobal
::
startAPMArduPlaneMockLink
(
bool
sendStatusText
)
{
#ifdef QT_DEBUG
MockConfiguration
mockConfig
(
"APM ArduPlane MockLink"
);
mockConfig
.
setFirmwareType
(
MAV_AUTOPILOT_ARDUPILOTMEGA
);
mockConfig
.
setVehicleType
(
MAV_TYPE_FIXED_WING
);
mockConfig
.
setSendStatusText
(
sendStatusText
);
_startMockLink
(
&
mockConfig
);
#endif
}
void
QGroundControlQmlGlobal
::
stopAllMockLinks
(
void
)
{
#ifdef QT_DEBUG
LinkManager
*
linkManager
=
qgcApp
()
->
toolbox
()
->
linkManager
();
QList
<
LinkInterface
*>
links
=
linkManager
->
getLinks
();
for
(
int
i
=
0
;
i
<
links
.
count
();
i
++
)
{
LinkInterface
*
link
=
links
[
i
];
MockLink
*
mockLink
=
qobject_cast
<
MockLink
*>
(
link
);
if
(
mockLink
)
{
linkManager
->
disconnectLink
(
mockLink
);
}
}
#endif
}
src/QmlControls/QGroundControlQmlGlobal.h
View file @
c1768f51
...
...
@@ -34,6 +34,10 @@
#include "HomePositionManager.h"
#include "FlightMapSettings.h"
#ifdef QT_DEBUG
#include "MockLink.h"
#endif
class
QGCToolbox
;
class
QGroundControlQmlGlobal
:
public
QObject
...
...
@@ -58,6 +62,12 @@ public:
Q_INVOKABLE
void
saveBoolGlobalSetting
(
const
QString
&
key
,
bool
value
);
Q_INVOKABLE
bool
loadBoolGlobalSetting
(
const
QString
&
key
,
bool
defaultValue
);
Q_INVOKABLE
void
startPX4MockLink
(
bool
sendStatusText
);
Q_INVOKABLE
void
startGenericMockLink
(
bool
sendStatusText
);
Q_INVOKABLE
void
startAPMArduCopterMockLink
(
bool
sendStatusText
);
Q_INVOKABLE
void
startAPMArduPlaneMockLink
(
bool
sendStatusText
);
Q_INVOKABLE
void
stopAllMockLinks
(
void
);
// Property accesors
HomePositionManager
*
homePositionManager
()
{
return
_homePositionManager
;
}
...
...
@@ -123,6 +133,10 @@ signals:
void
isVersionCheckEnabledChanged
(
bool
enabled
);
private:
#ifdef QT_DEBUG
void
_startMockLink
(
MockConfiguration
*
mockConfig
);
#endif
HomePositionManager
*
_homePositionManager
;
FlightMapSettings
*
_flightMapSettings
;
};
...
...
src/ui/MainWindowLeftPanel.qml
View file @
c1768f51
...
...
@@ -169,6 +169,20 @@ Item {
checked
=
true
}
}
QGCButton
{
width
:
parent
.
width
*
0.8
height
:
ScreenTools
.
defaultFontPixelHeight
*
2.5
text
:
"
Mock Link
"
visible
:
ScreenTools
.
isDebug
exclusiveGroup
:
panelActionGroup
anchors.horizontalCenter
:
parent
.
horizontalCenter
onClicked
:
{
if
(
__rightPanel
.
source
!=
"
MockLink.qml
"
)
{
__rightPanel
.
source
=
"
MockLink.qml
"
}
checked
=
true
}
}
QGCButton
{
width
:
parent
.
width
*
0.8
height
:
ScreenTools
.
defaultFontPixelHeight
*
2.5
...
...
src/ui/preferences/MockLink.qml
0 → 100644
View file @
c1768f51
/*=====================================================================
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.3
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
Rectangle
{
color
:
qgcPal
.
window
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
Column
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCButton
{
text
:
"
PX4 Vehicle
"
onClicked
:
QGroundControl
.
startPX4MockLink
(
sendStatusText
.
checked
)
}
QGCButton
{
text
:
"
APM ArduCopter Vehicle
"
onClicked
:
QGroundControl
.
startAPMArduCopterMockLink
(
sendStatusText
.
checked
)
}
QGCButton
{
text
:
"
APM ArduPlane Vehicle
"
onClicked
:
QGroundControl
.
startAPMArduPlaneMockLink
(
sendStatusText
.
checked
)
}
QGCButton
{
text
:
"
Generic Vehicle
"
onClicked
:
QGroundControl
.
startGenericMockLink
(
sendStatusText
.
checked
)
}
QGCCheckBox
{
id
:
sendStatusText
text
:
"
Send status text + voice
"
}
QGCButton
{
text
:
"
Stop All MockLinks
"
onClicked
:
QGroundControl
.
stopAllMockLinks
()
}
}
}
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