Ejemplo n.º 1
0
static void readAndDeleteLegacyCMakeSettings ()
{
    // restore the legacy cmake
    QSettings *settings = ICore::settings();
    settings->beginGroup(QLatin1String("CMakeSettings"));

    FileName exec = FileName::fromUserInput(settings->value(QLatin1String("cmakeExecutable")).toString());
    if (exec.toFileInfo().isExecutable()) {
        CMakeTool *item = CMakeToolManager::findByCommand(exec);
        if (!item) {
            item = new CMakeTool(CMakeTool::ManualDetection);
            item->setCMakeExecutable(exec);
            item->setDisplayName(CMakeToolManager::tr("CMake at %1").arg(item->cmakeExecutable().toUserOutput()));

            if (!CMakeToolManager::registerCMakeTool(item)) {
                delete item;
                item = 0;
            }
        }

        //this setting used to be the default cmake, make sure it is again
        if (item)
            d->m_defaultCMake = item->id();
    }

    //read the legacy ninja setting, if its not available use the current value
    d->m_preferNinja = settings->value(QLatin1String("preferNinja"), d->m_preferNinja).toBool();

    settings->remove(QString());
    settings->endGroup();
}
Ejemplo n.º 2
0
    foreach (const FileName &command, suspects) {
        CMakeTool *item = new CMakeTool(CMakeTool::AutoDetection);
        item->setCMakeExecutable(command);
        item->setDisplayName(CMakeToolManager::tr("System CMake at %1").arg(command.toUserOutput()));

        found.append(item);
    }
Ejemplo n.º 3
0
void CMakeToolItemModel::apply()
{
    foreach (const Core::Id &id, m_removedItems)
        CMakeToolManager::deregisterCMakeTool(id);

    foreach (auto item, itemsAtLevel<CMakeToolTreeItem *>(2)) {
        item->m_changed = false;

        bool isNew = false;
        CMakeTool *cmake = CMakeToolManager::findById(item->m_id);
        if (!cmake) {
            isNew = true;
            CMakeTool::Detection detection = item->m_autodetected ? CMakeTool::AutoDetection
                                                                  : CMakeTool::ManualDetection;
            cmake = new CMakeTool(detection, item->m_id);
        }

        cmake->setDisplayName(item->m_name);
        cmake->setCMakeExecutable(item->m_executable);

        if (isNew) {
            if (!CMakeToolManager::registerCMakeTool(cmake)) {
                delete cmake;
                item->m_changed = true;
            }
        }
    }

    CMakeToolManager::setDefaultCMakeTool(defaultItemId());
}