void BaseFileFind::runSearch(Find::SearchResult *search) { FileFindParameters parameters = search->userData().value<FileFindParameters>(); CountingLabel *label = new CountingLabel; connect(search, SIGNAL(countChanged(int)), label, SLOT(updateCount(int))); Find::SearchResultWindow::instance()->popup(true); QFutureWatcher<FileSearchResultList> *watcher = new QFutureWatcher<FileSearchResultList>(); m_watchers.insert(watcher, search); watcher->setPendingResultsLimit(1); connect(watcher, SIGNAL(resultReadyAt(int)), this, SLOT(displayResult(int))); connect(watcher, SIGNAL(finished()), this, SLOT(searchFinished())); if (parameters.flags & Find::FindRegularExpression) { watcher->setFuture(Utils::findInFilesRegExp(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), textDocumentFlagsForFindFlags(parameters.flags), ITextEditor::openedTextEditorsContents())); } else { watcher->setFuture(Utils::findInFiles(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), textDocumentFlagsForFindFlags(parameters.flags), ITextEditor::openedTextEditorsContents())); } Core::FutureProgress *progress = Core::ICore::progressManager()->addTask(watcher->future(), tr("Search"), QLatin1String(Constants::TASK_SEARCH)); progress->setWidget(label); connect(progress, SIGNAL(clicked()), search, SLOT(popup())); }
void ValgrindEngine::start() { emit starting(this); Core::FutureProgress* fp = Core::ICore::instance()->progressManager()->addTask(m_progress->future(), progressTitle(), "valgrind"); fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish); m_progress->reportStarted(); #if VALGRIND_DEBUG_OUTPUT emit standardOutputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" "))); emit standardOutputReceived(tr("Working directory: %1").arg(m_workingDirectory)); emit standardOutputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments)); #endif runner()->setWorkingDirectory(m_workingDirectory); runner()->setValgrindExecutable(m_settings->subConfig<ValgrindSettings>()->valgrindExecutable()); runner()->setValgrindArguments(toolArguments()); runner()->setDebuggeeExecutable(m_executable); // note that m_commandLineArguments may contain several arguments in one string runner()->setDebuggeeArguments(m_commandLineArguments); runner()->setEnvironment(m_environment); connect(runner(), SIGNAL(standardOutputReceived(QByteArray)), SLOT(receiveStandardOutput(QByteArray))); connect(runner(), SIGNAL(standardErrorReceived(QByteArray)), SLOT(receiveStandardError(QByteArray))); connect(runner(), SIGNAL(processErrorReceived(QString, QProcess::ProcessError)), SLOT(receiveProcessError(QString, QProcess::ProcessError))); connect(runner(), SIGNAL(finished()), SLOT(runnerFinished())); runner()->start(); }
bool ValgrindEngine::start() { emit starting(this); Core::FutureProgress *fp = Core::ICore::progressManager()->addTask(m_progress->future(), progressTitle(), "valgrind"); fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish); m_progress->setProgressRange(0, progressMaximum); m_progress->reportStarted(); m_progressWatcher->setFuture(m_progress->future()); m_progress->setProgressValue(progressMaximum / 10); #if VALGRIND_DEBUG_OUTPUT emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")), Utils::DebugFormat); emit outputReceived(tr("Working directory: %1").arg(m_workingDirectory), Utils::DebugFormat); emit outputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments), Utils::DebugFormat); #endif const AnalyzerStartParameters &sp = startParameters(); runner()->setWorkingDirectory(sp.workingDirectory); QString valgrindExe = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable(); if (!sp.analyzerCmdPrefix.isEmpty()) valgrindExe = sp.analyzerCmdPrefix + ' ' + valgrindExe; runner()->setValgrindExecutable(valgrindExe); runner()->setValgrindArguments(toolArguments()); runner()->setDebuggeeExecutable(sp.debuggee); runner()->setDebuggeeArguments(sp.debuggeeArgs); runner()->setEnvironment(sp.environment); runner()->setConnectionParameters(sp.connParams); runner()->setStartMode(sp.startMode); connect(runner(), SIGNAL(processOutputReceived(QByteArray,Utils::OutputFormat)), SLOT(receiveProcessOutput(QByteArray,Utils::OutputFormat))); connect(runner(), SIGNAL(processErrorReceived(QString,QProcess::ProcessError)), SLOT(receiveProcessError(QString,QProcess::ProcessError))); connect(runner(), SIGNAL(finished()), SLOT(runnerFinished())); if (!runner()->start()) { m_progress->cancel(); return false; } return true; }
void HeaderFilterProgress::findAll(const QString &text,QTextDocument::FindFlags findFlags) { // Fetch a list of all open projects QList<ProjectExplorer::Project*> projects = d->projectExplorer()->session()->projects(); // Make a list of files in each project QStringList files; Q_FOREACH(ProjectExplorer::Project* project, projects) files += project->files(ProjectExplorer::Project::AllFiles); // Remove duplicates files.removeDuplicates(); //------------------------------------------------------------ // Begin searching QString includeline = "#include <" + text + '>'; Find::SearchResult* result = d->searchResultWindow()->startNewSearch(); d->watcher.setFuture(QFuture<FileSearchResult>()); //When result gets activated it invokes the openEditor function connect(result, SIGNAL(activated(Find::SearchResultItem)), this, SLOT(openEditor(Find::SearchResultItem))); d->searchResultWindow()->popup(true); // Let the watcher monitor the search results d->watcher.setFuture(Utils::findInFiles(includeline, files, findFlags)); //Creates the Progres bar Core::FutureProgress* progress = Core::ICore::instance()->progressManager()->addTask(d->watcher.future(), "MySearch", Find::Constants::TASK_SEARCH, Core::ProgressManager::KeepOnFinish ); progress->setWidget(createProgressWidget()); connect(progress, SIGNAL(clicked()), d->searchResultWindow(), SLOT(popup())); }