mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 05:55:33 +08:00
refs #649, further fixes and improvements
* call of non-virtual function in ctor * use getCopy * return number of merged models * change current simulator in model set loader (fixes infinite loop: change data -> signal -> change data).
This commit is contained in:
@@ -48,7 +48,7 @@ namespace BlackGui
|
||||
|
||||
// should be single simulator or no simulator (default)
|
||||
this->m_simulatorSelection.synchronize();
|
||||
const CSimulatorInfo simulator(this->m_simulatorSelection.get());
|
||||
const CSimulatorInfo simulator(this->m_simulatorSelection.getCopy());
|
||||
const bool s = this->initModelLoader(!simulator.isSingleSimulator() ? CSimulatorInfo(CSimulatorInfo::FSX) : simulator);
|
||||
if (s)
|
||||
{
|
||||
|
||||
@@ -103,8 +103,8 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbOwnModelsComponent> ui;
|
||||
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheLastSelection> m_simulatorSelection {this }; //!< last selection
|
||||
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheLastSelection> m_simulatorSelection {this }; //!< last selection
|
||||
|
||||
//! Init or change model loader
|
||||
bool initModelLoader(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
@@ -126,8 +126,8 @@ namespace BlackGui
|
||||
virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override;
|
||||
|
||||
private:
|
||||
QList<QAction *> m_loadActions; //!< load actions
|
||||
QList<QAction *> m_reloadActions; //!< reload actions
|
||||
QList<QAction *> m_loadActions; //!< load actions
|
||||
QList<QAction *> m_reloadActions; //!< reload actions
|
||||
};
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "aircraftmodelmenus.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/simulation/aircraftmodelinterfaces.h"
|
||||
@@ -139,15 +140,27 @@ namespace BlackGui
|
||||
|
||||
void CMergeWithDbDataMenu::ps_mergeData()
|
||||
{
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
|
||||
BLACK_VERIFY_X(sGui, Q_FUNC_INFO, "Missing sGui");
|
||||
if (!sGui->hasWebDataServices()) { return; }
|
||||
|
||||
const CAircraftModelList dbModels(sGui->getWebDataServices()->getModels());
|
||||
if (dbModels.isEmpty())
|
||||
{
|
||||
CLogMessage().warning("No DB models to merge with");
|
||||
return;
|
||||
}
|
||||
|
||||
this->modelView()->showLoadIndicator();
|
||||
CAircraftModelList models(this->getAircraftModels());
|
||||
CAircraftModelUtilities::mergeWithDbData(models, dbModels, true);
|
||||
if (this->modelsTargetSetable())
|
||||
int c = CAircraftModelUtilities::mergeWithDbData(models, dbModels, true);
|
||||
if (c > 0 && this->modelsTargetSetable())
|
||||
{
|
||||
this->modelsTargetSetable()->setModels(models);
|
||||
CLogMessage().info("Merged %1/%2 models with DB") << c << models.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage().info("No data merged with DB");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user