summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp80
1 files changed, 68 insertions, 12 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 7231bfb..039f53f 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -44,2 +44,3 @@ namespace {
44 static QPixmap* _picPix = 0; 44 static QPixmap* _picPix = 0;
45 static QPixmap* _emptyPix = 0;
45 class IconViewItem : public QIconViewItem { 46 class IconViewItem : public QIconViewItem {
@@ -51,2 +52,6 @@ namespace {
51 void setText( const QString& ); 52 void setText( const QString& );
53 bool textOnly()const{return m_textOnly;}
54 void setTextOnly(bool how){m_textOnly=how;}
55 virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE );
56 virtual void setPixmap( const QPixmap & icon);
52 57
@@ -59,2 +64,5 @@ namespace {
59 bool m_noInfo :1; 64 bool m_noInfo :1;
65 bool m_textOnly:1;
66 bool m_NameOnly:1;
67 bool m_Pixset:1;
60 }; 68 };
@@ -82,3 +90,3 @@ namespace {
82 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), 90 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
83 m_noInfo( false ) 91 m_noInfo( false ),m_textOnly(false),m_Pixset(false)
84 { 92 {
@@ -89,2 +97,14 @@ namespace {
89 } 97 }
98
99 inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw)
100 {
101 m_Pixset = true;
102 QIconViewItem::setPixmap(icon,recalc,redraw);
103 }
104 inline void IconViewItem::setPixmap( const QPixmap & icon)
105 {
106 m_Pixset = true;
107 QIconViewItem::setPixmap(icon);
108 }
109
90 inline QPixmap* IconViewItem::pixmap()const { 110 inline QPixmap* IconViewItem::pixmap()const {
@@ -94,2 +114,6 @@ namespace {
94 114
115 if (textOnly()&&!m_isDir) {
116 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
117 return _emptyPix;
118 }
95 if ( m_isDir ) 119 if ( m_isDir )
@@ -103,3 +127,3 @@ namespace {
103 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); 127 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 );
104 if ( !m_pix && !g_stringPix.contains( m_path )) { 128 if (!m_pix && !g_stringPix.contains( m_path )&&!m_Pixset) {
105 currentView()->dirLister()->thumbNail( m_path, 64, 64 ); 129 currentView()->dirLister()->thumbNail( m_path, 64, 64 );
@@ -107,2 +131,5 @@ namespace {
107 } 131 }
132 if (m_Pixset) {
133 return QIconViewItem::pixmap();
134 }
108 return m_pix ? m_pix : _unkPix; 135 return m_pix ? m_pix : _unkPix;
@@ -369,7 +396,8 @@ void PIconView::addFolders( const QStringList& lst) {
369 QStringList::ConstIterator it; 396 QStringList::ConstIterator it;
397 IconViewItem * _iv;
370 398
371 for(it=lst.begin(); it != lst.end(); ++it ) 399 for(it=lst.begin(); it != lst.end(); ++it ) {
372 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); 400 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
373 401 if (m_mode==3) _iv->setTextOnly(true);
374 402 }
375} 403}
@@ -378,4 +406,10 @@ void PIconView::addFiles( const QStringList& lst) {
378 QStringList::ConstIterator it; 406 QStringList::ConstIterator it;
379 for (it=lst.begin(); it!= lst.end(); ++it ) 407 IconViewItem * _iv;
380 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); 408 QPixmap*m_pix = 0;
409 for (it=lst.begin(); it!= lst.end(); ++it ) {
410 m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 );
411 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
412 if (m_mode==3) _iv->setTextOnly(true);
413 if (m_pix) _iv->setPixmap(*m_pix);
414 }
381 415
@@ -406,2 +440,5 @@ void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
406 440
441 if (m_mode == 2) {
442 return;
443 }
407 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 444 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
@@ -426,6 +463,8 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
426 463
427 if (pix.width()>0) 464 if (pix.width()>0) {
428 PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); 465 PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
429 466 item->setPixmap(pix,true);
430 467 } else {
468 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 );
469 }
431 g_stringPix.remove( _path ); 470 g_stringPix.remove( _path );
@@ -550,3 +589,20 @@ void PIconView::resizeEvent( QResizeEvent* re ) {
550void PIconView::calculateGrid() { 589void PIconView::calculateGrid() {
551 590 odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl;
591 odebug << "Size of view: " << m_view->size() << oendl;
592
593 switch (m_mode) {
594 case 2:
595 m_view->setGridX(80);
596 m_view->setGridY(80);
597 break;
598 case 3:
599 m_view->setGridX(m_view->width());
600 m_view->setGridY(8);
601 break;
602 case 1:
603 default:
604 m_view->setGridX(m_view->width());
605 m_view->setGridY(80);
606 break;
607 }
552} 608}