summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Side-by-side diff
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 {
static QPixmap* _picPix = 0;
+ static QPixmap* _emptyPix = 0;
class IconViewItem : public QIconViewItem {
@@ -51,2 +52,6 @@ namespace {
void setText( const QString& );
+ bool textOnly()const{return m_textOnly;}
+ void setTextOnly(bool how){m_textOnly=how;}
+ virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE );
+ virtual void setPixmap( const QPixmap & icon);
@@ -59,2 +64,5 @@ namespace {
bool m_noInfo :1;
+ bool m_textOnly:1;
+ bool m_NameOnly:1;
+ bool m_Pixset:1;
};
@@ -82,3 +90,3 @@ namespace {
: QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
- m_noInfo( false )
+ m_noInfo( false ),m_textOnly(false),m_Pixset(false)
{
@@ -89,2 +97,14 @@ namespace {
}
+
+ inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw)
+ {
+ m_Pixset = true;
+ QIconViewItem::setPixmap(icon,recalc,redraw);
+ }
+ inline void IconViewItem::setPixmap( const QPixmap & icon)
+ {
+ m_Pixset = true;
+ QIconViewItem::setPixmap(icon);
+ }
+
inline QPixmap* IconViewItem::pixmap()const {
@@ -94,2 +114,6 @@ namespace {
+ if (textOnly()&&!m_isDir) {
+ if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
+ return _emptyPix;
+ }
if ( m_isDir )
@@ -103,3 +127,3 @@ namespace {
m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 );
- if ( !m_pix && !g_stringPix.contains( m_path )) {
+ if (!m_pix && !g_stringPix.contains( m_path )&&!m_Pixset) {
currentView()->dirLister()->thumbNail( m_path, 64, 64 );
@@ -107,2 +131,5 @@ namespace {
}
+ if (m_Pixset) {
+ return QIconViewItem::pixmap();
+ }
return m_pix ? m_pix : _unkPix;
@@ -369,7 +396,8 @@ void PIconView::addFolders( const QStringList& lst) {
QStringList::ConstIterator it;
+ IconViewItem * _iv;
- for(it=lst.begin(); it != lst.end(); ++it )
- (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
-
-
+ for(it=lst.begin(); it != lst.end(); ++it ) {
+ _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
+ if (m_mode==3) _iv->setTextOnly(true);
+ }
}
@@ -378,4 +406,10 @@ void PIconView::addFiles( const QStringList& lst) {
QStringList::ConstIterator it;
- for (it=lst.begin(); it!= lst.end(); ++it )
- (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
+ IconViewItem * _iv;
+ QPixmap*m_pix = 0;
+ for (it=lst.begin(); it!= lst.end(); ++it ) {
+ 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_pix) _iv->setPixmap(*m_pix);
+ }
@@ -406,2 +440,5 @@ void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
+ if (m_mode == 2) {
+ return;
+ }
if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
@@ -426,6 +463,8 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
- if (pix.width()>0)
+ if (pix.width()>0) {
PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
-
-
+ item->setPixmap(pix,true);
+ } else {
+ PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 );
+ }
g_stringPix.remove( _path );
@@ -550,3 +589,20 @@ void PIconView::resizeEvent( QResizeEvent* re ) {
void PIconView::calculateGrid() {
-
+ odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl;
+ odebug << "Size of view: " << m_view->size() << oendl;
+
+ switch (m_mode) {
+ case 2:
+ m_view->setGridX(80);
+ m_view->setGridY(80);
+ break;
+ case 3:
+ m_view->setGridX(m_view->width());
+ m_view->setGridY(8);
+ break;
+ case 1:
+ default:
+ m_view->setGridX(m_view->width());
+ m_view->setGridY(80);
+ break;
+ }
}