From 006ca7186bfd783e9db5e0e6365381bb17a9f5c7 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 22 Feb 2017 17:09:13 +0000 Subject: [PATCH] Fix updating of add-on aircraft in the launcher. Kick off a re-scan when adding or removing paths. --- src/GUI/PathsDialog.cxx | 11 ++--------- src/GUI/PathsDialog.hxx | 3 ++- src/GUI/QtLauncher.cxx | 12 +++++++++++- src/GUI/QtLauncher_private.hxx | 1 + 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/GUI/PathsDialog.cxx b/src/GUI/PathsDialog.cxx index afcd36f4a..cadf9040a 100644 --- a/src/GUI/PathsDialog.cxx +++ b/src/GUI/PathsDialog.cxx @@ -124,11 +124,6 @@ void AddOnsPage::onAddSceneryPath() m_ui->sceneryPathsList->addItem(path); saveSceneryPaths(); } - - // work around a Qt OS-X bug - this dialog is ending ordered - // behind the main settings dialog (consequence of modal-dialog - // showing a modla dialog showing a modial dialog) - window()->raise(); } void AddOnsPage::onRemoveSceneryPath() @@ -175,11 +170,8 @@ void AddOnsPage::onAddAircraftPath() } saveAircraftPaths(); + emit aircraftPathsChanged(); } - // work around a Qt OS-X bug - this dialog is ending ordered - // behind the main settings dialog (consequence of modal-dialog - // showing a modla dialog showing a modial dialog) - window()->raise(); } void AddOnsPage::onRemoveAircraftPath() @@ -187,6 +179,7 @@ void AddOnsPage::onRemoveAircraftPath() if (m_ui->aircraftPathsList->currentItem()) { delete m_ui->aircraftPathsList->currentItem(); saveAircraftPaths(); + emit aircraftPathsChanged(); } } diff --git a/src/GUI/PathsDialog.hxx b/src/GUI/PathsDialog.hxx index 1b843811a..aa1a2fb21 100644 --- a/src/GUI/PathsDialog.hxx +++ b/src/GUI/PathsDialog.hxx @@ -25,7 +25,8 @@ public: signals: void downloadDirChanged(); void sceneryPathsChanged(); - + void aircraftPathsChanged(); + private slots: void onAddSceneryPath(); void onRemoveSceneryPath(); diff --git a/src/GUI/QtLauncher.cxx b/src/GUI/QtLauncher.cxx index 831c5fb6d..08efa2c79 100644 --- a/src/GUI/QtLauncher.cxx +++ b/src/GUI/QtLauncher.cxx @@ -870,6 +870,8 @@ QtLauncher::QtLauncher() : this, &QtLauncher::onDownloadDirChanged); connect(addOnsPage, &AddOnsPage::sceneryPathsChanged, this, &QtLauncher::setSceneryPaths); + connect(addOnsPage, &AddOnsPage::aircraftPathsChanged, + this, &QtLauncher::onAircraftPathsChanged); m_ui->tabWidget->addTab(addOnsPage, tr("Add-ons")); // after any kind of reset, try to restore selection and scroll @@ -1635,8 +1637,9 @@ void QtLauncher::onDownloadDirChanged() globals->get_subsystem()->init(); - QSettings settings; // re-scan the aircraft list + QSettings settings; + m_aircraftModel->setPackageRoot(globals->packageRoot()); m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList()); m_aircraftModel->scanDirs(); @@ -1647,6 +1650,13 @@ void QtLauncher::onDownloadDirChanged() setSceneryPaths(); } +void QtLauncher::onAircraftPathsChanged() +{ + QSettings settings; + m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList()); + m_aircraftModel->scanDirs(); +} + bool QtLauncher::shouldShowOfficialCatalogMessage() const { QSettings settings; diff --git a/src/GUI/QtLauncher_private.hxx b/src/GUI/QtLauncher_private.hxx index 94bea286f..451b4c9e3 100644 --- a/src/GUI/QtLauncher_private.hxx +++ b/src/GUI/QtLauncher_private.hxx @@ -109,6 +109,7 @@ private slots: void onPackagesNeedUpdate(bool yes); + void onAircraftPathsChanged(); private: /**