mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +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 CShowSimulatorFileMenu(ui->comp_StashAircraft->view(), this, true));
|
||||||
ui->comp_StashAircraft->view()->setCustomMenu(new CApplyDbDataMenu(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));
|
ui->comp_StashAircraft->view()->setCustomMenu(new CModelStashToolsMenu(this, false));
|
||||||
|
|
||||||
// connects
|
// connects
|
||||||
@@ -343,6 +344,12 @@ namespace BlackGui
|
|||||||
return currentTabIndex() == TabStash;
|
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 CDbMappingComponent::validateCurrentModel(bool withNestedForms) const
|
||||||
{
|
{
|
||||||
CStatusMessageList msgs(ui->editor_ModelMapping->validate(!withNestedForms));
|
CStatusMessageList msgs(ui->editor_ModelMapping->validate(!withNestedForms));
|
||||||
@@ -647,8 +654,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CDbMappingComponent::ps_addToOwnModelSet()
|
void CDbMappingComponent::ps_addToOwnModelSet()
|
||||||
{
|
{
|
||||||
if (this->currentTabIndex() != CDbMappingComponent::TabOwnModels) { return; }
|
if (!this->canAddToModelSetTab()) { return; }
|
||||||
if (!currentModelView()->hasSelection()) { return; }
|
|
||||||
const CAircraftModelList models(this->currentModelView()->selectedObjects());
|
const CAircraftModelList models(this->currentModelView()->selectedObjects());
|
||||||
const CStatusMessage m = this->addToOwnModelSet(models, this->getOwnModelsSimulator());
|
const CStatusMessage m = this->addToOwnModelSet(models, this->getOwnModelsSimulator());
|
||||||
CLogMessage::preformatted(m);
|
CLogMessage::preformatted(m);
|
||||||
@@ -954,7 +960,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CDbMappingComponent *mapComp = mappingComponent();
|
CDbMappingComponent *mapComp = mappingComponent();
|
||||||
Q_ASSERT_X(mapComp, Q_FUNC_INFO, "no mapping component");
|
Q_ASSERT_X(mapComp, Q_FUNC_INFO, "no mapping component");
|
||||||
if (mapComp->currentTabIndex() == CDbMappingComponent::TabOwnModels && mapComp->currentModelView()->hasSelection())
|
if (mapComp->canAddToModelSetTab())
|
||||||
{
|
{
|
||||||
menuActions.addMenuModelSet();
|
menuActions.addMenuModelSet();
|
||||||
this->m_menuAction = menuActions.addAction(this->m_menuAction, CIcons::appModels16(), "Add to own model set", CMenuAction::pathModelSet(), this, { mapComp, &CDbMappingComponent::ps_addToOwnModelSet });
|
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
|
//! Is stashed view
|
||||||
bool isStashTab() const;
|
bool isStashTab() const;
|
||||||
|
|
||||||
|
//! Tab can contribute to model set
|
||||||
|
bool canAddToModelSetTab() const;
|
||||||
|
|
||||||
//! Current model view
|
//! Current model view
|
||||||
BlackGui::Views::CAircraftModelView *currentModelView() const;
|
BlackGui::Views::CAircraftModelView *currentModelView() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user