Commit ca234ed5 authored by Don Gagne's avatar Don Gagne

commit

parent fa4e7a2c
...@@ -144,6 +144,7 @@ INCLUDEPATH += \ ...@@ -144,6 +144,7 @@ INCLUDEPATH += \
src/input \ src/input \
src/Joystick \ src/Joystick \
src/lib/qmapcontrol \ src/lib/qmapcontrol \
src/MissionEditor \
src/QmlControls \ src/QmlControls \
src/uas \ src/uas \
src/ui \ src/ui \
...@@ -244,6 +245,7 @@ HEADERS += \ ...@@ -244,6 +245,7 @@ HEADERS += \
src/Joystick/JoystickManager.h \ src/Joystick/JoystickManager.h \
src/LogCompressor.h \ src/LogCompressor.h \
src/MG.h \ src/MG.h \
src/MissionEditor/MissionEditor.h \
src/QGC.h \ src/QGC.h \
src/QGCApplication.h \ src/QGCApplication.h \
src/QGCComboBox.h \ src/QGCComboBox.h \
...@@ -381,6 +383,7 @@ SOURCES += \ ...@@ -381,6 +383,7 @@ SOURCES += \
src/Joystick/JoystickManager.cc \ src/Joystick/JoystickManager.cc \
src/LogCompressor.cc \ src/LogCompressor.cc \
src/main.cc \ src/main.cc \
src/MissionEditor/MissionEditor.cc \
src/QGC.cc \ src/QGC.cc \
src/QGCApplication.cc \ src/QGCApplication.cc \
src/QGCComboBox.cc \ src/QGCComboBox.cc \
......
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
<file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file> <file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="FlightDisplayWidget.qml">src/FlightDisplay/FlightDisplayWidget.qml</file> <file alias="FlightDisplayWidget.qml">src/FlightDisplay/FlightDisplayWidget.qml</file>
<file alias="MapDisplay.qml">src/ui/mapdisplay/MapDisplay.qml</file> <file alias="MapDisplay.qml">src/ui/mapdisplay/MapDisplay.qml</file>
<file alias="MissionEditor.qml">src/MissionEditor/MissionEditor.qml</file>
<!-- FlightMap module --> <!-- FlightMap module -->
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file> <file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
......
/*=====================================================================
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/>.
======================================================================*/
#include "MissionEditor.h"
#include "ScreenToolsController.h"
#include <QQmlContext>
#include <QQmlEngine>
#include <QSettings>
const char* MissionEditor::_settingsGroup = "MissionEditor";
MissionEditor::MissionEditor(QWidget *parent)
: QGCQmlWidgetHolder(parent)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
// 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("controller", this);
setSource(QUrl::fromUserInput("qrc:/qml/MissionEditor.qml"));
}
MissionEditor::~MissionEditor()
{
}
void MissionEditor::saveSetting(const QString &name, const QString& value)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
settings.setValue(name, value);
}
QString MissionEditor::loadSetting(const QString &name, const QString& defaultValue)
{
QSettings settings;
settings.beginGroup(_settingsGroup);
return settings.value(name, defaultValue).toString();
}
void MissionEditor::addMissionItem(QGeoCoordinate coordinate)
{
MissionItem * newItem = new MissionItem(this, _missionItems.count(), coordinate.longitude(), coordinate.latitude());
_missionItems.append(newItem);
}
/*=====================================================================
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/>.
======================================================================*/
#ifndef MissionEditor_H
#define MissionEditor_H
#include "QGCQmlWidgetHolder.h"
#include "QmlObjectListModel.h"
class MissionEditor : public QGCQmlWidgetHolder
{
Q_OBJECT
public:
MissionEditor(QWidget* parent = NULL);
~MissionEditor();
Q_PROPERTY(QmlObjectListModel* missionItems READ missionItemsModel CONSTANT)
Q_INVOKABLE void addMissionItem(QGeoCoordinate coordinate);
Q_INVOKABLE void saveSetting (const QString &key, const QString& value);
Q_INVOKABLE QString loadSetting (const QString &key, const QString& defaultValue);
// Property accessors
QmlObjectListModel* missionItemsModel(void) { return &_missionItems; }
private:
QmlObjectListModel _missionItems;
static const char* _settingsGroup;
};
#endif
/*=====================================================================
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.4
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.FlightMap 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
/// Mission Editor
Item {
id: root
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property var _activeVehicle: multiVehicleManager.activeVehicle
readonly property real _defaultLatitude: 37.803784
readonly property real _defaultLongitude: -122.462276
FlightMap {
id: editorMap
anchors.fill: parent
mapName: "MissionEditor"
latitude: parent._defaultLatitude
longitude: parent._defaultLongitude
MouseArea {
anchors.fill: parent
onClicked: controller.addMissionItem(editorMap.mapItem.toCoordinate(Qt.point(mouse.x, mouse.y)))
}
}
Column {
id: controlWidgets
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.right: parent.left
anchors.bottom: parent.top
spacing: ScreenTools.defaultFontPixelWidth / 2
QGCButton {
id: addMode
text: "+"
checkable: true
}
}
// Mission item list
ListView {
id: missionItemSummaryList
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.bottom: parent.bottom
width: parent.width
height: ScreenTools.defaultFontPixelHeight * 7
spacing: ScreenTools.defaultFontPixelWidth / 2
opacity: 0.75
orientation: ListView.Horizontal
model: controller.missionItems
property real _maxItemHeight: 0
delegate:
MissionItemSummary {
opacity: 0.75
missionItem: object
Component.onCompleted: console.log("add", object.id)
}
}
}
...@@ -72,6 +72,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -72,6 +72,7 @@ This file is part of the QGROUNDCONTROL project
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "CustomCommandWidget.h" #include "CustomCommandWidget.h"
#include "HomePositionManager.h" #include "HomePositionManager.h"
#include "MissionEditor.h"
#ifdef UNITTEST_BUILD #ifdef UNITTEST_BUILD
#include "QmlControls/QmlTestWidget.h" #include "QmlControls/QmlTestWidget.h"
...@@ -425,6 +426,14 @@ void MainWindow::_buildPlanView(void) ...@@ -425,6 +426,14 @@ void MainWindow::_buildPlanView(void)
} }
} }
void MainWindow::_buildMissionEditorView(void)
{
if (!_missionEditorView) {
_missionEditorView = new MissionEditor(this);
_missionEditorView->setVisible(false);
}
}
void MainWindow::_buildFlightView(void) void MainWindow::_buildFlightView(void)
{ {
if (!_flightView) { if (!_flightView) {
...@@ -700,6 +709,7 @@ void MainWindow::connectCommonActions() ...@@ -700,6 +709,7 @@ void MainWindow::connectCommonActions()
perspectives->addAction(_ui.actionFlight); perspectives->addAction(_ui.actionFlight);
perspectives->addAction(_ui.actionSimulationView); perspectives->addAction(_ui.actionSimulationView);
perspectives->addAction(_ui.actionPlan); perspectives->addAction(_ui.actionPlan);
perspectives->addAction(_ui.actionMissionEditor);
perspectives->addAction(_ui.actionSetup); perspectives->addAction(_ui.actionSetup);
perspectives->setExclusive(true); perspectives->setExclusive(true);
...@@ -724,6 +734,11 @@ void MainWindow::connectCommonActions() ...@@ -724,6 +734,11 @@ void MainWindow::connectCommonActions()
_ui.actionPlan->setChecked(true); _ui.actionPlan->setChecked(true);
_ui.actionPlan->activate(QAction::Trigger); _ui.actionPlan->activate(QAction::Trigger);
} }
if (_currentView == VIEW_MISSIONEDITOR)
{
_ui.actionMissionEditor->setChecked(true);
_ui.actionMissionEditor->activate(QAction::Trigger);
}
if (_currentView == VIEW_SETUP) if (_currentView == VIEW_SETUP)
{ {
_ui.actionSetup->setChecked(true); _ui.actionSetup->setChecked(true);
...@@ -738,11 +753,12 @@ void MainWindow::connectCommonActions() ...@@ -738,11 +753,12 @@ void MainWindow::connectCommonActions()
connect(MultiVehicleManager::instance(), &MultiVehicleManager::vehicleRemoved, this, &MainWindow::_vehicleRemoved); connect(MultiVehicleManager::instance(), &MultiVehicleManager::vehicleRemoved, this, &MainWindow::_vehicleRemoved);
// Views actions // Views actions
connect(_ui.actionFlight, SIGNAL(triggered()), this, SLOT(loadFlightView())); connect(_ui.actionFlight, SIGNAL(triggered()), this, SLOT(loadFlightView()));
connect(_ui.actionSimulationView, SIGNAL(triggered()), this, SLOT(loadSimulationView())); connect(_ui.actionSimulationView, SIGNAL(triggered()), this, SLOT(loadSimulationView()));
connect(_ui.actionAnalyze, SIGNAL(triggered()), this, SLOT(loadAnalyzeView())); connect(_ui.actionAnalyze, SIGNAL(triggered()), this, SLOT(loadAnalyzeView()));
connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView())); connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView()));
connect(_ui.actionMissionEditor, SIGNAL(triggered()), this, SLOT(loadMissionEditorView()));
// Help Actions // Help Actions
connect(_ui.actionOnline_Documentation, SIGNAL(triggered()), this, SLOT(showHelp())); connect(_ui.actionOnline_Documentation, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(_ui.actionDeveloper_Credits, SIGNAL(triggered()), this, SLOT(showCredits())); connect(_ui.actionDeveloper_Credits, SIGNAL(triggered()), this, SLOT(showCredits()));
...@@ -891,6 +907,11 @@ void MainWindow::_loadCurrentViewState(void) ...@@ -891,6 +907,11 @@ void MainWindow::_loadCurrentViewState(void)
defaultWidgets = "WAYPOINT_LIST_DOCKWIDGET"; defaultWidgets = "WAYPOINT_LIST_DOCKWIDGET";
break; break;
case VIEW_MISSIONEDITOR:
_buildMissionEditorView();
centerView = _missionEditorView;
break;
case VIEW_SIMULATION: case VIEW_SIMULATION:
_buildSimView(); _buildSimView();
centerView = _simView; centerView = _simView;
...@@ -993,6 +1014,17 @@ void MainWindow::loadPlanView() ...@@ -993,6 +1014,17 @@ void MainWindow::loadPlanView()
} }
} }
void MainWindow::loadMissionEditorView()
{
if (_currentView != VIEW_MISSIONEDITOR)
{
_storeCurrentViewState();
_currentView = VIEW_MISSIONEDITOR;
_ui.actionMissionEditor->setChecked(true);
_loadCurrentViewState();
}
}
void MainWindow::loadSetupView() void MainWindow::loadSetupView()
{ {
if (_currentView != VIEW_SETUP) if (_currentView != VIEW_SETUP)
......
...@@ -130,17 +130,13 @@ public slots: ...@@ -130,17 +130,13 @@ public slots:
/** @brief Show the application settings */ /** @brief Show the application settings */
void showSettings(); void showSettings();
/** @brief Load configuration views */
void loadSetupView(); void loadSetupView();
/** @brief Load view for pilot */
void loadFlightView(); void loadFlightView();
/** @brief Load view for simulation */
void loadSimulationView(); void loadSimulationView();
/** @brief Load view for engineer */
void loadAnalyzeView(); void loadAnalyzeView();
/** @brief Load New (QtQuick) Map View (Mission) */
void loadPlanView(); void loadPlanView();
/** @brief Manage Links */ void loadMissionEditorView();
void manageLinks(); void manageLinks();
/** @brief Show the online help for users */ /** @brief Show the online help for users */
...@@ -204,12 +200,13 @@ protected: ...@@ -204,12 +200,13 @@ protected:
typedef enum _VIEW_SECTIONS typedef enum _VIEW_SECTIONS
{ {
VIEW_ANALYZE, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters VIEW_ANALYZE, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters
VIEW_PLAN, // New (QtQuick) Mission/Map/Plan view mode. Used for setting mission waypoints and high-level system commands. VIEW_PLAN, // Old mission editor
VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle. VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_SIMULATION, // HIL Simulation view. Useful overview of the entire system when doing hardware-in-the-loop simulations. VIEW_SIMULATION, // HIL Simulation view. Useful overview of the entire system when doing hardware-in-the-loop simulations.
VIEW_SETUP, // Setup view. Used for initializing the system for operation. Includes UI for calibration, firmware updating/checking, and parameter modifcation. VIEW_SETUP, // Setup view. Used for initializing the system for operation. Includes UI for calibration, firmware updating/checking, and parameter modifcation.
VIEW_UNUSED1, // Unused (don't remove, or it will screw up saved settigns indices) 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_UNUSED2, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_MISSIONEDITOR, // New mission editor
} VIEW_SECTIONS; } VIEW_SECTIONS;
/** @brief Catch window resize events */ /** @brief Catch window resize events */
...@@ -288,6 +285,7 @@ private: ...@@ -288,6 +285,7 @@ private:
QPointer<QWidget> _analyzeView; QPointer<QWidget> _analyzeView;
QPointer<QWidget> _simView; QPointer<QWidget> _simView;
QPointer<QWidget> _terminalView; QPointer<QWidget> _terminalView;
QPointer<QWidget> _missionEditorView;
// Dock widget names // Dock widget names
static const char* _uasControlDockWidgetName; static const char* _uasControlDockWidgetName;
...@@ -316,6 +314,7 @@ private: ...@@ -316,6 +314,7 @@ private:
void _buildAnalyzeView(void); void _buildAnalyzeView(void);
void _buildSimView(void); void _buildSimView(void);
void _buildTerminalView(void); void _buildTerminalView(void);
void _buildMissionEditorView(void);
void _storeCurrentViewState(void); void _storeCurrentViewState(void);
void _loadCurrentViewState(void); void _loadCurrentViewState(void);
...@@ -344,7 +343,6 @@ private: ...@@ -344,7 +343,6 @@ private:
QString _getWindowStateKey(); QString _getWindowStateKey();
QString _getWindowGeometryKey(); QString _getWindowGeometryKey();
}; };
#endif /* _MAINWINDOW_H_ */ #endif /* _MAINWINDOW_H_ */
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
</property> </property>
<addaction name="actionSetup"/> <addaction name="actionSetup"/>
<addaction name="actionPlan"/> <addaction name="actionPlan"/>
<addaction name="actionMissionEditor"/>
<addaction name="actionFlight"/> <addaction name="actionFlight"/>
<addaction name="actionAnalyze"/> <addaction name="actionAnalyze"/>
<addaction name="separator"/> <addaction name="separator"/>
...@@ -242,6 +243,17 @@ ...@@ -242,6 +243,17 @@
<string>Show Status Bar</string> <string>Show Status Bar</string>
</property> </property>
</action> </action>
<action name="actionMissionEditor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>New Mission Editor</string>
</property>
<property name="toolTip">
<string>Mission Editor</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
......
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