| 1357 | |
| 1358 | |
| 1359 | void 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 ); |
nothing calls this directly
no test coverage detected