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);
    }
}
void CustomExecutableRunConfiguration::restore(const PersistentSettingsReader &reader)
{
    m_executable = reader.restoreValue("Executable").toString();
    m_cmdArguments = reader.restoreValue("Arguments").toStringList();
    m_workingDirectory = reader.restoreValue("WorkingDirectory").toString();
    ApplicationRunConfiguration::restore(reader);
}
bool SnippetSpec::load(const QString &fileName)
{
    PersistentSettingsReader reader;
    if (!reader.load(fileName))
        return false;

    m_contents = reader.restoreValue(QLatin1String("Contents")).toString();
    m_name = reader.restoreValue(QLatin1String("Name")).toString();
    m_description = reader.restoreValue(QLatin1String("Description")).toString();
    m_category = reader.restoreValue(QLatin1String("Category")).toString();
    m_completionShortcut = reader.restoreValue(QLatin1String("Shortcut")).toString();

    QMap<QString, QVariant> temp = reader.restoreValue(QLatin1String("Arguments")).toMap();
    QMap<QString, QVariant>::const_iterator it, end;
    end = temp.constEnd();
    for (it = temp.constBegin(); it != end; ++it) {
        m_argumentDescription.insert( it.key().toInt(), it.value().toString());
    }

    temp = reader.restoreValue(QLatin1String("ArgumentDefaults")).toMap();
    end = temp.constEnd();
    for (it = temp.constBegin(); it != end; ++it) {
        m_argumentDefault.insert(it.key().toInt(), it.value().toString());
    }

    return true;
}
Beispiel #4
0
void Project::restoreSettings()
{
    PersistentSettingsReader reader;
    reader.load(file()->fileName() + QLatin1String(".user"));
    restoreSettingsImpl(reader);

    if (m_activeBuildConfiguration.isEmpty() && !m_buildConfigurations.isEmpty())
        setActiveBuildConfiguration(m_buildConfigurations.at(0));

    if (!m_activeRunConfiguration && !m_runConfigurations.isEmpty())
        setActiveRunConfiguration(m_runConfigurations.at(0));
}
Beispiel #5
0
void Qt4RunConfiguration::restore(const PersistentSettingsReader &reader)
{    
    ApplicationRunConfiguration::restore(reader);
    const QDir projectDir = QFileInfo(project()->file()->fileName()).absoluteDir();
    m_commandLineArguments = reader.restoreValue("CommandLineArguments").toStringList();
    m_proFilePath = projectDir.filePath(reader.restoreValue("ProFile").toString());
    m_userSetName = reader.restoreValue("UserSetName").toBool();
    m_runMode = reader.restoreValue("UseTerminal").toBool() ? Console : Gui;
    m_isUsingDyldImageSuffix = reader.restoreValue("UseDyldImageSuffix").toBool();
    if (!m_proFilePath.isEmpty()) {
        m_cachedTargetInformationValid = false;
        if (!m_userSetName)
            setName(QFileInfo(m_proFilePath).completeBaseName());
    }
}
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;
}
Beispiel #7
0
void CustomExecutableRunConfiguration::restore(const PersistentSettingsReader &reader)
{
    m_executable = reader.restoreValue("Executable").toString();
    m_cmdArguments = reader.restoreValue("Arguments").toStringList();
    m_workingDirectory = reader.restoreValue("WorkingDirectory").toString();
    m_runMode = reader.restoreValue("UseTerminal").toBool() ? Console : Gui;
    m_userSetName = reader.restoreValue("UserSetName").toBool();
    m_userName = reader.restoreValue("UserName").toString();
    ApplicationRunConfiguration::restore(reader);
}