Skip to content

Commit

Permalink
fix: Display the directory without selecting the file
Browse files Browse the repository at this point in the history
Log: as title
  • Loading branch information
LiHua000 committed Dec 19, 2024
1 parent c4eca55 commit f9a3458
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/plugins/codeeditor/gui/tabbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include <DMenu>
#include <DDialog>
#include <DGuiApplicationHelper>
#include <DDesktopServices>

#include <QSignalBlocker>
#include <QFileInfo>
#include <QHBoxLayout>
#include <QClipboard>
#include <QGuiApplication>
#include <QDesktopServices>

DWIDGET_USE_NAMESPACE

Expand Down Expand Up @@ -137,8 +137,7 @@ void TabBarPrivate::showMenu(QPoint pos)
menu.addSeparator();
menu.addAction(tr("Show Containing Folder"), [=]() {
auto file = tabBar->tabToolTip(curIndex);
QFileInfo info(file);
QDesktopServices::openUrl(QUrl::fromLocalFile(info.absolutePath()));
DDesktopServices::showFileItem(file);
});

menu.exec(QCursor::pos());
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/codegeex/codegeex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ bool CodeGeex::start()
aiService->available = std::bind(&CodeGeeXManager::isLoggedIn, CodeGeeXManager::instance());
aiService->askQuestion = std::bind(&CodeGeeXManager::independentAsking, CodeGeeXManager::instance(), _1, QMultiMap<QString, QString>(), _2);
aiService->askQuestionWithHistory = std::bind(&CodeGeeXManager::independentAsking, CodeGeeXManager::instance(), _1, _2, _3);
aiService->generateRag = std::bind(&CodeGeeXManager::generateRag, CodeGeeXManager::instance(), _1);
aiService->query = std::bind(&CodeGeeXManager::query, CodeGeeXManager::instance(), _1, _2, _3);

return true;
}
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/cxx/cmake/project/cmakeasynparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ void CmakeAsynParse::parseProject(QStandardItem *rootItem, const dpfservice::Pro
cmakeFileItem->setToolTip(cmakeFileInfo.filePath());
cmakeParentItem->appendRow(cmakeFileItem);
cmakeFileItem->setData(cmakeFileInfo.absoluteFilePath(), Project::FileIconRole);
cmakeFileItem->setData(cmakeFileInfo.absoluteFilePath(), Project::FilePathRole);

// monitor cmake file change to refresh project tree.
if (cmakeParentItem == rootItem) {
Expand Down Expand Up @@ -260,6 +261,7 @@ void CmakeAsynParse::parseProject(QStandardItem *rootItem, const dpfservice::Pro
srcItem->setText(srcFileInfo.fileName());
srcItem->setToolTip(srcFileInfo.filePath());
srcItem->setData(srcFileInfo.absoluteFilePath(), Project::FileIconRole);
srcItem->setData(srcFileInfo.absoluteFilePath(), Project::FilePathRole);
if (srcFileInfo.isDir())
emit directoryCreated(rootItem, srcFileInfo.filePath());

Expand Down Expand Up @@ -346,6 +348,7 @@ QStandardItem *CmakeAsynParse::createParentItem(QStandardItem *rootItem, const Q
item->setText(nameItem);
item->setToolTip(basePath + relative);
item->setData(basePath + relative, Project::FileIconRole);
item->setData(basePath + relative, Project::FilePathRole);
// append to parent.
QStandardItem *parentItem = findParentItem(rootItem, relative);
emit directoryCreated(rootItem, basePath + relative);
Expand Down
11 changes: 7 additions & 4 deletions src/plugins/project/mainframe/projecttree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <DPushButton>
#include <DLineEdit>
#include <DDialog>
#include <DDesktopServices>

#include <QDebug>
#include <QHeaderView>
Expand All @@ -26,9 +27,8 @@
#include <QApplication>
#include <QUrl>
#include <QClipboard>
#include <QDesktopServices>
#include <QScrollBar>

DCORE_USE_NAMESPACE
DWIDGET_USE_NAMESPACE
using namespace dpfservice;

Expand Down Expand Up @@ -259,9 +259,12 @@ void ProjectTree::doItemMenuRequest(QStandardItem *item, QContextMenuEvent *even
menu->addSeparator();
QAction *showContainFolder = new QAction(tr("Show Containing Folder"), this);
connect(showContainFolder, &QAction::triggered, [=]() {
QString filePath = item->toolTip();
QString filePath = item->data(Project::ProjectItemRole::FilePathRole).toString();
QFileInfo info(filePath);
QDesktopServices::openUrl(QUrl::fromLocalFile(info.absolutePath()));
if (info.isFile())
DDesktopServices::showFileItem(filePath);
else
DDesktopServices::showFolder(filePath);
});
menu->addAction(showContainFolder);

Expand Down
20 changes: 20 additions & 0 deletions src/services/ai/aiservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ class SERVICE_EXPORT AiService final : public dpf::PluginService, dpf::AutoServi
// custom model
DPF_INTERFACE(AbstractLLM *, getLLM, const LLMInfo &info);
DPF_INTERFACE(QList<LLMInfo>, getAllModel);

// rag
DPF_INTERFACE(void, generateRag, const QString &projectPath);
/*
Could be empty or not completed. see obj.isEmpty or obj["Completed"].toBool
May block, recommended to run in a separate thread
*/
/*!
* \brief
Could be empty or not completed. see obj.isEmpty or obj["Completed"].toBool
May block, recommended to run in a separate thread
* \param query . Find similar chunks based on this text as accurately as possible
* \param topItems . count of chunks
* \return
JsonObject:
Query: str
Chunks: Arr[fileName:str, content:str, similarity:float]
Instructions: obj{name:str, description:str, content:str}
*/
DPF_INTERFACE(QJsonObject, query, const QString &projectPath, const QString &query, int topItems);
};

} // namespace dpfservice
Expand Down

0 comments on commit f9a3458

Please sign in to comment.