mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T451, context menu in views (simulated aircraft/model) to disable model
This commit is contained in:
committed by
Mat Sutcliffe
parent
158ba34936
commit
93cf349a04
@@ -332,6 +332,19 @@ namespace BlackGui
|
||||
a->setChecked(this->derivedModel()->highlightModelStrings());
|
||||
addStashMenu = true;
|
||||
}
|
||||
|
||||
// client specific
|
||||
if (m_menus.testFlag(MenuDisableModelsTemp) && this->hasSelection())
|
||||
{
|
||||
if (!m_menuFlagActions.contains(MenuDisableModelsTemp))
|
||||
{
|
||||
CMenuActions ma;
|
||||
ma.addAction(CIcons::delete16(), "Temp.disable model", CMenuAction::pathModel(), { this, &CAircraftModelView::requestTempDisable });
|
||||
m_menuFlagActions.insert(MenuDisableModelsTemp, ma);
|
||||
}
|
||||
menuActions.addActions(initMenuActions(CViewBaseNonTemplate::MenuDisableModelsTemp));
|
||||
}
|
||||
|
||||
if (addStashMenu) { menuActions.addMenuStash(); }
|
||||
|
||||
// base class menus
|
||||
@@ -403,6 +416,15 @@ namespace BlackGui
|
||||
sGui->displayInStatusBar(CStatusMessage(CStatusMessage::SeverityInfo, "Stashed " + models.getModelStringList(true).join(" ")));
|
||||
}
|
||||
|
||||
void CAircraftModelView::requestTempDisable()
|
||||
{
|
||||
if (!m_menus.testFlag(MenuCanStashModels)) { return; }
|
||||
if (!this->hasSelection()) { return; }
|
||||
const CAircraftModelList models(this->selectedObjects());
|
||||
emit this->requestTempDisableModelsForMatching(models);
|
||||
sGui->displayInStatusBar(CStatusMessage(CStatusMessage::SeverityInfo, "Temp.disabled " + models.getModelStringList(true).join(" ")));
|
||||
}
|
||||
|
||||
void CAircraftModelView::displayModelStatisticsDialog()
|
||||
{
|
||||
if (!m_statisticsDialog)
|
||||
|
||||
@@ -113,12 +113,15 @@ namespace BlackGui
|
||||
//! Request to stash if applicable
|
||||
void requestStash(const BlackMisc::Simulation::CAircraftModelList &models);
|
||||
|
||||
//! Highlight stashed models has been toggled
|
||||
void toggledHighlightStashedModels();
|
||||
|
||||
//! Request further handling of drops I cannot handle on my own
|
||||
void requestHandlingOfStashDrop(const BlackMisc::Aviation::CAirlineIcaoCode &airlineIcao);
|
||||
|
||||
//! Temp.disable model
|
||||
void requestTempDisableModelsForMatching(const BlackMisc::Simulation::CAircraftModelList &models);
|
||||
|
||||
//! Highlight stashed models has been toggled
|
||||
void toggledHighlightStashedModels();
|
||||
|
||||
//! Models for simulator loaded (JSON)
|
||||
void jsonModelsForSimulatorLoaded(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
@@ -148,6 +151,9 @@ namespace BlackGui
|
||||
//! Stash shortcut pressed
|
||||
void requestedStash();
|
||||
|
||||
//! Requested a temporary disabled model
|
||||
void requestTempDisable();
|
||||
|
||||
//! Dialog about model statistics
|
||||
void displayModelStatisticsDialog();
|
||||
|
||||
|
||||
@@ -72,6 +72,10 @@ namespace BlackGui
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Enable all aircraft", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::enableAllDisabledAircraft });
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Disable all aircraft", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::disableAllEnabledAircraft });
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Re-enable unrendered aircraft", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::reEnableAllUnrenderedAircraft });
|
||||
if (m_menus.testFlag(MenuDisableModelsTemp) && this->hasSelection())
|
||||
{
|
||||
menuActions.addAction(CIcons::delete16(), "Temp.disable model", CMenuAction::pathModel(), { this, &CSimulatedAircraftView::requestTempDisable });
|
||||
}
|
||||
}
|
||||
|
||||
if (this->hasSelection())
|
||||
@@ -156,6 +160,15 @@ namespace BlackGui
|
||||
this->followAircraftInSimulator(aircraft);
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::requestTempDisable()
|
||||
{
|
||||
if (!m_menus.testFlag(MenuCanStashModels)) { return; }
|
||||
if (!this->hasSelection()) { return; }
|
||||
const CAircraftModelList models(this->selectedObjects().getModels());
|
||||
emit this->requestTempDisableModelsForMatching(models);
|
||||
sGui->displayInStatusBar(CStatusMessage(CStatusMessage::SeverityInfo, "Temp.disabled " + models.getModelStringList(true).join(" ")));
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::showPositionLogInSimulator()
|
||||
{
|
||||
IContextSimulator *simContext = simulatorContext();
|
||||
|
||||
@@ -60,6 +60,9 @@ namespace BlackGui
|
||||
//! Request a text message
|
||||
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! Disable for matching
|
||||
void requestTempDisableModelsForMatching(const BlackMisc::Simulation::CAircraftModelList &models);
|
||||
|
||||
protected:
|
||||
//! \copydoc CViewBase::customMenu
|
||||
virtual void customMenu(Menus::CMenuActions &menuActions) override;
|
||||
@@ -83,6 +86,9 @@ namespace BlackGui
|
||||
//! Follow in simulator
|
||||
void requestFollowInSimulator();
|
||||
|
||||
//! Request temp disabling of matching models
|
||||
void requestTempDisable();
|
||||
|
||||
//! Show position log for selected aircraft
|
||||
void showPositionLogInSimulator();
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ namespace BlackGui
|
||||
// maybe shifted in the future to elsewhere
|
||||
MenuHighlightStashed = 1 << 15, //!< highlight stashed models
|
||||
MenuCanStashModels = 1 << 16, //!< stash models
|
||||
MenuDisableModelsTemp = 1 << 17, //!< temp. disable model
|
||||
MenuStashing = MenuHighlightStashed | MenuCanStashModels,
|
||||
};
|
||||
Q_DECLARE_FLAGS(Menu, MenuFlag)
|
||||
@@ -540,7 +541,7 @@ namespace BlackGui
|
||||
Menus::CFontMenu *m_fontMenu = nullptr; //!< font menu if applicable
|
||||
CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
||||
Components::CTextEditDialog *m_textEditDialog = nullptr; //!< text edit dialog
|
||||
QMap<MenuFlag, Menus::CMenuActions> m_menuFlagActions; //!< initialized actions
|
||||
QMap<MenuFlag, Menus::CMenuActions> m_menuFlagActions; //!< initialized actions for menu flag (enum)
|
||||
QString m_saveFileName; //!< save file name (JSON)
|
||||
BlackMisc::CDirectories::ColumnIndex m_dirSettingsIndex = BlackMisc::CDirectories::IndexDirLastViewJsonOrDefault; //!< allows to set more specialized directories //!< remember last JSON directory, having this member allows to have specific dir
|
||||
BlackMisc::CSetting<BlackMisc::Settings::TDirectorySettings> m_dirSettings { this }; //!< directory for load/save
|
||||
|
||||
Reference in New Issue
Block a user