1
0
Fork 0

Fix updating of add-on aircraft in the launcher.

Kick off a re-scan when adding or removing paths.
This commit is contained in:
James Turner 2017-02-22 17:09:13 +00:00
parent 72988a6bb7
commit 006ca7186b
4 changed files with 16 additions and 11 deletions

View file

@ -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();
}
}

View file

@ -25,6 +25,7 @@ public:
signals:
void downloadDirChanged();
void sceneryPathsChanged();
void aircraftPathsChanged();
private slots:
void onAddSceneryPath();

View file

@ -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<FGHTTPClient>()->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;

View file

@ -109,6 +109,7 @@ private slots:
void onPackagesNeedUpdate(bool yes);
void onAircraftPathsChanged();
private:
/**