mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Add control button to activate and deactivate swift weather
- GUI changes - Context and ISimulator APIs - Refactored settings and static weather injection in CSimulatorCommon refs #807
This commit is contained in:
committed by
Mathew Sutcliffe
parent
2cea07f174
commit
1a6c7fa192
@@ -52,6 +52,8 @@ namespace BlackGui
|
||||
auto scenario = m_weatherScenarioSetting.get();
|
||||
ui->cb_weatherScenario->setCurrentIndex(scenario.getIndex());
|
||||
|
||||
ui->pb_ActivateWeather->setIcon(CIcons::metar());
|
||||
|
||||
setupConnections();
|
||||
setupInputValidators();
|
||||
setupCompleter();
|
||||
@@ -107,6 +109,21 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CWeatherComponent::toggleWeatherActivation()
|
||||
{
|
||||
if (m_isWeatherActivated)
|
||||
{
|
||||
m_isWeatherActivated = false;
|
||||
ui->pb_ActivateWeather->setText("Activate");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isWeatherActivated = true;
|
||||
ui->pb_ActivateWeather->setText("Deactivate");
|
||||
}
|
||||
sGui->getIContextSimulator()->setWeatherActivated(m_isWeatherActivated);
|
||||
}
|
||||
|
||||
void CWeatherComponent::setWeatherScenario(int index)
|
||||
{
|
||||
if (index == -1) { return; }
|
||||
@@ -198,6 +215,7 @@ namespace BlackGui
|
||||
connect(ui->le_Lon, &QLineEdit::returnPressed, this, &CWeatherComponent::updateWeatherInformation);
|
||||
connect(ui->cb_UseOwnAcftPosition, &QCheckBox::toggled, this, &CWeatherComponent::toggleUseOwnAircraftPosition);
|
||||
connect(&m_weatherUpdateTimer, &QTimer::timeout, this, &CWeatherComponent::updateWeatherInformation);
|
||||
connect(ui->pb_ActivateWeather, &QPushButton::clicked, this, &CWeatherComponent::toggleWeatherActivation);
|
||||
|
||||
// Context connections
|
||||
Q_ASSERT(sGui->getIContextSimulator());
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
void toggleUseOwnAircraftPosition(bool checked);
|
||||
void toggleWeatherActivation();
|
||||
void setWeatherScenario(int index);
|
||||
|
||||
void updateWeatherInformation();
|
||||
@@ -76,6 +77,7 @@ namespace BlackGui
|
||||
QTimer m_weatherUpdateTimer { this };
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastOwnAircraftPosition;
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TSelectedWeatherScenario> m_weatherScenarioSetting { this };
|
||||
bool m_isWeatherActivated = false;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -35,9 +35,16 @@
|
||||
<string>Weather Control</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_WeatherComponent">
|
||||
<item row="0" column="0">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QComboBox" name="cb_weatherScenario"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_ActivateWeather">
|
||||
<property name="text">
|
||||
<string>Activate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user