mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Allow to add to model set from stash
This commit is contained in:
committed by
Mathew Sutcliffe
parent
eec33847b2
commit
78c618e589
@@ -91,6 +91,7 @@ namespace BlackGui
|
||||
|
||||
ui->comp_StashAircraft->view()->setCustomMenu(new CShowSimulatorFileMenu(ui->comp_StashAircraft->view(), this, true));
|
||||
ui->comp_StashAircraft->view()->setCustomMenu(new CApplyDbDataMenu(this, true));
|
||||
ui->comp_StashAircraft->view()->setCustomMenu(new COwnModelSetMenu(this, true));
|
||||
ui->comp_StashAircraft->view()->setCustomMenu(new CModelStashToolsMenu(this, false));
|
||||
|
||||
// connects
|
||||
@@ -343,6 +344,12 @@ namespace BlackGui
|
||||
return currentTabIndex() == TabStash;
|
||||
}
|
||||
|
||||
bool CDbMappingComponent::canAddToModelSetTab() const
|
||||
{
|
||||
const bool allowed = this->currentTabIndex() == CDbMappingComponent::TabOwnModels || this->currentTabIndex() == CDbMappingComponent::TabStash;
|
||||
return allowed && this->currentModelView()->hasSelection();
|
||||
}
|
||||
|
||||
CStatusMessageList CDbMappingComponent::validateCurrentModel(bool withNestedForms) const
|
||||
{
|
||||
CStatusMessageList msgs(ui->editor_ModelMapping->validate(!withNestedForms));
|
||||
@@ -647,8 +654,7 @@ namespace BlackGui
|
||||
|
||||
void CDbMappingComponent::ps_addToOwnModelSet()
|
||||
{
|
||||
if (this->currentTabIndex() != CDbMappingComponent::TabOwnModels) { return; }
|
||||
if (!currentModelView()->hasSelection()) { return; }
|
||||
if (!this->canAddToModelSetTab()) { return; }
|
||||
const CAircraftModelList models(this->currentModelView()->selectedObjects());
|
||||
const CStatusMessage m = this->addToOwnModelSet(models, this->getOwnModelsSimulator());
|
||||
CLogMessage::preformatted(m);
|
||||
@@ -954,7 +960,7 @@ namespace BlackGui
|
||||
{
|
||||
CDbMappingComponent *mapComp = mappingComponent();
|
||||
Q_ASSERT_X(mapComp, Q_FUNC_INFO, "no mapping component");
|
||||
if (mapComp->currentTabIndex() == CDbMappingComponent::TabOwnModels && mapComp->currentModelView()->hasSelection())
|
||||
if (mapComp->canAddToModelSetTab())
|
||||
{
|
||||
menuActions.addMenuModelSet();
|
||||
this->m_menuAction = menuActions.addAction(this->m_menuAction, CIcons::appModels16(), "Add to own model set", CMenuAction::pathModelSet(), this, { mapComp, &CDbMappingComponent::ps_addToOwnModelSet });
|
||||
|
||||
@@ -107,6 +107,9 @@ namespace BlackGui
|
||||
//! Is stashed view
|
||||
bool isStashTab() const;
|
||||
|
||||
//! Tab can contribute to model set
|
||||
bool canAddToModelSetTab() const;
|
||||
|
||||
//! Current model view
|
||||
BlackGui::Views::CAircraftModelView *currentModelView() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user