1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

OP-1119 Some glue code between qml and c++

This commit is contained in:
Fredrik Arvidsson 2013-11-20 00:07:04 +01:00
parent f05e7c87aa
commit 1b33f48048
4 changed files with 111 additions and 7 deletions

View File

@ -1,8 +1,11 @@
TEMPLATE = lib
TARGET = FlightLog
QT += qml quick
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/uavobjects/uavobjects.pri)
HEADERS += flightlogplugin.h \
flightlogmanager.h

View File

@ -27,13 +27,30 @@
#include "flightlogmanager.h"
FlightLogManager::FlightLogManager(QObject *parent) :
FlightLogEntry::FlightLogEntry(QObject *parent) :
QObject(parent)
{
}
FlightLogManager::~FlightLogManager()
FlightLogEntry::~FlightLogEntry()
{
}
FlightLogManager::FlightLogManager(QObject *parent) :
QObject(parent) {
}
FlightLogManager::~FlightLogManager() {
}
void FlightLogManager::clearAllLogs() {
}
void FlightLogManager::retrieveLogs(int flight) {
}

View File

@ -29,18 +29,101 @@
#define FLIGHTLOGMANAGER_H
#include <QObject>
#include <QtDeclarative/QDeclarativeListProperty>
class FlightLogEntry : public QObject {
Q_OBJECT Q_PROPERTY(int flightTime READ getFlightTime NOTIFY FlightTimeChanged)
Q_PROPERTY(int flight READ getFlight NOTIFY FlightChanged)
Q_PROPERTY(int entry READ getEntry NOTIFY EntryChanged)
Q_PROPERTY(int type READ getType NOTIFY TypeChanged)
int m_flightTime;
int m_flight;
int m_entry;
int m_type;
public:
explicit FlightLogEntry(QObject *parent = 0);
~FlightLogEntry();
int getFlightTime() const
{
return m_flightTime;
}
int getFlight() const
{
return m_flight;
}
int getEntry() const
{
return m_entry;
}
int getType() const
{
return m_type;
}
signals:
void FlightTimeChanged(int arg);
void FlightChanged(int arg);
void EntryChanged(int arg);
void TypeChanged(int arg);
};
class FlightLogManager : public QObject {
Q_OBJECT Q_PROPERTY(int flightsRecorded READ flightsRecorded NOTIFY flightsRecordedChanged)
Q_PROPERTY(int logsRecordedLastFlight READ logsRecordedLastFlight NOTIFY logsRecordedLastFlightChanged)
Q_PROPERTY(int totalLogsRecorded READ totalLogsRecorded NOTIFY totalLogsRecordedChanged)
Q_PROPERTY(int freeLogEntries READ freeLogEntries NOTIFY freeLogEntriesChanged)
Q_PROPERTY(QDeclarativeListProperty<FlightLogEntry *> records READ records)
int m_flightsRecorded;
int m_logsRecordedLastFlight;
int m_totalLogsRecorded;
int m_freeLogEntries;
QDeclarativeListProperty<FlightLogEntry *> m_records;
class FlightLogManager : public QObject
{
Q_OBJECT
public:
explicit FlightLogManager(QObject *parent = 0);
~FlightLogManager();
int flightsRecorded() const
{
return m_flightsRecorded;
}
int logsRecordedLastFlight() const
{
return m_logsRecordedLastFlight;
}
int totalLogsRecorded() const
{
return m_totalLogsRecorded;
}
int freeLogEntries() const
{
return m_freeLogEntries;
}
QDeclarativeListProperty<FlightLogEntry *> records() const
{
return m_records;
}
signals:
void flightsRecordedChanged(int arg);
void logsRecordedLastFlightChanged(int arg);
void totalLogsRecordedChanged(int arg);
void freeLogEntriesChanged(int arg);
public slots:
void clearAllLogs();
void retrieveLogs(int flight = -1);
};
#endif // FLIGHTLOGMANAGER_H

View File

@ -241,5 +241,6 @@ SUBDIRS += plugin_setupwizard
# Flight Logs plugin
plugin_flightlog.subdir = flightlog
plugin_flightlog.depends = plugin_coreplugin
plugin_flightlog.depends += plugin_uavobjects
SUBDIRS += plugin_flightlog