QFileInfoGatherer: port away from QPair
Task-number: QTBUG-115841 Change-Id: I06c39140fb9afbbe6352af1025387d1890ca2730 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
3cd69050ff
commit
5038e1eb65
@ -13,8 +13,6 @@
|
||||
# include "qplatformdefs.h"
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
@ -365,7 +363,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
|
||||
base.start();
|
||||
QFileInfo fileInfo;
|
||||
bool firstTime = true;
|
||||
QList<QPair<QString, QFileInfo>> updatedFiles;
|
||||
QList<std::pair<QString, QFileInfo>> updatedFiles;
|
||||
QStringList filesToCheck = files;
|
||||
|
||||
QStringList allFiles;
|
||||
@ -394,9 +392,9 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
|
||||
}
|
||||
|
||||
void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime,
|
||||
QList<QPair<QString, QFileInfo>> &updatedFiles, const QString &path)
|
||||
QList<std::pair<QString, QFileInfo>> &updatedFiles, const QString &path)
|
||||
{
|
||||
updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo));
|
||||
updatedFiles.emplace_back(std::pair(fileInfo.fileName(), fileInfo));
|
||||
QElapsedTimer current;
|
||||
current.start();
|
||||
if ((firstTime && updatedFiles.size() > 100) || base.msecsTo(current) > 1000) {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <qfilesystemwatcher.h>
|
||||
#endif
|
||||
#include <qabstractfileiconprovider.h>
|
||||
#include <qpair.h>
|
||||
#include <qstack.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qdir.h>
|
||||
@ -32,6 +31,8 @@
|
||||
|
||||
#include <private/qfilesystemengine_p.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
QT_REQUIRE_CONFIG(filesystemmodel);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -124,7 +125,7 @@ class Q_GUI_EXPORT QFileInfoGatherer : public QThread
|
||||
Q_OBJECT
|
||||
|
||||
Q_SIGNALS:
|
||||
void updates(const QString &directory, const QList<QPair<QString, QFileInfo>> &updates);
|
||||
void updates(const QString &directory, const QList<std::pair<QString, QFileInfo>> &updates);
|
||||
void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const;
|
||||
void nameResolved(const QString &fileName, const QString &resolvedName) const;
|
||||
void directoryLoaded(const QString &path);
|
||||
@ -164,7 +165,7 @@ private:
|
||||
// called by run():
|
||||
void getFileInfos(const QString &path, const QStringList &files);
|
||||
void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime,
|
||||
QList<QPair<QString, QFileInfo>> &updatedFiles, const QString &path);
|
||||
QList<std::pair<QString, QFileInfo>> &updatedFiles, const QString &path);
|
||||
|
||||
private:
|
||||
void createWatcher();
|
||||
|
@ -1913,7 +1913,7 @@ void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int
|
||||
update and emit dataChanged if it has actually changed.
|
||||
*/
|
||||
void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path,
|
||||
const QList<QPair<QString, QFileInfo>> &updates)
|
||||
const QList<std::pair<QString, QFileInfo>> &updates)
|
||||
{
|
||||
#if QT_CONFIG(filesystemwatcher)
|
||||
Q_Q(QFileSystemModel);
|
||||
@ -2081,7 +2081,7 @@ void QFileSystemModelPrivate::init()
|
||||
|
||||
delayedSortTimer.setSingleShot(true);
|
||||
|
||||
qRegisterMetaType<QList<QPair<QString, QFileInfo>>>();
|
||||
qRegisterMetaType<QList<std::pair<QString, QFileInfo>>>();
|
||||
#if QT_CONFIG(filesystemwatcher)
|
||||
q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)),
|
||||
q, SLOT(_q_directoryChanged(QString,QStringList)));
|
||||
|
@ -138,7 +138,7 @@ private:
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_performDelayedSort())
|
||||
Q_PRIVATE_SLOT(d_func(),
|
||||
void _q_fileSystemChanged(const QString &path,
|
||||
const QList<QPair<QString, QFileInfo>> &))
|
||||
const QList<std::pair<QString, QFileInfo>> &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_resolvedName(const QString &fileName, const QString &resolvedName))
|
||||
|
||||
friend class QFileDialogPrivate;
|
||||
|
@ -252,7 +252,7 @@ public:
|
||||
|
||||
void _q_directoryChanged(const QString &directory, const QStringList &list);
|
||||
void _q_performDelayedSort();
|
||||
void _q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo>> &);
|
||||
void _q_fileSystemChanged(const QString &path, const QList<std::pair<QString, QFileInfo>> &);
|
||||
void _q_resolvedName(const QString &fileName, const QString &resolvedName);
|
||||
|
||||
QDir rootDir;
|
||||
|
Loading…
x
Reference in New Issue
Block a user