1
0
Fork 0

Qt launcher: accept scenery paths containing either of: Buildings, Roads, Pylons

When adding a scenery path in the built-in launcher, accept folders
containing any of the new directories populated by osm2city. Also try to
improve the message that is displayed when the sanity check conditions
for the added scenery path aren't met (cf. discussion around
<https://sourceforge.net/p/flightgear/mailman/message/35716946/>).
This commit is contained in:
Florent Rougon 2017-03-15 00:28:51 +01:00
parent 40be2687f7
commit f4788cddb4

View file

@ -105,17 +105,24 @@ void AddOnsPage::onAddSceneryPath()
// validation
SGPath p(path.toStdString());
SGPath objectsPath = p / "Objects";
SGPath terrainPath = p / "Terrain";
SGPath navdataPath = p / "NavData";
bool isValid = false;
if (!objectsPath.exists() && !terrainPath.exists() && !navdataPath.exists()) {
for (const auto& dir: {"Objects", "Terrain", "Buildings", "Roads",
"Pylons", "NavData"}) {
if ((p / dir).exists()) {
isValid = true;
break;
}
}
if (!isValid) {
QMessageBox mb;
mb.setText(QString("The folder '%1' doesn't appear to contain scenery - add anyway?").arg(path));
mb.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
mb.setDefaultButton(QMessageBox::No);
mb.setInformativeText("Added scenery should contain folders called "
"'Objects' and / or 'Terrain' and / or 'NavData'");
mb.setInformativeText(
"Added scenery should contain at least one of the following "
"folders: Objects, Terrain, Buildings, Roads, Pylons, NavData.");
mb.exec();
if (mb.result() == QMessageBox::No) {