mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T489, added "parsing" state for entity read states
This commit is contained in:
committed by
Mat Sutcliffe
parent
a908c03e93
commit
efb1ac46f2
@@ -198,6 +198,8 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
// parsing
|
||||
emit this->dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadParsing, 0);
|
||||
CAirportList airports;
|
||||
CAirportList inconsistent;
|
||||
if (res.isRestricted())
|
||||
@@ -255,7 +257,7 @@ namespace BlackCore
|
||||
{
|
||||
url.appendQuery(queryLatestTimestamp(newerThan));
|
||||
this->getFromNetworkAndLog(url, { this, &CAirportDataReader::parseAirportData });
|
||||
emit dataRead(CEntityFlags::AirportEntity, CEntityFlags::StartRead, 0);
|
||||
emit dataRead(CEntityFlags::AirportEntity, CEntityFlags::ReadStarted, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace BlackCore
|
||||
|
||||
if (entitiesTriggered != CEntityFlags::NoEntity)
|
||||
{
|
||||
emit this->dataRead(entitiesTriggered, CEntityFlags::StartRead, 0);
|
||||
emit this->dataRead(entitiesTriggered, CEntityFlags::ReadStarted, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,6 +269,7 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
emit this->dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadParsing, 0);
|
||||
CAircraftIcaoCodeList codes;
|
||||
CAircraftIcaoCodeList inconsistent;
|
||||
if (res.isRestricted())
|
||||
@@ -323,6 +324,7 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
emit this->dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadParsing, 0);
|
||||
CAirlineIcaoCodeList codes;
|
||||
CAirlineIcaoCodeList inconsistent;
|
||||
if (res.isRestricted())
|
||||
@@ -375,6 +377,7 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
emit this->dataRead(CEntityFlags::CountryEntity, CEntityFlags::ReadParsing, 0);
|
||||
CCountryList countries;
|
||||
if (res.isRestricted())
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace BlackCore
|
||||
if (!url.isEmpty())
|
||||
{
|
||||
this->getFromNetworkAndLog(url, { this, &CInfoDataReader::parseInfoObjectsData});
|
||||
emit this->dataRead(this->getEntityForMode(), CEntityFlags::StartRead, 0);
|
||||
emit this->dataRead(this->getEntityForMode(), CEntityFlags::ReadStarted, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace BlackCore
|
||||
|
||||
if (triggeredRead != CEntityFlags::NoEntity)
|
||||
{
|
||||
emit dataRead(triggeredRead, CEntityFlags::StartRead, 0);
|
||||
emit dataRead(triggeredRead, CEntityFlags::ReadStarted, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,6 +288,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// get all or incremental set of distributor
|
||||
emit this->dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadParsing, 0);
|
||||
CLiveryList liveries;
|
||||
if (res.isRestricted())
|
||||
{
|
||||
@@ -335,6 +336,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// get all or incremental set of distributors
|
||||
emit this->dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadParsing, 0);
|
||||
CDistributorList distributors;
|
||||
if (res.isRestricted())
|
||||
{
|
||||
@@ -383,6 +385,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// get all or incremental set of models
|
||||
emit this->dataRead(CEntityFlags::ModelEntity, CEntityFlags::ReadParsing, 0);
|
||||
CAircraftModelList models;
|
||||
if (res.isRestricted())
|
||||
{
|
||||
|
||||
@@ -1300,7 +1300,7 @@ namespace BlackCore
|
||||
{
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::webservice()}));
|
||||
|
||||
if (state == CEntityFlags::StartRead) { return; } // just started
|
||||
if (state == CEntityFlags::ReadStarted) { return; } // just started
|
||||
if (CEntityFlags::isWarningOrAbove(state))
|
||||
{
|
||||
const CStatusMessage::StatusSeverity severity = CEntityFlags::flagToSeverity(state);
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace BlackGui
|
||||
void CDbLoadDataDialog::onDataRead(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)
|
||||
{
|
||||
if (m_pendingEntities == CEntityFlags::NoEntity) { return; } // no triggered from here
|
||||
if (state == CEntityFlags::StartRead) { return; }
|
||||
if (state == CEntityFlags::ReadStarted) { return; }
|
||||
if (!m_pendingEntities.testFlag(CEntityFlags::entityToEntityFlag(entity))) { return; }
|
||||
|
||||
m_pendingEntities &= ~entity;
|
||||
|
||||
@@ -135,7 +135,8 @@ namespace BlackGui
|
||||
led->setOn(false);
|
||||
led->blink(resetTimeMs); // blink here (temp. "on"), since read from cache results in immediate ReadFinished
|
||||
break;
|
||||
case CEntityFlags::StartRead:
|
||||
case CEntityFlags::ReadStarted:
|
||||
case CEntityFlags::ReadParsing:
|
||||
led->setOn(true);
|
||||
break;
|
||||
case CEntityFlags::ReadFailed:
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace BlackMisc
|
||||
return state == ReadFinished || state == ReadFinishedRestricted;
|
||||
}
|
||||
|
||||
int CEntityFlags::numberOfEntities(BlackMisc::Network::CEntityFlags::Entity entities)
|
||||
int CEntityFlags::numberOfEntities(CEntityFlags::Entity entities)
|
||||
{
|
||||
const int c = static_cast<int>(std::bitset<(sizeof(entities) * 8)>(entities).count());
|
||||
return c;
|
||||
@@ -95,9 +95,10 @@ namespace BlackMisc
|
||||
{
|
||||
case ReadFinished: return "finished";
|
||||
case ReadFinishedRestricted: return "finished (restricted)";
|
||||
case ReadParsing: return "parsing";
|
||||
case ReadFailed: return "failed";
|
||||
case ReadSkipped: return "skipped";
|
||||
case StartRead: return "read started";
|
||||
case ReadStarted: return "read started";
|
||||
default:
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "wrong flags");
|
||||
return "wrong flags";
|
||||
@@ -110,7 +111,8 @@ namespace BlackMisc
|
||||
{
|
||||
case ReadFinished:
|
||||
case ReadFinishedRestricted:
|
||||
case StartRead: return CStatusMessage::SeverityInfo;
|
||||
case ReadParsing:
|
||||
case ReadStarted: return CStatusMessage::SeverityInfo;
|
||||
case ReadSkipped: return CStatusMessage::SeverityWarning;
|
||||
case ReadFailed: return CStatusMessage::SeverityError;
|
||||
default:
|
||||
|
||||
@@ -63,7 +63,8 @@ namespace BlackMisc
|
||||
//! State of operation
|
||||
enum ReadState
|
||||
{
|
||||
StartRead, //!< reading has been started
|
||||
ReadStarted, //!< reading has been started
|
||||
ReadParsing, //!< parsing data
|
||||
ReadFinished, //!< reading done
|
||||
ReadFinishedRestricted, //!< finished a timestamp restricted read
|
||||
ReadFailed, //!< reading failed
|
||||
|
||||
Reference in New Issue
Block a user