X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/dd18909eecce59ae23b1e921b96937fd547c9558..76a46fd9094b17eb99e8a42cca8562fdc0b3814c:/src/kitemviews/kfileitemmodelrolesupdater.h diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index a9e979ae1..b881b73e4 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -20,12 +20,11 @@ #ifndef KFILEITEMMODELROLESUPDATER_H #define KFILEITEMMODELROLESUPDATER_H -#include +#include "dolphin_export.h" +#include "kitemviews/kitemmodelbase.h" #include -#include - -#include +#include #include #include @@ -34,15 +33,20 @@ class KDirectoryContentsCounter; class KFileItemModel; -class KJob; class QPixmap; class QTimer; +class KOverlayIconPlugin; + +namespace KIO { + class PreviewJob; +} #ifdef HAVE_BALOO namespace Baloo { class FileMonitor; } + #include #endif /** @@ -84,13 +88,13 @@ class QTimer; * 3. Finally, the entire process is repeated for any items that might have * changed in the mean time. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModelRolesUpdater : public QObject +class DOLPHIN_EXPORT KFileItemModelRolesUpdater : public QObject { Q_OBJECT public: - explicit KFileItemModelRolesUpdater(KFileItemModel* model, QObject* parent = 0); - virtual ~KFileItemModelRolesUpdater(); + explicit KFileItemModelRolesUpdater(KFileItemModel* model, QObject* parent = nullptr); + ~KFileItemModelRolesUpdater() override; void setIconSize(const QSize& size); QSize iconSize() const; @@ -150,10 +154,21 @@ public: */ QStringList enabledPlugins() const; + /** + * Sets the maximum file size of local files for which + * previews will be generated (if enabled). A value of 0 + * indicates no file size limit. + * Per default the value from KConfigGroup "PreviewSettings" + * MaximumSize is used, 0 otherwise. + * @param size + */ + void setLocalFileSizePreviewLimit(qlonglong size); + qlonglong localFileSizePreviewLimit() const; + private slots: void slotItemsInserted(const KItemRangeList& itemRanges); void slotItemsRemoved(const KItemRangeList& itemRanges); - void slotItemsMoved(const KItemRange& itemRange, QList movedToIndexes); + void slotItemsMoved(const KItemRange& itemRange, const QList &movedToIndexes); void slotItemsChanged(const KItemRangeList& itemRanges, const QSet& roles); void slotSortRoleChanged(const QByteArray& current, @@ -179,6 +194,11 @@ private slots: */ void slotPreviewJobFinished(); + /** + * Is invoked when one of the KOverlayIconPlugin emit the signal that an overlay has changed + */ + void slotOverlaysChanged(const QUrl& url, const QStringList&); + /** * Resolves the sort role of the next item in m_pendingSortRole, applies it * to the model, and invokes itself if there are any pending items left. If @@ -201,9 +221,9 @@ private slots: void resolveRecentlyChangedItems(); void applyChangedBalooRoles(const QString& file); - void applyChangedBalooRolesJobFinished(KJob* job); + void applyChangedBalooRolesForItem(const KFileItem& file); - void slotDirectoryContentsCountReceived(const QString& path, int count); + void slotDirectoryContentsCountReceived(const QString& path, int count, long size); private: /** @@ -304,6 +324,7 @@ private: QSet m_roles; QSet m_resolvableRoles; QStringList m_enabledPlugins; + qulonglong m_localFileSizePreviewLimit; // Items for which the sort role still has to be determined. QSet m_pendingSortRoleItems; @@ -316,7 +337,7 @@ private: // A new preview job will be started from them once the first one finishes. KFileItemList m_pendingPreviewItems; - KJob* m_previewJob; + KIO::PreviewJob* m_previewJob; // When downloading or copying large files, the slot slotItemsChanged() // will be called periodically within a quite short delay. To prevent @@ -331,8 +352,11 @@ private: KDirectoryContentsCounter* m_directoryContentsCounter; + QList m_overlayIconsPlugin; + #ifdef HAVE_BALOO Baloo::FileMonitor* m_balooFileMonitor; + Baloo::IndexerConfig m_balooConfig; #endif };