summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp26
-rw-r--r--noncore/graphics/opie-eye/lib/imagecache.cpp6
-rw-r--r--noncore/graphics/opie-eye/lib/imagecache.h5
3 files changed, 27 insertions, 10 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
@@ -52,7 +52,9 @@ namespace {
52 void setText( const QString& ); 52 void setText( const QString& );
53 bool textOnly()const{return m_textOnly;} 53 bool textOnly()const{return m_textOnly;}
54 void setTextOnly(bool how){m_textOnly=how;} 54 void setTextOnly(bool how){m_textOnly=how;}
55 /* just for starting recalc of item rect! */
55 virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); 56 virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE );
57 /* just for starting recalc of item rect! */
56 virtual void setPixmap( const QPixmap & icon); 58 virtual void setPixmap( const QPixmap & icon);
57 59
58 protected: 60 protected:
@@ -99,12 +101,12 @@ namespace {
99 inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw) 101 inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw)
100 { 102 {
101 m_Pixset = true; 103 m_Pixset = true;
102 QIconViewItem::setPixmap(icon,recalc,redraw); 104 calcRect(text());
103 } 105 }
104 inline void IconViewItem::setPixmap( const QPixmap & icon) 106 inline void IconViewItem::setPixmap( const QPixmap & icon)
105 { 107 {
106 m_Pixset = true; 108 m_Pixset = true;
107 QIconViewItem::setPixmap(icon); 109 calcRect(text());
108 } 110 }
109 111
110 inline QPixmap* IconViewItem::pixmap()const { 112 inline QPixmap* IconViewItem::pixmap()const {
@@ -125,13 +127,10 @@ namespace {
125 } 127 }
126 128
127 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); 129 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 );
128 if (!m_pix && !g_stringPix.contains( m_path )&&!m_Pixset) { 130 if (!m_pix && !g_stringPix.contains( m_path )) {
129 currentView()->dirLister()->thumbNail( m_path, 64, 64 ); 131 currentView()->dirLister()->thumbNail( m_path, 64, 64 );
130 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); 132 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
131 } 133 }
132 if (m_Pixset) {
133 return QIconViewItem::pixmap();
134 }
135 return m_pix ? m_pix : _unkPix; 134 return m_pix ? m_pix : _unkPix;
136 } 135 }
137 } 136 }
@@ -409,8 +408,12 @@ void PIconView::addFiles( const QStringList& lst) {
409 for (it=lst.begin(); it!= lst.end(); ++it ) { 408 for (it=lst.begin(); it!= lst.end(); ++it ) {
410 m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 ); 409 m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 );
411 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); 410 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
412 if (m_mode==3) _iv->setTextOnly(true); 411 if (m_mode==3) {
413 if (m_pix) _iv->setPixmap(*m_pix); 412 _iv->setTextOnly(true);
413 _iv->setPixmap(QPixmap());
414 } else {
415 if (m_pix) _iv->setPixmap(*m_pix);
416 }
414 } 417 }
415 418
416} 419}
@@ -592,17 +595,20 @@ void PIconView::calculateGrid() {
592 595
593 switch (m_mode) { 596 switch (m_mode) {
594 case 2: 597 case 2:
595 m_view->setGridX(80); 598 m_view->setGridX(50);
596 m_view->setGridY(80); 599 m_view->setGridY(20);
600 PPixmapCache::self()->setMaxImages(40);
597 break; 601 break;
598 case 3: 602 case 3:
599 m_view->setGridX(m_view->width()); 603 m_view->setGridX(m_view->width());
600 m_view->setGridY(8); 604 m_view->setGridY(8);
605 PPixmapCache::self()->setMaxImages(2);
601 break; 606 break;
602 case 1: 607 case 1:
603 default: 608 default:
604 m_view->setGridX(m_view->width()); 609 m_view->setGridX(m_view->width());
605 m_view->setGridY(80); 610 m_view->setGridY(80);
611 PPixmapCache::self()->setMaxImages(20);
606 break; 612 break;
607 } 613 }
608} 614}
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
@@ -62,6 +62,12 @@ PPixmapCache::PPixmapCache() {
62PPixmapCache::~PPixmapCache() { 62PPixmapCache::~PPixmapCache() {
63} 63}
64 64
65void PPixmapCache::setMaxImages(unsigned int aMax)
66{
67 m_MaxImages = aMax;
68 setMaxCost( 64*64*QPixmap::defaultDepth()/8*m_MaxImages);
69}
70
65PPixmapCache* PPixmapCache::self() { 71PPixmapCache* PPixmapCache::self() {
66 if ( !_pxmCache ) 72 if ( !_pxmCache )
67 _pxmCache = new PPixmapCache; 73 _pxmCache = new PPixmapCache;
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
@@ -28,11 +28,16 @@ class PPixmapCache : public QCache<QPixmap> {
28private: 28private:
29 PPixmapCache(); 29 PPixmapCache();
30 ~PPixmapCache(); 30 ~PPixmapCache();
31
32 unsigned int m_MaxImages;
33
31public: 34public:
32 static PPixmapCache *self(); 35 static PPixmapCache *self();
33 QPixmap* cachedImage( const QString& path, int width, int height ); 36 QPixmap* cachedImage( const QString& path, int width, int height );
34 void insertImage( const QString& path, const QPixmap &, int width, int height ); 37 void insertImage( const QString& path, const QPixmap &, int width, int height );
35 void insertImage( const QString& path, const QPixmap *, int width, int height ); 38 void insertImage( const QString& path, const QPixmap *, int width, int height );
39 void setMaxImages(unsigned int aMax);
40 unsigned int maxImages()const{return m_MaxImages;}
36}; 41};
37 42
38inline void PPixmapCache::insertImage( const QString& path, const QPixmap& p, int width, int height ) { 43inline void PPixmapCache::insertImage( const QString& path, const QPixmap& p, int width, int height ) {