48 # include <sys/types.h> 50 #if defined(Q_OS_VXWORKS) 51 # include "qplatformdefs.h" 56 #ifndef QT_NO_FILESYSTEMMODEL 58 #ifdef QT_BUILD_INTERNAL 59 static bool fetchedRoot =
false;
75 :
QThread(parent), abort(false),
79 m_resolveSymlinks(false), m_iconProvider(&defaultProvider)
83 #elif !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) 87 #ifndef QT_NO_FILESYSTEMWATCHER 143 if (this->files.
at(loc) ==
files) {
148 this->path.push(path);
149 this->files.push(files);
172 #ifndef QT_NO_FILESYSTEMWATCHER 186 #ifndef QT_NO_FILESYSTEMWATCHER 208 bool updateFiles =
false;
218 path = this->path.first();
220 this->path.pop_front();
235 #ifndef QT_NO_FILESYSTEMWATCHER 254 if (resolvedInfo.exists()) {
264 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) 268 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) 281 #ifndef QT_NO_FILESYSTEMWATCHER 292 #ifdef QT_BUILD_INTERNAL 299 for (
int i = 0; i < files.
count(); ++i)
302 for (
int i = infoList.
count() - 1; i >= 0; --i) {
314 bool firstTime =
true;
321 while(!
abort && dirIt.hasNext()) {
323 fileInfo = dirIt.fileInfo();
325 fetch(fileInfo, base, firstTime, updatedFiles, path);
334 fetch(fileInfo, base, firstTime, updatedFiles, path);
345 if ((firstTime && updatedFiles.count() > 100) || base.
msecsTo(current) > 1000) {
347 updatedFiles.clear();
353 #endif // QT_NO_FILESYSTEMMODEL void removePath(const QString &path)
void updateFile(const QString &path)
Fetch extended information for all filePath.
QStack< QStringList > files
static mach_timebase_info_data_t info
void pop_front()
This function is provided for STL compatibility.
#define QT_END_NAMESPACE
This macro expands to.
void getFileInfos(const QString &path, const QStringList &files)
The QFileSystemWatcher class provides an interface for monitoring files and directories for modificat...
qint64 msecsTo(const QElapsedTimer &other) const
Returns the number of milliseconds between this QElapsedTimer and other.
void removePath(const QString &file)
Removes the specified path from the file system watcher.
T & first()
Returns a reference to the first item in the vector.
void chop(int n)
Removes n characters from the end of the string.
int length() const
Returns the number of characters in this string.
void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const
void setResolveSymlinks(bool enable)
void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList< QPair< QString, QFileInfo > > &updatedFiles, const QString &path)
QString fileName() const
Returns the name of the file, excluding the path.
virtual QIcon icon(IconType type) const
Returns an icon set for the given type.
void unlock()
Unlocks this mutex locker.
void removePaths(const QStringList &files)
Removes the specified paths from the file system watcher.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QString absoluteFilePath() const
Returns an absolute path including the file name.
QFileSystemWatcher * watcher
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool exists() const
Returns true if the file exists; otherwise returns false.
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QDirIterator class provides an iterator for directory entrylists.
The QString class provides a Unicode character string.
QString translateDriveName(const QFileInfo &drive) const
The QObject class is the base class of all Qt objects.
static QChar separator()
Returns the native directory separator: "/" under Unix (including Mac OS X) and "\\" under Windows...
The QElapsedTimer class provides a fast way to calculate elapsed times.
virtual QString type(const QFileInfo &info) const
Returns the type of the file described by info.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QFileInfoGatherer(QObject *parent=0)
Creates thread.
friend class const_iterator
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QFileIconProvider * iconProvider() const
void fetchExtendedInformation(const QString &path, const QStringList &files)
Fetch extended information for all files in path.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QStringList files() const
Returns a list of paths to files that are being watched.
~QFileInfoGatherer()
Destroys thread.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
void setFile(const QString &file)
Sets the file that the QFileInfo provides information about to file.
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes...
QExtendedInformation getInfo(const QFileInfo &info) const
QFileIconProvider * m_iconProvider
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
void updates(const QString &directory, const QList< QPair< QString, QFileInfo > > &updates)
static QFileInfoList drives()
Returns a list of the root directories on this system.
void list(const QString &directoryPath)
bool wait(QMutex *mutex, unsigned long time=ULONG_MAX)
bool resolveSymlinks() const
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
QStringList directories() const
Returns a list of paths to directories that are being watched.
void start(Priority=InheritPriority)
Begins execution of the thread by calling run().
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
void directoryLoaded(const QString &path)
#define QT_NO_FILESYSTEMWATCHER
bool wait(unsigned long time=ULONG_MAX)
Blocks the thread until either of these conditions is met:
void nameResolved(const QString &fileName, const QString &resolvedName) const
#define Q_AUTOTEST_EXPORT
QString symLinkTarget() const
Returns the absolute path to the file or directory a symlink (or shortcut on Windows) points to...
void addPath(const QString &file)
Adds path to the file system watcher if path exists.
void run()
The starting point for the thread.
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
static QString fromNativeSeparators(const QString &pathName)
Returns pathName using '/' as file separator.
bool isReadable() const
Returns true if the user can read the file; otherwise returns false.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isSymLink() const
Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise return...
The QFileInfo class provides system-independent file information.
QString filePath() const
Returns the file name, including the path (which may be absolute or relative).
The QThread class provides a platform-independent way to manage threads.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QString fileName(const QString &fileUrl)
void start()
Starts this timer.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
void setIconProvider(QFileIconProvider *provider)
#define forever
This macro is provided for convenience for writing infinite loops.