From 6a95abb194a951274ed97a03fc1996ff2e6b98c9 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 31 Oct 2019 02:44:55 +0100 Subject: [PATCH] [UI] Change distributor buttons to BB/XCSL XPlane standard DOES NOT make sense, as it adds AI aircraft --- .../components/dbdistributorcomponent.cpp | 19 +++++++++++++------ .../components/dbdistributorcomponent.ui | 13 ++++++++++--- src/blackmisc/simulation/distributor.cpp | 19 +++++++++++++++++++ src/blackmisc/simulation/distributor.h | 3 +++ 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/blackgui/components/dbdistributorcomponent.cpp b/src/blackgui/components/dbdistributorcomponent.cpp index 7e8c85e5c..8102fb76b 100644 --- a/src/blackgui/components/dbdistributorcomponent.cpp +++ b/src/blackgui/components/dbdistributorcomponent.cpp @@ -38,9 +38,10 @@ namespace BlackGui ui->tvp_Distributors->allowDragDrop(true, false); ui->tvp_Distributors->setFilterWidget(ui->filter_Distributor); - connect(ui->tvp_Distributors, &CDistributorView::requestNewBackendData, this, &CDbDistributorComponent::reload); + connect(ui->tvp_Distributors, &CDistributorView::requestNewBackendData, this, &CDbDistributorComponent::reload); connect(ui->pb_SelectAllFsFamily, &QPushButton::released, this, &CDbDistributorComponent::selectStandardModels); - connect(ui->pb_SelectXPlane, &QPushButton::released, this, &CDbDistributorComponent::selectStandardModels); + connect(ui->pb_SelectXPlaneBB, &QPushButton::released, this, &CDbDistributorComponent::selectStandardModels); + connect(ui->pb_SelectXplaneXCSL, &QPushButton::released, this, &CDbDistributorComponent::selectStandardModels); if (sGui && sGui->getWebDataServices()) { @@ -81,11 +82,12 @@ namespace BlackGui void CDbDistributorComponent::onDistributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count) { - Q_UNUSED(count); + Q_UNUSED(count) if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; } if (entity.testFlag(CEntityFlags::DistributorEntity) && CEntityFlags::isFinishedReadState(readState)) { - ui->tvp_Distributors->updateContainer(sGui->getWebDataServices()->getDistributors()); + const CDistributorList distributors = sGui->getWebDataServices()->getDistributors(); + ui->tvp_Distributors->updateContainer(distributors); } } @@ -98,10 +100,15 @@ namespace BlackGui this->filterBySimulator(CSimulatorInfo::AllFsFamily); keys = CDistributor::standardAllFsFamily(); } - else if (s == ui->pb_SelectXPlane) + else if (s == ui->pb_SelectXPlaneBB) { this->filterBySimulator(CSimulatorInfo::XPLANE); - keys = QSet({ CDistributor::standardXPlane() }); + keys = QSet({ CDistributor::xplaneBlueBell() }); + } + else if (s == ui->pb_SelectXplaneXCSL) + { + this->filterBySimulator(CSimulatorInfo::XPLANE); + keys = QSet({ CDistributor::xplaneXcsl() }); } // deferred because filter must first work and update diff --git a/src/blackgui/components/dbdistributorcomponent.ui b/src/blackgui/components/dbdistributorcomponent.ui index c74f72980..51d7755ff 100644 --- a/src/blackgui/components/dbdistributorcomponent.ui +++ b/src/blackgui/components/dbdistributorcomponent.ui @@ -111,9 +111,16 @@ - + - XPlane standard + XPlane BlueBell + + + + + + + XPlane XCSL @@ -156,7 +163,7 @@ pb_SelectAllFsFamily - pb_SelectXPlane + pb_SelectXPlaneBB tvp_Distributors diff --git a/src/blackmisc/simulation/distributor.cpp b/src/blackmisc/simulation/distributor.cpp index 7885b91f2..422140cbf 100644 --- a/src/blackmisc/simulation/distributor.cpp +++ b/src/blackmisc/simulation/distributor.cpp @@ -218,5 +218,24 @@ namespace BlackMisc static const QSet fsFamily({standardFS9(), standardFSX(), standardP3D()}); return fsFamily; } + + const QSet &CDistributor::xplaneMostPopular() + { + static const QSet mp({ xplaneBlueBell(), xplaneXcsl() }); + return mp; + } + + const QString &CDistributor::xplaneBlueBell() + { + static const QString k("BB"); + return k; + } + + const QString &CDistributor::xplaneXcsl() + { + static const QString k("XCSL"); + return k; + } + } // namespace } // namespace diff --git a/src/blackmisc/simulation/distributor.h b/src/blackmisc/simulation/distributor.h index 71545cbdc..a7654d765 100644 --- a/src/blackmisc/simulation/distributor.h +++ b/src/blackmisc/simulation/distributor.h @@ -132,6 +132,9 @@ namespace BlackMisc static const QString &standardXPlane(); static const QString &standardFlightGear(); static const QSet &standardAllFsFamily(); + static const QSet &xplaneMostPopular(); + static const QString &xplaneBlueBell(); + static const QString &xplaneXcsl(); //! @} private: