Commit d8cb9592 authored by Don Gagne's avatar Don Gagne

Merge pull request #2005 from DonLakeFlyer/FullQml

MainWindow is now 100% Qml
parents 3ba9c2f8 57c34c1c
......@@ -216,7 +216,7 @@ HEADERS += \
src/comm/TCPLink.h \
src/comm/UDPLink.h \
src/FlightDisplay/FlightDisplayWidget.h \
src/FlightDisplay/FlightDisplayView.h \
src/FlightDisplay/FlightDisplayViewController.h \
src/FlightMap/FlightMapSettings.h \
src/GAudioOutput.h \
src/HomePositionManager.h \
......@@ -224,7 +224,7 @@ HEADERS += \
src/Joystick/JoystickManager.h \
src/LogCompressor.h \
src/MG.h \
src/MissionEditor/MissionEditor.h \
src/MissionEditor/MissionEditorController.h \
src/MissionManager/MissionManager.h \
src/QGC.h \
src/QGCApplication.h \
......@@ -264,7 +264,7 @@ HEADERS += \
src/ui/QGCTCPLinkConfiguration.h \
src/ui/QGCUDPLinkConfiguration.h \
src/ui/SettingsDialog.h \
src/ui/toolbar/MainToolBar.h \
src/ui/toolbar/MainToolBarController.h \
src/ui/uas/QGCUnconnectedInfoWidget.h \
src/ui/uas/UASMessageView.h \
src/MissionItem.h \
......@@ -327,7 +327,7 @@ SOURCES += \
src/comm/TCPLink.cc \
src/comm/UDPLink.cc \
src/FlightDisplay/FlightDisplayWidget.cc \
src/FlightDisplay/FlightDisplayView.cc \
src/FlightDisplay/FlightDisplayViewController.cc \
src/FlightMap/FlightMapSettings.cc \
src/GAudioOutput.cc \
src/HomePositionManager.cc \
......@@ -335,7 +335,7 @@ SOURCES += \
src/Joystick/JoystickManager.cc \
src/LogCompressor.cc \
src/main.cc \
src/MissionEditor/MissionEditor.cc \
src/MissionEditor/MissionEditorController.cc \
src/MissionManager/MissionManager.cc \
src/QGC.cc \
src/QGCApplication.cc \
......@@ -369,7 +369,7 @@ SOURCES += \
src/ui/QGCTCPLinkConfiguration.cc \
src/ui/QGCUDPLinkConfiguration.cc \
src/ui/SettingsDialog.cc \
src/ui/toolbar/MainToolBar.cc \
src/ui/toolbar/MainToolBarController.cc \
src/ui/uas/QGCUnconnectedInfoWidget.cc \
src/ui/uas/UASMessageView.cc \
src/MissionItem.cc \
......@@ -518,7 +518,6 @@ HEADERS+= \
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h \
src/Vehicle/MultiVehicleManager.h \
src/Vehicle/Vehicle.h \
src/VehicleSetup/SetupView.h \
src/VehicleSetup/VehicleComponent.h \
!MobileBuild {
......@@ -557,7 +556,6 @@ SOURCES += \
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc \
src/Vehicle/MultiVehicleManager.cc \
src/Vehicle/Vehicle.cc \
src/VehicleSetup/SetupView.cc \
src/VehicleSetup/VehicleComponent.cc \
!MobileBuild {
......
......@@ -119,6 +119,11 @@
<file alias="QGroundControl/Controls/QGCCanvas.qml">src/QmlControls/QGCCanvas.qml</file>
<file alias="QGroundControl/Controls/ExclusiveGroupItem.qml">src/QmlControls/ExclusiveGroupItem.qml</file>
<!-- Main Window -->
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
<file alias="QGroundControl/Controls/MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="QGroundControl/Controls/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<!-- Vehicle Setup -->
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
......
......@@ -64,9 +64,7 @@ void AutoPilotPlugin::_parametersReadyChanged(bool parametersReady)
QGCMessageBox::warning("Setup", "One or more vehicle components require setup prior to flight.");
// Take the user to Vehicle Summary
MainWindow* mainWindow = MainWindow::instance();
Q_ASSERT(mainWindow);
mainWindow->getMainToolBar()->onSetupView();
MainWindow::instance()->showSetupView();
qgcApp()->processEvents(QEventLoop::ExcludeUserInputEvents);
}
}
......
......@@ -34,11 +34,23 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.Controllers 1.0
/// Flight Display View
Item {
id: root
// Top margin for all widgets. Used to prevent overlap with the toolbar
property real topMargin: 0
// Used by parent to hide widgets when it displays something above in the z order.
// Prevents z order drawing problems.
property bool hideWidgets: false
readonly property alias zOrderTopMost: flightMap.zOrderTopMost
readonly property alias zOrderWidgets: flightMap.zOrderWidgets
readonly property alias zOrderMapItems: flightMap.zOrderMapItems
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property var _activeVehicle: multiVehicleManager.activeVehicle
......@@ -70,6 +82,8 @@ Item {
property bool _showMap: getBool(QGroundControl.flightMapSettings.loadMapSetting(flightMap.mapName, _showMapBackgroundKey, "1"))
FlightDisplayViewController { id: _controller; }
ExclusiveGroup {
id: _dropButtonsExclusiveGroup
}
......@@ -86,7 +100,7 @@ Item {
}
function _setShowMap(showMap) {
_showMap = flightDisplay.hasVideo ? showMap : true
_showMap = _controller.hasVideo ? showMap : true
QGroundControl.flightMapSettings.saveMapSetting(flightMap.mapName, _showMapBackgroundKey, setBool(_showMap))
}
......@@ -118,6 +132,7 @@ Item {
label: "H"
coordinate: (_activeVehicle && _activeVehicle.homePositionAvailable) ? _activeVehicle.homePosition : QtPositioning.coordinate(0, 0)
visible: _activeVehicle ? _activeVehicle.homePositionAvailable : false
z: flightMap.zOrderMapItems
}
// Add trajectory points to the map
......@@ -128,6 +143,8 @@ Item {
MapPolyline {
line.width: 3
line.color: "orange"
z: flightMap.zOrderMapItems - 1
path: [
{ latitude: object.coordinate1.latitude, longitude: object.coordinate1.longitude },
......@@ -145,6 +162,7 @@ Item {
vehicle: object
coordinate: object.coordinate
isSatellite: flightMap.isSatelliteMap
z: flightMap.zOrderMapItems
}
}
......@@ -157,6 +175,7 @@ Item {
label: object.sequenceNumber
isCurrentItem: object.isCurrentItem
coordinate: object.coordinate
z: flightMap.zOrderMapItems
}
}
......@@ -175,17 +194,20 @@ Item {
horizontalAlignment: Text.AlignHCenter
visible: object.satelliteLock < 2
text: "No GPS Lock for Vehicle #" + object.id
z: flightMap.zOrderMapItems - 2
}
}
}
QGCCompassWidget {
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.topMargin: topMargin
anchors.left: parent.left
anchors.top: parent.top
size: ScreenTools.defaultFontPixelSize * (13.3)
heading: _heading
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
QGCAttitudeWidget {
......@@ -196,6 +218,7 @@ Item {
rollAngle: _roll
pitchAngle: _pitch
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
DropButton {
......@@ -207,6 +230,7 @@ Item {
buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: flightMap.zOrderWidgets
dropDownComponent: Component {
Row {
......@@ -242,14 +266,16 @@ Item {
}
DropButton {
id: mapTypeButton
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.top: parent.top
anchors.right: parent.right
dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
id: mapTypeButton
anchors.topMargin: topMargin
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.top: parent.top
anchors.right: parent.right
dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: flightMap.zOrderWidgets
dropDownComponent: Component {
Row {
......@@ -277,8 +303,8 @@ Item {
QGCVideoBackground {
anchors.fill: parent
display: videoDisplay
receiver: videoReceiver
display: _controller.videoSurface
receiver: _controller.videoReceiver
visible: !_showMap
QGCCompassHUD {
......@@ -289,7 +315,7 @@ Item {
height: ScreenTools.defaultFontPixelSize * (10)
heading: _heading
active: multiVehicleManager.activeVehicleAvailable
z: 70
z: flightMap.zOrderWidgets
}
QGCAttitudeHUD {
......@@ -299,6 +325,7 @@ Item {
width: ScreenTools.defaultFontPixelSize * (30)
height: ScreenTools.defaultFontPixelSize * (30)
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
}
......@@ -307,7 +334,8 @@ Item {
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
width: ScreenTools.defaultFontPixelSize * (5)
altitude: _altitudeWGS84
z: 30
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCSpeedWidget {
......@@ -315,7 +343,8 @@ Item {
width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
speed: _groundSpeed
z: 40
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCCurrentSpeed {
......@@ -324,7 +353,8 @@ Item {
airspeed: _airSpeed
groundspeed: _groundSpeed
active: multiVehicleManager.activeVehicleAvailable
z: 50
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCCurrentAltitude {
......@@ -333,7 +363,8 @@ Item {
altitude: _altitudeWGS84
vertZ: _climbRate
active: multiVehicleManager.activeVehicleAvailable
z: 60
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
// Mission item list
......@@ -348,6 +379,8 @@ Item {
opacity: 0.75
orientation: ListView.Horizontal
model: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.missionItems : 0
z: flightMap.zOrderWidgets
visible: !hideWidgets
property real _maxItemHeight: 0
......@@ -360,12 +393,14 @@ Item {
QGCButton {
id: optionsButton
x: flightMap.mapWidgets.x
y: flightMap.mapWidgets.y - height - (ScreenTools.defaultFontPixelHeight / 2)
width: flightMap.mapWidgets.width
text: "Options"
menu: optionsMenu
id: optionsButton
x: flightMap.mapWidgets.x
y: flightMap.mapWidgets.y - height - (ScreenTools.defaultFontPixelHeight / 2)
z: flightMap.zOrderWidgets
width: flightMap.mapWidgets.width
text: "Options"
menu: optionsMenu
visible: _controller.hasVideo && !hideWidgets
ExclusiveGroup {
id: backgroundTypeGroup
......@@ -380,7 +415,6 @@ Item {
checkable: true
checked: _showMap
text: "Show map as background"
visible: flightDisplay.hasVideo
onTriggered: _setShowMap(true)
}
......@@ -391,14 +425,9 @@ Item {
checkable: true
checked: !_showMap
text: "Show video as background"
visible: flightDisplay.hasVideo
onTriggered: _setShowMap(false)
}
MenuSeparator {
visible: flightDisplay.hasVideo && _showMap
}
}
}
}
......@@ -26,30 +26,15 @@ This file is part of the QGROUNDCONTROL project
#include <QSettings>
#include <VideoItem.h>
#include <VideoSurface.h>
#include "VideoReceiver.h"
#include "ScreenToolsController.h"
#include "FlightDisplayView.h"
#include "FlightDisplayViewController.h"
const char* kMainFlightDisplayViewGroup = "FlightDisplayView";
const char* kMainFlightDisplayViewControllerGroup = "FlightDisplayViewController";
FlightDisplayView::FlightDisplayView(QWidget *parent)
: QGCQmlWidgetHolder(QString(), NULL, parent)
FlightDisplayViewController::FlightDisplayViewController(QObject *parent)
: QObject(parent)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setObjectName("FlightDisplayView");
// Get rid of layout default margins
QLayout* pl = layout();
if(pl) {
pl->setContentsMargins(0,0,0,0);
}
#ifndef __android__
setMinimumWidth( 31 * ScreenToolsController::defaultFontPixelSize_s());
setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s());
#endif
setContextPropertyObject("flightDisplay", this);
/*
* This is the receiving end of an UDP RTP stream. The sender can be setup with this command:
*
......@@ -75,19 +60,15 @@ FlightDisplayView::FlightDisplayView(QWidget *parent)
* Do not change anything else unless you know what you are doing. Any other change will require a matching change on the receiving end.
*
*/
VideoSurface* pSurface = new VideoSurface;
setContextPropertyObject("videoDisplay", pSurface);
VideoReceiver* pReceiver = new VideoReceiver(this);
pReceiver->setUri(QLatin1Literal("udp://0.0.0.0:5000"));
_videoSurface = new VideoSurface;
_videoReceiver = new VideoReceiver(this);
_videoReceiver->setUri(QLatin1Literal("udp://0.0.0.0:5000"));
#if defined(QGC_GST_STREAMING)
pReceiver->setVideoSink(pSurface->videoSink());
_videoReceiver->setVideoSink(_videoSurface->videoSink());
#endif
setContextPropertyObject("videoReceiver", pReceiver);
setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplayView.qml"));
setVisible(true);
}
FlightDisplayView::~FlightDisplayView()
FlightDisplayViewController::~FlightDisplayViewController()
{
}
......@@ -21,32 +21,36 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
#ifndef FlightDisplayView_H
#define FlightDisplayView_H
#ifndef FlightDisplayViewController_H
#define FlightDisplayViewController_H
#include "QGCQmlWidgetHolder.h"
#include <QObject>
class FlightDisplayView : public QGCQmlWidgetHolder
#include "VideoSurface.h"
#include "VideoReceiver.h"
class FlightDisplayViewController : public QObject
{
Q_OBJECT
public:
FlightDisplayView(QWidget* parent = NULL);
~FlightDisplayView();
/// @brief Invokes the Flight Display Options menu
void showOptionsMenu() { emit showOptionsMenuChanged(); }
public:
FlightDisplayViewController(QObject* parent = NULL);
~FlightDisplayViewController();
Q_PROPERTY(bool hasVideo READ hasVideo CONSTANT)
Q_PROPERTY(VideoSurface* videoSurface MEMBER _videoSurface CONSTANT);
Q_PROPERTY(VideoReceiver* videoReceiver MEMBER _videoReceiver CONSTANT);
#if defined(QGC_GST_STREAMING)
bool hasVideo () { return true; }
#else
bool hasVideo () { return false; }
#endif
signals:
void showOptionsMenuChanged ();
private:
VideoSurface* _videoSurface;
VideoReceiver* _videoReceiver;
};
#endif
......@@ -55,6 +55,10 @@ Map {
property real lon: (longitude >= -180 && longitude <= 180) ? longitude : 0
property real lat: (latitude >= -90 && latitude <= 90) ? latitude : 0
readonly property real zOrderTopMost: 1000 ///< z order for top most items, toolbar, main window sub view
readonly property real zOrderWidgets: 100 ///< z order value to widgets, for example: zoom controls, hud widgetss
readonly property real zOrderMapItems: 50 ///< z order value for map items, for example: mission item indicators
zoomLevel: 18
center: QtPositioning.coordinate(lat, lon)
gesture.flickDeceleration: 3000
......@@ -115,6 +119,7 @@ Map {
QGCButton {
width: parent._buttonWidth
z: zOrderWidgets
//iconSource: "/qmlimages/ZoomPlus.svg"
text: "+"
......@@ -131,6 +136,7 @@ Map {
QGCButton {
width: parent._buttonWidth
z: zOrderWidgets
//iconSource: "/qmlimages/ZoomMinus.svg"
text: "-"
......
This diff is collapsed.
......@@ -21,20 +21,21 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
#ifndef MissionEditor_H
#define MissionEditor_H
#ifndef MissionEditorController_H
#define MissionEditorController_H
#include <QObject>
#include "QGCQmlWidgetHolder.h"
#include "QmlObjectListModel.h"
#include "Vehicle.h"
class MissionEditor : public QGCQmlWidgetHolder
class MissionEditorController : public QObject
{
Q_OBJECT
public:
MissionEditor(QWidget* parent = NULL);
~MissionEditor();
MissionEditorController(QWidget* parent = NULL);
~MissionEditorController();
Q_PROPERTY(QmlObjectListModel* missionItems READ missionItems NOTIFY missionItemsChanged)
Q_PROPERTY(QmlObjectListModel* waypointLines READ waypointLines NOTIFY waypointLinesChanged)
......
......@@ -85,6 +85,11 @@
#include "FlightMapSettings.h"
#include "QGCQGeoCoordinate.h"
#include "CoordinateVector.h"
#include "MainToolBarController.h"
#include "MissionEditorController.h"
#include "FlightDisplayViewController.h"
#include "VideoSurface.h"
#include "VideoReceiver.h"
#ifndef __ios__
#include "SerialLink.h"
......@@ -333,7 +338,9 @@ void QGCApplication::_initCommon(void)
qmlRegisterUncreatableType<QmlObjectListModel> ("QGroundControl", 1, 0, "QmlObjectListModel", "Reference only");
qmlRegisterUncreatableType<QGCQGeoCoordinate> ("QGroundControl", 1, 0, "QGCQGeoCoordinate", "Reference only");
qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", "Reference only");
qmlRegisterUncreatableType<VideoSurface> ("QGroundControl", 1, 0, "VideoSurface", "Reference only");
qmlRegisterUncreatableType<VideoReceiver> ("QGroundControl", 1, 0, "VideoReceiver", "Reference only");
qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<FlightModesComponentController> ("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController> ("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
......@@ -341,7 +348,10 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<PowerComponentController> ("QGroundControl.Controllers", 1, 0, "PowerComponentController");
qmlRegisterType<RadioComponentController> ("QGroundControl.Controllers", 1, 0, "RadioComponentController");
qmlRegisterType<ScreenToolsController> ("QGroundControl.Controllers", 1, 0, "ScreenToolsController");
qmlRegisterType<MainToolBarController> ("QGroundControl.Controllers", 1, 0, "MainToolBarController");
qmlRegisterType<MissionEditorController> ("QGroundControl.Controllers", 1, 0, "MissionEditorController");
qmlRegisterType<FlightDisplayViewController> ("QGroundControl.Controllers", 1, 0, "FlightDisplayViewController");
#ifndef __mobile__
qmlRegisterType<ViewWidgetController> ("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<CustomCommandWidgetController> ("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
......@@ -636,8 +646,9 @@ void QGCApplication::_createSingletons(void)
void QGCApplication::_destroySingletons(void)
{
if (MainWindow::instance()) {
delete MainWindow::instance();
MainWindow* mainWindow = MainWindow::instance();
if (mainWindow) {
delete mainWindow;
}
if (LinkManager::instance(true /* nullOk */)) {
......@@ -804,7 +815,7 @@ void QGCApplication::showToolBarMessage(const QString& message)
{
MainWindow* mainWindow = MainWindow::instance();
if (mainWindow) {
mainWindow->getMainToolBar()->showToolBarMessage(message);
mainWindow->showToolbarMessage(message);
} else {
QGCMessageBox::information("", message);
}
......
......@@ -24,6 +24,7 @@
#include "QGCFileDialog.h"
#include "QGCApplication.h"
#include "MainWindow.h"
#ifdef QT_DEBUG
#ifndef __mobile__
#include "UnitTest.h"
......
......@@ -28,10 +28,12 @@
#include "MainWindow.h"
#include "QGCApplication.h"
#ifdef QT_DEBUG
#ifndef __mobile__
#include "UnitTest.h"
#endif
#endif
/// @file
......
......@@ -31,6 +31,8 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(const QString& title, QAction* action, QW
{
_ui.setupUi(this);
layout()->setContentsMargins(0,0,0,0);
if (action) {
setWindowTitle(title);
}
......@@ -70,4 +72,4 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void)
void QGCQmlWidgetHolder::setResizeMode(QQuickWidget::ResizeMode resizeMode)
{
_ui.qmlWidget->setResizeMode(resizeMode);
}
\ No newline at end of file
}
......@@ -34,3 +34,6 @@ MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
MissionItemSummary 1.0 MissionItemSummary.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MainToolBar 1.0 MainToolBar.qml
FlightDisplayView 1.0 FlightDisplayView.qml
/*=====================================================================
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/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "SetupView.h"
#include "AutoPilotPluginManager.h"
#include "VehicleComponent.h"
#include "QGCQmlWidgetHolder.h"
#include "MainWindow.h"
#include "QGCMessageBox.h"
#ifndef __mobile__
#include "FirmwareUpgradeController.h"
#endif
#include "ParameterEditorController.h"
#include <QQmlError>
#include <QQmlContext>
#include <QDebug>
SetupView::SetupView(QWidget* parent) :
QGCQmlWidgetHolder(QString(), NULL, parent)
{
setSource(QUrl::fromUserInput("qrc:/qml/SetupView.qml"));
}
SetupView::~SetupView()
{
}
#ifdef UNITTEST_BUILD
void SetupView::showFirmware(void)
{
#ifndef __mobile__
QVariant returnedValue;
bool success = QMetaObject::invokeMethod(getRootObject(),
"showFirmwarePanel",
Q_RETURN_ARG(QVariant, returnedValue));
Q_ASSERT(success);
Q_UNUSED(success);
#endif
}
void SetupView::showParameters(void)
{
QVariant returnedValue;
bool success = QMetaObject::invokeMethod(getRootObject(),
"showParametersPanel",
Q_RETURN_ARG(QVariant, returnedValue));
Q_ASSERT(success);
Q_UNUSED(success);
}
void SetupView::showSummary(void)
{
QVariant returnedValue;
bool success = QMetaObject::invokeMethod(getRootObject(),
"showSummaryPanel",
Q_RETURN_ARG(QVariant, returnedValue));
Q_ASSERT(success);
Q_UNUSED(success);
}
void SetupView::showVehicleComponentSetup(VehicleComponent* vehicleComponent)
{
QVariant returnedValue;
bool success = QMetaObject::invokeMethod(getRootObject(),
"showVehicleComponentPanel",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, QVariant::fromValue((VehicleComponent*)vehicleComponent)));
Q_ASSERT(success);
Q_UNUSED(success);
}
#endif
/*=====================================================================
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 SETUPVIEW_H
#define SETUPVIEW_H
#include "UASInterface.h"
#include "VehicleComponent.h"
#include "AutoPilotPlugin.h"
#include "QGCQmlWidgetHolder.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 QGCQmlWidgetHolder
{
Q_OBJECT
public:
explicit SetupView(QWidget* parent = 0);
~SetupView();
#ifdef UNITTEST_BUILD
void showFirmware(void);
void showParameters(void);
void showSummary(void);
void showVehicleComponentSetup(VehicleComponent* vehicleComponent);
#endif
};
#endif
......@@ -37,6 +37,7 @@ import QGroundControl.MultiVehicleManager 1.0
Rectangle {
id: topLevel
color: palette.window
z: zOrder // zOrder comes from the Loader in MainWindow.qml
QGCPalette { id: palette; colorGroupEnabled: true }
......
......@@ -27,14 +27,12 @@
#include "SetupViewTest.h"
#include "MockLink.h"
#include "QGCMessageBox.h"
#include "SetupView.h"
#include "MultiVehicleManager.h"
UT_REGISTER_TEST(SetupViewTest)
SetupViewTest::SetupViewTest(void) :
_mainWindow(NULL),
_mainToolBar(NULL)
_mainWindow(NULL)
{
}
......@@ -45,9 +43,6 @@ void SetupViewTest::init(void)
_mainWindow = MainWindow::_create(NULL);
Q_CHECK_PTR(_mainWindow);
_mainToolBar = _mainWindow->getMainToolBar();
Q_ASSERT(_mainToolBar);
}
void SetupViewTest::cleanup(void)
......@@ -78,33 +73,29 @@ void SetupViewTest::_clickThrough_test(void)
AutoPilotPlugin* autopilot = MultiVehicleManager::instance()->activeVehicle()->autopilotPlugin();
Q_ASSERT(autopilot);
// Switch to the Setup view
_mainToolBar->onSetupView();
QTest::qWait(1000);
MainWindow* mainWindow = MainWindow::instance();
Q_ASSERT(mainWindow);
QWidget* setupViewWidget = mainWindow->getCurrentViewWidget();
Q_ASSERT(setupViewWidget);
SetupView* setupView = qobject_cast<SetupView*>(setupViewWidget);
Q_ASSERT(setupView);
// Switch to the Setup view
_mainWindow->showSetupView();
QTest::qWait(1000);
// Click through fixed buttons
qDebug() << "Showing firmware";
setupView->showFirmware();
_mainWindow->showSetupFirmware();
QTest::qWait(1000);
qDebug() << "Showing parameters";
setupView->showParameters();
_mainWindow->showSetupParameters();
QTest::qWait(1000);
qDebug() << "Showing summary";
setupView->showSummary();
_mainWindow->showSetupSummary();
QTest::qWait(1000);
const QVariantList& components = autopilot->vehicleComponents();
foreach(QVariant varComponent, components) {
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(varComponent));
qDebug() << "Showing" << component->name();
setupView->showVehicleComponentSetup(component);
_mainWindow->showSetupVehicleComponent(component);
QTest::qWait(1000);
}
......
......@@ -29,7 +29,6 @@
#include "UnitTest.h"
#include "MainWindow.h"
#include "MainToolBar.h"
/// Click through test for Setup View buttons
class SetupViewTest : public UnitTest
......@@ -47,7 +46,6 @@ private slots:
private:
MainWindow* _mainWindow;
MainToolBar* _mainToolBar;
};
#endif
......@@ -67,6 +67,10 @@ union px4_custom_mode {
float data_float;
};
float MockLink::_vehicleLatitude = 47.633033f;
float MockLink::_vehicleLongitude = -122.08794f;
float MockLink::_vehicleAltitude = 2.5f;
MockLink::MockLink(MockConfiguration* config)
: _missionItemHandler(this)
, _name("MockLink")
......@@ -164,6 +168,7 @@ void MockLink::_run1HzTasks(void)
void MockLink::_run10HzTasks(void)
{
if (_mavlinkStarted && _connected) {
_sendGpsRawInt();
}
}
......@@ -696,7 +701,7 @@ void MockLink::setMissionItemFailureMode(MockLinkMissionItemHandler::FailureMode
void MockLink::_sendHomePosition(void)
{
mavlink_message_t msg;
mavlink_message_t msg;
float bogus[4];
bogus[0] = 0.0f;
......@@ -707,11 +712,31 @@ void MockLink::_sendHomePosition(void)
mavlink_msg_home_position_pack(_vehicleSystemId,
_vehicleComponentId,
&msg,
(int32_t)(47.633033f * 1E7),
(int32_t)(-122.08794f * 1E7),
(int32_t)(2.0f * 1000),
(int32_t)(_vehicleLatitude * 1E7),
(int32_t)(_vehicleLongitude * 1E7),
(int32_t)(_vehicleAltitude * 1000),
0.0f, 0.0f, 0.0f,
&bogus[0],
0.0f, 0.0f, 0.0f);
respondWithMavlinkMessage(msg);
}
void MockLink::_sendGpsRawInt(void)
{
static uint64_t timeTick = 0;
mavlink_message_t msg;
mavlink_msg_gps_raw_int_pack(_vehicleSystemId,
_vehicleComponentId,
&msg,
timeTick++, // time since boot
3, // 3D fix
(int32_t)(_vehicleLatitude * 1E7),
(int32_t)(_vehicleLongitude * 1E7),
(int32_t)(_vehicleAltitude * 1000),
UINT16_MAX, UINT16_MAX, // HDOP/VDOP not known
UINT16_MAX, // velocity not known
UINT16_MAX, // course over ground not known
8); // satellite count
respondWithMavlinkMessage(msg);
}
......@@ -144,6 +144,7 @@ private:
float _floatUnionForParam(int componentId, const QString& paramName);
void _setParamFloatUnionIntoMap(int componentId, const QString& paramName, float paramFloat);
void _sendHomePosition(void);
void _sendGpsRawInt(void);
MockLinkMissionItemHandler _missionItemHandler;
......@@ -167,6 +168,10 @@ private:
MAV_AUTOPILOT _autopilotType;
MockLinkFileServer* _fileServer;
static float _vehicleLatitude;
static float _vehicleLongitude;
static float _vehicleAltitude;
};
#endif
......@@ -34,8 +34,7 @@
UT_REGISTER_TEST(MainWindowTest)
MainWindowTest::MainWindowTest(void) :
_mainWindow(NULL),
_mainToolBar(NULL)
_mainWindow(NULL)
{
}
......@@ -46,14 +45,12 @@ void MainWindowTest::init(void)
_mainWindow = MainWindow::_create(NULL);
Q_CHECK_PTR(_mainWindow);
_mainToolBar = _mainWindow->getMainToolBar();
Q_ASSERT(_mainToolBar);
}
void MainWindowTest::cleanup(void)
{
_mainWindow->close();
QTest::qWait(200);
delete _mainWindow;
UnitTest::cleanup();
......@@ -78,11 +75,11 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot)
// Cycle through all the top level views
_mainToolBar->onSetupView();
_mainWindow->showSetupView();
QTest::qWait(200);
_mainToolBar->onPlanView();
_mainWindow->showPlanView();
QTest::qWait(200);
_mainToolBar->onFlyView();
_mainWindow->showFlyView();
QTest::qWait(200);
// On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing.
......
......@@ -31,7 +31,6 @@
#include "UnitTest.h"
#include "MainWindow.h"
#include "MainToolBar.h"
class MainWindowTest : public UnitTest
{
......@@ -51,7 +50,6 @@ private:
void _connectWindowClose_test(MAV_AUTOPILOT autopilot);
MainWindow* _mainWindow;
MainToolBar* _mainToolBar;
};
#endif
This diff is collapsed.
......@@ -37,25 +37,24 @@ This file is part of the QGROUNDCONTROL project
#include <QSettings>
#include <QList>
#include "ui_MainWindow.h"
#include "LinkManager.h"
#include "LinkInterface.h"
#include "UASInterface.h"
#include "CameraView.h"
#include "MainToolBar.h"
#include "LogCompressor.h"
#include "FlightDisplayView.h"
#include "QGCMAVLinkInspector.h"
#include "QGCMAVLinkLogPlayer.h"
#include "MAVLinkDecoder.h"
#include "Vehicle.h"
#include "QGCDockWidget.h"
#include "QGCQmlWidgetHolder.h"
#include "ui_MainWindow.h"
#if (defined QGC_MOUSE_ENABLED_WIN) | (defined QGC_MOUSE_ENABLED_LINUX)
#include "Mouse6dofInput.h"
#endif // QGC_MOUSE_ENABLED_WIN
class QSplashScreen;
class QGCStatusBar;
class Linecharts;
......@@ -67,7 +66,6 @@ class QGCDataPlot2D;
**/
class MainWindow : public QMainWindow
{
friend class MainToolBar;
Q_OBJECT
public:
......@@ -106,32 +104,13 @@ public:
/// @brief Restore (and connects) the last used connection (if any)
void restoreLastUsedConnection();
/// @brief Gets a pointer to the Main Tool Bar
MainToolBar* getMainToolBar(void) { return _mainToolBar; }
/// @brief Gets a pointer to the Main Flight Display
FlightDisplayView* getFlightDisplay() { return dynamic_cast<FlightDisplayView*>(_flightView.data()); }
QWidget* getCurrentViewWidget(void) { return _currentViewWidget; }
public slots:
/** @brief Show the application settings */
void showSettings();
void loadSetupView();
void loadFlightView();
void loadPlanView();
void manageLinks();
/** @brief Show the online help for users */
void showHelp();
/** @brief Show the authors / credits */
void showCredits();
/** @brief Show the project roadmap */
void showRoadMap();
/** @brief Automatically reconnect last link */
void enableAutoReconnect(bool enabled);
......@@ -143,8 +122,6 @@ public slots:
/** @brief Update the window name */
void configureWindowName();
void commsWidgetDestroyed(QObject *obj);
protected slots:
/**
* @brief Unchecks the normalActionItem.
......@@ -164,6 +141,19 @@ protected slots:
void showStatusBarCallback(bool checked);
signals:
// Signals the Qml to show the specified view
void showFlyView(void);
void showPlanView(void);
void showSetupView(void);
void showToolbarMessage(const QString& message);
// These are used for unit testing
void showSetupFirmware(void);
void showSetupParameters(void);
void showSetupSummary(void);
void showSetupVehicleComponent(VehicleComponent* vehicleComponent);
void initStatusChanged(const QString& message, int alignment, const QColor &color);
/** Emitted when any value changes from any source */
void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec);
......@@ -182,22 +172,6 @@ public:
}
protected:
typedef enum _VIEW_SECTIONS
{
VIEW_UNUSED5, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_UNUSED3, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_UNUSED4, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_SETUP, // Setup view. Used for initializing the system for operation.
VIEW_UNUSED1, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_UNUSED2, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_MISSIONEDITOR, // New mission editor
} VIEW_SECTIONS;
/** @brief Catch window resize events */
void resizeEvent(QResizeEvent * event);
void connectCommonActions();
void loadSettings();
......@@ -205,10 +179,6 @@ protected:
QSettings settings;
// Center widgets
QPointer<Linecharts> linechartWidget;
QPointer<MainToolBar> _mainToolBar;
QPointer<MAVLinkDecoder> mavlinkDecoder;
QGCMAVLinkLogPlayer* logPlayer;
......@@ -241,7 +211,7 @@ private slots:
void _linkStateChange(LinkInterface*);
void _closeWindow(void) { close(); }
void _vehicleAdded(Vehicle* vehicle);
#ifndef __mobile__
void _showDockWidgetAction(bool show);
#endif
......@@ -277,12 +247,6 @@ private:
QMap<QString, QAction*> _mapName2Action;
#endif
void _buildPlanView(void);
void _buildFlightView(void);
void _buildSetupView(void);
void _buildTerminalView(void);
void _buildMissionEditorView(void);
void _storeCurrentViewState(void);
void _loadCurrentViewState(void);
......@@ -300,16 +264,12 @@ private:
bool _autoReconnect;
bool _lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets
bool _showStatusBar;
QActionGroup* _centerStackActionGroup;
QVBoxLayout* _centralLayout;
QList<QObject*> _commsWidgetList;
QWidget* _currentViewWidget; ///< Currently displayed view widget
QSplashScreen* _splashScreen; ///< Splash screen, NULL is splash screen not currently being shown
VIEW_SECTIONS _currentView; ///< Currently displayed view
Ui::MainWindow _ui;
QString _screenFileName;
QString _getWindowStateKey();
QGCQmlWidgetHolder* _mainQmlWidgetHolder;
QString _getWindowGeometryKey();
};
......
/*=====================================================================
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 QtQuick.Controls 1.2
import QtPositioning 5.2
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl.ScreenTools 1.0
/// Qml for MainWindow
FlightDisplayView {
id: _root
// sets the top margin soo map widgets are not under toolbar
topMargin: toolbar.height + ScreenTools.defaultFontPixelWidth
readonly property string _planViewSource: "MissionEditor.qml"
readonly property string _setupViewSource: "SetupView.qml"
Connections {
target: controller
onShowFlyView: {
setupViewLoader.visible = false
planViewLoader.visible = false
_root.hideWidgets = false
}
onShowPlanView: {
if (planViewLoader.source != _planViewSource) {
planViewLoader.source = _planViewSource
}
setupViewLoader.visible = false
planViewLoader.visible = true
_root.hideWidgets = true
}
onShowSetupView: {
if (setupViewLoader.source != _setupViewSource) {
setupViewLoader.source = _setupViewSource
}
setupViewLoader.visible = true
planViewLoader.visible = false
_root.hideWidgets = true
}
onShowToolbarMessage: toolbar.showToolbarMessage(message)
// The following are use for unit testing only
onShowSetupFirmware: setupViewLoader.item.showFirmwarePanel()
onShowSetupParameters: setupViewLoader.item.showParametersPanel()
onShowSetupSummary: setupViewLoader.item.showSummaryPanel()
onShowSetupVehicleComponent: setupViewLoader.item.showVehicleComponentPanel(vechicleComponent)
}
MainToolBar {
id: toolbar
width: parent.width
z: _root.zOrderTopMost
}
Loader {
id: planViewLoader
anchors.left: parent.left
anchors.right: parent.right
anchors.top: toolbar.bottom
anchors.bottom: parent.bottom
visible: false
property real zOrder: _root.zOrderTopMost
}
Loader {
id: setupViewLoader
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: parent.right
anchors.top: toolbar.bottom
anchors.bottom: parent.bottom
visible: false
property real zOrder: _root.zOrderTopMost
}
}
#include "QGCHilFlightGearConfiguration.h"
#include "MainWindow.h"
#include <QMenu>
// Various settings groups and keys
const char* QGCHilFlightGearConfiguration::_settingsGroup = "QGC_HILCONFIG_FLIGHTGEAR";
const char* QGCHilFlightGearConfiguration::_mavSettingsSubGroupFixedWing = "FIXED_WING";
......
......@@ -36,7 +36,7 @@
#include "QGCApplication.h"
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "MainToolBar.h"
#include "MainToolBarController.h"
#include "FlightMapSettings.h"
SettingsDialog::SettingsDialog(QWidget *parent, int showTab, Qt::WindowFlags flags) :
......@@ -61,15 +61,6 @@ _ui(new Ui::SettingsDialog)
this->window()->setWindowTitle(tr("QGroundControl Settings"));
// Tool Bar Preferences
QSettings settings;
settings.beginGroup(TOOL_BAR_SETTINGS_GROUP);
_ui->showBattery->setChecked(settings.value( TOOL_BAR_SHOW_BATTERY, true).toBool());
_ui->showGPS->setChecked(settings.value( TOOL_BAR_SHOW_GPS, true).toBool());
_ui->showMav->setChecked(settings.value( TOOL_BAR_SHOW_MAV, true).toBool());
_ui->showMessages->setChecked(settings.value(TOOL_BAR_SHOW_MESSAGES, true).toBool());
_ui->showRSSI->setChecked(settings.value( TOOL_BAR_SHOW_RSSI, true).toBool());
settings.endGroup();
// Audio preferences
_ui->audioMuteCheckBox->setChecked(GAudioOutput::instance()->isMuted());
connect(_ui->audioMuteCheckBox, SIGNAL(toggled(bool)), GAudioOutput::instance(), SLOT(mute(bool)));
......@@ -181,31 +172,6 @@ void SettingsDialog::_selectSavedFilesDirectory(void)
// * Parameters
}
void SettingsDialog::on_showGPS_clicked(bool checked)
{
_mainWindow->getMainToolBar()->viewStateChanged(TOOL_BAR_SHOW_GPS, checked);
}
void SettingsDialog::on_showBattery_clicked(bool checked)
{
_mainWindow->getMainToolBar()->viewStateChanged(TOOL_BAR_SHOW_BATTERY, checked);
}
void SettingsDialog::on_showMessages_clicked(bool checked)
{
_mainWindow->getMainToolBar()->viewStateChanged(TOOL_BAR_SHOW_MESSAGES, checked);
}
void SettingsDialog::on_showMav_clicked(bool checked)
{
_mainWindow->getMainToolBar()->viewStateChanged(TOOL_BAR_SHOW_MAV, checked);
}
void SettingsDialog::on_showRSSI_clicked(bool checked)
{
_mainWindow->getMainToolBar()->viewStateChanged(TOOL_BAR_SHOW_RSSI, checked);
}
void SettingsDialog::_bingMapRadioClicked(bool checked)
{
if (checked) {
......
......@@ -55,13 +55,6 @@ private slots:
void _deleteSettingsToggled(bool checked);
void _selectSavedFilesDirectory(void);
void _validateBeforeClose(void);
void on_showGPS_clicked(bool checked);
void on_showBattery_clicked(bool checked);
void on_showMessages_clicked(bool checked);
void on_showMav_clicked(bool checked);
void on_showRSSI_clicked(bool checked);
void _bingMapRadioClicked(bool checked);
void _googleMapRadioClicked(bool checked);
......
......@@ -281,80 +281,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Tool Bar</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="showGPS">
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Show GPS</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showMessages">
<property name="text">
<string>Show Messages</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="showBattery">
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Show Battery</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showMav">
<property name="text">
<string>Show Mav Icon</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="showRSSI">
<property name="text">
<string>Show RSSI</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
......
This diff is collapsed.
......@@ -27,10 +27,13 @@ This file is part of the QGROUNDCONTROL project
* @author Gus Grubba <mavlink@grubba.com>
*/
#ifndef MAINTOOLBAR_H
#define MAINTOOLBAR_H
#ifndef MainToolBarController_H
#define MainToolBarController_H
#include "QGCQmlWidgetHolder.h"
#include <QObject>
#include "Vehicle.h"
#include "UASMessageView.h"
#define TOOL_BAR_SETTINGS_GROUP "TOOLBAR_SETTINGS_GROUP"
#define TOOL_BAR_SHOW_BATTERY "ShowBattery"
......@@ -39,52 +42,31 @@ This file is part of the QGROUNDCONTROL project
#define TOOL_BAR_SHOW_MESSAGES "ShowMessages"
#define TOOL_BAR_SHOW_RSSI "ShowRSSI"
class UASInterface;
class UASMessage;
class UASMessageViewRollDown;
class MainToolBar : public QGCQmlWidgetHolder
class MainToolBarController : public QObject
{
Q_OBJECT
Q_ENUMS(ViewType_t)
public:
typedef enum {
ViewNone = -1,
ViewAnalyze, // MainWindow::VIEW_ENGINEER
ViewPlan , // MainWindow::VIEW_MISSION_EDITOR
ViewFly , // MainWindow::VIEW_FLIGHT
ViewSetup , // MainWindow::VIEW_SETUP
} ViewType_t;
MainToolBar(QWidget* parent = NULL);
~MainToolBar();
public:
MainToolBarController(QObject* parent = NULL);
~MainToolBarController();
Q_INVOKABLE void onSetupView();
Q_INVOKABLE void onPlanView();
Q_INVOKABLE void onFlyView();
Q_INVOKABLE void onFlyViewMenu();
Q_INVOKABLE void onConnect(QString conf);
Q_INVOKABLE void onDisconnect(QString conf);
Q_INVOKABLE void onEnterMessageArea(int x, int y);
Q_INVOKABLE void onToolBarMessageClosed(void);
Q_PROPERTY(double height MEMBER _toolbarHeight NOTIFY heightChanged)
Q_PROPERTY(ViewType_t currentView MEMBER _currentView NOTIFY currentViewChanged)
Q_PROPERTY(QStringList configList MEMBER _linkConfigurations NOTIFY configListChanged)
Q_PROPERTY(int connectionCount READ connectionCount NOTIFY connectionCountChanged)
Q_PROPERTY(QStringList connectedList MEMBER _connectedList NOTIFY connectedListChanged)
Q_PROPERTY(bool showGPS MEMBER _showGPS NOTIFY showGPSChanged)
Q_PROPERTY(bool showMav MEMBER _showMav NOTIFY showMavChanged)
Q_PROPERTY(bool showMessages MEMBER _showMessages NOTIFY showMessagesChanged)
Q_PROPERTY(bool showBattery MEMBER _showBattery NOTIFY showBatteryChanged)
Q_PROPERTY(bool showRSSI MEMBER _showRSSI NOTIFY showRSSIChanged)
Q_PROPERTY(float progressBarValue MEMBER _progressBarValue NOTIFY progressBarValueChanged)
Q_PROPERTY(int remoteRSSI READ remoteRSSI NOTIFY remoteRSSIChanged)
Q_PROPERTY(int telemetryRRSSI READ telemetryRRSSI NOTIFY telemetryRRSSIChanged)
Q_PROPERTY(int telemetryLRSSI READ telemetryLRSSI NOTIFY telemetryLRSSIChanged)
void setCurrentView (int currentView);
void viewStateChanged (const QString& key, bool value);
int remoteRSSI () { return _remoteRSSI; }
int telemetryRRSSI () { return _telemetryRRSSI; }
......@@ -95,14 +77,8 @@ public:
signals:
void connectionCountChanged (int count);
void currentViewChanged ();
void configListChanged ();
void connectedListChanged (QStringList connectedList);
void showGPSChanged (bool value);
void showMavChanged (bool value);
void showMessagesChanged (bool value);
void showBatteryChanged (bool value);
void showRSSIChanged (bool value);
void progressBarValueChanged (float value);
void remoteRSSIChanged (int value);
void telemetryRRSSIChanged (int value);
......@@ -121,26 +97,17 @@ private slots:
void _setProgressBarValue (float value);
void _remoteControlRSSIChanged (uint8_t rssi);
void _telemetryChanged (LinkInterface* link, unsigned rxerrors, unsigned fixed, unsigned rssi, unsigned remrssi, unsigned txbuf, unsigned noise, unsigned remnoise);
void _heightChanged (double height);
void _delayedShowToolBarMessage (void);
private:
void _updateConnection (LinkInterface *disconnectedLink = NULL);
void _setToolBarState (const QString& key, bool value);
private:
Vehicle* _vehicle;
UASInterface* _mav;
QQuickItem* _toolBar;
ViewType_t _currentView;
QStringList _linkConfigurations;
int _connectionCount;
QStringList _connectedList;
bool _showGPS;
bool _showMav;
bool _showMessages;
bool _showRSSI;
bool _showBattery;
float _progressBarValue;
int _remoteRSSI;
double _remoteRSSIstore;
......@@ -155,4 +122,4 @@ private:
QMutex _toolbarMessageQueueMutex;
};
#endif // MAINTOOLBAR_H
#endif // MainToolBarController_H
......@@ -24,7 +24,6 @@ This file is part of the QGROUNDCONTROL project
#include <QMenu>
#include <QScrollBar>
#include "MainToolBar.h"
#include "UASMessageView.h"
#include "QGCUnconnectedInfoWidget.h"
#include "UASMessageHandler.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment