From f4788cddb4e4d87c436b2461ab30eb4ac6faeff0 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Wed, 15 Mar 2017 00:28:51 +0100 Subject: [PATCH] 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 ). --- src/GUI/PathsDialog.cxx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/GUI/PathsDialog.cxx b/src/GUI/PathsDialog.cxx index 20041dd43..397ff6c02 100644 --- a/src/GUI/PathsDialog.cxx +++ b/src/GUI/PathsDialog.cxx @@ -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) {