Commit aef36099 authored by Michael Carpenter's avatar Michael Carpenter

Fix for crash when removing item from QuickView, and addition of more generic...

Fix for crash when removing item from QuickView, and addition of more generic signal/slot combonation for property updates
parent 73a9b95c
...@@ -118,6 +118,7 @@ public: ...@@ -118,6 +118,7 @@ public:
{ {
localX = val; localX = val;
emit localXChanged(val,"localX"); emit localXChanged(val,"localX");
emit valueChanged(this->uasId,"localX","M",QVariant(val),getUnixTime());
} }
double getLocalX() const double getLocalX() const
{ {
...@@ -128,6 +129,7 @@ public: ...@@ -128,6 +129,7 @@ public:
{ {
localY = val; localY = val;
emit localYChanged(val,"localY"); emit localYChanged(val,"localY");
emit valueChanged(this->uasId,"localY","M",QVariant(val),getUnixTime());
} }
double getLocalY() const double getLocalY() const
{ {
...@@ -138,6 +140,7 @@ public: ...@@ -138,6 +140,7 @@ public:
{ {
localZ = val; localZ = val;
emit localZChanged(val,"localZ"); emit localZChanged(val,"localZ");
emit valueChanged(this->uasId,"localZ","M",QVariant(val),getUnixTime());
} }
double getLocalZ() const double getLocalZ() const
{ {
...@@ -148,6 +151,7 @@ public: ...@@ -148,6 +151,7 @@ public:
{ {
latitude = val; latitude = val;
emit latitudeChanged(val,"latitude"); emit latitudeChanged(val,"latitude");
emit valueChanged(this->uasId,"latitude","deg",QVariant(val),getUnixTime());
} }
double getLatitude() const double getLatitude() const
{ {
...@@ -158,6 +162,7 @@ public: ...@@ -158,6 +162,7 @@ public:
{ {
longitude = val; longitude = val;
emit longitudeChanged(val,"longitude"); emit longitudeChanged(val,"longitude");
emit valueChanged(this->uasId,"longitude","deg",QVariant(val),getUnixTime());
} }
double getLongitude() const double getLongitude() const
{ {
...@@ -168,6 +173,7 @@ public: ...@@ -168,6 +173,7 @@ public:
{ {
altitude = val; altitude = val;
emit altitudeChanged(val,"altitude"); emit altitudeChanged(val,"altitude");
emit valueChanged(this->uasId,"altitude","M",QVariant(val),getUnixTime());
} }
double getAltitude() const double getAltitude() const
...@@ -179,6 +185,7 @@ public: ...@@ -179,6 +185,7 @@ public:
{ {
satelliteCount = val; satelliteCount = val;
emit satelliteCountChanged(val,"satelliteCount"); emit satelliteCountChanged(val,"satelliteCount");
emit valueChanged(this->uasId,"satelliteCount","M",QVariant(val),getUnixTime());
} }
double getSatelliteCount() const double getSatelliteCount() const
...@@ -199,6 +206,7 @@ public: ...@@ -199,6 +206,7 @@ public:
{ {
distToWaypoint = val; distToWaypoint = val;
emit distToWaypointChanged(val,"distToWaypoint"); emit distToWaypointChanged(val,"distToWaypoint");
emit valueChanged(this->uasId,"distToWaypoint","M",QVariant(val),getUnixTime());
} }
double getDistToWaypoint() const double getDistToWaypoint() const
...@@ -807,6 +815,8 @@ signals: ...@@ -807,6 +815,8 @@ signals:
void satelliteCountChanged(double val,QString name); void satelliteCountChanged(double val,QString name);
void distToWaypointChanged(double val,QString name); void distToWaypointChanged(double val,QString name);
protected: protected:
/** @brief Get the UNIX timestamp in milliseconds, enter microseconds */ /** @brief Get the UNIX timestamp in milliseconds, enter microseconds */
quint64 getUnixTime(quint64 time=0); quint64 getUnixTime(quint64 time=0);
......
...@@ -449,6 +449,7 @@ signals: ...@@ -449,6 +449,7 @@ signals:
void valueChanged(const int uasId, const QString& name, const QString& unit, const quint64 value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const quint64 value, const quint64 msec);
void valueChanged(const int uasId, const QString& name, const QString& unit, const qint64 value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const qint64 value, const quint64 msec);
void valueChanged(const int uasId, const QString& name, const QString& unit, const double value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const double value, const quint64 msec);
void valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs);
void voltageChanged(int uasId, double voltage); void voltageChanged(int uasId, double voltage);
void waypointUpdated(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool active); void waypointUpdated(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool active);
......
...@@ -106,6 +106,7 @@ void UASQuickView::setActiveUAS(UASInterface* uas) ...@@ -106,6 +106,7 @@ void UASQuickView::setActiveUAS(UASInterface* uas)
return; return;
} }
this->uas = uas; this->uas = uas;
connect(uas,SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)),this,SLOT(valueChanged(int,QString,QString,QVariant,quint64)));
uasPropertyList.clear(); uasPropertyList.clear();
qDebug() << "UASInfoWidget property count:" << uas->metaObject()->propertyCount(); qDebug() << "UASInfoWidget property count:" << uas->metaObject()->propertyCount();
for (int i=0;i<uas->metaObject()->propertyCount();i++) for (int i=0;i<uas->metaObject()->propertyCount();i++)
...@@ -151,13 +152,18 @@ void UASQuickView::actionTriggered(bool checked) ...@@ -151,13 +152,18 @@ void UASQuickView::actionTriggered(bool checked)
else else
{ {
ui.verticalLayout->removeWidget(uasPropertyToLabelMap[senderlabel->text()]); ui.verticalLayout->removeWidget(uasPropertyToLabelMap[senderlabel->text()]);
uasPropertyToLabelMap.remove(senderlabel->text());
uasPropertyToLabelMap[senderlabel->text()]->deleteLater(); uasPropertyToLabelMap[senderlabel->text()]->deleteLater();
uasPropertyToLabelMap.remove(senderlabel->text());
} }
} }
void UASQuickView::valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs)
{
uasPropertyValueMap[name] = value.toDouble();
}
void UASQuickView::valChanged(double val,QString type) void UASQuickView::valChanged(double val,QString type)
{ {
//qDebug() << "Value changed:" << type << val; //qDebug() << "Value changed:" << type << val;
uasPropertyValueMap[type] = val; // uasPropertyValueMap[type] = val;
} }
...@@ -24,6 +24,7 @@ protected: ...@@ -24,6 +24,7 @@ protected:
signals: signals:
public slots: public slots:
void valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs);
void actionTriggered(bool checked); void actionTriggered(bool checked);
void updateTimerTick(); void updateTimerTick();
void addUAS(UASInterface* uas); void addUAS(UASInterface* uas);
......
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