| 428 | } |
| 429 | |
| 430 | void OutputWidget::endExecution(int exitCode, qint64 time) |
| 431 | { |
| 432 | TextLayoutLock lock(this); |
| 433 | |
| 434 | if (_solutionBuffer != nullptr) { |
| 435 | auto* doc = _solutionBuffer; |
| 436 | _solutionBuffer = nullptr; |
| 437 | |
| 438 | // Print compressed solutions |
| 439 | QTextCursor cursor(doc); |
| 440 | cursor.setPosition(_lastSolutions[0].position(), QTextCursor::KeepAnchor); |
| 441 | if (cursor.hasSelection()) { |
| 442 | auto* t = nextInsertAt().insertTable(1, 2, _headerTableFormat); |
| 443 | t->cellAt(0, 0).firstCursorPosition().insertText(QString(QChar::ObjectReplacementCharacter), _arrowFormat); |
| 444 | auto label = QString("[ %1 more solutions ]").arg(_solutionCount - _firstCompressedSolution - 1); |
| 445 | t->cellAt(0, 1).firstCursorPosition().insertText(label, noticeCharFormat()); |
| 446 | |
| 447 | auto* f = nextInsertAt().insertFrame(_frameFormat); |
| 448 | f->firstCursorPosition().insertFragment(QTextDocumentFragment(cursor)); |
| 449 | if (f->lastCursorPosition().block().text().isEmpty()) { |
| 450 | // Remove trailing newline |
| 451 | f->lastCursorPosition().deletePreviousChar(); |
| 452 | } |
| 453 | toggleFrameVisibility(f); |
| 454 | } |
| 455 | |
| 456 | // Print last solution and final status/stats |
| 457 | cursor.setPosition(_lastSolutions[0].position()); |
| 458 | cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor); |
| 459 | nextInsertAt().insertFragment(QTextDocumentFragment(cursor)); |
| 460 | |
| 461 | delete doc; |
| 462 | } |
| 463 | |
| 464 | _lastTraceLoc = ""; |
| 465 | if (exitCode != 0) { |
| 466 | QString msg = "Process finished with non-zero exit code %1.\n"; |
| 467 | nextInsertAt().insertText(msg.arg(exitCode), errorCharFormat()); |
| 468 | } |
| 469 | auto t = IDEUtils::formatTime(time); |
| 470 | nextInsertAt().insertText(QString("Finished in %1.").arg(t), noticeCharFormat()); |
| 471 | _statusCursor.insertText(t, infoCharFormat()); |
| 472 | _frame = ui->textBrowser->document()->rootFrame(); |
| 473 | } |
| 474 | |
| 475 | |
| 476 | void OutputWidget::addMessageType(const QString &messageType) |
no test coverage detected