[UI] Change distributor buttons to BB/XCSL

XPlane standard DOES NOT make sense, as it adds AI aircraft
This commit is contained in:
Klaus Basan
2019-10-31 02:44:55 +01:00
committed by Mat Sutcliffe
parent 32c6ef3fd6
commit 6a95abb194
4 changed files with 45 additions and 9 deletions

View File

@@ -38,9 +38,10 @@ namespace BlackGui
ui->tvp_Distributors->allowDragDrop(true, false); ui->tvp_Distributors->allowDragDrop(true, false);
ui->tvp_Distributors->setFilterWidget(ui->filter_Distributor); 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_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()) if (sGui && sGui->getWebDataServices())
{ {
@@ -81,11 +82,12 @@ namespace BlackGui
void CDbDistributorComponent::onDistributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count) 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 (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
if (entity.testFlag(CEntityFlags::DistributorEntity) && CEntityFlags::isFinishedReadState(readState)) 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); this->filterBySimulator(CSimulatorInfo::AllFsFamily);
keys = CDistributor::standardAllFsFamily(); keys = CDistributor::standardAllFsFamily();
} }
else if (s == ui->pb_SelectXPlane) else if (s == ui->pb_SelectXPlaneBB)
{ {
this->filterBySimulator(CSimulatorInfo::XPLANE); this->filterBySimulator(CSimulatorInfo::XPLANE);
keys = QSet<QString>({ CDistributor::standardXPlane() }); keys = QSet<QString>({ CDistributor::xplaneBlueBell() });
}
else if (s == ui->pb_SelectXplaneXCSL)
{
this->filterBySimulator(CSimulatorInfo::XPLANE);
keys = QSet<QString>({ CDistributor::xplaneXcsl() });
} }
// deferred because filter must first work and update // deferred because filter must first work and update

View File

@@ -111,9 +111,16 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pb_SelectXPlane"> <widget class="QPushButton" name="pb_SelectXPlaneBB">
<property name="text"> <property name="text">
<string>XPlane standard</string> <string>XPlane BlueBell</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_SelectXplaneXCSL">
<property name="text">
<string>XPlane XCSL</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -156,7 +163,7 @@
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>pb_SelectAllFsFamily</tabstop> <tabstop>pb_SelectAllFsFamily</tabstop>
<tabstop>pb_SelectXPlane</tabstop> <tabstop>pb_SelectXPlaneBB</tabstop>
<tabstop>tvp_Distributors</tabstop> <tabstop>tvp_Distributors</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>

View File

@@ -218,5 +218,24 @@ namespace BlackMisc
static const QSet<QString> fsFamily({standardFS9(), standardFSX(), standardP3D()}); static const QSet<QString> fsFamily({standardFS9(), standardFSX(), standardP3D()});
return fsFamily; return fsFamily;
} }
const QSet<QString> &CDistributor::xplaneMostPopular()
{
static const QSet<QString> 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
} // namespace } // namespace

View File

@@ -132,6 +132,9 @@ namespace BlackMisc
static const QString &standardXPlane(); static const QString &standardXPlane();
static const QString &standardFlightGear(); static const QString &standardFlightGear();
static const QSet<QString> &standardAllFsFamily(); static const QSet<QString> &standardAllFsFamily();
static const QSet<QString> &xplaneMostPopular();
static const QString &xplaneBlueBell();
static const QString &xplaneXcsl();
//! @} //! @}
private: private: