MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / initialiseModule

Method initialiseModule

radiantcore/xmlregistry/XMLRegistry.cpp:290–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290void XMLRegistry::initialiseModule(const IApplicationContext& ctx)
291{
292 // Load the XML files from the runtime data directory
293 std::string base = ctx.getRuntimeDataPath();
294
295 rMessage() << "XMLRegistry: looking for XML files in " << base << std::endl;
296
297 try
298 {
299 // Load all of the required XML files
300 import(base + "user.xml", "", Registry::treeStandard);
301 import(base + "colours.xml", "user/ui", Registry::treeStandard);
302 import(base + "input.xml", "user/ui", Registry::treeStandard);
303 import(base + "menu.xml", "user/ui", Registry::treeStandard);
304 import(base + "commandsystem.xml", "user/ui", Registry::treeStandard);
305
306 // Load the debug.xml file only if the relevant key is set in user.xml
307 if (get("user/debug") == "1")
308 {
309 import(base + "debug.xml", "", Registry::treeStandard);
310 }
311 }
312 catch (std::runtime_error& e)
313 {
314 rConsoleError() << "XML registry population failed:\n\n" << e.what() << std::endl;
315 }
316
317 // Load user preferences, these overwrite any values that have defined before
318 settings::SettingsManager manager(ctx);
319
320 loadUserFileFromSettingsPath(manager, "user.xml", "");
321 loadUserFileFromSettingsPath(manager, "colours.xml", "user/ui");
322 loadUserFileFromSettingsPath(manager, "input.xml", "user/ui");
323 loadUserFileFromSettingsPath(manager, "filters.xml", "user/ui/filtersystem");
324
325 // Subscribe to the post-module-shutdown signal to save changes to disk
326 module::GlobalModuleRegistry().signal_allModulesUninitialised().connect(
327 sigc::mem_fun(this, &XMLRegistry::shutdown));
328
329 _autosaveTimer.reset(new util::Timer(2000,
330 sigc::mem_fun(this, &XMLRegistry::onAutoSaveTimerIntervalReached)));
331
332 module::GlobalModuleRegistry().signal_allModulesInitialised().connect([this]()
333 {
334 _autosaveTimer->start();
335 });
336}
337
338void XMLRegistry::shutdownModule()
339{

Callers

nothing calls this directly

Calls 8

rMessageFunction · 0.85
getFunction · 0.85
rConsoleErrorFunction · 0.85
whatMethod · 0.80
getRuntimeDataPathMethod · 0.45
connectMethod · 0.45
resetMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected