#include "Material_ResourceMgr.h"
+#include <QFileInfo>
#include <QFileSystemWatcher>
#include <QThread>
if ( on ) {
if ( !myWatcher ) {
myWatcher = new QFileSystemWatcher( this );
- myWatcher->addPath( userFileName( appName() ) );
+ QFileInfo ufile = userFileName( appName() );
+ if ( ufile.exists() ) {
+ myWatcher->addPath( ufile.filePath() );
+ }
connect( myWatcher, SIGNAL( fileChanged( QString ) ), this, SLOT( update() ) );
}
}
}
}
+/*!
+ \brief This function is called after user configuration file is saved.
+ \internal
+*/
+void Material_ResourceMgr::saved()
+{
+ if ( resourceMgr() != this ) {
+ resourceMgr()->saved();
+ }
+ else if ( myWatcher ) {
+ QStringList files = myWatcher->files();
+ QFileInfo ufile = userFileName( appName() );
+ if ( ufile.exists() && !files.contains( ufile.filePath() ) ) {
+ myWatcher->addPath( ufile.filePath() );
+ update();
+ }
+ }
+}
+
/*!
\brief Update user database slot
\internal