mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #712, signals when all DB data are read / the web services are started
(useful for GUI as it can be used to init only when data are available)
This commit is contained in:
@@ -561,6 +561,8 @@ namespace BlackCore
|
||||
new CWebDataServices(this->m_webReadersUsed, this->m_dbReaderConfig, {}, this)
|
||||
);
|
||||
}
|
||||
|
||||
emit webDataServicesStarted(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -322,13 +322,14 @@ namespace BlackCore
|
||||
void updateInfoAvailable(bool success);
|
||||
|
||||
//! Startup has been completed
|
||||
//! \remark needs to be triggered by application when it think it is done
|
||||
void startUpCompleted(bool success);
|
||||
|
||||
//! Facade started
|
||||
void coreFacadeStarted();
|
||||
|
||||
//! Web data services started
|
||||
void webDataServicesStarted();
|
||||
void webDataServicesStarted(bool success);
|
||||
|
||||
protected slots:
|
||||
//! Setup read/syncronized
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackCore
|
||||
{
|
||||
QJsonArray m_jsonArray; //!< JSON array data
|
||||
QDateTime m_updated; //!< when was the latest updated?
|
||||
int m_arraySize = -1; //!< size of array, if applicable (copied to member for debugging purposes)
|
||||
int m_arraySize = -1; //!< size of array, if applicable (copied to member for debugging purposes)
|
||||
bool m_restricted = false; //!< restricted reponse, only changed data
|
||||
BlackMisc::CStatusMessage m_message; //!< last error or warning
|
||||
|
||||
|
||||
@@ -668,9 +668,11 @@ namespace BlackCore
|
||||
void CWebDataServices::ps_readFromSwiftDb(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)
|
||||
{
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::webservice()}));
|
||||
|
||||
if (state == CEntityFlags::StartRead) { return; } // just started
|
||||
if (CEntityFlags::isWarningOrAbove(state))
|
||||
{
|
||||
CStatusMessage::StatusSeverity severity = CEntityFlags::flagToSeverity(state);
|
||||
const CStatusMessage::StatusSeverity severity = CEntityFlags::flagToSeverity(state);
|
||||
if (severity == CStatusMessage::SeverityWarning)
|
||||
{
|
||||
CLogMessage(cats).warning("Read data %1 entries: %2 state: %3") << CEntityFlags::flagToString(entity) << number << CEntityFlags::flagToString(state);
|
||||
@@ -684,6 +686,12 @@ namespace BlackCore
|
||||
{
|
||||
CLogMessage(cats).info("Read data %1 entries: %2 state: %3") << CEntityFlags::flagToString(entity) << number << CEntityFlags::flagToString(state);
|
||||
}
|
||||
|
||||
this->m_swiftDbEntitiesReaad |= entity;
|
||||
if (this->m_swiftDbEntitiesReaad == CEntityFlags::AllDbEntitiesNoInfoObjects || this->m_swiftDbEntitiesReaad == CEntityFlags::AllDbEntities)
|
||||
{
|
||||
emit allSwiftDbDataRead();
|
||||
}
|
||||
}
|
||||
|
||||
void CWebDataServices::ps_setupChanged()
|
||||
|
||||
@@ -320,6 +320,9 @@ namespace BlackCore
|
||||
//! Combined read signal
|
||||
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||
|
||||
//! All swift DB data have been read
|
||||
void allSwiftDbDataRead();
|
||||
|
||||
public slots:
|
||||
//! Call CWebDataServices::readInBackground by single shot
|
||||
void readDeferredInBackground(BlackMisc::Network::CEntityFlags::Entity entities, int delayMs);
|
||||
@@ -356,6 +359,7 @@ namespace BlackCore
|
||||
CWebReaderFlags::WebReader m_readers = CWebReaderFlags::WebReaderFlag::None; //!< which readers are available
|
||||
BlackCore::Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< how to read DB data
|
||||
BlackMisc::Network::CEntityFlags::Entity m_entitiesPeriodicallyRead = BlackMisc::Network::CEntityFlags::NoEntity; //!< those entities which are permanently updated by timers
|
||||
BlackMisc::Network::CEntityFlags::Entity m_swiftDbEntitiesReaad = BlackMisc::Network::CEntityFlags::NoEntity; //!< entities read
|
||||
bool m_initialRead = false; //!< Initial read started
|
||||
int m_infoObjectTrials = 0; //!< Tried to read info objects
|
||||
|
||||
|
||||
@@ -45,10 +45,11 @@ namespace BlackMisc
|
||||
VatsimDataFile = 1 << 9, //!< the VATSIM data file (multiple data entities)
|
||||
VatsimStatusFile = 1 << 10, //!< the VATSIM status file (URLs for data files etc.)
|
||||
AllEntities = ((1 << 11) - 1), //!< everything
|
||||
AllIcaoEntities = AircraftIcaoEntity | AirlineIcaoEntity, //!< all ICAO codes
|
||||
AllIcaoAndCountries = AircraftIcaoEntity | AirlineIcaoEntity | CountryEntity, //!< all ICAO codes and countries
|
||||
DistributorLiveryModel = DistributorEntity | LiveryEntity | ModelEntity, //!< Combinded
|
||||
AllDbEntities = AllIcaoEntities | DistributorLiveryModel | InfoObjectEntity //!< All DB stuff
|
||||
AllIcaoEntities = AircraftIcaoEntity | AirlineIcaoEntity, //!< all ICAO codes
|
||||
AllIcaoAndCountries = AircraftIcaoEntity | AirlineIcaoEntity | CountryEntity, //!< all ICAO codes and countries
|
||||
DistributorLiveryModel = DistributorEntity | LiveryEntity | ModelEntity, //!< Combinded
|
||||
AllDbEntities = AllIcaoAndCountries | DistributorLiveryModel | InfoObjectEntity, //!< All DB stuff
|
||||
AllDbEntitiesNoInfoObjects = AllIcaoAndCountries | DistributorLiveryModel //!< All DB entities, no info objects
|
||||
};
|
||||
Q_DECLARE_FLAGS(Entity, EntityFlag)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user