mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-1119 Downloading from firmware now works. Added columns for log data and some table formatting quirks.
This commit is contained in:
parent
0a085ce106
commit
00d710a324
@ -30,10 +30,43 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: logManager.logEntries
|
||||
TableViewColumn { role: "Flight"; title: "Flight"; width: 50; horizontalAlignment: Text.AlignRight}
|
||||
TableViewColumn { role: "FlightTime"; title: "Time";width: 50; horizontalAlignment: Text.AlignRight}
|
||||
TableViewColumn { role: "Entry"; title: "#"; width: 50; horizontalAlignment: Text.AlignRight}
|
||||
TableViewColumn { role: "Type"; title: "Contents"; width: 100}
|
||||
|
||||
itemDelegate: Text {
|
||||
anchors.margins: 3
|
||||
font.pixelSize: 12
|
||||
text: styleData.value
|
||||
}
|
||||
|
||||
TableViewColumn {
|
||||
role: "Flight"; title: qsTr("Flight"); width: 50;
|
||||
delegate:
|
||||
Text {
|
||||
anchors.margins: 3
|
||||
font.pixelSize: 12
|
||||
text: styleData.value + 1
|
||||
}
|
||||
|
||||
}
|
||||
TableViewColumn { role: "FlightTime"; title: qsTr("Time"); width: 50}
|
||||
TableViewColumn { role: "Entry"; title: qsTr("#"); width: 50}
|
||||
TableViewColumn {
|
||||
role: "Type"; title: "Type"; width: 100;
|
||||
delegate:
|
||||
Text {
|
||||
anchors.margins: 3
|
||||
font.pixelSize: 12
|
||||
text: {
|
||||
switch(styleData.value) {
|
||||
case 0 : text: qsTr("Empty"); break;
|
||||
case 1 : text: qsTr("Text"); break;
|
||||
case 2 : text: qsTr("UAVO"); break;
|
||||
default: text: qsTr("Unknown"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
TableViewColumn { role: "LogString"; title: qsTr("Data"); width: 280}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
@ -34,12 +34,12 @@
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
|
||||
#include "debuglogentry.h"
|
||||
#include "flightlogmanager.h"
|
||||
|
||||
FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager) :
|
||||
QDialog(parent)
|
||||
{
|
||||
qmlRegisterType<DebugLogEntry>("org.openpilot", 1, 0, "DebugLogEntry");
|
||||
qmlRegisterType<ExtendedDebugLogEntry>("org.openpilot", 1, 0, "DebugLogEntry");
|
||||
|
||||
setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
|
||||
setWindowTitle(tr("Manage flight side logs"));
|
||||
|
@ -46,58 +46,31 @@ FlightLogManager::FlightLogManager(QObject *parent) :
|
||||
|
||||
m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager);
|
||||
Q_ASSERT(m_flightLogEntry);
|
||||
|
||||
DebugLogEntry *entry = new DebugLogEntry();
|
||||
entry->setFlight(1);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(2);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(3);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(4);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(5);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(6);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(7);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(8);
|
||||
m_logEntries.append(entry);
|
||||
entry = new DebugLogEntry();
|
||||
entry->setFlight(9);
|
||||
m_logEntries.append(entry);
|
||||
|
||||
}
|
||||
|
||||
FlightLogManager::~FlightLogManager() {
|
||||
|
||||
}
|
||||
|
||||
void addEntries(QQmlListProperty<DebugLogEntry> *list, DebugLogEntry *entry) {
|
||||
void addEntries(QQmlListProperty<ExtendedDebugLogEntry> *list, ExtendedDebugLogEntry *entry) {
|
||||
Q_UNUSED(list);
|
||||
Q_UNUSED(entry);
|
||||
}
|
||||
|
||||
int countEntries(QQmlListProperty<DebugLogEntry> *list) {
|
||||
return static_cast< QList<DebugLogEntry *> *>(list->data)->size();
|
||||
int countEntries(QQmlListProperty<ExtendedDebugLogEntry> *list) {
|
||||
return static_cast< QList<ExtendedDebugLogEntry *> *>(list->data)->size();
|
||||
}
|
||||
|
||||
DebugLogEntry* entryAt(QQmlListProperty<DebugLogEntry> *list, int index) {
|
||||
return static_cast< QList<DebugLogEntry *> *>(list->data)->at(index);
|
||||
ExtendedDebugLogEntry* entryAt(QQmlListProperty<ExtendedDebugLogEntry> *list, int index) {
|
||||
return static_cast< QList<ExtendedDebugLogEntry *> *>(list->data)->at(index);
|
||||
}
|
||||
|
||||
void clearEntries(QQmlListProperty<DebugLogEntry> *list) {
|
||||
return static_cast< QList<DebugLogEntry *> *>(list->data)->clear();
|
||||
void clearEntries(QQmlListProperty<ExtendedDebugLogEntry> *list) {
|
||||
return static_cast< QList<ExtendedDebugLogEntry *> *>(list->data)->clear();
|
||||
}
|
||||
|
||||
QQmlListProperty<DebugLogEntry> FlightLogManager::logEntries() {
|
||||
return QQmlListProperty<DebugLogEntry>(this, &m_logEntries, &addEntries, &countEntries, &entryAt, &clearEntries);
|
||||
QQmlListProperty<ExtendedDebugLogEntry> FlightLogManager::logEntries() {
|
||||
return QQmlListProperty<ExtendedDebugLogEntry>(this, &m_logEntries, &addEntries, &countEntries, &entryAt, &clearEntries);
|
||||
}
|
||||
|
||||
void FlightLogManager::clearAllLogs() {
|
||||
@ -141,7 +114,10 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve) {
|
||||
m_flightLogEntry->getFlight() == flight && m_flightLogEntry->getEntry() == entry) {
|
||||
|
||||
//Ok, we retrieved the entry, and it was the correct one. clone it and add it to the list
|
||||
m_logEntries.append((DebugLogEntry*) m_flightLogEntry->clone(0));
|
||||
|
||||
ExtendedDebugLogEntry* logEntry = new ExtendedDebugLogEntry();
|
||||
logEntry->setData(m_flightLogEntry->getData());
|
||||
m_logEntries.append(logEntry);
|
||||
|
||||
// Increment to get next entry from flight side
|
||||
entry++;
|
||||
@ -159,9 +135,14 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
emit logEntriesChanged();
|
||||
}
|
||||
|
||||
void FlightLogManager::exportLogs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ExtendedDebugLogEntry::ExtendedDebugLogEntry() : DebugLogEntry()
|
||||
{
|
||||
}
|
||||
|
@ -38,23 +38,41 @@
|
||||
#include "debuglogstatus.h"
|
||||
#include "debuglogcontrol.h"
|
||||
|
||||
class FlightLogManager : public QObject {
|
||||
class ExtendedDebugLogEntry : public DebugLogEntry {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString LogString READ LogString)
|
||||
|
||||
public:
|
||||
explicit ExtendedDebugLogEntry();
|
||||
|
||||
QString LogString()
|
||||
{
|
||||
if(getType() == DebugLogEntry::TYPE_TEXT) {
|
||||
return QString((const char*)getData().Data);
|
||||
} else {
|
||||
return "Object";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class FlightLogManager : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus)
|
||||
Q_PROPERTY(QQmlListProperty<DebugLogEntry> logEntries READ logEntries CONSTANT)
|
||||
Q_PROPERTY(QQmlListProperty<ExtendedDebugLogEntry> logEntries READ logEntries NOTIFY logEntriesChanged)
|
||||
|
||||
public:
|
||||
explicit FlightLogManager(QObject *parent = 0);
|
||||
~FlightLogManager();
|
||||
|
||||
QQmlListProperty<DebugLogEntry> logEntries();
|
||||
QQmlListProperty<ExtendedDebugLogEntry> logEntries();
|
||||
|
||||
DebugLogStatus* flightLogStatus() const
|
||||
{
|
||||
return m_flightLogStatus;
|
||||
}
|
||||
|
||||
signals:
|
||||
signals:
|
||||
void logEntriesChanged();
|
||||
|
||||
public slots:
|
||||
void clearAllLogs();
|
||||
@ -66,9 +84,9 @@ private:
|
||||
DebugLogControl *m_flightLogControl;
|
||||
DebugLogStatus *m_flightLogStatus;
|
||||
DebugLogEntry *m_flightLogEntry;
|
||||
QList<DebugLogEntry *> m_logEntries;
|
||||
QList<ExtendedDebugLogEntry *> m_logEntries;
|
||||
|
||||
const int UAVTALK_TIMEOUT = 4000;
|
||||
static const int UAVTALK_TIMEOUT = 4000;
|
||||
|
||||
};
|
||||
|
||||
|
@ -244,6 +244,7 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *info)
|
||||
// Setup element names
|
||||
QString varElemName = info->fields[n]->name + "ElemNames";
|
||||
finit.append(QString(" QStringList %1;\n").arg(varElemName));
|
||||
|
||||
QStringList elemNames = info->fields[n]->elementNames;
|
||||
for (int m = 0; m < elemNames.length(); ++m) {
|
||||
finit.append(QString(" %1.append(\"%2\");\n")
|
||||
|
Loading…
x
Reference in New Issue
Block a user