diff --git a/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.cpp b/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.cpp index 23fc72519..357875886 100644 --- a/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.cpp +++ b/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.cpp @@ -9,6 +9,7 @@ #include "simulatoremulatedmonitordialog.h" #include "ui_simulatoremulatedmonitordialog.h" #include "simulatoremulated.h" +#include "blackcore/context/contextsimulator.h" #include "blackgui/components/cockpitcomtransmissioncomponent.h" #include "blackgui/guiapplication.h" #include "blackmisc/logmessage.h" @@ -72,6 +73,7 @@ namespace BlackSimPlugin connect(ui->pb_InterpolatorFetch, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::interpolatorLogButton); connect(ui->pb_EmitAddedFailed, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::emitSignal); connect(ui->pb_AddAutoPublishData, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::addAutoPublishTestData); + connect(ui->pb_RequestWeather, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::requestWeather); ui->led_Receiving->setToolTips("receiving", "idle"); ui->led_Receiving->setShape(CLedWidget::Rounded); @@ -158,7 +160,7 @@ namespace BlackSimPlugin void CSimulatorEmulatedMonitorDialog::receivedWeather(const CWeatherGrid &weatherGrid) { - Q_UNUSED(weatherGrid) + ui->te_Weather->setText(weatherGrid.getDescription()); } void CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged() @@ -330,5 +332,28 @@ namespace BlackSimPlugin { return (m_simulator && sGui && !sGui->isShuttingDown()); } + + void CSimulatorEmulatedMonitorDialog::requestWeather() + { + if (!this->canUseSimulator()) { return; } + + /** + if (sGui && sGui->getIContextSimulator()) + { + const CSimulatedAircraft ownAircraft = m_simulator->getOwnAircraft(); + const CWeatherGrid grid{ { "GLOB", ownAircraft.getSituation() } }; + sGui->getIContextSimulator()->requestWeatherGrid(grid, m_simulator->identifier()); + } + **/ + + if (m_simulator->requestWeather()) + { + ui->te_Weather->setText("Requested weather"); + } + else + { + ui->te_Weather->setText("Cannot requested weather, weather activated?"); + } + } } // ns } // ns diff --git a/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.h b/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.h index e3b881ada..f78c71a48 100644 --- a/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.h +++ b/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.h @@ -120,6 +120,9 @@ namespace BlackSimPlugin //! Can use the emulated simulator bool canUseSimulator() const; + //! Request weather + void requestWeather(); + QScopedPointer ui; CSimulatorEmulated *m_simulator = nullptr; QTimer m_uiUpdateTimer; diff --git a/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.ui b/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.ui index 1034ef256..f24a540b9 100644 --- a/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.ui +++ b/src/plugins/simulator/emulated/simulatoremulatedmonitordialog.ui @@ -68,7 +68,7 @@ - 4 + 0 @@ -457,6 +457,32 @@ + + + Weather + + + + + + Request weather + + + + + + request weather + + + + + + + + + + + API/Log information @@ -601,7 +627,7 @@ 0 0 634 - 353 + 384