Commit 9c5a4938 authored by Don Gagne's avatar Don Gagne

Lat/Lon/Alt Fact changes must signal coordinateChanged

parent cfb1d1b4
...@@ -158,6 +158,11 @@ MissionItem::MissionItem(QObject* parent, ...@@ -158,6 +158,11 @@ MissionItem::MissionItem(QObject* parent,
connect(_param1Fact, &Fact::valueChanged, this, &MissionItem::_factValueChanged); connect(_param1Fact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_param2Fact, &Fact::valueChanged, this, &MissionItem::_factValueChanged); connect(_param2Fact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_altitudeRelativeToHomeFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged); connect(_altitudeRelativeToHomeFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
// Connect valueChanged signals so we can output coordinateChanged signal
connect(_latitudeFact, &Fact::valueChanged, this, &MissionItem::_coordinateFactChanged);
connect(_longitudeFact, &Fact::valueChanged, this, &MissionItem::_coordinateFactChanged);
connect(_altitudeFact, &Fact::valueChanged, this, &MissionItem::_coordinateFactChanged);
} }
MissionItem::MissionItem(const MissionItem& other, QObject* parent) MissionItem::MissionItem(const MissionItem& other, QObject* parent)
...@@ -182,6 +187,21 @@ MissionItem::MissionItem(const MissionItem& other, QObject* parent) ...@@ -182,6 +187,21 @@ MissionItem::MissionItem(const MissionItem& other, QObject* parent)
_jumpSequenceMetaData = new FactMetaData(this); _jumpSequenceMetaData = new FactMetaData(this);
_jumpRepeatMetaData = new FactMetaData(this); _jumpRepeatMetaData = new FactMetaData(this);
// Connect to valueChanged to track dirty state
connect(_latitudeFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_longitudeFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_altitudeFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_yawRadiansFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_loiterOrbitRadiusFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_param1Fact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_param2Fact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
connect(_altitudeRelativeToHomeFact, &Fact::valueChanged, this, &MissionItem::_factValueChanged);
// Connect valueChanged signals so we can output coordinateChanged signal
connect(_latitudeFact, &Fact::valueChanged, this, &MissionItem::_coordinateFactChanged);
connect(_longitudeFact, &Fact::valueChanged, this, &MissionItem::_coordinateFactChanged);
connect(_altitudeFact, &Fact::valueChanged, this, &MissionItem::_coordinateFactChanged);
*this = other; *this = other;
} }
...@@ -752,7 +772,6 @@ void MissionItem::setYawRadians(double yaw) ...@@ -752,7 +772,6 @@ void MissionItem::setYawRadians(double yaw)
if (yawRadians() != yaw) if (yawRadians() != yaw)
{ {
_yawRadiansFact->setValue(yaw); _yawRadiansFact->setValue(yaw);
emit yawChanged(yaw);
emit changed(this); emit changed(this);
emit valueStringsChanged(valueStrings()); emit valueStringsChanged(valueStrings());
} }
...@@ -813,6 +832,8 @@ bool MissionItem::canEdit(void) ...@@ -813,6 +832,8 @@ bool MissionItem::canEdit(void)
void MissionItem::setDirty(bool dirty) void MissionItem::setDirty(bool dirty)
{ {
_dirty = dirty; _dirty = dirty;
// We want to emit dirtyChanged even if _dirty didn't change. This can be handy signal for
// any value within the item changing.
emit dirtyChanged(_dirty); emit dirtyChanged(_dirty);
} }
...@@ -821,3 +842,9 @@ void MissionItem::_factValueChanged(QVariant value) ...@@ -821,3 +842,9 @@ void MissionItem::_factValueChanged(QVariant value)
Q_UNUSED(value); Q_UNUSED(value);
setDirty(true); setDirty(true);
} }
void MissionItem::_coordinateFactChanged(QVariant value)
{
Q_UNUSED(value);
emit coordinateChanged(coordinate());
}
...@@ -68,7 +68,6 @@ public: ...@@ -68,7 +68,6 @@ public:
Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged) Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY commandChanged) Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY commandChanged)
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged) Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
Q_PROPERTY(double yaw READ yawDegrees WRITE setYawDegrees NOTIFY yawChanged)
Q_PROPERTY(QStringList commandNames READ commandNames CONSTANT) Q_PROPERTY(QStringList commandNames READ commandNames CONSTANT)
Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged) Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged)
Q_PROPERTY(QStringList valueLabels READ valueLabels NOTIFY commandChanged) Q_PROPERTY(QStringList valueLabels READ valueLabels NOTIFY commandChanged)
...@@ -189,7 +188,6 @@ signals: ...@@ -189,7 +188,6 @@ signals:
void sequenceNumberChanged(int sequenceNumber); void sequenceNumberChanged(int sequenceNumber);
void isCurrentItemChanged(bool isCurrentItem); void isCurrentItemChanged(bool isCurrentItem);
void coordinateChanged(const QGeoCoordinate& coordinate); void coordinateChanged(const QGeoCoordinate& coordinate);
void yawChanged(double yaw);
void dirtyChanged(bool dirty); void dirtyChanged(bool dirty);
/** @brief Announces a change to the waypoint data */ /** @brief Announces a change to the waypoint data */
...@@ -229,6 +227,7 @@ public: ...@@ -229,6 +227,7 @@ public:
private slots: private slots:
void _factValueChanged(QVariant value); void _factValueChanged(QVariant value);
void _coordinateFactChanged(QVariant value);
private: private:
QString _oneDecimalString(double value); QString _oneDecimalString(double value);
......
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