mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 05:28:09 +08:00
Ref T292, Ref T285 use CEntityFlags::isFinishedReadState to also check against restricted read plus refactoring
This commit is contained in:
@@ -1326,7 +1326,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// individual signals
|
||||
if (state == CEntityFlags::ReadFinished || state == CEntityFlags::ReadFinishedRestricted)
|
||||
if (CEntityFlags::isFinishedReadState(state))
|
||||
{
|
||||
if (entities.testFlag(CEntityFlags::AirportEntity) && signalEntitiesAlreadyRead(CEntityFlags::AirportEntity)) { emit swiftDbAirportsRead(); }
|
||||
if (entities.testFlag(CEntityFlags::AirlineIcaoEntity) && signalEntitiesAlreadyRead(CEntityFlags::AirlineIcaoEntity)) { emit swiftDbAirlineIcaoRead(); }
|
||||
|
||||
@@ -36,14 +36,14 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
this->setViewWithIndicator(ui->tvp_AircraftIcao);
|
||||
ui->tvp_AircraftIcao->setResizeMode(CAircraftIcaoCodeView::ResizingOff);
|
||||
connect(ui->tvp_AircraftIcao, &CAircraftIcaoCodeView::requestNewBackendData, this, &CDbAircraftIcaoComponent::ps_reload);
|
||||
connect(ui->tvp_AircraftIcao, &CAircraftIcaoCodeView::requestNewBackendData, this, &CDbAircraftIcaoComponent::onReload);
|
||||
|
||||
ui->tvp_AircraftIcao->allowDragDrop(true, false);
|
||||
ui->tvp_AircraftIcao->setFilterWidget(ui->filter_AircraftIcao);
|
||||
ui->tvp_AircraftIcao->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoComponent::ps_icaoRead);
|
||||
this->ps_icaoRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAircraftIcaoCodesCount());
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoComponent::onIcaoRead);
|
||||
this->onIcaoRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAircraftIcaoCodesCount());
|
||||
}
|
||||
|
||||
CDbAircraftIcaoComponent::~CDbAircraftIcaoComponent()
|
||||
@@ -59,18 +59,19 @@ namespace BlackGui
|
||||
ui->filter_AircraftIcao->filter(icao);
|
||||
}
|
||||
|
||||
void CDbAircraftIcaoComponent::ps_icaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
void CDbAircraftIcaoComponent::onIcaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
ui->tvp_AircraftIcao->updateContainerMaybeAsync(sGui->getWebDataServices()->getAircraftIcaoCodes());
|
||||
}
|
||||
}
|
||||
|
||||
void CDbAircraftIcaoComponent::ps_reload()
|
||||
void CDbAircraftIcaoComponent::onReload()
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
sGui->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::AircraftIcaoEntity, QDateTime());
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -54,12 +54,12 @@ namespace BlackGui
|
||||
//! Filter by ICAO as default
|
||||
void filter(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! ICAO codes have been read
|
||||
void ps_icaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
void onIcaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Reload models
|
||||
void ps_reload();
|
||||
void onReload();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbAircraftIcaoComponent> ui;
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace BlackGui
|
||||
void CDbAircraftIcaoSelectorComponent::onCodesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
if (!sGui || !sGui->hasWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace BlackGui
|
||||
ui->tvp_AirlineIcao->setFilterWidget(ui->filter_AirlineIcao);
|
||||
ui->tvp_AirlineIcao->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(ui->tvp_AirlineIcao, &CAirlineIcaoCodeView::requestNewBackendData, this, &CDbAirlineIcaoComponent::ps_reload);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAirlineIcaoComponent::ps_icaoRead);
|
||||
this->ps_icaoRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAirlineIcaoCodesCount());
|
||||
connect(ui->tvp_AirlineIcao, &CAirlineIcaoCodeView::requestNewBackendData, this, &CDbAirlineIcaoComponent::onReload);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAirlineIcaoComponent::onIcaoRead);
|
||||
this->onIcaoRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAirlineIcaoCodesCount());
|
||||
}
|
||||
|
||||
CDbAirlineIcaoComponent::~CDbAirlineIcaoComponent()
|
||||
@@ -54,18 +54,19 @@ namespace BlackGui
|
||||
return ui->tvp_AirlineIcao;
|
||||
}
|
||||
|
||||
void CDbAirlineIcaoComponent::ps_icaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
void CDbAirlineIcaoComponent::onIcaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
ui->tvp_AirlineIcao->updateContainerMaybeAsync(sGui->getWebDataServices()->getAirlineIcaoCodes());
|
||||
}
|
||||
}
|
||||
|
||||
void CDbAirlineIcaoComponent::ps_reload()
|
||||
void CDbAirlineIcaoComponent::onReload()
|
||||
{
|
||||
if (!sGui || !sGui->hasWebDataServices()) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
sGui->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::AirlineIcaoEntity, QDateTime());
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Ui { class CDbAirlineIcaoComponent; }
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -35,7 +33,7 @@ namespace BlackGui
|
||||
class BLACKGUI_EXPORT CDbAirlineIcaoComponent :
|
||||
public QFrame,
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public BlackGui::CEnableForViewBasedIndicator
|
||||
public CEnableForViewBasedIndicator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -44,17 +42,17 @@ namespace BlackGui
|
||||
explicit CDbAirlineIcaoComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CDbAirlineIcaoComponent();
|
||||
virtual ~CDbAirlineIcaoComponent();
|
||||
|
||||
//! Get the view
|
||||
BlackGui::Views::CAirlineIcaoCodeView *view() const;
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! ICAO codes have been read
|
||||
void ps_icaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
void onIcaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Reload models
|
||||
void ps_reload();
|
||||
void onReload();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbAirlineIcaoComponent> ui;
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace BlackGui
|
||||
}
|
||||
else if (valueVariant.canConvert<CAirlineIcaoCodeList>())
|
||||
{
|
||||
CAirlineIcaoCodeList icaos(valueVariant.value<CAirlineIcaoCodeList>());
|
||||
const CAirlineIcaoCodeList icaos(valueVariant.value<CAirlineIcaoCodeList>());
|
||||
if (icaos.isEmpty()) { return; }
|
||||
this->setAirlineIcao(icaos.front());
|
||||
}
|
||||
@@ -135,7 +135,7 @@ namespace BlackGui
|
||||
void CDbAirlineIcaoSelectorBase::onCodesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
@@ -33,31 +33,32 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
this->setViewWithIndicator(ui->tvp_Countries);
|
||||
ui->tvp_Countries->setResizeMode(CViewBaseNonTemplate::ResizingOnce);
|
||||
connect(ui->tvp_Countries, &CCountryView::requestNewBackendData, this, &CDbCountryComponent::ps_reload);
|
||||
connect(ui->tvp_Countries, &CCountryView::requestNewBackendData, this, &CDbCountryComponent::onReload);
|
||||
|
||||
// filter and drag and drop
|
||||
ui->tvp_Countries->setFilterWidget(ui->filter_CountryComponent);
|
||||
ui->tvp_Countries->allowDragDrop(true, false);
|
||||
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbCountryComponent::ps_countriesRead);
|
||||
this->ps_countriesRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getCountriesCount());
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbCountryComponent::onCountriesRead);
|
||||
this->onCountriesRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getCountriesCount());
|
||||
}
|
||||
|
||||
CDbCountryComponent::~CDbCountryComponent()
|
||||
{ }
|
||||
|
||||
void CDbCountryComponent::ps_countriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
void CDbCountryComponent::onCountriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (entity.testFlag(CEntityFlags::CountryEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::CountryEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
ui->tvp_Countries->updateContainerMaybeAsync(sApp->getWebDataServices()->getCountries());
|
||||
}
|
||||
}
|
||||
|
||||
void CDbCountryComponent::ps_reload()
|
||||
void CDbCountryComponent::onReload()
|
||||
{
|
||||
if (!sGui || !sGui->getWebDataServices()) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
sApp->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::CountryEntity);
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -45,12 +45,12 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
virtual ~CDbCountryComponent();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! Countries have been read
|
||||
void ps_countriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
void onCountriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Reload models
|
||||
void ps_reload();
|
||||
void onReload();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbCountryComponent> ui;
|
||||
|
||||
@@ -156,8 +156,8 @@ namespace BlackGui
|
||||
|
||||
void CDbCountrySelectorComponent::onCountriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
@@ -168,18 +168,18 @@ namespace BlackGui
|
||||
connect(c, static_cast<void (QCompleter::*)(const QString &)>(&QCompleter::activated), this, &CDbCountrySelectorComponent::onCompleterActivated);
|
||||
|
||||
ui->le_CountryName->setCompleter(c);
|
||||
this->m_completerCountryNames.reset(c); // deletes any old completer
|
||||
m_completerCountryNames.reset(c); // deletes any old completer
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_completerCountryNames.reset(nullptr);
|
||||
m_completerCountryNames.reset(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CDbCountrySelectorComponent::onDataChanged()
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
QObject *sender = this->sender();
|
||||
if (sender == ui->le_CountryIso)
|
||||
{
|
||||
|
||||
@@ -40,8 +40,8 @@ namespace BlackGui
|
||||
ui->tvp_Distributors->setFilterWidget(ui->filter_Distributor);
|
||||
|
||||
connect(ui->tvp_Distributors, &CDistributorView::requestNewBackendData, this, &CDbDistributorComponent::reload);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbDistributorComponent::distributorsRead);
|
||||
this->distributorsRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getDistributorsCount());
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbDistributorComponent::onDistributorsRead, Qt::QueuedConnection);
|
||||
this->onDistributorsRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getDistributorsCount());
|
||||
}
|
||||
|
||||
CDbDistributorComponent::~CDbDistributorComponent()
|
||||
@@ -67,10 +67,11 @@ namespace BlackGui
|
||||
return ui->tvp_Distributors->hasSelection();
|
||||
}
|
||||
|
||||
void CDbDistributorComponent::distributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
void CDbDistributorComponent::onDistributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
ui->tvp_Distributors->updateContainer(sGui->getWebDataServices()->getDistributors());
|
||||
}
|
||||
@@ -78,7 +79,7 @@ namespace BlackGui
|
||||
|
||||
void CDbDistributorComponent::reload()
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
sGui->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::DistributorEntity);
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Ui { class CDbDistributorComponent; }
|
||||
namespace BlackMisc { namespace Simulation { class CSimulatorInfo; }}
|
||||
namespace BlackGui
|
||||
@@ -63,7 +61,7 @@ namespace BlackGui
|
||||
QScopedPointer<Ui::CDbDistributorComponent> ui;
|
||||
|
||||
//! Distributors have been read
|
||||
void distributorsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
void onDistributorsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Reload models
|
||||
void reload();
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace BlackGui
|
||||
void CDbDistributorSelectorComponent::onDistributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (entity.testFlag(CEntityFlags::DistributorEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
@@ -31,15 +31,15 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setViewWithIndicator(ui->tvp_Liveries);
|
||||
connect(ui->tvp_Liveries, &CLiveryView::requestNewBackendData, this, &CDbLiveryComponent::ps_reload);
|
||||
connect(ui->tvp_Liveries, &CLiveryView::requestNewBackendData, this, &CDbLiveryComponent::onReload);
|
||||
|
||||
// filter and drag and drop
|
||||
ui->tvp_Liveries->setFilterWidget(ui->filter_Livery);
|
||||
ui->tvp_Liveries->allowDragDrop(true, false);
|
||||
ui->tvp_Liveries->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLiveryComponent::ps_liveriesRead);
|
||||
this->ps_liveriesRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getLiveriesCount());
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLiveryComponent::onLiveriesRead);
|
||||
this->onLiveriesRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getLiveriesCount());
|
||||
}
|
||||
|
||||
CDbLiveryComponent::~CDbLiveryComponent()
|
||||
@@ -60,18 +60,19 @@ namespace BlackGui
|
||||
ui->filter_Livery->filter(icao);
|
||||
}
|
||||
|
||||
void CDbLiveryComponent::ps_liveriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
void CDbLiveryComponent::onLiveriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
ui->tvp_Liveries->updateContainerMaybeAsync(sGui->getWebDataServices()->getLiveries());
|
||||
}
|
||||
}
|
||||
|
||||
void CDbLiveryComponent::ps_reload()
|
||||
void CDbLiveryComponent::onReload()
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
sGui->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::LiveryEntity);
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -58,12 +58,12 @@ namespace BlackGui
|
||||
//! Filter by airline ICAO
|
||||
void filterByAirline(const BlackMisc::Aviation::CAirlineIcaoCode &icao);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! Liveries codes have been read
|
||||
void ps_liveriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
void onLiveriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Reload models
|
||||
void ps_reload();
|
||||
void onReload();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbLiveryComponent> ui;
|
||||
|
||||
@@ -51,11 +51,11 @@ namespace BlackGui
|
||||
|
||||
ui->le_Livery->setValidator(new CUpperCaseValidator(this));
|
||||
|
||||
connect(ui->le_Livery, &QLineEdit::returnPressed, this, &CDbLiverySelectorComponent::ps_dataChanged);
|
||||
connect(ui->le_Livery, &QLineEdit::returnPressed, this, &CDbLiverySelectorComponent::ps_dataChanged);
|
||||
connect(ui->le_Livery, &QLineEdit::returnPressed, this, &CDbLiverySelectorComponent::onDataChanged);
|
||||
connect(ui->le_Livery, &QLineEdit::returnPressed, this, &CDbLiverySelectorComponent::onDataChanged);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLiverySelectorComponent::ps_liveriesRead);
|
||||
this->ps_liveriesRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getLiveriesCount());
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLiverySelectorComponent::onLiveriesRead, Qt::QueuedConnection);
|
||||
this->onLiveriesRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getLiveriesCount());
|
||||
}
|
||||
|
||||
CDbLiverySelectorComponent::~CDbLiverySelectorComponent()
|
||||
@@ -87,7 +87,7 @@ namespace BlackGui
|
||||
s = liveryCode.indexOf('(');
|
||||
if (s >= 1) { liveryCode = liveryCode.left(s).trimmed(); }
|
||||
|
||||
if (this->m_currentLivery.matchesCombinedCode(liveryCode)) { return; }
|
||||
if (m_currentLivery.matchesCombinedCode(liveryCode)) { return; }
|
||||
CLivery d(sApp->getWebDataServices()->getLiveries().findByCombinedCode(liveryCode));
|
||||
if (d.hasCompleteData())
|
||||
{
|
||||
@@ -114,7 +114,7 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->m_currentLivery;
|
||||
return m_currentLivery;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace BlackGui
|
||||
void CDbLiverySelectorComponent::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (!event || !acceptDrop(event->mimeData())) { return; }
|
||||
setBackgroundRole(QPalette::Highlight);
|
||||
this->setBackgroundRole(QPalette::Highlight);
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
@@ -171,23 +171,23 @@ namespace BlackGui
|
||||
{
|
||||
if (valueVariant.canConvert<CLivery>())
|
||||
{
|
||||
CLivery livery(valueVariant.value<CLivery>());
|
||||
const CLivery livery(valueVariant.value<CLivery>());
|
||||
if (!livery.hasValidDbKey()) { return; }
|
||||
this->setLivery(livery);
|
||||
}
|
||||
else if (valueVariant.canConvert<CLiveryList>())
|
||||
{
|
||||
CLiveryList liveries(valueVariant.value<CLiveryList>());
|
||||
const CLiveryList liveries(valueVariant.value<CLiveryList>());
|
||||
if (liveries.isEmpty()) { return; }
|
||||
this->setLivery(liveries.front());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CDbLiverySelectorComponent::ps_liveriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
void CDbLiverySelectorComponent::onLiveriesRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
if (!sApp) { return; }
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity) && readState == CEntityFlags::ReadFinished)
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
@@ -196,21 +196,21 @@ namespace BlackGui
|
||||
c->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
c->setCompletionMode(QCompleter::PopupCompletion);
|
||||
c->setMaxVisibleItems(10);
|
||||
connect(c, static_cast<void (QCompleter::*)(const QString &)>(&QCompleter::activated), this, &CDbLiverySelectorComponent::ps_completerActivated);
|
||||
connect(c, static_cast<void (QCompleter::*)(const QString &)>(&QCompleter::activated), this, &CDbLiverySelectorComponent::onCompleterActivated);
|
||||
|
||||
ui->le_Livery->setCompleter(c);
|
||||
m_completerLiveries.reset(c); // deletes any old completer
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_completerLiveries.reset(nullptr);
|
||||
m_completerLiveries.reset(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CDbLiverySelectorComponent::ps_dataChanged()
|
||||
void CDbLiverySelectorComponent::onDataChanged()
|
||||
{
|
||||
if (!sApp) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
const QString code(
|
||||
this->stripExtraInfo(ui->le_Livery->text())
|
||||
);
|
||||
@@ -219,7 +219,7 @@ namespace BlackGui
|
||||
this->setLivery(livery);
|
||||
}
|
||||
|
||||
void CDbLiverySelectorComponent::ps_completerActivated(const QString &liveryCode)
|
||||
void CDbLiverySelectorComponent::onCompleterActivated(const QString &liveryCode)
|
||||
{
|
||||
this->setlivery(liveryCode);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
||||
explicit CDbLiverySelectorComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CDbLiverySelectorComponent();
|
||||
virtual ~CDbLiverySelectorComponent();
|
||||
|
||||
//! Current livery
|
||||
void setLivery(const BlackMisc::Aviation::CLivery &livery);
|
||||
@@ -93,17 +93,16 @@ namespace BlackGui
|
||||
//! \copydoc QWidget::dropEvent
|
||||
virtual void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! Data have been changed
|
||||
void ps_dataChanged();
|
||||
void onDataChanged();
|
||||
|
||||
//! Completer activated
|
||||
void ps_completerActivated(const QString &liveryCode);
|
||||
void onCompleterActivated(const QString &liveryCode);
|
||||
|
||||
//! Distributors have been read
|
||||
void ps_liveriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
void onLiveriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
private:
|
||||
//! Strip extra info from livery code
|
||||
QString stripExtraInfo(const QString &liveryCode) const;
|
||||
|
||||
|
||||
@@ -44,16 +44,16 @@ namespace BlackGui
|
||||
ui->tvp_AircraftModel->menuAddItems(CAircraftModelView::MenuStashing);
|
||||
ui->tvp_AircraftModel->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
ui->tvp_AircraftModel->menuRemoveItems(CAircraftModelView::MenuHighlightStashed); // not supported here
|
||||
connect(ui->tvp_AircraftModel, &CAircraftModelView::requestNewBackendData, this, &CDbModelComponent::ps_reload);
|
||||
connect(ui->tvp_AircraftModel, &CAircraftModelView::requestNewBackendData, this, &CDbModelComponent::onReload);
|
||||
connect(ui->tvp_AircraftModel, &CAircraftModelView::requestStash, this, &CDbModelComponent::requestStash);
|
||||
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CDbModelComponent::ps_onStyleSheetChanged);
|
||||
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CDbModelComponent::onStyleSheetChanged);
|
||||
|
||||
// configure view
|
||||
ui->tvp_AircraftModel->setFilterWidget(ui->filter_AircraftModelFilter);
|
||||
ui->tvp_AircraftModel->allowDragDrop(true, false);
|
||||
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbModelComponent::ps_modelsRead);
|
||||
this->ps_modelsRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFinished, sApp->getWebDataServices()->getModelsCount());
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbModelComponent::onModelsRead);
|
||||
this->onModelsRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFinished, sApp->getWebDataServices()->getModelsCount());
|
||||
}
|
||||
|
||||
CDbModelComponent::~CDbModelComponent()
|
||||
@@ -77,37 +77,29 @@ namespace BlackGui
|
||||
sGui->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::ModelEntity, ts);
|
||||
}
|
||||
|
||||
void CDbModelComponent::ps_modelsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
void CDbModelComponent::onModelsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::ModelEntity))
|
||||
{
|
||||
if (readState == CEntityFlags::ReadFinished || readState == CEntityFlags::ReadFinishedRestricted)
|
||||
if (CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
ui->tvp_AircraftModel->updateContainerMaybeAsync(sGui->getWebDataServices()->getModels());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CDbModelComponent::ps_reload()
|
||||
void CDbModelComponent::onReload()
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
sGui->getWebDataServices()->triggerLoadingDirectlyFromDb(CEntityFlags::ModelEntity);
|
||||
}
|
||||
|
||||
void CDbModelComponent::ps_onStyleSheetChanged()
|
||||
void CDbModelComponent::onStyleSheetChanged()
|
||||
{
|
||||
// code goes here
|
||||
}
|
||||
|
||||
void CDbModelComponent::ps_stashSelectedModels()
|
||||
{
|
||||
if (!ui->tvp_AircraftModel->hasSelection()) { return; }
|
||||
const CAircraftModelList models(ui->tvp_AircraftModel->selectedObjects());
|
||||
if (!models.isEmpty())
|
||||
{
|
||||
emit requestStash(models);
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -59,22 +59,19 @@ namespace BlackGui
|
||||
//! Request to stash the selected models
|
||||
void requestStash(const BlackMisc::Simulation::CAircraftModelList &models);
|
||||
|
||||
public slots:
|
||||
public:
|
||||
//! Load new data
|
||||
void requestUpdatedData();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
//! Models have been read
|
||||
void ps_modelsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
void onModelsRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Reload models
|
||||
void ps_reload();
|
||||
void onReload();
|
||||
|
||||
//! Style sheet changed
|
||||
void ps_onStyleSheetChanged();
|
||||
|
||||
//! Stash the selected models
|
||||
void ps_stashSelectedModels();
|
||||
void onStyleSheetChanged();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbModelComponent> ui;
|
||||
|
||||
@@ -304,7 +304,7 @@ namespace BlackGui
|
||||
|
||||
void CLoginComponent::onWebServiceDataRead(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)
|
||||
{
|
||||
if (state != CEntityFlags::ReadFinished) { return; }
|
||||
if (!CEntityFlags::isFinishedReadState(state)) { return; }
|
||||
Q_UNUSED(number);
|
||||
|
||||
if (entity == CEntityFlags::VatsimDataFile)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackGui
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CModelMatcherComponent::onSimulatorChanged);
|
||||
connect(ui->pb_ModelMatching, &QPushButton::pressed, this, &CModelMatcherComponent::testModelMatching);
|
||||
connect(ui->pb_ReverseLookup, &QPushButton::pressed, this, &CModelMatcherComponent::reverseLookup);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CModelMatcherComponent::onWebDataRed);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CModelMatcherComponent::onWebDataRead);
|
||||
|
||||
this->redisplay();
|
||||
}
|
||||
@@ -137,9 +137,9 @@ namespace BlackGui
|
||||
ui->tvp_ResultMessages->updateContainer(msgs);
|
||||
}
|
||||
|
||||
void CModelMatcherComponent::onWebDataRed(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)
|
||||
void CModelMatcherComponent::onWebDataRead(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)
|
||||
{
|
||||
if (number > 0 && entity.testFlag(CEntityFlags::ModelEntity) && state == CEntityFlags::ReadFinished)
|
||||
if (number > 0 && entity.testFlag(CEntityFlags::ModelEntity) && CEntityFlags::isFinishedReadState(state))
|
||||
{
|
||||
const QStringList modelStrings(sGui->getWebDataServices()->getModelStrings(true));
|
||||
ui->le_ModelString->setCompleter(new QCompleter(modelStrings, this));
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
void onCacheChanged(BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Web data have been read
|
||||
void onWebDataRed(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||
void onWebDataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||
|
||||
//! Run the matcher
|
||||
void testModelMatching();
|
||||
|
||||
Reference in New Issue
Block a user