-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 31 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/iface/dirlister.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | 28 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.h | 24 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | 57 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h | 21 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 148 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 42 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 8 |
13 files changed, 361 insertions, 16 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 660c4fa..087db30 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -1,617 +1,628 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #include "iconview.h" #include <lib/imagecache.h> #include <gui/imageinfoui.h> #include <iface/dirview.h> #include <iface/dirlister.h> #include <opie2/oconfig.h> #include <opie2/okeyconfigwidget.h> #include <opie2/odebug.h> #include <opie2/oimagescrollview.h> #include <qpe/resource.h> #include <qpe/qpemessagebox.h> #include <qpe/ir.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.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::Core::OKeyConfigItem; /* * The Icons, Request Cache and IconViewItem for the IconView */ namespace { static QPixmap* _dirPix = 0; static QPixmap* _unkPix = 0; static QPixmap* _picPix = 0; static QPixmap* _emptyPix = 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& ); bool textOnly()const{return m_textOnly;} void setTextOnly(bool how){m_textOnly=how;} /* just for starting recalc of item rect! */ virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); /* just for starting recalc of item rect! */ virtual void setPixmap( const QPixmap & icon); protected: mutable QPixmap* m_pix; private: QString m_path; bool m_isDir : 1; bool m_noInfo :1; bool m_textOnly:1; bool m_NameOnly:1; bool m_Pixset:1; }; class TextViewItem : public IconViewItem { TextViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); QPixmap *pixmap()const; void setText( const QString& ); }; class ThumbViewItem : public IconViewItem { ThumbViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); QPixmap *pixmap()const; void setText( const QString& ); }; /* * If we request an Image or String * we add it to the map */ 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 ),m_textOnly(false),m_Pixset(false) { if ( isDir && !_dirPix ) _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); else if ( !isDir && !_unkPix ) _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); } inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw) { m_Pixset = true; calcRect(text()); } inline void IconViewItem::setPixmap( const QPixmap & icon) { m_Pixset = true; calcRect(text()); } 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 (textOnly()&&!m_isDir) { if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); return _emptyPix; } 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 ); } } /* * 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()" ); } m_path = QDir::homeDirPath(); m_mode = 0; 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*)) ); connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), this, SLOT(slotClicked(QIconViewItem*)) ); m_view->setArrangement( QIconView::LeftToRight ); m_mode = cfg->readNumEntry("ListViewMode", 1); if (m_mode < 1 || m_mode>3) m_mode = 1; m_view->setItemTextPos( QIconView::Right ); calculateGrid(); 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::Core::OKeyConfigManager* PIconView::manager() { return m_viewManager; } /* * init the KeyBoard Shortcuts * called from the c'tor */ void PIconView::initKeys() { Opie::Core::OKeyPair::List lst; lst.append( Opie::Core::OKeyPair::upArrowKey() ); lst.append( Opie::Core::OKeyPair::downArrowKey() ); lst.append( Opie::Core::OKeyPair::leftArrowKey() ); lst.append( Opie::Core::OKeyPair::rightArrowKey() ); lst.append( Opie::Core::OKeyPair::returnKey() ); m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", lst, false,this, "keyconfig name" ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", Resource::loadPixmap("beam"), BeamItem, Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), this, SLOT(slotBeam())) ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", Resource::loadPixmap("trash"), DeleteItem, Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), this, SLOT(slotTrash())) ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", Resource::loadPixmap("1to1"), ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), this, SLOT(slotShowImage()))); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", Resource::loadPixmap("DocumentTypeWord"), InfoItem, Opie::Core::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 ) 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(); return it->path(); } QString PIconView::nextFileName(bool &isDir)const { isDir = false; QIconViewItem* _it1 = m_view->currentItem(); if ( !_it1 ) return QString::null; QIconViewItem* _it = _it1->nextItem(); if ( !_it ) return QString::null; IconViewItem* it = static_cast<IconViewItem*>( _it ); isDir = it->isDir(); return it->path(); } QString PIconView::prevFileName(bool &isDir)const{ isDir = false; QIconViewItem* _it = m_view->currentItem(); if ( !_it ) return QString::null; _it = _it->prevItem(); 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(); } /* * 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() ) ); + m_views->insertItem( 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; + if (cur) delete cur; QString str = m_views->text(i); - cur = (*(*viewMap())[str])(*m_cfg); + ViewMap* map = viewMap(); + if (!map) {setCurrentView(0l); return;} + if (map->find(str) == map->end()) { + owarn << "Key not found" << oendl; + setCurrentView(0l); return; + } + cur = (*(*map)[str])(*m_cfg); setCurrentView( cur ); /* connect to the signals of the lister */ PDirLister* lis = cur->dirLister(); connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), this, SLOT( slotThumbInfo(const QString&, const QString&))); connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), this, SLOT(slotThumbNail(const QString&, const QPixmap&))); connect(lis, SIGNAL(sig_start()), this, SLOT(slotStart())); connect(lis, SIGNAL(sig_end()) , this, SLOT(slotEnd()) ); /* reload now */ QTimer::singleShot( 0, this, SLOT(slotReloadDir())); } void PIconView::slotReloadDir() { slotChangeDir( m_path ); } /* * add files and folders */ void PIconView::addFolders( const QStringList& lst) { QStringList::ConstIterator it; IconViewItem * _iv; for(it=lst.begin(); it != lst.end(); ++it ) { _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); if (m_mode==3) _iv->setTextOnly(true); } } void PIconView::addFiles( const QStringList& lst) { QStringList::ConstIterator it; IconViewItem * _iv; QPixmap*m_pix = 0; + QString pre = ""; + if (!m_path.isEmpty()) { + pre = m_path+"/"; + } for (it=lst.begin(); it!= lst.end(); ++it ) { - m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 ); - _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); + m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); + _iv = new IconViewItem( m_view, pre+(*it), (*it) ); if (m_mode==3) { _iv->setTextOnly(true); _iv->setPixmap(QPixmap()); } else { if (m_pix) _iv->setPixmap(*m_pix); } } } /* * 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 (m_mode == 2) { 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; if (pix.width()>0) { PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); item->setPixmap(pix,true); } else { PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 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 ); } void PIconView::slotEnd() { if ( m_updatet ) m_view->arrangeItemsInGrid( ); m_view->viewport()->setUpdatesEnabled( true ); m_updatet = false; } void PIconView::slotShowNext() { bool isDir = false; QString name = nextFileName(isDir); if (name.isEmpty()) return; if (isDir) return; /* if we got a name we have a next item */ m_view->setCurrentItem(m_view->currentItem()->nextItem()); slotShowImage(name); } void PIconView::slotShowPrev() { bool isDir = false; QString name = prevFileName(isDir); if (name.isEmpty()) return; if (isDir) return; /* if we got a name we have a prev item */ m_view->setCurrentItem(m_view->currentItem()->prevItem()); slotShowImage(name); } void PIconView::slotShowImage() { bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; - slotShowImage( name ); } void PIconView::slotShowImage( const QString& name) { - emit sig_display( name ); + PDirLister *lister = currentView()->dirLister(); + QString r_name = lister->nameToFname(name); + emit sig_display( r_name ); } void PIconView::slotImageInfo() { bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; slotImageInfo( name ); } void PIconView::slotImageInfo( const QString& name) { - emit sig_showInfo( name ); + PDirLister *lister = currentView()->dirLister(); + QString r_name = lister->nameToFname(name); + emit sig_showInfo(r_name ); } void PIconView::slotChangeMode( int mode ) { if ( mode >= 1 && mode <= 3 ) m_mode = mode; m_cfg->writeEntry("ListViewMode", m_mode); calculateGrid(); slotReloadDir(); } void PIconView::resizeEvent( QResizeEvent* re ) { QVBox::resizeEvent( re ); calculateGrid(); } void PIconView::calculateGrid() { - odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; - odebug << "Size of view: " << m_view->size() << oendl; int dw = QApplication::desktop()->width(); int viewerWidth = dw-style().scrollBarExtent().width(); QIconView::ItemTextPos pos; switch( m_mode ) { case 2: pos = QIconView::Bottom; break; case 3: case 1: default: pos = QIconView::Right; break; } m_view->setItemTextPos( pos ); switch (m_mode) { case 2: m_view->setGridX(50); m_view->setGridY(20); PPixmapCache::self()->setMaxImages(40); break; case 3: m_view->setGridX( fontMetrics().width("testimage.jpg")+20); m_view->setGridY(8); PPixmapCache::self()->setMaxImages(2); break; case 1: default: m_view->setGridX( viewerWidth-3*m_view->spacing()); m_view->setGridY( fontMetrics().height()*2+40 ); PPixmapCache::self()->setMaxImages(20); break; } } diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 58f02ef..058fca0 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -1,421 +1,422 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #include "mainwindow.h" #include "imageview.h" #include "iconview.h" #include "filesystem.h" #include "imageinfoui.h" #include "viewmodebutton.h" #include <iface/ifaceinfo.h> #include <iface/dirview.h> #include <opie2/odebug.h> #include <opie2/owidgetstack.h> #include <opie2/oapplicationfactory.h> #include <opie2/otabwidget.h> #include <opie2/okeyconfigwidget.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/ir.h> #include <qpe/applnk.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qdialog.h> #include <qmap.h> #include <qtimer.h> #include <qframe.h> -OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) +//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) +OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) { setCaption( QObject::tr("Opie Eye Caramba" ) ); m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("Zecke_view" ); tFrame = 0; // qDebug( "Process-wide OApplication object @ %0x", oApp ); /* * Initialize ToolBar and IconView * And Connect Them */ QToolBar *bar = new QToolBar( this ); bar->setHorizontalStretchable( true ); setToolBarsMovable( false ); m_stack = new Opie::Ui::OWidgetStack( this ); setCentralWidget( m_stack ); m_view = new PIconView( m_stack, m_cfg ); m_stack->addWidget( m_view, IconView ); m_stack->raiseWidget( IconView ); connect(m_view, SIGNAL(sig_display(const QString&)), this, SLOT(slotDisplay(const QString&))); connect(m_view, SIGNAL(sig_showInfo(const QString&)), this, SLOT(slotShowInfo(const QString&)) ); m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); upButton = new QToolButton( bar ); upButton->setIconSet( Resource::loadIconSet( "up" ) ); connect( upButton, SIGNAL(clicked()), m_view, SLOT(slotDirUp()) ); fsButton = new PFileSystem( bar ); connect( fsButton, SIGNAL( changeDir( const QString& ) ), m_view, SLOT(slotChangeDir( const QString& ) ) ); QToolButton*btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "edit" ) ); connect( btn, SIGNAL(clicked()), m_view, SLOT(slotRename()) ); if ( Ir::supported() ) { btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "beam" ) ); connect( btn, SIGNAL(clicked()), m_view, SLOT(slotBeam()) ); } btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "trash" ) ); connect( btn, SIGNAL(clicked() ), m_view, SLOT(slotTrash() ) ); int mode = m_cfg->readNumEntry("ListViewMode", 1); if (mode < 1 || mode>3) mode = 1; viewModeButton = new ViewModeButton( bar,mode ); connect( viewModeButton, SIGNAL(changeMode(int)), m_view, SLOT(slotChangeMode(int))); btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); connect( btn, SIGNAL(clicked() ), this, SLOT(slotConfig() ) ); prevButton = new QToolButton(bar); prevButton->setIconSet( Resource::loadIconSet( "back" ) ); connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); nextButton = new QToolButton(bar); nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); rotateButton = new QToolButton(bar); rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); rotateButton->setToggleButton(true); if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { rotateButton->setOn(true); autoRotate = true; prevButton->hide(); nextButton->hide(); } else { rotateButton->setOn(false); autoRotate = false; } connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); scaleButton = new QToolButton(bar); scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); scaleButton->setToggleButton(true); scaleButton->setOn(false); connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); autoScale = true; zoomButton = new QToolButton(bar); zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); zoomButton->setToggleButton(true); zoomButton->setOn(true); connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); zoomerOn = true; } PMainWindow::~PMainWindow() { odebug << "Shutting down" << oendl; if (tFrame) delete tFrame; odebug << "Shutting down done" << oendl; } void PMainWindow::slotToggleZoomer() { if (!m_disp) return; bool cur = zoomButton->isOn(); zoomButton->setOn(!cur); } void PMainWindow::slotZoomerToggled(bool how) { zoomerOn = how; if (m_disp) { m_disp->setShowZoomer(zoomerOn); } } void PMainWindow::slotToggleAutorotate() { if (!m_disp) return; if (!rotateButton->isEnabled()) return; bool cur = rotateButton->isOn(); rotateButton->setOn(!cur); } void PMainWindow::slotToggleAutoscale() { if (!m_disp) return; bool cur = scaleButton->isOn(); scaleButton->setOn(!cur); } void PMainWindow::slotRotateToggled(bool how) { autoRotate = how; if (m_disp) { m_disp->setAutoRotate(how); } } void PMainWindow::slotScaleToggled(bool how) { autoScale = !how; if (!how) { autoRotate = how; } if (m_disp) { m_disp->setAutoScaleRotate(autoScale,autoRotate); } if (!autoScale) { rotateButton->setOn(false); } rotateButton->setEnabled(!how); } void PMainWindow::slotConfig() { /* * have a tab with the possible views * a tab for globals image cache size.. scaled loading * and one tab for the KeyConfigs */ QDialog dlg(this, 0, true); dlg.setCaption( tr("Phunk View - Config" ) ); QHBoxLayout *lay = new QHBoxLayout(&dlg); Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); lay->addWidget( wid ); ViewMap *vM = viewMap(); ViewMap::Iterator _it = vM->begin(); QMap<PDirView*, QWidget*> lst; for( ; _it != vM->end(); ++_it ) { PDirView *view = (_it.data())(*m_cfg); PInterfaceInfo *inf = view->interfaceInfo(); QWidget *_wid = inf->configWidget( *m_cfg ); _wid->reparent(wid, QPoint() ); lst.insert( view, _wid ); wid->addTab( _wid, "fileopen", inf->name() ); } /* * Add the KeyConfigWidget */ Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); if ( !m_info ) { initInfo(); } keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); if ( !m_disp ) { initDisp(); } keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); keyWid->load(); wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); /* * clean up *apply changes */ QMap<PDirView*, QWidget*>::Iterator it; for ( it = lst.begin(); it != lst.end(); ++it ) { if ( act ) it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); delete it.key(); } if ( act ) { m_view->resetView(); keyWid->save(); m_disp->manager()->save(); m_info->manager()->save(); m_view->manager()->save(); } delete keyWid; } /* * create a new image info component * and detach the current one * we will make the other delete on exit */ template<class T> void PMainWindow::initT( const char* name, T** ptr, int id) { if ( *ptr ) { (*ptr)->disconnect(this, SLOT(slotReturn())); (*ptr)->setDestructiveClose(); m_stack->removeWidget( *ptr ); } *ptr = new T(m_cfg, m_stack, name ); m_stack->addWidget( *ptr, id ); connect(*ptr, SIGNAL(sig_return()), this,SLOT(slotReturn())); } void PMainWindow::initInfo() { initT<imageinfo>( "Image Info", &m_info, ImageInfo ); connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); } void PMainWindow::initDisp() { initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); if (m_disp) { if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_disp->setMinimumSize(QApplication::desktop()->size()/2); } m_disp->setAutoScale(autoScale); m_disp->setAutoRotate(autoRotate); m_disp->setShowZoomer(zoomerOn); m_disp->setBackgroundColor(white); connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); } } void PMainWindow::slotToggleFullScreen() { odebug << "Toggle full " << oendl; if (!m_disp) return; bool current = !m_disp->fullScreen(); m_disp->setFullScreen(current); odebug << "Current = " << current << oendl; if (current) { odebug << "full" << oendl; m_disp->setBackgroundColor(black); if (!tFrame) { tFrame = new QWidget(0,0,WStyle_Customize|WStyle_NoBorder); tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height()); } m_disp->reparent(tFrame,QPoint(0,0)); m_disp->setVScrollBarMode(QScrollView::AlwaysOff); m_disp->setHScrollBarMode(QScrollView::AlwaysOff); m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); tFrame->showFullScreen(); } else { setUpdatesEnabled(false); odebug << "window" << oendl; m_disp->reparent(0,QPoint(0,0)); m_disp->showNormal(); /* don't forget it! */ tFrame->hide(); m_disp->setBackgroundColor(white); m_stack->addWidget(m_disp,ImageDisplay); m_disp->setVScrollBarMode(QScrollView::Auto); m_disp->setHScrollBarMode(QScrollView::Auto); m_stack->raiseWidget(m_disp); if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_disp->resize(m_disp->minimumSize()); } setUpdatesEnabled(true); } } /** * With big Screen the plan could be to 'detach' the image * window if visible and to create a ne wone * init* already supports it but I make no use of it for * now. We set filename and raise * * ### FIXME and talk to alwin */ void PMainWindow::slotShowInfo( const QString& inf ) { if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { return; } if ( !m_info ) { initInfo(); } m_info->setPath( inf ); if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { prevButton->hide(); nextButton->hide(); upButton->hide(); fsButton->hide(); viewModeButton->hide(); } m_stack->raiseWidget( ImageInfo ); } void PMainWindow::slotDisplay( const QString& inf ) { if ( !m_disp ) { initDisp(); } m_disp->setImage( inf ); if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { prevButton->show(); nextButton->show(); upButton->hide(); fsButton->hide(); viewModeButton->hide(); } if (m_disp->fullScreen()) { tFrame->setActiveWindow(); tFrame->showFullScreen(); } else { m_stack->raiseWidget( ImageDisplay ); } } void PMainWindow::slotReturn() { raiseIconView(); } void PMainWindow::closeEvent( QCloseEvent* ev ) { /* * return from view * or properly quit */ if ( m_stack->visibleWidget() == m_info || m_stack->visibleWidget() == m_disp ) { ev->ignore(); raiseIconView(); return; } diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h index fcc55ec..9c7b2a9 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.h +++ b/noncore/graphics/opie-eye/iface/dirlister.h @@ -1,47 +1,48 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #ifndef PHUNK_DIR_LISTER_H #define PHUNK_DIR_LISTER_H #include <qobject.h> #include <qstring.h> #include <qstringlist.h> class PDirLister : public QObject { Q_OBJECT public: enum Factor { Width, Height, None }; PDirLister( const char* name ); virtual QString defaultPath()const = 0; virtual QString setStartPath( const QString& ) = 0; virtual QString currentPath()const = 0; virtual QStringList folders()const = 0; virtual QStringList files()const = 0; public slots: virtual void deleteImage( const QString& ) = 0; virtual void imageInfo( const QString&) = 0; virtual void fullImageInfo( const QString& ) = 0; virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; virtual QImage image( const QString&, Factor, int max = 0) = 0; + virtual QString nameToFname(const QString&name)const = 0; signals: void sig_dirchanged(); void sig_filechanged(); void sig_start(); void sig_end(); // If this app ever happens to get multithreaded... void sig_thumbInfo( const QString&, const QString& ); void sig_fullInfo( const QString&, const QString& ); void sig_thumbNail( const QString&, const QPixmap& ); protected: - ~PDirLister(); + virtual ~PDirLister(); }; #endif diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h index 8c6262f..c919dde 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h @@ -1,21 +1,21 @@ /* * GPLv2 * zecke@handhelds.org */ #ifndef DIR_IFACE_INFO_H #define DIR_IFACE_INFO_H -#include <iface/ifaceinfo.h>s +#include <iface/ifaceinfo.h> class DirInterfaceInfo : public PInterfaceInfo { public: DirInterfaceInfo(); - ~DirInterfaceInfo(); + virtual ~DirInterfaceInfo(); QString name()const; QWidget* configWidget(const Config&); void writeConfig( QWidget* wid, Config& ); }; #endif diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index 16758d7..3717297 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp @@ -1,97 +1,102 @@ /* * GPLv2 zecke@handhelds.org */ #include "dir_lister.h" #include <lib/slavemaster.h> /* OPIE */ #include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> using namespace Opie::Core; /* QT */ #include <qdir.h> #include <qfileinfo.h> Dir_DirLister::Dir_DirLister( bool list ) : PDirLister( "dir_dir_lister" ) { m_allFiles = list; owarn << "All Files " << m_allFiles << "" << oendl; SlaveMaster* master = SlaveMaster::self(); connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); } QString Dir_DirLister::defaultPath()const { return QPEApplication::documentDir(); } QString Dir_DirLister::setStartPath( const QString& path ) { m_currentDir.cd( path ); if (!m_currentDir.exists() ) m_currentDir.cd(defaultPath()); return m_currentDir.absPath(); } QString Dir_DirLister::currentPath()const { return m_currentDir.absPath(); } QStringList Dir_DirLister::folders()const { return m_currentDir.entryList( QDir::Dirs ); } QStringList Dir_DirLister::files()const { if ( m_allFiles ) return m_currentDir.entryList( QDir::Files ); else { QStringList out; QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { QFileInfo inf( *it ); QString ext = inf.extension(false).lower(); if( ext == QString::fromLatin1("jpg") || ext == QString::fromLatin1("jpeg" ) || ext == QString::fromLatin1("png" ) || ext == QString::fromLatin1("bmp" ) || ext == QString::fromLatin1("gif" ) ) out.append( *it ); } return out; } } void Dir_DirLister::deleteImage( const QString& fl) { QFile::remove( fl ); } void Dir_DirLister::thumbNail( const QString& str, int w, int h) { SlaveMaster::self()->thumbNail( str, w, h ); } QImage Dir_DirLister::image( const QString& str, Factor f, int m) { return SlaveMaster::self()->image( str, f, m ); } void Dir_DirLister::imageInfo( const QString& str) { SlaveMaster::self()->thumbInfo( str ); } void Dir_DirLister::fullImageInfo( const QString& str) { SlaveMaster::self()->imageInfo( str ); } + +QString Dir_DirLister::nameToFname(const QString&name)const +{ + return name; +} diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.h b/noncore/graphics/opie-eye/impl/dir/dir_lister.h index fc63bb0..d6ca6c0 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.h +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.h @@ -1,34 +1,37 @@ /* * GPLv2 zecke@handhelds.org */ #ifndef DIR_LISTER_INTERFACE_LISTER_H #define DIR_LISTER_INTERFACE_LISTER_H #include <qdir.h> #include <iface/dirlister.h> class Config; class Dir_DirLister : public PDirLister { + Q_OBJECT public: Dir_DirLister( bool ); + virtual ~Dir_DirLister(){} QString defaultPath()const; QString setStartPath( const QString& ); QString currentPath()const; QStringList folders()const; QStringList files()const; void deleteImage( const QString& ); void thumbNail( const QString&, int, int ); QImage image( const QString&, Factor, int ); void imageInfo( const QString& ); void fullImageInfo( const QString& ); + virtual QString nameToFname(const QString&name)const; private: bool m_allFiles; QDir m_currentDir; }; #endif diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp new file mode 100644 index 0000000..0d6e25f --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp @@ -0,0 +1,28 @@ +#include "doc_lister.h" +#include "doc_ifaceinfo.h" +#include "doc_dirview.h" + +PHUNK_VIEW_INTERFACE("Document View", Doc_DirView ); + + +Doc_DirView::Doc_DirView( const Config& cfg) + : PDirView(cfg) +{ + m_lister = 0; + m_info = 0; +} + +Doc_DirView::~Doc_DirView() { +} + +PInterfaceInfo* Doc_DirView::interfaceInfo()const{ + if (!m_info ) + m_info =new DocInterfaceInfo; + return m_info; +} + +PDirLister* Doc_DirView::dirLister()const{ + if (!m_lister ) + m_lister = new Doc_DirLister(); + return m_lister; +} diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.h b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h new file mode 100644 index 0000000..3a2fd71 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h @@ -0,0 +1,24 @@ +/* + * GPLv2 only zecke@handhelds.org + */ + +#ifndef DOC_DIR_VIEW_H +#define DOC_DIR_VIEW_H + +#include <iface/dirview.h> + + +struct Doc_DirView : public PDirView { + Doc_DirView( const Config& ); + ~Doc_DirView(); + + PInterfaceInfo* interfaceInfo()const; + PDirLister* dirLister()const; +private: + bool m_cfg : 1; + mutable PDirLister* m_lister; + mutable PInterfaceInfo *m_info; +}; + + +#endif diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp new file mode 100644 index 0000000..a6d6f3c --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp @@ -0,0 +1,57 @@ +/* + * GPLv2 + * zecke@handhelds.org + */ + +#include "doc_ifaceinfo.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; + +/* QT */ +#include <qwidget.h> +#include <qcheckbox.h> +#include <qhbox.h> +#include <qlabel.h> + +#if 0 +namespace { + class DirImageWidget : public QHBox { + public: + DirImageWidget() { + chkbox = new QCheckBox( QObject::tr("Show all files"), this ); + } + ~DirImageWidget() {} + QCheckBox* chkbox; + }; +} +#endif + +DocInterfaceInfo::DocInterfaceInfo() { +} +DocInterfaceInfo::~DocInterfaceInfo() { +} + +QString DocInterfaceInfo::name()const { + return QString::fromLatin1(QObject::tr("DocView" )); +} + +QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { +#if 0 + DirImageWidget* wid = new DirImageWidget(); + wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); + + return wid; +#endif + return 0L; +} + +void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { +#if 0 + owarn << "Write Config" << oendl; + DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); + cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); +#endif +} diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h new file mode 100644 index 0000000..73986c9 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h @@ -0,0 +1,21 @@ +/* + * GPLv2 + * zecke@handhelds.org + */ + +#ifndef DOC_IFACE_INFO_H +#define DOC_IFACE_INFO_H + +#include <iface/ifaceinfo.h> + +class DocInterfaceInfo : public PInterfaceInfo { +public: + DocInterfaceInfo(); + virtual ~DocInterfaceInfo(); + + QString name()const; + QWidget* configWidget(const Config&); + void writeConfig( QWidget* wid, Config& ); +}; + +#endif diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp new file mode 100644 index 0000000..f695a76 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp @@ -0,0 +1,148 @@ +/* + * GPLv2 zecke@handhelds.org + */ + +#include "doc_lister.h" + +#include <lib/slavemaster.h> + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +#include <qpe/qpeapplication.h> +#include <qpe/applnk.h> + +using namespace Opie::Core; + +/* QT */ +#include <qdir.h> +#include <qfileinfo.h> + +Doc_DirLister::Doc_DirLister() + : PDirLister( "doc_dir_lister" ) +{ + SlaveMaster* master = SlaveMaster::self(); + connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); + connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); + connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), + this, SLOT(slotThumbInfo(const QString&, const QString&)) ); + connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), + this, SLOT(slotFullInfo(const QString&, const QString&)) ); + connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), + this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); + +} + +QString Doc_DirLister::defaultPath()const { + return ""; QPEApplication::documentDir(); +} + +QString Doc_DirLister::setStartPath( const QString& path ) { + m_namemap.clear(); + m_out.clear(); + static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); + owarn << "Set start path" << oendl; + DocLnkSet ds; + Global::findDocuments(&ds,Mtype_str); + QListIterator<DocLnk> dit(ds.children()); + for( ; dit.current(); ++dit) { + owarn << (*dit)->file() << oendl; + m_namemap[(*dit)->name()]=(*dit)->file(); + m_filemap[(*dit)->file()]=(*dit)->name(); + m_out.append((*dit)->name()); + } + owarn << "Set start path end" << oendl; + return ""; +} + +QString Doc_DirLister::currentPath()const { + return ""; +} + + +QStringList Doc_DirLister::folders()const { + return QStringList(); +} + +QStringList Doc_DirLister::files()const { + return m_out; +} + +void Doc_DirLister::deleteImage( const QString& ) { +} + +void Doc_DirLister::thumbNail( const QString& str, int w, int h) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return; + } + QString fname = m_namemap[str]; + SlaveMaster::self()->thumbNail( fname, w, h ); +} + +QImage Doc_DirLister::image( const QString& str, Factor f, int m) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return QImage(); + } + QString fname = m_namemap[str]; + return SlaveMaster::self()->image( fname, f, m ); +} + +void Doc_DirLister::imageInfo( const QString& str) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return; + } + QString fname = m_namemap[str]; + owarn << "Image info: " << fname << oendl; + SlaveMaster::self()->thumbInfo( fname ); +} + +void Doc_DirLister::fullImageInfo( const QString& str) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return; + } + QString fname = m_namemap[str]; + SlaveMaster::self()->imageInfo( fname ); +} + +void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) +{ + if (m_filemap.find(f)==m_filemap.end()) { + owarn << "Item " << f << " not found" << oendl; + return; + } + QString name = m_filemap[f]; + emit sig_fullInfo(name, t); +} + +void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) +{ + if (m_filemap.find(f)==m_filemap.end()) { + owarn << "Item " << f << " not found" << oendl; + return; + } + QString name = m_filemap[f]; + emit sig_thumbInfo(name, t); +} + +void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) +{ + if (m_filemap.find(f)==m_filemap.end()) { + owarn << "Item " << f << " not found" << oendl; + return; + } + QString name = m_filemap[f]; + emit sig_thumbNail(name, p); +} + +QString Doc_DirLister::nameToFname(const QString&name)const +{ + if (m_namemap.find(name)==m_namemap.end()) { + owarn << "Item " << name << " not found" << oendl; + return QString::null; + } + return m_namemap[name]; +} diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h new file mode 100644 index 0000000..d89b579 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h @@ -0,0 +1,42 @@ +/* + * GPLv2 zecke@handhelds.org + */ + +#ifndef DOC_LISTER_INTERFACE_LISTER_H +#define DOC_LISTER_INTERFACE_LISTER_H + +#include <iface/dirlister.h> + +#include <qstring.h> +#include <qmap.h> + +class Config; +class Doc_DirLister : public PDirLister { + Q_OBJECT +public: + Doc_DirLister(); + virtual ~Doc_DirLister(){} + + QString defaultPath()const; + QString setStartPath( const QString& ); + QString currentPath()const; + QStringList folders()const; + QStringList files()const; + + void deleteImage( const QString& ); + void thumbNail( const QString&, int, int ); + QImage image( const QString&, Factor, int ); + void imageInfo( const QString& ); + void fullImageInfo( const QString& ); + virtual QString nameToFname(const QString&name)const; + +private: + QMap<QString,QString> m_namemap,m_filemap; + QStringList m_out; +protected slots: + virtual void slotFullInfo(const QString&, const QString&); + virtual void slotThumbInfo(const QString&, const QString&); + virtual void slotThumbNail(const QString&, const QPixmap&); +}; + +#endif diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 57e69b6..0a57a0f 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro @@ -1,40 +1,44 @@ CONFIG += qt warn_on quick-app DESTDIR = $(OPIEDIR)/bin TEMPLATE = app TARGET = opie-eye # the name of the resulting object HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ lib/imagecache.h impl/dir/dir_dirview.h \ iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ lib/slavemaster.h \ iface/slaveiface.h \ gui/imageinfoui.h \ gui/imageview.h \ - gui/viewmodebutton.h + gui/viewmodebutton.h \ + impl/doc/doc_lister.h impl/doc/doc_dirview.h \ + impl/doc/doc_ifaceinfo.h # A list header files SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ lib/imagecache.cpp lib/viewmap.cpp \ impl/dir/dir_dirview.cpp iface/dirlister.cpp \ iface/dirview.cpp impl/dir/dir_lister.cpp \ impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ gui/imageinfoui.cpp \ gui/imageview.cpp \ - gui/viewmodebutton.cpp + gui/viewmodebutton.cpp \ + impl/doc/doc_lister.cpp impl/doc/doc_dirview.cpp \ + impl/doc/doc_ifaceinfo.cpp # A list of source files INTERFACES = # list of ui files INCLUDEPATH += . $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 -lopiemm2 include ( $(OPIEDIR)/include.pro ) |