10#include <QtCore/qloggingcategory.h>
20#if QT_CONFIG(filesystemwatcher)
25 updateTypes(UpdateType::None),
29 showDotAndDotDot(
false),
31 showOnlyReadable(
false),
34#if QT_CONFIG(filesystemwatcher)
53#if QT_CONFIG(filesystemwatcher)
62#if QT_CONFIG(filesystemwatcher)
73 qCDebug(lcFileInfoThread) <<
"setPath called with path" <<
path;
77#if QT_CONFIG(filesystemwatcher)
88 qCDebug(lcFileInfoThread) <<
"setRootPath called with path" <<
path;
95#if QT_CONFIG(filesystemwatcher)
96void FileInfoThread::dirChanged(
const QString &directoryPath)
98 qCDebug(lcFileInfoThread) <<
"dirChanged called with directoryPath" << directoryPath;
101 updateTypes |= UpdateType::Contents;
108 qCDebug(lcFileInfoThread) <<
"setSortFlags called with flags" <<
flags;
112 updateTypes |= UpdateType::Sort;
119 qCDebug(lcFileInfoThread) <<
"setNameFilters called with filters" <<
filters;
122 updateTypes |= UpdateType::Contents;
128 qCDebug(lcFileInfoThread) <<
"setShowFiles called with show" <<
show;
131 updateTypes |= UpdateType::Contents;
137 qCDebug(lcFileInfoThread) <<
"setShowDirs called with showFolders" << showFolders;
139 showDirs = showFolders;
140 updateTypes |= UpdateType::Contents;
146 qCDebug(lcFileInfoThread) <<
"setShowDirsFirst called with show" <<
show;
148 showDirsFirst =
show;
149 updateTypes |= UpdateType::Contents;
155 qCDebug(lcFileInfoThread) <<
"setShowDotAndDotDot called with on" << on;
157 showDotAndDotDot = on;
158 updateTypes |= UpdateType::Contents;
165 qCDebug(lcFileInfoThread) <<
"setShowHidden called with on" << on;
168 updateTypes |= UpdateType::Contents;
175 qCDebug(lcFileInfoThread) <<
"setShowOnlyReadable called with on" << on;
177 showOnlyReadable = on;
178 updateTypes |= UpdateType::Contents;
184 qCDebug(lcFileInfoThread) <<
"setCaseSensitive called with on" << on;
187 updateTypes |= UpdateType::Contents;
191#if QT_CONFIG(filesystemwatcher)
192void FileInfoThread::updateFile(
const QString &
path)
194 qCDebug(lcFileInfoThread) <<
"updateFile called with path" <<
path;
197 updateTypes |= UpdateType::Contents;
205 bool updateFiles =
false;
210 if (currentPath.
isEmpty() || !needUpdate) {
236 auto getFileInfosAsync = [guardedThis](){
239 guardedThis->scanPending =
false;
240 if (guardedThis->currentPath.isEmpty()) {
245 guardedThis->getFileInfos(guardedThis->currentPath);
255 qCDebug(lcFileInfoThread) <<
"initiateScan is about to call condition.wakeAll()";
258 qCDebug(lcFileInfoThread) <<
"initiateScan is about to call runOnce()";
265 return fileInfoList.
size() <= 10
266 ? QDebug::toString(fileInfoList)
272 qCDebug(lcFileInfoThread) <<
"getFileInfos called with path" <<
path <<
"- updateType" << updateTypes;
281 if (!showDotAndDotDot)
283 else if (
path == rootPath)
287 if (showOnlyReadable)
302 if (updateTypes & UpdateType::Contents) {
306 currentFileList = filePropertyList;
307 qCDebug(lcFileInfoThread) <<
"- about to emit directoryUpdated with fromIndex" << fromIndex
311 currentFileList = filePropertyList;
312 if (updateTypes & UpdateType::Sort) {
313 qCDebug(lcFileInfoThread) <<
"- about to emit sortFinished - fileInfoList:"
317 qCDebug(lcFileInfoThread) <<
"- about to emit directoryChanged - fileInfoList:"
324 if (updateTypes & UpdateType::Contents) {
327 currentFileList.
clear();
328 qCDebug(lcFileInfoThread) <<
"- directory is empty, about to emit directoryUpdated with fromIndex"
329 << fromIndex <<
"toIndex" <<
toIndex;
332 currentFileList.
clear();
333 qCDebug(lcFileInfoThread) <<
"- directory is empty, about to emit directoryChanged";
337 updateTypes = UpdateType::None;
343 if (currentFileList.
size() == 0) {
351 bool changeFound =
false;
353 for (
i=0;
i < listSize;
i++) {
369constexpr FileInfoThread::UpdateTypes
operator|(FileInfoThread::UpdateType f1, FileInfoThread::UpdateTypes f2)
noexcept
374constexpr FileInfoThread::UpdateTypes
operator&(FileInfoThread::UpdateType f1, FileInfoThread::UpdateTypes f2)
noexcept
381#include "moc_fileinfothread_p.cpp"
void removePath(const QString &path)
void setRootPath(const QString &path)
void setShowFiles(bool show)
void directoryUpdated(const QString &directory, const QList< FileProperty > &list, int fromIndex, int toIndex) const
void setShowDotAndDotDot(bool on)
void statusChanged(QQuickFolderListModel::Status status) const
void directoryChanged(const QString &directory, const QList< FileProperty > &list) const
void setNameFilters(const QStringList &nameFilters)
void setShowDirsFirst(bool show)
void setCaseSensitive(bool on)
void setShowDirs(bool showFolders)
void sortFinished(const QList< FileProperty > &list) const
void findChangeRange(const QList< FileProperty > &list, int &fromIndex, int &toIndex)
void setShowHidden(bool on)
void getFileInfos(const QString &path)
void setShowOnlyReadable(bool on)
void setPath(const QString &path)
void setSortFlags(QDir::SortFlags flags)
QFileInfoList entryInfoList(Filters filters=NoFilter, SortFlags sort=NoSort) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore \reentrant
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
void reserve(qsizetype size)
void unlock() noexcept
Unlocks this mutex locker.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void clear()
Clears the contents of the string and makes it null.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool wait(QDeadlineTimer deadline=QDeadlineTimer(QDeadlineTimer::Forever))
bool singleShot
whether the timer is a single-shot timer
QString fileInfoListToString(const QFileInfoList &fileInfoList)
constexpr FileInfoThread::UpdateTypes operator|(FileInfoThread::UpdateType f1, FileInfoThread::UpdateTypes f2) noexcept
constexpr FileInfoThread::UpdateTypes operator&(FileInfoThread::UpdateType f1, FileInfoThread::UpdateTypes f2) noexcept
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLsizei const GLchar *const * path
bool updateFile(const QString &fileName, const QHash< QString, QString > &replacements)
static uint toIndex(ExecutionEngine *e, const Value &v)
QFutureWatcher< int > watcher
QFileInfo info(fileName)
[8]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]
\inmodule QtCore \reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent