-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 24 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/imagecache.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/imagecache.h | 5 |
3 files changed, 26 insertions, 9 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 039f53f..d546b64 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -53,5 +53,7 @@ namespace { bool textOnly()const{return m_textOnly;} void setTextOnly(bool how){m_textOnly=how;} + /* just for starting recalc of item rect! */ virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); + /* just for starting recalc of item rect! */ virtual void setPixmap( const QPixmap & icon); @@ -100,10 +102,10 @@ namespace { { m_Pixset = true; - QIconViewItem::setPixmap(icon,recalc,redraw); + calcRect(text()); } inline void IconViewItem::setPixmap( const QPixmap & icon) { m_Pixset = true; - QIconViewItem::setPixmap(icon); + calcRect(text()); } @@ -126,11 +128,8 @@ namespace { m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); - if (!m_pix && !g_stringPix.contains( m_path )&&!m_Pixset) { + if (!m_pix && !g_stringPix.contains( m_path )) { currentView()->dirLister()->thumbNail( m_path, 64, 64 ); g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); } - if (m_Pixset) { - return QIconViewItem::pixmap(); - } return m_pix ? m_pix : _unkPix; } @@ -410,7 +409,11 @@ void PIconView::addFiles( const QStringList& lst) { m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 ); _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); - if (m_mode==3) _iv->setTextOnly(true); + if (m_mode==3) { + _iv->setTextOnly(true); + _iv->setPixmap(QPixmap()); + } else { if (m_pix) _iv->setPixmap(*m_pix); } + } } @@ -593,10 +596,12 @@ void PIconView::calculateGrid() { switch (m_mode) { case 2: - m_view->setGridX(80); - m_view->setGridY(80); + m_view->setGridX(50); + m_view->setGridY(20); + PPixmapCache::self()->setMaxImages(40); break; case 3: m_view->setGridX(m_view->width()); m_view->setGridY(8); + PPixmapCache::self()->setMaxImages(2); break; case 1: @@ -604,4 +609,5 @@ void PIconView::calculateGrid() { m_view->setGridX(m_view->width()); m_view->setGridY(80); + PPixmapCache::self()->setMaxImages(20); break; } diff --git a/noncore/graphics/opie-eye/lib/imagecache.cpp b/noncore/graphics/opie-eye/lib/imagecache.cpp index 3b74a83..f1042a4 100644 --- a/noncore/graphics/opie-eye/lib/imagecache.cpp +++ b/noncore/graphics/opie-eye/lib/imagecache.cpp @@ -63,4 +63,10 @@ PPixmapCache::~PPixmapCache() { } +void PPixmapCache::setMaxImages(unsigned int aMax) +{ + m_MaxImages = aMax; + setMaxCost( 64*64*QPixmap::defaultDepth()/8*m_MaxImages); +} + PPixmapCache* PPixmapCache::self() { if ( !_pxmCache ) diff --git a/noncore/graphics/opie-eye/lib/imagecache.h b/noncore/graphics/opie-eye/lib/imagecache.h index 076ecd3..939247a 100644 --- a/noncore/graphics/opie-eye/lib/imagecache.h +++ b/noncore/graphics/opie-eye/lib/imagecache.h @@ -29,4 +29,7 @@ private: PPixmapCache(); ~PPixmapCache(); + + unsigned int m_MaxImages; + public: static PPixmapCache *self(); @@ -34,4 +37,6 @@ public: void insertImage( const QString& path, const QPixmap &, int width, int height ); void insertImage( const QString& path, const QPixmap *, int width, int height ); + void setMaxImages(unsigned int aMax); + unsigned int maxImages()const{return m_MaxImages;} }; |