refs #420, simulator status now displayed in GUI (user can see if sim is stopped / paused)

This commit is contained in:
Klaus Basan
2015-05-15 18:51:49 +02:00
parent de43caf451
commit 405de80945
3 changed files with 35 additions and 8 deletions

View File

@@ -56,14 +56,14 @@ namespace BlackGui
bool CEnableForDockWidgetInfoArea::isParentDockWidgetFloating() const bool CEnableForDockWidgetInfoArea::isParentDockWidgetFloating() const
{ {
Q_ASSERT(this->m_parentDockableInfoArea); Q_ASSERT(this->m_parentDockableInfoArea);
if (!this->m_parentDockableInfoArea) return false; if (!this->m_parentDockableInfoArea) { return false; }
return this->m_parentDockableInfoArea->isFloating(); return this->m_parentDockableInfoArea->isFloating();
} }
bool CEnableForDockWidgetInfoArea::isVisibleWidget() const bool CEnableForDockWidgetInfoArea::isVisibleWidget() const
{ {
Q_ASSERT(this->m_parentDockableInfoArea); Q_ASSERT(this->m_parentDockableInfoArea);
if (!this->m_parentDockableInfoArea) return false; if (!this->m_parentDockableInfoArea) { return false; }
return this->m_parentDockableInfoArea->isVisibleWidget(); return this->m_parentDockableInfoArea->isVisibleWidget();
} }

View File

@@ -104,10 +104,28 @@ namespace BlackGui
void CInfoBarStatusComponent::ps_onSimulatorStatusChanged(int status) void CInfoBarStatusComponent::ps_onSimulatorStatusChanged(int status)
{ {
if (status > 0) if (status > 0 && (status & ISimulator::Connected))
{ {
this->ui->led_Simulator->setOn(true); QString s(
this->ui->led_Simulator->setOnToolTip(getIContextSimulator()->getSimulatorPluginInfo().getDescription()); getIContextSimulator()->getSimulatorPluginInfo().getDescription() + ": " +
ISimulator::statusToString(status));
// at least connected
if (status & ISimulator::Paused)
{
// in paused state
this->ui->led_Simulator->setTriState();
this->ui->led_Simulator->setTriStateToolTip(s);
}
else if (status & ISimulator::Running)
{
this->ui->led_Simulator->setOn(true);
this->ui->led_Simulator->setOnToolTip(s);
}
else
{
this->ui->led_Simulator->setTriState();
this->ui->led_Simulator->setTriStateToolTip(s);
}
} }
else else
{ {

View File

@@ -383,9 +383,18 @@ namespace BlackGui
void CMappingComponent::updateSimulatedAircraftView() void CMappingComponent::updateSimulatedAircraftView()
{ {
Q_ASSERT_X(getIContextNetwork(), "updateSimulatedAircraftView", "missing network context"); Q_ASSERT_X(getIContextNetwork(), Q_FUNC_INFO, "missing network context");
const CSimulatedAircraftList aircraft = getIContextNetwork()->getAircraftInRange(); Q_ASSERT_X(getIContextSimulator(), Q_FUNC_INFO, "missing simulator context");
this->ui->tvp_SimulatedAircraft->updateContainer(aircraft); if (this->isVisibleWidget()) { return; }
if (getIContextSimulator()->isConnected())
{
const CSimulatedAircraftList aircraft(getIContextNetwork()->getAircraftInRange());
this->ui->tvp_SimulatedAircraft->updateContainer(aircraft);
}
else
{
this->ui->tvp_SimulatedAircraft->clear();
}
} }
} // namespace } // namespace