| 15 | namespace QodeAssist::Chat { |
| 16 | |
| 17 | ChatEditor::ChatEditor( |
| 18 | QQmlEngine *engine, |
| 19 | SessionFileRegistry *sessionFileRegistry, |
| 20 | Skills::SkillsManager *skillsManager) |
| 21 | : m_engine(engine) |
| 22 | , m_sessionFileRegistry(sessionFileRegistry) |
| 23 | , m_skillsManager(skillsManager) |
| 24 | , m_document(new ChatDocument(this)) |
| 25 | , m_chatWidget(new ChatWidget(engine, sessionFileRegistry, skillsManager, false)) |
| 26 | { |
| 27 | setWidget(m_chatWidget); |
| 28 | setContext(Core::Context(Constants::QODE_ASSIST_CHAT_CONTEXT)); |
| 29 | setDuplicateSupported(false); |
| 30 | |
| 31 | if (auto rootView = qobject_cast<ChatRootView *>(m_chatWidget->rootObject())) { |
| 32 | rootView->setInEditor(true); |
| 33 | connect( |
| 34 | rootView, |
| 35 | &ChatRootView::closeHostRequested, |
| 36 | this, |
| 37 | [this] { Core::EditorManager::closeEditors({this}); }, |
| 38 | Qt::QueuedConnection); |
| 39 | |
| 40 | auto syncTitle = [this, rootView] { |
| 41 | const QString title = rootView->chatTitle(); |
| 42 | m_document->setPreferredDisplayName( |
| 43 | title.isEmpty() ? Tr::tr("QodeAssist Chat") : QStringLiteral("QodeAssist - ") + title); |
| 44 | }; |
| 45 | connect(rootView, &ChatRootView::chatTitleChanged, this, syncTitle); |
| 46 | syncTitle(); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void ChatEditor::consumePendingChatFile() |
| 51 | { |
nothing calls this directly
no test coverage detected