KDEUI
kpixmapcache.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KPIXMAPCACHE_H
00022 #define KPIXMAPCACHE_H
00023
00024 #include <kdeui_export.h>
00025
00026 #include <QtCore/QList>
00027 #include <QtCore/QSet>
00028 #include <QtCore/QSize>
00029
00030 class QString;
00031 class QPixmap;
00032
00033
00076 class KDEUI_EXPORT KPixmapCache
00077 {
00078 public:
00083 explicit KPixmapCache(const QString& name);
00084 virtual ~KPixmapCache();
00085
00090 virtual bool find(const QString& key, QPixmap& pix);
00096 virtual void insert(const QString& key, const QPixmap& pix);
00097
00103 QPixmap loadFromFile(const QString& filename);
00109 QPixmap loadFromSvg(const QString& filename, const QSize& size = QSize());
00110
00116 unsigned int timestamp() const;
00122 void setTimestamp(unsigned int time);
00128 void setUseQPixmapCache(bool use);
00133 bool useQPixmapCache() const;
00134
00138 int size() const;
00143 int cacheLimit() const;
00153 void setCacheLimit(int kbytes);
00160 enum RemoveStrategy { RemoveOldest, RemoveSeldomUsed, RemoveLeastRecentlyUsed };
00165 RemoveStrategy removeEntryStrategy() const;
00169 void setRemoveEntryStrategy(RemoveStrategy strategy);
00170
00176 bool isEnabled() const;
00182 bool isValid() const;
00187 static void deleteCache(const QString& name);
00191 void discard();
00192
00203 void removeEntries(int newsize = 0);
00204
00205 protected:
00209 void ensureInited() const;
00210
00214 virtual bool loadCustomData(QDataStream& stream);
00215
00219 virtual bool writeCustomData(QDataStream& stream);
00220
00224 virtual bool loadCustomIndexHeader(QDataStream& stream);
00225
00229 virtual void writeCustomIndexHeader(QDataStream& stream);
00230
00235 void setValid(bool valid);
00236
00240 bool recreateCacheFiles();
00241
00242 private:
00243 class Private;
00244 friend class Private;
00245 Private * const d;
00246 };
00247
00248 #endif // KPIXMAPCACHE_H