Class sh::tools::LocalFilesystemWatcher

class sh::tools::LocalFilesystemWatcher : public QObject, public sh::base::Singleton

Used for watching parts of the local filesystem.

Depending on the compile flags and your system, this functionality might not be available. If so, the methods are no-ops.

Public Functions

qint64 addFile(QString path)

Watches one more file.

See also removeFile().

void removeFile(qint64 id)

Stops watching a file (by the return value of addFile()).

qint64 addDirectory(QString path)

Watches one more directory.

See also removeDirectory().

void removeDirectory(qint64 id)

Stops watching a directory (by the return value of addDirectory()).

~LocalFilesystemWatcher()
void doInitialize()

Executes singleton initialization.

void doShutdown()

Executes singleton shutdown.

void shutdown()

Shutdown down this singleton.

bool isAlive()

Returns if this singleton is alive (true until its shutdown begins).

Signals

void elementModified(QString name, QList<qint64> ids)
void elementDeleted(QString name, QList<qint64> ids)
void elementCreated(QString name, QList<qint64> ids)

Private Functions

LocalFilesystemWatcher()
void emitElementModified(QString name, QList<qint64> ids)
void emitElementDeleted(QString name, QList<qint64> ids)
void emitElementCreated(QString name, QList<qint64> ids)

Private Members

InotifyThread *inotifyThread
QMutex inotifymutex
QHash<int, QList<qint64>> inotifywd2ids
QHash<qint64, int> id2inotifywd
QHash<qint64, QString> id2path
qint64 nextEid = 0
QMutex inotifythreadmutex
QWaitCondition inotifythreadmutexwait

Friends

friend class InotifyThread
class InotifyThread : public QThread

Public Functions

InotifyThread(LocalFilesystemWatcher *watcher)

Friends

friend class LocalFilesystemWatcher