| 528 | } |
| 529 | |
| 530 | bool InlineChatWidgetPrivate::askForChat() |
| 531 | { |
| 532 | chatInfo.originalRange = editSrv->getBackgroundRange(chatInfo.fileName, selectionMarker); |
| 533 | if (chatInfo.originalRange.start.line == -1 || chatInfo.originalRange.end.line == -1) |
| 534 | return false; |
| 535 | chatInfo.originalText = editSrv->rangeText(chatInfo.fileName, chatInfo.originalRange); |
| 536 | |
| 537 | auto f = questionLabel->font(); |
| 538 | f.setUnderline(state == QuestionStart); |
| 539 | questionLabel->setFont(f); |
| 540 | |
| 541 | auto question = edit->toPlainText(); |
| 542 | if (prevState == FollowSubmit && state == SubmitStart) { |
| 543 | auto historyQuestion = questionLabel->text(); |
| 544 | if (!historyQuestion.isEmpty()) |
| 545 | question.prepend(historyQuestion + ", "); |
| 546 | } |
| 547 | |
| 548 | QSignalBlocker blk(edit); |
| 549 | edit->clear(); |
| 550 | edit->onTextChanged(); |
| 551 | questionLabel->setEnabled(true); |
| 552 | answerLabel->setEnabled(true); |
| 553 | questionLabel->setText(question); |
| 554 | answerLabel->clear(); |
| 555 | |
| 556 | auto *futureWatcher = new QFutureWatcher<QString>(); |
| 557 | futureWatcher->setFuture(QtConcurrent::run(this, &InlineChatWidgetPrivate::createPrompt, question, false)); |
| 558 | connect(futureWatcher, &QFutureWatcher<QString>::finished, this, &InlineChatWidgetPrivate::handleCreatePromptFinished); |
| 559 | futureWatcherList << futureWatcher; |
| 560 | return true; |
| 561 | } |
| 562 | |
| 563 | QList<Diff> InlineChatWidgetPrivate::diffText(const QString &str1, const QString &str2) |
| 564 | { |
nothing calls this directly
no test coverage detected