Commit d499b513 authored by Don Gagne's avatar Don Gagne

Mission raw/friendly edit support

parent f89fe8e3
......@@ -95,6 +95,8 @@
<file alias="Signal100.svg">src/ui/toolbar/Images/Signal100.svg</file>
<file alias="Yield.svg">src/ui/toolbar/Images/Yield.svg</file>
<file alias="CogWheel.svg">src/MissionManager/CogWheel.svg</file>
</qresource>
<qresource prefix="/res">
......
......@@ -247,8 +247,9 @@ HEADERS += \
src/Joystick/JoystickManager.h \
src/LogCompressor.h \
src/MG.h \
src/MissionManager/MissionManager.h \
src/MissionManager/MissionController.h \
src/MissionManager/MissionItem.h \
src/MissionManager/MissionManager.h \
src/QGC.h \
src/QGCApplication.h \
src/QGCComboBox.h \
......@@ -291,7 +292,6 @@ HEADERS += \
src/ui/toolbar/MainToolBarController.h \
src/ui/uas/QGCUnconnectedInfoWidget.h \
src/ui/uas/UASMessageView.h \
src/MissionItem.h \
src/AutoPilotPlugins/PX4/PX4AirframeLoader.h \
src/QmlControls/QGCImageProvider.h \
......@@ -363,8 +363,9 @@ SOURCES += \
src/Joystick/JoystickManager.cc \
src/LogCompressor.cc \
src/main.cc \
src/MissionManager/MissionManager.cc \
src/MissionManager/MissionController.cc \
src/MissionManager/MissionItem.cc \
src/MissionManager/MissionManager.cc \
src/QGC.cc \
src/QGCApplication.cc \
src/QGCComboBox.cc \
......@@ -402,7 +403,6 @@ SOURCES += \
src/ui/toolbar/MainToolBarController.cc \
src/ui/uas/QGCUnconnectedInfoWidget.cc \
src/ui/uas/UASMessageView.cc \
src/MissionItem.cc \
src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc \
src/QmlControls/QGCImageProvider.cc \
......@@ -471,9 +471,9 @@ HEADERS += \
src/FactSystem/FactSystemTestBase.h \
src/FactSystem/FactSystemTestGeneric.h \
src/FactSystem/FactSystemTestPX4.h \
src/MissionItemTest.h \
src/MissionManager/MissionControllerTest.h \
src/MissionManager/MissionControllerManagerTest.h \
src/MissionManager/MissionItemTest.h \
src/MissionManager/MissionManagerTest.h \
src/qgcunittest/GeoTest.h \
src/qgcunittest/FileDialogTest.h \
......@@ -494,9 +494,9 @@ SOURCES += \
src/FactSystem/FactSystemTestBase.cc \
src/FactSystem/FactSystemTestGeneric.cc \
src/FactSystem/FactSystemTestPX4.cc \
src/MissionItemTest.cc \
src/MissionManager/MissionControllerTest.cc \
src/MissionManager/MissionControllerManagerTest.cc \
src/MissionManager/MissionItemTest.cc \
src/MissionManager/MissionManagerTest.cc \
src/qgcunittest/GeoTest.cc \
src/qgcunittest/FileDialogTest.cc \
......
......@@ -28,7 +28,6 @@
<file alias="PowerComponent.qml">src/AutoPilotPlugins/PX4/PowerComponent.qml</file>
<file alias="PowerComponentSummary.qml">src/AutoPilotPlugins/PX4/PowerComponentSummary.qml</file>
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
<file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file>
<file alias="QGroundControl/Controls/DropButton.qml">src/QmlControls/DropButton.qml</file>
<file alias="QGroundControl/Controls/ExclusiveGroupItem.qml">src/QmlControls/ExclusiveGroupItem.qml</file>
......@@ -37,7 +36,6 @@
<file alias="QGroundControl/Controls/MainToolBarIndicators.qml">src/ui/toolbar/MainToolBarIndicators.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/QmlControls/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/MissionItemIndexLabel.qml">src/QmlControls/MissionItemIndexLabel.qml</file>
<file alias="QGroundControl/Controls/MissionItemSummary.qml">src/QmlControls/MissionItemSummary.qml</file>
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
......@@ -62,20 +60,17 @@
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file>
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file>
<file alias="QGroundControl/FactControls/FactLabel.qml">src/FactSystem/FactControls/FactLabel.qml</file>
<file alias="QGroundControl/FactControls/FactPanel.qml">src/FactSystem/FactControls/FactPanel.qml</file>
<file alias="QGroundControl/FactControls/FactTextField.qml">src/FactSystem/FactControls/FactTextField.qml</file>
<file alias="QGroundControl/FactControls/qmldir">src/FactSystem/FactControls/qmldir</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewMap.qml">src/FlightDisplay/FlightDisplayViewMap.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewVideo.qml">src/FlightDisplay/FlightDisplayViewVideo.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewWidgets.qml">src/FlightDisplay/FlightDisplayViewWidgets.qml</file>
<file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file>
<file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicator.qml">src/FlightMap/MapItems/MissionItemIndicator.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
......@@ -90,10 +85,8 @@
<file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file>
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
<file alias="QmlTest.qml">src/QmlControls/QmlTest.qml</file>
<file alias="RadioComponent.qml">src/AutoPilotPlugins/PX4/RadioComponent.qml</file>
<file alias="RadioComponentSummary.qml">src/AutoPilotPlugins/PX4/RadioComponentSummary.qml</file>
......@@ -107,4 +100,7 @@
<file alias="test.qml">src/test.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="MavCmdInfo.json">src/MissionManager/MavCmdInfo.json</file>
</qresource>
</RCC>
......@@ -40,7 +40,8 @@ import QGroundControl.Controllers 1.0
QGCView {
id: _root
viewPanel: panel
viewPanel: panel
topDialogMargin: height - mainWindow.availableHeight
// zOrder comes from the Loader in MainWindow.qml
z: QGroundControl.zOrderTopMost
......@@ -211,7 +212,6 @@ QGCView {
property var missionItem
property var missionItemIndicator
property real heading: missionItem ? missionItem.heading : 0
readonly property real _radius: ScreenTools.defaultFontPixelHeight * 4
readonly property real _arrowHeight: ScreenTools.defaultFontPixelHeight
......@@ -328,30 +328,34 @@ QGCView {
onClicked: setCurrentItem(object.sequenceNumber)
Connections {
target: object
onIsCurrentItemChanged: {
if (object.isCurrentItem) {
_root.showDistance(object)
if (object.specifiesCoordinate) {
// Setup our drag item
if (object.sequenceNumber != 0) {
itemDragger.visible = true
itemDragger.missionItem = Qt.binding(function() { return object })
itemDragger.missionItemIndicator = Qt.binding(function() { return itemIndicator })
} else {
itemDragger.clearItem()
}
// Move to the new position
editorMap.latitude = object.coordinate.latitude
editorMap.longitude = object.coordinate.longitude
function updateItemIndicator()
{
if (object.isCurrentItem) {
_root.showDistance(object)
if (object.specifiesCoordinate) {
// Setup our drag item
if (object.sequenceNumber != 0) {
itemDragger.visible = true
itemDragger.missionItem = Qt.binding(function() { return object })
itemDragger.missionItemIndicator = Qt.binding(function() { return itemIndicator })
} else {
itemDragger.clearItem()
}
// Move to the new position
editorMap.latitude = object.coordinate.latitude
editorMap.longitude = object.coordinate.longitude
}
}
}
Connections {
target: object
onIsCurrentItemChanged: updateItemIndicator()
onCommandChanged: updateItemIndicator()
}
// These are the non-coordinate child mission items attached to this item
Row {
anchors.top: parent.top
......@@ -380,7 +384,7 @@ QGCView {
// Mission Item Editor
Item {
id: missionItemEditor
height: mainWindow.avaiableHeight
height: mainWindow.availableHeight
anchors.bottom: parent.bottom
anchors.right: parent.right
width: _rightPanelWidth
......@@ -389,11 +393,10 @@ QGCView {
z: QGroundControl.zOrderTopMost
ListView {
id: missionItemSummaryList
anchors.fill: parent
spacing: _margin / 2
orientation: ListView.Vertical
model: controller.canEdit ? controller.missionItems : 0
model: controller.missionItems
property real _maxItemHeight: 0
......@@ -416,14 +419,6 @@ QGCView {
}
}
} // ListView
QGCLabel {
anchors.fill: parent
visible: !controller.canEdit
wrapMode: Text.WordWrap
text: "The set of mission items you have loaded cannot be edited by QGroundControl. " +
"You will only be able to save these to a file, or send them to a vehicle."
}
} // Item - Mission Item editor
/*
......
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="114 186 72 72" style="enable-background:new 114 186 72 72;" xml:space="preserve">
<style type="text/css">
.st0{display:none;}
.st1{display:inline;}
.st2{display:inline;stroke:#FFFFFF;stroke-width:1.1959;stroke-miterlimit:10;}
.st3{display:inline;fill:none;stroke:#FFFFFF;stroke-width:9.567;stroke-miterlimit:10;}
.st4{display:inline;stroke:#FFFFFF;stroke-width:0.9229;stroke-miterlimit:10;}
.st5{display:inline;fill:none;stroke:#FFFFFF;stroke-width:9.2289;stroke-miterlimit:10;}
.st6{display:inline;stroke:#FFFFFF;stroke-width:1.3383;stroke-miterlimit:10;}
.st7{display:inline;fill:#FFFFFF;}
.st8{display:inline;opacity:0.7;stroke:#FFFFFF;stroke-width:1.494;stroke-miterlimit:10;enable-background:new ;}
.st9{display:inline;opacity:0.7;stroke:#FFFFFF;stroke-width:0.9492;stroke-miterlimit:10;enable-background:new ;}
.st10{display:inline;fill:none;stroke:#000000;stroke-width:23.0795;stroke-miterlimit:10;}
.st11{enable-background:new ;}
.st12{fill:none;stroke:#000000;stroke-miterlimit:10;}
.st13{display:inline;fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10;}
.st14{display:inline;stroke:#000000;stroke-width:19.9759;stroke-miterlimit:10;}
.st15{display:inline;stroke:#000000;stroke-width:20.4762;stroke-miterlimit:10;}
.st16{display:inline;stroke:#000000;stroke-miterlimit:10;}
</style>
<g id="Media_play_icon" class="st0">
<polygon class="st1" points="389.5,36.1 138.1,181.2 138.1,-109 "/>
</g>
<g id="Document_icon" class="st0">
<rect x="153.8" y="-105.1" class="st2" width="219.9" height="282.3"/>
<line class="st3" x1="194.1" y1="-63.2" x2="334" y2="-63.2"/>
<line class="st3" x1="194.1" y1="-37.2" x2="297.3" y2="-37.2"/>
<line class="st3" x1="194.1" y1="-11.2" x2="310.8" y2="-11.2"/>
<line class="st3" x1="194.1" y1="14.9" x2="334" y2="14.9"/>
<line class="st3" x1="194.1" y1="40.9" x2="252.4" y2="40.9"/>
<line class="st3" x1="194.1" y1="67" x2="297.3" y2="67"/>
<line class="st3" x1="194.1" y1="93" x2="310.8" y2="93"/>
</g>
<g id="Contact_icon" class="st0">
<rect x="121.1" y="-72.8" class="st4" width="285.8" height="217.9"/>
<polyline class="st5" points="395.7,-62.9 264,39.8 133,-62.9 "/>
</g>
<g id="Image_icon" class="st0">
<rect x="126.4" y="-105.4" class="st6" width="274.7" height="283"/>
<rect x="153" y="-76.5" class="st7" width="220.5" height="220.5"/>
<polygon class="st8" points="299.9,130.5 162.5,130.3 231.4,11.4 "/>
<polygon class="st9" points="352.6,129.9 265.3,129.8 309,54.2 "/>
<circle class="st9" cx="296.9" cy="-12.5" r="23.9"/>
</g>
<g id="Map_icon" class="st0">
<circle class="st1" cx="263.8" cy="-10.1" r="99.2"/>
<polygon class="st1" points="263.8,182 191.3,56.4 336.3,56.4 "/>
<circle class="st7" cx="263.8" cy="-11" r="34.3"/>
</g>
<g id="Calendar_icon" class="st0">
<rect x="143.3" y="-82.8" class="st10" width="241.3" height="248.6"/>
<text transform="matrix(1 0 0 1 164.4731 113.2056)" class="st1" style="font-family:'Futura-Medium'; font-size:172.5264px;">31</text>
<text transform="matrix(1 0 0 1 164.4731 113.2056)" style="display:inline;fill:none;stroke:#000000;stroke-miterlimit:10; font-family:'Futura-Medium'; font-size:172.5264px;">31</text>
<polyline class="st1" points="306.1,147.8 364.8,147.8 364.8,89.1 "/>
<rect x="131.9" y="-105" class="st1" width="263.7" height="66.4"/>
<circle class="st13" cx="212.4" cy="-70" r="11.9"/>
<circle class="st13" cx="313.1" cy="-71.8" r="11.9"/>
</g>
<g id="Company_icon" class="st0">
<circle class="st14" cx="263.8" cy="-35.3" r="51.5"/>
<path class="st15" d="M173.4,172.9c0-81.1,40.5-146.9,90.4-146.9s90.4,65.8,90.4,146.9"/>
<polygon class="st16" points="202.7,173.1 216.3,173.2 209.9,116.5 "/>
<polygon class="st16" points="315.6,173.2 329.2,173.3 322.7,116.7 "/>
</g>
<g id="BOOUm1.tif">
<g>
<path d="M146.9,188c2,0,4.1,0,6.1,0c1.3,1.1,2,2.6,2.3,4.3c0.2,1.6,1.2,2.6,2.7,3.2c1.1,0.4,2.2,0.7,3.2,1.3
c2.5,1.5,4.8,0.9,7-0.5c2.3-1.4,2.9-1.3,4.8,0.5c0.5,0.5,1,1,1.5,1.5c2,2.1,2.2,3.4,0.5,5.9c-0.6,0.9-1.3,1.9-1.1,3
c0.6,2.6,1.5,5.2,3,7.4c1,1.5,3,1.8,4.8,2.2c1.9,0.4,2.4,1.9,2.3,3.5c-0.1,2.3,1,5.1-1.8,6.7c-0.4,0.2-1,0.2-1.5,0.4
c-1.3,0.4-2.7,0.8-3.7,1.8c-2.7,2.9-3.2,7.8-1.1,11.2c1,1.5,0.8,2.7-0.3,4c-0.5,0.6-1.1,1.2-1.7,1.8c-2.3,2.3-3.5,2.5-6.2,0.7
c-1.6-1.1-3.2-1.2-4.9-0.5c-0.8,0.3-1.6,0.8-2.5,1c-3.1,0.8-4.6,2.8-5,5.8c-0.3,1.8-1.4,2.6-3.1,2.7c-0.8,0-1.5,0-2.3,0
c-3.5,0-4.4-0.8-5-4.1c-0.2-0.9-0.4-1.8-1.2-2.3c-2.2-1.7-4.8-2.6-7.5-3.3c-1.7-0.4-3.3,0.8-4.7,1.7c-1.4,1-2.6,0.7-3.8-0.3
c-0.6-0.5-1.2-1.1-1.8-1.7c-2.4-2.4-2.6-3.5-0.7-6.3c1-1.5,1.1-2.9,0.5-4.5c-0.4-0.9-0.9-1.9-1.1-2.8c-0.8-3.1-3-4.5-5.9-5
c-0.9-0.1-1.6-0.4-2.1-1.2c-2.1-3.3-0.2-8.3,3.5-9.2c1.8-0.4,2.9-1.4,3.6-3.1c0.3-0.8,0.6-1.7,1-2.5c1.6-2.8,1.2-5.4-0.6-7.8
c-1.1-1.4-0.8-2.7,0.3-4c0.6-0.6,1.1-1.2,1.7-1.8c2.3-2.2,3.5-2.4,6.2-0.6c1.5,1,3,1.3,4.7,0.5c0.9-0.4,1.9-0.9,2.8-1.1
c3-0.7,4.4-2.9,4.8-5.7C145,189.4,145.7,188.6,146.9,188z M150,233.9c6.7,0,12.1-5.4,12.1-12c-0.1-6.5-5.5-11.9-12.1-11.9
c-6.6,0-11.9,5.4-11.9,12C138.2,228.7,143.4,233.9,150,233.9z"/>
</g>
</g>
</svg>
This diff is collapsed.
......@@ -37,7 +37,6 @@ MissionController::MissionController(QObject *parent)
: QObject(parent)
, _editMode(false)
, _missionItems(NULL)
, _canEdit(true)
, _activeVehicle(NULL)
, _liveHomePositionAvailable(false)
, _autoSync(false)
......@@ -51,7 +50,6 @@ MissionController::MissionController(QObject *parent)
MissionController::~MissionController()
{
// Start with empty list
_canEdit = true;
_missionItems = new QmlObjectListModel(this);
_initAllMissionItems();
}
......@@ -129,11 +127,9 @@ void MissionController::_setupMissionItems(bool loadFromVehicle, bool forceLoad)
}
if (!missionManager || !loadFromVehicle || missionManager->inProgress()) {
_canEdit = true;
_missionItems = new QmlObjectListModel(this);
qCDebug(MissionControllerLog) << "creating empty set";
} else {
_canEdit = missionManager->canEdit();
_missionItems = missionManager->copyMissionItems();
qCDebug(MissionControllerLog) << "loading from vehicle count"<< _missionItems->count();
}
......@@ -163,18 +159,15 @@ void MissionController::sendMissionItems(void)
int MissionController::addMissionItem(QGeoCoordinate coordinate)
{
if (!_canEdit) {
qWarning() << "addMissionItem called with _canEdit == false";
}
// Coordinate will come through without altitude
coordinate.setAltitude(MissionItem::defaultAltitude);
MissionItem * newItem = new MissionItem(this, _missionItems->count(), coordinate, MAV_CMD_NAV_WAYPOINT);
MissionItem * newItem = new MissionItem(this);
newItem->setSequenceNumber(_missionItems->count());
newItem->setCoordinate(coordinate);
newItem->setCommand(MAV_CMD_NAV_WAYPOINT);
_initMissionItem(newItem);
if (_missionItems->count() == 1) {
newItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF);
}
newItem->setDefaultsForCommand();
_missionItems->append(newItem);
_recalcAll();
......@@ -184,11 +177,6 @@ int MissionController::addMissionItem(QGeoCoordinate coordinate)
void MissionController::removeMissionItem(int index)
{
if (!_canEdit) {
qWarning() << "addMissionItem called with _canEdit == false";
return;
}
MissionItem* item = qobject_cast<MissionItem*>(_missionItems->removeAt(index));
_deinitMissionItem(item);
......@@ -221,8 +209,6 @@ void MissionController::loadMissionFromFile(void)
}
_missionItems = new QmlObjectListModel(this);
_canEdit = true;
// FIXME: This needs to handle APM files which have WP 0 in them
QFile file(filename);
......@@ -242,10 +228,6 @@ void MissionController::loadMissionFromFile(void)
if (item->load(in)) {
_missionItems->append(item);
if (!item->canEdit()) {
_canEdit = false;
}
} else {
errorString = "The mission file is corrupted.";
break;
......@@ -422,7 +404,9 @@ void MissionController::_initAllMissionItems(void)
// Add the home position item to the front
homeItem = new MissionItem(this);
homeItem->setHomePositionSpecialCase(true);
homeItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_WAYPOINT);
homeItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_LAST);
homeItem->setFrame(MAV_FRAME_GLOBAL_RELATIVE_ALT);
homeItem->setSequenceNumber(0);
_missionItems->insert(0, homeItem);
}
homeItem->setHomePositionValid(false);
......@@ -434,7 +418,6 @@ void MissionController::_initAllMissionItems(void)
_recalcAll();
emit missionItemsChanged();
emit canEditChanged(_canEdit);
_missionItems->setDirty(false);
......
......@@ -42,7 +42,6 @@ public:
Q_PROPERTY(QmlObjectListModel* missionItems READ missionItems NOTIFY missionItemsChanged)
Q_PROPERTY(QmlObjectListModel* waypointLines READ waypointLines NOTIFY waypointLinesChanged)
Q_PROPERTY(bool canEdit READ canEdit NOTIFY canEditChanged)
Q_PROPERTY(bool liveHomePositionAvailable READ liveHomePositionAvailable NOTIFY liveHomePositionAvailableChanged)
Q_PROPERTY(QGeoCoordinate liveHomePosition READ liveHomePosition NOTIFY liveHomePositionChanged)
Q_PROPERTY(bool autoSync READ autoSync WRITE setAutoSync NOTIFY autoSyncChanged)
......@@ -60,7 +59,6 @@ public:
QmlObjectListModel* missionItems(void);
QmlObjectListModel* waypointLines(void) { return &_waypointLines; }
bool canEdit(void) { return _canEdit; }
bool liveHomePositionAvailable(void) { return _liveHomePositionAvailable; }
QGeoCoordinate liveHomePosition(void) { return _liveHomePosition; }
bool autoSync(void) { return _autoSync; }
......@@ -68,7 +66,6 @@ public:
signals:
void missionItemsChanged(void);
void canEditChanged(bool canEdit);
void waypointLinesChanged(void);
void liveHomePositionAvailableChanged(bool homePositionAvailable);
void liveHomePositionChanged(const QGeoCoordinate& homePosition);
......@@ -103,7 +100,6 @@ private:
bool _editMode;
QmlObjectListModel* _missionItems;
QmlObjectListModel _waypointLines;
bool _canEdit; ///< true: UI can edit these items, false: can't edit, can only send to vehicle or save
Vehicle* _activeVehicle;
bool _liveHomePositionAvailable;
QGeoCoordinate _liveHomePosition;
......
......@@ -48,7 +48,6 @@ void MissionControllerManagerTest::_initForFirmwareType(MAV_AUTOPILOT firmwareTy
_missionManager = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()->missionManager();
QVERIFY(_missionManager);
_rgMissionManagerSignals[canEditChangedSignalIndex] = SIGNAL(canEditChanged(bool));
_rgMissionManagerSignals[newMissionItemsAvailableSignalIndex] = SIGNAL(newMissionItemsAvailable(void));
_rgMissionManagerSignals[inProgressChangedSignalIndex] = SIGNAL(inProgressChanged(bool));
_rgMissionManagerSignals[errorSignalIndex] = SIGNAL(error(int, const QString&));
......@@ -61,7 +60,6 @@ void MissionControllerManagerTest::_initForFirmwareType(MAV_AUTOPILOT firmwareTy
_multiSpyMissionManager->waitForSignalByIndex(newMissionItemsAvailableSignalIndex, _missionManagerSignalWaitTime);
_multiSpyMissionManager->waitForSignalByIndex(inProgressChangedSignalIndex, _missionManagerSignalWaitTime);
QCOMPARE(_multiSpyMissionManager->checkSignalByMask(newMissionItemsAvailableSignalMask | inProgressChangedSignalMask), true);
QCOMPARE(_multiSpyMissionManager->checkNoSignalByMask(canEditChangedSignalIndex), true);
}
QVERIFY(!_missionManager->inProgress());
......
......@@ -49,16 +49,16 @@ protected:
MissionManager* _missionManager;
typedef struct {
int sequenceNumber;
QGeoCoordinate coordinate;
int command;
double param1;
double param2;
double param3;
double param4;
bool autocontinue;
bool isCurrentItem;
int frame;
int sequenceNumber;
QGeoCoordinate coordinate;
MAV_CMD command;
double param1;
double param2;
double param3;
double param4;
bool autocontinue;
bool isCurrentItem;
MAV_FRAME frame;
} ItemInfo_t;
typedef struct {
......@@ -67,15 +67,13 @@ protected:
} TestCase_t;
typedef enum {
canEditChangedSignalIndex = 0,
newMissionItemsAvailableSignalIndex,
newMissionItemsAvailableSignalIndex = 0,
inProgressChangedSignalIndex,
errorSignalIndex,
maxSignalIndex
} MissionManagerSignalIndex_t;
typedef enum {
canEditChangedSignalMask = 1 << canEditChangedSignalIndex,
newMissionItemsAvailableSignalMask = 1 << newMissionItemsAvailableSignalIndex,
inProgressChangedSignalMask = 1 << inProgressChangedSignalIndex,
errorSignalMask = 1 << errorSignalIndex,
......
This diff is collapsed.
This diff is collapsed.
......@@ -54,11 +54,12 @@ const MissionItemTest::FactValue_t MissionItemTest::_rgFactValuesLoiterTurns[] =
const MissionItemTest::FactValue_t MissionItemTest::_rgFactValuesLoiterTime[] = {
{ "Altitude:", -30.0 },
{ "Radius:", 30.0 },
{ "Seconds:", 10.0 },
{ "Hold:", 10.0 },
};
const MissionItemTest::FactValue_t MissionItemTest::_rgFactValuesLand[] = {
{ "Altitude:", -30.0 },
{ "Abort Alt:", 10.0 },
{ "Heading:", 1.0 },
};
......@@ -69,7 +70,7 @@ const MissionItemTest::FactValue_t MissionItemTest::_rgFactValuesTakeoff[] = {
};
const MissionItemTest::FactValue_t MissionItemTest::_rgFactValuesConditionDelay[] = {
{ "Seconds:", 10.0 },
{ "Hold:", 10.0 },
};
const MissionItemTest::FactValue_t MissionItemTest::_rgFactValuesDoJump[] = {
......@@ -101,18 +102,19 @@ void MissionItemTest::_test(void)
qDebug() << "Command:" << info->command;
MissionItem* item = new MissionItem(NULL,
info->sequenceNumber,
info->coordinate,
MissionItem* item = new MissionItem(info->sequenceNumber,
info->command,
info->frame,
info->param1,
info->param2,
info->param3,
info->param4,
info->coordinate.latitude(),
info->coordinate.longitude(),
info->coordinate.altitude(),
info->autocontinue,
info->isCurrentItem,
info->frame);
info->isCurrentItem);
// Validate the saving is working correctly
QString savedItemString;
QTextStream saveStream(&savedItemString, QIODevice::WriteOnly);
......@@ -123,6 +125,7 @@ void MissionItemTest::_test(void)
size_t factCount = 0;
for (int i=0; i<item->textFieldFacts()->count(); i++) {
Fact* fact = qobject_cast<Fact*>(item->textFieldFacts()->get(i));
qDebug() << fact->name();
bool found = false;
for (size_t j=0; j<expected->cFactValues; j++) {
......@@ -130,11 +133,7 @@ void MissionItemTest::_test(void)
if (factValue->name == fact->name()) {
qDebug() << factValue->name;
if (strcmp(factValue->name, "Heading:") == 0) {
QCOMPARE(fact->value().toDouble() * (M_PI / 180.0), item->_yawRadians());
} else {
QCOMPARE(fact->value().toDouble(), factValue->value);
}
QCOMPARE(fact->rawValue().toDouble(), factValue->value);
factCount ++;
found = true;
break;
......
......@@ -49,14 +49,14 @@ private:
typedef struct {
int sequenceNumber;
QGeoCoordinate coordinate;
int command;
MAV_CMD command;
double param1;
double param2;
double param3;
double param4;
bool autocontinue;
bool isCurrentItem;
int frame;
MAV_FRAME frame;
} ItemInfo_t;
typedef struct {
......
......@@ -35,7 +35,6 @@ QGC_LOGGING_CATEGORY(MissionManagerLog, "MissionManagerLog")
MissionManager::MissionManager(Vehicle* vehicle)
: _vehicle(vehicle)
, _cMissionItems(0)
, _canEdit(true)
, _ackTimeoutTimer(NULL)
, _retryAck(AckNone)
{
......@@ -287,24 +286,21 @@ void MissionManager::_handleMissionItem(const mavlink_message_t& message)
return;
}
MissionItem* item = new MissionItem(this,
missionItem.seq,
QGeoCoordinate(missionItem.x, missionItem.y, missionItem.z),
missionItem.command,
MissionItem* item = new MissionItem(missionItem.seq,
(MAV_CMD)missionItem.command,
(MAV_FRAME)missionItem.frame,
missionItem.param1,
missionItem.param2,
missionItem.param3,
missionItem.param4,
missionItem.x,
missionItem.y,
missionItem.z,
missionItem.autocontinue,
missionItem.current,
missionItem.frame);
this);
_missionItems.append(item);
if (!item->canEdit()) {
_canEdit = false;
emit canEditChanged(false);
}
int nextSequenceNumber = missionItem.seq + 1;
if (nextSequenceNumber == _cMissionItems) {
_readTransactionComplete();
......
......@@ -49,13 +49,11 @@ public:
Q_PROPERTY(bool inProgress READ inProgress NOTIFY inProgressChanged)
Q_PROPERTY(QmlObjectListModel* missionItems READ missionItems CONSTANT)
Q_PROPERTY(bool canEdit READ canEdit NOTIFY canEditChanged)
// Property accessors
bool inProgress(void) { return _retryAck != AckNone; }
QmlObjectListModel* missionItems(void) { return &_missionItems; }
bool canEdit(void) { return _canEdit; }
// C++ methods
......@@ -85,8 +83,6 @@ public:
static const int _maxRetryCount = 5;
signals:
// Public signals
void canEditChanged(bool canEdit);
void newMissionItemsAvailable(void);
void inProgressChanged(bool inProgress);
void error(int errorCode, const QString& errorMsg);
......@@ -123,7 +119,6 @@ private:
Vehicle* _vehicle;
int _cMissionItems; ///< Mission items on vehicle
bool _canEdit; ///< true: Mission items are editable in the ui
QTimer* _ackTimeoutTimer;
AckType_t _retryAck;
......
......@@ -58,8 +58,7 @@ void MissionManagerTest::_writeItems(MockLinkMissionItemHandler::FailureMode_t f
homeItem->setHomePositionSpecialCase(true);
homeItem->setHomePositionValid(false);
homeItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_WAYPOINT);
homeItem->setLatitude(47.3769);
homeItem->setLongitude(8.549444);
homeItem->setCoordinate(QGeoCoordinate(47.3769, 8.549444, 0));
homeItem->setSequenceNumber(0);
list->insert(0, homeItem);
......@@ -137,8 +136,6 @@ void MissionManagerTest::_writeItems(MockLinkMissionItemHandler::FailureMode_t f
checkExpectedMessageBox();
}
QCOMPARE(_missionManager->canEdit(), true);
delete list;
list = NULL;
_multiSpyMissionManager->clearAllSignals();
......@@ -172,7 +169,6 @@ void MissionManagerTest::_roundTripItems(MockLinkMissionItemHandler::FailureMode
// newMissionItemsAvailable signal
_multiSpyMissionManager->waitForSignalByIndex(inProgressChangedSignalIndex, _missionManagerSignalWaitTime);
QCOMPARE(_multiSpyMissionManager->checkSignalByMask(newMissionItemsAvailableSignalMask | inProgressChangedSignalMask), true);
QCOMPARE(_multiSpyMissionManager->checkNoSignalByMask(canEditChangedSignalMask), true);
_checkInProgressValues(false);
} else {
......@@ -233,7 +229,6 @@ void MissionManagerTest::_roundTripItems(MockLinkMissionItemHandler::FailureMode
}
QCOMPARE(_missionManager->missionItems()->count(), (int)cMissionItemsExpected);
QCOMPARE(_missionManager->canEdit(), true);
size_t firstActualItem = 0;
if (_mockLink->getFirmwareType() == MAV_AUTOPILOT_ARDUPILOTMEGA) {
......
......@@ -40,6 +40,13 @@ Rectangle {
anchors.right: parent.right
height: valuesRect.visible ? valuesRect.y + valuesRect.height : valuesRect.y
MouseArea {
anchors.fill: parent
visible: !missionItem.isCurrentItem
onClicked: _root.clicked()
}
MissionItemIndexLabel {
id: label
anchors.verticalCenter: commandPicker.verticalCenter
......@@ -47,21 +54,30 @@ Rectangle {