mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
Ref T786, UI weather component aligned to identifier
This commit is contained in:
committed by
Mat Sutcliffe
parent
579a3b28e1
commit
42cd7b9ad8
@@ -192,7 +192,7 @@ namespace BlackGui
|
|||||||
const bool useOwnAcftPosition = ui->cb_UseOwnAcftPosition->isChecked();
|
const bool useOwnAcftPosition = ui->cb_UseOwnAcftPosition->isChecked();
|
||||||
CCoordinateGeodetic position;
|
CCoordinateGeodetic position;
|
||||||
Q_ASSERT(ui->cb_weatherScenario->currentData().canConvert<CWeatherScenario>());
|
Q_ASSERT(ui->cb_weatherScenario->currentData().canConvert<CWeatherScenario>());
|
||||||
CWeatherScenario scenario = ui->cb_weatherScenario->currentData().value<CWeatherScenario>();
|
const CWeatherScenario scenario = ui->cb_weatherScenario->currentData().value<CWeatherScenario>();
|
||||||
|
|
||||||
if (useOwnAcftPosition)
|
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<CWeatherScenario>();
|
||||||
|
if (!CWeatherScenario::isRealWeatherScenario(scenario)) { return; }
|
||||||
|
|
||||||
|
// we have received weather grid data and assume those are real weather updates
|
||||||
|
}
|
||||||
ui->lbl_Status->setText({});
|
ui->lbl_Status->setText({});
|
||||||
setWeatherGrid(weatherGrid);
|
setWeatherGrid(weatherGrid);
|
||||||
}
|
}
|
||||||
@@ -243,7 +250,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
// Context connections
|
// Context connections
|
||||||
Q_ASSERT(sGui->getIContextSimulator());
|
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)
|
void CWeatherComponent::setWeatherGrid(const CWeatherGrid &weatherGrid)
|
||||||
@@ -262,9 +269,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
|
||||||
ui->lbl_Status->setText(QStringLiteral("Loading around %1 %2").arg(position.latitude().toWgs84(), position.longitude().toWgs84()));
|
ui->lbl_Status->setText(QStringLiteral("Loading around %1 %2").arg(position.latitude().toWgs84(), position.longitude().toWgs84()));
|
||||||
const CWeatherGrid weatherGrid { { {}, position } };
|
sGui->getIContextSimulator()->requestWeatherGrid(position, this->identifier());
|
||||||
const auto ident = identifier();
|
|
||||||
sGui->getIContextSimulator()->requestWeatherGrid(weatherGrid, ident);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeatherComponent::onScenarioChanged()
|
void CWeatherComponent::onScenarioChanged()
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void updateWeatherInfoLine();
|
void updateWeatherInfoLine();
|
||||||
void updateWeatherInformation();
|
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();
|
void setupConnections();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user