Ref T515, context menus for re-matching

* added re-matching for single aircraft
* re-ordered
This commit is contained in:
Klaus Basan
2019-01-17 12:48:34 +01:00
committed by Mat Sutcliffe
parent a90d4465a2
commit a0c8f3778b
6 changed files with 54 additions and 16 deletions

View File

@@ -953,7 +953,7 @@ namespace BlackCore
resetAircraft.resetToNetworkModel();
this->xCtxAddedRemoteAircraftReadyForModelMatching(resetAircraft);
});
return false;
return true;
}
void CContextSimulator::onSimulatorStarted(const CSimulatorPluginInfo &info)

View File

@@ -57,7 +57,7 @@ namespace BlackGui
this->tabBar()->setUsesScrollButtons(true);
ui->tvp_AirportsInRange->setResizeMode(CAirportView::ResizingOnce);
ui->tvp_AircraftInRange->setAircraftMode(CSimulatedAircraftListModel::NetworkMode);
ui->tvp_AircraftInRange->configureMenu(true, false, true, true);
ui->tvp_AircraftInRange->configureMenu(true, true, false, true, true);
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::modelDataChangedDigest, this, &CAircraftComponent::onRowCountChanged);
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestTextMessageWidget, this, &CAircraftComponent::requestTextMessageWidget);

View File

@@ -315,8 +315,8 @@ namespace BlackGui
void CMappingComponent::doMatchingsAgain()
{
if (!sGui || !sGui->getIContextSimulator() || !sGui->getISimulator() || !sGui->getISimulator()->isConnected()) { return; }
const int reMatchedNo = sGui->getIContextSimulator()->doMatchingsAgain();
CLogMessage(this).info(u"Triggered re-apping of %1 aircraft") << reMatchedNo;
const int rematchedNumber = sGui->getIContextSimulator()->doMatchingsAgain();
CLogMessage(this).info(u"Triggered re-matching of %1 aircraft") << rematchedNumber;
}
void CMappingComponent::onSaveAircraft()

View File

@@ -103,7 +103,7 @@ namespace BlackGui
const CMenuAction &CMenuAction::subMenuDisplayModels()
{
static const CMenuAction subdir(CIcons::appAircraft16(), "Display models", CMenuAction::pathClientSimulationDisplay());
static const CMenuAction subdir(CIcons::appAircraft16(), "Display and render models", CMenuAction::pathClientSimulationDisplay());
return subdir;
}

View File

@@ -23,6 +23,7 @@
using namespace BlackConfig;
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Simulation;
using namespace BlackCore::Context;
using namespace BlackGui::Models;
@@ -45,12 +46,13 @@ namespace BlackGui
this->setSortIndicator();
}
void CSimulatedAircraftView::configureMenu(bool menuHighlightAndFollow, bool menuEnableAircraft, bool menuFastPositionUpdates, bool menuGndFlag)
void CSimulatedAircraftView::configureMenu(bool menuRecalculate, bool menuHighlightAndFollow, bool menuEnableAircraft, bool menuFastPositionUpdates, bool menuGndFlag)
{
m_withMenuEnableAircraft = menuEnableAircraft;
m_withMenuFastPosition = menuFastPositionUpdates;
m_withRecalculate = menuRecalculate;
m_withMenuEnableAircraft = menuEnableAircraft;
m_withMenuFastPosition = menuFastPositionUpdates;
m_withMenuHighlightAndFollow = menuHighlightAndFollow;
m_withMenuEnableGndFlag = menuGndFlag;
m_withMenuEnableGndFlag = menuGndFlag;
}
void CSimulatedAircraftView::configureMenuFastPositionUpdates(bool menuFastPositionUpdates)
@@ -65,17 +67,26 @@ namespace BlackGui
menuActions.addMenuDisplayModels();
menuActions.addMenuDataTransfer();
menuActions.addAction(CIcons::appInterpolation16(), "Recalculate all aircraft", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::recalculateAllAircraft });
if (m_menus.testFlag(MenuDisableModelsTemp) && this->hasSelection())
{
menuActions.addAction(CIcons::delete16(), "Temp.disable model from set", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestTempDisable });
}
if (m_withRecalculate)
{
menuActions.addAction(CIcons::appInterpolation16(), "Re-calculate all aircraft", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::recalculateAllAircraft });
menuActions.addAction(CIcons::appInterpolation16(), "Re-matching all aircraft", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::doMatchingsAgain });
if (this->hasSelection())
{
menuActions.addAction(CIcons::appInterpolation16(), "Re-matching selected", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::doMatchingsAgainForSelected });
}
}
if (m_withMenuEnableAircraft && !this->isEmpty())
{
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 });
}
menuActions.addAction(CIcons::appAircraft16(), "Disable all aircraft", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::disableAllEnabledAircraft });
}
if (this->hasSelection())
@@ -241,6 +252,26 @@ namespace BlackGui
simContext->recalculateAllAircraft();
}
void CSimulatedAircraftView::doMatchingsAgain()
{
IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
const int rematchedNumber = simContext->doMatchingsAgain();
CLogMessage(this).info(u"Triggered re-matching of %1 aircraft") << rematchedNumber;
}
void CSimulatedAircraftView::doMatchingsAgainForSelected()
{
IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
if (!this->hasSelection()) { return; }
const CCallsign cs = this->selectedObject().getCallsign();
if (simContext->doMatchingAgain(cs))
{
CLogMessage(this).info(u"Triggered re-matching of '%1'") << cs.asString();
}
}
void CSimulatedAircraftView::enableFastPositionUpdates(const CSimulatedAircraft &aircraft)
{
IContextNetwork *nwContext = networkContext();

View File

@@ -51,7 +51,7 @@ namespace BlackGui
void setAircraftMode(Models::CSimulatedAircraftListModel::AircraftMode mode);
//! Configure the menu
void configureMenu(bool menuHighlightAndFollow, bool menuEnableAircraft, bool menuFastPositionUpdates, bool menuGndFlag);
void configureMenu(bool menuRecalculate, bool menuHighlightAndFollow, bool menuEnableAircraft, bool menuFastPositionUpdates, bool menuGndFlag);
//! Configure fast position updates menu
void configureMenuFastPositionUpdates(bool menuFastPositionUpdates);
@@ -113,6 +113,12 @@ namespace BlackGui
//! Fully recalculate all aircraft
void recalculateAllAircraft();
//! Match all aircraft again
void doMatchingsAgain();
//! Match all aircraft again
void doMatchingsAgainForSelected();
//! Enable fast position updates
void enableFastPositionUpdates(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
@@ -128,6 +134,7 @@ namespace BlackGui
//! Network context
static BlackCore::Context::IContextNetwork *networkContext();
bool m_withRecalculate = true;
bool m_withMenuHighlightAndFollow = true;
bool m_withMenuEnableAircraft = true;
bool m_withMenuEnableGndFlag = true;