Unverified Commit f711da24 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8626 from mavlink/NewWizardDoneModel

Plan: New wizard done model
parents 675b9e79 56017ae7
......@@ -41,18 +41,19 @@ CorridorScanComplexItem::CorridorScanComplexItem(PlanMasterController* masterCon
_cameraCalc.distanceToSurface()->setRawValue(qgcApp()->toolbox()->settingsManager()->appSettings()->defaultMissionItemAltitude()->rawValue());
}
connect(&_corridorWidthFact, &Fact::valueChanged, this, &CorridorScanComplexItem::_setDirty);
connect(&_corridorPolyline, &QGCMapPolyline::pathChanged, this, &CorridorScanComplexItem::_setDirty);
connect(&_corridorWidthFact, &Fact::valueChanged, this, &CorridorScanComplexItem::_setDirty);
connect(&_corridorPolyline, &QGCMapPolyline::pathChanged, this, &CorridorScanComplexItem::_setDirty);
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this, &CorridorScanComplexItem::coordinateHasRelativeAltitudeChanged);
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this, &CorridorScanComplexItem::exitCoordinateHasRelativeAltitudeChanged);
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this, &CorridorScanComplexItem::coordinateHasRelativeAltitudeChanged);
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this, &CorridorScanComplexItem::exitCoordinateHasRelativeAltitudeChanged);
connect(&_corridorPolyline, &QGCMapPolyline::dirtyChanged, this, &CorridorScanComplexItem::_polylineDirtyChanged);
connect(&_corridorPolyline, &QGCMapPolyline::dirtyChanged, this, &CorridorScanComplexItem::_polylineDirtyChanged);
connect(&_corridorPolyline, &QGCMapPolyline::pathChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon);
connect(&_corridorWidthFact, &Fact::valueChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon);
connect(&_corridorPolyline, &QGCMapPolyline::pathChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon);
connect(&_corridorWidthFact, &Fact::valueChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon);
connect(&_corridorPolyline, &QGCMapPolyline::isValidChanged,this, &CorridorScanComplexItem::readyForSaveStateChanged);
connect(&_corridorPolyline, &QGCMapPolyline::isValidChanged, this, &CorridorScanComplexItem::_updateWizardMode);
connect(&_corridorPolyline, &QGCMapPolyline::traceModeChanged, this, &CorridorScanComplexItem::_updateWizardMode);
if (!kmlFile.isEmpty()) {
_corridorPolyline.loadKMLFile(kmlFile);
......@@ -384,3 +385,10 @@ double CorridorScanComplexItem::_calcTransectSpacing(void) const
return transectSpacing;
}
void CorridorScanComplexItem::_updateWizardMode(void)
{
if (_corridorPolyline.isValid() && !_corridorPolyline.traceMode()) {
setWizardMode(false);
}
}
......@@ -58,8 +58,9 @@ public:
static const char* corridorWidthName;
private slots:
void _polylineDirtyChanged (bool dirty);
void _rebuildCorridorPolygon (void);
void _polylineDirtyChanged (bool dirty);
void _rebuildCorridorPolygon (void);
void _updateWizardMode (void);
// Overrides from TransectStyleComplexItem
void _rebuildTransectsPhase1 (void) final;
......
......@@ -598,3 +598,11 @@ QDomElement QGCMapPolygon::kmlPolygonElement(KMLDomDocument& domDocument)
return polygonElement;
}
void QGCMapPolygon::setTraceMode(bool traceMode)
{
if (traceMode != _traceMode) {
_traceMode = traceMode;
emit traceModeChanged(traceMode);
}
}
......@@ -39,7 +39,7 @@ public:
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
Q_PROPERTY(bool empty READ empty NOTIFY isEmptyChanged)
Q_PROPERTY(bool traceMode MEMBER _traceMode NOTIFY traceModeChanged)
Q_PROPERTY(bool traceMode READ traceMode WRITE setTraceMode NOTIFY traceModeChanged)
Q_INVOKABLE void clear(void);
Q_INVOKABLE void appendVertex(const QGeoCoordinate& coordinate);
......@@ -105,6 +105,7 @@ public:
bool interactive (void) const { return _interactive; }
bool isValid (void) const { return _polygonModel.count() >= 3; }
bool empty (void) const { return _polygonModel.count() == 0; }
bool traceMode (void) const { return _traceMode; }
QVariantList path (void) const { return _polygonPath; }
QmlObjectListModel* qmlPathModel(void) { return &_polygonModel; }
......@@ -115,6 +116,7 @@ public:
void setCenter (QGeoCoordinate newCenter);
void setCenterDrag (bool centerDrag);
void setInteractive (bool interactive);
void setTraceMode (bool traceMode);
static const char* jsonPolygonKey;
......
......@@ -431,3 +431,11 @@ void QGCMapPolyline::_endResetIfNotActive(void)
endReset();
}
}
void QGCMapPolyline::setTraceMode(bool traceMode)
{
if (traceMode != _traceMode) {
_traceMode = traceMode;
emit traceModeChanged(traceMode);
}
}
......@@ -32,7 +32,7 @@ public:
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
Q_PROPERTY(bool empty READ empty NOTIFY isEmptyChanged)
Q_PROPERTY(bool traceMode MEMBER _traceMode NOTIFY traceModeChanged)
Q_PROPERTY(bool traceMode READ traceMode WRITE setTraceMode NOTIFY traceModeChanged)
Q_INVOKABLE void clear(void);
Q_INVOKABLE void appendVertex(const QGeoCoordinate& coordinate);
......@@ -89,6 +89,7 @@ public:
QVariantList path (void) const { return _polylinePath; }
bool isValid (void) const { return _polylineModel.count() >= 2; }
bool empty (void) const { return _polylineModel.count() == 0; }
bool traceMode (void) const { return _traceMode; }
QmlObjectListModel* qmlPathModel(void) { return &_polylineModel; }
QmlObjectListModel& pathModel (void) { return _polylineModel; }
......@@ -96,6 +97,7 @@ public:
void setPath (const QList<QGeoCoordinate>& path);
void setPath (const QVariantList& path);
void setInteractive (bool interactive);
void setTraceMode (bool traceMode);
static const char* jsonPolylineKey;
......
......@@ -71,6 +71,8 @@ StructureScanComplexItem::StructureScanComplexItem(PlanMasterController* masterC
connect(&_structurePolygon, &QGCMapPolygon::dirtyChanged, this, &StructureScanComplexItem::_polygonDirtyChanged);
connect(&_structurePolygon, &QGCMapPolygon::pathChanged, this, &StructureScanComplexItem::_rebuildFlightPolygon);
connect(&_structurePolygon, &QGCMapPolygon::isValidChanged, this, &StructureScanComplexItem::readyForSaveStateChanged);
connect(&_structurePolygon, &QGCMapPolygon::isValidChanged, this, &StructureScanComplexItem::_updateWizardMode);
connect(&_structurePolygon, &QGCMapPolygon::traceModeChanged, this, &StructureScanComplexItem::_updateWizardMode);
connect(&_structurePolygon, &QGCMapPolygon::countChanged, this, &StructureScanComplexItem::_updateLastSequenceNumber);
connect(&_layersFact, &Fact::valueChanged, this, &StructureScanComplexItem::_updateLastSequenceNumber);
......@@ -626,3 +628,10 @@ StructureScanComplexItem::ReadyForSaveState StructureScanComplexItem::readyForSa
{
return _structurePolygon.isValid() && !_wizardMode ? ReadyForSave : NotReadyForSaveData;
}
void StructureScanComplexItem::_updateWizardMode(void)
{
if (_structurePolygon.isValid() && !_structurePolygon.traceMode()) {
setWizardMode(false);
}
}
......@@ -117,17 +117,18 @@ signals:
private slots:
void _setDirty(void);
void _polygonDirtyChanged (bool dirty);
void _flightPathChanged (void);
void _clearInternal (void);
void _updateCoordinateAltitudes (void);
void _rebuildFlightPolygon (void);
void _recalcCameraShots (void);
void _recalcLayerInfo (void);
void _updateLastSequenceNumber (void);
void _updateGimbalPitch (void);
void _signalTopBottomAltChanged (void);
void _recalcScanDistance (void);
void _polygonDirtyChanged (bool dirty);
void _flightPathChanged (void);
void _clearInternal (void);
void _updateCoordinateAltitudes (void);
void _rebuildFlightPolygon (void);
void _recalcCameraShots (void);
void _recalcLayerInfo (void);
void _updateLastSequenceNumber (void);
void _updateGimbalPitch (void);
void _signalTopBottomAltChanged (void);
void _recalcScanDistance (void);
void _updateWizardMode (void);
private:
void _setCameraShots(int cameraShots);
......
......@@ -99,6 +99,9 @@ SurveyComplexItem::SurveyComplexItem(PlanMasterController* masterController, boo
connect(&_splitConcavePolygonsFact, &Fact::valueChanged, this, &SurveyComplexItem::_rebuildTransects);
connect(this, &SurveyComplexItem::refly90DegreesChanged, this, &SurveyComplexItem::_rebuildTransects);
connect(&_surveyAreaPolygon, &QGCMapPolygon::isValidChanged, this, &SurveyComplexItem::_updateWizardMode);
connect(&_surveyAreaPolygon, &QGCMapPolygon::traceModeChanged, this, &SurveyComplexItem::_updateWizardMode);
// FIXME: Shouldn't these be in TransectStyleComplexItem? They are also in CorridorScanComplexItem constructur
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this, &SurveyComplexItem::coordinateHasRelativeAltitudeChanged);
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this, &SurveyComplexItem::exitCoordinateHasRelativeAltitudeChanged);
......@@ -1428,3 +1431,10 @@ double SurveyComplexItem::additionalTimeDelay (void) const
return hoverTime;
}
void SurveyComplexItem::_updateWizardMode(void)
{
if (_surveyAreaPolygon.isValid() && !_surveyAreaPolygon.traceMode()) {
setWizardMode(false);
}
}
......@@ -80,10 +80,12 @@ signals:
void refly90DegreesChanged(bool refly90Degrees);
private slots:
void _updateWizardMode (void);
// Overrides from TransectStyleComplexItem
void _rebuildTransectsPhase1 (void) final;
void _recalcComplexDistance (void) final;
void _recalcCameraShots (void) final;
void _rebuildTransectsPhase1 (void) final;
void _recalcComplexDistance (void) final;
void _recalcCameraShots (void) final;
private:
enum CameraTriggerCode {
......
......@@ -68,15 +68,19 @@ Rectangle {
text: qsTr("Use the Polyline Tools to create the polyline which defines the corridor.")
}
/*
Trial of new "done" model so leaving for now in case it comes back
QGCButton {
text: qsTr("Done With Polyline")
Layout.fillWidth: true
enabled: missionItem.corridorPolyline.isValid && !missionItem.corridorPolyline.traceMode
onClicked: {
missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem()
// Trial of no auto select next item
//editorRoot.selectNextNotReadyItem()
}
}
*/
}
Column {
......
......@@ -312,12 +312,13 @@ Rectangle {
}
QGCButton {
text: qsTr("Done Adjusting")
text: qsTr("Done")
Layout.fillWidth: true
onClicked: {
missionItem.wizardMode = false
missionItem.landingDragAngleOnly = false
editorRoot.selectNextNotReadyItem()
// Trial of no auto select next item
//editorRoot.selectNextNotReadyItem()
}
}
}
......
......@@ -20,7 +20,7 @@ Rectangle {
color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade
radius: _radius
opacity: _currentItem ? 1.0 : 0.7
border.width: _readyForSave ? 0 : 1
border.width: _readyForSave ? 0 : 2
border.color: qgcPal.warningText
property var map ///< Map control
......@@ -87,7 +87,7 @@ Rectangle {
Rectangle {
id: notReadyForSaveIndicator
anchors.verticalCenter: parent.verticalCenter
width: readyForSaveLabel.contentHeight
width: _hamburgerSize
height: width
border.width: 1
border.color: qgcPal.warningText
......
......@@ -91,12 +91,13 @@ Rectangle {
}
QGCButton {
text: qsTr("Done Adjusting")
text: qsTr("Done")
Layout.fillWidth: true
visible: !initialClickLabel.visible
onClicked: {
missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem()
// Trial of no auto select next item
//editorRoot.selectNextNotReadyItem()
}
}
......
......@@ -69,15 +69,19 @@ Rectangle {
text: qsTr("Use the Polygon Tools to create the polygon which outlines the structure.")
}
/*
Trial of new "done" model so leaving for now in case it comes back
QGCButton {
text: qsTr("Done With Polygon")
Layout.fillWidth: true
enabled: missionItem.structurePolygon.isValid && !missionItem.structurePolygon.traceMode
onClicked: {
missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem()
// Trial of no auto select next item
//editorRoot.selectNextNotReadyItem()
}
}
*/
}
Column {
......
......@@ -29,7 +29,7 @@ Rectangle {
property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
property real _cameraMinTriggerInterval: missionItem.cameraCalc.minTriggerInterval.rawValue
property bool _polygonDone: false
property string _doneAdjusting: qsTr("Done Adjusting")
property string _doneAdjusting: qsTr("Done")
property bool _presetsAvailable: missionItem.presetNames.length !== 0
function polygonCaptureStarted() {
......@@ -77,6 +77,8 @@ Rectangle {
text: qsTr("Use the Polygon Tools to create the polygon which outlines your survey area.")
}
/*
Trial of new "done" model so leaving for now in case it comes back
QGCButton {
text: qsTr("Done With Polygon")
Layout.fillWidth: true
......@@ -84,13 +86,17 @@ Rectangle {
onClicked: {
if (!_presetsAvailable) {
missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem()
// Trial of no auto select next item
//editorRoot.selectNextNotReadyItem()
}
_polygonDone = true
}
}
*/
}
/*
Trial of new "done" model so leaving for now in case it comes back
ColumnLayout {
Layout.fillWidth: true
spacing: _margin
......@@ -166,10 +172,12 @@ Rectangle {
enabled: missionItem.surveyAreaPolygon.isValid
onClicked: {
missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem()
// Trial of no auto select next item
//editorRoot.selectNextNotReadyItem()
}
}
}
*/
}
Column {
......
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