]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemmodelrolesupdater.h
Provide ability to configure size cut-off for local file previews
[dolphin.git] / src / kitemviews / kfileitemmodelrolesupdater.h
index e9652e3b563126c7e4334b131c4fd01c84c4daf4..b881b73e4b0b4e369bc89f3d4025a93f6aa43a3d 100644 (file)
 #ifndef KFILEITEMMODELROLESUPDATER_H
 #define KFILEITEMMODELROLESUPDATER_H
 
 #ifndef KFILEITEMMODELROLESUPDATER_H
 #define KFILEITEMMODELROLESUPDATER_H
 
-#include <config-baloo.h>
+#include "dolphin_export.h"
+#include "kitemviews/kitemmodelbase.h"
 
 #include <KFileItem>
 
 #include <KFileItem>
-#include <kitemviews/kitemmodelbase.h>
-
-#include <libdolphin_export.h>
+#include <config-baloo.h>
 
 #include <QObject>
 #include <QSet>
 
 #include <QObject>
 #include <QSet>
@@ -34,9 +33,9 @@
 
 class KDirectoryContentsCounter;
 class KFileItemModel;
 
 class KDirectoryContentsCounter;
 class KFileItemModel;
-class KJob;
 class QPixmap;
 class QTimer;
 class QPixmap;
 class QTimer;
+class KOverlayIconPlugin;
 
 namespace KIO {
     class PreviewJob;
 
 namespace KIO {
     class PreviewJob;
@@ -47,6 +46,7 @@ namespace KIO {
     {
         class FileMonitor;
     }
     {
         class FileMonitor;
     }
+    #include <Baloo/IndexerConfig>
 #endif
 
 /**
 #endif
 
 /**
@@ -88,13 +88,13 @@ namespace KIO {
  * 3.   Finally, the entire process is repeated for any items that might have
  *      changed in the mean time.
  */
  * 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:
 {
     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;
 
     void setIconSize(const QSize& size);
     QSize iconSize() const;
@@ -154,10 +154,21 @@ public:
      */
     QStringList enabledPlugins() const;
 
      */
     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);
 private slots:
     void slotItemsInserted(const KItemRangeList& itemRanges);
     void slotItemsRemoved(const KItemRangeList& itemRanges);
-    void slotItemsMoved(const KItemRange& itemRange, QList<int> movedToIndexes);
+    void slotItemsMoved(const KItemRange& itemRange, const QList<int> &movedToIndexes);
     void slotItemsChanged(const KItemRangeList& itemRanges,
                           const QSet<QByteArray>& roles);
     void slotSortRoleChanged(const QByteArray& current,
     void slotItemsChanged(const KItemRangeList& itemRanges,
                           const QSet<QByteArray>& roles);
     void slotSortRoleChanged(const QByteArray& current,
@@ -183,6 +194,11 @@ private slots:
      */
     void slotPreviewJobFinished();
 
      */
     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
     /**
      * 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
@@ -205,9 +221,9 @@ private slots:
     void resolveRecentlyChangedItems();
 
     void applyChangedBalooRoles(const QString& file);
     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:
     /**
 
 private:
     /**
@@ -308,6 +324,7 @@ private:
     QSet<QByteArray> m_roles;
     QSet<QByteArray> m_resolvableRoles;
     QStringList m_enabledPlugins;
     QSet<QByteArray> m_roles;
     QSet<QByteArray> m_resolvableRoles;
     QStringList m_enabledPlugins;
+    qulonglong m_localFileSizePreviewLimit;
 
     // Items for which the sort role still has to be determined.
     QSet<KFileItem> m_pendingSortRoleItems;
 
     // Items for which the sort role still has to be determined.
     QSet<KFileItem> m_pendingSortRoleItems;
@@ -335,8 +352,11 @@ private:
 
     KDirectoryContentsCounter* m_directoryContentsCounter;
 
 
     KDirectoryContentsCounter* m_directoryContentsCounter;
 
+    QList<KOverlayIconPlugin*> m_overlayIconsPlugin;
+
 #ifdef HAVE_BALOO
     Baloo::FileMonitor* m_balooFileMonitor;
 #ifdef HAVE_BALOO
     Baloo::FileMonitor* m_balooFileMonitor;
+    Baloo::IndexerConfig m_balooConfig;
 #endif
 };
 
 #endif
 };