mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
Merge remote-tracking branch 'origin/next' into laurent/OP-1337_French_translations_updates
This commit is contained in:
commit
c67310509e
@ -52,11 +52,13 @@ class FieldTreeItem : public TreeItem {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FieldTreeItem(int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
FieldTreeItem(int index, const QList<QVariant> &data, UAVObjectField *field, TreeItem *parent = 0) :
|
||||||
TreeItem(data, parent), m_index(index) {}
|
TreeItem(data, parent), m_index(index), m_field(field)
|
||||||
|
{}
|
||||||
|
|
||||||
FieldTreeItem(int index, const QVariant &data, TreeItem *parent = 0) :
|
FieldTreeItem(int index, const QVariant &data, UAVObjectField *field, TreeItem *parent = 0) :
|
||||||
TreeItem(data, parent), m_index(index) {}
|
TreeItem(data, parent), m_index(index), m_field(field)
|
||||||
|
{}
|
||||||
|
|
||||||
bool isEditable()
|
bool isEditable()
|
||||||
{
|
{
|
||||||
@ -67,19 +69,27 @@ public:
|
|||||||
virtual QVariant getEditorValue(QWidget *editor) = 0;
|
virtual QVariant getEditorValue(QWidget *editor) = 0;
|
||||||
virtual void setEditorValue(QWidget *editor, QVariant value) = 0;
|
virtual void setEditorValue(QWidget *editor, QVariant value) = 0;
|
||||||
virtual void apply() {}
|
virtual void apply() {}
|
||||||
|
virtual bool isKnown()
|
||||||
|
{
|
||||||
|
return parent()->isKnown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_index;
|
int m_index;
|
||||||
|
UAVObjectField *m_field;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnumFieldTreeItem : public FieldTreeItem {
|
class EnumFieldTreeItem : public FieldTreeItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
EnumFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
EnumFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_enumOptions(field->getOptions()), m_field(field) {}
|
FieldTreeItem(index, data, field, parent), m_enumOptions(field->getOptions())
|
||||||
|
{}
|
||||||
|
|
||||||
EnumFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
EnumFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_enumOptions(field->getOptions()), m_field(field) {}
|
FieldTreeItem(index, data, field, parent), m_enumOptions(field->getOptions())
|
||||||
|
{}
|
||||||
|
|
||||||
void setData(QVariant value, int column)
|
void setData(QVariant value, int column)
|
||||||
{
|
{
|
||||||
@ -148,20 +158,19 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_enumOptions;
|
QStringList m_enumOptions;
|
||||||
UAVObjectField *m_field;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class IntFieldTreeItem : public FieldTreeItem {
|
class IntFieldTreeItem : public FieldTreeItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
IntFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
IntFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field)
|
FieldTreeItem(index, data, field, parent)
|
||||||
{
|
{
|
||||||
setMinMaxValues();
|
setMinMaxValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
IntFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
IntFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field)
|
FieldTreeItem(index, data, field, parent)
|
||||||
{
|
{
|
||||||
setMinMaxValues();
|
setMinMaxValues();
|
||||||
}
|
}
|
||||||
@ -246,7 +255,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectField *m_field;
|
|
||||||
int m_minValue;
|
int m_minValue;
|
||||||
int m_maxValue;
|
int m_maxValue;
|
||||||
};
|
};
|
||||||
@ -255,10 +263,10 @@ class FloatFieldTreeItem : public FieldTreeItem {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FloatFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, bool scientific = false, TreeItem *parent = 0) :
|
FloatFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, bool scientific = false, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field), m_useScientificNotation(scientific) {}
|
FieldTreeItem(index, data, field, parent), m_useScientificNotation(scientific) {}
|
||||||
|
|
||||||
FloatFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, bool scientific = false, TreeItem *parent = 0) :
|
FloatFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, bool scientific = false, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field), m_useScientificNotation(scientific) {}
|
FieldTreeItem(index, data, field, parent), m_useScientificNotation(scientific) {}
|
||||||
|
|
||||||
void setData(QVariant value, int column)
|
void setData(QVariant value, int column)
|
||||||
{
|
{
|
||||||
@ -324,7 +332,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectField *m_field;
|
|
||||||
bool m_useScientificNotation;
|
bool m_useScientificNotation;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -332,11 +339,11 @@ class HexFieldTreeItem : public FieldTreeItem {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
HexFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
HexFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field)
|
FieldTreeItem(index, data, field, parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
HexFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
HexFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field)
|
FieldTreeItem(index, data, field, parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QWidget *createEditor(QWidget *parent)
|
QWidget *createEditor(QWidget *parent)
|
||||||
@ -385,8 +392,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectField *m_field;
|
|
||||||
|
|
||||||
QVariant toHexString(QVariant value)
|
QVariant toHexString(QVariant value)
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
@ -407,11 +412,11 @@ class CharFieldTreeItem : public FieldTreeItem {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CharFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
CharFieldTreeItem(UAVObjectField *field, int index, const QList<QVariant> &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field)
|
FieldTreeItem(index, data, field, parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CharFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
CharFieldTreeItem(UAVObjectField *field, int index, const QVariant &data, TreeItem *parent = 0) :
|
||||||
FieldTreeItem(index, data, parent), m_field(field)
|
FieldTreeItem(index, data, field, parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QWidget *createEditor(QWidget *parent)
|
QWidget *createEditor(QWidget *parent)
|
||||||
@ -460,8 +465,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectField *m_field;
|
|
||||||
|
|
||||||
QVariant toChar(QVariant value)
|
QVariant toChar(QVariant value)
|
||||||
{
|
{
|
||||||
return value.toChar();
|
return value.toChar();
|
||||||
|
@ -88,6 +88,9 @@ private:
|
|||||||
class TreeItem : public QObject {
|
class TreeItem : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
static const int TITLE_COLUMN = 0;
|
||||||
|
static const int DATA_COLUMN = 1;
|
||||||
|
|
||||||
TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
|
TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
|
||||||
TreeItem(const QVariant &data, TreeItem *parent = 0);
|
TreeItem(const QVariant &data, TreeItem *parent = 0);
|
||||||
virtual ~TreeItem();
|
virtual ~TreeItem();
|
||||||
@ -205,14 +208,31 @@ public:
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
void updateIsKnown(bool isKnown)
|
||||||
|
{
|
||||||
|
if (isKnown != this->isKnown()) {
|
||||||
|
m_changed = false;
|
||||||
|
foreach(TreeItem * child, m_children) {
|
||||||
|
child->updateIsKnown(isKnown);
|
||||||
|
}
|
||||||
|
emit updateIsKnown(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
virtual bool isKnown()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateHighlight(TreeItem *);
|
void updateHighlight(TreeItem *item);
|
||||||
|
void updateIsKnown(TreeItem *item);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static int m_highlightTimeMs;
|
||||||
QList<TreeItem *> m_children;
|
QList<TreeItem *> m_children;
|
||||||
|
|
||||||
// m_data contains: [0] property name, [1] value, [2] unit
|
// m_data contains: [0] property name, [1] value, [2] unit
|
||||||
QList<QVariant> m_data;
|
QList<QVariant> m_data;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
@ -221,9 +241,6 @@ private:
|
|||||||
bool m_changed;
|
bool m_changed;
|
||||||
QTime m_highlightExpires;
|
QTime m_highlightExpires;
|
||||||
HighLightManager *m_highlightManager;
|
HighLightManager *m_highlightManager;
|
||||||
static int m_highlightTimeMs;
|
|
||||||
public:
|
|
||||||
static const int dataColumn = 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DataObjectTreeItem;
|
class DataObjectTreeItem;
|
||||||
@ -265,18 +282,25 @@ private:
|
|||||||
class ObjectTreeItem : public TreeItem {
|
class ObjectTreeItem : public TreeItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ObjectTreeItem(const QList<QVariant> &data, TreeItem *parent = 0) :
|
ObjectTreeItem(const QList<QVariant> &data, UAVObject *object, TreeItem *parent = 0) :
|
||||||
TreeItem(data, parent), m_obj(0) {}
|
TreeItem(data, parent), m_obj(object)
|
||||||
ObjectTreeItem(const QVariant &data, TreeItem *parent = 0) :
|
|
||||||
TreeItem(data, parent), m_obj(0) {}
|
|
||||||
void setObject(UAVObject *obj)
|
|
||||||
{
|
{
|
||||||
m_obj = obj; setDescription(obj->getDescription());
|
setDescription(m_obj->getDescription());
|
||||||
|
}
|
||||||
|
ObjectTreeItem(const QVariant &data, UAVObject *object, TreeItem *parent = 0) :
|
||||||
|
TreeItem(data, parent), m_obj(object)
|
||||||
|
{
|
||||||
|
setDescription(m_obj->getDescription());
|
||||||
}
|
}
|
||||||
inline UAVObject *object()
|
inline UAVObject *object()
|
||||||
{
|
{
|
||||||
return m_obj;
|
return m_obj;
|
||||||
}
|
}
|
||||||
|
bool isKnown()
|
||||||
|
{
|
||||||
|
return !m_obj->isSettingsObject() || m_obj->isKnown();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObject *m_obj;
|
UAVObject *m_obj;
|
||||||
};
|
};
|
||||||
@ -284,25 +308,27 @@ private:
|
|||||||
class MetaObjectTreeItem : public ObjectTreeItem {
|
class MetaObjectTreeItem : public ObjectTreeItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MetaObjectTreeItem(UAVObject *obj, const QList<QVariant> &data, TreeItem *parent = 0) :
|
MetaObjectTreeItem(UAVObject *object, const QList<QVariant> &data, TreeItem *parent = 0) :
|
||||||
ObjectTreeItem(data, parent)
|
ObjectTreeItem(data, object, parent)
|
||||||
|
{}
|
||||||
|
MetaObjectTreeItem(UAVObject *object, const QVariant &data, TreeItem *parent = 0) :
|
||||||
|
ObjectTreeItem(data, object, parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool isKnown()
|
||||||
{
|
{
|
||||||
setObject(obj);
|
return parent()->isKnown();
|
||||||
}
|
|
||||||
MetaObjectTreeItem(UAVObject *obj, const QVariant &data, TreeItem *parent = 0) :
|
|
||||||
ObjectTreeItem(data, parent)
|
|
||||||
{
|
|
||||||
setObject(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DataObjectTreeItem : public ObjectTreeItem {
|
class DataObjectTreeItem : public ObjectTreeItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DataObjectTreeItem(const QList<QVariant> &data, TreeItem *parent = 0) :
|
DataObjectTreeItem(const QList<QVariant> &data, UAVObject *object, TreeItem *parent = 0) :
|
||||||
ObjectTreeItem(data, parent) {}
|
ObjectTreeItem(data, object, parent) {}
|
||||||
DataObjectTreeItem(const QVariant &data, TreeItem *parent = 0) :
|
DataObjectTreeItem(const QVariant &data, UAVObject *object, TreeItem *parent = 0) :
|
||||||
ObjectTreeItem(data, parent) {}
|
ObjectTreeItem(data, object, parent) {}
|
||||||
virtual void apply()
|
virtual void apply()
|
||||||
{
|
{
|
||||||
foreach(TreeItem * child, treeChildren()) {
|
foreach(TreeItem * child, treeChildren()) {
|
||||||
@ -328,16 +354,12 @@ public:
|
|||||||
class InstanceTreeItem : public DataObjectTreeItem {
|
class InstanceTreeItem : public DataObjectTreeItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
InstanceTreeItem(UAVObject *obj, const QList<QVariant> &data, TreeItem *parent = 0) :
|
InstanceTreeItem(UAVObject *object, const QList<QVariant> &data, TreeItem *parent = 0) :
|
||||||
DataObjectTreeItem(data, parent)
|
DataObjectTreeItem(data, object, parent)
|
||||||
{
|
{}
|
||||||
setObject(obj);
|
InstanceTreeItem(UAVObject *object, const QVariant &data, TreeItem *parent = 0) :
|
||||||
}
|
DataObjectTreeItem(data, object, parent)
|
||||||
InstanceTreeItem(UAVObject *obj, const QVariant &data, TreeItem *parent = 0) :
|
{}
|
||||||
DataObjectTreeItem(data, parent)
|
|
||||||
{
|
|
||||||
setObject(obj);
|
|
||||||
}
|
|
||||||
virtual void apply()
|
virtual void apply()
|
||||||
{
|
{
|
||||||
TreeItem::apply();
|
TreeItem::apply();
|
||||||
@ -356,6 +378,10 @@ public:
|
|||||||
ArrayFieldTreeItem(UAVObjectField *field, const QVariant &data, TreeItem *parent = 0) : TreeItem(data, parent), m_field(field)
|
ArrayFieldTreeItem(UAVObjectField *field, const QVariant &data, TreeItem *parent = 0) : TreeItem(data, parent), m_field(field)
|
||||||
{}
|
{}
|
||||||
QVariant data(int column) const;
|
QVariant data(int column) const;
|
||||||
|
bool isKnown()
|
||||||
|
{
|
||||||
|
return parent()->isKnown();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectField *m_field;
|
UAVObjectField *m_field;
|
||||||
|
@ -46,6 +46,7 @@ void UAVObjectBrowser::loadConfiguration(IUAVGadgetConfiguration *config)
|
|||||||
UAVObjectBrowserConfiguration *m = qobject_cast<UAVObjectBrowserConfiguration *>(config);
|
UAVObjectBrowserConfiguration *m = qobject_cast<UAVObjectBrowserConfiguration *>(config);
|
||||||
|
|
||||||
m_config = m;
|
m_config = m;
|
||||||
|
m_widget->setUnknownObjectColor(m->unknownObjectColor());
|
||||||
m_widget->setRecentlyUpdatedColor(m->recentlyUpdatedColor());
|
m_widget->setRecentlyUpdatedColor(m->recentlyUpdatedColor());
|
||||||
m_widget->setManuallyChangedColor(m->manuallyChangedColor());
|
m_widget->setManuallyChangedColor(m->manuallyChangedColor());
|
||||||
m_widget->setRecentlyUpdatedTimeout(m->recentlyUpdatedTimeout());
|
m_widget->setRecentlyUpdatedTimeout(m->recentlyUpdatedTimeout());
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
UAVObjectBrowserConfiguration::UAVObjectBrowserConfiguration(QString classId, QSettings *qSettings, QObject *parent) :
|
UAVObjectBrowserConfiguration::UAVObjectBrowserConfiguration(QString classId, QSettings *qSettings, QObject *parent) :
|
||||||
IUAVGadgetConfiguration(classId, parent),
|
IUAVGadgetConfiguration(classId, parent),
|
||||||
|
m_unknownObjectColor(QColor(Qt::gray)),
|
||||||
m_recentlyUpdatedColor(QColor(255, 230, 230)),
|
m_recentlyUpdatedColor(QColor(255, 230, 230)),
|
||||||
m_manuallyChangedColor(QColor(230, 230, 255)),
|
m_manuallyChangedColor(QColor(230, 230, 255)),
|
||||||
m_onlyHilightChangedValues(false),
|
m_onlyHilightChangedValues(false),
|
||||||
@ -40,6 +41,7 @@ UAVObjectBrowserConfiguration::UAVObjectBrowserConfiguration(QString classId, QS
|
|||||||
{
|
{
|
||||||
// if a saved configuration exists load it
|
// if a saved configuration exists load it
|
||||||
if (qSettings != 0) {
|
if (qSettings != 0) {
|
||||||
|
m_unknownObjectColor = qSettings->value("unknownObjectColor", QVariant(QColor(Qt::gray))).value<QColor>();
|
||||||
m_useCategorizedView = qSettings->value("CategorizedView").toBool();
|
m_useCategorizedView = qSettings->value("CategorizedView").toBool();
|
||||||
m_useScientificView = qSettings->value("ScientificView").toBool();
|
m_useScientificView = qSettings->value("ScientificView").toBool();
|
||||||
m_showMetaData = qSettings->value("showMetaData").toBool();
|
m_showMetaData = qSettings->value("showMetaData").toBool();
|
||||||
@ -64,6 +66,7 @@ IUAVGadgetConfiguration *UAVObjectBrowserConfiguration::clone()
|
|||||||
m->m_useScientificView = m_useScientificView;
|
m->m_useScientificView = m_useScientificView;
|
||||||
m->m_splitterState = m_splitterState;
|
m->m_splitterState = m_splitterState;
|
||||||
m->m_showMetaData = m_showMetaData;
|
m->m_showMetaData = m_showMetaData;
|
||||||
|
m->m_unknownObjectColor = m_unknownObjectColor;
|
||||||
m->m_showDescription = m_showDescription;
|
m->m_showDescription = m_showDescription;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
@ -74,6 +77,7 @@ IUAVGadgetConfiguration *UAVObjectBrowserConfiguration::clone()
|
|||||||
*/
|
*/
|
||||||
void UAVObjectBrowserConfiguration::saveConfig(QSettings *qSettings) const
|
void UAVObjectBrowserConfiguration::saveConfig(QSettings *qSettings) const
|
||||||
{
|
{
|
||||||
|
qSettings->setValue("unknownObjectColor", m_unknownObjectColor);
|
||||||
qSettings->setValue("recentlyUpdatedColor", m_recentlyUpdatedColor);
|
qSettings->setValue("recentlyUpdatedColor", m_recentlyUpdatedColor);
|
||||||
qSettings->setValue("manuallyChangedColor", m_manuallyChangedColor);
|
qSettings->setValue("manuallyChangedColor", m_manuallyChangedColor);
|
||||||
qSettings->setValue("recentlyUpdatedTimeout", m_recentlyUpdatedTimeout);
|
qSettings->setValue("recentlyUpdatedTimeout", m_recentlyUpdatedTimeout);
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
class UAVObjectBrowserConfiguration : public IUAVGadgetConfiguration {
|
class UAVObjectBrowserConfiguration : public IUAVGadgetConfiguration {
|
||||||
Q_OBJECT Q_PROPERTY(QColor m_recentlyUpdatedColor READ recentlyUpdatedColor WRITE setRecentlyUpdatedColor)
|
Q_OBJECT Q_PROPERTY(QColor m_unknownObjectColor READ unknownObjectColor WRITE setUnknownObjectColor)
|
||||||
|
Q_PROPERTY(QColor m_recentlyUpdatedColor READ recentlyUpdatedColor WRITE setRecentlyUpdatedColor)
|
||||||
Q_PROPERTY(QColor m_manuallyChangedColor READ manuallyChangedColor WRITE setManuallyChangedColor)
|
Q_PROPERTY(QColor m_manuallyChangedColor READ manuallyChangedColor WRITE setManuallyChangedColor)
|
||||||
Q_PROPERTY(int m_recentlyUpdatedTimeout READ recentlyUpdatedTimeout WRITE setRecentlyUpdatedTimeout)
|
Q_PROPERTY(int m_recentlyUpdatedTimeout READ recentlyUpdatedTimeout WRITE setRecentlyUpdatedTimeout)
|
||||||
Q_PROPERTY(bool m_onlyHilightChangedValues READ onlyHighlightChangedValues WRITE setOnlyHighlightChangedValues)
|
Q_PROPERTY(bool m_onlyHilightChangedValues READ onlyHighlightChangedValues WRITE setOnlyHighlightChangedValues)
|
||||||
@ -49,6 +50,10 @@ public:
|
|||||||
void saveConfig(QSettings *settings) const;
|
void saveConfig(QSettings *settings) const;
|
||||||
IUAVGadgetConfiguration *clone();
|
IUAVGadgetConfiguration *clone();
|
||||||
|
|
||||||
|
QColor unknownObjectColor() const
|
||||||
|
{
|
||||||
|
return m_unknownObjectColor;
|
||||||
|
}
|
||||||
QColor recentlyUpdatedColor() const
|
QColor recentlyUpdatedColor() const
|
||||||
{
|
{
|
||||||
return m_recentlyUpdatedColor;
|
return m_recentlyUpdatedColor;
|
||||||
@ -90,6 +95,10 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void setUnknownObjectColor(QColor color)
|
||||||
|
{
|
||||||
|
m_unknownObjectColor = color;
|
||||||
|
}
|
||||||
void setRecentlyUpdatedColor(QColor color)
|
void setRecentlyUpdatedColor(QColor color)
|
||||||
{
|
{
|
||||||
m_recentlyUpdatedColor = color;
|
m_recentlyUpdatedColor = color;
|
||||||
@ -129,6 +138,7 @@ public slots:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QColor m_unknownObjectColor;
|
||||||
QColor m_recentlyUpdatedColor;
|
QColor m_recentlyUpdatedColor;
|
||||||
QColor m_manuallyChangedColor;
|
QColor m_manuallyChangedColor;
|
||||||
bool m_onlyHilightChangedValues;
|
bool m_onlyHilightChangedValues;
|
||||||
|
@ -50,6 +50,7 @@ QWidget *UAVObjectBrowserOptionsPage::createPage(QWidget *parent)
|
|||||||
|
|
||||||
m_page->recentlyUpdatedButton->setColor(m_config->recentlyUpdatedColor());
|
m_page->recentlyUpdatedButton->setColor(m_config->recentlyUpdatedColor());
|
||||||
m_page->manuallyChangedButton->setColor(m_config->manuallyChangedColor());
|
m_page->manuallyChangedButton->setColor(m_config->manuallyChangedColor());
|
||||||
|
m_page->unknownButton->setColor(m_config->unknownObjectColor());
|
||||||
m_page->recentlyUpdatedTimeoutSpinBox->setValue(m_config->recentlyUpdatedTimeout());
|
m_page->recentlyUpdatedTimeoutSpinBox->setValue(m_config->recentlyUpdatedTimeout());
|
||||||
m_page->hilightBox->setChecked(m_config->onlyHighlightChangedValues());
|
m_page->hilightBox->setChecked(m_config->onlyHighlightChangedValues());
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ QWidget *UAVObjectBrowserOptionsPage::createPage(QWidget *parent)
|
|||||||
|
|
||||||
void UAVObjectBrowserOptionsPage::apply()
|
void UAVObjectBrowserOptionsPage::apply()
|
||||||
{
|
{
|
||||||
|
m_config->setUnknownObjectColor(m_page->unknownButton->color());
|
||||||
m_config->setRecentlyUpdatedColor(m_page->recentlyUpdatedButton->color());
|
m_config->setRecentlyUpdatedColor(m_page->recentlyUpdatedButton->color());
|
||||||
m_config->setManuallyChangedColor(m_page->manuallyChangedButton->color());
|
m_config->setManuallyChangedColor(m_page->manuallyChangedButton->color());
|
||||||
m_config->setRecentlyUpdatedTimeout(m_page->recentlyUpdatedTimeoutSpinBox->value());
|
m_config->setRecentlyUpdatedTimeout(m_page->recentlyUpdatedTimeoutSpinBox->value());
|
||||||
|
@ -14,7 +14,16 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -33,12 +42,21 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>482</width>
|
<width>507</width>
|
||||||
<height>194</height>
|
<height>178</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -48,6 +66,32 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="2">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="Utils::QtColorButton" name="recentlyUpdatedButton">
|
<widget class="Utils::QtColorButton" name="recentlyUpdatedButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -67,10 +111,33 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Manually changed color:</string>
|
<string>Recently updated timeout (ms):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QCheckBox" name="hilightBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Only highlight nodes when value actually changes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QSpinBox" name="recentlyUpdatedTimeoutSpinBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100000000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>100</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -93,61 +160,38 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="0">
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Recently updated timeout (ms):</string>
|
<string>Manually changed color:</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QSpinBox" name="recentlyUpdatedTimeoutSpinBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100000000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="hilightBox">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Only highlight nodes when value actually changes</string>
|
<string>Unknown object color:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="3" column="1">
|
||||||
<spacer name="verticalSpacer">
|
<widget class="Utils::QtColorButton" name="unknownButton">
|
||||||
<property name="orientation">
|
<property name="sizePolicy">
|
||||||
<enum>Qt::Vertical</enum>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>64</width>
|
||||||
<height>40</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -162,6 +206,14 @@
|
|||||||
<header>utils/qtcolorbutton.h</header>
|
<header>utils/qtcolorbutton.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>scrollArea</tabstop>
|
||||||
|
<tabstop>recentlyUpdatedButton</tabstop>
|
||||||
|
<tabstop>manuallyChangedButton</tabstop>
|
||||||
|
<tabstop>unknownButton</tabstop>
|
||||||
|
<tabstop>recentlyUpdatedTimeoutSpinBox</tabstop>
|
||||||
|
<tabstop>hilightBox</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -51,11 +51,11 @@ UAVObjectBrowserWidget::UAVObjectBrowserWidget(QWidget *parent) : QWidget(parent
|
|||||||
m_model = new UAVObjectTreeModel();
|
m_model = new UAVObjectTreeModel();
|
||||||
m_browser->treeView->setModel(m_model);
|
m_browser->treeView->setModel(m_model);
|
||||||
m_browser->treeView->setColumnWidth(0, 300);
|
m_browser->treeView->setColumnWidth(0, 300);
|
||||||
|
|
||||||
BrowserItemDelegate *m_delegate = new BrowserItemDelegate();
|
BrowserItemDelegate *m_delegate = new BrowserItemDelegate();
|
||||||
m_browser->treeView->setItemDelegate(m_delegate);
|
m_browser->treeView->setItemDelegate(m_delegate);
|
||||||
m_browser->treeView->setEditTriggers(QAbstractItemView::AllEditTriggers);
|
m_browser->treeView->setEditTriggers(QAbstractItemView::AllEditTriggers);
|
||||||
m_browser->treeView->setSelectionBehavior(QAbstractItemView::SelectItems);
|
m_browser->treeView->setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||||
m_browser->splitter->setChildrenCollapsible(false);
|
|
||||||
m_mustacheTemplate = loadFileIntoString(QString(":/uavobjectbrowser/resources/uavodescription.mustache"));
|
m_mustacheTemplate = loadFileIntoString(QString(":/uavobjectbrowser/resources/uavodescription.mustache"));
|
||||||
showMetaData(m_viewoptions->cbMetaData->isChecked());
|
showMetaData(m_viewoptions->cbMetaData->isChecked());
|
||||||
showDescription(m_viewoptions->cbDescription->isChecked());
|
showDescription(m_viewoptions->cbDescription->isChecked());
|
||||||
@ -119,6 +119,7 @@ void UAVObjectBrowserWidget::categorize(bool categorize)
|
|||||||
m_model->setManuallyChangedColor(m_manuallyChangedColor);
|
m_model->setManuallyChangedColor(m_manuallyChangedColor);
|
||||||
m_model->setRecentlyUpdatedTimeout(m_recentlyUpdatedTimeout);
|
m_model->setRecentlyUpdatedTimeout(m_recentlyUpdatedTimeout);
|
||||||
m_model->setOnlyHilightChangedValues(m_onlyHilightChangedValues);
|
m_model->setOnlyHilightChangedValues(m_onlyHilightChangedValues);
|
||||||
|
m_model->setUnknowObjectColor(m_unknownObjectColor);
|
||||||
m_browser->treeView->setModel(m_model);
|
m_browser->treeView->setModel(m_model);
|
||||||
showMetaData(m_viewoptions->cbMetaData->isChecked());
|
showMetaData(m_viewoptions->cbMetaData->isChecked());
|
||||||
connect(m_browser->treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection);
|
connect(m_browser->treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection);
|
||||||
@ -134,6 +135,7 @@ void UAVObjectBrowserWidget::useScientificNotation(bool scientific)
|
|||||||
m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor);
|
m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor);
|
||||||
m_model->setManuallyChangedColor(m_manuallyChangedColor);
|
m_model->setManuallyChangedColor(m_manuallyChangedColor);
|
||||||
m_model->setRecentlyUpdatedTimeout(m_recentlyUpdatedTimeout);
|
m_model->setRecentlyUpdatedTimeout(m_recentlyUpdatedTimeout);
|
||||||
|
m_model->setUnknowObjectColor(m_unknownObjectColor);
|
||||||
m_browser->treeView->setModel(m_model);
|
m_browser->treeView->setModel(m_model);
|
||||||
showMetaData(m_viewoptions->cbMetaData->isChecked());
|
showMetaData(m_viewoptions->cbMetaData->isChecked());
|
||||||
connect(m_browser->treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection);
|
connect(m_browser->treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection);
|
||||||
|
@ -44,21 +44,31 @@ class UAVObjectBrowserWidget : public QWidget {
|
|||||||
public:
|
public:
|
||||||
UAVObjectBrowserWidget(QWidget *parent = 0);
|
UAVObjectBrowserWidget(QWidget *parent = 0);
|
||||||
~UAVObjectBrowserWidget();
|
~UAVObjectBrowserWidget();
|
||||||
|
|
||||||
|
void setUnknownObjectColor(QColor color)
|
||||||
|
{
|
||||||
|
m_unknownObjectColor = color;
|
||||||
|
m_model->setUnknowObjectColor(color);
|
||||||
|
}
|
||||||
void setRecentlyUpdatedColor(QColor color)
|
void setRecentlyUpdatedColor(QColor color)
|
||||||
{
|
{
|
||||||
m_recentlyUpdatedColor = color; m_model->setRecentlyUpdatedColor(color);
|
m_recentlyUpdatedColor = color;
|
||||||
|
m_model->setRecentlyUpdatedColor(color);
|
||||||
}
|
}
|
||||||
void setManuallyChangedColor(QColor color)
|
void setManuallyChangedColor(QColor color)
|
||||||
{
|
{
|
||||||
m_manuallyChangedColor = color; m_model->setManuallyChangedColor(color);
|
m_manuallyChangedColor = color;
|
||||||
|
m_model->setManuallyChangedColor(color);
|
||||||
}
|
}
|
||||||
void setRecentlyUpdatedTimeout(int timeout)
|
void setRecentlyUpdatedTimeout(int timeout)
|
||||||
{
|
{
|
||||||
m_recentlyUpdatedTimeout = timeout; m_model->setRecentlyUpdatedTimeout(timeout);
|
m_recentlyUpdatedTimeout = timeout;
|
||||||
|
m_model->setRecentlyUpdatedTimeout(timeout);
|
||||||
}
|
}
|
||||||
void setOnlyHilightChangedValues(bool hilight)
|
void setOnlyHilightChangedValues(bool hilight)
|
||||||
{
|
{
|
||||||
m_onlyHilightChangedValues = hilight; m_model->setOnlyHilightChangedValues(hilight);
|
m_onlyHilightChangedValues = hilight;
|
||||||
|
m_model->setOnlyHilightChangedValues(hilight);
|
||||||
}
|
}
|
||||||
void setViewOptions(bool categorized, bool scientific, bool metadata, bool description);
|
void setViewOptions(bool categorized, bool scientific, bool metadata, bool description);
|
||||||
void setSplitterState(QByteArray state);
|
void setSplitterState(QByteArray state);
|
||||||
@ -91,6 +101,7 @@ private:
|
|||||||
UAVObjectTreeModel *m_model;
|
UAVObjectTreeModel *m_model;
|
||||||
|
|
||||||
int m_recentlyUpdatedTimeout;
|
int m_recentlyUpdatedTimeout;
|
||||||
|
QColor m_unknownObjectColor;
|
||||||
QColor m_recentlyUpdatedColor;
|
QColor m_recentlyUpdatedColor;
|
||||||
QColor m_manuallyChangedColor;
|
QColor m_manuallyChangedColor;
|
||||||
bool m_onlyHilightChangedValues;
|
bool m_onlyHilightChangedValues;
|
||||||
|
@ -43,11 +43,14 @@ UAVObjectTreeModel::UAVObjectTreeModel(QObject *parent, bool categorize, bool us
|
|||||||
m_categorize(categorize),
|
m_categorize(categorize),
|
||||||
m_recentlyUpdatedTimeout(500), // ms
|
m_recentlyUpdatedTimeout(500), // ms
|
||||||
m_recentlyUpdatedColor(QColor(255, 230, 230)),
|
m_recentlyUpdatedColor(QColor(255, 230, 230)),
|
||||||
m_manuallyChangedColor(QColor(230, 230, 255))
|
m_manuallyChangedColor(QColor(230, 230, 255)),
|
||||||
|
m_unknownObjectColor(QColor(Qt::gray))
|
||||||
{
|
{
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
|
|
||||||
|
Q_ASSERT(objManager);
|
||||||
|
|
||||||
// Create highlight manager, let it run every 300 ms.
|
// Create highlight manager, let it run every 300 ms.
|
||||||
m_highlightManager = new HighLightManager(300);
|
m_highlightManager = new HighLightManager(300);
|
||||||
connect(objManager, SIGNAL(newObject(UAVObject *)), this, SLOT(newObject(UAVObject *)));
|
connect(objManager, SIGNAL(newObject(UAVObject *)), this, SLOT(newObject(UAVObject *)));
|
||||||
@ -112,9 +115,10 @@ void UAVObjectTreeModel::addDataObject(UAVDataObject *obj)
|
|||||||
if (existing) {
|
if (existing) {
|
||||||
addInstance(obj, existing);
|
addInstance(obj, existing);
|
||||||
} else {
|
} else {
|
||||||
DataObjectTreeItem *dataTreeItem = new DataObjectTreeItem(obj->getName() + " (" + QString::number(obj->getNumBytes()) + " bytes)");
|
DataObjectTreeItem *dataTreeItem = new DataObjectTreeItem(obj->getName(), obj);
|
||||||
dataTreeItem->setHighlightManager(m_highlightManager);
|
dataTreeItem->setHighlightManager(m_highlightManager);
|
||||||
connect(dataTreeItem, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
connect(dataTreeItem, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
||||||
|
connect(dataTreeItem, SIGNAL(updateIsKnown(TreeItem *)), this, SLOT(updateIsKnown(TreeItem *)));
|
||||||
parent->insertChild(dataTreeItem);
|
parent->insertChild(dataTreeItem);
|
||||||
root->addObjectTreeItem(obj->getObjID(), dataTreeItem);
|
root->addObjectTreeItem(obj->getObjID(), dataTreeItem);
|
||||||
UAVMetaObject *meta = obj->getMetaObject();
|
UAVMetaObject *meta = obj->getMetaObject();
|
||||||
@ -165,16 +169,18 @@ MetaObjectTreeItem *UAVObjectTreeModel::addMetaObject(UAVMetaObject *obj, TreeIt
|
|||||||
void UAVObjectTreeModel::addInstance(UAVObject *obj, TreeItem *parent)
|
void UAVObjectTreeModel::addInstance(UAVObject *obj, TreeItem *parent)
|
||||||
{
|
{
|
||||||
connect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(highlightUpdatedObject(UAVObject *)));
|
connect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(highlightUpdatedObject(UAVObject *)));
|
||||||
|
connect(obj, SIGNAL(isKnownChanged(UAVObject *, bool)), this, SLOT(isKnownChanged(UAVObject *, bool)));
|
||||||
TreeItem *item;
|
TreeItem *item;
|
||||||
if (obj->isSingleInstance()) {
|
if (obj->isSingleInstance()) {
|
||||||
item = parent;
|
item = parent;
|
||||||
DataObjectTreeItem *p = static_cast<DataObjectTreeItem *>(parent);
|
DataObjectTreeItem *objectItem = static_cast<DataObjectTreeItem *>(parent);
|
||||||
p->setObject(obj);
|
connect(objectItem, SIGNAL(updateIsKnown(TreeItem *)), this, SLOT(updateIsKnown(TreeItem *)));
|
||||||
} else {
|
} else {
|
||||||
QString name = tr("Instance") + " " + QString::number(obj->getInstID());
|
QString name = tr("Instance") + " " + QString::number(obj->getInstID());
|
||||||
item = new InstanceTreeItem(obj, name);
|
item = new InstanceTreeItem(obj, name);
|
||||||
item->setHighlightManager(m_highlightManager);
|
item->setHighlightManager(m_highlightManager);
|
||||||
connect(item, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
connect(item, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
||||||
|
connect(item, SIGNAL(updateIsKnown(TreeItem *)), this, SLOT(updateIsKnown(TreeItem *)));
|
||||||
parent->appendChild(item);
|
parent->appendChild(item);
|
||||||
}
|
}
|
||||||
foreach(UAVObjectField * field, obj->getFields()) {
|
foreach(UAVObjectField * field, obj->getFields()) {
|
||||||
@ -192,6 +198,7 @@ void UAVObjectTreeModel::addArrayField(UAVObjectField *field, TreeItem *parent)
|
|||||||
|
|
||||||
item->setHighlightManager(m_highlightManager);
|
item->setHighlightManager(m_highlightManager);
|
||||||
connect(item, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
connect(item, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
||||||
|
connect(item, SIGNAL(updateIsKnown(TreeItem *)), this, SLOT(updateIsKnown(TreeItem *)));
|
||||||
for (uint i = 0; i < field->getNumElements(); ++i) {
|
for (uint i = 0; i < field->getNumElements(); ++i) {
|
||||||
addSingleField(i, field, item);
|
addSingleField(i, field, item);
|
||||||
}
|
}
|
||||||
@ -247,6 +254,7 @@ void UAVObjectTreeModel::addSingleField(int index, UAVObjectField *field, TreeIt
|
|||||||
item->setHighlightManager(m_highlightManager);
|
item->setHighlightManager(m_highlightManager);
|
||||||
item->setDescription(field->getDescription());
|
item->setDescription(field->getDescription());
|
||||||
connect(item, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
connect(item, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *)));
|
||||||
|
connect(item, SIGNAL(updateIsKnown(TreeItem *)), this, SLOT(updateIsKnown(TreeItem *)));
|
||||||
parent->appendChild(item);
|
parent->appendChild(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,17 +361,21 @@ QVariant UAVObjectTreeModel::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.column() == TreeItem::dataColumn && role == Qt::EditRole) {
|
|
||||||
TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
|
||||||
|
|
||||||
|
if (index.column() == TreeItem::DATA_COLUMN && role == Qt::EditRole) {
|
||||||
return item->data(index.column());
|
return item->data(index.column());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == Qt::ToolTipRole) {
|
if (role == Qt::ToolTipRole) {
|
||||||
TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
|
|
||||||
return item->description();
|
return item->description();
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
|
if (role == Qt::ForegroundRole) {
|
||||||
|
if (!dynamic_cast<TopTreeItem *>(item) && !item->isKnown()) {
|
||||||
|
return QVariant(m_unknownObjectColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (index.column() == 0 && role == Qt::BackgroundRole) {
|
if (index.column() == 0 && role == Qt::BackgroundRole) {
|
||||||
if (!dynamic_cast<TopTreeItem *>(item) && item->highlighted()) {
|
if (!dynamic_cast<TopTreeItem *>(item) && item->highlighted()) {
|
||||||
@ -371,7 +383,7 @@ QVariant UAVObjectTreeModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.column() == TreeItem::dataColumn && role == Qt::BackgroundRole) {
|
if (index.column() == TreeItem::DATA_COLUMN && role == Qt::BackgroundRole) {
|
||||||
FieldTreeItem *fieldItem = dynamic_cast<FieldTreeItem *>(item);
|
FieldTreeItem *fieldItem = dynamic_cast<FieldTreeItem *>(item);
|
||||||
if (fieldItem && fieldItem->highlighted()) {
|
if (fieldItem && fieldItem->highlighted()) {
|
||||||
return QVariant(m_recentlyUpdatedColor);
|
return QVariant(m_recentlyUpdatedColor);
|
||||||
@ -386,7 +398,7 @@ QVariant UAVObjectTreeModel::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.column() == TreeItem::dataColumn) {
|
if (index.column() == TreeItem::DATA_COLUMN) {
|
||||||
EnumFieldTreeItem *fieldItem = dynamic_cast<EnumFieldTreeItem *>(item);
|
EnumFieldTreeItem *fieldItem = dynamic_cast<EnumFieldTreeItem *>(item);
|
||||||
if (fieldItem) {
|
if (fieldItem) {
|
||||||
int enumIndex = fieldItem->data(index.column()).toInt();
|
int enumIndex = fieldItem->data(index.column()).toInt();
|
||||||
@ -412,7 +424,7 @@ Qt::ItemFlags UAVObjectTreeModel::flags(const QModelIndex &index) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.column() == TreeItem::dataColumn) {
|
if (index.column() == TreeItem::DATA_COLUMN) {
|
||||||
TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
|
||||||
if (item->isEditable()) {
|
if (item->isEditable()) {
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
|
||||||
@ -483,5 +495,22 @@ void UAVObjectTreeModel::updateHighlight(TreeItem *item)
|
|||||||
QModelIndex itemIndex = index(item);
|
QModelIndex itemIndex = index(item);
|
||||||
|
|
||||||
Q_ASSERT(itemIndex != QModelIndex());
|
Q_ASSERT(itemIndex != QModelIndex());
|
||||||
emit dataChanged(itemIndex, itemIndex.sibling(itemIndex.row(), TreeItem::dataColumn));
|
emit dataChanged(itemIndex, itemIndex.sibling(itemIndex.row(), TreeItem::DATA_COLUMN));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAVObjectTreeModel::updateIsKnown(TreeItem *item)
|
||||||
|
{
|
||||||
|
QModelIndex itemIndex = index(item);
|
||||||
|
|
||||||
|
Q_ASSERT(itemIndex != QModelIndex());
|
||||||
|
emit dataChanged(itemIndex, itemIndex.sibling(itemIndex.row(), TreeItem::TITLE_COLUMN));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAVObjectTreeModel::isKnownChanged(UAVObject *object, bool isKnown)
|
||||||
|
{
|
||||||
|
Q_UNUSED(isKnown);
|
||||||
|
ObjectTreeItem *item = findObjectTreeItem(object);
|
||||||
|
if (item) {
|
||||||
|
item->updateIsKnown(isKnown);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,10 @@ public:
|
|||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
|
||||||
|
void setUnknowObjectColor(QColor color)
|
||||||
|
{
|
||||||
|
m_unknownObjectColor = color;
|
||||||
|
}
|
||||||
void setRecentlyUpdatedColor(QColor color)
|
void setRecentlyUpdatedColor(QColor color)
|
||||||
{
|
{
|
||||||
m_recentlyUpdatedColor = color;
|
m_recentlyUpdatedColor = color;
|
||||||
@ -88,8 +92,10 @@ public slots:
|
|||||||
void newObject(UAVObject *obj);
|
void newObject(UAVObject *obj);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void updateHighlight(TreeItem *item);
|
||||||
|
void updateIsKnown(TreeItem *item);
|
||||||
void highlightUpdatedObject(UAVObject *obj);
|
void highlightUpdatedObject(UAVObject *obj);
|
||||||
void updateHighlight(TreeItem *);
|
void isKnownChanged(UAVObject *object, bool isKnown);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupModelData(UAVObjectManager *objManager);
|
void setupModelData(UAVObjectManager *objManager);
|
||||||
@ -115,6 +121,7 @@ private:
|
|||||||
int m_recentlyUpdatedTimeout;
|
int m_recentlyUpdatedTimeout;
|
||||||
QColor m_recentlyUpdatedColor;
|
QColor m_recentlyUpdatedColor;
|
||||||
QColor m_manuallyChangedColor;
|
QColor m_manuallyChangedColor;
|
||||||
|
QColor m_unknownObjectColor;
|
||||||
bool m_onlyHilightChangedValues;
|
bool m_onlyHilightChangedValues;
|
||||||
|
|
||||||
// Highlight manager to handle highlighting of tree items.
|
// Highlight manager to handle highlighting of tree items.
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cbDescription">
|
<widget class="QCheckBox" name="cbDescription">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show description</string>
|
<string>Show Description</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -63,6 +63,7 @@ UAVObject::UAVObject(quint32 objID, bool isSingleInst, const QString & name)
|
|||||||
this->data = 0;
|
this->data = 0;
|
||||||
this->numBytes = 0;
|
this->numBytes = 0;
|
||||||
this->mutex = new QMutex(QMutex::Recursive);
|
this->mutex = new QMutex(QMutex::Recursive);
|
||||||
|
m_isKnown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -603,6 +604,25 @@ void UAVObject::emitNewInstance(UAVObject *obj)
|
|||||||
emit newInstance(obj);
|
emit newInstance(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UAVObject::isKnown() const
|
||||||
|
{
|
||||||
|
QMutexLocker locker(mutex);
|
||||||
|
|
||||||
|
return m_isKnown;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAVObject::setIsKnown(bool isKnown)
|
||||||
|
{
|
||||||
|
lock();
|
||||||
|
bool changed = m_isKnown != isKnown;
|
||||||
|
m_isKnown = isKnown;
|
||||||
|
unlock();
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
emit isKnownChanged(this, isKnown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool UAVObject::isSettingsObject()
|
bool UAVObject::isSettingsObject()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -142,6 +142,9 @@ public:
|
|||||||
void emitTransactionCompleted(bool success);
|
void emitTransactionCompleted(bool success);
|
||||||
void emitNewInstance(UAVObject *);
|
void emitNewInstance(UAVObject *);
|
||||||
|
|
||||||
|
bool isKnown() const;
|
||||||
|
void setIsKnown(bool isKnown);
|
||||||
|
|
||||||
virtual bool isSettingsObject();
|
virtual bool isSettingsObject();
|
||||||
virtual bool isDataObject();
|
virtual bool isDataObject();
|
||||||
virtual bool isMetaDataObject();
|
virtual bool isMetaDataObject();
|
||||||
@ -178,9 +181,7 @@ signals:
|
|||||||
void updateRequested(UAVObject *obj, bool all = false);
|
void updateRequested(UAVObject *obj, bool all = false);
|
||||||
void transactionCompleted(UAVObject *obj, bool success);
|
void transactionCompleted(UAVObject *obj, bool success);
|
||||||
void newInstance(UAVObject *obj);
|
void newInstance(UAVObject *obj);
|
||||||
|
void isKnownChanged(UAVObject *obj, bool isKnown);
|
||||||
private slots:
|
|
||||||
void fieldUpdated(UAVObjectField *field);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
quint32 objID;
|
quint32 objID;
|
||||||
@ -197,6 +198,12 @@ protected:
|
|||||||
void initializeFields(QList<UAVObjectField *> & fields, quint8 *data, quint32 numBytes);
|
void initializeFields(QList<UAVObjectField *> & fields, quint8 *data, quint32 numBytes);
|
||||||
void setDescription(const QString & description);
|
void setDescription(const QString & description);
|
||||||
void setCategory(const QString & category);
|
void setCategory(const QString & category);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_isKnown;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void fieldUpdated(UAVObjectField *field);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UAVOBJECT_H
|
#endif // UAVOBJECT_H
|
||||||
|
@ -41,10 +41,13 @@ Telemetry::Telemetry(UAVTalk *utalk, UAVObjectManager *objMngr) : objMngr(objMng
|
|||||||
mutex = new QMutex(QMutex::Recursive);
|
mutex = new QMutex(QMutex::Recursive);
|
||||||
|
|
||||||
// Register all objects in the list
|
// Register all objects in the list
|
||||||
QList< QList<UAVObject *> > objs = objMngr->getObjects();
|
foreach(QList<UAVObject *> instances, objMngr->getObjects()) {
|
||||||
for (int objidx = 0; objidx < objs.length(); ++objidx) {
|
foreach(UAVObject * object, instances) {
|
||||||
|
// make sure we 'forget' all objects before we request it from the flight side
|
||||||
|
object->setIsKnown(false);
|
||||||
|
}
|
||||||
// we only need to register one instance per object type
|
// we only need to register one instance per object type
|
||||||
registerObject(objs[objidx][0]);
|
registerObject(instances.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen to new object creations
|
// Listen to new object creations
|
||||||
@ -74,6 +77,12 @@ Telemetry::Telemetry(UAVTalk *utalk, UAVObjectManager *objMngr) : objMngr(objMng
|
|||||||
Telemetry::~Telemetry()
|
Telemetry::~Telemetry()
|
||||||
{
|
{
|
||||||
closeAllTransactions();
|
closeAllTransactions();
|
||||||
|
foreach(QList<UAVObject *> instances, objMngr->getObjects()) {
|
||||||
|
foreach(UAVObject * object, instances) {
|
||||||
|
// make sure we 'forget' all objects before we request it from the flight side
|
||||||
|
object->setIsKnown(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,10 +244,14 @@ void Telemetry::transactionCompleted(UAVObject *obj, bool success)
|
|||||||
|
|
||||||
if (transInfo) {
|
if (transInfo) {
|
||||||
if (success) {
|
if (success) {
|
||||||
|
// We now know tat the flight side knows of this object.
|
||||||
|
obj->setIsKnown(true);
|
||||||
|
|
||||||
#ifdef VERBOSE_TELEMETRY
|
#ifdef VERBOSE_TELEMETRY
|
||||||
qDebug() << "Telemetry - transaction successful for object" << obj->toStringBrief();
|
qDebug() << "Telemetry - transaction successful for object" << obj->toStringBrief();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
obj->setIsKnown(false);
|
||||||
qWarning() << "Telemetry - !!! transaction failed for object" << obj->toStringBrief();
|
qWarning() << "Telemetry - !!! transaction failed for object" << obj->toStringBrief();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +79,6 @@ public:
|
|||||||
void resetStats();
|
void resetStats();
|
||||||
void transactionTimeout(ObjectTransactionInfo *info);
|
void transactionTimeout(ObjectTransactionInfo *info);
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const int REQ_TIMEOUT_MS = 250;
|
static const int REQ_TIMEOUT_MS = 250;
|
||||||
|
@ -26,16 +26,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "telemetrymanager.h"
|
#include "telemetrymanager.h"
|
||||||
|
#include "telemetry.h"
|
||||||
|
#include "telemetrymonitor.h"
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/threadmanager.h>
|
#include <coreplugin/threadmanager.h>
|
||||||
|
|
||||||
TelemetryManager::TelemetryManager() : autopilotConnected(false)
|
TelemetryManager::TelemetryManager() : m_isAutopilotConnected(false)
|
||||||
{
|
{
|
||||||
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
||||||
// Get UAVObjectManager instance
|
// Get UAVObjectManager instance
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
objMngr = pm->getObject<UAVObjectManager>();
|
m_uavobjectManager = pm->getObject<UAVObjectManager>();
|
||||||
|
|
||||||
// connect to start stop signals
|
// connect to start stop signals
|
||||||
connect(this, SIGNAL(myStart()), this, SLOT(onStart()), Qt::QueuedConnection);
|
connect(this, SIGNAL(myStart()), this, SLOT(onStart()), Qt::QueuedConnection);
|
||||||
@ -47,24 +49,24 @@ TelemetryManager::~TelemetryManager()
|
|||||||
|
|
||||||
bool TelemetryManager::isConnected()
|
bool TelemetryManager::isConnected()
|
||||||
{
|
{
|
||||||
return autopilotConnected;
|
return m_isAutopilotConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryManager::start(QIODevice *dev)
|
void TelemetryManager::start(QIODevice *dev)
|
||||||
{
|
{
|
||||||
device = dev;
|
m_telemetryDevice = dev;
|
||||||
// OP-1383
|
// OP-1383
|
||||||
// take ownership of the device by moving it to the TelemetryManager thread (see TelemetryManager constructor)
|
// take ownership of the device by moving it to the TelemetryManager thread (see TelemetryManager constructor)
|
||||||
// this removes the following runtime Qt warning and incidentally fixes GCS crashes:
|
// this removes the following runtime Qt warning and incidentally fixes GCS crashes:
|
||||||
// QObject: Cannot create children for a parent that is in a different thread.
|
// QObject: Cannot create children for a parent that is in a different thread.
|
||||||
// (Parent is QSerialPort(0x56af73f8), parent's thread is QThread(0x23f69ae8), current thread is QThread(0x2649cfd8)
|
// (Parent is QSerialPort(0x56af73f8), parent's thread is QThread(0x23f69ae8), current thread is QThread(0x2649cfd8)
|
||||||
device->moveToThread(thread());
|
m_telemetryDevice->moveToThread(thread());
|
||||||
emit myStart();
|
emit myStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryManager::onStart()
|
void TelemetryManager::onStart()
|
||||||
{
|
{
|
||||||
utalk = new UAVTalk(device, objMngr);
|
m_uavTalk = new UAVTalk(m_telemetryDevice, m_uavobjectManager);
|
||||||
if (false) {
|
if (false) {
|
||||||
// UAVTalk must be thread safe and for that:
|
// UAVTalk must be thread safe and for that:
|
||||||
// 1- all public methods must lock a mutex
|
// 1- all public methods must lock a mutex
|
||||||
@ -73,25 +75,25 @@ void TelemetryManager::onStart()
|
|||||||
// It is assumed that the UAVObjectManager is thread safe
|
// It is assumed that the UAVObjectManager is thread safe
|
||||||
|
|
||||||
// Create the reader and move it to the reader thread
|
// Create the reader and move it to the reader thread
|
||||||
IODeviceReader *reader = new IODeviceReader(utalk);
|
IODeviceReader *reader = new IODeviceReader(m_uavTalk);
|
||||||
reader->moveToThread(&readerThread);
|
reader->moveToThread(&m_telemetryReaderThread);
|
||||||
// The reader will be deleted (later) when the thread finishes
|
// The reader will be deleted (later) when the thread finishes
|
||||||
connect(&readerThread, &QThread::finished, reader, &QObject::deleteLater);
|
connect(&m_telemetryReaderThread, &QThread::finished, reader, &QObject::deleteLater);
|
||||||
// Connect IO device to reader
|
// Connect IO device to reader
|
||||||
connect(device, SIGNAL(readyRead()), reader, SLOT(read()));
|
connect(m_telemetryDevice, SIGNAL(readyRead()), reader, SLOT(read()));
|
||||||
// start the reader thread
|
// start the reader thread
|
||||||
readerThread.start();
|
m_telemetryReaderThread.start();
|
||||||
} else {
|
} else {
|
||||||
// Connect IO device to reader
|
// Connect IO device to reader
|
||||||
connect(device, SIGNAL(readyRead()), utalk, SLOT(processInputStream()));
|
connect(m_telemetryDevice, SIGNAL(readyRead()), m_uavTalk, SLOT(processInputStream()));
|
||||||
}
|
}
|
||||||
|
|
||||||
telemetry = new Telemetry(utalk, objMngr);
|
m_telemetry = new Telemetry(m_uavTalk, m_uavobjectManager);
|
||||||
telemetryMon = new TelemetryMonitor(objMngr, telemetry);
|
m_telemetryMonitor = new TelemetryMonitor(m_uavobjectManager, m_telemetry);
|
||||||
|
|
||||||
connect(telemetryMon, SIGNAL(connected()), this, SLOT(onConnect()));
|
connect(m_telemetryMonitor, SIGNAL(connected()), this, SLOT(onConnect()));
|
||||||
connect(telemetryMon, SIGNAL(disconnected()), this, SLOT(onDisconnect()));
|
connect(m_telemetryMonitor, SIGNAL(disconnected()), this, SLOT(onDisconnect()));
|
||||||
connect(telemetryMon, SIGNAL(telemetryUpdated(double, double)), this, SLOT(onTelemetryUpdate(double, double)));
|
connect(m_telemetryMonitor, SIGNAL(telemetryUpdated(double, double)), this, SLOT(onTelemetryUpdate(double, double)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryManager::stop()
|
void TelemetryManager::stop()
|
||||||
@ -99,29 +101,29 @@ void TelemetryManager::stop()
|
|||||||
emit myStop();
|
emit myStop();
|
||||||
|
|
||||||
if (false) {
|
if (false) {
|
||||||
readerThread.quit();
|
m_telemetryReaderThread.quit();
|
||||||
readerThread.wait();
|
m_telemetryReaderThread.wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryManager::onStop()
|
void TelemetryManager::onStop()
|
||||||
{
|
{
|
||||||
telemetryMon->disconnect(this);
|
m_telemetryMonitor->disconnect(this);
|
||||||
delete telemetryMon;
|
delete m_telemetryMonitor;
|
||||||
delete telemetry;
|
delete m_telemetry;
|
||||||
delete utalk;
|
delete m_uavTalk;
|
||||||
onDisconnect();
|
onDisconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryManager::onConnect()
|
void TelemetryManager::onConnect()
|
||||||
{
|
{
|
||||||
autopilotConnected = true;
|
m_isAutopilotConnected = true;
|
||||||
emit connected();
|
emit connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryManager::onDisconnect()
|
void TelemetryManager::onDisconnect()
|
||||||
{
|
{
|
||||||
autopilotConnected = false;
|
m_isAutopilotConnected = false;
|
||||||
emit disconnected();
|
emit disconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,10 +132,10 @@ void TelemetryManager::onTelemetryUpdate(double txRate, double rxRate)
|
|||||||
emit telemetryUpdated(txRate, rxRate);
|
emit telemetryUpdated(txRate, rxRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
IODeviceReader::IODeviceReader(UAVTalk *uavTalk) : uavTalk(uavTalk)
|
IODeviceReader::IODeviceReader(UAVTalk *uavTalk) : m_uavTalk(uavTalk)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void IODeviceReader::read()
|
void IODeviceReader::read()
|
||||||
{
|
{
|
||||||
uavTalk->processInputStream();
|
m_uavTalk->processInputStream();
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,14 @@
|
|||||||
#define TELEMETRYMANAGER_H
|
#define TELEMETRYMANAGER_H
|
||||||
|
|
||||||
#include "uavtalk_global.h"
|
#include "uavtalk_global.h"
|
||||||
#include "telemetrymonitor.h"
|
|
||||||
#include "telemetry.h"
|
|
||||||
#include "uavtalk.h"
|
#include "uavtalk.h"
|
||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
class Telemetry;
|
||||||
|
class TelemetryMonitor;
|
||||||
|
|
||||||
class UAVTALK_EXPORT TelemetryManager : public QObject {
|
class UAVTALK_EXPORT TelemetryManager : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -62,13 +63,13 @@ private slots:
|
|||||||
void onStop();
|
void onStop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectManager *objMngr;
|
UAVObjectManager *m_uavobjectManager;
|
||||||
UAVTalk *utalk;
|
UAVTalk *m_uavTalk;
|
||||||
Telemetry *telemetry;
|
Telemetry *m_telemetry;
|
||||||
TelemetryMonitor *telemetryMon;
|
TelemetryMonitor *m_telemetryMonitor;
|
||||||
QIODevice *device;
|
QIODevice *m_telemetryDevice;
|
||||||
bool autopilotConnected;
|
bool m_isAutopilotConnected;
|
||||||
QThread readerThread;
|
QThread m_telemetryReaderThread;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ class IODeviceReader : public QObject {
|
|||||||
public:
|
public:
|
||||||
IODeviceReader(UAVTalk *uavTalk);
|
IODeviceReader(UAVTalk *uavTalk);
|
||||||
|
|
||||||
UAVTalk *uavTalk;
|
UAVTalk *m_uavTalk;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void read();
|
void read();
|
||||||
|
@ -48,9 +48,6 @@ bool UAVTalkPlugin::initialize(const QStringList & arguments, QString *errorStri
|
|||||||
// Done
|
// Done
|
||||||
Q_UNUSED(arguments);
|
Q_UNUSED(arguments);
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
// Get UAVObjectManager instance
|
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
objMngr = pm->getObject<UAVObjectManager>();
|
|
||||||
|
|
||||||
// Create TelemetryManager
|
// Create TelemetryManager
|
||||||
telMngr = new TelemetryManager();
|
telMngr = new TelemetryManager();
|
||||||
|
@ -30,11 +30,8 @@
|
|||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include "telemetrymonitor.h"
|
|
||||||
#include "telemetry.h"
|
|
||||||
#include "uavtalk.h"
|
#include "uavtalk.h"
|
||||||
#include "telemetrymanager.h"
|
#include "telemetrymanager.h"
|
||||||
#include "uavobjectmanager.h"
|
|
||||||
|
|
||||||
class UAVTALK_EXPORT UAVTalkPlugin : public ExtensionSystem::IPlugin {
|
class UAVTALK_EXPORT UAVTalkPlugin : public ExtensionSystem::IPlugin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -53,7 +50,6 @@ protected slots:
|
|||||||
void onDeviceDisconnect();
|
void onDeviceDisconnect();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UAVObjectManager *objMngr;
|
|
||||||
TelemetryManager *telMngr;
|
TelemetryManager *telMngr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
defaultvalue="Attitude,Attitude,AxisLock,Manual"
|
defaultvalue="Attitude,Attitude,AxisLock,Manual"
|
||||||
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl:Attitude:Rattitude:Acro+:WeakLeveling:VirtualBar; \
|
||||||
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
||||||
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
||||||
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
||||||
@ -22,7 +22,7 @@
|
|||||||
defaultvalue="Attitude,Attitude,Rate,Manual"
|
defaultvalue="Attitude,Attitude,Rate,Manual"
|
||||||
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl:Attitude:Rattitude:Acro+:WeakLeveling:VirtualBar; \
|
||||||
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
||||||
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
||||||
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
||||||
@ -33,7 +33,7 @@
|
|||||||
defaultvalue="Rate,Rate,Rate,Manual"
|
defaultvalue="Rate,Rate,Rate,Manual"
|
||||||
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl:Attitude:Rattitude:Acro+:WeakLeveling:VirtualBar; \
|
||||||
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
||||||
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
||||||
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
||||||
@ -44,7 +44,7 @@
|
|||||||
defaultvalue="Attitude,Attitude,AxisLock,CruiseControl"
|
defaultvalue="Attitude,Attitude,AxisLock,CruiseControl"
|
||||||
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl:Attitude:Rattitude:Acro+:WeakLeveling:VirtualBar; \
|
||||||
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
||||||
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
||||||
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
||||||
@ -55,7 +55,7 @@
|
|||||||
defaultvalue="Attitude,Attitude,Rate,CruiseControl"
|
defaultvalue="Attitude,Attitude,Rate,CruiseControl"
|
||||||
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl:Attitude:Rattitude:Acro+:WeakLeveling:VirtualBar; \
|
||||||
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
||||||
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
||||||
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
defaultvalue="Rate,Rate,Rate,CruiseControl"
|
defaultvalue="Rate,Rate,Rate,CruiseControl"
|
||||||
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
limits="%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
||||||
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl; \
|
%NE:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario:CruiseControl:Attitude:Rattitude:Acro+:WeakLeveling:VirtualBar; \
|
||||||
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
%NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude,\
|
||||||
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
%0401NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario,\
|
||||||
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
%0402NE:Rate:Attitude:AxisLock:WeakLeveling:VirtualBar:Acro+:Rattitude:RelayRate:RelayAttitude:AltitudeHold:AltitudeVario;"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<field name="MaxPDOP" units="" type="float" elements="1" defaultvalue="3.5"/>
|
<field name="MaxPDOP" units="" type="float" elements="1" defaultvalue="3.5"/>
|
||||||
<!-- Ubx self configuration. Enable to allow the flight board to auto configure ubx GPS options,
|
<!-- Ubx self configuration. Enable to allow the flight board to auto configure ubx GPS options,
|
||||||
store does AutoConfig and save GPS settings (i.e. to prevent issues if gps is power cycled) -->
|
store does AutoConfig and save GPS settings (i.e. to prevent issues if gps is power cycled) -->
|
||||||
<field name="UbxAutoConfig" units="" type="enum" elements="1" options="Disabled,Configure,ConfigureAndStore" defaultvalue="Disabled"/>
|
<field name="UbxAutoConfig" units="" type="enum" elements="1" options="Disabled,Configure,ConfigureAndStore" defaultvalue="Configure"/>
|
||||||
<!-- Ubx position update rate, -1 for auto -->
|
<!-- Ubx position update rate, -1 for auto -->
|
||||||
<field name="UbxRate" units="Hz" type="int8" elements="1" defaultvalue="5" />
|
<field name="UbxRate" units="Hz" type="int8" elements="1" defaultvalue="5" />
|
||||||
<!-- Ubx dynamic model, see UBX datasheet for more details -->
|
<!-- Ubx dynamic model, see UBX datasheet for more details -->
|
||||||
|
Loading…
Reference in New Issue
Block a user