Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
fileinfothread_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
ifndef
FILEINFOTHREAD_P_H
5
#
define
FILEINFOTHREAD_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QThread
>
19
#
include
<
QMutex
>
20
#
include
<
QWaitCondition
>
21
#
if
QT_CONFIG
(
filesystemwatcher
)
22
#
include
<
QFileSystemWatcher
>
23
#
endif
24
#
include
<
QFileInfo
>
25
#
include
<
QDir
>
26
27
#
include
"fileproperty_p.h"
28
#
include
"qquickfolderlistmodel_p.h"
29
30
QT_BEGIN_NAMESPACE
31
32
class
FileInfoThread
:
public
QThread
33
{
34
Q_OBJECT
35
36
Q_SIGNALS:
37
void
directoryChanged
(
const
QString
&
directory
,
const
QList
<
FileProperty
> &
list
)
const
;
38
void
directoryUpdated
(
const
QString &directory,
const
QList<FileProperty> &list,
int
fromIndex,
int
toIndex)
const
;
39
void
sortFinished
(
const
QList<FileProperty> &list)
const
;
40
void
statusChanged
(QQuickFolderListModel::Status status)
const
;
41
42
public
:
43
FileInfoThread
(QObject *parent =
nullptr
);
44
~
FileInfoThread
();
45
46
void
clear
();
47
void
removePath
(
const
QString &path);
48
void
setPath
(
const
QString &path);
49
void
setRootPath
(
const
QString &path);
50
void
setSortFlags
(QDir::SortFlags flags);
51
void
setNameFilters
(
const
QStringList & nameFilters);
52
void
setShowFiles
(
bool
show);
53
void
setShowDirs
(
bool
showFolders);
54
void
setShowDirsFirst
(
bool
show);
55
void
setShowDotAndDotDot
(
bool
on);
56
void
setShowDot
(
bool
on);
57
void
setShowDotDot
(
bool
on);
58
void
setShowHidden
(
bool
on);
59
void
setShowOnlyReadable
(
bool
on);
60
void
setCaseSensitive
(
bool
on);
61
62
public
Q_SLOTS
:
63
#
if
QT_CONFIG
(
filesystemwatcher
)
64
void
dirChanged
(
const
QString
&
directoryPath
);
65
void
updateFile
(
const
QString
&
path
);
66
#
endif
67
68
protected
:
69
void
run
()
override
;
70
void
runOnce
();
71
void
initiateScan
();
72
void
getFileInfos
(
const
QString &path);
73
void
findChangeRange
(
const
QList<FileProperty> &list,
int
&fromIndex,
int
&toIndex);
74
75
private
:
76
enum
class
UpdateType {
77
None = 1 << 0,
78
// The order of the files in the current folder changed.
79
Sort = 1 << 1,
80
// A subset of files in the current folder changed.
81
Contents = 1 << 2
82
};
83
Q_DECLARE_FLAGS(UpdateTypes, UpdateType)
84
85
// Declare these ourselves, as Q_DECLARE_OPERATORS_FOR_FLAGS needs the enum to be public.
86
friend
constexpr
UpdateTypes
operator
|(UpdateType f1, UpdateTypes f2)
noexcept
;
87
friend
constexpr
UpdateTypes
operator
&(UpdateType f1, UpdateTypes f2)
noexcept
;
88
89
QMutex mutex;
90
QWaitCondition condition;
91
volatile
bool
abort;
92
bool
scanPending;
93
94
#
if
QT_CONFIG
(
filesystemwatcher
)
95
QFileSystemWatcher
*
watcher
;
96
#
endif
97
QList<FileProperty> currentFileList;
98
QDir::SortFlags sortFlags;
99
QString currentPath;
100
QString rootPath;
101
QStringList nameFilters;
102
bool
needUpdate;
103
UpdateTypes updateTypes;
104
bool
showFiles;
105
bool
showDirs;
106
bool
showDirsFirst;
107
bool
showDotAndDotDot;
108
bool
showDot;
109
bool
showDotDot;
110
bool
showHidden;
111
bool
showOnlyReadable;
112
bool
caseSensitive;
113
};
114
115
QT_END_NAMESPACE
116
117
#
endif
// FILEINFOTHREAD_P_H
FileInfoThread
Definition
fileinfothread_p.h:33
FileInfoThread::removePath
void removePath(const QString &path)
Definition
fileinfothread.cpp:62
FileInfoThread::setRootPath
void setRootPath(const QString &path)
Definition
fileinfothread.cpp:89
FileInfoThread::setShowFiles
void setShowFiles(bool show)
Definition
fileinfothread.cpp:129
FileInfoThread::clear
void clear()
Definition
fileinfothread.cpp:53
FileInfoThread::initiateScan
void initiateScan()
Definition
fileinfothread.cpp:275
FileInfoThread::directoryUpdated
void directoryUpdated(const QString &directory, const QList< FileProperty > &list, int fromIndex, int toIndex) const
FileInfoThread::setShowDotAndDotDot
void setShowDotAndDotDot(bool on)
Definition
fileinfothread.cpp:156
FileInfoThread::~FileInfoThread
~FileInfoThread()
Definition
fileinfothread.cpp:44
FileInfoThread::setShowDotDot
void setShowDotDot(bool on)
Definition
fileinfothread.cpp:176
FileInfoThread::statusChanged
void statusChanged(QQuickFolderListModel::Status status) const
FileInfoThread::setShowDot
void setShowDot(bool on)
Definition
fileinfothread.cpp:166
FileInfoThread::setNameFilters
void setNameFilters(const QStringList &nameFilters)
Definition
fileinfothread.cpp:120
FileInfoThread::FileInfoThread
FileInfoThread(QObject *parent=nullptr)
Definition
fileinfothread.cpp:17
FileInfoThread::setShowDirsFirst
void setShowDirsFirst(bool show)
Definition
fileinfothread.cpp:147
FileInfoThread::setCaseSensitive
void setCaseSensitive(bool on)
Definition
fileinfothread.cpp:205
FileInfoThread::setShowDirs
void setShowDirs(bool showFolders)
Definition
fileinfothread.cpp:138
FileInfoThread::runOnce
void runOnce()
Definition
fileinfothread.cpp:252
FileInfoThread::sortFinished
void sortFinished(const QList< FileProperty > &list) const
FileInfoThread::findChangeRange
void findChangeRange(const QList< FileProperty > &list, int &fromIndex, int &toIndex)
Definition
fileinfothread.cpp:364
FileInfoThread::setShowHidden
void setShowHidden(bool on)
Definition
fileinfothread.cpp:186
FileInfoThread::getFileInfos
void getFileInfos(const QString &path)
Definition
fileinfothread.cpp:293
FileInfoThread::setShowOnlyReadable
void setShowOnlyReadable(bool on)
Definition
fileinfothread.cpp:196
FileInfoThread::setPath
void setPath(const QString &path)
Definition
fileinfothread.cpp:74
FileInfoThread::setSortFlags
void setSortFlags(QDir::SortFlags flags)
Definition
fileinfothread.cpp:109
QPointer
Definition
qpointer.h:20
fileInfoListToString
QString fileInfoListToString(const QFileInfoList &fileInfoList)
Definition
fileinfothread.cpp:286
operator|
constexpr FileInfoThread::UpdateTypes operator|(FileInfoThread::UpdateType f1, FileInfoThread::UpdateTypes f2) noexcept
Definition
fileinfothread.cpp:392
operator&
constexpr FileInfoThread::UpdateTypes operator&(FileInfoThread::UpdateType f1, FileInfoThread::UpdateTypes f2) noexcept
Definition
fileinfothread.cpp:397
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
labs
folderlistmodel
fileinfothread_p.h
Generated on
for Qt by
1.18.0