Commit 0adf8caa authored by Don Gagne's avatar Don Gagne

Mission Editor usability changes

parent 92cc42a1
......@@ -70,6 +70,7 @@
<file alias="Help.svg">src/FlightMap/Images/Help.svg</file>
<file alias="MapCenter.svg">src/FlightMap/Images/MapCenter.svg</file>
<file alias="MapSync.svg">src/FlightMap/Images/MapSync.svg</file>
<file alias="MapSyncChanged.svg">src/FlightMap/Images/MapSyncChanged.svg</file>
<file alias="MapType.svg">src/FlightMap/Images/MapType.svg</file>
<file alias="MapHome.svg">src/FlightMap/Images/MapHome.svg</file>
<file alias="MapAddMission.svg">src/FlightMap/Images/MapAddMission.svg</file>
......
......@@ -55,15 +55,14 @@ Item {
property var _activeVehicle: multiVehicleManager.activeVehicle
readonly property real _defaultLatitude: 37.803784
readonly property real _defaultLongitude: -122.462276
readonly property real _defaultRoll: 0
readonly property real _defaultPitch: 0
readonly property real _defaultHeading: 0
readonly property real _defaultAltitudeWGS84: 0
readonly property real _defaultGroundSpeed: 0
readonly property real _defaultAirSpeed: 0
readonly property real _defaultClimbRate: 0
readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276)
readonly property real _defaultRoll: 0
readonly property real _defaultPitch: 0
readonly property real _defaultHeading: 0
readonly property real _defaultAltitudeWGS84: 0
readonly property real _defaultGroundSpeed: 0
readonly property real _defaultAirSpeed: 0
readonly property real _defaultClimbRate: 0
readonly property string _mapName: "FlightDisplayView"
readonly property string _showMapBackgroundKey: "/showMapBackground"
......@@ -72,8 +71,7 @@ Item {
property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch
property real _heading: _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading
property real _latitude: _activeVehicle ? ((_activeVehicle.latitude === 0) ? _defaultLatitude : _activeVehicle.latitude) : _defaultLatitude
property real _longitude: _activeVehicle ? ((_activeVehicle.longitude === 0) ? _defaultLongitude : _activeVehicle.longitude) : _defaultLongitude
property var _vehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : _defaultVehicleCoordinate
property real _altitudeWGS84: _activeVehicle ? _activeVehicle.altitudeWGS84 : _defaultAltitudeWGS84
property real _groundSpeed: _activeVehicle ? _activeVehicle.groundSpeed : _defaultGroundSpeed
......@@ -82,14 +80,20 @@ Item {
property bool _showMap: getBool(QGroundControl.flightMapSettings.loadMapSetting(flightMap.mapName, _showMapBackgroundKey, "1"))
FlightDisplayViewController { id: _controller; }
FlightDisplayViewController { id: _controller }
ExclusiveGroup {
id: _dropButtonsExclusiveGroup
}
// Validate _showMap setting
Component.onCompleted: _setShowMap(_showMap)
Component.onCompleted: {
// We have to be careful to not reference root properties in a function which is in a subcomponent
// until the root component has completed loading. Otherwise you get undefined references.
flightMap.rootLoadCompleted = true
flightMap.updateMapPosition(true /* force */)
_setShowMap(_showMap)
}
function getBool(value) {
return value === '0' ? false : true;
......@@ -104,24 +108,24 @@ Item {
QGroundControl.flightMapSettings.saveMapSetting(flightMap.mapName, _showMapBackgroundKey, setBool(_showMap))
}
FlightMap {
id: flightMap
anchors.fill: parent
mapName: _mapName
visible: _showMap
latitude: root._defaultCoordinate.latitude
longitude: root._defaultCoordinate.longitude
property real rootLatitude: root._latitude
property real rootLongitude: root._longitude
Component.onCompleted: updateMapPosition(true /* force */)
property var rootVehicleCoordinate: _vehicleCoordinate
property bool rootLoadCompleted: false
onRootLatitudeChanged: updateMapPosition(false /* force */)
onRootLongitudeChanged: updateMapPosition(false /* force */)
onRootVehicleCoordinateChanged: updateMapPosition(false /* force */)
function updateMapPosition(force) {
if (_followVehicle || force) {
latitude = root._latitude
longitude = root._longitude
if ((_followVehicle || force) && rootLoadCompleted) {
flightMap.latitude = root._vehicleCoordinate.latitude
flightMap.longitude = root._vehicleCoordinate.longitude
}
}
......
......@@ -59,10 +59,13 @@ Map {
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
gesture.enabled: interactive
readonly property real maxZoomLevel: 20
zoomLevel: 18
center: QtPositioning.coordinate(lat, lon)
gesture.flickDeceleration: 3000
gesture.enabled: interactive
gesture.activeGestures: MapGestureArea.ZoomGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
plugin: Plugin { name: "QGroundControl" }
......@@ -295,11 +298,4 @@ Map {
}
}
*/
MouseArea {
//-- TODO: Check if this is still needed when we switch to 5.5.1
//-- Workaround for QTBUG-46388 (Pinch zoom doesn't work without it on mobile)
anchors.fill: parent
}
} // Map
This diff is collapsed.
......@@ -103,14 +103,15 @@ int MissionEditorController::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);
_initMissionItem(newItem);
newItem->setAltitude(30);
if (_missionItems->count() == 1) {
newItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF);
}
qDebug() << "MissionItem" << newItem->coordinate();
_missionItems->append(newItem);
_recalcAll();
......
This diff is collapsed.
......@@ -50,9 +50,9 @@ public:
QGeoCoordinate coordiante = QGeoCoordinate(),
int action = MAV_CMD_NAV_WAYPOINT,
double param1 = 0.0,
double param2 = 0.0,
double param3 = 0.0,
double param4 = 0.0,
double param2 = defaultAcceptanceRadius,
double param3 = defaultLoiterOrbitRadius,
double param4 = defaultHeading,
bool autocontinue = true,
bool isCurrentItem = false,
int frame = MAV_FRAME_GLOBAL_RELATIVE_ALT);
......@@ -67,10 +67,16 @@ public:
Q_PROPERTY(int sequenceNumber READ sequenceNumber WRITE setSequenceNumber NOTIFY sequenceNumberChanged)
Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY commandChanged)
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
Q_PROPERTY(bool specifiesHeading READ specifiesHeading NOTIFY commandChanged)
Q_PROPERTY(double heading READ headingDegrees WRITE setHeadingDegrees NOTIFY headingDegreesChanged)
Q_PROPERTY(QStringList commandNames READ commandNames CONSTANT)
Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged)
Q_PROPERTY(QString commandDescription READ commandDescription NOTIFY commandChanged)
Q_PROPERTY(QStringList valueLabels READ valueLabels NOTIFY commandChanged)
Q_PROPERTY(QStringList valueStrings READ valueStrings NOTIFY valueStringsChanged)
Q_PROPERTY(int commandByIndex READ commandByIndex WRITE setCommandByIndex NOTIFY commandChanged)
......@@ -88,12 +94,16 @@ public:
void setIsCurrentItem(bool isCurrentItem);
bool specifiesCoordinate(void) const;
QGeoCoordinate coordinate(void) const;
void setCoordinate(const QGeoCoordinate& coordinate);
bool specifiesHeading(void) const;
double headingDegrees(void) const;
void setHeadingDegrees(double headingDegrees);
QStringList commandNames(void);
QString commandName(void);
QString commandDescription(void);
int commandByIndex(void);
void setCommandByIndex(int index);
......@@ -107,9 +117,6 @@ public:
QmlObjectListModel* textFieldFacts(void);
QmlObjectListModel* checkboxFacts(void);
double yawDegrees(void) const;
void setYawDegrees(double yaw);
bool dirty(void) { return _dirty; }
void setDirty(bool dirty);
......@@ -136,9 +143,6 @@ public:
void setY(double y);
void setZ(double z);
double yawRadians(void) const;
void setYawRadians(double yaw);
bool autoContinue() const {
return _autocontinue;
}
......@@ -161,7 +165,7 @@ public:
return loiterOrbitRadius();
}
double param4() const {
return yawRadians();
return _yawRadians();
}
double param5() const {
return latitude();
......@@ -189,11 +193,19 @@ public:
bool load(QTextStream &loadStream);
void setHomePositionSpecialCase(bool homePositionSpecialCase) { _homePositionSpecialCase = homePositionSpecialCase; }
static const double defaultPitch;
static const double defaultHeading;
static const double defaultAltitude;
static const double defaultAcceptanceRadius;
static const double defaultLoiterOrbitRadius;
static const double defaultLoiterTurns;
signals:
void sequenceNumberChanged(int sequenceNumber);
void isCurrentItemChanged(bool isCurrentItem);
void coordinateChanged(const QGeoCoordinate& coordinate);
void headingDegreesChanged(double heading);
void dirtyChanged(bool dirty);
/** @brief Announces a change to the waypoint data */
......@@ -234,9 +246,13 @@ public:
private slots:
void _factValueChanged(QVariant value);
void _coordinateFactChanged(QVariant value);
void _headingDegreesFactChanged(QVariant value);
private:
QString _oneDecimalString(double value);
void _connectSignals(void);
double _yawRadians(void) const;
void _setYawRadians(double yawRadians);
private:
typedef struct {
......@@ -254,7 +270,7 @@ private:
Fact* _latitudeFact;
Fact* _longitudeFact;
Fact* _altitudeFact;
Fact* _yawRadiansFact;
Fact* _headingDegreesFact;
Fact* _loiterOrbitRadiusFact;
Fact* _param1Fact;
Fact* _param2Fact;
......
......@@ -224,7 +224,7 @@ Item {
context.lineTo(dropItemHolderRect.x, dropItemHolderRect.y)
context.closePath()
context.fillStyle = qgcPal.button
context.fillStyle = qgcPal.windowShade
context.fill()
}
} // Canvas - arrowCanvas
......
......@@ -19,34 +19,26 @@ Rectangle {
signal clicked
signal remove
height: missionItem.isCurrentItem ?
(missionItem.textFieldFacts.count * (measureTextField.height + _margin)) +
(missionItem.checkboxFacts.count * (measureCheckbox.height + _margin)) +
commandPicker.height + (deleteButton.visible ? deleteButton.height : 0) + (_margin * 9) :
commandPicker.height + (_margin * 2)
height: innerItem.height + (_margin * 2)
color: missionItem.isCurrentItem ? qgcPal.buttonHighlight : qgcPal.windowShade
radius: _radius
readonly property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 3
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
QGCTextField {
id: measureTextField
visible: false
}
QGCCheckBox {
id: measureCheckbox
visible: false
}
Item {
id: innerItem
anchors.margins: _margin
anchors.fill: parent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: valuesRect.visible ? valuesRect.y + valuesRect.height : valuesRect.y
MissionItemIndexLabel {
id: label
......@@ -69,7 +61,7 @@ Rectangle {
anchors.right: parent.right
currentIndex: missionItem.commandByIndex
model: missionItem.commandNames
visible: missionItem.sequenceNumber != 0 // Item 0 is home position, can't change item type
visible: missionItem.sequenceNumber != 0 && missionItem.isCurrentItem
onActivated: missionItem.commandByIndex = index
}
......@@ -77,30 +69,36 @@ Rectangle {
Rectangle {
anchors.fill: commandPicker
color: qgcPal.button
visible: missionItem.sequenceNumber == 0 // Item 0 is home position, can't change item type
visible: !commandPicker.visible
QGCLabel {
id: homeLabel
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
text: "Home"
text: missionItem.sequenceNumber == 0 ? "Home" : missionItem.commandName
color: qgcPal.buttonText
}
}
Rectangle {
id: valuesRect
anchors.topMargin: _margin
anchors.top: commandPicker.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: valuesItem.height
color: qgcPal.windowShadeDark
visible: missionItem.isCurrentItem
radius: _radius
Item {
id: valuesItem
anchors.margins: _margin
anchors.fill: parent
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: valuesColumn.height + _margin
Column {
id: valuesColumn
......@@ -109,6 +107,12 @@ Rectangle {
anchors.top: parent.top
spacing: _margin
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: missionItem.commandDescription
}
Repeater {
model: missionItem.textFieldFacts
......@@ -140,11 +144,6 @@ Rectangle {
}
}
Item {
width: 10
height: missionItem.textFieldFacts.count ? _margin : 0
}
Repeater {
model: missionItem.checkboxFacts
......@@ -154,28 +153,6 @@ Rectangle {
fact: object
}
}
Item {
width: 10
height: missionItem.checkboxFacts.count ? _margin : 0
}
Row {
width: parent.width
spacing: _margin
readonly property real buttonWidth: (width - (_margin * 2)) / 3
QGCButton {
id: deleteButton
width: parent.buttonWidth
text: "Delete"
visible: !readOnly
onClicked: _root.remove()
}
}
} // Column
} // Item
} // Rectangle
......
......@@ -13,7 +13,7 @@ Rectangle {
QGCPalette { id: qgcPal }
width: ScreenTools.defaultFontPixelHeight * 1.5
width: ScreenTools.mediumFontPixelSize * 1.5
height: width
radius: width / 2
border.width: 2
......@@ -32,5 +32,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
font.pixelSize: ScreenTools.mediumFontPixelSize
}
}
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