mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
refs #661, allow to sort by distributor order in builder
* some style changes * pass distributors to builder * distributor model mode * flags
This commit is contained in:
@@ -114,6 +114,7 @@ namespace BlackGui
|
||||
// initial values
|
||||
this->ps_onModelSetChanged(ui->comp_OwnModelSet->view()->rowCount(), ui->comp_OwnModelSet->view()->hasFilter());
|
||||
this->ps_onStashedModelsDataChanged(ui->comp_StashAircraft->view()->rowCount(), ui->comp_StashAircraft->view()->hasFilter());
|
||||
this->ps_onOwnModelsChanged(ui->comp_OwnAircraftModels->view()->rowCount(), ui->comp_OwnAircraftModels->view()->hasFilter());
|
||||
|
||||
// how to display forms
|
||||
ui->editor_AircraftIcao->setSelectOnly();
|
||||
@@ -389,11 +390,11 @@ namespace BlackGui
|
||||
this->m_autoFilterInDbViews = !this->m_autoFilterInDbViews;
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_applyDbData()
|
||||
void CDbMappingComponent::ps_applyFormData()
|
||||
{
|
||||
QAction *sender = qobject_cast<QAction *>(this->sender());
|
||||
const QAction *sender = qobject_cast<QAction *>(this->sender());
|
||||
if (!sender) { return; }
|
||||
QString cn(sender->data().toString());
|
||||
const QString cn(sender->data().toString());
|
||||
if (cn.isEmpty()) { return; }
|
||||
if (this->ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
||||
|
||||
@@ -915,16 +916,16 @@ namespace BlackGui
|
||||
// stash view and selection
|
||||
menuActions.addMenuStashEditor();
|
||||
|
||||
this->m_menuActions[0] = menuActions.addAction(this->m_menuActions[0], CIcons::appAircraftIcao16(), "Current aircraft ICAO", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyDbData });
|
||||
this->m_menuActions[0] = menuActions.addAction(this->m_menuActions[0], CIcons::appAircraftIcao16(), "Current aircraft ICAO", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormData });
|
||||
this->m_menuActions[0]->setData(CAircraftIcaoCode().getClassName());
|
||||
|
||||
this->m_menuActions[1] = menuActions.addAction(this->m_menuActions[1], CIcons::appDistributors16(), "Current distributor", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyDbData });
|
||||
this->m_menuActions[1] = menuActions.addAction(this->m_menuActions[1], CIcons::appDistributors16(), "Current distributor", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormData });
|
||||
this->m_menuActions[1]->setData(CDistributor().getClassName());
|
||||
|
||||
this->m_menuActions[2] = menuActions.addAction(this->m_menuActions[2], CIcons::appLiveries16(), "Current livery", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyDbData });
|
||||
this->m_menuActions[2] = menuActions.addAction(this->m_menuActions[2], CIcons::appLiveries16(), "Current livery", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormData });
|
||||
this->m_menuActions[2]->setData(CLivery().getClassName());
|
||||
|
||||
this->m_menuActions[3] = menuActions.addAction(this->m_menuActions[3], CIcons::databaseTable16(), "Modify DB model data", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyDbData });
|
||||
this->m_menuActions[3] = menuActions.addAction(this->m_menuActions[3], CIcons::databaseTable16(), "Modify DB model data", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormData });
|
||||
this->m_menuActions[3]->setData(CAircraftModel().getClassName());
|
||||
}
|
||||
this->nestedCustomMenu(menuActions);
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace BlackGui
|
||||
void ps_toggleAutoFiltering();
|
||||
|
||||
//! Apply current DB data from form
|
||||
void ps_applyDbData();
|
||||
void ps_applyFormData();
|
||||
|
||||
//! Open model modify dialog
|
||||
void ps_modifyModelDialog();
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace BlackGui
|
||||
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheLastSelection> m_simulatorSelection {this }; //!< last selection
|
||||
|
||||
//! Init model loader
|
||||
//! Init or change model loader
|
||||
bool initModelLoader(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! File name for savinf
|
||||
|
||||
@@ -193,6 +193,9 @@ namespace BlackGui
|
||||
const QObject *sender = QObject::sender();
|
||||
if (sender == ui->pb_CreateNewSet)
|
||||
{
|
||||
// make sure both tabs display the same simulator
|
||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "Missing mapping component");
|
||||
this->getMappingComponent()->setOwnModelsSimulator(this->getModelSetSimulator());
|
||||
if (!this->m_modelSetDialog)
|
||||
{
|
||||
this->m_modelSetDialog.reset(new CDbOwnModelSetDialog(this));
|
||||
@@ -211,7 +214,7 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
static const CStatusMessage m(CStatusMessage(this, CStatusMessage::SeverityError, "No model data"));
|
||||
static const CStatusMessage m = CStatusMessage(this).error("No model data for %1") << this->m_modelSetDialog->getSimulatorInfo().toQString(true);
|
||||
this->getMappingComponent()->showOverlayMessage(m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,13 +124,14 @@ namespace BlackGui
|
||||
const CAircraftModelList models = this->getMappingComponent()->getOwnModels();
|
||||
this->m_simulatorInfo = this->getMappingComponent()->getOwnModelsSimulator();
|
||||
const CDistributorList distributors = selectedProviders ?
|
||||
this->ui->form_OwnModelSet->getSelectedDistributors() :
|
||||
CDistributorList();
|
||||
ui->form_OwnModelSet->getSelectedDistributors() :
|
||||
ui->form_OwnModelSet->getDistributors();
|
||||
const CModelSetBuilder builder(this);
|
||||
CModelSetBuilder::Builder options = selectedProviders ? CModelSetBuilder::FilterDistributos : CModelSetBuilder::NoOptions;
|
||||
if (dbDataOnly) { options |= CModelSetBuilder::OnlyDbData; }
|
||||
if (dbIcaoOnly) { options |= CModelSetBuilder::OnlyDbIcaoCodes; }
|
||||
if (dbDataOnly) { options |= CModelSetBuilder::OnlyDbData; }
|
||||
if (dbIcaoOnly) { options |= CModelSetBuilder::OnlyDbIcaoCodes; }
|
||||
if (incremnental) { options |= CModelSetBuilder::Incremental; }
|
||||
if (ui->form_OwnModelSet->hasDIstributorPreferences()) { options |= CModelSetBuilder::SortByDistributors; }
|
||||
return builder.buildModelSet(simulator, models, currentSet, options, distributors);
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace BlackGui
|
||||
const bool hasPreferences = this->hasDIstributorPreferences();
|
||||
ui->cb_Preferences->setChecked(hasPreferences);
|
||||
ui->comp_SimulatorSelector->setValue(this->m_simulator);
|
||||
ui->tvp_Distributors->setDistributorMode(hasPreferences ? CDistributorListModel::MinimalWithOrder : CDistributorListModel::Minimal);
|
||||
if (!distributors.isEmpty())
|
||||
{
|
||||
this->ui->tvp_Distributors->updateContainerMaybeAsync(distributors);
|
||||
@@ -87,6 +88,7 @@ namespace BlackGui
|
||||
CDistributorList COwnModelSetForm::getDistributors() const
|
||||
{
|
||||
Q_ASSERT_X(sGui && sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
|
||||
Q_ASSERT_X(this->m_simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
const CDistributorListPreferences prefs(this->m_distributorPreferences.getCopy());
|
||||
const CDistributorList distributors(prefs.getDistributors(this->m_simulator));
|
||||
if (!distributors.isEmpty()) { return distributors; }
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace BlackGui
|
||||
//! Request incremental build
|
||||
bool incrementalBuild() const;
|
||||
|
||||
//! Distributors
|
||||
//! Distributors (from preferences or web)
|
||||
BlackMisc::Simulation::CDistributorList getDistributors() const;
|
||||
|
||||
//! Preferences for given simulator
|
||||
|
||||
Reference in New Issue
Block a user