2013-11-19 07:39:52 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file flightlogmanager.cpp
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
|
|
|
* @addtogroup [Group]
|
|
|
|
* @{
|
|
|
|
* @addtogroup FlightLogManager
|
|
|
|
* @{
|
|
|
|
* @brief [Brief]
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "flightlogmanager.h"
|
2013-11-20 12:24:34 +01:00
|
|
|
#include "extensionsystem/pluginmanager.h"
|
2013-11-19 07:39:52 +01:00
|
|
|
|
2013-11-20 12:24:34 +01:00
|
|
|
#include "debuglogcontrol.h"
|
2013-11-20 00:07:04 +01:00
|
|
|
|
|
|
|
FlightLogManager::FlightLogManager(QObject *parent) :
|
|
|
|
QObject(parent) {
|
|
|
|
|
2013-11-20 12:24:34 +01:00
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
m_objectManager = pm->getObject<UAVObjectManager>();
|
|
|
|
Q_ASSERT(m_objectManager);
|
|
|
|
|
|
|
|
m_flightLogStatus = DebugLogStatus::GetInstance(m_objectManager);
|
|
|
|
Q_ASSERT(m_flightLogStatus);
|
|
|
|
|
2013-11-20 16:24:57 +01:00
|
|
|
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);
|
|
|
|
|
2013-11-20 00:07:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FlightLogManager::~FlightLogManager() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-11-20 16:24:57 +01:00
|
|
|
void addEntries(QQmlListProperty<DebugLogEntry> *list, DebugLogEntry *entry) {
|
|
|
|
Q_UNUSED(list);
|
|
|
|
Q_UNUSED(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
int countEntries(QQmlListProperty<DebugLogEntry> *list) {
|
|
|
|
return static_cast< QList<DebugLogEntry *> *>(list->data)->size();
|
|
|
|
}
|
|
|
|
|
|
|
|
DebugLogEntry* entryAt(QQmlListProperty<DebugLogEntry> *list, int index) {
|
|
|
|
return static_cast< QList<DebugLogEntry *> *>(list->data)->at(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void clearEntries(QQmlListProperty<DebugLogEntry> *list) {
|
|
|
|
return static_cast< QList<DebugLogEntry *> *>(list->data)->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
QQmlListProperty<DebugLogEntry> FlightLogManager::logEntries() {
|
|
|
|
return QQmlListProperty<DebugLogEntry>(this, &m_logEntries, &addEntries, &countEntries, &entryAt, &clearEntries);
|
|
|
|
}
|
|
|
|
|
2013-11-20 00:07:04 +01:00
|
|
|
void FlightLogManager::clearAllLogs() {
|
|
|
|
|
2013-11-20 16:24:57 +01:00
|
|
|
//Clear on flight side
|
|
|
|
m_logEntries.clear();
|
2013-11-20 00:07:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void FlightLogManager::retrieveLogs(int flight) {
|
2013-11-20 16:24:57 +01:00
|
|
|
//Get logs from flight side
|
2013-11-20 00:07:04 +01:00
|
|
|
}
|