mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +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");
|
||||
id = qRegisterMetaType<BlackCore::INetwork::ConnectionStatus>();
|
||||
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");
|
||||
id = qRegisterMetaType<BlackCore::CWebReaderFlags::WebReader>();
|
||||
Q_UNUSED(id);
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace BlackCore
|
||||
BlackMisc::CThreadedReader(owner, name)
|
||||
{ }
|
||||
|
||||
void CDatabaseReader::readInBackgroundThread(CDbFlags::Entity entities)
|
||||
void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities)
|
||||
{
|
||||
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_UNUSED(s);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/threadedreader.h"
|
||||
#include "blackmisc/network/dbflags.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonArray>
|
||||
#include <QDateTime>
|
||||
@@ -54,7 +54,7 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
//! Start reading in own thread
|
||||
void readInBackgroundThread(BlackMisc::Network::CDbFlags::Entity entities);
|
||||
void readInBackgroundThread(BlackMisc::Network::CEntityFlags::Entity entities);
|
||||
|
||||
//! Can connect to DB
|
||||
bool canConnect() const;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace BlackCore
|
||||
return m_countries.size();
|
||||
}
|
||||
|
||||
void CIcaoDataReader::ps_read(BlackMisc::Network::CDbFlags::Entity entities)
|
||||
void CIcaoDataReader::ps_read(BlackMisc::Network::CEntityFlags::Entity entities)
|
||||
{
|
||||
this->threadAssertCheck();
|
||||
Q_ASSERT(this->m_networkManagerAircraft);
|
||||
@@ -167,29 +167,29 @@ namespace BlackCore
|
||||
Q_ASSERT(!m_urlAirlineIcao.isEmpty());
|
||||
Q_ASSERT(!m_urlCountry.isEmpty());
|
||||
|
||||
CDbFlags::Entity entitiesTriggered = CDbFlags::NoEntity;
|
||||
if (entities.testFlag(CDbFlags::AircraftIcaoEntity))
|
||||
CEntityFlags::Entity entitiesTriggered = CEntityFlags::NoEntity;
|
||||
if (entities.testFlag(CEntityFlags::AircraftIcaoEntity))
|
||||
{
|
||||
QNetworkRequest requestAircraft(m_urlAircraftIcao);
|
||||
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);
|
||||
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);
|
||||
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)
|
||||
@@ -200,7 +200,7 @@ namespace BlackCore
|
||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||
if (array.isEmpty())
|
||||
{
|
||||
emit readData(CDbFlags::AircraftIcaoEntity, CDbFlags::ReadFailed, 0);
|
||||
emit dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFailed, 0);
|
||||
return;
|
||||
}
|
||||
CAircraftIcaoCodeList codes = CAircraftIcaoCodeList::fromDatabaseJson(array);
|
||||
@@ -212,7 +212,7 @@ namespace BlackCore
|
||||
this->m_aircraftIcaos = codes;
|
||||
n = codes.size();
|
||||
}
|
||||
emit readData(CDbFlags::AircraftIcaoEntity, CDbFlags::ReadFinished, n);
|
||||
emit dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, n);
|
||||
}
|
||||
|
||||
void CIcaoDataReader::ps_parseAirlineIcaoData(QNetworkReply *nwReplyPtr)
|
||||
@@ -221,7 +221,7 @@ namespace BlackCore
|
||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||
if (array.isEmpty())
|
||||
{
|
||||
emit readData(CDbFlags::AirlineIcaoEntity, CDbFlags::ReadFailed, 0);
|
||||
emit dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFailed, 0);
|
||||
return;
|
||||
}
|
||||
CAirlineIcaoCodeList codes = CAirlineIcaoCodeList::fromDatabaseJson(array);
|
||||
@@ -233,7 +233,7 @@ namespace BlackCore
|
||||
this->m_airlineIcaos = codes;
|
||||
n = codes.size();
|
||||
}
|
||||
emit readData(CDbFlags::AirlineIcaoEntity, CDbFlags::ReadFinished, n);
|
||||
emit dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, n);
|
||||
}
|
||||
|
||||
void CIcaoDataReader::ps_parseCountryData(QNetworkReply *nwReplyPtr)
|
||||
@@ -242,7 +242,7 @@ namespace BlackCore
|
||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||
if (array.isEmpty())
|
||||
{
|
||||
emit readData(CDbFlags::CountryEntity, CDbFlags::ReadFailed, 0);
|
||||
emit dataRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFailed, 0);
|
||||
return;
|
||||
}
|
||||
CCountryList countries = CCountryList::fromDatabaseJson(array);
|
||||
@@ -254,7 +254,7 @@ namespace BlackCore
|
||||
this->m_countries = countries;
|
||||
n = m_countries.size();
|
||||
}
|
||||
emit readData(CDbFlags::CountryEntity, CDbFlags::ReadFinished, n);
|
||||
emit dataRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, n);
|
||||
}
|
||||
|
||||
bool CIcaoDataReader::canConnect(QString &message) const
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "blackmisc/countrylist.h"
|
||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||
#include "blackmisc/network/dbflags.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
@@ -103,7 +103,7 @@ namespace BlackCore
|
||||
|
||||
signals:
|
||||
//! 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:
|
||||
//! Aircraft have been read
|
||||
@@ -116,7 +116,7 @@ namespace BlackCore
|
||||
void ps_parseCountryData(QNetworkReply *nwReply);
|
||||
|
||||
//! Read / re-read data file
|
||||
void ps_read(BlackMisc::Network::CDbFlags::Entity entities);
|
||||
void ps_read(BlackMisc::Network::CEntityFlags::Entity entities);
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *m_networkManagerAircraft = nullptr;
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace BlackCore
|
||||
return cm;
|
||||
}
|
||||
|
||||
void CModelDataReader::ps_read(CDbFlags::Entity entity)
|
||||
void CModelDataReader::ps_read(CEntityFlags::Entity entity)
|
||||
{
|
||||
this->threadAssertCheck();
|
||||
Q_ASSERT(this->m_networkManagerLivery);
|
||||
@@ -171,29 +171,29 @@ namespace BlackCore
|
||||
Q_ASSERT(!m_urlLiveries.isEmpty());
|
||||
Q_ASSERT(!m_urlDistributors.isEmpty());
|
||||
|
||||
CDbFlags::Entity triggeredRead = CDbFlags::NoEntity;
|
||||
if (entity.testFlag(CDbFlags::LiveryEntity))
|
||||
CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity;
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity))
|
||||
{
|
||||
QNetworkRequest requestLivery(m_urlLiveries);
|
||||
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);
|
||||
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);
|
||||
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)
|
||||
@@ -204,7 +204,7 @@ namespace BlackCore
|
||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||
if (array.isEmpty())
|
||||
{
|
||||
emit readData(CDbFlags::LiveryEntity, CDbFlags::ReadFailed, 0);
|
||||
emit dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFailed, 0);
|
||||
return;
|
||||
}
|
||||
CLiveryList liveries = CLiveryList::fromDatabaseJson(array);
|
||||
@@ -216,7 +216,7 @@ namespace BlackCore
|
||||
this->m_liveries = liveries;
|
||||
n = liveries.size();
|
||||
}
|
||||
emit readData(CDbFlags::LiveryEntity, CDbFlags::ReadFinished, n);
|
||||
emit dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, n);
|
||||
}
|
||||
|
||||
void CModelDataReader::ps_parseDistributorData(QNetworkReply *nwReplyPtr)
|
||||
@@ -225,7 +225,7 @@ namespace BlackCore
|
||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||
if (array.isEmpty())
|
||||
{
|
||||
emit readData(CDbFlags::DistributorEntity, CDbFlags::ReadFailed, 0);
|
||||
emit dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFailed, 0);
|
||||
return;
|
||||
}
|
||||
CDistributorList distributors = CDistributorList::fromDatabaseJson(array);
|
||||
@@ -237,7 +237,7 @@ namespace BlackCore
|
||||
this->m_distributors = distributors;
|
||||
n = distributors.size();
|
||||
}
|
||||
emit readData(CDbFlags::DistributorEntity, CDbFlags::ReadFinished, n);
|
||||
emit dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, n);
|
||||
}
|
||||
|
||||
void CModelDataReader::ps_parseModelData(QNetworkReply *nwReplyPtr)
|
||||
@@ -246,7 +246,7 @@ namespace BlackCore
|
||||
QJsonArray array = this->transformReplyIntoDatastoreResponse(nwReply.data());
|
||||
if (array.isEmpty())
|
||||
{
|
||||
emit readData(CDbFlags::ModelEntity, CDbFlags::ReadFailed, 0);
|
||||
emit dataRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFailed, 0);
|
||||
return;
|
||||
}
|
||||
CAircraftModelList models = CAircraftModelList::fromDatabaseJson(array);
|
||||
@@ -258,7 +258,7 @@ namespace BlackCore
|
||||
this->m_models = models;
|
||||
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)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace BlackCore
|
||||
|
||||
signals:
|
||||
//! 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:
|
||||
//! Liveries have been read
|
||||
@@ -108,7 +108,7 @@ namespace BlackCore
|
||||
void ps_parseModelData(QNetworkReply *nwReply);
|
||||
|
||||
//! 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:
|
||||
QNetworkAccessManager *m_networkManagerLivery = nullptr;
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace BlackCore
|
||||
|
||||
//! \copydoc IWebDataReaderProvider::connectSwiftDatabaseSignals
|
||||
//! \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
|
||||
//! \ingroup webdatareaderprovider
|
||||
@@ -236,7 +236,7 @@ namespace BlackCore
|
||||
void vatsimMetarsRead(int number);
|
||||
|
||||
//! 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
|
||||
void modelWritten(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
@@ -252,7 +252,7 @@ namespace BlackCore
|
||||
void ps_dataFileRead(int lines);
|
||||
|
||||
//! 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:
|
||||
//! Init the readers
|
||||
@@ -261,7 +261,7 @@ namespace BlackCore
|
||||
//! Init the writers
|
||||
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
|
||||
CVatsimBookingReader *m_vatsimBookingReader = nullptr;
|
||||
|
||||
@@ -13,36 +13,41 @@ using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
CWebReaderFlags::WebReader CWebReaderFlags::entityToReader(CDbFlags::Entity entity)
|
||||
CWebReaderFlags::WebReader CWebReaderFlags::entityToReader(CEntityFlags::Entity entity)
|
||||
{
|
||||
WebReader f = None;
|
||||
if (entity.testFlag(CDbFlags::AircraftIcaoEntity) ||
|
||||
entity.testFlag(CDbFlags::AirlineIcaoEntity) ||
|
||||
entity.testFlag(CDbFlags::CountryEntity))
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) ||
|
||||
entity.testFlag(CEntityFlags::AirlineIcaoEntity) ||
|
||||
entity.testFlag(CEntityFlags::CountryEntity))
|
||||
{
|
||||
f |= IcaoDataReader;
|
||||
}
|
||||
|
||||
if (entity.testFlag(CDbFlags::ModelEntity) ||
|
||||
entity.testFlag(CDbFlags::DistributorEntity) ||
|
||||
entity.testFlag(CDbFlags::LiveryEntity))
|
||||
if (entity.testFlag(CEntityFlags::ModelEntity) ||
|
||||
entity.testFlag(CEntityFlags::DistributorEntity) ||
|
||||
entity.testFlag(CEntityFlags::LiveryEntity))
|
||||
{
|
||||
f |= ModelReader;
|
||||
}
|
||||
|
||||
if (entity.testFlag(CDbFlags::VatsimBookings))
|
||||
if (entity.testFlag(CEntityFlags::BookingEntity))
|
||||
{
|
||||
f |= VatsimBookingReader;
|
||||
}
|
||||
|
||||
if (entity.testFlag(CDbFlags::VatsimDataFile))
|
||||
if (entity.testFlag(CEntityFlags::VatsimDataFile))
|
||||
{
|
||||
f |= VatsimDataReader;
|
||||
}
|
||||
|
||||
if (entity.testFlag(CEntityFlags::MetarEntity))
|
||||
{
|
||||
f |= VatsimMetarReader;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
bool CWebReaderFlags::isFromSwiftDb(CDbFlags::Entity entity)
|
||||
bool CWebReaderFlags::isFromSwiftDb(CEntityFlags::Entity entity)
|
||||
{
|
||||
return isFromSwiftDb(entityToReader(entity));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//! \file
|
||||
|
||||
#include "blackcoreexport.h"
|
||||
#include "blackmisc/network/dbflags.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include <QFlags>
|
||||
#include <QMetaType>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace BlackCore
|
||||
{
|
||||
public:
|
||||
//! Which readers to init
|
||||
enum WebReaderFlags
|
||||
enum WebReaderFlag
|
||||
{
|
||||
None = 0, ///< no reader at all
|
||||
VatsimBookingReader = 1 << 0, ///< reader for VATSIM booking data
|
||||
@@ -38,20 +38,20 @@ namespace BlackCore
|
||||
AllSwiftDbReaders = IcaoDataReader | ModelReader, ///< all swift data
|
||||
AllReaders = AllSwiftDbReaders | AllVatsimReaders ///< everything
|
||||
};
|
||||
Q_DECLARE_FLAGS(WebReader, WebReaderFlags)
|
||||
Q_DECLARE_FLAGS(WebReader, WebReaderFlag)
|
||||
|
||||
//! 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
|
||||
static bool isFromSwiftDb(BlackMisc::Network::CDbFlags::Entity entity);
|
||||
static bool isFromSwiftDb(BlackMisc::Network::CEntityFlags::Entity entity);
|
||||
|
||||
//! Read from swift DB
|
||||
static bool isFromSwiftDb(WebReader reader);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackCore::CWebReaderFlags::WebReaderFlags)
|
||||
Q_DECLARE_METATYPE(BlackCore::CWebReaderFlags::WebReaderFlag)
|
||||
Q_DECLARE_METATYPE(BlackCore::CWebReaderFlags::WebReader)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::CWebReaderFlags::WebReader)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
int c = getAircraftIcaoCodesCount();
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
if (entity.testFlag(CDbFlags::AircraftIcaoEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
this->ui->tvp_AircraftIcao->updateContainerMaybeAsync(this->getAircraftIcaoCodes());
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
||||
void CDbAircraftIcaoComponent::ps_reload()
|
||||
{
|
||||
if (!hasProvider()) { return; }
|
||||
triggerRead(CDbFlags::AircraftIcaoEntity);
|
||||
triggerRead(CEntityFlags::AircraftIcaoEntity);
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_reload();
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackGui
|
||||
int c = this->getAircraftIcaoCodesCount();
|
||||
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 (entity.testFlag(CDbFlags::AircraftIcaoEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_dataChanged();
|
||||
|
||||
@@ -47,14 +47,14 @@ namespace BlackGui
|
||||
int c = this->getAirlineIcaoCodesCount();
|
||||
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);
|
||||
if (entity.testFlag(CDbFlags::AirlineIcaoEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
this->ui->tvp_AirlineIcao->updateContainerMaybeAsync(this->getAirlineIcaoCodes());
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace BlackGui
|
||||
void CDbAirlineIcaoComponent::ps_reload()
|
||||
{
|
||||
if (!hasProvider()) { return; }
|
||||
triggerRead(CDbFlags::AirlineIcaoEntity);
|
||||
triggerRead(CEntityFlags::AirlineIcaoEntity);
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_reload();
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace BlackGui
|
||||
int c = this->getAirlineIcaoCodesCount();
|
||||
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 (entity.testFlag(CDbFlags::AirlineIcaoEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_dataChanged();
|
||||
|
||||
@@ -47,14 +47,14 @@ namespace BlackGui
|
||||
int c = getCountriesCount();
|
||||
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);
|
||||
if (entity.testFlag(CDbFlags::CountryEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::CountryEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
this->ui->tvp_Countries->updateContainerMaybeAsync(this->getCountries());
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace BlackGui
|
||||
void CDbCountryComponent::ps_reload()
|
||||
{
|
||||
if (!hasProvider()) { return; }
|
||||
triggerRead(CDbFlags::CountryEntity);
|
||||
triggerRead(CEntityFlags::CountryEntity);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_reload();
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
||||
int c = this->getCountriesCount();
|
||||
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 (entity.testFlag(CDbFlags::DistributorEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_dataChanged();
|
||||
|
||||
@@ -43,14 +43,14 @@ namespace BlackGui
|
||||
int c = getDistributorsCount();
|
||||
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);
|
||||
if (entity.testFlag(CDbFlags::DistributorEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
this->ui->tvp_Distributors->updateContainer(this->getDistributors());
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace BlackGui
|
||||
void CDbDistributorComponent::ps_reload()
|
||||
{
|
||||
if (!hasProvider()) { return; }
|
||||
triggerRead(CDbFlags::DistributorEntity);
|
||||
triggerRead(CEntityFlags::DistributorEntity);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_reload();
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackGui
|
||||
int c = getDistributorsCount();
|
||||
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 (entity.testFlag(CDbFlags::DistributorEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_dataChanged();
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
int c = getLiveriesCount();
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
if (entity.testFlag(CDbFlags::LiveryEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
this->ui->tvp_Liveries->updateContainerMaybeAsync(this->getLiveries());
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
||||
void CDbLiveryComponent::ps_reload()
|
||||
{
|
||||
if (!hasProvider()) { return; }
|
||||
triggerRead(CDbFlags::LiveryEntity);
|
||||
triggerRead(CEntityFlags::LiveryEntity);
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_reload();
|
||||
|
||||
@@ -51,14 +51,14 @@ namespace BlackGui
|
||||
int c = getModelsCount();
|
||||
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);
|
||||
if (entity.testFlag(CDbFlags::ModelEntity) && readState == CDbFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::ModelEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
this->ui->tvp_AircraftModel->updateContainer(this->getModels());
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
||||
void CDbModelComponent::ps_reload()
|
||||
{
|
||||
if (!hasProvider()) { return; }
|
||||
triggerRead(CDbFlags::ModelEntity);
|
||||
triggerRead(CEntityFlags::ModelEntity);
|
||||
}
|
||||
|
||||
void CDbModelComponent::ps_onStyleSheetChanged()
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
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);
|
||||
if (swift && count > 0)
|
||||
@@ -88,7 +88,7 @@ namespace BlackGui
|
||||
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)
|
||||
{
|
||||
@@ -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");
|
||||
int blinkTime = 2.5 * 1000;
|
||||
switch (readState)
|
||||
{
|
||||
case CDbFlags::ReadFinished:
|
||||
case CEntityFlags::ReadFinished:
|
||||
led->setOn(true, blinkTime);
|
||||
break;
|
||||
case CDbFlags::StartRead:
|
||||
case CEntityFlags::StartRead:
|
||||
led->setOn(true);
|
||||
break;
|
||||
case CDbFlags::ReadFailed:
|
||||
case CEntityFlags::ReadFailed:
|
||||
led->setTriState(2 * blinkTime);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QList<CLedWidget *> CInfoBarWebReadersStatusComponent::entityToLeds(CDbFlags::Entity entity) const
|
||||
QList<CLedWidget *> CInfoBarWebReadersStatusComponent::entityToLeds(CEntityFlags::Entity entity) const
|
||||
{
|
||||
QList<CLedWidget *> leds;
|
||||
if (entity.testFlag(CDbFlags::CountryEntity)) { leds << ui->led_Countries; }
|
||||
if (entity.testFlag(CDbFlags::DistributorEntity)) { leds << ui->led_Distributors; }
|
||||
if (entity.testFlag(CDbFlags::AircraftIcaoEntity)) { leds << ui->led_IcaoAircraft; }
|
||||
if (entity.testFlag(CDbFlags::AirlineIcaoEntity)) { leds << ui->led_IcaoAirline; }
|
||||
if (entity.testFlag(CDbFlags::LiveryEntity)) { leds << ui->led_Liveries; }
|
||||
if (entity.testFlag(CDbFlags::ModelEntity)) { leds << ui->led_Models; }
|
||||
if (entity.testFlag(CEntityFlags::CountryEntity)) { leds << ui->led_Countries; }
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity)) { leds << ui->led_Distributors; }
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity)) { leds << ui->led_IcaoAircraft; }
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity)) { leds << ui->led_IcaoAirline; }
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity)) { leds << ui->led_Liveries; }
|
||||
if (entity.testFlag(CEntityFlags::ModelEntity)) { leds << ui->led_Models; }
|
||||
return leds;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! 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
|
||||
void ps_checkServerAndData();
|
||||
@@ -56,13 +56,13 @@ namespace BlackGui
|
||||
QTimer m_timer { this };
|
||||
|
||||
//! 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
|
||||
void setLedReadState(CLedWidget *led, BlackMisc::Network::CDbFlags::ReadState readState);
|
||||
void setLedReadState(CLedWidget *led, BlackMisc::Network::CEntityFlags::ReadState readState);
|
||||
|
||||
//! 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
|
||||
bool hasAllData() const;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "blackmisc/network/network.h"
|
||||
#include "blackmisc/network/dbflags.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
/*
|
||||
* Metadata for Network
|
||||
@@ -28,12 +28,5 @@ void BlackMisc::Network::registerMetadata()
|
||||
CClient::registerMetadata();
|
||||
CClientList::registerMetadata();
|
||||
CVoiceCapabilities::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);
|
||||
CEntityFlags::registerMetadata();
|
||||
}
|
||||
|
||||
@@ -7,19 +7,21 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/network/dbflags.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/dbus.h"
|
||||
#include <QtDBus/QDBusMetaType>
|
||||
#include <QStringList>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
QString CDbFlags::flagToString(CDbFlags::EntityFlags flag)
|
||||
QString CEntityFlags::flagToString(CEntityFlags::EntityFlag flag)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
case NoEntity: return "no data";
|
||||
case VatsimBookings: return "VATSIM bookings";
|
||||
case BookingEntity: return "VATSIM bookings";
|
||||
case VatsimDataFile: return "VATSIM data file";
|
||||
case AircraftIcaoEntity: return "Aircraft ICAO";
|
||||
case AirlineIcaoEntity: return "Airline ICAO";
|
||||
@@ -36,11 +38,11 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
QString CDbFlags::flagToString(Entity flag)
|
||||
QString CEntityFlags::flagToString(Entity flag)
|
||||
{
|
||||
QStringList list;
|
||||
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(AircraftIcaoEntity)) list << "Aircraft ICAO";
|
||||
if (flag.testFlag(AirlineIcaoEntity)) list << "Airline ICAO";
|
||||
@@ -51,7 +53,7 @@ namespace BlackMisc
|
||||
return list.join(',');
|
||||
}
|
||||
|
||||
QString CDbFlags::flagToString(CDbFlags::ReadState flag)
|
||||
QString CEntityFlags::flagToString(CEntityFlags::ReadState flag)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
@@ -63,5 +65,25 @@ namespace BlackMisc
|
||||
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
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_NETWORK_ENTITREADERFLAGS_H
|
||||
#define BLACKMISC_NETWORK_ENTITREADERFLAGS_H
|
||||
#ifndef BLACKMISC_NETWORK_ENTITRFLAGS_H
|
||||
#define BLACKMISC_NETWORK_ENTITRFLAGS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QObject>
|
||||
@@ -20,29 +20,30 @@ namespace BlackMisc
|
||||
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:
|
||||
//! Which data to read, requires corresponding readers
|
||||
enum EntityFlags
|
||||
enum EntityFlag
|
||||
{
|
||||
NoEntity = 0, ///< no data at all
|
||||
VatsimBookings = 1 << 0, ///< bookings
|
||||
VatsimDataFile = 1 << 1, ///< the VATSIM data file
|
||||
AircraftIcaoEntity = 1 << 2, ///< ICAO codes for aircraft
|
||||
AirlineIcaoEntity = 1 << 3, ///< ICAO codes for airlines
|
||||
CountryEntity = 1 << 4, ///< Country codes
|
||||
DistributorEntity = 1 << 5, ///< distributors
|
||||
LiveryEntity = 1 << 6, ///< liveries
|
||||
ModelEntity = 1 << 7, ///< models
|
||||
VatsimDataFile = 1 << 0, ///< the VATSIM data file (multiple data entities)
|
||||
BookingEntity = 1 << 1, ///< bookings
|
||||
MetarEntity = 1 << 2,
|
||||
AircraftIcaoEntity = 1 << 3, ///< ICAO codes for aircraft
|
||||
AirlineIcaoEntity = 1 << 4, ///< ICAO codes for airlines
|
||||
CountryEntity = 1 << 5, ///< country codes
|
||||
DistributorEntity = 1 << 6, ///< distributors
|
||||
LiveryEntity = 1 << 7, ///< liveries
|
||||
ModelEntity = 1 << 8, ///< models
|
||||
AllIcaoEntities = AircraftIcaoEntity | AirlineIcaoEntity, ///< all ICAO codes
|
||||
AllIcaoAndCountries = AircraftIcaoEntity | AirlineIcaoEntity | CountryEntity, ///< all ICAO codes and countries
|
||||
DistributorLiveryModel = DistributorEntity | LiveryEntity | ModelEntity, ///< Combinded
|
||||
AllEntities = 0xFFFF ///< everything
|
||||
};
|
||||
Q_DECLARE_FLAGS(Entity, EntityFlags)
|
||||
Q_DECLARE_FLAGS(Entity, EntityFlag)
|
||||
|
||||
//! State of operation
|
||||
enum ReadState
|
||||
@@ -53,20 +54,23 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Convert to string
|
||||
static QString flagToString(EntityFlags flag);
|
||||
static QString flagToString(EntityFlag flag);
|
||||
|
||||
//! Convert to string
|
||||
static QString flagToString(BlackMisc::Network::CDbFlags::Entity flag);
|
||||
static QString flagToString(BlackMisc::Network::CEntityFlags::Entity flag);
|
||||
|
||||
//! Convert to string
|
||||
static QString flagToString(ReadState flag);
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CDbFlags::EntityFlags)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CDbFlags::Entity)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CDbFlags::ReadState)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Network::CDbFlags::Entity)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::EntityFlag)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::Entity)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::ReadState)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Network::CEntityFlags::Entity)
|
||||
|
||||
#endif // guard
|
||||
@@ -34,7 +34,7 @@ namespace BlackMisc
|
||||
public:
|
||||
|
||||
//! Simulator
|
||||
enum SimulatorFlags
|
||||
enum SimulatorFlag
|
||||
{
|
||||
None = 0,
|
||||
FSX = 1 << 0,
|
||||
@@ -45,7 +45,7 @@ namespace BlackMisc
|
||||
AllMS = FSX | FS9 | P3D,
|
||||
All = FSX | FS9 | XPLANE | P3D
|
||||
};
|
||||
Q_DECLARE_FLAGS(Simulator, SimulatorFlags)
|
||||
Q_DECLARE_FLAGS(Simulator, SimulatorFlag)
|
||||
|
||||
//! Default constructor
|
||||
CSimulatorInfo();
|
||||
@@ -130,7 +130,7 @@ BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Simulation::CSimulatorInfo, (
|
||||
attr(o.m_simulator)
|
||||
))
|
||||
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)
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace BlackCoreTest
|
||||
m_icaoReader.start();
|
||||
Expect e(&this->m_icaoReader);
|
||||
EXPECT_UNIT(e)
|
||||
.send(&CIcaoDataReader::readInBackgroundThread, CDbFlags::AllIcaoEntities)
|
||||
.expect(&CIcaoDataReader::readData, [server]()
|
||||
.send(&CIcaoDataReader::readInBackgroundThread, CEntityFlags::AllIcaoEntities)
|
||||
.expect(&CIcaoDataReader::dataRead, [server]()
|
||||
{
|
||||
qDebug() << "Read ICAO data from" << server;
|
||||
})
|
||||
@@ -68,8 +68,8 @@ namespace BlackCoreTest
|
||||
m_modelReader.start();
|
||||
Expect e(&this->m_modelReader);
|
||||
EXPECT_UNIT(e)
|
||||
.send(&CModelDataReader::readInBackgroundThread, CDbFlags::AllIcaoEntities)
|
||||
.expect(&CModelDataReader::readData, [server]()
|
||||
.send(&CModelDataReader::readInBackgroundThread, CEntityFlags::AllIcaoEntities)
|
||||
.expect(&CModelDataReader::dataRead, [server]()
|
||||
{
|
||||
// CDbFlags::flagToString(entity) << CDbFlags::flagToString(state) << number
|
||||
qDebug() << "Read model data " << server;
|
||||
|
||||
Reference in New Issue
Block a user