122
122
return writeString(TC_User, scope, key, value);
125
bool ConfigurationController::readStringUser(const std::string& scope, const std::string& key, std::string& value, const std::string& defaultValue)
125
bool ConfigurationController::readStringUser(const std::string& scope, const std::string& key, std::string& value, const std::string& defaultValue)
127
127
if (!readString(TC_General, scope, key, value, defaultValue)) {
128
return readString(TC_User, scope, key, value, defaultValue);
128
if (!readString(TC_Machine, scope, key, value, defaultValue)) {
129
return readString(TC_User, scope, key, value, defaultValue);
134
135
bool ConfigurationController::readBoolUser(const std::string& scope, const std::string& key, bool& value, bool defaultValue)
136
137
if (!readBool(TC_General, scope, key, value, defaultValue)) {
137
return readBool(TC_User, scope, key, value, defaultValue);
138
if (!readBool(TC_Machine, scope, key, value, defaultValue)) {
139
return readBool(TC_User, scope, key, value, defaultValue);
143
145
bool ConfigurationController::writeBoolUser(const std::string& scope, const std::string& key, bool value)
148
150
bool ConfigurationController::readIntUser(const std::string& scope, const std::string& key, int& value, int defaultValue)
150
152
if (!readInt(TC_General, scope, key, value, defaultValue)) {
151
return readInt(TC_User, scope, key, value, defaultValue);
153
if (!readInt(TC_Machine, scope, key, value, defaultValue)) {
154
return readInt(TC_User, scope, key, value, defaultValue);
157
160
bool ConfigurationController::writeIntUser(const std::string& scope, const std::string& key, int value)
162
165
bool ConfigurationController::readDoubleUser(const std::string& scope, const std::string& key, double& value, double defaultValue)
164
167
if (!readDouble(TC_General, scope, key, value, defaultValue)) {
165
return readDouble(TC_User, scope, key, value, defaultValue);
168
if (!readDouble(TC_Machine, scope, key, value, defaultValue)) {
169
return readDouble(TC_User, scope, key, value, defaultValue);
171
175
bool ConfigurationController::writeDoubleUser(const std::string& scope, const std::string& key, double value)
181
185
bool ConfigurationController::readGroupUser(const std::string& scope, TListGroups& listOfGroups)
183
187
if (!readGroup(TC_General, scope, listOfGroups)) {
184
return readGroup(TC_User, scope, listOfGroups);
188
if (!readGroup(TC_Machine, scope, listOfGroups)) {
189
return readGroup(TC_User, scope, listOfGroups);
190
195
bool ConfigurationController::saveGlobalConfigurationFile(const std::string& path)
231
236
wxCriticalSectionLocker locker(m_criticalSection);
232
237
wxConfigBase * config;
233
if (type==TC_General) {
234
config = m_pGeneralConfig;
236
config = m_pUserConfig;
240
config = m_pUserConfig;
243
config = m_pMachineConfig;
247
config = m_pGeneralConfig;
249
if (config == NULL) {
238
252
config->SetPath(wxString::FromUTF8(scope.c_str()));
247
261
wxCriticalSectionLocker locker(m_criticalSection);
248
262
wxConfigBase * config;
249
if (type==TC_General) {
250
config = m_pGeneralConfig;
252
config = m_pUserConfig;
265
config = m_pUserConfig;
268
config = m_pMachineConfig;
272
config = m_pGeneralConfig;
274
if (config == NULL) {
254
277
config->SetPath(wxString::FromUTF8(scope.c_str()));
263
286
wxCriticalSectionLocker locker(m_criticalSection);
264
287
wxConfigBase * config;
265
if (type==TC_General) {
266
config = m_pGeneralConfig;
268
config = m_pUserConfig;
290
config = m_pUserConfig;
293
config = m_pMachineConfig;
297
config = m_pGeneralConfig;
299
if (config == NULL) {
270
302
config->SetPath(wxString::FromUTF8(scope.c_str()));
279
311
wxCriticalSectionLocker locker(m_criticalSection);
280
312
wxConfigBase * config;
281
if (type==TC_General) {
282
config = m_pGeneralConfig;
284
config = m_pUserConfig;
315
config = m_pUserConfig;
318
config = m_pMachineConfig;
322
config = m_pGeneralConfig;
324
if (config == NULL) {
286
327
config->SetPath(wxString::FromUTF8(scope.c_str()));
295
336
wxCriticalSectionLocker locker(m_criticalSection);
296
337
wxConfigBase * config;
297
if (type==TC_General) {
298
config = m_pGeneralConfig;
300
config = m_pUserConfig;
340
config = m_pUserConfig;
343
config = m_pMachineConfig;
347
config = m_pGeneralConfig;
349
if (config == NULL) {
302
352
config->SetPath(wxString::FromUTF8(scope.c_str()));
311
361
wxCriticalSectionLocker locker(m_criticalSection);
312
362
wxConfigBase * config;
313
if (type==TC_General) {
314
config = m_pGeneralConfig;
316
config = m_pUserConfig;
365
config = m_pUserConfig;
368
config = m_pMachineConfig;
372
config = m_pGeneralConfig;
374
if (config == NULL) {
318
377
config->SetPath(wxString::FromUTF8(scope.c_str()));
327
386
wxCriticalSectionLocker locker(m_criticalSection);
328
387
wxConfigBase * config;
329
if (type==TC_General) {
330
config = m_pGeneralConfig;
332
config = m_pUserConfig;
390
config = m_pUserConfig;
393
config = m_pMachineConfig;
397
config = m_pGeneralConfig;
399
if (config == NULL) {
334
402
config->SetPath(wxString::FromUTF8(scope.c_str()));
343
411
wxCriticalSectionLocker locker(m_criticalSection);
344
412
wxConfigBase * config;
345
if (type==TC_General) {
346
config = m_pGeneralConfig;
348
config = m_pUserConfig;
415
config = m_pUserConfig;
418
config = m_pMachineConfig;
422
config = m_pGeneralConfig;
424
if (config == NULL) {
350
427
config->SetPath(wxString::FromUTF8(scope.c_str()));
359
436
wxCriticalSectionLocker locker(m_criticalSection);
360
437
wxConfigBase * config;
361
if (type==TC_General) {
362
config = m_pGeneralConfig;
364
config = m_pUserConfig;
440
config = m_pUserConfig;
443
config = m_pMachineConfig;
447
config = m_pGeneralConfig;
449
if (config == NULL) {
366
452
config->DeleteGroup(wxString::FromUTF8(scope.c_str()));
367
453
config->SetPath(wxString::FromUTF8(scope.c_str()));
383
469
wxCriticalSectionLocker locker(m_criticalSection);
384
470
wxConfigBase * config;
385
if (type==TC_General) {
386
config = m_pGeneralConfig;
388
config = m_pUserConfig;
473
config = m_pUserConfig;
476
config = m_pMachineConfig;
480
config = m_pGeneralConfig;
482
if (config == NULL) {
390
485
config->SetPath(wxString::FromUTF8(scope.c_str()));
407
502
config->SetPath(wxT(".."));
408
503
bCont = config->GetNextGroup(str, dummy);
505
return !listOfGroups.empty();
413
508
ConfigurationController::ConfigurationController()
537
wxString pathMachineConfig = fileName.GetPath(true) + wxT("GinkgoMachine.ini");
538
if(wxFileExists(pathMachineConfig)) {
539
m_pMachineConfig = new wxFileConfig(wxEmptyString,wxEmptyString,pathMachineConfig,wxEmptyString,wxCONFIG_USE_LOCAL_FILE);
541
m_pMachineConfig = NULL;
443
545
ConfigurationController::~ConfigurationController() {
445
547
delete m_pUserConfig;
446
548
delete m_pGeneralConfig;
549
if (m_pMachineConfig != NULL) {
550
delete m_pMachineConfig;