mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-22 18:42:46 -05:00
feat: Improve build project tool (#272)
This commit is contained in:
@ -20,15 +20,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <llmcore/BaseTool.hpp>
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QPromise>
|
||||
#include <QSharedPointer>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
}
|
||||
|
||||
namespace QodeAssist::Tools {
|
||||
|
||||
struct BuildInfo
|
||||
{
|
||||
QSharedPointer<QPromise<QString>> promise;
|
||||
QPointer<ProjectExplorer::Project> project;
|
||||
QString projectName;
|
||||
bool isRebuild = false;
|
||||
QMetaObject::Connection buildFinishedConnection;
|
||||
};
|
||||
|
||||
class BuildProjectTool : public LLMCore::BaseTool
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BuildProjectTool(QObject *parent = nullptr);
|
||||
~BuildProjectTool() override;
|
||||
|
||||
QString name() const override;
|
||||
QString stringName() const override;
|
||||
@ -37,6 +55,15 @@ public:
|
||||
LLMCore::ToolPermissions requiredPermissions() const override;
|
||||
|
||||
QFuture<QString> executeAsync(const QJsonObject &input = QJsonObject()) override;
|
||||
|
||||
private slots:
|
||||
void onBuildQueueFinished(bool success);
|
||||
|
||||
private:
|
||||
QString collectBuildResults(bool success, const QString &projectName, bool isRebuild);
|
||||
void cleanupBuildInfo(ProjectExplorer::Project *project);
|
||||
|
||||
QHash<ProjectExplorer::Project *, BuildInfo> m_activeBuilds;
|
||||
};
|
||||
|
||||
} // namespace QodeAssist::Tools
|
||||
|
||||
Reference in New Issue
Block a user