1
0
Fork 0

Rename preferences.xml -> defaults.xml

Requires FGData commit: 0565eaab10a5d466cd485766b17d1870936a0a57
(which actually renames the file).

Also disables the preferences-load command since I don’t believe it
would actually be safe to reload the defaults without doing a simulator
reset (aircraft -set.xml values would be overwritten, for example)
This commit is contained in:
James Turner 2017-01-11 17:58:22 +00:00
parent 2098593531
commit 78498c560d
9 changed files with 23 additions and 19 deletions

View file

@ -167,7 +167,7 @@ FGFlightRecorder::getDefault(void)
const char* Path = m_RecorderNode->getStringValue("default-config",NULL); const char* Path = m_RecorderNode->getStringValue("default-config",NULL);
if (!Path) if (!Path)
{ {
SG_LOG(SG_SYSTEMS, SG_ALERT, "FlightRecorder: No default flight recorder specified! Check preferences.xml!"); SG_LOG(SG_SYSTEMS, SG_ALERT, "FlightRecorder: No default flight recorder specified! Check defaults.xml!");
} }
else else
{ {

View file

@ -126,7 +126,7 @@ bool SetupRootDialog::validatePath(QString path)
// no harm // no harm
QStringList files = QStringList() QStringList files = QStringList()
<< "version" << "version"
<< "preferences.xml" << "defaults.xml"
<< "Materials/base/materials-base.xml" << "Materials/base/materials-base.xml"
<< "gui/menubar.xml" << "gui/menubar.xml"
<< "Timezone/zone.tab"; << "Timezone/zone.tab";

View file

@ -104,7 +104,7 @@ void Transponder::init()
_idCode_node = node->getChild("id-code", 0, true); _idCode_node = node->getChild("id-code", 0, true);
_idCode_node->addChangeListener(this); _idCode_node->addChangeListener(this);
// set default, but don't overwrite value from preferences.xml or -set.xml // set default, but don't overwrite value from defaults.xml or -set.xml
if (!_idCode_node->hasValue()) { if (!_idCode_node->hasValue()) {
_idCode_node->setIntValue(1200); _idCode_node->setIntValue(1200);
} }

View file

@ -395,15 +395,12 @@ do_panel_load (const SGPropertyNode * arg)
static bool static bool
do_preferences_load (const SGPropertyNode * arg) do_preferences_load (const SGPropertyNode * arg)
{ {
try { // disabling this command which was formerly used to reload 'preferences.xml'
fgLoadProps(arg->getStringValue("path", "preferences.xml"), // reloading the defaults doesn't make sense (better to reset the simulator),
globals->get_props()); // and loading arbitrary XML docs into the property-tree can be done via
} catch (const sg_exception &e) { // the standard load-xml command.
guiErrorMessage("Error reading global preferences: ", e); SG_LOG(SG_GENERAL, SG_ALERT, "preferences-load command is deprecated and non-functional");
return false; return false;
}
SG_LOG(SG_INPUT, SG_INFO, "Successfully read global preferences.");
return true;
} }
static void static void

View file

@ -472,10 +472,17 @@ int fgInitConfig ( int argc, char **argv, bool reinit )
options->init(argc, argv, dataPath); options->init(argc, argv, dataPath);
} }
// Read global preferences from $FG_ROOT/preferences.xml // Read global defaults from $FG_ROOT/defaults
SG_LOG(SG_GENERAL, SG_INFO, "Reading global preferences"); SG_LOG(SG_GENERAL, SG_INFO, "Reading global defaults");
fgLoadProps("preferences.xml", globals->get_props()); SGPath defaultsXML = globals->get_fg_root() / "defaults.xml";
SG_LOG(SG_GENERAL, SG_INFO, "Finished Reading global preferences"); if (!defaultsXML.exists()) {
flightgear::fatalMessageBox("Missing files",
"Couldn't load an essential simulator data file",
defaultsXML.utf8Str());
}
fgLoadProps("defaults.xml", globals->get_props());
SG_LOG(SG_GENERAL, SG_INFO, "Finished Reading global defaults");
// do not load user settings when reset to default is requested, or if // do not load user settings when reset to default is requested, or if
// told to explicitly ignore // told to explicitly ignore

View file

@ -190,7 +190,7 @@ FGLocale::selectLanguage(const char *language)
if (!_currentLocale) if (!_currentLocale)
{ {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_GENERAL, SG_ALERT,
"System locale not found or no internationalization settings specified in preferences.xml. Using default (en)." ); "System locale not found or no internationalization settings specified in defaults.xml. Using default (en)." );
return false; return false;
} }

View file

@ -112,7 +112,7 @@ static int fgSetupProxy( const char *arg );
/** /**
* Set a few fail-safe default property values. * Set a few fail-safe default property values.
* *
* These should all be set in $FG_ROOT/preferences.xml, but just * These should all be set in $FG_ROOT/defaults.xml, but just
* in case, we provide some initial sane values here. This method * in case, we provide some initial sane values here. This method
* should be invoked *before* reading any init files. * should be invoked *before* reading any init files.
*/ */

View file

@ -124,7 +124,7 @@ main(int argc, char** argv)
SGSharedPtr<SGPropertyNode> props = new SGPropertyNode; SGSharedPtr<SGPropertyNode> props = new SGPropertyNode;
try { try {
SGPath preferencesFile = fg_root; SGPath preferencesFile = fg_root;
preferencesFile.append("preferences.xml"); preferencesFile.append("defaults.xml");
readProperties(preferencesFile, props); readProperties(preferencesFile, props);
} catch (...) { } catch (...) {
// In case of an error, at least make summer :) // In case of an error, at least make summer :)

View file

@ -85,7 +85,7 @@ main(int argc, char** argv)
SGSharedPtr<SGPropertyNode> props = new SGPropertyNode; SGSharedPtr<SGPropertyNode> props = new SGPropertyNode;
try { try {
SGPath preferencesFile = fg_root; SGPath preferencesFile = fg_root;
preferencesFile.append("preferences.xml"); preferencesFile.append("defaults.xml");
readProperties(preferencesFile, props); readProperties(preferencesFile, props);
} catch (...) { } catch (...) {
// In case of an error, at least make summer :) // In case of an error, at least make summer :)