author | alwin <alwin> | 2004-04-21 20:43:51 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 20:43:51 (UTC) |
commit | 8269dfa474065b986375de7c4fd380cbda837a12 (patch) (unidiff) | |
tree | 0c73c9457032d5cf3957092a6ad1153a86eb2f29 | |
parent | 81cd1a4a916fb00b6c8867bdc1d945db155b12c0 (diff) | |
download | opie-8269dfa474065b986375de7c4fd380cbda837a12.zip opie-8269dfa474065b986375de7c4fd380cbda837a12.tar.gz opie-8269dfa474065b986375de7c4fd380cbda837a12.tar.bz2 |
some performance issues
fixed a crasher in mainwindow
-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 | 40 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 1 |
4 files changed, 28 insertions, 20 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 | |||
@@ -230,25 +230,27 @@ void PIconView::initKeys() { | |||
230 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", | 230 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", |
231 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, | 231 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, |
232 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), | 232 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), |
233 | this, SLOT(slotImageInfo()) ) ); | 233 | this, SLOT(slotImageInfo()) ) ); |
234 | m_viewManager->load(); | 234 | m_viewManager->load(); |
235 | m_viewManager->handleWidget( m_view ); | 235 | m_viewManager->handleWidget( m_view ); |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | /* | 239 | /* |
240 | * change one dir up | 240 | * change one dir up |
241 | */ | 241 | */ |
242 | void PIconView::slotDirUp() { | 242 | void PIconView::slotDirUp() |
243 | { | ||
244 | if (m_path.isEmpty()) return; | ||
243 | QDir dir( m_path ); | 245 | QDir dir( m_path ); |
244 | dir.cdUp(); | 246 | dir.cdUp(); |
245 | slotChangeDir( dir.absPath() ); | 247 | slotChangeDir( dir.absPath() ); |
246 | } | 248 | } |
247 | 249 | ||
248 | /* | 250 | /* |
249 | * change the dir | 251 | * change the dir |
250 | */ | 252 | */ |
251 | void PIconView::slotChangeDir(const QString& path) { | 253 | void PIconView::slotChangeDir(const QString& path) { |
252 | if ( !currentView() ) | 254 | if ( !currentView() ) |
253 | return; | 255 | return; |
254 | 256 | ||
@@ -571,24 +573,26 @@ void PIconView::slotImageInfo() { | |||
571 | void PIconView::slotImageInfo( const QString& name) { | 573 | void PIconView::slotImageInfo( const QString& name) { |
572 | PDirLister *lister = currentView()->dirLister(); | 574 | PDirLister *lister = currentView()->dirLister(); |
573 | QString r_name = lister->nameToFname(name); | 575 | QString r_name = lister->nameToFname(name); |
574 | emit sig_showInfo(r_name ); | 576 | emit sig_showInfo(r_name ); |
575 | } | 577 | } |
576 | 578 | ||
577 | 579 | ||
578 | void PIconView::slotChangeMode( int mode ) { | 580 | void PIconView::slotChangeMode( int mode ) { |
579 | if ( mode >= 1 && mode <= 3 ) | 581 | if ( mode >= 1 && mode <= 3 ) |
580 | m_mode = mode; | 582 | m_mode = mode; |
581 | 583 | ||
582 | m_cfg->writeEntry("ListViewMode", m_mode); | 584 | m_cfg->writeEntry("ListViewMode", m_mode); |
585 | /* performance! */ | ||
586 | m_view->clear(); | ||
583 | calculateGrid(); | 587 | calculateGrid(); |
584 | slotReloadDir(); | 588 | slotReloadDir(); |
585 | } | 589 | } |
586 | 590 | ||
587 | 591 | ||
588 | void PIconView::resizeEvent( QResizeEvent* re ) { | 592 | void PIconView::resizeEvent( QResizeEvent* re ) { |
589 | QVBox::resizeEvent( re ); | 593 | QVBox::resizeEvent( re ); |
590 | calculateGrid(); | 594 | calculateGrid(); |
591 | } | 595 | } |
592 | 596 | ||
593 | 597 | ||
594 | void PIconView::calculateGrid() { | 598 | void PIconView::calculateGrid() { |
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 | |||
@@ -215,24 +215,25 @@ void PMainWindow::slotConfig() { | |||
215 | 215 | ||
216 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 216 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
217 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 217 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
218 | lay->addWidget( wid ); | 218 | lay->addWidget( wid ); |
219 | ViewMap *vM = viewMap(); | 219 | ViewMap *vM = viewMap(); |
220 | ViewMap::Iterator _it = vM->begin(); | 220 | ViewMap::Iterator _it = vM->begin(); |
221 | QMap<PDirView*, QWidget*> lst; | 221 | QMap<PDirView*, QWidget*> lst; |
222 | 222 | ||
223 | for( ; _it != vM->end(); ++_it ) { | 223 | for( ; _it != vM->end(); ++_it ) { |
224 | PDirView *view = (_it.data())(*m_cfg); | 224 | PDirView *view = (_it.data())(*m_cfg); |
225 | PInterfaceInfo *inf = view->interfaceInfo(); | 225 | PInterfaceInfo *inf = view->interfaceInfo(); |
226 | QWidget *_wid = inf->configWidget( *m_cfg ); | 226 | QWidget *_wid = inf->configWidget( *m_cfg ); |
227 | if (!_wid) continue; | ||
227 | _wid->reparent(wid, QPoint() ); | 228 | _wid->reparent(wid, QPoint() ); |
228 | lst.insert( view, _wid ); | 229 | lst.insert( view, _wid ); |
229 | wid->addTab( _wid, "fileopen", inf->name() ); | 230 | wid->addTab( _wid, "fileopen", inf->name() ); |
230 | } | 231 | } |
231 | 232 | ||
232 | /* | 233 | /* |
233 | * Add the KeyConfigWidget | 234 | * Add the KeyConfigWidget |
234 | */ | 235 | */ |
235 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 236 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
236 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 237 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
237 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 238 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
238 | 239 | ||
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 | |||
@@ -22,62 +22,67 @@ Doc_DirLister::Doc_DirLister() | |||
22 | : PDirLister( "doc_dir_lister" ) | 22 | : PDirLister( "doc_dir_lister" ) |
23 | { | 23 | { |
24 | SlaveMaster* master = SlaveMaster::self(); | 24 | SlaveMaster* master = SlaveMaster::self(); |
25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
33 | 33 | ||
34 | m_namemap.clear(); | ||
35 | m_filemap.clear(); | ||
34 | } | 36 | } |
35 | 37 | ||
36 | QString Doc_DirLister::defaultPath()const { | 38 | QString Doc_DirLister::defaultPath()const { |
37 | return ""; QPEApplication::documentDir(); | 39 | return ""; QPEApplication::documentDir(); |
38 | } | 40 | } |
39 | 41 | ||
40 | QString Doc_DirLister::setStartPath( const QString& path ) { | 42 | QString Doc_DirLister::setStartPath(const QString&) { |
41 | m_namemap.clear(); | ||
42 | m_out.clear(); | ||
43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
44 | owarn << "Set start path" << oendl; | 44 | if (m_namemap.isEmpty()) { |
45 | DocLnkSet ds; | 45 | DocLnkSet ds; |
46 | Global::findDocuments(&ds,Mtype_str); | 46 | Global::findDocuments(&ds,Mtype_str); |
47 | QListIterator<DocLnk> dit(ds.children()); | 47 | QListIterator<DocLnk> dit(ds.children()); |
48 | for( ; dit.current(); ++dit) { | 48 | for( ; dit.current(); ++dit) { |
49 | owarn << (*dit)->file() << oendl; | 49 | owarn << (*dit)->file() << oendl; |
50 | m_namemap[(*dit)->name()]=(*dit)->file(); | 50 | m_namemap[(*dit)->name()]=(*dit)->file(); |
51 | m_filemap[(*dit)->file()]=(*dit)->name(); | 51 | m_filemap[(*dit)->file()]=(*dit)->name(); |
52 | m_out.append((*dit)->name()); | 52 | } |
53 | } | 53 | } |
54 | owarn << "Set start path end" << oendl; | 54 | return QString::null; |
55 | return ""; | ||
56 | } | 55 | } |
57 | 56 | ||
58 | QString Doc_DirLister::currentPath()const { | 57 | QString Doc_DirLister::currentPath()const { |
59 | return ""; | 58 | return QString::null; |
60 | } | 59 | } |
61 | 60 | ||
62 | 61 | ||
63 | QStringList Doc_DirLister::folders()const { | 62 | QStringList Doc_DirLister::folders()const { |
64 | return QStringList(); | 63 | return QStringList(); |
65 | } | 64 | } |
66 | 65 | ||
67 | QStringList Doc_DirLister::files()const { | 66 | QStringList Doc_DirLister::files()const { |
68 | return m_out; | 67 | QStringList out; |
68 | QMap<QString,QString>::ConstIterator it; | ||
69 | for (it = m_namemap.begin();it != m_namemap.end();++it) { | ||
70 | out.append(it.key()); | ||
71 | } | ||
72 | return out; | ||
69 | } | 73 | } |
70 | 74 | ||
71 | void Doc_DirLister::deleteImage( const QString& ) { | 75 | void Doc_DirLister::deleteImage( const QString& ) |
76 | { | ||
72 | } | 77 | } |
73 | 78 | ||
74 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | 79 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { |
75 | if (m_namemap.find(str)==m_namemap.end()) { | 80 | if (m_namemap.find(str)==m_namemap.end()) { |
76 | owarn << "Item " << str << " not found" << oendl; | 81 | owarn << "Item " << str << " not found" << oendl; |
77 | return; | 82 | return; |
78 | } | 83 | } |
79 | QString fname = m_namemap[str]; | 84 | QString fname = m_namemap[str]; |
80 | SlaveMaster::self()->thumbNail( fname, w, h ); | 85 | SlaveMaster::self()->thumbNail( fname, w, h ); |
81 | } | 86 | } |
82 | 87 | ||
83 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | 88 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { |
@@ -86,25 +91,24 @@ QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | |||
86 | return QImage(); | 91 | return QImage(); |
87 | } | 92 | } |
88 | QString fname = m_namemap[str]; | 93 | QString fname = m_namemap[str]; |
89 | return SlaveMaster::self()->image( fname, f, m ); | 94 | return SlaveMaster::self()->image( fname, f, m ); |
90 | } | 95 | } |
91 | 96 | ||
92 | void Doc_DirLister::imageInfo( const QString& str) { | 97 | void Doc_DirLister::imageInfo( const QString& str) { |
93 | if (m_namemap.find(str)==m_namemap.end()) { | 98 | if (m_namemap.find(str)==m_namemap.end()) { |
94 | owarn << "Item " << str << " not found" << oendl; | 99 | owarn << "Item " << str << " not found" << oendl; |
95 | return; | 100 | return; |
96 | } | 101 | } |
97 | QString fname = m_namemap[str]; | 102 | QString fname = m_namemap[str]; |
98 | owarn << "Image info: " << fname << oendl; | ||
99 | SlaveMaster::self()->thumbInfo( fname ); | 103 | SlaveMaster::self()->thumbInfo( fname ); |
100 | } | 104 | } |
101 | 105 | ||
102 | void Doc_DirLister::fullImageInfo( const QString& str) { | 106 | void Doc_DirLister::fullImageInfo( const QString& str) { |
103 | if (m_namemap.find(str)==m_namemap.end()) { | 107 | if (m_namemap.find(str)==m_namemap.end()) { |
104 | owarn << "Item " << str << " not found" << oendl; | 108 | owarn << "Item " << str << " not found" << oendl; |
105 | return; | 109 | return; |
106 | } | 110 | } |
107 | QString fname = m_namemap[str]; | 111 | QString fname = m_namemap[str]; |
108 | SlaveMaster::self()->imageInfo( fname ); | 112 | SlaveMaster::self()->imageInfo( fname ); |
109 | } | 113 | } |
110 | 114 | ||
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 | |||
@@ -23,20 +23,19 @@ public: | |||
23 | QStringList folders()const; | 23 | QStringList folders()const; |
24 | QStringList files()const; | 24 | QStringList files()const; |
25 | 25 | ||
26 | void deleteImage( const QString& ); | 26 | void deleteImage( const QString& ); |
27 | void thumbNail( const QString&, int, int ); | 27 | void thumbNail( const QString&, int, int ); |
28 | QImage image( const QString&, Factor, int ); | 28 | QImage image( const QString&, Factor, int ); |
29 | void imageInfo( const QString& ); | 29 | void imageInfo( const QString& ); |
30 | void fullImageInfo( const QString& ); | 30 | void fullImageInfo( const QString& ); |
31 | virtual QString nameToFname(const QString&name)const; | 31 | virtual QString nameToFname(const QString&name)const; |
32 | 32 | ||
33 | private: | 33 | private: |
34 | QMap<QString,QString> m_namemap,m_filemap; | 34 | QMap<QString,QString> m_namemap,m_filemap; |
35 | QStringList m_out; | ||
36 | protected slots: | 35 | protected slots: |
37 | virtual void slotFullInfo(const QString&, const QString&); | 36 | virtual void slotFullInfo(const QString&, const QString&); |
38 | virtual void slotThumbInfo(const QString&, const QString&); | 37 | virtual void slotThumbInfo(const QString&, const QString&); |
39 | virtual void slotThumbNail(const QString&, const QPixmap&); | 38 | virtual void slotThumbNail(const QString&, const QPixmap&); |
40 | }; | 39 | }; |
41 | 40 | ||
42 | #endif | 41 | #endif |