-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/slavemaster.cpp | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/slave/slavereciever.cpp | 7 |
3 files changed, 17 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 0b80012..38a621e 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -64,117 +64,121 @@ namespace { else if ( !isDir && !_unkPix ) _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); } inline QPixmap* IconViewItem::pixmap()const { 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)); } m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); 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 ); } } PIconView::PIconView( QWidget* wid, Config* cfg ) : QVBox( wid ), m_cfg( cfg ) { { - QCopEnvelope( "QPE/Application/opie-eye_slave", "foo()" ); +// QCopEnvelope( "QPE/Application/opie-eye_slave", "foo()" ); } 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)), 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 ); 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() { } void PIconView::slotDirUp() { QDir dir( m_path ); dir.cdUp(); slotChangeDir( dir.absPath() ); } void PIconView::slotChangeDir(const QString& path) { if ( !currentView() ) return; PDirLister *lister = currentView()->dirLister(); if (!lister ) return; lister->setStartPath( path ); m_path = lister->currentPath(); m_view->clear(); addFolders( lister->folders() ); addFiles( lister->files() ); + // 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 ) ); } 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(); return it->path(); } void PIconView::slotTrash() { bool isDir; QString pa = currentFileName( isDir ); if ( isDir && pa.isEmpty() ) return; if (!QPEMessageBox::confirmDelete( this, tr("Delete Image" ), tr("the Image %1" ).arg(pa))) return currentView()->dirLister()->deleteImage( pa ); delete m_view->currentItem(); } void PIconView::loadViews() { ViewMap::Iterator it; diff --git a/noncore/graphics/opie-eye/lib/slavemaster.cpp b/noncore/graphics/opie-eye/lib/slavemaster.cpp index 18dc883..4e28535 100644 --- a/noncore/graphics/opie-eye/lib/slavemaster.cpp +++ b/noncore/graphics/opie-eye/lib/slavemaster.cpp @@ -1,54 +1,59 @@ #include "slavemaster.h" #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qcopchannel_qws.h> #include <qtimer.h> QDataStream & operator << (QDataStream & str, bool b) { str << Q_INT8(b); return str; } QDataStream & operator >> (QDataStream & str, bool & b) { Q_INT8 l; str >> l; b = bool(l); return str; } + +/* + * ! We don't put a Pixmap in!!!! + */ QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { - return s << inf.file << inf.pixmap << inf.width << inf.height; + qWarning( "Image request is %s %d %d", inf.file.latin1(), inf.width, inf.height ); + return s << inf.file << inf.width << inf.height; } QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { s >> inf.file >> inf.pixmap >> inf.width >> inf.height; return s; } QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { return s << i.kind << i.file << i.info; } QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { s >> i.kind >> i.file >> i.info; return s; } SlaveMaster* SlaveMaster::m_master = 0; SlaveMaster::SlaveMaster() : m_started( false ) { QCopChannel *chan= new QCopChannel( "QPE/opie-eye",this ); connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(recieve(const QCString&,const QByteArray&)) ); } SlaveMaster::~SlaveMaster() { } SlaveMaster* SlaveMaster::self() { if ( !m_master ) m_master = new SlaveMaster; return m_master; diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp index 951f3df..c8e33d4 100644 --- a/noncore/graphics/opie-eye/slave/slavereciever.cpp +++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp @@ -2,66 +2,71 @@ * GPLv2 zecke@handhelds.org */ #include "slavereciever.h" #include "slaveiface.h" #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qtimer.h> static SlaveObjects* _slaveObj = 0; QDataStream & operator << (QDataStream & str, bool b) { str << Q_INT8(b); return str; } QDataStream & operator >> (QDataStream & str, bool & b) { Q_INT8 l; str >> l; b = bool(l); return str; } QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { return s << inf.file << inf.pixmap << inf.width << inf.height; } + +/* + * GUI sends no QPIxmap!!! + */ QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { - s >> inf.file >> inf.pixmap >> inf.width >> inf.height; + s >> inf.file >> inf.width >> inf.height; + qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height ); return s; } QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { return s << i.kind << i.file << i.info; } QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { s >> i.kind >> i.file >> i.info; return s; } SlaveObjects* slaveObjects() { if ( !_slaveObj ) _slaveObj = new SlaveObjects; return _slaveObj; } SlaveReciever::SlaveReciever( QObject* par) : QObject( par ) { m_inf = new QTimer(this); connect(m_inf,SIGNAL(timeout()), this, SLOT(slotImageInfo())); m_pix = new QTimer(this); connect(m_pix,SIGNAL(timeout()), this, SLOT(slotThumbNail())); m_out = new QTimer(this); connect(m_out,SIGNAL(timeout()), this, SLOT(slotSend())); |