Fixed some minor issues in mapping tool (triggered by slack discussion)

* slot menu connect
* stashing from model view
* removed unused menu
This commit is contained in:
Klaus Basan
2016-02-25 17:13:11 +01:00
committed by Mathew Sutcliffe
parent 79f95845b2
commit 76814b43be
6 changed files with 6 additions and 39 deletions

View File

@@ -31,7 +31,7 @@ namespace BlackGui
ui(new Ui::CDataInfoAreaComponent)
{
ui->setupUi(this);
initInfoArea(); // init base class
this->initInfoArea(); // init base class
this->setWindowIcon(CIcons::swiftDatabase24());
this->ps_setTabBarPosition(QTabWidget::North);
}

View File

@@ -863,7 +863,7 @@ namespace BlackGui
if (mapComp->currentTabIndex() == CDbMappingComponent::TabOwnModels && mapComp->currentModelView()->hasSelection())
{
this->addSeparator(menu);
menu.addAction(CIcons::text16(), "Open simulator file", this, SLOT(ps_showSimulatorFile()));
menu.addAction(CIcons::text16(), "Open simulator file", mapComp, SLOT(ps_showSimulatorFile()));
}
this->nestedCustomMenu(menu);

View File

@@ -36,6 +36,8 @@ namespace BlackGui
ui->setupUi(this);
this->setViewWithIndicator(this->ui->tvp_AircraftModel);
this->ui->tvp_AircraftModel->setAircraftModelMode(CAircraftModelListModel::Database);
this->ui->tvp_AircraftModel->menuAddItems(CAircraftModelView::MenuStashing);
this->ui->tvp_AircraftModel->menuRemoveItems(CAircraftModelView::MenuHighlightStashed); // not supported here
connect(this->ui->tvp_AircraftModel, &CAircraftModelView::requestNewBackendData, this, &CDbModelComponent::ps_reload);
connect(this->ui->tvp_AircraftModel, &CAircraftModelView::requestStash, this, &CDbModelComponent::requestStash);
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CDbModelComponent::ps_onStyleSheetChanged);
@@ -101,22 +103,5 @@ namespace BlackGui
emit requestStash(models);
}
}
void CDbModelComponent::CStashMenu::customMenu(QMenu &menu) const
{
CDbModelComponent *modelComponent = qobject_cast<CDbModelComponent *>(this->parent());
Q_ASSERT_X(modelComponent, Q_FUNC_INFO, "Cannot access model component");
if (modelComponent->hasModels())
{
menu.addAction(CIcons::appMappings16(), "Stash", modelComponent, SLOT(ps_stashSelectedModels()), CShortcut::keyStash());
}
this->nestedCustomMenu(menu);
}
CDbModelComponent *CDbModelComponent::CStashMenu::modelComponent() const
{
return qobject_cast<CDbModelComponent *>(this->parent());
}
} // ns
} // ns

View File

@@ -74,24 +74,6 @@ namespace BlackGui
private:
QScopedPointer<Ui::CDbModelComponent> ui;
//! The menu for stashing models
//! \note This is a specific menu for that very component
class CStashMenu : public BlackGui::IMenuDelegate
{
public:
//! Constructor
CStashMenu(CDbModelComponent *modelComponent, bool separatorAtEnd) :
BlackGui::IMenuDelegate(modelComponent, separatorAtEnd)
{}
//! \copydoc IMenuDelegate::customMenu
virtual void customMenu(QMenu &menu) const override;
private:
//! Mapping component
CDbModelComponent *modelComponent() const;
};
};
} // ns
} // ns

View File

@@ -103,7 +103,7 @@ namespace BlackGui
CStatusMessageList msgs;
for (const CAircraftModel &model : models)
{
CStatusMessage m(stashModel(model));
const CStatusMessage m(stashModel(model));
if (m.isWarningOrAbove()) { msgs.push_back(m); }
}
return msgs;

View File

@@ -183,7 +183,7 @@ namespace BlackGui
void menuRemoveItems(Menu menusToRemove);
//! Add given menu items
void menuAddItems(Menu menusToRemove);
void menuAddItems(Menu menusToAdd);
//! Set menu items
void setMenu(Menu menuItems) { this->m_menus = menuItems; }