mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
refs #641, order and update models by distributor
This commit is contained in:
@@ -165,9 +165,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
this->m_modelSetDialog->setModal(true);
|
this->m_modelSetDialog->setModal(true);
|
||||||
this->m_modelSetDialog->reloadData();
|
this->m_modelSetDialog->reloadData();
|
||||||
QDialog::DialogCode rc = static_cast<QDialog::DialogCode>(
|
QDialog::DialogCode rc = static_cast<QDialog::DialogCode>(this->m_modelSetDialog->exec());
|
||||||
this->m_modelSetDialog->exec()
|
|
||||||
);
|
|
||||||
if (rc == QDialog::Accepted)
|
if (rc == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
this->setModelSet(this->m_modelSetDialog->getModelSet(), this->m_modelSetDialog->getSimulatorInfo());
|
this->setModelSet(this->m_modelSetDialog->getModelSet(), this->m_modelSetDialog->getSimulatorInfo());
|
||||||
@@ -235,6 +233,16 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDbOwnModelSetComponent::ps_preferencesChanged()
|
||||||
|
{
|
||||||
|
const CDistributorListPreferences preferences = this->m_distributorPreferences.get();
|
||||||
|
const CSimulatorInfo simuulator = preferences.getLastUpdatedSimulator();
|
||||||
|
if (simuulator.isSingleSimulator())
|
||||||
|
{
|
||||||
|
this->updateDistributorOrder(simuulator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CDbOwnModelSetComponent::setSaveFileName(const CSimulatorInfo &sim)
|
void CDbOwnModelSetComponent::setSaveFileName(const CSimulatorInfo &sim)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(sim.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
Q_ASSERT_X(sim.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||||
@@ -248,6 +256,24 @@ namespace BlackGui
|
|||||||
this->ui->le_Simulator->setText(sim.toQString(true));
|
this->ui->le_Simulator->setText(sim.toQString(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDbOwnModelSetComponent::updateDistributorOrder(const CSimulatorInfo &simulator)
|
||||||
|
{
|
||||||
|
CAircraftModelList modelSet = this->m_modelSetLoader.getAircraftModels(simulator);
|
||||||
|
if (modelSet.isEmpty()) { return; }
|
||||||
|
const CDistributorListPreferences preferences = this->m_distributorPreferences.get();
|
||||||
|
const CDistributorList distributors = preferences.getDistributors(simulator);
|
||||||
|
if (distributors.isEmpty()) { return; }
|
||||||
|
modelSet.updateDistributorOrder(distributors);
|
||||||
|
this->m_modelSetLoader.setModels(modelSet, simulator);
|
||||||
|
|
||||||
|
// display?
|
||||||
|
const CSimulatorInfo currentSimulator(this->getModelSetSimulator());
|
||||||
|
if (simulator == currentSimulator)
|
||||||
|
{
|
||||||
|
ui->tvp_OwnModelSet->updateContainerAsync(modelSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CDbOwnModelSetComponent::CLoadModelsMenu::customMenu(QMenu &menu) const
|
void CDbOwnModelSetComponent::CLoadModelsMenu::customMenu(QMenu &menu) const
|
||||||
{
|
{
|
||||||
const CSimulatorInfo sims = CSimulatorInfo::getLocallyInstalledSimulators();
|
const CSimulatorInfo sims = CSimulatorInfo::getLocallyInstalledSimulators();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define BLACKGUI_COMPONENTS_DBOWNMODELSETCOMPONENT_H
|
#define BLACKGUI_COMPONENTS_DBOWNMODELSETCOMPONENT_H
|
||||||
|
|
||||||
#include "blackgui/menus/menudelegate.h"
|
#include "blackgui/menus/menudelegate.h"
|
||||||
|
#include "blackcore/settings/distributorpreferences.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
#include "blackmisc/simulation/aircraftmodelsetloader.h"
|
#include "blackmisc/simulation/aircraftmodelsetloader.h"
|
||||||
#include "dbmappingcomponentaware.h"
|
#include "dbmappingcomponentaware.h"
|
||||||
@@ -105,6 +106,9 @@ namespace BlackGui
|
|||||||
//! JSON data have been loaded from disk
|
//! JSON data have been loaded from disk
|
||||||
void ps_onJsonDataLoaded(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void ps_onJsonDataLoaded(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
|
//! Preferences changed
|
||||||
|
void ps_preferencesChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Default file name
|
//! Default file name
|
||||||
void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
||||||
@@ -112,10 +116,14 @@ namespace BlackGui
|
|||||||
//! Simulator
|
//! Simulator
|
||||||
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
||||||
|
|
||||||
|
//! Update distributor order
|
||||||
|
void updateDistributorOrder(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
|
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
|
||||||
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
|
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
|
||||||
BlackMisc::Simulation::CSimulatorInfo m_simulator;
|
BlackMisc::Simulation::CSimulatorInfo m_simulator;
|
||||||
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { BlackMisc::Simulation::CSimulatorInfo(BlackMisc::Simulation::CSimulatorInfo::FSX), this };
|
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { BlackMisc::Simulation::CSimulatorInfo(BlackMisc::Simulation::CSimulatorInfo::FSX), this };
|
||||||
|
BlackMisc::CSetting<BlackCore::Settings::Simulation::DistributorListPreferences> m_distributorPreferences { this, &CDbOwnModelSetComponent::ps_preferencesChanged };
|
||||||
|
|
||||||
//! The menu for loading and handling own models for mapping tasks
|
//! The menu for loading and handling own models for mapping tasks
|
||||||
//! \note This is specific for that very component
|
//! \note This is specific for that very component
|
||||||
|
|||||||
Reference in New Issue
Block a user