mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Functions to select distributor/ICAO in component
This commit is contained in:
committed by
Mat Sutcliffe
parent
30b65d6c36
commit
5eeb29bafe
@@ -59,6 +59,12 @@ namespace BlackGui
|
|||||||
ui->filter_AircraftIcao->filter(icao);
|
ui->filter_AircraftIcao->filter(icao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDbAircraftIcaoComponent::selectAircraftIcao(const CAircraftIcaoCode &icao)
|
||||||
|
{
|
||||||
|
if (!icao.isLoadedFromDb()) { return false; }
|
||||||
|
return ui->tvp_AircraftIcao->selectDbKey(icao.getDbKey());
|
||||||
|
}
|
||||||
|
|
||||||
void CDbAircraftIcaoComponent::onIcaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
void CDbAircraftIcaoComponent::onIcaoRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
|||||||
explicit CDbAircraftIcaoComponent(QWidget *parent = nullptr);
|
explicit CDbAircraftIcaoComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CDbAircraftIcaoComponent();
|
virtual ~CDbAircraftIcaoComponent() override;
|
||||||
|
|
||||||
//! Get the view
|
//! Get the view
|
||||||
BlackGui::Views::CAircraftIcaoCodeView *view() const;
|
BlackGui::Views::CAircraftIcaoCodeView *view() const;
|
||||||
@@ -50,6 +50,9 @@ namespace BlackGui
|
|||||||
//! Filter by ICAO as default
|
//! Filter by ICAO as default
|
||||||
void filter(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
void filter(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||||
|
|
||||||
|
//! Select aircraft ICAO object
|
||||||
|
bool selectAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! ICAO codes have been read
|
//! ICAO codes have been read
|
||||||
void onIcaoRead(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);
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ namespace BlackGui
|
|||||||
return ui->tvp_Distributors->selectedObjects();
|
return ui->tvp_Distributors->selectedObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDbDistributorComponent::selectDistributor(const CDistributor &distributor)
|
||||||
|
{
|
||||||
|
if (ui->tvp_Distributors->isEmpty() || !distributor.isLoadedFromDb()) { return false; }
|
||||||
|
return ui->tvp_Distributors->selectDbKey(distributor.getDbKey());
|
||||||
|
}
|
||||||
|
|
||||||
bool CDbDistributorComponent::hasSelectedDistributors() const
|
bool CDbDistributorComponent::hasSelectedDistributors() const
|
||||||
{
|
{
|
||||||
return ui->tvp_Distributors->hasSelection();
|
return ui->tvp_Distributors->hasSelection();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace BlackGui
|
|||||||
class BLACKGUI_EXPORT CDbDistributorComponent :
|
class BLACKGUI_EXPORT CDbDistributorComponent :
|
||||||
public QFrame,
|
public QFrame,
|
||||||
public CEnableForDockWidgetInfoArea,
|
public CEnableForDockWidgetInfoArea,
|
||||||
public BlackGui::CEnableForViewBasedIndicator
|
public CEnableForViewBasedIndicator
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
|||||||
explicit CDbDistributorComponent(QWidget *parent = nullptr);
|
explicit CDbDistributorComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CDbDistributorComponent();
|
virtual ~CDbDistributorComponent() override;
|
||||||
|
|
||||||
//! Get the view
|
//! Get the view
|
||||||
BlackGui::Views::CDistributorView *view() const;
|
BlackGui::Views::CDistributorView *view() const;
|
||||||
@@ -53,6 +53,9 @@ namespace BlackGui
|
|||||||
//! The selected distributors
|
//! The selected distributors
|
||||||
BlackMisc::Simulation::CDistributorList getSelectedDistributors() const;
|
BlackMisc::Simulation::CDistributorList getSelectedDistributors() const;
|
||||||
|
|
||||||
|
//! Select the given distributor
|
||||||
|
bool selectDistributor(const BlackMisc::Simulation::CDistributor &distributor);
|
||||||
|
|
||||||
//! Having selected distributors
|
//! Having selected distributors
|
||||||
bool hasSelectedDistributors() const;
|
bool hasSelectedDistributors() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user