summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index b3f0006..ed9fc9c 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -9,12 +9,13 @@
#include <iface/dirview.h>
#include <iface/dirlister.h>
#include <opie2/oconfig.h>
#include <opie2/okeyconfigwidget.h>
+#include <opie2/odebug.h>
#include <qpe/resource.h>
#include <qpe/qpemessagebox.h>
#include <qpe/ir.h>
#include <qpe/qcopenvelope_qws.h>
@@ -39,13 +40,14 @@ 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;
};
@@ -67,12 +69,16 @@ namespace {
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;
else{
if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
currentView()->dirLister()->imageInfo( m_path );
g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
@@ -87,18 +93,12 @@ namespace {
}
}
inline void IconViewItem::setText( const QString& str ) {
QString text = QIconViewItem::text()+"\n"+str;
m_noInfo = true;
QIconViewItem::setText( text );
- reCalc();
- }
-
- inline void IconViewItem::reCalc()
- {
- calcRect();
}
}
PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
: QVBox( wid ), m_cfg( cfg )
@@ -119,17 +119,16 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* 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->setGridX( viewerWidth-3*m_view->spacing());
m_view->setGridY( fontMetrics().height()*2+40 );
initKeys();
loadViews();
@@ -193,17 +192,17 @@ void PIconView::slotChangeDir(const QString& path) {
if (!lister )
return;
lister->setStartPath( path );
m_path = lister->currentPath();
- m_view->setUpdatesEnabled( false );
+ m_view->viewport()->setUpdatesEnabled( false );
m_view->clear();
addFolders( lister->folders() );
addFiles( lister->files() );
- m_view->setUpdatesEnabled( true );
+ m_view->viewport()->setUpdatesEnabled( true );
// Also invalidate the cache. We can't cancel the operations anyway
g_stringPix.clear();
g_stringInf.clear();
// looks ugly
@@ -311,28 +310,25 @@ void PIconView::slotClicked(QIconViewItem* _it) {
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 );
- 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];
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() {
@@ -354,17 +350,18 @@ void PIconView::slotBeam() {
void PIconView::slotBeamDone( Ir* ir) {
delete ir;
}
void PIconView::slotStart() {
- m_view->setUpdatesEnabled( false );
+ m_view->viewport()->setUpdatesEnabled( false );
}
void PIconView::slotEnd() {
- m_view->setUpdatesEnabled( true );
+ m_view->arrangeItemsInGrid( );
+ m_view->viewport()->setUpdatesEnabled( true );
}
void PIconView::slotShowImage() {
}
void PIconView::slotShowImage( const QString& ) {