author | zecke <zecke> | 2004-04-03 00:02:12 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-03 00:02:12 (UTC) |
commit | cc5b13ad3cd093239e004f1b92bca9f6d88073a9 (patch) (side-by-side diff) | |
tree | 0af3af7a913b12ef357d0b20764df6300aca5226 | |
parent | 02bb854283a7b0abecf3d3e9dd4c9ece0c5ef6a9 (diff) | |
download | opie-cc5b13ad3cd093239e004f1b92bca9f6d88073a9.zip opie-cc5b13ad3cd093239e004f1b92bca9f6d88073a9.tar.gz opie-cc5b13ad3cd093239e004f1b92bca9f6d88073a9.tar.bz2 |
- remove qWarning
- pixmaps for the keyboard actions
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 4a20648..f415d39 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -10,227 +10,227 @@ #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> #include <qiconview.h> #include <qlabel.h> #include <qhbox.h> #include <qcombobox.h> #include <qdir.h> #include <qapplication.h> #include <qmainwindow.h> #include <qtimer.h> #include <qstyle.h> using Opie::Ui::OKeyConfigItem; namespace { QPixmap* _dirPix = 0; QPixmap* _unkPix = 0; class IconViewItem : public QIconViewItem { 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& ); private: mutable QPixmap* m_pix; QString m_path; bool m_isDir : 1; bool m_noInfo :1; }; /* * 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, name ), m_path( path ), m_isDir( isDir ), m_noInfo( false ) { 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 ); 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, Opie::Core::OConfig* 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)), 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-3*m_view->spacing()); m_view->setGridY( fontMetrics().height()*2+40 ); initKeys(); loadViews(); slotViewChanged( m_views->currentItem() ); } PIconView::~PIconView() { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); } m_viewManager->save(); delete m_viewManager; } Opie::Ui::OKeyConfigManager* PIconView::manager() { return m_viewManager; } void PIconView::initKeys() { Opie::Ui::OKeyPair::List lst; lst.append( Opie::Ui::OKeyPair::upArrowKey() ); lst.append( Opie::Ui::OKeyPair::downArrowKey() ); lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); lst.append( Opie::Ui::OKeyPair::returnKey() ); m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", lst, false,this, "keyconfig name" ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", - QString::fromLatin1("beam"), BeamItem, + Resource::loadPixmap("beam"), BeamItem, Opie::Ui::OKeyPair(Qt::Key_B, Qt::ShiftButton), this, SLOT(slotBeam())) ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", - QString::fromLatin1("trash"), DeleteItem, + Resource::loadPixmap("trash"), DeleteItem, Opie::Ui::OKeyPair(Qt::Key_D, Qt::ShiftButton), this, SLOT(slotTrash())) ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", - QString::fromLatin1("1to1"), ViewItem, + Resource::loadPixmap("1to1"), ViewItem, Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), this, SLOT(slotShowImage()))); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", - QString::fromLatin1("DocumentTypeWord"), InfoItem, + Resource::loadPixmap("DocumentTypeWord"), InfoItem, Opie::Ui::OKeyPair(Qt::Key_I, Qt::ShiftButton ), this, SLOT(slotImageInfo()) ) ); m_viewManager->load(); m_viewManager->handleWidget( m_view ); } 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->viewport()->setUpdatesEnabled( false ); m_view->clear(); 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 ) ); } 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(); } |