From b5dc8c10367537aec8ce7c061f608ca896ec9f36 Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 2 Jan 2018 22:09:07 +0100 Subject: Implement cache for FileWidget Some data-gathering is quite expensive and requires a QProcess, like getting the duration, so cache it in memory using QCache. Once the cache is filled, the UI is much snappier. This simplifies gatherData() a bit. It's still quite a long function, but now it doesn't create the QStandardItems any more. I moved it to a separate function. --- filewidget.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'filewidget.h') diff --git a/filewidget.h b/filewidget.h index b4c94e3..9c466fa 100644 --- a/filewidget.h +++ b/filewidget.h @@ -9,6 +9,7 @@ #include #include #include +#include class QLineEdit; class QStandardItemModel; @@ -23,6 +24,8 @@ class OriginDialog; class QMenu; class FileCopier; class ProgressDialog; +class CachedFileData; +class QStandardItem; class FileWidget : public QWidget { Q_OBJECT @@ -86,6 +89,7 @@ class FileWidget : public QWidget { void readSettings(); void writeSettings(); void cutOrCopy(); + QList constructRow(CachedFileData *fd) const; QAction *createSeparator(); QLineEdit *mDir; QLineEdit *mFilter; @@ -117,6 +121,7 @@ class FileWidget : public QWidget { VideoSorter *mProxy; OriginDialog *mOrignDlg; FileCopier *mFileCopier; + QCache mFileCache; int mFileAction; }; -- cgit v1.2.3-70-g09d2