-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 36 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 1 |
2 files changed, 23 insertions, 14 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 @@ -53,28 +53,27 @@ namespace { }; /* * If we request an Image or String * we add it to the map */ 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()); if ( m_isDir ) return _dirPix; @@ -92,25 +91,25 @@ namespace { 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 ); } } 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(); QHBox *hbox = new QHBox( this ); QLabel* lbl = new QLabel( hbox ); lbl->setText( tr("View as" ) ); m_views = new QComboBox( hbox, "View As" ); connect( m_views, SIGNAL(activated(int)), @@ -299,45 +298,50 @@ void PIconView::addFiles( const QStringList& lst) { void PIconView::slotClicked(QIconViewItem* _it) { if(!_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]; - /* if set the view shows nonsens! - I dont know how to fix the format of displayed text :(*/ + 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 (!item ) + return; - if (pix.width()>0) { + 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 ); - /* required for a recalculated rectangle. otherwise the view show nonsense! */ - } else { - PPixmapCache::self()->insertImage(_path,Resource::loadPixmap( "UnknownDocument" ),64,64 ); - } + + g_stringPix.remove( _path ); } -} void PIconView::slotRename() { } void PIconView::slotBeam() { bool isDir; QString pa = currentFileName( isDir ); if ( isDir && pa.isEmpty() ) return; @@ -345,29 +349,33 @@ void PIconView::slotBeam() { connect( ir, SIGNAL(done(Ir*)), this, SLOT(slotBeamDone(Ir*))); ir->send(pa, tr( "Image" ) ); } void PIconView::slotBeamDone( Ir* ir) { delete ir; } void PIconView::slotStart() { m_view->viewport()->setUpdatesEnabled( false ); + qWarning( "Sig Start" ); } void PIconView::slotEnd() { + 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& ) { } void PIconView::slotImageInfo() { } void PIconView::slotImageInfo( 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 @@ -65,15 +65,16 @@ private slots: void addFiles( const QStringList& ); void slotClicked(QIconViewItem* ); /**/ void slotThumbInfo(const QString&, const QString&); void slotThumbNail(const QString&, const QPixmap&); 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 |