mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-05-28 03:10:28 -04:00
Add base qml chat view to navigation panel
This commit is contained in:
parent
d77e13cddb
commit
8be279a5fd
@ -62,4 +62,9 @@ add_qtc_plugin(QodeAssist
|
|||||||
chat/ChatWidget.h chat/ChatWidget.cpp
|
chat/ChatWidget.h chat/ChatWidget.cpp
|
||||||
chat/ChatOutputPane.h chat/ChatOutputPane.cpp
|
chat/ChatOutputPane.h chat/ChatOutputPane.cpp
|
||||||
chat/ChatClientInterface.hpp chat/ChatClientInterface.cpp
|
chat/ChatClientInterface.hpp chat/ChatClientInterface.cpp
|
||||||
|
chat/NavigationPanel.hpp chat/NavigationPanel.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(chatview)
|
||||||
|
|
||||||
|
target_link_libraries(QodeAssist PUBLIC QodeAssistChatViewplugin)
|
||||||
|
45
chat/NavigationPanel.cpp
Normal file
45
chat/NavigationPanel.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Petr Mironychev
|
||||||
|
*
|
||||||
|
* This file is part of QodeAssist.
|
||||||
|
*
|
||||||
|
* QodeAssist is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QodeAssist is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QodeAssist. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "NavigationPanel.hpp"
|
||||||
|
|
||||||
|
#include "chatview/BaseChatWidget.hpp"
|
||||||
|
|
||||||
|
namespace QodeAssist::Chat {
|
||||||
|
|
||||||
|
NavigationPanel::NavigationPanel() {
|
||||||
|
setDisplayName(tr("QodeAssist Chat"));
|
||||||
|
setPriority(500);
|
||||||
|
setId("QodeAssistChat");
|
||||||
|
setActivationSequence(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_C));
|
||||||
|
}
|
||||||
|
|
||||||
|
NavigationPanel::~NavigationPanel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::NavigationView NavigationPanel::createWidget()
|
||||||
|
{
|
||||||
|
Core::NavigationView view;
|
||||||
|
view.widget = new BaseChatWidget;
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
chat/NavigationPanel.hpp
Normal file
37
chat/NavigationPanel.hpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Petr Mironychev
|
||||||
|
*
|
||||||
|
* This file is part of QodeAssist.
|
||||||
|
*
|
||||||
|
* QodeAssist is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QodeAssist is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QodeAssist. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
|
|
||||||
|
namespace QodeAssist::Chat {
|
||||||
|
|
||||||
|
class NavigationPanel : public Core::INavigationWidgetFactory
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit NavigationPanel();
|
||||||
|
~NavigationPanel();
|
||||||
|
|
||||||
|
Core::NavigationView createWidget() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
35
chatview/BaseChatWidget.cpp
Normal file
35
chatview/BaseChatWidget.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Petr Mironychev
|
||||||
|
*
|
||||||
|
* This file is part of QodeAssist.
|
||||||
|
*
|
||||||
|
* QodeAssist is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QodeAssist is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QodeAssist. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "BaseChatWidget.hpp"
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QQmlContext>
|
||||||
|
|
||||||
|
namespace QodeAssist::Chat {
|
||||||
|
|
||||||
|
BaseChatWidget::BaseChatWidget(QWidget *parent)
|
||||||
|
{
|
||||||
|
setSource(QUrl("qrc:/ChatView/qml/ChatView.qml"));
|
||||||
|
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
|
|
||||||
|
engine()->rootContext()->setContextObject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
chatview/BaseChatWidget.hpp
Normal file
34
chatview/BaseChatWidget.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Petr Mironychev
|
||||||
|
*
|
||||||
|
* This file is part of QodeAssist.
|
||||||
|
*
|
||||||
|
* QodeAssist is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QodeAssist is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QodeAssist. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QtQuickWidgets/QtQuickWidgets>
|
||||||
|
|
||||||
|
namespace QodeAssist::Chat {
|
||||||
|
|
||||||
|
class BaseChatWidget : public QQuickWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BaseChatWidget(QWidget *parent = nullptr);
|
||||||
|
~BaseChatWidget() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
24
chatview/CMakeLists.txt
Normal file
24
chatview/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
qt_add_library(QodeAssistChatView STATIC)
|
||||||
|
|
||||||
|
find_package(Qt6 COMPONENTS Core Widgets Quick QuickWidgets Network REQUIRED)
|
||||||
|
|
||||||
|
qt_add_qml_module(QodeAssistChatView
|
||||||
|
URI ChatView
|
||||||
|
VERSION 1.0
|
||||||
|
QML_FILES
|
||||||
|
qml/ChatView.qml
|
||||||
|
SOURCES
|
||||||
|
BaseChatWidget.hpp BaseChatWidget.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(QodeAssistChatView
|
||||||
|
PRIVATE
|
||||||
|
Qt::Widgets
|
||||||
|
Qt::Quick
|
||||||
|
Qt::QuickWidgets
|
||||||
|
Qt::Network
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(QodeAssistChatView
|
||||||
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
7
chatview/qml/ChatView.qml
Normal file
7
chatview/qml/ChatView.qml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
color: "gray"
|
||||||
|
}
|
@ -43,6 +43,7 @@
|
|||||||
#include "PromptTemplateManager.hpp"
|
#include "PromptTemplateManager.hpp"
|
||||||
#include "QodeAssistClient.hpp"
|
#include "QodeAssistClient.hpp"
|
||||||
#include "chat/ChatOutputPane.h"
|
#include "chat/ChatOutputPane.h"
|
||||||
|
#include "chat/NavigationPanel.hpp"
|
||||||
#include "providers/LMStudioProvider.hpp"
|
#include "providers/LMStudioProvider.hpp"
|
||||||
#include "providers/OllamaProvider.hpp"
|
#include "providers/OllamaProvider.hpp"
|
||||||
#include "providers/OpenAICompatProvider.hpp"
|
#include "providers/OpenAICompatProvider.hpp"
|
||||||
@ -116,6 +117,7 @@ public:
|
|||||||
StatusBarManager::addStatusBarWidget(toggleButton, StatusBarManager::RightCorner);
|
StatusBarManager::addStatusBarWidget(toggleButton, StatusBarManager::RightCorner);
|
||||||
|
|
||||||
m_chatOutputPane = new Chat::ChatOutputPane(this);
|
m_chatOutputPane = new Chat::ChatOutputPane(this);
|
||||||
|
m_navigationPanel.reset(new Chat::NavigationPanel());
|
||||||
}
|
}
|
||||||
|
|
||||||
void extensionsInitialized() final
|
void extensionsInitialized() final
|
||||||
@ -150,6 +152,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QScopedPointer<QodeAssistClient> m_qodeAssistClient;
|
QScopedPointer<QodeAssistClient> m_qodeAssistClient;
|
||||||
QPointer<Chat::ChatOutputPane> m_chatOutputPane;
|
QPointer<Chat::ChatOutputPane> m_chatOutputPane;
|
||||||
|
QScopedPointer<Chat::NavigationPanel> m_navigationPanel;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QodeAssist::Internal
|
} // namespace QodeAssist::Internal
|
||||||
|
Loading…
Reference in New Issue
Block a user