mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 04:35:41 +08:00
refs #469, renamed flags
* db to entity flags as it also features entities not from DB * Flag enums singular (discussed with MS / slack)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
24432a56c7
commit
2cfd3540b8
@@ -20,7 +20,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
||||||
id = qRegisterMetaType<BlackCore::INetwork::ConnectionStatus>();
|
id = qRegisterMetaType<BlackCore::INetwork::ConnectionStatus>();
|
||||||
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
||||||
id = qRegisterMetaType<BlackCore::CWebReaderFlags::WebReaderFlags>();
|
id = qRegisterMetaType<BlackCore::CWebReaderFlags::WebReaderFlag>();
|
||||||
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
||||||
id = qRegisterMetaType<BlackCore::CWebReaderFlags::WebReader>();
|
id = qRegisterMetaType<BlackCore::CWebReaderFlags::WebReader>();
|
||||||
Q_UNUSED(id);
|
Q_UNUSED(id);
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ namespace BlackCore
|
|||||||
BlackMisc::CThreadedReader(owner, name)
|
BlackMisc::CThreadedReader(owner, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void CDatabaseReader::readInBackgroundThread(CDbFlags::Entity entities)
|
void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities)
|
||||||
{
|
{
|
||||||
if (m_shutdown) { return; }
|
if (m_shutdown) { return; }
|
||||||
bool s = QMetaObject::invokeMethod(this, "ps_read", Q_ARG(BlackMisc::Network::CDbFlags::Entity, entities));
|
bool s = QMetaObject::invokeMethod(this, "ps_read", Q_ARG(BlackMisc::Network::CEntityFlags::Entity, entities));
|
||||||
Q_ASSERT_X(s, Q_FUNC_INFO, "Invoke failed");
|
Q_ASSERT_X(s, Q_FUNC_INFO, "Invoke failed");
|
||||||
Q_UNUSED(s);
|
Q_UNUSED(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "blackcore/blackcoreexport.h"
|
#include "blackcore/blackcoreexport.h"
|
||||||
#include "blackmisc/threadedreader.h"
|
#include "blackmisc/threadedreader.h"
|
||||||
#include "blackmisc/network/dbflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
@@ -54,7 +54,7 @@ namespace BlackCore
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Start reading in own thread
|
//! Start reading in own thread
|
||||||
void readInBackgroundThread(BlackMisc::Network::CDbFlags::Entity entities);
|
void readInBackgroundThread(BlackMisc::Network::CEntityFlags::Entity entities);
|
||||||
|
|
||||||
//! Can connect to DB
|
//! Can connect to DB
|
||||||
bool canConnect() const;
|
bool canConnect() const;
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ namespace BlackCore
|
|||||||
return m_countries.size();
|
return m_countries.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIcaoDataReader::ps_read(BlackMisc::Network::CDbFlags::Entity entities)
|
void CIcaoDataReader::ps_read(BlackMisc::Network::CEntityFlags::Entity entities)
|
||||||
{
|
{
|
||||||
this->threadAssertCheck();
|
this->threadAssertCheck();
|
||||||
Q_ASSERT(this->m_networkManagerAircraft);
|
Q_ASSERT(this->m_networkManagerAircraft);
|
||||||
@@ -167,29 +167,29 @@ namespace BlackCore
|
|||||||
Q_ASSERT(!m_urlAirlineIcao.isEmpty());
|
Q_ASSERT(!m_urlAirlineIcao.isEmpty());
|
||||||
Q_ASSERT(!m_urlCountry.isEmpty());
|
Q_ASSERT(!m_urlCountry.isEmpty());
|
||||||
|
|
||||||
CDbFlags::Entity entitiesTriggered = CDbFlags::NoEntity;
|
CEntityFlags::Entity entitiesTriggered = CEntityFlags::NoEntity;
|
||||||
if (entities.testFlag(CDbFlags::AircraftIcaoEntity))
|
if (entities.testFlag(CEntityFlags::AircraftIcaoEntity))
|
||||||
{
|
{
|
||||||
QNetworkRequest requestAircraft(m_urlAircraftIcao);
|
QNetworkRequest requestAircraft(m_urlAircraftIcao);
|
||||||
this->m_networkManagerAircraft->get(requestAircraft);
|
this->m_networkManagerAircraft->get(requestAircraft);
|
||||||
entitiesTriggered |= CDbFlags::AircraftIcaoEntity;
|
entitiesTriggered |= CEntityFlags::AircraftIcaoEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entities.testFlag(CDbFlags::AirlineIcaoEntity))
|
if (entities.testFlag(CEntityFlags::AirlineIcaoEntity))
|
||||||
{
|
{
|
||||||
QNetworkRequest requestAirline(m_urlAirlineIcao);
|
QNetworkRequest requestAirline(m_urlAirlineIcao);
|
||||||
this->m_networkManagerAirlines->get(requestAirline);
|
this->m_networkManagerAirlines->get(requestAirline);
|
||||||
entitiesTriggered |= CDbFlags::AirlineIcaoEntity;
|
entitiesTriggered |= CEntityFlags::AirlineIcaoEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entities.testFlag(CDbFlags::CountryEntity))
|
if (entities.testFlag(CEntityFlags::CountryEntity))
|
||||||
{
|
{
|
||||||
QNetworkRequest requestCountry(m_urlCountry);
|
QNetworkRequest requestCountry(m_urlCountry);
|
||||||
this->m_networkManagerCountries->get(requestCountry);
|
this->m_networkManagerCountries->get(requestCountry);
|
||||||
entitiesTriggered |= CDbFlags::CountryEntity;
|
entitiesTriggered |= CEntityFlags::CountryEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit readData(entitiesTriggered, CDbFlags::StartRead, 0);
|
emit dataRead(entitiesTriggered, CEntityFlags::StartRead, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIcaoDataReader::ps_parseAircraftIcaoData(QNetworkReply *nwReplyPtr)
|
void CIcaoDataReader::ps_parseAircraftIcaoData(QNetworkReply *nwReplyPtr)
|
||||||
@@ -200,7 +200,7 @@ namespace BlackCore
|
|||||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||||
if (array.isEmpty())
|
if (array.isEmpty())
|
||||||
{
|
{
|
||||||
emit readData(CDbFlags::AircraftIcaoEntity, CDbFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CAircraftIcaoCodeList codes = CAircraftIcaoCodeList::fromDatabaseJson(array);
|
CAircraftIcaoCodeList codes = CAircraftIcaoCodeList::fromDatabaseJson(array);
|
||||||
@@ -212,7 +212,7 @@ namespace BlackCore
|
|||||||
this->m_aircraftIcaos = codes;
|
this->m_aircraftIcaos = codes;
|
||||||
n = codes.size();
|
n = codes.size();
|
||||||
}
|
}
|
||||||
emit readData(CDbFlags::AircraftIcaoEntity, CDbFlags::ReadFinished, n);
|
emit dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIcaoDataReader::ps_parseAirlineIcaoData(QNetworkReply *nwReplyPtr)
|
void CIcaoDataReader::ps_parseAirlineIcaoData(QNetworkReply *nwReplyPtr)
|
||||||
@@ -221,7 +221,7 @@ namespace BlackCore
|
|||||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||||
if (array.isEmpty())
|
if (array.isEmpty())
|
||||||
{
|
{
|
||||||
emit readData(CDbFlags::AirlineIcaoEntity, CDbFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CAirlineIcaoCodeList codes = CAirlineIcaoCodeList::fromDatabaseJson(array);
|
CAirlineIcaoCodeList codes = CAirlineIcaoCodeList::fromDatabaseJson(array);
|
||||||
@@ -233,7 +233,7 @@ namespace BlackCore
|
|||||||
this->m_airlineIcaos = codes;
|
this->m_airlineIcaos = codes;
|
||||||
n = codes.size();
|
n = codes.size();
|
||||||
}
|
}
|
||||||
emit readData(CDbFlags::AirlineIcaoEntity, CDbFlags::ReadFinished, n);
|
emit dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIcaoDataReader::ps_parseCountryData(QNetworkReply *nwReplyPtr)
|
void CIcaoDataReader::ps_parseCountryData(QNetworkReply *nwReplyPtr)
|
||||||
@@ -242,7 +242,7 @@ namespace BlackCore
|
|||||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||||
if (array.isEmpty())
|
if (array.isEmpty())
|
||||||
{
|
{
|
||||||
emit readData(CDbFlags::CountryEntity, CDbFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CCountryList countries = CCountryList::fromDatabaseJson(array);
|
CCountryList countries = CCountryList::fromDatabaseJson(array);
|
||||||
@@ -254,7 +254,7 @@ namespace BlackCore
|
|||||||
this->m_countries = countries;
|
this->m_countries = countries;
|
||||||
n = m_countries.size();
|
n = m_countries.size();
|
||||||
}
|
}
|
||||||
emit readData(CDbFlags::CountryEntity, CDbFlags::ReadFinished, n);
|
emit dataRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIcaoDataReader::canConnect(QString &message) const
|
bool CIcaoDataReader::canConnect(QString &message) const
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "blackmisc/countrylist.h"
|
#include "blackmisc/countrylist.h"
|
||||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||||
#include "blackmisc/network/dbflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@@ -103,7 +103,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Combined read signal
|
//! Combined read signal
|
||||||
void readData(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState state, int number);
|
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Aircraft have been read
|
//! Aircraft have been read
|
||||||
@@ -116,7 +116,7 @@ namespace BlackCore
|
|||||||
void ps_parseCountryData(QNetworkReply *nwReply);
|
void ps_parseCountryData(QNetworkReply *nwReply);
|
||||||
|
|
||||||
//! Read / re-read data file
|
//! Read / re-read data file
|
||||||
void ps_read(BlackMisc::Network::CDbFlags::Entity entities);
|
void ps_read(BlackMisc::Network::CEntityFlags::Entity entities);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QNetworkAccessManager *m_networkManagerAircraft = nullptr;
|
QNetworkAccessManager *m_networkManagerAircraft = nullptr;
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace BlackCore
|
|||||||
return cm;
|
return cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelDataReader::ps_read(CDbFlags::Entity entity)
|
void CModelDataReader::ps_read(CEntityFlags::Entity entity)
|
||||||
{
|
{
|
||||||
this->threadAssertCheck();
|
this->threadAssertCheck();
|
||||||
Q_ASSERT(this->m_networkManagerLivery);
|
Q_ASSERT(this->m_networkManagerLivery);
|
||||||
@@ -171,29 +171,29 @@ namespace BlackCore
|
|||||||
Q_ASSERT(!m_urlLiveries.isEmpty());
|
Q_ASSERT(!m_urlLiveries.isEmpty());
|
||||||
Q_ASSERT(!m_urlDistributors.isEmpty());
|
Q_ASSERT(!m_urlDistributors.isEmpty());
|
||||||
|
|
||||||
CDbFlags::Entity triggeredRead = CDbFlags::NoEntity;
|
CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity;
|
||||||
if (entity.testFlag(CDbFlags::LiveryEntity))
|
if (entity.testFlag(CEntityFlags::LiveryEntity))
|
||||||
{
|
{
|
||||||
QNetworkRequest requestLivery(m_urlLiveries);
|
QNetworkRequest requestLivery(m_urlLiveries);
|
||||||
this->m_networkManagerLivery->get(requestLivery);
|
this->m_networkManagerLivery->get(requestLivery);
|
||||||
triggeredRead |= CDbFlags::LiveryEntity;
|
triggeredRead |= CEntityFlags::LiveryEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.testFlag(CDbFlags::DistributorEntity))
|
if (entity.testFlag(CEntityFlags::DistributorEntity))
|
||||||
{
|
{
|
||||||
QNetworkRequest requestDistributor(m_urlDistributors);
|
QNetworkRequest requestDistributor(m_urlDistributors);
|
||||||
this->m_networkManagerDistributor->get(requestDistributor);
|
this->m_networkManagerDistributor->get(requestDistributor);
|
||||||
triggeredRead |= CDbFlags::DistributorEntity;
|
triggeredRead |= CEntityFlags::DistributorEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.testFlag(CDbFlags::ModelEntity))
|
if (entity.testFlag(CEntityFlags::ModelEntity))
|
||||||
{
|
{
|
||||||
QNetworkRequest requestModel(m_urlModels);
|
QNetworkRequest requestModel(m_urlModels);
|
||||||
this->m_networkManagerModel->get(requestModel);
|
this->m_networkManagerModel->get(requestModel);
|
||||||
triggeredRead |= CDbFlags::ModelEntity;
|
triggeredRead |= CEntityFlags::ModelEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit readData(triggeredRead, CDbFlags::StartRead, 0);
|
emit dataRead(triggeredRead, CEntityFlags::StartRead, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelDataReader::ps_parseLiveryData(QNetworkReply *nwReplyPtr)
|
void CModelDataReader::ps_parseLiveryData(QNetworkReply *nwReplyPtr)
|
||||||
@@ -204,7 +204,7 @@ namespace BlackCore
|
|||||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||||
if (array.isEmpty())
|
if (array.isEmpty())
|
||||||
{
|
{
|
||||||
emit readData(CDbFlags::LiveryEntity, CDbFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CLiveryList liveries = CLiveryList::fromDatabaseJson(array);
|
CLiveryList liveries = CLiveryList::fromDatabaseJson(array);
|
||||||
@@ -216,7 +216,7 @@ namespace BlackCore
|
|||||||
this->m_liveries = liveries;
|
this->m_liveries = liveries;
|
||||||
n = liveries.size();
|
n = liveries.size();
|
||||||
}
|
}
|
||||||
emit readData(CDbFlags::LiveryEntity, CDbFlags::ReadFinished, n);
|
emit dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelDataReader::ps_parseDistributorData(QNetworkReply *nwReplyPtr)
|
void CModelDataReader::ps_parseDistributorData(QNetworkReply *nwReplyPtr)
|
||||||
@@ -225,7 +225,7 @@ namespace BlackCore
|
|||||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||||
if (array.isEmpty())
|
if (array.isEmpty())
|
||||||
{
|
{
|
||||||
emit readData(CDbFlags::DistributorEntity, CDbFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CDistributorList distributors = CDistributorList::fromDatabaseJson(array);
|
CDistributorList distributors = CDistributorList::fromDatabaseJson(array);
|
||||||
@@ -237,7 +237,7 @@ namespace BlackCore
|
|||||||
this->m_distributors = distributors;
|
this->m_distributors = distributors;
|
||||||
n = distributors.size();
|
n = distributors.size();
|
||||||
}
|
}
|
||||||
emit readData(CDbFlags::DistributorEntity, CDbFlags::ReadFinished, n);
|
emit dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelDataReader::ps_parseModelData(QNetworkReply *nwReplyPtr)
|
void CModelDataReader::ps_parseModelData(QNetworkReply *nwReplyPtr)
|
||||||
@@ -246,7 +246,7 @@ namespace BlackCore
|
|||||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||||
if (array.isEmpty())
|
if (array.isEmpty())
|
||||||
{
|
{
|
||||||
emit readData(CDbFlags::ModelEntity, CDbFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CAircraftModelList models = CAircraftModelList::fromDatabaseJson(array);
|
CAircraftModelList models = CAircraftModelList::fromDatabaseJson(array);
|
||||||
@@ -258,7 +258,7 @@ namespace BlackCore
|
|||||||
this->m_models = models;
|
this->m_models = models;
|
||||||
n = models.size();
|
n = models.size();
|
||||||
}
|
}
|
||||||
emit readData(CDbFlags::ModelEntity, CDbFlags::ReadFinished, n);
|
emit dataRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFinished, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CModelDataReader::getLiveryUrl(const QString &protocol, const QString &server, const QString &baseUrl)
|
QString CModelDataReader::getLiveryUrl(const QString &protocol, const QString &server, const QString &baseUrl)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Combined read signal
|
//! Combined read signal
|
||||||
void readData(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState state, int number);
|
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Liveries have been read
|
//! Liveries have been read
|
||||||
@@ -108,7 +108,7 @@ namespace BlackCore
|
|||||||
void ps_parseModelData(QNetworkReply *nwReply);
|
void ps_parseModelData(QNetworkReply *nwReply);
|
||||||
|
|
||||||
//! Read / re-read data file
|
//! Read / re-read data file
|
||||||
void ps_read(BlackMisc::Network::CDbFlags::Entity entity = BlackMisc::Network::CDbFlags::DistributorLiveryModel);
|
void ps_read(BlackMisc::Network::CEntityFlags::Entity entity = BlackMisc::Network::CEntityFlags::DistributorLiveryModel);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QNetworkAccessManager *m_networkManagerLivery = nullptr;
|
QNetworkAccessManager *m_networkManagerLivery = nullptr;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! \copydoc IWebDataReaderProvider::connectSwiftDatabaseSignals
|
//! \copydoc IWebDataReaderProvider::connectSwiftDatabaseSignals
|
||||||
//! \ingroup webdatareaderprovider
|
//! \ingroup webdatareaderprovider
|
||||||
virtual BlackMisc::Network::CDbFlags::Entity triggerRead(BlackMisc::Network::CDbFlags::Entity whatToRead) override;
|
virtual BlackMisc::Network::CEntityFlags::Entity triggerRead(BlackMisc::Network::CEntityFlags::Entity whatToRead) override;
|
||||||
|
|
||||||
//! \copydoc IWebDataReaderProvider::getVatsimFsdServers
|
//! \copydoc IWebDataReaderProvider::getVatsimFsdServers
|
||||||
//! \ingroup webdatareaderprovider
|
//! \ingroup webdatareaderprovider
|
||||||
@@ -236,7 +236,7 @@ namespace BlackCore
|
|||||||
void vatsimMetarsRead(int number);
|
void vatsimMetarsRead(int number);
|
||||||
|
|
||||||
//! Combined read signal
|
//! Combined read signal
|
||||||
void readSwiftDbData(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState state, int number);
|
void readSwiftDbData(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
|
||||||
//! Model has been written
|
//! Model has been written
|
||||||
void modelWritten(const BlackMisc::Simulation::CAircraftModel &model);
|
void modelWritten(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
@@ -252,7 +252,7 @@ namespace BlackCore
|
|||||||
void ps_dataFileRead(int lines);
|
void ps_dataFileRead(int lines);
|
||||||
|
|
||||||
//! Read from model reader
|
//! Read from model reader
|
||||||
void ps_readFromSwiftDb(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState state, int number);
|
void ps_readFromSwiftDb(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Init the readers
|
//! Init the readers
|
||||||
@@ -261,7 +261,7 @@ namespace BlackCore
|
|||||||
//! Init the writers
|
//! Init the writers
|
||||||
void initWriters();
|
void initWriters();
|
||||||
|
|
||||||
CWebReaderFlags::WebReader m_readerFlags = CWebReaderFlags::WebReaderFlags::None; //!< which readers are available
|
CWebReaderFlags::WebReader m_readerFlags = CWebReaderFlags::WebReaderFlag::None; //!< which readers are available
|
||||||
|
|
||||||
// for reading XML and VATSIM data files
|
// for reading XML and VATSIM data files
|
||||||
CVatsimBookingReader *m_vatsimBookingReader = nullptr;
|
CVatsimBookingReader *m_vatsimBookingReader = nullptr;
|
||||||
|
|||||||
@@ -13,36 +13,41 @@ using namespace BlackMisc::Network;
|
|||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
CWebReaderFlags::WebReader CWebReaderFlags::entityToReader(CDbFlags::Entity entity)
|
CWebReaderFlags::WebReader CWebReaderFlags::entityToReader(CEntityFlags::Entity entity)
|
||||||
{
|
{
|
||||||
WebReader f = None;
|
WebReader f = None;
|
||||||
if (entity.testFlag(CDbFlags::AircraftIcaoEntity) ||
|
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) ||
|
||||||
entity.testFlag(CDbFlags::AirlineIcaoEntity) ||
|
entity.testFlag(CEntityFlags::AirlineIcaoEntity) ||
|
||||||
entity.testFlag(CDbFlags::CountryEntity))
|
entity.testFlag(CEntityFlags::CountryEntity))
|
||||||
{
|
{
|
||||||
f |= IcaoDataReader;
|
f |= IcaoDataReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.testFlag(CDbFlags::ModelEntity) ||
|
if (entity.testFlag(CEntityFlags::ModelEntity) ||
|
||||||
entity.testFlag(CDbFlags::DistributorEntity) ||
|
entity.testFlag(CEntityFlags::DistributorEntity) ||
|
||||||
entity.testFlag(CDbFlags::LiveryEntity))
|
entity.testFlag(CEntityFlags::LiveryEntity))
|
||||||
{
|
{
|
||||||
f |= ModelReader;
|
f |= ModelReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.testFlag(CDbFlags::VatsimBookings))
|
if (entity.testFlag(CEntityFlags::BookingEntity))
|
||||||
{
|
{
|
||||||
f |= VatsimBookingReader;
|
f |= VatsimBookingReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.testFlag(CDbFlags::VatsimDataFile))
|
if (entity.testFlag(CEntityFlags::VatsimDataFile))
|
||||||
{
|
{
|
||||||
f |= VatsimDataReader;
|
f |= VatsimDataReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entity.testFlag(CEntityFlags::MetarEntity))
|
||||||
|
{
|
||||||
|
f |= VatsimMetarReader;
|
||||||
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWebReaderFlags::isFromSwiftDb(CDbFlags::Entity entity)
|
bool CWebReaderFlags::isFromSwiftDb(CEntityFlags::Entity entity)
|
||||||
{
|
{
|
||||||
return isFromSwiftDb(entityToReader(entity));
|
return isFromSwiftDb(entityToReader(entity));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
#include "blackcoreexport.h"
|
#include "blackcoreexport.h"
|
||||||
#include "blackmisc/network/dbflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Which readers to init
|
//! Which readers to init
|
||||||
enum WebReaderFlags
|
enum WebReaderFlag
|
||||||
{
|
{
|
||||||
None = 0, ///< no reader at all
|
None = 0, ///< no reader at all
|
||||||
VatsimBookingReader = 1 << 0, ///< reader for VATSIM booking data
|
VatsimBookingReader = 1 << 0, ///< reader for VATSIM booking data
|
||||||
@@ -38,20 +38,20 @@ namespace BlackCore
|
|||||||
AllSwiftDbReaders = IcaoDataReader | ModelReader, ///< all swift data
|
AllSwiftDbReaders = IcaoDataReader | ModelReader, ///< all swift data
|
||||||
AllReaders = AllSwiftDbReaders | AllVatsimReaders ///< everything
|
AllReaders = AllSwiftDbReaders | AllVatsimReaders ///< everything
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(WebReader, WebReaderFlags)
|
Q_DECLARE_FLAGS(WebReader, WebReaderFlag)
|
||||||
|
|
||||||
//! Relationship between reader and entity
|
//! Relationship between reader and entity
|
||||||
static WebReader entityToReader(BlackMisc::Network::CDbFlags::Entity entity);
|
static WebReader entityToReader(BlackMisc::Network::CEntityFlags::Entity entity);
|
||||||
|
|
||||||
//! Read from swift DB
|
//! Read from swift DB
|
||||||
static bool isFromSwiftDb(BlackMisc::Network::CDbFlags::Entity entity);
|
static bool isFromSwiftDb(BlackMisc::Network::CEntityFlags::Entity entity);
|
||||||
|
|
||||||
//! Read from swift DB
|
//! Read from swift DB
|
||||||
static bool isFromSwiftDb(WebReader reader);
|
static bool isFromSwiftDb(WebReader reader);
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackCore::CWebReaderFlags::WebReaderFlags)
|
Q_DECLARE_METATYPE(BlackCore::CWebReaderFlags::WebReaderFlag)
|
||||||
Q_DECLARE_METATYPE(BlackCore::CWebReaderFlags::WebReader)
|
Q_DECLARE_METATYPE(BlackCore::CWebReaderFlags::WebReader)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::CWebReaderFlags::WebReader)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::CWebReaderFlags::WebReader)
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
int c = getAircraftIcaoCodesCount();
|
int c = getAircraftIcaoCodesCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
ps_icaoRead(CDbFlags::AircraftIcaoEntity, CDbFlags::ReadFinished, c);
|
ps_icaoRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ namespace BlackGui
|
|||||||
this->ui->filter_AircraftIcao->filter(icao);
|
this->ui->filter_AircraftIcao->filter(icao);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbAircraftIcaoComponent::ps_icaoRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbAircraftIcaoComponent::ps_icaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
if (entity.testFlag(CDbFlags::AircraftIcaoEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
this->ui->tvp_AircraftIcao->updateContainerMaybeAsync(this->getAircraftIcaoCodes());
|
this->ui->tvp_AircraftIcao->updateContainerMaybeAsync(this->getAircraftIcaoCodes());
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
|||||||
void CDbAircraftIcaoComponent::ps_reload()
|
void CDbAircraftIcaoComponent::ps_reload()
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
triggerRead(CDbFlags::AircraftIcaoEntity);
|
triggerRead(CEntityFlags::AircraftIcaoEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! ICAO codes have been read
|
//! ICAO codes have been read
|
||||||
void ps_icaoRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_icaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Reload models
|
//! Reload models
|
||||||
void ps_reload();
|
void ps_reload();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace BlackGui
|
|||||||
int c = this->getAircraftIcaoCodesCount();
|
int c = this->getAircraftIcaoCodesCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
this->ps_codesRead(CDbFlags::AircraftIcaoEntity, CDbFlags::ReadFinished, c);
|
this->ps_codesRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,10 +141,10 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbAircraftIcaoSelectorComponent::ps_codesRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbAircraftIcaoSelectorComponent::ps_codesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
if (entity.testFlag(CDbFlags::AircraftIcaoEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Distributors have been read
|
//! Distributors have been read
|
||||||
void ps_codesRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_codesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Data have been changed
|
//! Data have been changed
|
||||||
void ps_dataChanged();
|
void ps_dataChanged();
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ namespace BlackGui
|
|||||||
int c = this->getAirlineIcaoCodesCount();
|
int c = this->getAirlineIcaoCodesCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
this->ps_icaoRead(CDbFlags::AirlineIcaoEntity, CDbFlags::ReadFinished, c);
|
this->ps_icaoRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbAirlineIcaoComponent::ps_icaoRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbAirlineIcaoComponent::ps_icaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
if (entity.testFlag(CDbFlags::AirlineIcaoEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
this->ui->tvp_AirlineIcao->updateContainerMaybeAsync(this->getAirlineIcaoCodes());
|
this->ui->tvp_AirlineIcao->updateContainerMaybeAsync(this->getAirlineIcaoCodes());
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ namespace BlackGui
|
|||||||
void CDbAirlineIcaoComponent::ps_reload()
|
void CDbAirlineIcaoComponent::ps_reload()
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
triggerRead(CDbFlags::AirlineIcaoEntity);
|
triggerRead(CEntityFlags::AirlineIcaoEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! ICAO codes have been read
|
//! ICAO codes have been read
|
||||||
void ps_icaoRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_icaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Reload models
|
//! Reload models
|
||||||
void ps_reload();
|
void ps_reload();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace BlackGui
|
|||||||
int c = this->getAirlineIcaoCodesCount();
|
int c = this->getAirlineIcaoCodesCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
this->ps_codesRead(CDbFlags::AirlineIcaoEntity, CDbFlags::ReadFinished, c);
|
this->ps_codesRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,10 +143,10 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbAirlineIcaoSelectorComponent::ps_codesRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbAirlineIcaoSelectorComponent::ps_codesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
if (entity.testFlag(CDbFlags::AirlineIcaoEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Distributors have been read
|
//! Distributors have been read
|
||||||
void ps_codesRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_codesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Data have been changed
|
//! Data have been changed
|
||||||
void ps_dataChanged();
|
void ps_dataChanged();
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ namespace BlackGui
|
|||||||
int c = getCountriesCount();
|
int c = getCountriesCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
ps_countriesRead(CDbFlags::CountryEntity, CDbFlags::ReadFinished, c);
|
ps_countriesRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbCountryComponent::ps_countriesRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbCountryComponent::ps_countriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
if (entity.testFlag(CDbFlags::CountryEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::CountryEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
this->ui->tvp_Countries->updateContainerMaybeAsync(this->getCountries());
|
this->ui->tvp_Countries->updateContainerMaybeAsync(this->getCountries());
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ namespace BlackGui
|
|||||||
void CDbCountryComponent::ps_reload()
|
void CDbCountryComponent::ps_reload()
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
triggerRead(CDbFlags::CountryEntity);
|
triggerRead(CEntityFlags::CountryEntity);
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Countries have been read
|
//! Countries have been read
|
||||||
void ps_countriesRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_countriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Reload models
|
//! Reload models
|
||||||
void ps_reload();
|
void ps_reload();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
|||||||
int c = this->getCountriesCount();
|
int c = this->getCountriesCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
this->ps_CountriesRead(CDbFlags::CountryEntity, CDbFlags::ReadFinished, c);
|
this->ps_CountriesRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,10 +147,10 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbCountrySelectorComponent::ps_CountriesRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbCountrySelectorComponent::ps_CountriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
if (entity.testFlag(CDbFlags::DistributorEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Countries have been read
|
//! Countries have been read
|
||||||
void ps_CountriesRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_CountriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Data have been changed
|
//! Data have been changed
|
||||||
void ps_dataChanged();
|
void ps_dataChanged();
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ namespace BlackGui
|
|||||||
int c = getDistributorsCount();
|
int c = getDistributorsCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
ps_distributorsRead(CDbFlags::DistributorEntity, CDbFlags::ReadFinished, c);
|
ps_distributorsRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbDistributorComponent::ps_distributorsRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbDistributorComponent::ps_distributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
if (entity.testFlag(CDbFlags::DistributorEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
this->ui->tvp_Distributors->updateContainer(this->getDistributors());
|
this->ui->tvp_Distributors->updateContainer(this->getDistributors());
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ namespace BlackGui
|
|||||||
void CDbDistributorComponent::ps_reload()
|
void CDbDistributorComponent::ps_reload()
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
triggerRead(CDbFlags::DistributorEntity);
|
triggerRead(CEntityFlags::DistributorEntity);
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Distributors have been read
|
//! Distributors have been read
|
||||||
void ps_distributorsRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_distributorsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Reload models
|
//! Reload models
|
||||||
void ps_reload();
|
void ps_reload();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace BlackGui
|
|||||||
int c = getDistributorsCount();
|
int c = getDistributorsCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
ps_distributorsRead(CDbFlags::DistributorEntity, CDbFlags::ReadFinished, c);
|
ps_distributorsRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,10 +146,10 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbDistributorSelectorComponent::ps_distributorsRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbDistributorSelectorComponent::ps_distributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
if (entity.testFlag(CDbFlags::DistributorEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Distributors have been read
|
//! Distributors have been read
|
||||||
void ps_distributorsRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_distributorsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Data have been changed
|
//! Data have been changed
|
||||||
void ps_dataChanged();
|
void ps_dataChanged();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
int c = getLiveriesCount();
|
int c = getLiveriesCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
ps_liveriesRead(CDbFlags::LiveryEntity, CDbFlags::ReadFinished, c);
|
ps_liveriesRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ namespace BlackGui
|
|||||||
this->ui->filter_Livery->filter(livery);
|
this->ui->filter_Livery->filter(livery);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbLiveryComponent::ps_liveriesRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbLiveryComponent::ps_liveriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
if (entity.testFlag(CDbFlags::LiveryEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::LiveryEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
this->ui->tvp_Liveries->updateContainerMaybeAsync(this->getLiveries());
|
this->ui->tvp_Liveries->updateContainerMaybeAsync(this->getLiveries());
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
|||||||
void CDbLiveryComponent::ps_reload()
|
void CDbLiveryComponent::ps_reload()
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
triggerRead(CDbFlags::LiveryEntity);
|
triggerRead(CEntityFlags::LiveryEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Liveries codes have been read
|
//! Liveries codes have been read
|
||||||
void ps_liveriesRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_liveriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Reload models
|
//! Reload models
|
||||||
void ps_reload();
|
void ps_reload();
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ namespace BlackGui
|
|||||||
int c = getModelsCount();
|
int c = getModelsCount();
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
ps_modelsRead(CDbFlags::ModelEntity, CDbFlags::ReadFinished, c);
|
ps_modelsRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFinished, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbModelComponent::ps_modelsRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CDbModelComponent::ps_modelsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
if (entity.testFlag(CDbFlags::ModelEntity) && readState == CDbFlags::ReadFinished)
|
if (entity.testFlag(CEntityFlags::ModelEntity) && readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
this->ui->tvp_AircraftModel->updateContainer(this->getModels());
|
this->ui->tvp_AircraftModel->updateContainer(this->getModels());
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
|||||||
void CDbModelComponent::ps_reload()
|
void CDbModelComponent::ps_reload()
|
||||||
{
|
{
|
||||||
if (!hasProvider()) { return; }
|
if (!hasProvider()) { return; }
|
||||||
triggerRead(CDbFlags::ModelEntity);
|
triggerRead(CEntityFlags::ModelEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbModelComponent::ps_onStyleSheetChanged()
|
void CDbModelComponent::ps_onStyleSheetChanged()
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Models have been read
|
//! Models have been read
|
||||||
void ps_modelsRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_modelsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Reload models
|
//! Reload models
|
||||||
void ps_reload();
|
void ps_reload();
|
||||||
|
|||||||
@@ -60,9 +60,9 @@ namespace BlackGui
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoBarWebReadersStatusComponent::ps_dataRead(CDbFlags::Entity entity, CDbFlags::ReadState readState, int count)
|
void CInfoBarWebReadersStatusComponent::ps_dataRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
if (readState == CDbFlags::ReadFinished)
|
if (readState == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
bool swift = CWebReaderFlags::isFromSwiftDb(entity);
|
bool swift = CWebReaderFlags::isFromSwiftDb(entity);
|
||||||
if (swift && count > 0)
|
if (swift && count > 0)
|
||||||
@@ -88,7 +88,7 @@ namespace BlackGui
|
|||||||
this->ui->led_DataReady->setOn(allData);
|
this->ui->led_DataReady->setOn(allData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoBarWebReadersStatusComponent::setLedReadStates(const QList<CLedWidget *> &leds, CDbFlags::ReadState readState)
|
void CInfoBarWebReadersStatusComponent::setLedReadStates(const QList<CLedWidget *> &leds, CEntityFlags::ReadState readState)
|
||||||
{
|
{
|
||||||
for (CLedWidget *led : leds)
|
for (CLedWidget *led : leds)
|
||||||
{
|
{
|
||||||
@@ -96,33 +96,33 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoBarWebReadersStatusComponent::setLedReadState(CLedWidget *led, CDbFlags::ReadState readState)
|
void CInfoBarWebReadersStatusComponent::setLedReadState(CLedWidget *led, CEntityFlags::ReadState readState)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(led, Q_FUNC_INFO, "no LED");
|
Q_ASSERT_X(led, Q_FUNC_INFO, "no LED");
|
||||||
int blinkTime = 2.5 * 1000;
|
int blinkTime = 2.5 * 1000;
|
||||||
switch (readState)
|
switch (readState)
|
||||||
{
|
{
|
||||||
case CDbFlags::ReadFinished:
|
case CEntityFlags::ReadFinished:
|
||||||
led->setOn(true, blinkTime);
|
led->setOn(true, blinkTime);
|
||||||
break;
|
break;
|
||||||
case CDbFlags::StartRead:
|
case CEntityFlags::StartRead:
|
||||||
led->setOn(true);
|
led->setOn(true);
|
||||||
break;
|
break;
|
||||||
case CDbFlags::ReadFailed:
|
case CEntityFlags::ReadFailed:
|
||||||
led->setTriState(2 * blinkTime);
|
led->setTriState(2 * blinkTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<CLedWidget *> CInfoBarWebReadersStatusComponent::entityToLeds(CDbFlags::Entity entity) const
|
QList<CLedWidget *> CInfoBarWebReadersStatusComponent::entityToLeds(CEntityFlags::Entity entity) const
|
||||||
{
|
{
|
||||||
QList<CLedWidget *> leds;
|
QList<CLedWidget *> leds;
|
||||||
if (entity.testFlag(CDbFlags::CountryEntity)) { leds << ui->led_Countries; }
|
if (entity.testFlag(CEntityFlags::CountryEntity)) { leds << ui->led_Countries; }
|
||||||
if (entity.testFlag(CDbFlags::DistributorEntity)) { leds << ui->led_Distributors; }
|
if (entity.testFlag(CEntityFlags::DistributorEntity)) { leds << ui->led_Distributors; }
|
||||||
if (entity.testFlag(CDbFlags::AircraftIcaoEntity)) { leds << ui->led_IcaoAircraft; }
|
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity)) { leds << ui->led_IcaoAircraft; }
|
||||||
if (entity.testFlag(CDbFlags::AirlineIcaoEntity)) { leds << ui->led_IcaoAirline; }
|
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity)) { leds << ui->led_IcaoAirline; }
|
||||||
if (entity.testFlag(CDbFlags::LiveryEntity)) { leds << ui->led_Liveries; }
|
if (entity.testFlag(CEntityFlags::LiveryEntity)) { leds << ui->led_Liveries; }
|
||||||
if (entity.testFlag(CDbFlags::ModelEntity)) { leds << ui->led_Models; }
|
if (entity.testFlag(CEntityFlags::ModelEntity)) { leds << ui->led_Models; }
|
||||||
return leds;
|
return leds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Data have been read
|
//! Data have been read
|
||||||
void ps_dataRead(BlackMisc::Network::CDbFlags::Entity entity, BlackMisc::Network::CDbFlags::ReadState readState, int count);
|
void ps_dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||||
|
|
||||||
//! Check server status
|
//! Check server status
|
||||||
void ps_checkServerAndData();
|
void ps_checkServerAndData();
|
||||||
@@ -56,13 +56,13 @@ namespace BlackGui
|
|||||||
QTimer m_timer { this };
|
QTimer m_timer { this };
|
||||||
|
|
||||||
//! Set LED states
|
//! Set LED states
|
||||||
void setLedReadStates(const QList<CLedWidget *> &leds, BlackMisc::Network::CDbFlags::ReadState readState);
|
void setLedReadStates(const QList<CLedWidget *> &leds, BlackMisc::Network::CEntityFlags::ReadState readState);
|
||||||
|
|
||||||
//! Set the LED read state
|
//! Set the LED read state
|
||||||
void setLedReadState(CLedWidget *led, BlackMisc::Network::CDbFlags::ReadState readState);
|
void setLedReadState(CLedWidget *led, BlackMisc::Network::CEntityFlags::ReadState readState);
|
||||||
|
|
||||||
//! Maps entity to its id
|
//! Maps entity to its id
|
||||||
QList<CLedWidget *> entityToLeds(BlackMisc::Network::CDbFlags::Entity entity) const;
|
QList<CLedWidget *> entityToLeds(BlackMisc::Network::CEntityFlags::Entity entity) const;
|
||||||
|
|
||||||
//! All data read
|
//! All data read
|
||||||
bool hasAllData() const;
|
bool hasAllData() const;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "blackmiscfreefunctions.h"
|
#include "blackmiscfreefunctions.h"
|
||||||
#include "blackmisc/network/network.h"
|
#include "blackmisc/network/network.h"
|
||||||
#include "blackmisc/network/dbflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Metadata for Network
|
* Metadata for Network
|
||||||
@@ -28,12 +28,5 @@ void BlackMisc::Network::registerMetadata()
|
|||||||
CClient::registerMetadata();
|
CClient::registerMetadata();
|
||||||
CClientList::registerMetadata();
|
CClientList::registerMetadata();
|
||||||
CVoiceCapabilities::registerMetadata();
|
CVoiceCapabilities::registerMetadata();
|
||||||
|
CEntityFlags::registerMetadata();
|
||||||
int id = qRegisterMetaType<CDbFlags::Entity>();
|
|
||||||
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
|
||||||
id = qRegisterMetaType<CDbFlags::EntityFlags>();
|
|
||||||
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
|
||||||
id = qRegisterMetaType<CDbFlags::ReadState>();
|
|
||||||
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
|
||||||
Q_UNUSED(id);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,21 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackmisc/network/dbflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
|
#include "blackmisc/dbus.h"
|
||||||
|
#include <QtDBus/QDBusMetaType>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
namespace Network
|
namespace Network
|
||||||
{
|
{
|
||||||
QString CDbFlags::flagToString(CDbFlags::EntityFlags flag)
|
QString CEntityFlags::flagToString(CEntityFlags::EntityFlag flag)
|
||||||
{
|
{
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case NoEntity: return "no data";
|
case NoEntity: return "no data";
|
||||||
case VatsimBookings: return "VATSIM bookings";
|
case BookingEntity: return "VATSIM bookings";
|
||||||
case VatsimDataFile: return "VATSIM data file";
|
case VatsimDataFile: return "VATSIM data file";
|
||||||
case AircraftIcaoEntity: return "Aircraft ICAO";
|
case AircraftIcaoEntity: return "Aircraft ICAO";
|
||||||
case AirlineIcaoEntity: return "Airline ICAO";
|
case AirlineIcaoEntity: return "Airline ICAO";
|
||||||
@@ -36,11 +38,11 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CDbFlags::flagToString(Entity flag)
|
QString CEntityFlags::flagToString(Entity flag)
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
if (flag.testFlag(NoEntity)) list << "no data";
|
if (flag.testFlag(NoEntity)) list << "no data";
|
||||||
if (flag.testFlag(VatsimBookings)) list << "VATSIM bookings";
|
if (flag.testFlag(BookingEntity)) list << "VATSIM bookings";
|
||||||
if (flag.testFlag(VatsimDataFile)) list << "VATSIM data file";
|
if (flag.testFlag(VatsimDataFile)) list << "VATSIM data file";
|
||||||
if (flag.testFlag(AircraftIcaoEntity)) list << "Aircraft ICAO";
|
if (flag.testFlag(AircraftIcaoEntity)) list << "Aircraft ICAO";
|
||||||
if (flag.testFlag(AirlineIcaoEntity)) list << "Airline ICAO";
|
if (flag.testFlag(AirlineIcaoEntity)) list << "Airline ICAO";
|
||||||
@@ -51,7 +53,7 @@ namespace BlackMisc
|
|||||||
return list.join(',');
|
return list.join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CDbFlags::flagToString(CDbFlags::ReadState flag)
|
QString CEntityFlags::flagToString(CEntityFlags::ReadState flag)
|
||||||
{
|
{
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
@@ -63,5 +65,25 @@ namespace BlackMisc
|
|||||||
return "wrong flags";
|
return "wrong flags";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEntityFlags::registerMetadata()
|
||||||
|
{
|
||||||
|
// this is no value class and I register enums here,
|
||||||
|
// that's why I do not use the Mixins
|
||||||
|
int id = qRegisterMetaType<CEntityFlags::Entity>();
|
||||||
|
// int idb = qDBusRegisterMetaType<CEntityFlags::Entity>();
|
||||||
|
// Q_ASSERT_X(id >= 1024 && id == idb, Q_FUNC_INFO, "wrong id for metatype");
|
||||||
|
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
||||||
|
|
||||||
|
id = qRegisterMetaType<CEntityFlags::EntityFlag>();
|
||||||
|
// idb = qDBusRegisterMetaType<CEntityFlags::EntityFlag>();
|
||||||
|
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
||||||
|
|
||||||
|
id = qRegisterMetaType<CEntityFlags::ReadState>();
|
||||||
|
// idb = qDBusRegisterMetaType<CEntityFlags::ReadState>();
|
||||||
|
Q_ASSERT_X(id >= 1024, Q_FUNC_INFO, "wrong id for metatype");
|
||||||
|
Q_UNUSED(id);
|
||||||
|
// Q_UNUSED(idb);
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKMISC_NETWORK_ENTITREADERFLAGS_H
|
#ifndef BLACKMISC_NETWORK_ENTITRFLAGS_H
|
||||||
#define BLACKMISC_NETWORK_ENTITREADERFLAGS_H
|
#define BLACKMISC_NETWORK_ENTITRFLAGS_H
|
||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -20,29 +20,30 @@ namespace BlackMisc
|
|||||||
namespace Network
|
namespace Network
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* What and state of reading from DB
|
* What and state of reading from web services
|
||||||
*/
|
*/
|
||||||
class BLACKMISC_EXPORT CDbFlags
|
class BLACKMISC_EXPORT CEntityFlags
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Which data to read, requires corresponding readers
|
//! Which data to read, requires corresponding readers
|
||||||
enum EntityFlags
|
enum EntityFlag
|
||||||
{
|
{
|
||||||
NoEntity = 0, ///< no data at all
|
NoEntity = 0, ///< no data at all
|
||||||
VatsimBookings = 1 << 0, ///< bookings
|
VatsimDataFile = 1 << 0, ///< the VATSIM data file (multiple data entities)
|
||||||
VatsimDataFile = 1 << 1, ///< the VATSIM data file
|
BookingEntity = 1 << 1, ///< bookings
|
||||||
AircraftIcaoEntity = 1 << 2, ///< ICAO codes for aircraft
|
MetarEntity = 1 << 2,
|
||||||
AirlineIcaoEntity = 1 << 3, ///< ICAO codes for airlines
|
AircraftIcaoEntity = 1 << 3, ///< ICAO codes for aircraft
|
||||||
CountryEntity = 1 << 4, ///< Country codes
|
AirlineIcaoEntity = 1 << 4, ///< ICAO codes for airlines
|
||||||
DistributorEntity = 1 << 5, ///< distributors
|
CountryEntity = 1 << 5, ///< country codes
|
||||||
LiveryEntity = 1 << 6, ///< liveries
|
DistributorEntity = 1 << 6, ///< distributors
|
||||||
ModelEntity = 1 << 7, ///< models
|
LiveryEntity = 1 << 7, ///< liveries
|
||||||
|
ModelEntity = 1 << 8, ///< models
|
||||||
AllIcaoEntities = AircraftIcaoEntity | AirlineIcaoEntity, ///< all ICAO codes
|
AllIcaoEntities = AircraftIcaoEntity | AirlineIcaoEntity, ///< all ICAO codes
|
||||||
AllIcaoAndCountries = AircraftIcaoEntity | AirlineIcaoEntity | CountryEntity, ///< all ICAO codes and countries
|
AllIcaoAndCountries = AircraftIcaoEntity | AirlineIcaoEntity | CountryEntity, ///< all ICAO codes and countries
|
||||||
DistributorLiveryModel = DistributorEntity | LiveryEntity | ModelEntity, ///< Combinded
|
DistributorLiveryModel = DistributorEntity | LiveryEntity | ModelEntity, ///< Combinded
|
||||||
AllEntities = 0xFFFF ///< everything
|
AllEntities = 0xFFFF ///< everything
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(Entity, EntityFlags)
|
Q_DECLARE_FLAGS(Entity, EntityFlag)
|
||||||
|
|
||||||
//! State of operation
|
//! State of operation
|
||||||
enum ReadState
|
enum ReadState
|
||||||
@@ -53,20 +54,23 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Convert to string
|
//! Convert to string
|
||||||
static QString flagToString(EntityFlags flag);
|
static QString flagToString(EntityFlag flag);
|
||||||
|
|
||||||
//! Convert to string
|
//! Convert to string
|
||||||
static QString flagToString(BlackMisc::Network::CDbFlags::Entity flag);
|
static QString flagToString(BlackMisc::Network::CEntityFlags::Entity flag);
|
||||||
|
|
||||||
//! Convert to string
|
//! Convert to string
|
||||||
static QString flagToString(ReadState flag);
|
static QString flagToString(ReadState flag);
|
||||||
|
|
||||||
|
//! Register metadata
|
||||||
|
static void registerMetadata();
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Network::CDbFlags::EntityFlags)
|
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::EntityFlag)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Network::CDbFlags::Entity)
|
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::Entity)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Network::CDbFlags::ReadState)
|
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::ReadState)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Network::CDbFlags::Entity)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Network::CEntityFlags::Entity)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
@@ -34,7 +34,7 @@ namespace BlackMisc
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Simulator
|
//! Simulator
|
||||||
enum SimulatorFlags
|
enum SimulatorFlag
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
FSX = 1 << 0,
|
FSX = 1 << 0,
|
||||||
@@ -45,7 +45,7 @@ namespace BlackMisc
|
|||||||
AllMS = FSX | FS9 | P3D,
|
AllMS = FSX | FS9 | P3D,
|
||||||
All = FSX | FS9 | XPLANE | P3D
|
All = FSX | FS9 | XPLANE | P3D
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(Simulator, SimulatorFlags)
|
Q_DECLARE_FLAGS(Simulator, SimulatorFlag)
|
||||||
|
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
CSimulatorInfo();
|
CSimulatorInfo();
|
||||||
@@ -130,7 +130,7 @@ BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Simulation::CSimulatorInfo, (
|
|||||||
attr(o.m_simulator)
|
attr(o.m_simulator)
|
||||||
))
|
))
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorInfo)
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorInfo)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorInfo::SimulatorFlags)
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorInfo::SimulatorFlag)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::CSimulatorInfo::Simulator)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::CSimulatorInfo::Simulator)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace BlackCoreTest
|
|||||||
m_icaoReader.start();
|
m_icaoReader.start();
|
||||||
Expect e(&this->m_icaoReader);
|
Expect e(&this->m_icaoReader);
|
||||||
EXPECT_UNIT(e)
|
EXPECT_UNIT(e)
|
||||||
.send(&CIcaoDataReader::readInBackgroundThread, CDbFlags::AllIcaoEntities)
|
.send(&CIcaoDataReader::readInBackgroundThread, CEntityFlags::AllIcaoEntities)
|
||||||
.expect(&CIcaoDataReader::readData, [server]()
|
.expect(&CIcaoDataReader::dataRead, [server]()
|
||||||
{
|
{
|
||||||
qDebug() << "Read ICAO data from" << server;
|
qDebug() << "Read ICAO data from" << server;
|
||||||
})
|
})
|
||||||
@@ -68,8 +68,8 @@ namespace BlackCoreTest
|
|||||||
m_modelReader.start();
|
m_modelReader.start();
|
||||||
Expect e(&this->m_modelReader);
|
Expect e(&this->m_modelReader);
|
||||||
EXPECT_UNIT(e)
|
EXPECT_UNIT(e)
|
||||||
.send(&CModelDataReader::readInBackgroundThread, CDbFlags::AllIcaoEntities)
|
.send(&CModelDataReader::readInBackgroundThread, CEntityFlags::AllIcaoEntities)
|
||||||
.expect(&CModelDataReader::readData, [server]()
|
.expect(&CModelDataReader::dataRead, [server]()
|
||||||
{
|
{
|
||||||
// CDbFlags::flagToString(entity) << CDbFlags::flagToString(state) << number
|
// CDbFlags::flagToString(entity) << CDbFlags::flagToString(state) << number
|
||||||
qDebug() << "Read model data " << server;
|
qDebug() << "Read model data " << server;
|
||||||
|
|||||||
Reference in New Issue
Block a user