-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 26 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 1 |
4 files changed, 21 insertions, 13 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 087db30..77597d2 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -218,49 +218,51 @@ void PIconView::initKeys() { 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() { +void PIconView::slotDirUp() +{ + if (m_path.isEmpty()) return; 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(); @@ -559,48 +561,50 @@ void PIconView::slotShowImage( const QString& 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) { 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); + /* performance! */ + m_view->clear(); calculateGrid(); slotReloadDir(); } void PIconView::resizeEvent( QResizeEvent* re ) { QVBox::resizeEvent( re ); calculateGrid(); } void PIconView::calculateGrid() { 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; diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 058fca0..ec6b051 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -203,48 +203,49 @@ void PMainWindow::slotScaleToggled(bool how) } 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 ); + if (!_wid) continue; _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") ); diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index f695a76..73b2863 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp @@ -10,113 +10,117 @@ #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&)) ); + m_namemap.clear(); + m_filemap.clear(); } QString Doc_DirLister::defaultPath()const { return ""; QPEApplication::documentDir(); } -QString Doc_DirLister::setStartPath( const QString& path ) { - m_namemap.clear(); - m_out.clear(); +QString Doc_DirLister::setStartPath(const QString&) { static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); - owarn << "Set start path" << oendl; + if (m_namemap.isEmpty()) { 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 ""; + } + return QString::null; } QString Doc_DirLister::currentPath()const { - return ""; + return QString::null; } QStringList Doc_DirLister::folders()const { return QStringList(); } QStringList Doc_DirLister::files()const { - return m_out; + QStringList out; + QMap<QString,QString>::ConstIterator it; + for (it = m_namemap.begin();it != m_namemap.end();++it) { + out.append(it.key()); + } + return out; } -void Doc_DirLister::deleteImage( const QString& ) { +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) { diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h index d89b579..a65b616 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.h +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h @@ -11,32 +11,31 @@ #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 |