fix: Remove files and folder watches

This commit is contained in:
Petr Mironychev
2026-06-29 15:11:40 +02:00
parent d66c714a28
commit 86135d0c13
9 changed files with 23 additions and 111 deletions

View File

@@ -5,7 +5,6 @@
#include "SkillsManager.hpp"
#include <QDir>
#include <QFileSystemWatcher>
#include "SkillsLoader.hpp"
@@ -13,10 +12,7 @@ namespace QodeAssist::Skills {
SkillsManager::SkillsManager(QObject *parent)
: QObject(parent)
, m_watcher(new QFileSystemWatcher(this))
{
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, [this] { reload(); });
}
{}
void SkillsManager::configure(
const QString &projectPath,
@@ -61,28 +57,9 @@ void SkillsManager::reload()
{
const QStringList roots = resolveRoots(m_projectPath, m_globalRoots, m_projectSubdirs);
m_skills = SkillsLoader::scan(roots);
updateWatcher(roots);
emit skillsChanged();
}
void SkillsManager::updateWatcher(const QStringList &roots)
{
const QStringList watched = m_watcher->directories();
if (!watched.isEmpty())
m_watcher->removePaths(watched);
QStringList toWatch;
for (const QString &root : roots) {
if (QDir(root).exists())
toWatch << root;
}
for (const AgentSkill &skill : m_skills)
toWatch << skill.skillDir;
if (!toWatch.isEmpty())
m_watcher->addPaths(toWatch);
}
QVector<AgentSkill> SkillsManager::skills() const
{
return m_skills;

View File

@@ -13,8 +13,6 @@
#include "AgentSkill.hpp"
class QFileSystemWatcher;
namespace QodeAssist::Skills {
class SkillsManager : public QObject
@@ -48,13 +46,10 @@ signals:
void skillsChanged();
private:
void updateWatcher(const QStringList &roots);
QString m_projectPath;
QStringList m_globalRoots;
QStringList m_projectSubdirs;
QVector<AgentSkill> m_skills;
QFileSystemWatcher *m_watcher = nullptr;
};
} // namespace QodeAssist::Skills