mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
refs #587, use modify form as dialog in mapping component
This commit is contained in:
@@ -167,7 +167,7 @@ namespace BlackGui
|
||||
void CDbMappingComponent::setProvider(BlackMisc::Network::IWebDataServicesProvider *provider)
|
||||
{
|
||||
CWebDataServicesAware::setProvider(provider);
|
||||
this->m_autostashDialog->setProvider(provider);
|
||||
this->m_autoStashDialog->setProvider(provider);
|
||||
this->ui->editor_Livery->setProvider(provider);
|
||||
this->ui->editor_Distributor->setProvider(provider);
|
||||
this->ui->editor_AircraftIcao->setProvider(provider);
|
||||
@@ -325,7 +325,7 @@ namespace BlackGui
|
||||
|
||||
void CDbMappingComponent::ps_displayAutoStashingDialog()
|
||||
{
|
||||
this->m_autostashDialog->exec();
|
||||
this->m_autoStashDialog->exec();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_removeDbModelsFromView()
|
||||
@@ -392,6 +392,20 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_modifyModelDialog()
|
||||
{
|
||||
// only one model selected, use as default
|
||||
if (this->ui->comp_StashAircraft->getView()->hasSingleSelectedRow())
|
||||
{
|
||||
this->m_modelModifyDialog->setValue(this->ui->comp_StashAircraft->getView()->selectedObject());
|
||||
}
|
||||
|
||||
QDialog::DialogCode s = static_cast<QDialog::DialogCode>(this->m_modelModifyDialog->exec());
|
||||
if (s == QDialog::Rejected) { return; }
|
||||
CPropertyIndexVariantMap vm = this->m_modelModifyDialog->getValues();
|
||||
this->ui->comp_StashAircraft->applyToSelected(vm);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::resizeForSelect()
|
||||
{
|
||||
int h = this->height();
|
||||
@@ -742,9 +756,9 @@ namespace BlackGui
|
||||
const QString msgAutoStash("Auto stashing");
|
||||
menu.addAction(CIcons::appDbStash16(), msgAutoStash, mapComp, SLOT(ps_displayAutoStashingDialog()));
|
||||
|
||||
if (mapComp->m_autostashDialog && mapComp->m_autostashDialog->isCompleted())
|
||||
if (mapComp->m_autoStashDialog && mapComp->m_autoStashDialog->isCompleted())
|
||||
{
|
||||
menu.addAction(CIcons::appDbStash16(), "Last auto stash run", mapComp->m_autostashDialog.data(), SLOT(showLastResults()));
|
||||
menu.addAction(CIcons::appDbStash16(), "Last auto stash run", mapComp->m_autoStashDialog.data(), SLOT(showLastResults()));
|
||||
}
|
||||
|
||||
// auto filter in DB views
|
||||
@@ -783,6 +797,8 @@ namespace BlackGui
|
||||
|
||||
// a = subMenu->addAction(CIcons::appAirlineIcao16(), "Current airline ICAO", mapComp, SLOT(ps_applyDbData()));
|
||||
// a->setData(CAirlineIcaoCode().getClassName());
|
||||
|
||||
menu.addAction(CIcons::databaseTable16(), "Modify model data", mapComp, SLOT(ps_modifyModelDialog()));
|
||||
}
|
||||
this->nestedCustomMenu(menu);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/components/dbautostashingcomponent.h"
|
||||
#include "blackgui/components/dbmodelmappingmodifycomponent.h"
|
||||
#include "blackgui/views/aircraftmodelview.h"
|
||||
#include "blackmisc/simulation/aircraftmodelloader.h"
|
||||
#include "blackmisc/simulation/fscommon/vpilotrulesreader.h"
|
||||
@@ -202,9 +203,13 @@ namespace BlackGui
|
||||
//! Apply current DB data from form
|
||||
void ps_applyDbData();
|
||||
|
||||
//! Open model modify dialog
|
||||
void ps_modifyModelDialog();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbMappingComponent> ui;
|
||||
QScopedArrayPointer<CDbAutoStashingComponent> m_autostashDialog { new CDbAutoStashingComponent(this) };
|
||||
QScopedPointer<CDbAutoStashingComponent> m_autoStashDialog { new CDbAutoStashingComponent(this) };
|
||||
QScopedPointer<CDbModelMappingModifyComponent> m_modelModifyDialog { new CDbModelMappingModifyComponent(this) };
|
||||
BlackMisc::Simulation::FsCommon::CVPilotRulesReader m_vPilotReader; //!< read vPilot rules
|
||||
BlackMisc::CData<BlackCore::Data::VPilotAircraftModels> m_cachedVPilotModels { this, &CDbMappingComponent::ps_onVPilotCacheChanged }; //!< cache for latest vPilot rules
|
||||
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENTAWARE_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user