From 6192138f99ffc1d0fa288906193f9399a6ca55ba Mon Sep 17 00:00:00 2001 From: Maurizio Monge Date: Thu, 12 Jul 2007 01:00:09 +0200 Subject: [PATCH] Use names easer to understand in PixmapLoader implementation --- src/pixmaploader.cpp | 26 ++++++++++++-------------- src/pixmaploader.h | 14 +++++++------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/pixmaploader.cpp b/src/pixmaploader.cpp index 5c5772f..94050e3 100644 --- a/src/pixmaploader.cpp +++ b/src/pixmaploader.cpp @@ -12,21 +12,19 @@ #include "loader/theme.h" #include "pixmaploader.h" -class PixmapLoader::Loader : public ::Loader::Theme { +class PixmapLoader::ThemeLoader : public Loader::Theme { public: int m_ref_count; - Loader(const QString& s) - : ::Loader::Theme(s) + + ThemeLoader(const QString& s) + : Loader::Theme(s) , m_ref_count(0) { } }; -/* inherit instead of typedef to ease forward declaration :) */ -class PixmapLoader::LoadersCache : public - std::map { -}; -PixmapLoader::LoadersCache PixmapLoader::loaders; +PixmapLoader::ThemeLoadersCache PixmapLoader::loaders; + PixmapLoader::PixmapLoader() : m_loader(NULL) @@ -54,7 +52,7 @@ void PixmapLoader::flush() { } void PixmapLoader::setBasePath(const QString& base) { - //QString base = PixmapLoader::Loader::resolveBasePath(__base); + //QString base = PixmapLoader::ThemeLoader::resolveBasePath(__base); if(base == m_base) return; @@ -81,7 +79,7 @@ void PixmapLoader::initialize() { if(loaders.count(m_base)) m_loader = loaders[m_base]; else { - m_loader = new Loader(m_base); + m_loader = new ThemeLoader(m_base); loaders[m_base] = m_loader; } @@ -99,9 +97,9 @@ QPixmap PixmapLoader::operator()(const QString& id) { return m_loader->getPixmap(id, m_size); } -::Loader::PixmapOrMap PixmapLoader::getPixmapMap(const QString& id) { +Loader::PixmapOrMap PixmapLoader::getPixmapMap(const QString& id) { if(!m_size || m_base.isEmpty()) - return ::Loader::PixmapOrMap(); + return Loader::PixmapOrMap(); if(!m_loader) initialize(); @@ -109,9 +107,9 @@ QPixmap PixmapLoader::operator()(const QString& id) { return m_loader->getPixmapMap(id, m_size); } -::Loader::Glyph PixmapLoader::getGlyph(const QString& id) { +Loader::Glyph PixmapLoader::getGlyph(const QString& id) { if(!m_size || m_base.isEmpty()) - return ::Loader::Glyph(); + return Loader::Glyph(); if(!m_loader) initialize(); diff --git a/src/pixmaploader.h b/src/pixmaploader.h index 2accd45..1f0d17a 100644 --- a/src/pixmaploader.h +++ b/src/pixmaploader.h @@ -20,21 +20,21 @@ * @brief The simple pixmap loading facility. * * This is the utility class used by the interface to load pixmap from resource ids. - * It acts simply as a wrapper around PixmapLoader::Loader, making it possible to + * It acts simply as a wrapper around PixmapLoader::ThemeLoader, making it possible to * use it in a simple and afficient way. * * Note that pixmaps will not be all of the specified size, the size is only the base size. */ class PixmapLoader { private: - class Loader; - class LoadersCache; + class ThemeLoader; + typedef std::map ThemeLoadersCache; /** static cache of the loaders, there should be only one for each (theme,variant) pair */ - static LoadersCache loaders; + static ThemeLoadersCache loaders; /** the current loader, or NULL */ - Loader *m_loader; + ThemeLoader *m_loader; /** the current size */ int m_size; @@ -67,10 +67,10 @@ public: QPixmap operator()(const QString& id); /** looks up a string id (for instance a predefined id, like "background" or "highlighting") */ - ::Loader::PixmapOrMap getPixmapMap(const QString& id); + ::ThemeLoader::PixmapOrMap getPixmapMap(const QString& id); /** looks up a font + char */ - ::Loader::Glyph getGlyph(const QString& id); + ::ThemeLoader::Glyph getGlyph(const QString& id); }; #endif // PIXMAPLOADER_H -- 2.11.4.GIT