mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T786, emulated sim. dialog weather support
* display weather * request weather
This commit is contained in:
committed by
Mat Sutcliffe
parent
026e19add0
commit
579a3b28e1
@@ -9,6 +9,7 @@
|
|||||||
#include "simulatoremulatedmonitordialog.h"
|
#include "simulatoremulatedmonitordialog.h"
|
||||||
#include "ui_simulatoremulatedmonitordialog.h"
|
#include "ui_simulatoremulatedmonitordialog.h"
|
||||||
#include "simulatoremulated.h"
|
#include "simulatoremulated.h"
|
||||||
|
#include "blackcore/context/contextsimulator.h"
|
||||||
#include "blackgui/components/cockpitcomtransmissioncomponent.h"
|
#include "blackgui/components/cockpitcomtransmissioncomponent.h"
|
||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
@@ -72,6 +73,7 @@ namespace BlackSimPlugin
|
|||||||
connect(ui->pb_InterpolatorFetch, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::interpolatorLogButton);
|
connect(ui->pb_InterpolatorFetch, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::interpolatorLogButton);
|
||||||
connect(ui->pb_EmitAddedFailed, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::emitSignal);
|
connect(ui->pb_EmitAddedFailed, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::emitSignal);
|
||||||
connect(ui->pb_AddAutoPublishData, &QPushButton::clicked, this, &CSimulatorEmulatedMonitorDialog::addAutoPublishTestData);
|
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->setToolTips("receiving", "idle");
|
||||||
ui->led_Receiving->setShape(CLedWidget::Rounded);
|
ui->led_Receiving->setShape(CLedWidget::Rounded);
|
||||||
@@ -158,7 +160,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorEmulatedMonitorDialog::receivedWeather(const CWeatherGrid &weatherGrid)
|
void CSimulatorEmulatedMonitorDialog::receivedWeather(const CWeatherGrid &weatherGrid)
|
||||||
{
|
{
|
||||||
Q_UNUSED(weatherGrid)
|
ui->te_Weather->setText(weatherGrid.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged()
|
void CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged()
|
||||||
@@ -330,5 +332,28 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
return (m_simulator && sGui && !sGui->isShuttingDown());
|
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
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ namespace BlackSimPlugin
|
|||||||
//! Can use the emulated simulator
|
//! Can use the emulated simulator
|
||||||
bool canUseSimulator() const;
|
bool canUseSimulator() const;
|
||||||
|
|
||||||
|
//! Request weather
|
||||||
|
void requestWeather();
|
||||||
|
|
||||||
QScopedPointer<Ui::CSimulatorEmulatedMonitorDialog> ui;
|
QScopedPointer<Ui::CSimulatorEmulatedMonitorDialog> ui;
|
||||||
CSimulatorEmulated *m_simulator = nullptr;
|
CSimulatorEmulated *m_simulator = nullptr;
|
||||||
QTimer m_uiUpdateTimer;
|
QTimer m_uiUpdateTimer;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tw_SwiftMonitorDialog">
|
<widget class="QTabWidget" name="tw_SwiftMonitorDialog">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tb_AircraftSituation">
|
<widget class="QWidget" name="tb_AircraftSituation">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -457,6 +457,32 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tb_Weather">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Weather</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="vl_Weather">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_RequestWeather">
|
||||||
|
<property name="title">
|
||||||
|
<string>Request weather</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vl_GbWeather">
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QPushButton" name="pb_RequestWeather">
|
||||||
|
<property name="text">
|
||||||
|
<string>request weather</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="te_Weather"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="QWidget" name="tb_LogMessages">
|
<widget class="QWidget" name="tb_LogMessages">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>API/Log information</string>
|
<string>API/Log information</string>
|
||||||
@@ -601,7 +627,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>634</width>
|
<width>634</width>
|
||||||
<height>353</height>
|
<height>384</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vl_LogMessagesScrollArea">
|
<layout class="QVBoxLayout" name="vl_LogMessagesScrollArea">
|
||||||
|
|||||||
Reference in New Issue
Block a user