mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1119 Code cleanup and more uncrustification
This commit is contained in:
parent
a11d98aa0d
commit
8054cd5296
@ -28,6 +28,8 @@
|
||||
#include "flightlogmanager.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "debuglogcontrol.h"
|
||||
#include "uavobjecthelper.h"
|
||||
|
||||
@ -94,6 +96,8 @@ void FlightLogManager::clearAllLogs()
|
||||
|
||||
void FlightLogManager::retrieveLogs(int flightToRetrieve)
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
UAVObjectUpdaterHelper updateHelper;
|
||||
UAVObjectRequestHelper requestHelper;
|
||||
|
||||
@ -104,7 +108,6 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
|
||||
emit logEntriesChanged();
|
||||
|
||||
// Set up what to retrieve
|
||||
bool timedOut = false;
|
||||
int startFlight = (flightToRetrieve == -1) ? 0 : flightToRetrieve;
|
||||
int endFlight = (flightToRetrieve == -1) ? m_flightLogStatus->getFlight() : flightToRetrieve;
|
||||
|
||||
@ -118,15 +121,9 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
|
||||
// Send request for loading flight entry on flight side and wait for ack/nack
|
||||
m_flightLogControl->setEntry(entry);
|
||||
|
||||
UAVObjectUpdaterHelper::Result result = updateHelper.doObjectAndWait(m_flightLogControl, UAVTALK_TIMEOUT);
|
||||
if (result == UAVObjectUpdaterHelper::SUCCESS) {
|
||||
result = requestHelper.doObjectAndWait(m_flightLogEntry, UAVTALK_TIMEOUT);
|
||||
if (result == UAVObjectUpdaterHelper::TIMEOUT) {
|
||||
timedOut = true;
|
||||
break;
|
||||
} else {
|
||||
if (!m_flightLogEntry->getType() == DebugLogEntry::TYPE_EMPTY &&
|
||||
m_flightLogEntry->getFlight() == flight && m_flightLogEntry->getEntry() == entry) {
|
||||
if (updateHelper.doObjectAndWait(m_flightLogControl, UAVTALK_TIMEOUT) == UAVObjectUpdaterHelper::SUCCESS &&
|
||||
requestHelper.doObjectAndWait(m_flightLogEntry, UAVTALK_TIMEOUT) == UAVObjectUpdaterHelper::SUCCESS) {
|
||||
if (m_flightLogEntry->getType() != DebugLogEntry::TYPE_EMPTY) {
|
||||
// Ok, we retrieved the entry, and it was the correct one. clone it and add it to the list
|
||||
ExtendedDebugLogEntry *logEntry = new ExtendedDebugLogEntry();
|
||||
logEntry->setObjectManager(m_objectManager);
|
||||
@ -137,19 +134,16 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
|
||||
entry++;
|
||||
} else {
|
||||
// We are done, not more entries on this flight
|
||||
break;
|
||||
}
|
||||
gotLast = true;
|
||||
}
|
||||
} else {
|
||||
// We failed for some reason
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (timedOut) {
|
||||
// We timed out, do something smart here to alert the user
|
||||
break;
|
||||
}
|
||||
}
|
||||
emit logEntriesChanged();
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void FlightLogManager::exportLogs()
|
||||
|
@ -30,8 +30,7 @@
|
||||
|
||||
AbstractUAVObjectHelper::AbstractUAVObjectHelper(QObject *parent) :
|
||||
QObject(parent), m_transactionResult(false), m_transactionCompleted(false)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
AbstractUAVObjectHelper::Result AbstractUAVObjectHelper::doObjectAndWait(UAVObject *object, int timeout)
|
||||
{
|
||||
@ -85,8 +84,7 @@ void AbstractUAVObjectHelper::transactionCompleted(UAVObject *object, bool succe
|
||||
}
|
||||
|
||||
UAVObjectUpdaterHelper::UAVObjectUpdaterHelper(QObject *parent) : AbstractUAVObjectHelper(parent)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void UAVObjectUpdaterHelper::doObjectAndWaitImpl()
|
||||
{
|
||||
@ -94,8 +92,7 @@ void UAVObjectUpdaterHelper::doObjectAndWaitImpl()
|
||||
}
|
||||
|
||||
UAVObjectRequestHelper::UAVObjectRequestHelper(QObject *parent) : AbstractUAVObjectHelper(parent)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void UAVObjectRequestHelper::doObjectAndWaitImpl()
|
||||
{
|
||||
|
@ -35,8 +35,7 @@
|
||||
|
||||
#include "uavobject.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT AbstractUAVObjectHelper : public QObject
|
||||
{
|
||||
class UAVOBJECTS_EXPORT AbstractUAVObjectHelper : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AbstractUAVObjectHelper(QObject *parent = 0);
|
||||
@ -58,8 +57,7 @@ private:
|
||||
bool m_transactionCompleted;
|
||||
};
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectUpdaterHelper : public AbstractUAVObjectHelper
|
||||
{
|
||||
class UAVOBJECTS_EXPORT UAVObjectUpdaterHelper : public AbstractUAVObjectHelper {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit UAVObjectUpdaterHelper(QObject *parent = 0);
|
||||
@ -68,8 +66,7 @@ protected:
|
||||
virtual void doObjectAndWaitImpl();
|
||||
};
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectRequestHelper : public AbstractUAVObjectHelper
|
||||
{
|
||||
class UAVOBJECTS_EXPORT UAVObjectRequestHelper : public AbstractUAVObjectHelper {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit UAVObjectRequestHelper(QObject *parent = 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user