diff --git a/src/GUI/LauncherMainWindow.cxx b/src/GUI/LauncherMainWindow.cxx index c34cb427a..5002bc228 100644 --- a/src/GUI/LauncherMainWindow.cxx +++ b/src/GUI/LauncherMainWindow.cxx @@ -493,6 +493,18 @@ void LauncherMainWindow::collectAircraftArgs() qWarning() << "unsupported aircraft launch URL" << m_selectedAircraft; } } + + + // scenery paths + QSettings settings; + Q_FOREACH(QString path, settings.value("scenery-paths").toStringList()) { + m_config->setArg("fg-scenery", path); + } + + // aircraft paths + Q_FOREACH(QString path, settings.value("aircraft-paths").toStringList()) { + m_config->setArg("fg-aircraft", path); + } } void LauncherMainWindow::onRun() @@ -511,16 +523,16 @@ void LauncherMainWindow::onRun() m_recentAircraft.pop_back(); } -// m_ui->location->setLocationProperties(); + // aircraft paths + QSettings settings; updateLocationHistory(); - QSettings settings; - QString downloadDir = settings.value("download-dir").toString(); + QString downloadDir = settings.value("downloadSettings/downloadDir").toString(); if (!downloadDir.isEmpty()) { QDir d(downloadDir); if (!d.exists()) { int result = QMessageBox::question(this, tr("Create download folder?"), - tr("The selected location for downloads does not exist. Create it?"), + tr("The selected location for downloads does not exist. (%1) Create it?").arg(downloadDir), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (result == QMessageBox::Cancel) { return; @@ -532,17 +544,6 @@ void LauncherMainWindow::onRun() } } - // scenery paths - Q_FOREACH(QString path, settings.value("scenery-paths").toStringList()) { - opt->addOption("fg-scenery", path.toStdString()); - } - - // aircraft paths - Q_FOREACH(QString path, settings.value("aircraft-paths").toStringList()) { - // can't use fg-aircraft for this, as it is processed before the launcher is run - globals->append_aircraft_path(path.toStdString()); - } - if (settings.contains("restore-defaults-on-run")) { settings.remove("restore-defaults-on-run"); opt->addOption("restore-defaults", ""); diff --git a/src/GUI/PathsDialog.cxx b/src/GUI/PathsDialog.cxx index 33c57a367..5ba1ee987 100644 --- a/src/GUI/PathsDialog.cxx +++ b/src/GUI/PathsDialog.cxx @@ -68,9 +68,15 @@ AddOnsPage::AddOnsPage(QWidget *parent, simgear::pkg::RootRef root) : QStringList sceneryPaths = settings.value("scenery-paths").toStringList(); m_ui->sceneryPathsList->addItems(sceneryPaths); + connect(m_ui->sceneryPathsList->model(), &QAbstractItemModel::rowsMoved, + this, &AddOnsPage::saveSceneryPaths); + QStringList aircraftPaths = settings.value("aircraft-paths").toStringList(); m_ui->aircraftPathsList->addItems(aircraftPaths); + connect(m_ui->aircraftPathsList->model(), &QAbstractItemModel::rowsMoved, + this, &AddOnsPage::saveAircraftPaths); + updateUi(); } @@ -160,7 +166,6 @@ void AddOnsPage::onAddAircraftPath() } saveAircraftPaths(); - emit aircraftPathsChanged(); } } @@ -169,7 +174,6 @@ void AddOnsPage::onRemoveAircraftPath() if (m_ui->aircraftPathsList->currentItem()) { delete m_ui->aircraftPathsList->currentItem(); saveAircraftPaths(); - emit aircraftPathsChanged(); } } @@ -183,6 +187,7 @@ void AddOnsPage::saveAircraftPaths() } settings.setValue("aircraft-paths", paths); + emit aircraftPathsChanged(); } void AddOnsPage::saveSceneryPaths() @@ -293,3 +298,8 @@ void AddOnsPage::updateUi() FGHTTPClient* http = globals->get_subsystem(); m_ui->addDefaultCatalogButton->setEnabled(!http->isDefaultCatalogInstalled()); } + +void AddOnsPage::onDraggedAircraftList() +{ + qWarning() << "did drag aircraft list"; +} diff --git a/src/GUI/PathsDialog.hxx b/src/GUI/PathsDialog.hxx index 14102dd66..1361d4ac8 100644 --- a/src/GUI/PathsDialog.hxx +++ b/src/GUI/PathsDialog.hxx @@ -38,11 +38,14 @@ private slots: void onAddDefaultCatalog(); void onInstallScenery(); -private: - void updateUi(); + + void onDraggedAircraftList(); void saveAircraftPaths(); void saveSceneryPaths(); +private: + void updateUi(); + bool haveSceneryPath(QString path) const; Ui::AddOnsPage* m_ui;