WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. | Zuble QML Types | Zuble C++ Classes | Zuble Overview |
Zuble
0.1
Zuble Framework C++/QML extension API
|
This class wraps QFileSystemWatcher and adds path reference counting. More...
#include <ZFileSystemWatcher.h>
Public Types | |
typedef QMap< QString, int > | zFileWatcherMap |
Signals | |
void | fileChanged (const QString &path) |
void | directoryChanged (const QString &path) |
Public Member Functions | |
ZFileSystemWatcher (QObject *parent=nullptr) | |
Q_INVOKABLE bool | addPath (const QString &file) |
Q_INVOKABLE QStringList | addPaths (const QStringList &files) |
Q_INVOKABLE bool | removePath (const QString &file) |
Q_INVOKABLE QStringList | removePaths (const QStringList &files) |
Q_INVOKABLE QStringList | files () const |
Q_INVOKABLE QStringList | directories () const |
bool | getRestoreDeletedFiles () |
void | setRestoreDeletedFiles (bool restoreFiles) |
Static Public Member Functions | |
static void | registerType () |
Registers ZFileSystemWatcher as a QML type. More... | |
Protected Member Functions | |
void | onFileChanged (const QString &path) |
bool | waitForFileCreation (const QString &path) |
Protected Attributes | |
QFileSystemWatcher | m_watcher |
zFileWatcherMap | m_paths |
QMutex | m_lock |
bool | m_restoreDeletedFiles |
Properties | |
bool | restoreDeletedFiles |
When true ZFileSystemWatcher will wait for deleted files to be restored. More... | |
This class wraps QFileSystemWatcher and adds path reference counting.
Each time a path is added to ZFileSystemWatcher the path's reference count is incremented and each time a path is removed it's reference count is decremented. As long as the path's reference count is greater than zero ZFileSystemWatcher will continue to watch the path. When the path's reference count reaches zero that path is removed from the watch list and the path will no longer be watched.
Definition at line 50 of file ZFileSystemWatcher.h.
typedef QMap<QString, int> Zbl::ZFileSystemWatcher::zFileWatcherMap |
Definition at line 55 of file ZFileSystemWatcher.h.
|
explicit |
Definition at line 33 of file ZFileSystemWatcher.cpp.
bool Zbl::ZFileSystemWatcher::addPath | ( | const QString & | file | ) |
Definition at line 50 of file ZFileSystemWatcher.cpp.
Referenced by addPaths(), and Zbl::ZSettings::setFileWatcher().
QStringList Zbl::ZFileSystemWatcher::addPaths | ( | const QStringList & | files | ) |
Definition at line 81 of file ZFileSystemWatcher.cpp.
QStringList Zbl::ZFileSystemWatcher::directories | ( | ) | const |
Definition at line 156 of file ZFileSystemWatcher.cpp.
|
signal |
Referenced by ZFileSystemWatcher().
|
signal |
Referenced by onFileChanged(), and Zbl::ZSettings::ZSettings().
QStringList Zbl::ZFileSystemWatcher::files | ( | ) | const |
Definition at line 148 of file ZFileSystemWatcher.cpp.
Referenced by Zbl::ZSettings::onFileChanged().
bool Zbl::ZFileSystemWatcher::getRestoreDeletedFiles | ( | ) |
Definition at line 164 of file ZFileSystemWatcher.cpp.
|
protected |
Definition at line 202 of file ZFileSystemWatcher.cpp.
Referenced by ZFileSystemWatcher().
|
static |
Registers ZFileSystemWatcher as a QML type.
Definition at line 42 of file ZFileSystemWatcher.cpp.
Referenced by Zbl::Zblcore::registerTypes().
bool Zbl::ZFileSystemWatcher::removePath | ( | const QString & | file | ) |
Definition at line 100 of file ZFileSystemWatcher.cpp.
Referenced by removePaths(), and Zbl::ZSettings::setFileWatcher().
QStringList Zbl::ZFileSystemWatcher::removePaths | ( | const QStringList & | files | ) |
Definition at line 129 of file ZFileSystemWatcher.cpp.
void Zbl::ZFileSystemWatcher::setRestoreDeletedFiles | ( | bool | restoreFiles | ) |
Definition at line 171 of file ZFileSystemWatcher.cpp.
Referenced by Zbl::ZSettings::ZSettings().
|
protected |
Definition at line 178 of file ZFileSystemWatcher.cpp.
Referenced by onFileChanged().
|
protected |
Definition at line 113 of file ZFileSystemWatcher.h.
Referenced by addPath(), addPaths(), directories(), files(), getRestoreDeletedFiles(), onFileChanged(), removePath(), removePaths(), and setRestoreDeletedFiles().
|
protected |
Definition at line 111 of file ZFileSystemWatcher.h.
Referenced by addPath(), removePath(), and waitForFileCreation().
|
protected |
Definition at line 115 of file ZFileSystemWatcher.h.
Referenced by getRestoreDeletedFiles(), onFileChanged(), and setRestoreDeletedFiles().
|
protected |
Definition at line 109 of file ZFileSystemWatcher.h.
Referenced by addPath(), directories(), files(), onFileChanged(), and removePath().
|
readwrite |
When true ZFileSystemWatcher will wait for deleted files to be restored.
Some programs modify files by deleting and re-creating them. The file deletion causes QFileSystemWatcher to stop watching the deleted path. When restoreDeletedFiles is true ZFileSystemWatcher will wait for deleted files to be re-created by the modifying process before emitting the fileChanged signal and adding the deleted path back to QFileSystemWatcher's path list.
WARNING: When this property is set file deletions NOT immediately re-created by the modifying process will cause ZFileSystemWatcher to time out and generate an error message.
Definition at line 81 of file ZFileSystemWatcher.h.
Zuble documentation copyright © 2019 Bob Dinitto. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Zuble is a derivative work of Qt version 5. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.