author | zecke <zecke> | 2004-04-05 20:01:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-05 20:01:22 (UTC) |
commit | ecdd2845abeb5f3d00f58540e9b222799d6610e8 (patch) (side-by-side diff) | |
tree | 7199007b1dc296bb4572f2c96178d47d2f36bc02 /noncore/graphics/opie-eye/gui/iconview.cpp | |
parent | cb3097d5249b6bd576d0212394ab57e885f9e9da (diff) | |
download | opie-ecdd2845abeb5f3d00f58540e9b222799d6610e8.zip opie-ecdd2845abeb5f3d00f58540e9b222799d6610e8.tar.gz opie-ecdd2845abeb5f3d00f58540e9b222799d6610e8.tar.bz2 |
Make use of OWidgetStack
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index de2cdf0..4ced52d 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -32,15 +32,18 @@ #include <qtimer.h> #include <qstyle.h> using Opie::Ui::OKeyConfigItem; +/* + * The Icons, Request Cache and IconViewItem for the IconView + */ namespace { - QPixmap* _dirPix = 0; - QPixmap* _unkPix = 0; + static QPixmap* _dirPix = 0; + static 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; } @@ -56,14 +59,14 @@ namespace { /* * If we request an Image or String * we add it to the map */ - QMap<QString, IconViewItem*> g_stringInf; - QMap<QString, IconViewItem*> g_stringPix; + static QMap<QString, IconViewItem*> g_stringInf; + static 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 ) { @@ -98,12 +101,16 @@ namespace { m_noInfo = true; QIconViewItem::setText( text ); } } +/* + * Set up the GUI.. initialize the slave set up gui + * and also load a dir + */ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } @@ -133,24 +140,32 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) initKeys(); loadViews(); slotViewChanged( m_views->currentItem() ); } +/* + * Unref the slave and save the keyboard manager + */ PIconView::~PIconView() { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); } m_viewManager->save(); delete m_viewManager; } Opie::Ui::OKeyConfigManager* PIconView::manager() { return m_viewManager; } + +/* + * init the KeyBoard Shortcuts + * called from the c'tor + */ 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() ); @@ -175,19 +190,26 @@ void PIconView::initKeys() { Opie::Ui::OKeyPair(Qt::Key_I, Qt::ShiftButton ), this, SLOT(slotImageInfo()) ) ); m_viewManager->load(); m_viewManager->handleWidget( m_view ); } + +/* + * 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 ) @@ -281,15 +303,15 @@ void PIconView::slotReloadDir() { } void PIconView::addFolders( const QStringList& lst) { QStringList::ConstIterator it; - for(it=lst.begin(); it != lst.end(); ++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 ) @@ -302,13 +324,13 @@ void PIconView::slotClicked(QIconViewItem* _it) { return; IconViewItem* it = static_cast<IconViewItem*>(_it); if( it->isDir() ) slotChangeDir( it->path() ); else // view image - ; + slotShowImage(); } void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { IconViewItem* item = g_stringInf[_path]; if (!item ) return; @@ -357,40 +379,39 @@ void PIconView::slotBeam() { 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() { - qDebug("image show"); +void PIconView::slotShowImage() +{ + qWarning( "SLotShowImage" ); bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; - ImageDlg dlg(name); - QPEApplication::execDialog(&dlg); -} -void PIconView::slotShowImage( const QString& ) { + slotShowImage( name ); +} +void PIconView::slotShowImage( const QString& name) { + emit sig_display( name ); } void PIconView::slotImageInfo() { - qDebug("image info"); + qWarning( "SlotImageInfo" ); bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; - infoDlg dlg(name); - QPEApplication::execDialog(&dlg); + + slotImageInfo( name ); } -void PIconView::slotImageInfo( const QString& ) { - +void PIconView::slotImageInfo( const QString& name) { + emit sig_showInfo( name ); } |