Advanced weather support in the launcher
This commit is contained in:
parent
daedf1e546
commit
78bacefb60
3 changed files with 38 additions and 2 deletions
|
@ -143,4 +143,13 @@ QString WeatherScenariosModel::descriptionForItem(int index) const
|
||||||
return m_scenarios.at(index).description;
|
return m_scenarios.at(index).description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString WeatherScenariosModel::nameForItem(int index) const
|
||||||
|
{
|
||||||
|
if ((index < 0) || (index >= m_scenarios.size())) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_scenarios.at(index).name;
|
||||||
|
}
|
||||||
|
|
||||||
} // of namespace flightgear
|
} // of namespace flightgear
|
||||||
|
|
|
@ -46,6 +46,8 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE QString metarForItem(int index) const;
|
Q_INVOKABLE QString metarForItem(int index) const;
|
||||||
|
|
||||||
|
Q_INVOKABLE QString nameForItem(int index) const;
|
||||||
|
|
||||||
Q_INVOKABLE QString descriptionForItem(int index) const;
|
Q_INVOKABLE QString descriptionForItem(int index) const;
|
||||||
private:
|
private:
|
||||||
struct WeatherScenario
|
struct WeatherScenario
|
||||||
|
|
|
@ -5,6 +5,16 @@ Section {
|
||||||
id: weatherSettings
|
id: weatherSettings
|
||||||
title: "Weather"
|
title: "Weather"
|
||||||
|
|
||||||
|
Checkbox {
|
||||||
|
id: advancedWeather
|
||||||
|
label: "Advanced weather modelling"
|
||||||
|
description: "Detailed weather simulation based on local terrain and "
|
||||||
|
+ "atmospheric simulation. Note that using advanced weather with "
|
||||||
|
+ "real-world weather data (METAR) information may not show exactly "
|
||||||
|
+ "the conditions recorded, and is not recommended for multi-player "
|
||||||
|
+ "flight since the weather simulation is not shared over the network."
|
||||||
|
}
|
||||||
|
|
||||||
Checkbox {
|
Checkbox {
|
||||||
id: fetchMetar
|
id: fetchMetar
|
||||||
label: "Real-world weather"
|
label: "Real-world weather"
|
||||||
|
@ -50,14 +60,29 @@ Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onApply: {
|
onApply: {
|
||||||
|
if (advancedWeather.checked) {
|
||||||
|
// set description from the weather scenarios, so Local-weather
|
||||||
|
// can run the appropriate simulation
|
||||||
|
_config.setProperty("/nasal/local_weather/enabled", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = weatherScenario.selectedIndex;
|
||||||
|
|
||||||
if (!fetchMetar.checked) {
|
if (!fetchMetar.checked) {
|
||||||
if (weatherScenario.isCustomMETAR) {
|
if (weatherScenario.isCustomMETAR) {
|
||||||
_config.setArg("metar", customMETAR.value)
|
_config.setArg("metar", customMETAR.value)
|
||||||
} else {
|
} else {
|
||||||
_config.setArg("metar", _weatherScenarios.metarForItem(weatherScenario.selectedIndex))
|
_config.setArg("metar", _weatherScenarios.metarForItem(index))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// either way, set the scenario name since Local-Weather keys off
|
||||||
|
// this to know what to do with the scenario + metar data
|
||||||
|
_config.setProperty("/environment/weather-scenario",
|
||||||
|
_weatherScenarios.nameForItem(index))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
summary: fetchMetar.checked ? "real-world weather;" : ""
|
summary: (advancedWeather.checked ? "advanced weather;" : "")
|
||||||
|
+ (fetchMetar.checked ? "real-world weather;" : "")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue