Commit 5ca7da25 authored by Simon Depiets's avatar Simon Depiets
Browse files

Auto reload project file on disk change

parent c87466d9
......@@ -47,6 +47,7 @@
#include <QDir>
#include <QFileInfo>
#include <QStringBuilder>
#include <QFileSystemWatcher>
#include "projectmodel.h"
#include "webquerycontroller.h"
......@@ -211,6 +212,11 @@ void Project::load(const QString &newProjectPath, const QString& forcedTargetLan
QaModel::instance()->loadRules(qaPath());
}
//Set a watch for config change/reload
m_projectFileWatcher = new QFileSystemWatcher(this);
m_projectFileWatcher->addPath(newProjectPath);
connect(m_projectFileWatcher, &QFileSystemWatcher::fileChanged, Project::instance(), &KCoreConfigSkeleton::load);
//qCDebug(LOKALIZE_LOG)<<"until emitting signal"<<a.elapsed();
emit loaded();
......
......@@ -28,6 +28,7 @@
#include <QVector>
#include <QList>
#include <QFileSystemWatcher>
#include "projectbase.h"
#define WEBQUERY_ENABLE
......@@ -201,6 +202,7 @@ signals:
private:
QString m_path;
QString m_desirablePath;
QFileSystemWatcher* m_projectFileWatcher;
ProjectLocal* m_localConfig;
ProjectModel* m_model;
GlossaryNS::Glossary* m_glossary;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment