MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / ChatView

Method ChatView

ChatView/ChatView.cpp:31–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace QodeAssist::Chat {
30
31ChatView::ChatView(
32 QQmlEngine *engine,
33 SessionFileRegistry *sessionFileRegistry,
34 Skills::SkillsManager *skillsManager)
35 : QQuickView{engine, nullptr}
36 , m_isPin(false)
37{
38 setTitle("QodeAssist Chat");
39 /// @note setup quick view content
40 {
41 auto context = new QQmlContext{engine, this};
42 context->setContextProperty("_chatview", this);
43 context->setContextProperty("sessionFileRegistry", sessionFileRegistry);
44 context->setContextProperty("skillsManager", skillsManager);
45
46 auto component = new QQmlComponent{engine, QUrl{"qrc:/qt/qml/ChatView/qml/RootItem.qml"}, this};
47 auto rootItem = component->create(context);
48
49 setContent(component->url(), component, rootItem);
50 }
51
52 if (auto rootView = qobject_cast<ChatRootView *>(rootObject())) {
53 connect(
54 rootView,
55 &ChatRootView::closeHostRequested,
56 this,
57 &QWindow::close,
58 Qt::QueuedConnection);
59 }
60
61 setResizeMode(QQuickView::SizeRootObjectToView);
62 setMinimumSize({400, 300});
63 setFlags(baseFlags);
64
65 bindCommandShortcut("QodeAssist.CloseChatView", [this] { close(); });
66 bindCommandShortcut(Constants::QODE_ASSIST_CHAT_SEND_MESSAGE, [this] {
67 QMetaObject::invokeMethod(rootObject(), "sendChatMessage");
68 });
69 bindCommandShortcut(Constants::QODE_ASSIST_CHAT_CLEAR_SESSION, [this] {
70 QMetaObject::invokeMethod(rootObject(), "clearChat");
71 });
72
73 restoreSettings();
74}
75
76void ChatView::bindCommandShortcut(Utils::Id commandId,
77 const std::function<void()> &onActivated)

Callers

nothing calls this directly

Calls 2

createMethod · 0.80
urlMethod · 0.45

Tested by

no test coverage detected