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