static void readDebuggers(const FileName &fileName, bool isSystem) { PersistentSettingsReader reader; if (!reader.load(fileName)) return; QVariantMap data = reader.restoreValues(); // Check version int version = data.value(QLatin1String(DEBUGGER_FILE_VERSION_KEY), 0).toInt(); if (version < 1) return; int count = data.value(QLatin1String(DEBUGGER_COUNT_KEY), 0).toInt(); for (int i = 0; i < count; ++i) { const QString key = QString::fromLatin1(DEBUGGER_DATA_KEY) + QString::number(i); if (!data.contains(key)) continue; const QVariantMap dbMap = data.value(key).toMap(); DebuggerItem item(dbMap); if (isSystem) { item.setAutoDetected(true); // SDK debuggers are always considered to be up-to-date, so no need to recheck them. } else { // User settings. if (item.isAutoDetected() && (!item.isValid() || item.engineType() == NoEngineType)) { qWarning() << QString::fromLatin1("DebuggerItem \"%1\" (%2) dropped since it is not valid") .arg(item.command().toString()).arg(item.id().toString()); continue; } } DebuggerItemManager::registerDebugger(item); } }
static QList<CMakeTool *> readCMakeTools(const FileName &fileName, Core::Id *defaultId, bool fromSDK) { PersistentSettingsReader reader; if (!reader.load(fileName)) return QList<CMakeTool *>(); QVariantMap data = reader.restoreValues(); // Check version int version = data.value(QLatin1String(CMAKETOOL_FILE_VERSION_KEY), 0).toInt(); if (version < 1) return QList<CMakeTool *>(); QList<CMakeTool *> loaded; int count = data.value(QLatin1String(CMAKETOOL_COUNT_KEY), 0).toInt(); for (int i = 0; i < count; ++i) { const QString key = QString::fromLatin1(CMAKETOOL_DATA_KEY) + QString::number(i); if (!data.contains(key)) continue; const QVariantMap dbMap = data.value(key).toMap(); CMakeTool *item = new CMakeTool(dbMap,fromSDK); if (item->isAutoDetected()) { if (!item->cmakeExecutable().toFileInfo().isExecutable()) { qWarning() << QString::fromLatin1("CMakeTool \"%1\" (%2) read from \"%3\" dropped since the command is not executable.") .arg(item->cmakeExecutable().toUserOutput(), item->id().toString(), fileName.toUserOutput()); delete item; continue; } } loaded.append(item); } *defaultId = Id::fromSetting(data.value(QLatin1String(CMAKETOOL_DEFAULT_KEY), defaultId->toSetting())); d->m_preferNinja= data.value(QLatin1String(CMAKETOOL_PREFER_NINJA_KEY), d->m_preferNinja).toBool(); return loaded; }