Commit cada73cc authored by Don Gagne's avatar Don Gagne

Merge pull request #3038 from NaterGator/missionabbrev

Add support for customizing the abbreviated representation of mission…
parents 53ba2fde 2d00726c
......@@ -44,7 +44,7 @@ MapQuickItem {
MissionItemIndexLabel {
id: _label
isCurrentItem: _isCurrentItem
label: sequenceNumber == 0 ? "H" : sequenceNumber
label: missionItem.abbreviation
onClicked: _item.clicked()
property bool _isCurrentItem: missionItem ? missionItem.isCurrentItem : false
......
......@@ -127,7 +127,7 @@ Rectangle {
y: availableHeight - (availableHeight * object.altPercent)
small: true
isCurrentItem: object.isCurrentItem
label: object.homePosition ? "H" : object.sequenceNumber
label: object.abbreviation
visible: object.relativeAltitude ? true : (object.homePosition || graphAbsolute)
}
......
......@@ -80,6 +80,7 @@ public:
bool specifiesCoordinate (void) const final;
QString commandDescription (void) const final { return "Survey"; }
QString commandName (void) const final { return "Survey"; }
QString abbreviation (void) const final { return "S"; }
QGeoCoordinate coordinate (void) const final { return _coordinate; }
QGeoCoordinate exitCoordinate (void) const final { return _exitCoordinate; }
int sequenceNumber (void) const final { return _sequenceNumber; }
......
......@@ -43,6 +43,7 @@ void ComplexMissionItemTest::init(void)
_rgComplexMissionItemSignals[azimuthChangedIndex] = SIGNAL(azimuthChanged(double));
_rgComplexMissionItemSignals[commandDescriptionChangedIndex] = SIGNAL(commandDescriptionChanged());
_rgComplexMissionItemSignals[commandNameChangedIndex] = SIGNAL(commandNameChanged());
_rgComplexMissionItemSignals[abbreviationChangedIndex] = SIGNAL(abbreviationChanged());
_rgComplexMissionItemSignals[coordinateChangedIndex] = SIGNAL(coordinateChanged(const QGeoCoordinate&));
_rgComplexMissionItemSignals[exitCoordinateChangedIndex] = SIGNAL(exitCoordinateChanged(const QGeoCoordinate&));
_rgComplexMissionItemSignals[dirtyChangedIndex] = SIGNAL(dirtyChanged(bool));
......
......@@ -62,6 +62,7 @@ private:
azimuthChangedIndex,
commandDescriptionChangedIndex,
commandNameChangedIndex,
abbreviationChangedIndex,
coordinateChangedIndex,
exitCoordinateChangedIndex,
dirtyChangedIndex,
......
......@@ -180,6 +180,7 @@ void SimpleMissionItem::_connectSignals(void)
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::setDefaultsForCommand);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandNameChanged);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandDescriptionChanged);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::abbreviationChanged);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::specifiesCoordinateChanged);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::isStandaloneCoordinateChanged);
......@@ -303,6 +304,21 @@ QString SimpleMissionItem::commandName(void) const
}
}
QString SimpleMissionItem::abbreviation() const
{
if (homePosition())
return QStringLiteral("H");
switch(command()) {
default:
return QString::number(sequenceNumber());
case MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF:
return QStringLiteral("T");
case MavlinkQmlSingleton::MAV_CMD_NAV_LAND:
return QStringLiteral("L");
}
}
void SimpleMissionItem::_clearParamMetaData(void)
{
_param1MetaData.setRawUnits("");
......
......@@ -99,6 +99,7 @@ public:
bool specifiesCoordinate (void) const final;
QString commandDescription (void) const final;
QString commandName (void) const final;
QString abbreviation (void) const final;
QGeoCoordinate coordinate (void) const final { return _missionItem.coordinate(); }
QGeoCoordinate exitCoordinate (void) const final { return coordinate(); }
int sequenceNumber (void) const final { return _missionItem.sequenceNumber(); }
......
......@@ -81,6 +81,7 @@ public:
Q_PROPERTY(QString commandDescription READ commandDescription NOTIFY commandDescriptionChanged)
Q_PROPERTY(QString commandName READ commandName NOTIFY commandNameChanged)
Q_PROPERTY(QString abbreviation READ abbreviation NOTIFY abbreviationChanged)
Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) ///< Item is dirty and requires save/send
Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged)
Q_PROPERTY(int sequenceNumber READ sequenceNumber WRITE setSequenceNumber NOTIFY sequenceNumberChanged)
......@@ -118,6 +119,7 @@ public:
virtual bool specifiesCoordinate (void) const = 0;
virtual QString commandDescription (void) const = 0;
virtual QString commandName (void) const = 0;
virtual QString abbreviation (void) const = 0;
virtual QGeoCoordinate coordinate (void) const = 0;
virtual QGeoCoordinate exitCoordinate (void) const = 0;
virtual int sequenceNumber (void) const = 0;
......@@ -140,6 +142,7 @@ signals:
void azimuthChanged (double azimuth);
void commandDescriptionChanged (void);
void commandNameChanged (void);
void abbreviationChanged (void);
void coordinateChanged (const QGeoCoordinate& coordinate);
void exitCoordinateChanged (const QGeoCoordinate& exitCoordinate);
void dirtyChanged (bool dirty);
......
......@@ -51,7 +51,7 @@ Rectangle {
anchors.verticalCenter: commandPicker.verticalCenter
anchors.leftMargin: _margin
anchors.left: parent.left
text: missionItem.sequenceNumber == 0 ? "H" : missionItem.sequenceNumber
text: missionItem.abbreviation
color: _outerTextColor
}
......
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