mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #602, emoved web service provider
* webservices now directly accessible via sGui * interface no longer needed * no init of provider (setProvider) needed anymore
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a0cfa2e687
commit
79f95845b2
@@ -9,17 +9,19 @@
|
||||
|
||||
#include "ui_dbaircrafticaocomponent.h"
|
||||
#include "dbaircrafticaocomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include <functional>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Views;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
CDbAircraftIcaoComponent::CDbAircraftIcaoComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CDbAircraftIcaoComponent)
|
||||
@@ -31,26 +33,14 @@ namespace BlackGui
|
||||
|
||||
this->ui->tvp_AircraftIcao->allowDragDropValueObjects(true, false);
|
||||
this->ui->tvp_AircraftIcao->setFilterWidget(this->ui->filter_AircraftIcao);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoComponent::ps_icaoRead);
|
||||
this->ps_icaoRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAircraftIcaoCodesCount());
|
||||
}
|
||||
|
||||
CDbAircraftIcaoComponent::~CDbAircraftIcaoComponent()
|
||||
{ }
|
||||
|
||||
void CDbAircraftIcaoComponent::setProvider(IWebDataServicesProvider *webDataReaderProvider)
|
||||
{
|
||||
CWebDataServicesAware::setProvider(webDataReaderProvider);
|
||||
this->ui->filter_AircraftIcao->setProvider(webDataReaderProvider);
|
||||
connectDataReadSignal(
|
||||
this,
|
||||
std::bind(&CDbAircraftIcaoComponent::ps_icaoRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
|
||||
);
|
||||
int c = getAircraftIcaoCodesCount();
|
||||
if (c > 0)
|
||||
{
|
||||
ps_icaoRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, c);
|
||||
}
|
||||
}
|
||||
|
||||
void CDbAircraftIcaoComponent::filter(const CAircraftIcaoCode &icao)
|
||||
{
|
||||
this->ui->filter_AircraftIcao->filter(icao);
|
||||
@@ -61,14 +51,14 @@ namespace BlackGui
|
||||
Q_UNUSED(count);
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && readState == CEntityFlags::ReadFinished)
|
||||
{
|
||||
this->ui->tvp_AircraftIcao->updateContainerMaybeAsync(this->getAircraftIcaoCodes());
|
||||
this->ui->tvp_AircraftIcao->updateContainerMaybeAsync(sGui->getWebDataServices()->getAircraftIcaoCodes());
|
||||
}
|
||||
}
|
||||
|
||||
void CDbAircraftIcaoComponent::ps_reload()
|
||||
{
|
||||
if (!hasProvider()) { return; }
|
||||
triggerRead(CEntityFlags::AircraftIcaoEntity, QDateTime());
|
||||
if (!sGui) { return; }
|
||||
sGui->getWebDataServices()->triggerRead(CEntityFlags::AircraftIcaoEntity, QDateTime());
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user