| 324 | } |
| 325 | |
| 326 | QString ProjectSearchTool::formatResults(const QList<SearchResult> &results, const QString &query) |
| 327 | { |
| 328 | QString output = QString("Query: %1\n Found %2 matches:\n\n").arg(query).arg(results.size()); |
| 329 | int count = 0; |
| 330 | for (const auto &r : results) { |
| 331 | if (++count > 100) { |
| 332 | output += QString("... and %1 more matches").arg(results.size() - 20); |
| 333 | break; |
| 334 | } |
| 335 | output += QString("%1:%2: %3\n").arg(r.relativePath).arg(r.lineNumber).arg(r.content); |
| 336 | } |
| 337 | return output; |
| 338 | } |
| 339 | |
| 340 | } // namespace QodeAssist::Tools |