diff --git a/src/blackgui/components/weathercomponent.cpp b/src/blackgui/components/weathercomponent.cpp index 016673ed3..73b9f43cf 100644 --- a/src/blackgui/components/weathercomponent.cpp +++ b/src/blackgui/components/weathercomponent.cpp @@ -192,7 +192,7 @@ namespace BlackGui const bool useOwnAcftPosition = ui->cb_UseOwnAcftPosition->isChecked(); CCoordinateGeodetic position; Q_ASSERT(ui->cb_weatherScenario->currentData().canConvert()); - CWeatherScenario scenario = ui->cb_weatherScenario->currentData().value(); + const CWeatherScenario scenario = ui->cb_weatherScenario->currentData().value(); if (useOwnAcftPosition) { @@ -225,9 +225,16 @@ namespace BlackGui } } - void CWeatherComponent::weatherGridReceived(const CWeatherGrid &weatherGrid, const CIdentifier &identifier) + void CWeatherComponent::onWeatherGridReceived(const CWeatherGrid &weatherGrid, const CIdentifier &identifier) { - if (!isMyIdentifier(identifier)) { return; } + if (!isMyIdentifier(identifier)) + { + // not from myself + const CWeatherScenario scenario = ui->cb_weatherScenario->currentData().value(); + if (!CWeatherScenario::isRealWeatherScenario(scenario)) { return; } + + // we have received weather grid data and assume those are real weather updates + } ui->lbl_Status->setText({}); setWeatherGrid(weatherGrid); } @@ -243,7 +250,7 @@ namespace BlackGui // Context connections Q_ASSERT(sGui->getIContextSimulator()); - connect(sGui->getIContextSimulator(), &IContextSimulator::weatherGridReceived, this, &CWeatherComponent::weatherGridReceived, Qt::QueuedConnection); + connect(sGui->getIContextSimulator(), &IContextSimulator::weatherGridReceived, this, &CWeatherComponent::onWeatherGridReceived, Qt::QueuedConnection); } void CWeatherComponent::setWeatherGrid(const CWeatherGrid &weatherGrid) @@ -262,9 +269,7 @@ namespace BlackGui { if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; } ui->lbl_Status->setText(QStringLiteral("Loading around %1 %2").arg(position.latitude().toWgs84(), position.longitude().toWgs84())); - const CWeatherGrid weatherGrid { { {}, position } }; - const auto ident = identifier(); - sGui->getIContextSimulator()->requestWeatherGrid(weatherGrid, ident); + sGui->getIContextSimulator()->requestWeatherGrid(position, this->identifier()); } void CWeatherComponent::onScenarioChanged() diff --git a/src/blackgui/components/weathercomponent.h b/src/blackgui/components/weathercomponent.h index 0d1b9113e..bce13bcd2 100644 --- a/src/blackgui/components/weathercomponent.h +++ b/src/blackgui/components/weathercomponent.h @@ -67,7 +67,7 @@ namespace BlackGui void updateWeatherInfoLine(); void updateWeatherInformation(); - void weatherGridReceived(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier); + void onWeatherGridReceived(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier); void setupConnections();