void repo::gui::RepoWorkerProjectSettings::run()
{
    int jobsCount = 1;
    int jobsDone = 0;
    emit progressRangeChanged(0, 0); // undetermined (moving) progress bar

    try
    {
        if (!cancelled && !mongo.reconnect())
            std::cerr << tr("Connection failed").toStdString() << std::endl;
        else
        {            
            mongo.reauthenticate();

            //------------------------------------------------------------------
            // Execute command (such as drop or update setting) if any
            if (command.isOk())
                mongo.runCommand(database, command);

            emit progressValueChanged(jobsDone++);

            jobsCount += mongo.countItemsInCollection(database, REPO_COLLECTION_SETTINGS);
            emit progressRangeChanged(jobsDone, jobsCount);

            //------------------------------------------------------------------
            // Get project settings
            std::auto_ptr<mongo::DBClientCursor> cursor;
            std::list<std::string> fields; // projection, emtpy at the moment
            unsigned long long skip = 0;
            do
            {
                for (; !cancelled && cursor.get() && cursor->more(); ++skip)
                {
                    core::RepoProjectSettings projectSettings(cursor->nextSafe());
                    emit projectSettingsFetched(projectSettings.copy());
                    emit progressValueChanged(jobsDone++);
                }
                if (!cancelled)
                    cursor = mongo.listAllTailable(
                        database,
                        REPO_COLLECTION_SETTINGS,
                        fields,
                        "",
                        -1,
                        skip);
            }
            while (!cancelled && cursor.get() && cursor->more());

        }
    }
    catch(std::exception e)
    {
        std::cerr << e.what() << std::endl;
    }

    //--------------------------------------------------------------------------
    emit progressValueChanged(jobsCount);
    emit RepoWorkerAbstract::finished();

}
static QStringList warningOptions(CppTools::ProjectPart *projectPart)
{
    if (projectPart && projectPart->project) {
        ClangProjectSettings projectSettings(projectPart->project);
        if (!projectSettings.useGlobalWarningConfig()) {
            const Core::Id warningConfigId = projectSettings.warningConfigId();
            const CppTools::ClangDiagnosticConfigsModel configsModel(
                        CppTools::codeModelSettings()->clangCustomDiagnosticConfigs());
            if (configsModel.hasConfigWithId(warningConfigId))
                return configsModel.configWithId(warningConfigId).commandLineOptions();
        }
    }

    return CppTools::codeModelSettings()->clangDiagnosticConfig().commandLineOptions();
}
Exemplo n.º 3
0
void ProgramController::CreateProject(std::string projectName)
{
	FileSystemController::CreateFile(projectName);
	FileController projectSettingsFile(projectName, true);
	if (projectSettingsFile.IsFileOpen())
	{
		ProjectSettings projectSettings(projectName, "WinRAR", 1, 0, std::vector<std::string>());
		std::cout << "[SUCCESS] Project \"" << projectName << "\" settings file has been created" << std::endl;
		projectSettingsFile.SaveProjectSettingsToFile(projectSettings);
	}
	else
	{
		std::cout << "[FAIL] Project " << projectName << " settings file hasn't been created" << std::endl;
		return;
	}
}