mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
Ref T554, check function for auto publishing
This commit is contained in:
@@ -513,5 +513,23 @@ namespace BlackCore
|
|||||||
textPartDebug.setBody(QString("ECLIPSE_DBGP").toUtf8());
|
textPartDebug.setBody(QString("ECLIPSE_DBGP").toUtf8());
|
||||||
return textPartDebug;
|
return textPartDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChangedAutoPublishData CDatabaseUtils::autoPublishDataChanged(const QString &modelString, const PhysicalQuantities::CLength &cg, const CSimulatorInfo &simulator)
|
||||||
|
{
|
||||||
|
ChangedAutoPublishData changed;
|
||||||
|
if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return changed; }
|
||||||
|
const CAircraftModel model = sApp->getWebDataServices()->getModelForModelString(modelString);
|
||||||
|
return CDatabaseUtils::autoPublishDataChanged(model, cg, simulator);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChangedAutoPublishData CDatabaseUtils::autoPublishDataChanged(const CAircraftModel &model, const PhysicalQuantities::CLength &cg, const CSimulatorInfo &simulator)
|
||||||
|
{
|
||||||
|
ChangedAutoPublishData changed;
|
||||||
|
changed.modelKnown = model.hasValidDbKey();
|
||||||
|
if (!changed.modelKnown) { return changed; }
|
||||||
|
changed.changedCG = !(cg == model.getCG());
|
||||||
|
changed.changedSim = !(model.getSimulator().matchesAll(simulator));
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -11,9 +11,11 @@
|
|||||||
#ifndef BLACKCORE_DB_DATABASEUTILS_H
|
#ifndef BLACKCORE_DB_DATABASEUTILS_H
|
||||||
#define BLACKCORE_DB_DATABASEUTILS_H
|
#define BLACKCORE_DB_DATABASEUTILS_H
|
||||||
|
|
||||||
#include "blackcore/blackcoreexport.h"
|
|
||||||
#include "blackcore/progress.h"
|
#include "blackcore/progress.h"
|
||||||
|
#include "blackcore/blackcoreexport.h"
|
||||||
#include "blackmisc/simulation/aircraftmodel.h"
|
#include "blackmisc/simulation/aircraftmodel.h"
|
||||||
|
#include "blackmisc/simulation/autopublishdata.h"
|
||||||
|
|
||||||
#include <QHttpPart>
|
#include <QHttpPart>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
@@ -108,6 +110,14 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Multipart with DEBUG FLAG for server
|
//! Multipart with DEBUG FLAG for server
|
||||||
static QHttpPart getMultipartWithDebugFlag();
|
static QHttpPart getMultipartWithDebugFlag();
|
||||||
|
|
||||||
|
//! Which auto-publish data did change?
|
||||||
|
//! \sa CAutoPublishData::analyzeAgainstDBData
|
||||||
|
static BlackMisc::Simulation::ChangedAutoPublishData autoPublishDataChanged(const QString &modelString, const BlackMisc::PhysicalQuantities::CLength &cg, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
|
//! Which auto-publish data did change?
|
||||||
|
//! \sa CAutoPublishData::analyzeAgainstDBData
|
||||||
|
static BlackMisc::Simulation::ChangedAutoPublishData autoPublishDataChanged(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::PhysicalQuantities::CLength &cg, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -42,6 +42,22 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Which data have changed
|
||||||
|
struct ChangedAutoPublishData
|
||||||
|
{
|
||||||
|
bool modelKnown = false; //!< model known in DB
|
||||||
|
bool changedCG = false; //!< CG changed
|
||||||
|
bool changedSim = false; //!< simulator changed
|
||||||
|
|
||||||
|
//! Set all to true;
|
||||||
|
void setAllTrue()
|
||||||
|
{
|
||||||
|
modelKnown = true;
|
||||||
|
changedCG = true;
|
||||||
|
changedSim = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//! Objects that can be use for auto-publishing.
|
//! Objects that can be use for auto-publishing.
|
||||||
//! Auto publishing means we sent those data to the DB.
|
//! Auto publishing means we sent those data to the DB.
|
||||||
class BLACKMISC_EXPORT CAutoPublishData
|
class BLACKMISC_EXPORT CAutoPublishData
|
||||||
|
|||||||
Reference in New Issue
Block a user