1
0
Fork 0

Enable auto-save migration.

When performing the migration, let the user know it happened, and to
be alert for any issues that might occur.
This commit is contained in:
James Turner 2017-09-20 17:57:25 +01:00
parent c99504f321
commit 32cc9be007
3 changed files with 16 additions and 5 deletions

View file

@ -72,7 +72,7 @@ flightgear::MessageBoxResult cocoaMessageBox(const std::string& msg,
defaultButton:nil /* localized 'ok' */
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"%@",stdStringToCocoa(text)];
informativeTextWithFormat:@" %@",stdStringToCocoa(text)];
[[alert retain] autorelease];
[alert runModal];
return flightgear::MSG_BOX_OK;

View file

@ -58,6 +58,7 @@
#include <Scenery/tilemgr.hxx>
#include <Viewer/renderer.hxx>
#include <GUI/FGFontCache.hxx>
#include <GUI/MessageBox.hxx>
#include <simgear/sound/soundmgr.hxx>
#include <simgear/scene/material/matlib.hxx>
@ -761,7 +762,8 @@ static void tryAutosaveMigration(const SGPath& userDataPath, SGPropertyNode* pro
// read migration blacklist
string_list blacklist;
for (auto node : fgGetNode("/sim/autosave-migration/blacklist")->getChildren("path")) {
SGPropertyNode_ptr blacklistNode = fgGetNode("/sim/autosave-migration/blacklist", true);
for (auto node : blacklistNode->getChildren("path")) {
blacklist.push_back(node->getStringValue());
}
@ -770,11 +772,20 @@ static void tryAutosaveMigration(const SGPath& userDataPath, SGPropertyNode* pro
// copy remaining props out
copyProperties(&oldProps, props);
// inform the user
#if !defined(FG_TESTLIB)
flightgear::modalMessageBox("Settings migrated",
"Saved settings were migrated from a previous version of FlightGear. "
"If you encounter any problems when using the system, try restoring "
"the default settings, before reporting a problem."
"Saved settings can affect the appearance, performance and features of the simulator.");
#endif
}
// Load user settings from the autosave file (normally in $FG_HOME)
void
FGGlobals::loadUserSettings(SGPath userDataPath, bool tryMigrate)
FGGlobals::loadUserSettings(SGPath userDataPath)
{
if (userDataPath.isNull()) {
userDataPath = get_fg_home();
@ -794,7 +805,7 @@ FGGlobals::loadUserSettings(SGPath userDataPath, bool tryMigrate)
SG_LOG(SG_INPUT, SG_WARN, "failed to read user settings:" << e.getMessage()
<< "(from " << e.getOrigin() << ")");
}
} else if (tryMigrate) {
} else {
tryAutosaveMigration(userDataPath, &autosave);
}
copyProperties(&autosave, globals->get_props());

View file

@ -385,7 +385,7 @@ public:
* Load user settings from the autosave file under 'userDataPath',
* which defaults to $FG_HOME.
*/
void loadUserSettings(SGPath userDatapath = SGPath(), bool tryMigrate = false);
void loadUserSettings(SGPath userDatapath = SGPath());
/**
* Save user settings to the autosave file under 'userDataPath', which