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
fff84f17
Commit
fff84f17
authored
Feb 04, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1191 from DonLakeFlyer/SetupUI
Back to non-modal, no pop-up Setup View
parents
d652eeb9
af38a105
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
370 additions
and
542 deletions
+370
-542
cogwheels.png
files/Setup/cogwheels.png
+0
-0
qgroundcontrol.pro
qgroundcontrol.pro
+4
-6
qgroundcontrol.qrc
qgroundcontrol.qrc
+7
-6
SetupButton.qml
qml/QGroundControl/Controls/SetupButton.qml
+88
-0
qmldir
qml/QGroundControl/Controls/qmldir
+2
-0
SetupButton.qml
qml/QGroundControl/FactControls/SetupButton.qml
+0
-163
AirframeComponent.cc
src/AutoPilotPlugins/PX4/AirframeComponent.cc
+0
-1
FlightModesComponent.cc
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
+0
-1
RadioComponent.cc
src/AutoPilotPlugins/PX4/RadioComponent.cc
+0
-1
SafetyComponent.cc
src/AutoPilotPlugins/PX4/SafetyComponent.cc
+0
-1
SensorsComponent.cc
src/AutoPilotPlugins/PX4/SensorsComponent.cc
+0
-1
FactSystem.cc
src/FactSystem/FactSystem.cc
+0
-1
SetupPane.qml
src/VehicleSetup/SetupPane.qml
+0
-51
SetupView.cc
src/VehicleSetup/SetupView.cc
+63
-62
SetupView.h
src/VehicleSetup/SetupView.h
+13
-7
SetupView.ui
src/VehicleSetup/SetupView.ui
+90
-0
SetupViewButtons.qml
src/VehicleSetup/SetupViewButtons.qml
+88
-0
SetupViewDisconnected.qml
src/VehicleSetup/SetupViewDisconnected.qml
+0
-34
SetupWidgetHolder.cc
src/VehicleSetup/SetupWidgetHolder.cc
+0
-19
SetupWidgetHolder.h
src/VehicleSetup/SetupWidgetHolder.h
+0
-24
SetupWidgetHolder.ui
src/VehicleSetup/SetupWidgetHolder.ui
+0
-40
VehicleComponentSummaryItem.cc
src/VehicleSetup/VehicleComponentSummaryItem.cc
+0
-35
VehicleComponentSummaryItem.h
src/VehicleSetup/VehicleComponentSummaryItem.h
+0
-57
VehicleSummary.qml
src/VehicleSetup/VehicleSummary.qml
+6
-27
test.qml
src/test.qml
+9
-5
No files found.
files/Setup/cogwheels.png
0 → 100644
View file @
fff84f17
10.2 KB
qgroundcontrol.pro
View file @
fff84f17
...
...
@@ -208,6 +208,8 @@ ReleaseBuild {
}
}
QML_IMPORT_PATH
=
$$
BASEDIR
/
qml
#
qextserialport
should
not
be
used
by
general
QGroundControl
code
.
Use
QSerialPort
instead
.
This
is
only
#
here
to
support
special
case
Firmware
Upgrade
code
.
include
(
libs
/
qextserialport
/
src
/
qextserialport
.
pri
)
...
...
@@ -343,7 +345,7 @@ FORMS += \
src
/
ui
/
px4_configuration
/
PX4FirmwareUpgrade
.
ui
\
src
/
ui
/
QGCUASFileView
.
ui
\
src
/
QGCQmlWidgetHolder
.
ui
\
src
/
ui
/
QGCMapRCToParamDialog
.
ui
src
/
ui
/
QGCMapRCToParamDialog
.
ui
\
HEADERS
+=
\
src
/
MG
.
h
\
...
...
@@ -713,13 +715,12 @@ FORMS += \
src
/
VehicleSetup
/
ParameterEditor
.
ui
\
src
/
ui
/
QGCPX4VehicleConfig
.
ui
\
src
/
AutoPilotPlugins
/
PX4
/
FlightModeConfig
.
ui
\
src
/
VehicleSetup
/
Setup
WidgetHolder
.
ui
\
src
/
VehicleSetup
/
Setup
View
.
ui
\
HEADERS
+=
\
src
/
VehicleSetup
/
SetupView
.
h
\
src
/
VehicleSetup
/
ParameterEditor
.
h
\
src
/
VehicleSetup
/
VehicleComponent
.
h
\
src
/
VehicleSetup
/
VehicleComponentSummaryItem
.
h
\
src
/
AutoPilotPlugins
/
AutoPilotPluginManager
.
h
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
.
h
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
h
\
...
...
@@ -733,13 +734,11 @@ HEADERS+= \
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
SafetyComponent
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
PX4ParameterFacts
.
h
\
src
/
VehicleSetup
/
SetupWidgetHolder
.
h
\
SOURCES
+=
\
src
/
VehicleSetup
/
SetupView
.
cc
\
src
/
VehicleSetup
/
ParameterEditor
.
cc
\
src
/
VehicleSetup
/
VehicleComponent
.
cc
\
src
/
VehicleSetup
/
VehicleComponentSummaryItem
.
cc
\
src
/
AutoPilotPlugins
/
AutoPilotPluginManager
.
cc
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
Generic
/
GenericParameterFacts
.
cc
\
...
...
@@ -752,7 +751,6 @@ SOURCES += \
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
SafetyComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
PX4ParameterFacts
.
cc
\
src
/
VehicleSetup
/
SetupWidgetHolder
.
cc
\
#
Fact
System
code
...
...
qgroundcontrol.qrc
View file @
fff84f17
...
...
@@ -241,19 +241,18 @@
<file alias="test.qml">src/test.qml</file>
<file alias="QGroundControl/FactControls/qmldir">qml/QGroundControl/FactControls/qmldir</file>
<file alias="QGroundControl/FactControls/SetupButton.qml">qml/QGroundControl/FactControls/SetupButton.qml</file>
<file alias="QGroundControl/FactControls/FactLabel.qml">qml/QGroundControl/FactControls/FactLabel.qml</file>
<file alias="QGroundControl/FactControls/FactTextField.qml">qml/QGroundControl/FactControls/FactTextField.qml</file>
<file alias="QGroundControl/FactControls/FactCheckBox.qml">qml/QGroundControl/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/Controls/qmldir">qml/QGroundControl/Controls/qmldir</file>
<file alias="QGroundControl/Controls/SetupButton.qml">qml/QGroundControl/Controls/SetupButton.qml</file>
<file alias="octo_x.png">files/images/px4/airframes/octo_x.png</file>
<file alias="px4fmu_2.x.png">files/images/px4/boards/px4fmu_2.x.png</file>
<file alias="SetupViewConnected.qml">src/VehicleSetup/SetupViewConnected.qml</file>
<file alias="SetupViewDisconnected.qml">src/VehicleSetup/SetupViewDisconnected.qml</file>
<file alias="SetupPane.qml">src/VehicleSetup/SetupPane.qml</file>
<file alias="SetupViewButtons.qml">src/VehicleSetup/SetupViewButtons.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
<file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file>
...
...
@@ -263,6 +262,8 @@
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="AirframeComponentSummary.qml">src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file>
<file alias="QGroundControl/Controls/setupButtonImage.png">files/Setup/cogwheels.png</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
...
...
qml/QGroundControl/Controls/SetupButton.qml
0 → 100644
View file @
fff84f17
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QtGraphicalEffects
1.0
import
QGroundControl
.
FactSystem
1.0
Button
{
checkable
:
true
height
:
80
text
:
"
Button
"
property
bool
setupComplete
:
true
property
bool
setupIndicator
:
true
style
:
ButtonStyle
{
id
:
buttonStyle
property
var
__qgcpal
:
QGCPalette
{
colorGroup
:
control
.
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Disabled
}
background
:
Rectangle
{
id
:
innerRect
readonly
property
real
titleHeight
:
30
border.color
:
control
.
checked
?
"
#eee333
"
:
"
#676767
"
radius
:
10
color
:
control
.
checked
?
"
#eee333
"
:
"
#343434
"
Text
{
id
:
titleBar
width
:
parent
.
width
height
:
parent
.
titleHeight
verticalAlignment
:
TextEdit
.
AlignVCenter
horizontalAlignment
:
TextEdit
.
AlignHCenter
text
:
control
.
text
font.pixelSize
:
12
color
:
control
.
checked
?
"
black
"
:
"
white
"
Rectangle
{
id
:
setupIndicator
readonly
property
real
indicatorRadius
:
6
x
:
parent
.
width
-
(
indicatorRadius
*
2
)
-
5
y
:
(
parent
.
height
-
(
indicatorRadius
*
2
))
/
2
width
:
indicatorRadius
*
2
height
:
indicatorRadius
*
2
radius
:
indicatorRadius
color
:
control
.
setupIndicator
?
(
control
.
setupComplete
?
"
green
"
:
"
red
"
)
:
innerRect
.
color
}
}
Rectangle
{
width
:
parent
.
width
height
:
parent
.
height
-
parent
.
titleHeight
y
:
parent
.
titleHeight
color
:
__qgcpal
.
window
border.color
:
control
.
checked
?
"
#eee333
"
:
"
#676767
"
Image
{
id
:
buttonImage
source
:
"
setupButtonImage.png
"
sourceSize
:
Qt
.
size
(
parent
.
width
-
20
,
parent
.
height
-
20
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
smooth
:
true
visible
:
false
}
ColorOverlay
{
anchors.fill
:
buttonImage
source
:
buttonImage
color
:
control
.
checked
?
"
#eee333
"
:
"
#58585a
"
}
}
}
label
:
Item
{}
}
}
qml/QGroundControl/Controls/qmldir
0 → 100644
View file @
fff84f17
Module QGroundControl.Controls
SetupButton 1.0 SetupButton.qml
\ No newline at end of file
qml/QGroundControl/FactControls/SetupButton.qml
deleted
100644 → 0
View file @
d652eeb9
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
Button
{
text
:
"
Button
"
property
bool
setupComplete
:
false
property
var
summaryModel
:
ListModel
{
ListElement
{
name
:
"
Row 1
"
;
state
:
"
State 1
"
}
ListElement
{
name
:
"
Row 2
"
;
state
:
"
State 2
"
}
ListElement
{
name
:
"
Row 3
"
;
state
:
"
State 3
"
}
}
style
:
ButtonStyle
{
id
:
buttonStyle
background
:
Rectangle
{
id
:
innerRect
readonly
property
real
titleHeight
:
30
//property alias summaryModel: summaryList.model
border.color
:
"
#888
"
radius
:
10
color
:
control
.
activeFocus
?
"
#47b
"
:
"
white
"
opacity
:
control
.
hovered
||
control
.
activeFocus
?
1
:
0.75
Behavior
on
opacity
{
NumberAnimation
{
duration
:
100
}}
Text
{
id
:
titleBar
width
:
parent
.
width
height
:
parent
.
titleHeight
verticalAlignment
:
TextEdit
.
AlignVCenter
horizontalAlignment
:
TextEdit
.
AlignHCenter
text
:
control
.
text
font.pixelSize
:
12
Rectangle
{
id
:
setupIndicator
property
bool
setupComplete
:
true
readonly
property
real
indicatorRadius
:
6
x
:
parent
.
width
-
(
indicatorRadius
*
2
)
-
5
y
:
(
parent
.
height
-
(
indicatorRadius
*
2
))
/
2
width
:
indicatorRadius
*
2
height
:
indicatorRadius
*
2
radius
:
indicatorRadius
color
:
control
.
setupComplete
?
"
green
"
:
"
red
"
}
}
Rectangle
{
width
:
parent
.
width
height
:
parent
.
height
-
parent
.
titleHeight
y
:
parent
.
titleHeight
border.color
:
"
#888
"
gradient
:
Gradient
{
GradientStop
{
position
:
0
;
color
:
"
#ffffff
"
}
GradientStop
{
position
:
1
;
color
:
"
#000000
"
}
}
ListView
{
id
:
summaryList
anchors.fill
:
parent
model
:
control
.
summaryModel
delegate
:
Row
{
Text
{
text
:
modelData
.
name
}
Text
{
text
:
modelData
.
state
}
}
}
}
}
label
:
Item
{}
}
}
/*
Rectangle {
readonly property real titleHeight: 30
property alias title: titleBar.text
property alias setupComplete: setupIndicator.setupComplete
//property alias summaryModel: summaryList.model
border.color: "#888"
radius: 10
gradient: Gradient {
GradientStop { position: 0 ; color: "#cccccc" }
GradientStop { position: 1 ; color: "#aaa" }
}
Text {
id: titleBar
width: parent.width
height: parent.titleHeight
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
text: qsTr("TITLE")
font.pixelSize: 12
Rectangle {
id: setupIndicator
property bool setupComplete: true
readonly property real indicatorRadius: 6
x: parent.width - (indicatorRadius * 2) - 5
y: (parent.height - (indicatorRadius * 2)) / 2
width: indicatorRadius * 2
height: indicatorRadius * 2
radius: indicatorRadius
color: setupComplete ? "green" : "red"
}
}
Rectangle {
width: parent.width
height: parent.height - parent.titleHeight
y: parent.titleHeight
border.color: "#888"
gradient: Gradient {
GradientStop {
position: 0
color: "#ffffff"
}
GradientStop {
position: 1
color: "#000000"
}
}
ListView {
id: summaryList
anchors.fill: parent
model: ListModel {
ListElement { name: "Row 1"; state: "State 1" }
ListElement { name: "Row 2"; state: "State 2" }
ListElement { name: "Row 3"; state: "State 3" }
}
delegate: Row { Text { text: modelData.name } Text { text: modelData.state } }
}
}
}
*/
\ No newline at end of file
src/AutoPilotPlugins/PX4/AirframeComponent.cc
View file @
fff84f17
...
...
@@ -26,7 +26,6 @@
#include "AirframeComponent.h"
#include "QGCPX4AirframeConfig.h"
#include "VehicleComponentSummaryItem.h"
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
"SYS_AUTOSTART"
,
NULL
};
...
...
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
View file @
fff84f17
...
...
@@ -26,7 +26,6 @@
#include "FlightModesComponent.h"
#include "FlightModeConfig.h"
#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
/// @brief Parameters which signal a change in setupComplete state
...
...
src/AutoPilotPlugins/PX4/RadioComponent.cc
View file @
fff84f17
...
...
@@ -26,7 +26,6 @@
#include "RadioComponent.h"
#include "PX4RCCalibration.h"
#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
/// @brief Parameters which signal a change in setupComplete state
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.cc
View file @
fff84f17
...
...
@@ -26,7 +26,6 @@
#include "SafetyComponent.h"
#include "PX4RCCalibration.h"
#include "VehicleComponentSummaryItem.h"
#include "QGCQmlWidgetHolder.h"
#include "PX4AutoPilotPlugin.h"
...
...
src/AutoPilotPlugins/PX4/SensorsComponent.cc
View file @
fff84f17
...
...
@@ -26,7 +26,6 @@
#include "SensorsComponent.h"
#include "QGCPX4SensorCalibration.h"
#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
// These two list must be kept in sync
...
...
src/FactSystem/FactSystem.cc
View file @
fff84f17
...
...
@@ -44,7 +44,6 @@ FactSystem::FactSystem(QObject* parent) :
// FIXME: Where should these go?
qmlRegisterUncreatableType
<
VehicleComponent
>
(
_factSystemQmlUri
,
1
,
0
,
"VehicleComponent"
,
"Can only reference VehicleComponent"
);
qmlRegisterUncreatableType
<
VehicleComponent
>
(
_factSystemQmlUri
,
1
,
0
,
"VehicleComponentSummaryItem"
,
"Can only reference VehicleComponentSummaryItem"
);
qmlRegisterType
<
QGCPalette
>
(
_factSystemQmlUri
,
1
,
0
,
"QGCPalette"
);
}
...
...
src/VehicleSetup/SetupPane.qml
deleted
100644 → 0
View file @
d652eeb9
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
//import QGroundControl.FactControls 1.0
Item
{
id
:
item1
width
:
500
height
:
500
Rectangle
{
id
:
innerRect
color
:
"
#d298d2
"
z
:
1
anchors.rightMargin
:
15
anchors.leftMargin
:
15
anchors.bottomMargin
:
15
anchors.topMargin
:
40
anchors.fill
:
parent
Rectangle
{
id
:
close
x
:
parent
.
width
-
(
width
/
2
)
y
:
0
-
(
height
/
2
)
width
:
30
height
:
30
color
:
"
#ffffff
"
radius
:
15
z
:
2
border.color
:
"
#000000
"
}
}
Rectangle
{
id
:
outerRect
color
:
"
#ffffff
"
opacity
:
0.8
anchors.fill
:
parent
Text
{
id
:
title
x
:
237
y
:
8
text
:
qsTr
(
"
Setup Pane
"
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
font.pointSize
:
20
}
}
}
src/VehicleSetup/SetupView.cc
View file @
fff84f17
...
...
@@ -25,13 +25,14 @@
/// @author Don Gagne <don@thegagnes.com>
#include "SetupView.h"
#include "ui_SetupView.h"
#include "UASManager.h"
#include "AutoPilotPluginManager.h"
#include "VehicleComponent.h"
#include "PX4FirmwareUpgrade.h"
#include "ParameterEditor.h"
#include "
Setup
WidgetHolder.h"
#include "
QGCQml
WidgetHolder.h"
#include "MainWindow.h"
#include "QGCMessageBox.h"
...
...
@@ -40,16 +41,38 @@
#include <QDebug>
SetupView
::
SetupView
(
QWidget
*
parent
)
:
Q
GCQuick
Widget
(
parent
),
QWidget
(
parent
),
_uasCurrent
(
NULL
),
_initComplete
(
false
),
_autoPilotPlugin
(
NULL
)
_autoPilotPlugin
(
NULL
),
_currentSetupWidget
(
NULL
),
_ui
(
new
Ui
::
SetupView
)
{
_ui
->
setupUi
(
this
);
bool
fSucceeded
=
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
_setActiveUAS
(
UASInterface
*
)));
Q_UNUSED
(
fSucceeded
);
Q_ASSERT
(
fSucceeded
);
setResizeMode
(
SizeRootObjectToView
);
//setResizeMode(SizeRootObjectToView);
_ui
->
buttonHolder
->
setAutoPilot
(
NULL
);
_ui
->
buttonHolder
->
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/SetupViewButtons.qml"
));
QObject
*
rootObject
=
(
QObject
*
)
_ui
->
buttonHolder
->
rootObject
();
Q_ASSERT
(
rootObject
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
setupButtonClicked
(
QVariant
)),
this
,
SLOT
(
_setupButtonClicked
(
QVariant
)));
Q_ASSERT
(
fSucceeded
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
firmwareButtonClicked
()),
this
,
SLOT
(
_firmwareButtonClicked
()));
Q_ASSERT
(
fSucceeded
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
parametersButtonClicked
()),
this
,
SLOT
(
_parametersButtonClicked
()));
Q_ASSERT
(
fSucceeded
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
summaryButtonClicked
()),
this
,
SLOT
(
_summaryButtonClicked
()));
Q_ASSERT
(
fSucceeded
);
_setActiveUAS
(
UASManager
::
instance
()
->
getActiveUAS
());
}
...
...
@@ -63,10 +86,16 @@ void SetupView::_setActiveUAS(UASInterface* uas)
{
if
(
_uasCurrent
)
{
Q_ASSERT
(
_autoPilotPlugin
);
disconnect
(
_autoPilotPlugin
);
_autoPilotPlugin
=
NULL
;
disconnect
(
_autoPilotPlugin
,
&
AutoPilotPlugin
::
pluginReady
,
this
,
&
SetupView
::
_pluginReady
);
}
_autoPilotPlugin
=
NULL
;
_ui
->
buttonHolder
->
setAutoPilot
(
NULL
);
_firmwareButtonClicked
();
QObject
*
button
=
_ui
->
buttonHolder
->
rootObject
()
->
findChild
<
QObject
*>
(
"firmwareButton"
);
Q_ASSERT
(
button
);
button
->
setProperty
(
"checked"
,
true
);
_uasCurrent
=
uas
;
if
(
_uasCurrent
)
{
...
...
@@ -74,48 +103,27 @@ void SetupView::_setActiveUAS(UASInterface* uas)
connect
(
_autoPilotPlugin
,
&
AutoPilotPlugin
::
pluginReady
,
this
,
&
SetupView
::
_pluginReady
);
if
(
_autoPilotPlugin
->
pluginIsReady
())
{
_
setConnectedView
();
_
pluginReady
();
}
}
else
{
_setDisconnectedView
();
}
}
void
SetupView
::
_pluginReady
(
void
)
{
_setConnectedView
();
}
void
SetupView
::
_setViewConnections
(
void
)
{
QObject
*
button
=
rootObject
()
->
findChild
<
QObject
*>
(
"firmwareButton"
);
_ui
->
buttonHolder
->
setAutoPilot
(
_autoPilotPlugin
);
_summaryButtonClicked
();
QObject
*
button
=
_ui
->
buttonHolder
->
rootObject
()
->
findChild
<
QObject
*>
(
"summaryButton"
);
Q_ASSERT
(
button
);
connect
(
button
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
_firmwareButtonClicked
()));
button
=
rootObject
()
->
findChild
<
QObject
*>
(
"parametersButton"
);
if
(
button
)
{
connect
(
button
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
_parametersButtonClicked
()));
}
button
->
setProperty
(
"checked"
,
true
);
}
void
SetupView
::
_
setDisconnectedView
(
void
)
void
SetupView
::
_
changeSetupWidget
(
QWidget
*
newWidget
)
{
setSource
(
QUrl
::
fromUserInput
(
"qrc:qml/SetupViewDisconnected.qml"
));
_setViewConnections
();
}
void
SetupView
::
_setConnectedView
(
void
)
{
Q_ASSERT
(
_uasCurrent
);
Q_ASSERT
(
_autoPilotPlugin
);
setAutoPilot
(
_autoPilotPlugin
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:qml/SetupViewConnected.qml"
));
disconnect
(
_autoPilotPlugin
);
_setViewConnections
();
connect
((
QObject
*
)
rootObject
(),
SIGNAL
(
buttonClicked
(
QVariant
)),
this
,
SLOT
(
_setupButtonClicked
(
QVariant
)));
if
(
_currentSetupWidget
)
{
delete
_currentSetupWidget
;
}
_currentSetupWidget
=
newWidget
;
_ui
->
setupWidgetLayout
->
addWidget
(
newWidget
);
}
void
SetupView
::
_firmwareButtonClicked
(
void
)
...
...
@@ -125,24 +133,27 @@ void SetupView::_firmwareButtonClicked(void)
return
;
}
SetupWidgetHolder
*
dialog
=
new
SetupWidgetHolder
(
MainWindow
::
instance
());
dialog
->
setModal
(
true
);
dialog
->
setWindowTitle
(
"Firmware Upgrade"
);
PX4FirmwareUpgrade
*
setup
=
new
PX4FirmwareUpgrade
(
dialog
);
dialog
->
setInnerWidget
(
setup
);
dialog
->
exec
();
PX4FirmwareUpgrade
*
setup
=
new
PX4FirmwareUpgrade
(
this
);
_changeSetupWidget
(
setup
);
}
void
SetupView
::
_parametersButtonClicked
(
void
)
{
SetupWidgetHolder
*
dialog
=
new
SetupWidgetHolder
(
MainWindow
::
instance
());
dialog
->
setModal
(
true
);
dialog
->
setWindowTitle
(
"Parameter Editor"
);
ParameterEditor
*
setup
=
new
ParameterEditor
(
_uasCurrent
,
QStringList
(),
this
);
_changeSetupWidget
(
setup
);
}
void
SetupView
::
_summaryButtonClicked
(
void
)
{
Q_ASSERT
(
_autoPilotPlugin
);
QGCQmlWidgetHolder
*
summary
=
new
QGCQmlWidgetHolder
;
Q_CHECK_PTR
(
summary
);
ParameterEditor
*
setup
=
new
ParameterEditor
(
_uasCurrent
,
QStringList
(),
dialog
);
dialog
->
setInnerWidget
(
setup
);
dialog
->
exec
();
summary
->
setAutoPilot
(
_autoPilotPlugin
);
summary
->
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/VehicleSummary.qml"
));
_changeSetupWidget
(
summary
);
}
void
SetupView
::
_setupButtonClicked
(
const
QVariant
&
component
)
...
...
@@ -161,15 +172,5 @@ void SetupView::_setupButtonClicked(const QVariant& component)
return
;
}
SetupWidgetHolder
dialog
(
MainWindow
::
instance
());
dialog
.
setModal
(
true
);
dialog
.
setWindowTitle
(
vehicle
->
name
());
QWidget
*
setupWidget
=
vehicle
->
setupWidget
();
dialog
.
resize
(
setupWidget
->
minimumSize
());
dialog
.
setInnerWidget
(
setupWidget
);
dialog
.
exec
();
delete
setupWidget
;
_changeSetupWidget
(
vehicle
->
setupWidget
());
}
src/VehicleSetup/SetupView.h
View file @
fff84f17
...
...
@@ -24,18 +24,22 @@
#ifndef SETUPVIEW_H
#define SETUPVIEW_H
#include "UASInterface.h"
#include "ParameterEditor.h"
#include "VehicleComponent.h"
#include "QGCQuickWidget.h"
#include "AutoPilotPlugin.h"
#include <QWidget>
/// @file
/// @brief This class is used to display the UI for the VehicleComponent objects.
/// @author Don Gagne <don@thegagnes.com>
class
SetupView
:
public
QGCQuickWidget
namespace
Ui
{
class
SetupView
;
}
class
SetupView
:
public
QWidget
{
Q_OBJECT
...
...
@@ -48,16 +52,18 @@ private slots:
void
_pluginReady
(
void
);
void
_firmwareButtonClicked
(
void
);
void
_parametersButtonClicked
(
void
);
void
_summaryButtonClicked
(
void
);
void
_setupButtonClicked
(
const
QVariant
&
component
);
private:
void
_setConnectedView
(
void
);
void
_setDisconnectedView
(
void
);
void
_setViewConnections
(
void
);
void
_changeSetupWidget
(
QWidget
*
newWidget
);
UASInterface
*
_uasCurrent
;
///< Currently active UAS
bool
_initComplete
;
///< true: parameters are ready and ui has been setup
AutoPilotPlugin
*
_autoPilotPlugin
;
QWidget
*
_currentSetupWidget
;
Ui
::
SetupView
*
_ui
;
};
#endif
src/VehicleSetup/SetupView.ui
0 → 100644
View file @
fff84f17
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
SetupView
</class>
<widget
class=
"QWidget"
name=
"SetupView"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
946
</width>
<height>
821
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QGCQuickWidget"
name=
"buttonHolder"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
160
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
160
</width>
<height>
16777215
</height>
</size>
</property>
<property
name=
"resizeMode"
>
<enum>
QGCQuickWidget::SizeRootObjectToView
</enum>
</property>
</widget>
</item>
<item>
<widget
class=
"QWidget"
name=
"setupWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<property
name=
"autoFillBackground"
>
<bool>
true
</bool>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"setupWidgetLayout"
/>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
QGCQuickWidget
</class>
<extends>
QQuickWidget
</extends>
<header>
QGCQuickWidget.h
</header>
<container>
1
</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
src/VehicleSetup/SetupViewButtons.qml
0 → 100644
View file @
fff84f17
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
Controls
1.0
Rectangle
{
id
:
topLevel
QGCPalette
{
id
:
palette
;
colorGroup
:
QGCPalette
.
Active
}
color
:
palette
.
window
signal
firmwareButtonClicked
;
signal
summaryButtonClicked
;
signal
parametersButtonClicked
;
signal
setupButtonClicked
(
variant
component
);
ExclusiveGroup
{
id
:
setupButtonGroup
}
Component
{
id
:
disconnectedButtons
Column
{
spacing
:
10
SetupButton
{
id
:
firmwareButton
;
objectName
:
"
firmwareButton
"
width
:
parent
.
width
text
:
"
FIRMWARE
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
firmwareButtonClicked
()
}
}
}
Component
{
id
:
connectedButtons
Column
{
spacing
:
10
SetupButton
{
id
:
summaryButton
;
objectName
:
"
summaryButton
"
width
:
parent
.
width
text
:
"
VEHICLE SUMMARY
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
summaryButtonClicked
()
}
SetupButton
{
id
:
firmwareButton
;
objectName
:
"
firmwareButton
"
width
:
parent
.
width
text
:
"
FIRMWARE
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
firmwareButtonClicked
()
}
Repeater
{
model
:
autopilot
.
components
SetupButton
{
width
:
parent
.
width
text
:
modelData
.
name
.
toUpperCase
()
setupComplete
:
modelData
.
setupComplete
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
setupButtonClicked
(
modelData
)
}
}
SetupButton
{
width
:
parent
.
width
text
:
"
PARAMETERS
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
parametersButtonClicked
()
}
}
}
Loader
{
anchors.fill
:
parent
sourceComponent
:
autopilot
?
connectedButtons
:
disconnectedButtons
}
}
src/VehicleSetup/SetupViewDisconnected.qml
deleted
100644 → 0
View file @
d652eeb9
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
Rectangle
{
QGCPalette
{
id
:
palette
;
colorGroup
:
QGCPalette
.
Active
}
color
:
palette
.
window
Item
{
anchors.margins
:
20
anchors.fill
:
parent
Rectangle
{
id
:
header
;
color
:
"
lightblue
"
;
radius
:
10.0
;
width
:
parent
.
width
;
height
:
titleText
.
height
+
20
;
opacity
:
0.8
;
Text
{
id
:
titleText
;
anchors.centerIn
:
parent
;
font.pointSize
:
24
;
text
:
"
Vehicle Setup
"
}
}
Text
{
width
:
parent
.
width
;
height
:
parent
.
height
-
header
.
height
-
footer
.
height
;
anchors.top
:
header
.
bottom
color
:
palette
.
windowText
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
text
:
"
Vehicle Setup is only available while vehicle is connected.
"
}
Rectangle
{
id
:
footer
;
anchors.bottom
:
parent
.
bottom
;
color
:
"
lightblue
"
;
radius
:
10.0
;
width
:
parent
.
width
;
height
:
titleText
.
height
+
20
;
opacity
:
0.8
;
Button
{
id
:
firmwareButton
;
objectName
:
"
firmwareButton
"
;
anchors.horizontalCenter
:
parent
.
horizontalCenter
;
anchors.verticalCenter
:
parent
.
verticalCenter
;
text
:
"
Firmware Upgrade
"
}
}
}
}
src/VehicleSetup/SetupWidgetHolder.cc
deleted
100644 → 0
View file @
d652eeb9
#include "SetupWidgetHolder.h"
#include "ui_SetupWidgetHolder.h"
SetupWidgetHolder
::
SetupWidgetHolder
(
QWidget
*
parent
)
:
QDialog
(
parent
),
ui
(
new
Ui
::
SetupWidgetHolder
)
{
ui
->
setupUi
(
this
);
}
SetupWidgetHolder
::~
SetupWidgetHolder
()
{
delete
ui
;
}
void
SetupWidgetHolder
::
setInnerWidget
(
QWidget
*
widget
)
{
ui
->
setupWidgetLayout
->
addWidget
(
widget
);
}
src/VehicleSetup/SetupWidgetHolder.h
deleted
100644 → 0
View file @
d652eeb9
#ifndef SETUPWIDGETHOLDER_H
#define SETUPWIDGETHOLDER_H
#include <QDialog>
namespace
Ui
{
class
SetupWidgetHolder
;
}
class
SetupWidgetHolder
:
public
QDialog
{
Q_OBJECT
public:
explicit
SetupWidgetHolder
(
QWidget
*
parent
=
0
);
~
SetupWidgetHolder
();
void
setInnerWidget
(
QWidget
*
widget
);
private:
Ui
::
SetupWidgetHolder
*
ui
;
};
#endif // SETUPWIDGETHOLDER_H
src/VehicleSetup/SetupWidgetHolder.ui
deleted
100644 → 0
View file @
d652eeb9
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
SetupWidgetHolder
</class>
<widget
class=
"QDialog"
name=
"SetupWidgetHolder"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<property
name=
"autoFillBackground"
>
<bool>
true
</bool>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"setupWidgetLayout"
/>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
src/VehicleSetup/VehicleComponentSummaryItem.cc
deleted
100644 → 0
View file @
d652eeb9
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 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/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "VehicleComponentSummaryItem.h"
VehicleComponentSummaryItem
::
VehicleComponentSummaryItem
(
const
QString
&
name
,
const
QString
&
state
,
QObject
*
parent
)
:
QObject
(
parent
),
_name
(
name
),
_state
(
state
)
{
}
src/VehicleSetup/VehicleComponentSummaryItem.h
deleted
100644 → 0
View file @
d652eeb9
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 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/>.
======================================================================*/
#ifndef VehicleComponentSummaryItem_H
#define VehicleComponentSummaryItem_H
#include <QObject>
#include <QQmlContext>
#include <QQuickItem>
#include "UASInterface.h"
/// @file
/// @brief Vehicle Component class. A vehicle component is an object which
/// abstracts the physical portion of a vehicle into a set of
/// configurable values and user interface.
/// @author Don Gagne <don@thegagnes.com>
class
VehicleComponentSummaryItem
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
QString
state
READ
state
CONSTANT
)
public:
VehicleComponentSummaryItem
(
const
QString
&
name
,
const
QString
&
state
,
QObject
*
parent
=
NULL
);
QString
name
(
void
)
const
{
return
_name
;
}
QString
state
(
void
)
const
{
return
_state
;
}
protected:
QString
_name
;
QString
_state
;
};
#endif
src/VehicleSetup/
SetupViewConnected
.qml
→
src/VehicleSetup/
VehicleSummary
.qml
View file @
fff84f17
...
...
@@ -4,34 +4,29 @@ import QtQuick.Controls.Styles 1.2
import
QGroundControl
.
FactSystem
1.0
Rectangle
{
width
:
600
height
:
400
QGCPalette
{
id
:
palette
;
colorGroup
:
QGCPalette
.
Active
}
id
:
topLevel
objectName
:
"
topLevel
"
color
:
palette
.
window
signal
buttonClicked
(
variant
component
);
Image
{
anchors.fill
:
parent
fillMode
:
Image
.
PreserveAspectFit
smooth
:
true
source
:
autopilot
.
setupBackgroundImage
;
}
Column
{
anchors.margins
:
20
anchors.fill
:
parent
spacing
:
5
Rectangle
{
id
:
header
;
color
:
"
lightblue
"
;
radius
:
10.0
;
width
:
parent
.
width
;
height
:
titleText
.
height
+
20
;
opacity
:
0.8
;
Text
{
id
:
titleText
;
anchors.centerIn
:
parent
;
font.pointSize
:
24
;
text
:
"
Vehicle Setup
"
}
}
Flow
{
width
:
parent
.
width
;
height
:
parent
.
height
-
header
.
height
-
footer
.
height
height
:
parent
.
height
spacing
:
5
Repeater
{
...
...
@@ -54,9 +49,8 @@ Rectangle {
border.color
:
"
#888
"
radius
:
10
color
:
control
.
activeFocus
?
"
#47b
"
:
"
white
"
opacity
:
control
.
hovered
||
control
.
activeFocus
?
1
:
0.8
Behavior
on
opacity
{
NumberAnimation
{
duration
:
100
}}
color
:
"
white
"
opacity
:
0.8
Text
{
id
:
titleBar
...
...
@@ -108,23 +102,8 @@ Rectangle {
label
:
Item
{}
}
onClicked
:
topLevel
.
buttonClicked
(
modelData
)
}
}
}
Rectangle
{
id
:
footer
;
color
:
"
lightblue
"
;
radius
:
10.0
;
width
:
parent
.
width
;
height
:
titleText
.
height
+
20
;
opacity
:
0.8
;
property
real
spacing
:
(
width
-
firmwareButton
.
width
-
parametersButton
.
width
)
/
3
Button
{
id
:
firmwareButton
;
objectName
:
"
firmwareButton
"
;
x
:
parent
.
spacing
;
anchors.verticalCenter
:
parent
.
verticalCenter
;
text
:
"
Firmware Upgrade
"
}
Button
{
id
:
parametersButton
;
objectName
:
"
parametersButton
"
x
:
firmwareButton
.
width
+
(
parent
.
spacing
*
2
);
anchors.verticalCenter
:
parent
.
verticalCenter
;
text
:
"
Parameters
"
}
}
}
}
src/test.qml
View file @
fff84f17
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
//
import QGroundControl.FactControls 1.0
import
QGroundControl
.
FactControls
1.0
Row
{
width
:
200
Text
{
id
:
firstCol
;
text
:
"
Col 1
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
firstCol
.
contentWidth
;
text
:
"
Col 2
"
}
Rectangle
{
QGCPalette
{
id
:
palette
;
colorGroup
:
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Disabled
}
width
:
100
height
:
100
color
:
"
#e43f3f
"
// palette.windowText
}
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