mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #618, allow to set file name for saving in views
This commit is contained in:
@@ -101,6 +101,7 @@ namespace BlackGui
|
||||
Q_ASSERT_X(simInfo.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
||||
if (this->m_modelLoader && this->m_modelLoader->supportsSimulator(simInfo))
|
||||
{
|
||||
this->setSaveFileName(simInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -123,10 +124,18 @@ namespace BlackGui
|
||||
bool c = connect(this->m_modelLoader.get(), &IAircraftModelLoader::loadingFinished, this, &CDbOwnModelsComponent::ps_onOwnModelsLoadingFinished);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect for model loader");
|
||||
Q_UNUSED(c);
|
||||
this->setSaveFileName(simInfo);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void CDbOwnModelsComponent::setSaveFileName(const CSimulatorInfo &sim)
|
||||
{
|
||||
Q_ASSERT_X(sim.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
const QString n("simulator models " + sim.toQString(true));
|
||||
this->ui->tvp_OwnAircraftModels->setSaveFileName(n);
|
||||
}
|
||||
|
||||
void CDbOwnModelsComponent::CLoadModelsMenu::customMenu(QMenu &menu) const
|
||||
{
|
||||
CSimulatorInfo sims = CSimulatorInfo::getLocallyInstalledSimulators();
|
||||
|
||||
@@ -82,6 +82,9 @@ namespace BlackGui
|
||||
//! Init model loader
|
||||
bool initModelLoader(const BlackMisc::Simulation::CSimulatorInfo &simInfo);
|
||||
|
||||
//! File name for savinf
|
||||
void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
||||
|
||||
//! The menu for loading and handling own models for mapping tasks
|
||||
//! \note This is specific for that very component
|
||||
class CLoadModelsMenu : public BlackGui::Menus::IMenuDelegate
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
ui->tvp_OwnModelSet->setAircraftModelMode(CAircraftModelListModel::OwnSimulatorModelMapping);
|
||||
ui->tvp_OwnModelSet->menuRemoveItems(CAircraftModelView::MenuDisplayAutomaticallyAndRefresh | CAircraftModelView::MenuStashing | CAircraftModelView::MenuBackend | CAircraftModelView::MenuRefresh);
|
||||
ui->tvp_OwnModelSet->menuAddItems(CAircraftModelView::MenuRemoveSelectedRows);
|
||||
ui->tvp_OwnModelSet->menuAddItems(CAircraftModelView::MenuRemoveSelectedRows | CAircraftModelView::MenuClear);
|
||||
ui->tvp_OwnModelSet->addFilterDialog();
|
||||
connect(ui->pb_CreateNewSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::ps_buttonClicked);
|
||||
connect(ui->pb_LoadExistingSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::ps_buttonClicked);
|
||||
}
|
||||
@@ -52,6 +53,7 @@ namespace BlackGui
|
||||
this->ui->pb_SaveAsSetForSimulator->setText("save for " + simulator.toQString());
|
||||
this->ui->pb_SaveAsSetForSimulator->setEnabled(!models.isEmpty());
|
||||
this->m_simulator = simulator;
|
||||
this->setSaveFileName(simulator);
|
||||
}
|
||||
|
||||
void CDbOwnModelSetComponent::setMappingComponent(CDbMappingComponent *component)
|
||||
@@ -111,5 +113,12 @@ namespace BlackGui
|
||||
this->ui->tvp_OwnModelSet->showFileLoadDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void CDbOwnModelSetComponent::setSaveFileName(const CSimulatorInfo &sim)
|
||||
{
|
||||
Q_ASSERT_X(sim.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
const QString n("modelset" + sim.toQString(true));
|
||||
this->ui->tvp_OwnModelSet->setSaveFileName(n);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -62,6 +62,9 @@ namespace BlackGui
|
||||
void ps_buttonClicked();
|
||||
|
||||
private:
|
||||
//! Default file name
|
||||
void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
||||
|
||||
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
|
||||
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator;
|
||||
|
||||
Reference in New Issue
Block a user