mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Fixes context menu for stashing
(there is no sender when invoking the slot)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
227190ab42
commit
6037ce85ed
@@ -403,53 +403,46 @@ namespace BlackGui
|
|||||||
this->m_autoFilterInDbViews = !this->m_autoFilterInDbViews;
|
this->m_autoFilterInDbViews = !this->m_autoFilterInDbViews;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbMappingComponent::ps_applyFormData()
|
void CDbMappingComponent::ps_applyFormLiveryData()
|
||||||
{
|
{
|
||||||
const QAction *sender = qobject_cast<QAction *>(this->sender());
|
|
||||||
if (!sender) { return; }
|
|
||||||
const QString cn(sender->data().toString());
|
|
||||||
if (cn.isEmpty()) { return; }
|
|
||||||
if (this->ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
if (this->ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
||||||
|
const CStatusMessageList msgs = this->ui->editor_Livery->validate(true);
|
||||||
CStatusMessageList msgs;
|
if (msgs.hasErrorMessages())
|
||||||
if (CLivery().getClassName() == cn)
|
|
||||||
{
|
{
|
||||||
msgs = this->ui->editor_Livery->validate(true);
|
this->showOverlayMessages(msgs);
|
||||||
if (!msgs.hasErrorMessages())
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
this->ui->comp_StashAircraft->applyToSelected(this->ui->editor_Livery->getValue());
|
this->ui->comp_StashAircraft->applyToSelected(this->ui->editor_Livery->getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CDistributor().getClassName() == cn)
|
|
||||||
|
void CDbMappingComponent::ps_applyFormAircraftIcaoData()
|
||||||
{
|
{
|
||||||
msgs = this->ui->editor_Distributor->validate();
|
if (this->ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
||||||
if (!msgs.hasErrorMessages())
|
const CStatusMessageList msgs = this->ui->editor_AircraftIcao->validate(true);
|
||||||
|
if (msgs.hasErrorMessages())
|
||||||
{
|
{
|
||||||
this->ui->comp_StashAircraft->applyToSelected(this->ui->editor_Distributor->getValue());
|
this->showOverlayMessages(msgs);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (CAircraftIcaoCode().getClassName() == cn)
|
|
||||||
{
|
|
||||||
msgs = this->ui->editor_AircraftIcao->validate();
|
|
||||||
if (!msgs.hasErrorMessages())
|
|
||||||
{
|
{
|
||||||
this->ui->comp_StashAircraft->applyToSelected(this->ui->editor_AircraftIcao->getValue());
|
this->ui->comp_StashAircraft->applyToSelected(this->ui->editor_AircraftIcao->getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CAirlineIcaoCode().getClassName() == cn)
|
|
||||||
{
|
|
||||||
msgs = this->ui->editor_Livery->validateAirlineIcao();
|
|
||||||
if (!msgs.hasErrorMessages())
|
|
||||||
{
|
|
||||||
this->ui->comp_StashAircraft->applyToSelected(this->ui->editor_Livery->getValueAirlineIcao());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// errors if any
|
void CDbMappingComponent::ps_applyFormDistributorData()
|
||||||
|
{
|
||||||
|
if (this->ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
||||||
|
const CStatusMessageList msgs = this->ui->editor_Distributor->validate(true);
|
||||||
if (msgs.hasErrorMessages())
|
if (msgs.hasErrorMessages())
|
||||||
{
|
{
|
||||||
this->showOverlayMessages(msgs);
|
this->showOverlayMessages(msgs);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->ui->comp_StashAircraft->applyToSelected(this->ui->editor_Distributor->getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbMappingComponent::ps_modifyModelDialog()
|
void CDbMappingComponent::ps_modifyModelDialog()
|
||||||
@@ -941,17 +934,10 @@ namespace BlackGui
|
|||||||
// stash view and selection
|
// stash view and selection
|
||||||
menuActions.addMenuStashEditor();
|
menuActions.addMenuStashEditor();
|
||||||
|
|
||||||
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] = menuActions.addAction(this->m_menuActions[0], CIcons::appAircraftIcao16(), "Current aircraft ICAO", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormAircraftIcaoData });
|
||||||
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_applyFormDistributorData });
|
||||||
|
this->m_menuActions[2] = menuActions.addAction(this->m_menuActions[2], CIcons::appLiveries16(), "Current livery", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormLiveryData });
|
||||||
this->m_menuActions[1] = menuActions.addAction(this->m_menuActions[1], CIcons::appDistributors16(), "Current distributor", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormData });
|
this->m_menuActions[3] = menuActions.addAction(this->m_menuActions[3], CIcons::databaseTable16(), "Modify DB model data", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_modifyModelDialog });
|
||||||
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_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_applyFormData });
|
|
||||||
this->m_menuActions[3]->setData(CAircraftModel().getClassName());
|
|
||||||
}
|
}
|
||||||
this->nestedCustomMenu(menuActions);
|
this->nestedCustomMenu(menuActions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,13 @@ namespace BlackGui
|
|||||||
void ps_toggleAutoFiltering();
|
void ps_toggleAutoFiltering();
|
||||||
|
|
||||||
//! Apply current DB data from form
|
//! Apply current DB data from form
|
||||||
void ps_applyFormData();
|
void ps_applyFormLiveryData();
|
||||||
|
|
||||||
|
//! Apply current DB data from form
|
||||||
|
void ps_applyFormAircraftIcaoData();
|
||||||
|
|
||||||
|
//! Apply current DB data from form
|
||||||
|
void ps_applyFormDistributorData();
|
||||||
|
|
||||||
//! Open model modify dialog
|
//! Open model modify dialog
|
||||||
void ps_modifyModelDialog();
|
void ps_modifyModelDialog();
|
||||||
|
|||||||
Reference in New Issue
Block a user