]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/iconmanager.h
There are some extractable strings in subdirs too.
[dolphin.git] / src / iconmanager.h
index d6cf5332b6fef16d25208eb1fa9032e266436ae8..f72811c2722fd257502f875cfec5d37bee255624 100644 (file)
@@ -48,20 +48,20 @@ public:
     virtual ~IconManager();
     void setShowPreview(bool show);
     bool showPreview() const;
+    void updatePreviews();
 
 private slots:
     /**
-     * Updates the icons of for each item in \a items by making hidden
-     * items semitransparent and generating previews. The current preview
-     * settings (maximum size, 'Show Preview' menu) are respected.
+     * Generates previews for the items \a items asynchronously.
      */
-    void updateIcons(const KFileItemList& items);
+    void generatePreviews(const KFileItemList &items);
 
     /**
-     * Replaces the icon of the item \a item by the preview pixmap
-     * \a pixmap.
+     * Adds the preview \a pixmap for the item \a item to the preview
+     * queue and starts a timer which will dispatch the preview queue
+     * later.
      */
-    void replaceIcon(const KFileItem& item, const QPixmap& pixmap);
+    void addToPreviewQueue(const KFileItem& item, const QPixmap& pixmap);
 
     /**
      * Is invoked when the preview job has been finished and
@@ -72,7 +72,19 @@ private slots:
     /** Synchronizes the item icon with the clipboard of cut items. */
     void updateCutItems();
 
+    /**
+     * Dispatches the preview queue m_previews block by block within
+     * time slices.
+     */
+    void dispatchPreviewQueue();
+
 private:
+    /**
+     * Replaces the icon of the item with the \a url by the preview pixmap
+     * \a pixmap.
+     */
+    void replaceIcon(const KUrl& url, const QPixmap& pixmap);
+
     /**
      * Returns true, if the item \a item has been cut into
      * the clipboard.
@@ -82,15 +94,27 @@ private:
     /** Applies an item effect to all cut items. */
     void applyCutItemEffect();
 
-    /** Applies an item effect to the hidden item \a hiddenItem. */
-    void applyHiddenItemEffect(const KFileItem& hiddenItem);
+    /**
+     * Applies a frame around the icon. False is returned if
+     * no frame has been added because the icon is too small.
+     */
+    bool applyImageFrame(QPixmap& icon);
+
+    /**
+     * Resizes the icon to \a maxSize if the icon size does not
+     * fit into the maximum size. The aspect ratio of the icon
+     * is kept.
+     */
+    void limitToSize(QPixmap& icon, const QSize& maxSize);
+
+    /** Kills all ongoing preview jobs. */
+    void killJobs();
 
 private:
     /**
-     * Remembers the original pixmap for an item before
-     * the cut effect is applied.
+     * Remembers the pixmap for an item specified by an URL.
      */
-    struct CutItem
+    struct ItemInfo
     {
         KUrl url;
         QPixmap pixmap;
@@ -99,11 +123,13 @@ private:
     bool m_showPreview;
 
     QAbstractItemView* m_view;
+    QTimer* m_previewTimer;
     QList<KJob*> m_previewJobs;
     DolphinModel* m_dolphinModel;
     DolphinSortFilterProxyModel* m_proxyModel;
 
-    QList<CutItem> m_cutItemsCache;
+    QList<ItemInfo> m_cutItemsCache;
+    QList<ItemInfo> m_previews;
 };
 
 inline bool IconManager::showPreview() const