summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 729b64f..aeaa3c6 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -35,12 +35,13 @@ namespace {
public:
IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false);
QPixmap* pixmap()const;
QString path()const { return m_path; }
bool isDir()const { return m_isDir; }
void setText( const QString& );
+ void reCalc();
private:
mutable QPixmap* m_pix;
QString m_path;
bool m_isDir : 1;
bool m_noInfo :1;
};
@@ -83,12 +84,17 @@ namespace {
}
inline void IconViewItem::setText( const QString& str ) {
QString text = QIconViewItem::text()+"\n"+str;
m_noInfo = true;
QIconViewItem::setText( text );
}
+
+ inline void IconViewItem::reCalc()
+ {
+ calcRect();
+ }
}
PIconView::PIconView( QWidget* wid, Config* cfg )
: QVBox( wid ), m_cfg( cfg )
{
@@ -108,13 +114,13 @@ PIconView::PIconView( QWidget* wid, Config* cfg )
m_view= new QIconView( this );
connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
this, SLOT(slotClicked(QIconViewItem*)) );
m_view->setArrangement( QIconView::LeftToRight );
m_view->setItemTextPos( QIconView::Right );
-
+ m_view->setResizeMode(QIconView::Adjust);
int dw = QApplication::desktop()->width();
int viewerWidth = dw-style().scrollBarExtent().width();
m_view->setGridX( viewerWidth-2*m_view->spacing() );
m_view->setGridY( fontMetrics().height()*2+40 );
loadViews();
@@ -255,21 +261,30 @@ void PIconView::slotClicked(QIconViewItem* _it) {
;
}
void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
if ( g_stringInf.contains( _path ) ) {
IconViewItem* item = g_stringInf[_path];
- item->setText( str );
+ /* if set the view shows nonsens!
+ I dont know how to fix the format of displayed text :(*/
+ //item->setText( str );
item->repaint();
g_stringInf.remove( _path );
}
}
void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
if ( g_stringPix.contains( _path ) ) {
IconViewItem* item = g_stringPix[_path];
- PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
+
+ if (pix.width()>0) {
+ PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
+ /* required for a recalculated rectangle. otherwise the view show nonsense! */
+ item->reCalc();
+ } else {
+ PPixmapCache::self()->insertImage(_path,Resource::loadPixmap( "UnknownDocument" ),64,64 );
+ }
item->repaint();
g_stringPix.remove( _path );
}
}