MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / endExecution

Method endExecution

MiniZincIDE/outputwidget.cpp:430–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430void 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
476void OutputWidget::addMessageType(const QString &messageType)

Callers 3

compileMethod · 0.80
runMethod · 0.80

Calls 1

formatTimeFunction · 0.85

Tested by

no test coverage detected