Launcher bugfix: custom download dirs
Partial fixes for: https://sourceforge.net/p/flightgear/codetickets/2019/ But further work needed on Windows I expect, will do that now.
This commit is contained in:
parent
2e438e357e
commit
6f8a788d80
3 changed files with 17 additions and 25 deletions
|
@ -344,9 +344,9 @@ void LauncherController::downloadDirChanged(QString path)
|
|||
return;
|
||||
}
|
||||
|
||||
// if the default dir is passed in, map that back to the emptru string
|
||||
// if the default dir is passed in, map that back to the empty string
|
||||
if (path == m_config->defaultDownloadDir()) {
|
||||
path.clear();;
|
||||
path.clear();
|
||||
}
|
||||
|
||||
auto options = flightgear::Options::sharedInstance();
|
||||
|
@ -364,25 +364,9 @@ void LauncherController::downloadDirChanged(QString path)
|
|||
options->clearOption("download-dir");
|
||||
}
|
||||
|
||||
// replace existing package root
|
||||
globals->get_subsystem<FGHTTPClient>()->shutdown();
|
||||
globals->setPackageRoot(simgear::pkg::RootRef());
|
||||
|
||||
// create new root with updated download-dir value
|
||||
fgInitPackageRoot();
|
||||
|
||||
globals->get_subsystem<FGHTTPClient>()->init();
|
||||
|
||||
QSettings settings;
|
||||
// re-scan the aircraft list
|
||||
m_aircraftModel->setPackageRoot(globals->packageRoot());
|
||||
|
||||
auto aircraftCache = LocalAircraftCache::instance();
|
||||
aircraftCache->setPaths(settings.value("aircraft-paths").toStringList());
|
||||
aircraftCache->scanDirs();
|
||||
|
||||
// re-set scenery dirs
|
||||
flightgear::launcherSetSceneryPaths();
|
||||
m_config->setValueForKey("", "download-dir", path);
|
||||
saveSettings();
|
||||
flightgear::restartTheApp();
|
||||
}
|
||||
|
||||
QmlAircraftInfo *LauncherController::selectedAircraftInfo() const
|
||||
|
|
|
@ -62,6 +62,9 @@ Item {
|
|||
|
||||
function saveState()
|
||||
{
|
||||
if (root.setting === "")
|
||||
return;
|
||||
|
||||
if (this.hasOwnProperty("value")) {
|
||||
_config.setValueForKey("", root.setting, this.value)
|
||||
} else {
|
||||
|
@ -71,10 +74,8 @@ Item {
|
|||
|
||||
function restoreState()
|
||||
{
|
||||
if (root.setting == "") {
|
||||
console.warn("Missing setting key on " + label)
|
||||
if (root.setting === "")
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"value" in root) {
|
||||
console.warn("No value property on " + root);
|
||||
|
|
|
@ -309,7 +309,8 @@ Item {
|
|||
label: qsTr("Download location")
|
||||
description: qsTr("FlightGear stores downloaded files (scenery and aircraft) in this location. "
|
||||
+ "Depending on your settings, it may grow to a considerable size (many gigabytes). "
|
||||
+ "If you change the download location, files will need to be downloaded again.")
|
||||
+ "If you change the download location, files will need to be downloaded again. "
|
||||
+ "When changing this setting, FlightGear will restart to use the new location correctly.")
|
||||
advanced: true
|
||||
chooseDirectory: true
|
||||
defaultPath: _config.defaultDownloadDir
|
||||
|
@ -327,6 +328,12 @@ Item {
|
|||
// value is changed.
|
||||
_launcher.downloadDirChanged(path);
|
||||
}
|
||||
|
||||
function saveState()
|
||||
{
|
||||
// ensure this is a no-op, we write the value explicity
|
||||
// in LauncherController::downloadDirChanged
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in a new issue