KHtml
26 #ifndef _khtml_loader_h
27 #define _khtml_loader_h
29 #include "loader_client.h"
35 #include <QStringList>
40 #include <QLinkedList>
43 #include <kio/global.h>
45 #include <khtml_settings.h>
46 #include <dom/dom_string.h>
47 #include "imload/image.h"
48 #include "imload/imageowner.h"
97 PreloadNotReferenced = 0,
99 PreloadReferencedWhileLoading,
100 PreloadReferencedWhileComplete
103 PreloadResult preloadResult()
const
105 return m_preloadResult;
107 void setProspectiveRequest()
109 m_prospectiveRequest =
true;
113 : m_url(url), m_type(type), m_cachePolicy(_cachePolicy),
118 m_cachePolicy = _cachePolicy;
123 m_wasBlocked =
false;
124 m_prev = m_next =
nullptr;
126 m_preloadResult = PreloadNotReferenced;
127 m_prospectiveRequest =
false;
131 virtual void data(
QBuffer &buffer,
bool eof) = 0;
132 virtual void error(
int err,
const char *text) = 0;
148 return m_clients.count();
150 int accessCount()
const
152 return m_accessCount;
155 bool isPreloaded()
const
157 return m_preloadCount;
159 void increasePreloadCount()
163 void decreasePreloadCount()
165 assert(m_preloadCount);
169 void setStatus(Status s)
173 Status status()
const
178 virtual void setCharset(
const QString & ) {}
187 bool isLoaded()
const
191 bool hadError()
const
203 return m_cachePolicy;
206 void setRequest(
Request *_request);
208 bool canDelete()
const
210 return (m_clients.count() == 0 && !m_request && !m_preloadCount);
213 void setExpireDate(
const QDateTime &_expireDate)
215 m_expireDate = _expireDate;
218 bool isExpired()
const;
220 virtual void finish();
230 void setAccept(
const QString &_accept)
242 void setSize(
int size);
254 unsigned m_preloadCount;
255 PreloadResult m_preloadResult: 3;
260 bool m_wasBlocked : 1;
261 bool m_prospectiveRequest: 1;
264 bool allowInLRUList()
const
266 return canDelete() && !m_free && status() != Persistent;
268 CachedObject *m_next;
269 CachedObject *m_prev;
271 friend class ::KHTMLPart;
296 void data(
QBuffer &buffer,
bool eof)
override;
297 void error(
int err,
const char *text)
override;
299 void setCharsetHint(
const QString &charset)
301 m_charsetHint = charset;
303 void setCharset(
const QString &charset)
override
335 void data(
QBuffer &buffer,
bool eof)
override;
336 void error(
int err,
const char *text)
override;
340 bool isLoaded()
const
344 void setCharset(
const QString &charset)
override
367 QPixmap *scaled_pixmap(
int xWidth,
int xHeight);
368 QPixmap tiled_pixmap(
const QColor &bg,
int xWidth = -1,
int xHeight = -1);
370 QSize pixmap_size()
const;
373 bool canRender()
const
375 return !isErrorImage() && pixmap_size().
width() > 0 && pixmap_size().
height() > 0;
380 void data(
QBuffer &buffer,
bool eof)
override;
381 void error(
int err,
const char *text)
override;
383 bool isComplete()
const
387 bool isTransparent()
const
391 bool isErrorImage()
const
395 bool isBlockedImage()
const
399 const QString &suggestedFilename()
const
401 return m_suggestedFilename;
403 void setSuggestedFilename(
const QString &s)
405 m_suggestedFilename = s;
408 const QString &suggestedTitle()
const
410 return m_suggestedTitle;
412 void setSuggestedTitle(
const QString &s)
414 m_suggestedTitle = s;
417 const QString &suggestedTitle()
const
419 return m_suggestedFilename;
423 void setShowAnimations(KHTMLSettings::KAnimationAdvice);
425 void finish()
override;
444 void doNotifyFinished();
446 void do_notify(
const QRect &r);
459 friend class ::KHTMLPart;
476 void data(
QBuffer &buffer,
bool eof)
override;
477 void error(
int err,
const char *text)
override;
481 bool isLoaded()
const
504 void data(
QBuffer &buffer,
bool eof)
override;
505 void error(
int err,
const char *text)
override;
509 bool isLoaded()
const
531 const char *accept =
"text/css",
bool userSheet =
false);
537 bool autoloadImages()
const
539 return m_bautoloadImages;
543 return m_cachePolicy;
545 KHTMLSettings::KAnimationAdvice showAnimations()
const
547 return m_showAnimations;
562 void setCacheCreationDate(
const QDateTime &);
564 void setRelativeExpireDate(qint64 seconds);
565 void setAutoloadImages(
bool);
568 m_cachePolicy = cachePolicy;
570 void setShowAnimations(KHTMLSettings::KAnimationAdvice);
574 m_docObjects.remove(o);
576 void clearPreloads();
578 void printPreloadStats();
585 friend class ::KHTMLPart;
593 bool m_bautoloadImages : 1;
594 KHTMLSettings::KAnimationAdvice m_showAnimations : 2;
640 void slotFinished(
KJob *);
645 void scheduleRequest(
Request *req);
660 template<
typename CachedObjectType, enum CachedObject::Type CachedType>
661 static CachedObjectType *requestObject(
DocLoader *dl,
const QUrl &kurl,
const char *accept);
668 KHTML_EXPORT
static void init();
689 static void setSize(
int bytes);
694 static void statistics();
695 KHTML_EXPORT
static void flush(
bool force =
false);
702 KHTML_EXPORT
static void clear();
712 static int cacheSize;
718 static void checkLRUAndUncacheableListIntegrity();
728 static int totalSizeOfLRU;
This file is part of the HTML rendering engine for KDE.
bool complete() const
Returns true if the image has been fully loaded.
static KHTML_EXPORT void clear()
clears the cache Warning: call this only at the end of your program, to clean up memory (useful for f...
This library provides a full-featured HTML parser and widget.
This class is khtml's main class.
The users of Image's need to inherit off ImageOwner, in order to receive the information about their ...
static KHTML_EXPORT void init()
init the cache in case it's not already.
static void preloadStyleSheet(const QString &url, const QString &stylesheet_data)
Ask the cache for some url.
The CSSStyleSheet interface is a concrete interface used to represent a CSS style sheet i....
This class implements the basic string we use in the DOM.
QString accept() const
List of acceptable mimetypes separated by ",".
static void preloadScript(const QString &url, const QString &script_data)
Pre-loads a script into the cache.
An image represents a static picture or an animation, that may be incrementally loaded.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 03:56:14 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.