Commit ca234ed5 authored by Don Gagne's avatar Don Gagne

commit

parent fa4e7a2c
......@@ -144,6 +144,7 @@ INCLUDEPATH += \
src/input \
src/Joystick \
src/lib/qmapcontrol \
src/MissionEditor \
src/QmlControls \
src/uas \
src/ui \
......@@ -244,6 +245,7 @@ HEADERS += \
src/Joystick/JoystickManager.h \
src/LogCompressor.h \
src/MG.h \
src/MissionEditor/MissionEditor.h \
src/QGC.h \
src/QGCApplication.h \
src/QGCComboBox.h \
......@@ -381,6 +383,7 @@ SOURCES += \
src/Joystick/JoystickManager.cc \
src/LogCompressor.cc \
src/main.cc \
src/MissionEditor/MissionEditor.cc \
src/QGC.cc \
src/QGCApplication.cc \
src/QGCComboBox.cc \
......
......@@ -128,6 +128,7 @@
<file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="FlightDisplayWidget.qml">src/FlightDisplay/FlightDisplayWidget.qml</file>
<file alias="MapDisplay.qml">src/ui/mapdisplay/MapDisplay.qml</file>
<file alias="MissionEditor.qml">src/MissionEditor/MissionEditor.qml</file>
<!-- FlightMap module -->
<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
#include "MultiVehicleManager.h"
#include "CustomCommandWidget.h"
#include "HomePositionManager.h"
#include "MissionEditor.h"
#ifdef UNITTEST_BUILD
#include "QmlControls/QmlTestWidget.h"
......@@ -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)
{
if (!_flightView) {
......@@ -700,6 +709,7 @@ void MainWindow::connectCommonActions()
perspectives->addAction(_ui.actionFlight);
perspectives->addAction(_ui.actionSimulationView);
perspectives->addAction(_ui.actionPlan);
perspectives->addAction(_ui.actionMissionEditor);
perspectives->addAction(_ui.actionSetup);
perspectives->setExclusive(true);
......@@ -724,6 +734,11 @@ void MainWindow::connectCommonActions()
_ui.actionPlan->setChecked(true);
_ui.actionPlan->activate(QAction::Trigger);
}
if (_currentView == VIEW_MISSIONEDITOR)
{
_ui.actionMissionEditor->setChecked(true);
_ui.actionMissionEditor->activate(QAction::Trigger);
}
if (_currentView == VIEW_SETUP)
{
_ui.actionSetup->setChecked(true);
......@@ -738,11 +753,12 @@ void MainWindow::connectCommonActions()
connect(MultiVehicleManager::instance(), &MultiVehicleManager::vehicleRemoved, this, &MainWindow::_vehicleRemoved);
// Views actions
connect(_ui.actionFlight, SIGNAL(triggered()), this, SLOT(loadFlightView()));
connect(_ui.actionSimulationView, SIGNAL(triggered()), this, SLOT(loadSimulationView()));
connect(_ui.actionAnalyze, SIGNAL(triggered()), this, SLOT(loadAnalyzeView()));
connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView()));
connect(_ui.actionFlight, SIGNAL(triggered()), this, SLOT(loadFlightView()));
connect(_ui.actionSimulationView, SIGNAL(triggered()), this, SLOT(loadSimulationView()));
connect(_ui.actionAnalyze, SIGNAL(triggered()), this, SLOT(loadAnalyzeView()));
connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView()));
connect(_ui.actionMissionEditor, SIGNAL(triggered()), this, SLOT(loadMissionEditorView()));
// Help Actions
connect(_ui.actionOnline_Documentation, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(_ui.actionDeveloper_Credits, SIGNAL(triggered()), this, SLOT(showCredits()));
......@@ -891,6 +907,11 @@ void MainWindow::_loadCurrentViewState(void)
defaultWidgets = "WAYPOINT_LIST_DOCKWIDGET";
break;
case VIEW_MISSIONEDITOR:
_buildMissionEditorView();
centerView = _missionEditorView;
break;
case VIEW_SIMULATION:
_buildSimView();
centerView = _simView;
......@@ -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()
{
if (_currentView != VIEW_SETUP)
......
......@@ -130,17 +130,13 @@ public slots:
/** @brief Show the application settings */
void showSettings();
/** @brief Load configuration views */
void loadSetupView();
/** @brief Load view for pilot */
void loadFlightView();
/** @brief Load view for simulation */
void loadSimulationView();
/** @brief Load view for engineer */
void loadAnalyzeView();
/** @brief Load New (QtQuick) Map View (Mission) */
void loadPlanView();
/** @brief Manage Links */
void loadMissionEditorView();
void manageLinks();
/** @brief Show the online help for users */
......@@ -204,12 +200,13 @@ protected:
typedef enum _VIEW_SECTIONS
{
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_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_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 */
......@@ -288,6 +285,7 @@ private:
QPointer<QWidget> _analyzeView;
QPointer<QWidget> _simView;
QPointer<QWidget> _terminalView;
QPointer<QWidget> _missionEditorView;
// Dock widget names
static const char* _uasControlDockWidgetName;
......@@ -316,6 +314,7 @@ private:
void _buildAnalyzeView(void);
void _buildSimView(void);
void _buildTerminalView(void);
void _buildMissionEditorView(void);
void _storeCurrentViewState(void);
void _loadCurrentViewState(void);
......@@ -344,7 +343,6 @@ private:
QString _getWindowStateKey();
QString _getWindowGeometryKey();
};
#endif /* _MAINWINDOW_H_ */
......@@ -79,6 +79,7 @@
</property>
<addaction name="actionSetup"/>
<addaction name="actionPlan"/>
<addaction name="actionMissionEditor"/>
<addaction name="actionFlight"/>
<addaction name="actionAnalyze"/>
<addaction name="separator"/>
......@@ -242,6 +243,17 @@
<string>Show Status Bar</string>
</property>
</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>
<layoutdefault spacing="6" margin="11"/>
<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