author | zecke <zecke> | 2004-04-06 10:37:23 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-06 10:37:23 (UTC) |
commit | 8981e35697647315d88cdf95e912b0fe2f9d5375 (patch) (side-by-side diff) | |
tree | 4631dc800cb6d45d38d69d43f14e305ce0123d10 | |
parent | 2a4ec8132bea9c4c8308038d555755eabc1eee46 (diff) | |
download | opie-8981e35697647315d88cdf95e912b0fe2f9d5375.zip opie-8981e35697647315d88cdf95e912b0fe2f9d5375.tar.gz opie-8981e35697647315d88cdf95e912b0fe2f9d5375.tar.bz2 |
Add some documentation and remove qWarnings
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 4ced52d..c07a1e5 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -196,47 +196,57 @@ void PIconView::initKeys() { /* * change one dir up */ void PIconView::slotDirUp() { QDir dir( m_path ); dir.cdUp(); slotChangeDir( dir.absPath() ); - } /* * change the dir */ void PIconView::slotChangeDir(const QString& path) { if ( !currentView() ) return; PDirLister *lister = currentView()->dirLister(); if (!lister ) return; + /* + * Say what we want and take what we get + */ lister->setStartPath( path ); m_path = lister->currentPath(); m_view->viewport()->setUpdatesEnabled( false ); m_view->clear(); + + /* + * add files and folders + */ addFolders( lister->folders() ); addFiles( lister->files() ); m_view->viewport()->setUpdatesEnabled( true ); // Also invalidate the cache. We can't cancel the operations anyway g_stringPix.clear(); g_stringInf.clear(); // looks ugly static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); } +/** + * get the current file name + * @param isDir see if this is a dir or real file + */ QString PIconView::currentFileName(bool &isDir)const { isDir = false; QIconViewItem* _it = m_view->currentItem(); if ( !_it ) return QString::null; IconViewItem* it = static_cast<IconViewItem*>( _it ); isDir = it->isDir(); @@ -253,27 +263,34 @@ void PIconView::slotTrash() { tr("Delete Image" ), tr("the Image %1" ).arg(pa))) return currentView()->dirLister()->deleteImage( pa ); delete m_view->currentItem(); } + +/* + * see what views are available + */ void PIconView::loadViews() { ViewMap::Iterator it; ViewMap* map = viewMap(); for ( it = map->begin(); it != map->end(); ++it ) m_views->insertItem( QObject::tr(it.key() ) ); } void PIconView::resetView() { slotViewChanged(m_views->currentItem()); } +/* + *swicth view reloadDir and connect signals + */ void PIconView::slotViewChanged( int i) { if (!m_views->count() ) { setCurrentView( 0l); return; } PDirView* cur = currentView(); delete cur; @@ -298,55 +315,69 @@ void PIconView::slotViewChanged( int i) { } void PIconView::slotReloadDir() { slotChangeDir( m_path ); } +/* + * add files and folders + */ void PIconView::addFolders( const QStringList& lst) { QStringList::ConstIterator it; for(it=lst.begin(); it != lst.end(); ++it ) (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); } 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) ); } +/* + * user clicked on the item. Change dir or view + */ void PIconView::slotClicked(QIconViewItem* _it) { if(!_it ) return; IconViewItem* it = static_cast<IconViewItem*>(_it); if( it->isDir() ) slotChangeDir( it->path() ); else // view image slotShowImage(); } +/* + * got thumb info add to the cache if items is visible + * we later need update after processing of slave is done + */ void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 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 ); } + +/* + * got thumbnail and see if it is visible so we need to update later + */ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 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; @@ -354,33 +385,43 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { if (pix.width()>0) PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); g_stringPix.remove( _path ); } +/* + * FIXME rename + */ void PIconView::slotRename() { } + +/* + * BEAM the current file + */ void PIconView::slotBeam() { bool isDir; QString pa = currentFileName( isDir ); if ( isDir && pa.isEmpty() ) return; Ir* ir = new Ir( this ); connect( ir, SIGNAL(done(Ir*)), this, SLOT(slotBeamDone(Ir*))); ir->send(pa, tr( "Image" ) ); } +/* + * BEAM done clean up + */ void PIconView::slotBeamDone( Ir* ir) { delete ir; } void PIconView::slotStart() { m_view->viewport()->setUpdatesEnabled( false ); } @@ -388,28 +429,26 @@ void PIconView::slotEnd() { if ( m_updatet ) m_view->arrangeItemsInGrid( ); m_view->viewport()->setUpdatesEnabled( true ); m_updatet = false; } void PIconView::slotShowImage() { - qWarning( "SLotShowImage" ); bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; slotShowImage( name ); } void PIconView::slotShowImage( const QString& name) { emit sig_display( name ); } void PIconView::slotImageInfo() { - qWarning( "SlotImageInfo" ); bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; slotImageInfo( name ); } void PIconView::slotImageInfo( const QString& name) { |