• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • util
kpixmapcache.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of the KDE project.
4  * Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License version 2 as published by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef KPIXMAPCACHE_H
22 #define KPIXMAPCACHE_H
23 
24 #include <kdeui_export.h>
25 
26 #include <QtCore/QList>
27 #include <QtCore/QSet>
28 #include <QtCore/QSize>
29 
30 class QString;
31 class QPixmap;
32 
33 
85 class KDEUI_EXPORT KPixmapCache
86 {
87 public:
92  explicit KPixmapCache(const QString& name);
93  virtual ~KPixmapCache();
94 
101  virtual bool find(const QString& key, QPixmap& pix);
102 
108  virtual void insert(const QString& key, const QPixmap& pix);
109 
128  QPixmap loadFromFile(const QString& filename);
129 
144  QPixmap loadFromSvg(const QString& filename, const QSize& size = QSize());
145 
151  unsigned int timestamp() const;
152 
158  void setTimestamp(unsigned int time);
159 
173  // KDE5 Get rid of QPixmapCache and use a sane cache instead.
174  void setUseQPixmapCache(bool use);
175 
186  bool useQPixmapCache() const;
187 
191  int size() const;
192 
197  int cacheLimit() const;
198 
210  void setCacheLimit(int kbytes);
211 
216  enum RemoveStrategy {
217  RemoveOldest,
219  RemoveSeldomUsed,
221  RemoveLeastRecentlyUsed
222  };
227  RemoveStrategy removeEntryStrategy() const;
228 
232  void setRemoveEntryStrategy(RemoveStrategy strategy);
233 
240  bool isEnabled() const;
241 
247  bool isValid() const;
248 
253  // KDE5: Static function oh how I hate you, this makes it very difficult to perform
254  // appropriate locking and synchronization to actually remove the cache.
255  static void deleteCache(const QString& name);
256 
266  void discard();
267 
279  void removeEntries(int newsize = 0);
280 
281 protected:
291  // KDE5: rename to ensureInitialized()
292  // KDE5: Make private or move to Private
293  void ensureInited() const;
294 
308  virtual bool loadCustomData(QDataStream& stream);
309 
320  virtual bool writeCustomData(QDataStream& stream);
321 
335  virtual bool loadCustomIndexHeader(QDataStream& stream);
336 
347  virtual void writeCustomIndexHeader(QDataStream& stream);
348 
361  void setValid(bool valid);
362 
375  bool recreateCacheFiles();
376 
377 private:
379  class Private;
380  friend class Private;
381  Private * const d;
382 };
383 
384 #endif // KPIXMAPCACHE_H
KStandardGuiItem::discard
KGuiItem discard()
Returns the 'Discard' gui item.
Definition: kstandardguiitem.cpp:128
QDataStream
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KPixmapCache
General-purpose pixmap cache for KDE.
Definition: kpixmapcache.h:85
KStandardAction::find
KAction * find(const QObject *recvr, const char *slot, QObject *parent)
Initiate a 'find' request in the current document.
Definition: kstandardaction.cpp:329
KPixmapCache::RemoveSeldomUsed
least used entries are removed first.
Definition: kpixmapcache.h:219
KStandardShortcut::insert
const KShortcut & insert()
Toggle insert/overwrite (with visual feedback, e.g.
Definition: kstandardguiitem.cpp:264
QString
QPixmap
QSize
KPixmapCache::RemoveOldest
oldest entries are removed first.
Definition: kpixmapcache.h:217
kdeui_export.h
KPixmapCache::RemoveStrategy
RemoveStrategy
Describes which entries will be removed first during cache cleanup.
Definition: kpixmapcache.h:216
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal