|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.core.QFileSystemWatcher
public class QFileSystemWatcher
The QFileSystemWatcher class provides an interface for monitoring files and directories for modifications. QFileSystemWatcher monitors the file system for changes to files and directories by watching a list of specified paths.
Call addPath()
to watch a particular file or directory. Multiple paths can be added using the addPaths()
function. Existing paths can be removed by using the removePath()
and removePaths()
functions.
QFileSystemWatcher examines each path added to it. Files that have been added to the QFileSystemWatcher can be accessed using the files()
function, and directories using the directories()
function.
The fileChanged()
signal is emitted when a file has been modified or removed from disk. Similarly, the directoryChanged()
signal is emitted when a directory or its contents is modified or removed. Note that QFileSystemWatcher stops monitoring files and directories once they have been removed from disk.
Note: On systems running a Linux kernel without inotify support, file systems that contain watched paths cannot be unmounted.
Note: Windows CE does not support directory monitoring by default as this depends on the file system driver installed.
Note: The act of monitoring files and directories for modifications consumes system resources. This implies there is a limit to the number of files and directories your process can monitor simultaneously. On Mac OS and all BSD variants, for example, an open file descriptor is required for each monitored file. The system limits the number of open file descriptors to 256 by default. This means that addPath()
and addPaths()
will fail if your process tries to add more than 256 files or directories to the file system monitor. Also note that your process may have other file descriptors open in addition to the ones for files being monitored, and these other open descriptors also count in the total.
QFile
, and QDir
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary | |
---|---|
QSignalEmitter.Signal1 |
directoryChanged
This signal takes 1 generic argument(s). |
QSignalEmitter.Signal1 |
fileChanged
This signal takes 1 generic argument(s). |
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QFileSystemWatcher()
Constructs a new file system watcher object with the given parent. |
|
QFileSystemWatcher(java.util.List paths)
Constructs a new file system watcher object with the given parent which monitors the specified paths list. |
|
QFileSystemWatcher(java.util.List paths,
QObject parent)
Constructs a new file system watcher object with the given parent which monitors the specified paths list. |
|
QFileSystemWatcher(QObject parent)
Constructs a new file system watcher object with the given parent. |
Method Summary | |
---|---|
void |
addPath(java.lang.String file)
Adds path to the file system watcher if path exists. |
void |
addPaths(java.util.List files)
Adds each path in paths to the file system watcher. |
java.util.List |
directories()
Returns a list of paths to directories that are being watched. |
java.util.List |
files()
Returns a list of paths to files that are being watched. |
void |
removePath(java.lang.String file)
Removes the specified path from the file system watcher. |
void |
removePaths(java.util.List files)
Removes the specified paths from the file system watcher. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1 directoryChanged
This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: path)>:
This signal is emitted when the directory at a specified path, is modified (e. ., when a file is added, modified or deleted) or removed from disk. Note that if there are several changes during a short period of time, some of the changes might not emit this signal. However, the last change in the sequence of changes will always generate this signal.
fileChanged()
.
public final QSignalEmitter.Signal1 fileChanged
This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: path)>:
This signal is emitted when the file at the specified path is modified or removed from disk.
directoryChanged()
.
Constructor Detail |
---|
public QFileSystemWatcher()
public QFileSystemWatcher(QObject parent)
public QFileSystemWatcher(java.util.List paths)
public QFileSystemWatcher(java.util.List paths, QObject parent)
Method Detail |
---|
public final void addPath(java.lang.String file)
If path specifies a directory, the directoryChanged()
signal will be emitted when path is modified or removed from disk; otherwise the fileChanged()
signal is emitted when path is modified or removed.
Note: There is a system dependent limit to the number of files and directories that can be monitored simultaneously. If this limit has been reached, path will not be added to the file system watcher, and a warning message will be printed to stderr.
addPaths()
, and removePath()
.
public final void addPaths(java.util.List files)
If a path specifies a directory, the directoryChanged()
signal will be emitted when the path is modified or removed from disk; otherwise the fileChanged()
signal is emitted when the path is modified or removed.
Note: There is a system dependent limit to the number of files and directories that can be monitored simultaneously. If this limit has been reached, the excess paths will not be added to the file system watcher, and a warning message will be printed to stderr for each path that could not be added.
addPath()
, and removePaths()
.
public final java.util.List directories()
files()
.
public final java.util.List files()
directories()
.
public final void removePath(java.lang.String file)
removePaths()
, and addPath()
.
public final void removePaths(java.util.List files)
removePath()
, and addPaths()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |