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:
parent
c99504f321
commit
32cc9be007
3 changed files with 16 additions and 5 deletions
|
@ -72,7 +72,7 @@ flightgear::MessageBoxResult cocoaMessageBox(const std::string& msg,
|
||||||
defaultButton:nil /* localized 'ok' */
|
defaultButton:nil /* localized 'ok' */
|
||||||
alternateButton:nil
|
alternateButton:nil
|
||||||
otherButton:nil
|
otherButton:nil
|
||||||
informativeTextWithFormat:@"%@",stdStringToCocoa(text)];
|
informativeTextWithFormat:@" %@",stdStringToCocoa(text)];
|
||||||
[[alert retain] autorelease];
|
[[alert retain] autorelease];
|
||||||
[alert runModal];
|
[alert runModal];
|
||||||
return flightgear::MSG_BOX_OK;
|
return flightgear::MSG_BOX_OK;
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include <Scenery/tilemgr.hxx>
|
#include <Scenery/tilemgr.hxx>
|
||||||
#include <Viewer/renderer.hxx>
|
#include <Viewer/renderer.hxx>
|
||||||
#include <GUI/FGFontCache.hxx>
|
#include <GUI/FGFontCache.hxx>
|
||||||
|
#include <GUI/MessageBox.hxx>
|
||||||
|
|
||||||
#include <simgear/sound/soundmgr.hxx>
|
#include <simgear/sound/soundmgr.hxx>
|
||||||
#include <simgear/scene/material/matlib.hxx>
|
#include <simgear/scene/material/matlib.hxx>
|
||||||
|
@ -761,7 +762,8 @@ static void tryAutosaveMigration(const SGPath& userDataPath, SGPropertyNode* pro
|
||||||
|
|
||||||
// read migration blacklist
|
// read migration blacklist
|
||||||
string_list 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());
|
blacklist.push_back(node->getStringValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,11 +772,20 @@ static void tryAutosaveMigration(const SGPath& userDataPath, SGPropertyNode* pro
|
||||||
|
|
||||||
// copy remaining props out
|
// copy remaining props out
|
||||||
copyProperties(&oldProps, props);
|
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)
|
// Load user settings from the autosave file (normally in $FG_HOME)
|
||||||
void
|
void
|
||||||
FGGlobals::loadUserSettings(SGPath userDataPath, bool tryMigrate)
|
FGGlobals::loadUserSettings(SGPath userDataPath)
|
||||||
{
|
{
|
||||||
if (userDataPath.isNull()) {
|
if (userDataPath.isNull()) {
|
||||||
userDataPath = get_fg_home();
|
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()
|
SG_LOG(SG_INPUT, SG_WARN, "failed to read user settings:" << e.getMessage()
|
||||||
<< "(from " << e.getOrigin() << ")");
|
<< "(from " << e.getOrigin() << ")");
|
||||||
}
|
}
|
||||||
} else if (tryMigrate) {
|
} else {
|
||||||
tryAutosaveMigration(userDataPath, &autosave);
|
tryAutosaveMigration(userDataPath, &autosave);
|
||||||
}
|
}
|
||||||
copyProperties(&autosave, globals->get_props());
|
copyProperties(&autosave, globals->get_props());
|
||||||
|
|
|
@ -385,7 +385,7 @@ public:
|
||||||
* Load user settings from the autosave file under 'userDataPath',
|
* Load user settings from the autosave file under 'userDataPath',
|
||||||
* which defaults to $FG_HOME.
|
* 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
|
* Save user settings to the autosave file under 'userDataPath', which
|
||||||
|
|
Loading…
Add table
Reference in a new issue