summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-25 17:13:47 (UTC)
committer alwin <alwin>2004-03-25 17:13:47 (UTC)
commit97016caf3a660676a8a1ce300b7e4c7588262209 (patch) (side-by-side diff)
treed59a6a50d71378516e4a457f2a0d7a839519c74f
parent2487430405f4faa9671a81a1db4be825c06bb601 (diff)
downloadopie-97016caf3a660676a8a1ce300b7e4c7588262209.zip
opie-97016caf3a660676a8a1ce300b7e4c7588262209.tar.gz
opie-97016caf3a660676a8a1ce300b7e4c7588262209.tar.bz2
some workarounds so the dirview displays the icons a little bit better
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
@@ -29,24 +29,25 @@
namespace {
QPixmap* _dirPix = 0;
QPixmap* _unkPix = 0;
class IconViewItem : public QIconViewItem {
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;
};
/*
* If we request an Image or String
* we add it to the map
*/
@@ -77,24 +78,29 @@ namespace {
if ( !m_pix && !g_stringPix.contains( m_path )) {
currentView()->dirLister()->thumbNail( m_path, 64, 64 );
g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
}
return m_pix ? m_pix : _unkPix;
}
}
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 )
{
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
}
m_path = QDir::homeDirPath();
QHBox *hbox = new QHBox( this );
@@ -102,25 +108,25 @@ PIconView::PIconView( QWidget* wid, Config* cfg )
lbl->setText( tr("View as" ) );
m_views = new QComboBox( hbox, "View As" );
connect( m_views, SIGNAL(activated(int)),
this, SLOT(slotViewChanged(int)) );
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();
slotViewChanged( m_views->currentItem() );
}
PIconView::~PIconView() {
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
@@ -249,33 +255,42 @@ void PIconView::slotClicked(QIconViewItem* _it) {
return;
IconViewItem* it = static_cast<IconViewItem*>(_it);
if( it->isDir() )
slotChangeDir( it->path() );
else // view image
;
}
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 );
}
}
void PIconView::slotRename() {
}
void PIconView::slotBeam() {
bool isDir;