MCPcopy Create free account
hub / github.com/amule-project/amule / LoadAllItems

Method LoadAllItems

src/Preferences.cpp:1359–1429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1357
1358
1359void CPreferences::LoadAllItems(wxConfigBase* cfg)
1360{
1361#ifndef CLIENT_GUI
1362 // Preserve values from old config. The global config object may not be set yet
1363 // when BuildItemList() is called, so we need to provide defaults later - here.
1364 if (cfg->HasEntry("/eMule/ExecOnCompletion")) {
1365 bool ExecOnCompletion;
1366 cfg->Read("/eMule/ExecOnCompletion", &ExecOnCompletion, false);
1367 // Assign to core command, that's the most likely it was.
1368 static_cast<Cfg_Bool*>(s_CfgList[USEREVENTS_FIRST_ID + CUserEvents::DownloadCompleted * USEREVENTS_IDS_PER_EVENT + 1])->SetDefault(ExecOnCompletion);
1369 cfg->DeleteEntry("/eMule/ExecOnCompletion");
1370 }
1371 if (cfg->HasEntry("/eMule/ExecOnCompletionCommand")) {
1372 wxString ExecOnCompletionCommand;
1373 cfg->Read("/eMule/ExecOnCompletionCommand", &ExecOnCompletionCommand, "");
1374 static_cast<Cfg_Str*>(s_CfgList[USEREVENTS_FIRST_ID + CUserEvents::DownloadCompleted * USEREVENTS_IDS_PER_EVENT + 2])->SetDefault(ExecOnCompletionCommand);
1375 cfg->DeleteEntry("/eMule/ExecOnCompletionCommand");
1376 }
1377#endif
1378 CFGMap::iterator it_a = s_CfgList.begin();
1379 for ( ; it_a != s_CfgList.end(); ++it_a ) {
1380 it_a->second->LoadFromFile( cfg );
1381 }
1382
1383 CFGList::iterator it_b = s_MiscList.begin();
1384 for ( ; it_b != s_MiscList.end(); ++it_b ) {
1385 (*it_b)->LoadFromFile( cfg );
1386 }
1387
1388 // Preserve old value of UDPDisable
1389 if (cfg->HasEntry("/eMule/UDPDisable")) {
1390 bool UDPDisable;
1391 cfg->Read("/eMule/UDPDisable", &UDPDisable, false);
1392 SetUDPDisable(UDPDisable);
1393 cfg->DeleteEntry("/eMule/UDPDisable");
1394 }
1395
1396 // Preserve old value of UseSkinFiles
1397 if (cfg->HasEntry("/SkinGUIOptions/UseSkinFiles")) {
1398 bool UseSkinFiles;
1399 cfg->Read("/SkinGUIOptions/UseSkinFiles", &UseSkinFiles, false);
1400 if (!UseSkinFiles) {
1401 s_Skin.Clear();
1402 }
1403 cfg->DeleteEntry("/SkinGUIOptions/UseSkinFiles");
1404 }
1405
1406#ifdef __DEBUG__
1407 // Load debug-categories
1408 int count = theLogger.GetDebugCategoryCount();
1409
1410 for ( int i = 0; i < count; i++ ) {
1411 const CDebugCategory& cat = theLogger.GetDebugCategory( i );
1412
1413 bool enabled = false;
1414 cfg->Read( "/Debug/Cat_" + cat.GetName(), &enabled );
1415
1416 theLogger.SetEnabled( cat.GetType(), enabled );

Callers

nothing calls this directly

Calls 13

GetRandomUint8Function · 0.85
HasEntryMethod · 0.80
SetDefaultMethod · 0.80
DeleteEntryMethod · 0.80
GetDebugCategoryCountMethod · 0.80
GetNameMethod · 0.80
ReadMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
LoadFromFileMethod · 0.45
ClearMethod · 0.45
SetEnabledMethod · 0.45

Tested by

no test coverage detected