author | zecke <zecke> | 2004-04-02 23:46:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-02 23:46:47 (UTC) |
commit | 02bb854283a7b0abecf3d3e9dd4c9ece0c5ef6a9 (patch) (side-by-side diff) | |
tree | f0ff26b90aefd930c18735cf49b2a9e2c7c6ba9a | |
parent | cc94df750d5e0c016fad2dc12bbbf7cd8592e7c8 (diff) | |
download | opie-02bb854283a7b0abecf3d3e9dd4c9ece0c5ef6a9.zip opie-02bb854283a7b0abecf3d3e9dd4c9ece0c5ef6a9.tar.gz opie-02bb854283a7b0abecf3d3e9dd4c9ece0c5ef6a9.tar.bz2 |
Ah finally the IconView is a bit faster... Still needs a Qt patch
But hey previewing is really useful now. I think it is one of the fastest
Image Viewer available for Unix/Windoze...
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 58 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 1 |
2 files changed, 34 insertions, 25 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index ed9fc9c..4a20648 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -59,25 +59,24 @@ namespace { */ QMap<QString, IconViewItem*> g_stringInf; QMap<QString, IconViewItem*> g_stringPix; IconViewItem::IconViewItem( QIconView* view,const QString& path, const QString& name, bool isDir ) - : QIconViewItem( view ), m_path( path ), m_isDir( isDir ), + : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), m_noInfo( false ) { - QIconViewItem::setText( name ); if ( isDir && !_dirPix ) _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); else if ( !isDir && !_unkPix ) _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); } inline QPixmap* IconViewItem::pixmap()const { - qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", - rect().x(),rect().y(),rect().width(),rect().height(), - iconView()->contentsX(), iconView()->contentsY()); + qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", + rect().x(),rect().y(),rect().width(),rect().height(), + iconView()->contentsX(), iconView()->contentsY()); if ( m_isDir ) return _dirPix; else{ if (!m_noInfo && !g_stringInf.contains( m_path ) ) { currentView()->dirLister()->imageInfo( m_path ); @@ -98,13 +97,13 @@ namespace { QIconViewItem::setText( text ); } } PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) - : QVBox( wid ), m_cfg( cfg ) + : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } m_path = QDir::homeDirPath(); @@ -305,32 +304,37 @@ void PIconView::slotClicked(QIconViewItem* _it) { 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]; - /* if set the view shows nonsens! - I dont know how to fix the format of displayed text :(*/ - item->setText( str ); - g_stringInf.remove( _path ); - } + IconViewItem* item = g_stringInf[_path]; + if (!item ) + return; + + if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), + m_view->contentsWidth(), m_view->contentsHeight() ) ) ) + m_updatet = true; + + item->setText( str ); + g_stringInf.remove( _path ); } void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { - if ( g_stringPix.contains( _path ) ) { - IconViewItem* item = g_stringPix[_path]; - - if (pix.width()>0) { - PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); - /* required for a recalculated rectangle. otherwise the view show nonsense! */ - } else { - PPixmapCache::self()->insertImage(_path,Resource::loadPixmap( "UnknownDocument" ),64,64 ); - } - g_stringPix.remove( _path ); - } + IconViewItem* item = g_stringPix[_path]; + if (!item ) + return; + + if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), + m_view->contentsWidth(), m_view->contentsHeight() ) ) ) + m_updatet = true; + + if (pix.width()>0) + PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); + + + g_stringPix.remove( _path ); } void PIconView::slotRename() { } @@ -351,17 +355,21 @@ void PIconView::slotBeam() { void PIconView::slotBeamDone( Ir* ir) { delete ir; } void PIconView::slotStart() { m_view->viewport()->setUpdatesEnabled( false ); + qWarning( "Sig Start" ); } void PIconView::slotEnd() { - m_view->arrangeItemsInGrid( ); + qWarning( "SLot End" ); + if ( m_updatet ) + m_view->arrangeItemsInGrid( ); m_view->viewport()->setUpdatesEnabled( true ); + m_updatet = false; } void PIconView::slotShowImage() { } void PIconView::slotShowImage( const QString& ) { diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index 0fba327..7ddb023 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h @@ -71,9 +71,10 @@ private slots: private: Opie::Ui::OKeyConfigManager *m_viewManager; Opie::Core::OConfig *m_cfg; QComboBox* m_views; QIconView* m_view; QString m_path; + bool m_updatet : 1; }; #endif |