100 QAbstractListModel(pr)
104 SGPropertyNode_ptr scenarios = root->getNode(
"environment/weather-scenarios");
106 int nChildren = scenarios->nChildren();
107 for (
int i = 0;
i < nChildren;
i++) {
108 SGPropertyNode_ptr scenario = scenarios->getChild(
i);
109 if (scenario->getNameString() !=
"scenario") {
115 if (scenario->getStringValue(
"local-weather/tile-type") == std::string(
"live")) {
120 const std::string wsId = scenario->getStringValue(
"id");
123 auto locale =
globals->get_locale();
124 ws.name = QString::fromStdString(locale->getLocalizedString(wsId +
"-name",
"weather-scenarios"));
125 ws.description = QString::fromStdString(locale->getLocalizedString(wsId +
"-desc",
"weather-scenarios"));
127 ws.name = QString::fromStdString(scenario->getStringValue(
"name"));
128 ws.description = QString::fromStdString(scenario->getStringValue(
"description")).simplified();
131 ws.metar = QString::fromStdString(scenario->getStringValue(
"metar"));
132 if (scenario->hasChild(
"local-weather")) {
133 ws.localWeatherTileManagement = QString::fromStdString(scenario->getStringValue(
"local-weather/tile-management"));
134 ws.localWeatherTileType = QString::fromStdString(scenario->getStringValue(
"local-weather/tile-type"));
136 m_scenarios.push_back(ws);
148 const int row = index.row();
149 if ((row < 0) || (
static_cast<std::vector<WeatherScenariosModel::WeatherScenario>::size_type
>(row) >= m_scenarios.size())) {
153 const WeatherScenario& scenario(m_scenarios.at(row));
154 if ((role == Qt::DisplayRole) || (role == NameRole)) {
155 return scenario.name;
156 }
else if (role == DescriptionRole) {
157 return scenario.description;
158 }
else if (role == MetarRole) {
159 return scenario.metar;