5 #include <QDirIterator>
46 printf(
"Deleting file browser model updater\n");
50 printf(
"QxrdFileBrowserModelUpdater::~QxrdFileBrowserModelUpdater(%p)\n",
this);
54 printMessage(
"QxrdFileBrowserModelUpdater::~QxrdFileBrowserModelUpdater");
66 if (dirs.count() >= 1) {
110 QThread *curr = QThread::currentThread();
119 if (updater && updater->updateNeeded()) {
129 return f1.fileName().toLower() < f2.fileName().toLower();
136 return f1.fileName().toLower() > f2.fileName().toLower();
143 return f1.size() < f2.size();
150 return f1.size() > f2.size();
157 return f1.lastModified() < f2.lastModified();
164 return f1.lastModified() > f2.lastModified();
178 QDirIterator iter(
m_RootPath, model->nameFilters());
179 QVector<QFileInfo> dirs;
180 QVector<QFileInfo> files;
182 while (iterd.hasNext()) {
191 QString filePath = iterd.next();
194 if (fileInfo.isDir()) {
195 QString dirName = fileInfo.fileName();
197 if ((dirName !=
".") && (dirName !=
"..")) {
198 dirs.append(fileInfo);
203 while (iter.hasNext()) {
212 QString filePath = iter.next();
215 if (fileInfo.isDir()) {
217 files.append(fileInfo);
233 foreach(QFileInfo file, files) {
234 QDateTime
mod = file.lastModified();
236 model->updatedFile(file);
247 int column = model->sortedColumn();
248 Qt::SortOrder order = model->sortOrder();
256 if (order == Qt::AscendingOrder) {
266 if (order == Qt::AscendingOrder) {
276 if (order == Qt::AscendingOrder) {
304 limit = app->get_FileBrowserLimit();
307 int trueSize =
m_Files.count();
309 if (limit && limit < trueSize) {
static bool fileDateLessThan(QFileInfo f1, QFileInfo f2)
qint64 qcepDebug(int cond)
void changeContents(const QString &path)
static bool fileSizeLessThan(QFileInfo f1, QFileInfo f2)
QxrdFileBrowserModelUpdaterPtr updater() const
virtual ~QxrdFileBrowserModelUpdater()
static bool fileNameGreaterThan(QFileInfo f1, QFileInfo f2)
QxrdFileBrowserModelUpdater(QxrdFileBrowserModelWPtr browser, QcepObject *parent)
static bool fileSizeGreaterThan(QFileInfo f1, QFileInfo f2)
QSharedPointer< QxrdFileBrowserModelUpdater > QxrdFileBrowserModelUpdaterPtr
QxrdFileBrowserModelWPtr m_BrowserModel
QAtomicInt m_GenerateUpdates
QAtomicInt m_UpdateNeeded
static bool fileNameLessThan(QFileInfo f1, QFileInfo f2)
QFileSystemWatcher * m_FileSystemWatcher
static double mod(double a, double b)
static void checkSortInterrupt()
QDateTime m_PreviousUpdate
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime()) const
QVector< QFileInfo > m_Files
QVector< QFileInfo > m_Directories
QWeakPointer< QxrdFileBrowserModel > QxrdFileBrowserModelWPtr
void rootChanged(const QString &path)
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
void generateFileUpdates(int doIt)
QcepApplication * g_Application
void changeRoot(const QString &path)
QSharedPointer< QxrdFileBrowserModel > QxrdFileBrowserModelPtr
static bool fileDateGreaterThan(QFileInfo f1, QFileInfo f2)