author | alwin <alwin> | 2004-11-11 00:52:25 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-11 00:52:25 (UTC) |
commit | 75c24d504700b1810c94c970e40de953bc3a4779 (patch) (unidiff) | |
tree | c55dc293a72e4f9079c8f8f1cf987f1363a751d1 | |
parent | 79060b829e9231cddc0acfe2dd2b7da3f13dfbc4 (diff) | |
download | opie-75c24d504700b1810c94c970e40de953bc3a4779.zip opie-75c24d504700b1810c94c970e40de953bc3a4779.tar.gz opie-75c24d504700b1810c94c970e40de953bc3a4779.tar.bz2 |
speed up cat selection
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 11 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index d60149f..e43baed 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -33,16 +33,17 @@ Doc_DirLister::Doc_DirLister() | |||
33 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 33 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
34 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 34 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
35 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 35 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
36 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 36 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
37 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 37 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
38 | 38 | ||
39 | m_namemap.clear(); | 39 | m_namemap.clear(); |
40 | m_filemap.clear(); | 40 | m_filemap.clear(); |
41 | m_docreads = false; | ||
41 | } | 42 | } |
42 | 43 | ||
43 | QString Doc_DirLister::defaultPath()const { | 44 | QString Doc_DirLister::defaultPath()const { |
44 | return QString::null; | 45 | return QString::null; |
45 | } | 46 | } |
46 | 47 | ||
47 | bool Doc_DirLister::matchCat(const AppLnk* app) | 48 | bool Doc_DirLister::matchCat(const AppLnk* app) |
48 | { | 49 | { |
@@ -51,21 +52,23 @@ bool Doc_DirLister::matchCat(const AppLnk* app) | |||
51 | return true; | 52 | return true; |
52 | } | 53 | } |
53 | return false; | 54 | return false; |
54 | } | 55 | } |
55 | 56 | ||
56 | QString Doc_DirLister::setStartPath(const QString&) { | 57 | QString Doc_DirLister::setStartPath(const QString&) { |
57 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 58 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
58 | if (m_namemap.isEmpty()) { | 59 | if (m_namemap.isEmpty()) { |
59 | DocLnkSet ds; | 60 | if (!m_docreads) { |
60 | Global::findDocuments(&ds,Mtype_str); | 61 | Global::findDocuments(&m_ds,Mtype_str); |
61 | QListIterator<DocLnk> dit(ds.children()); | 62 | m_docreads = true; |
63 | } | ||
64 | QListIterator<DocLnk> dit(m_ds.children()); | ||
62 | for( ; dit.current(); ++dit) { | 65 | for( ; dit.current(); ++dit) { |
63 | if (! (*dit)->isValid()) continue; | 66 | // if (! (*dit)->isValid()) continue; |
64 | if (!matchCat((*dit))) continue; | 67 | if (!matchCat((*dit))) continue; |
65 | m_namemap[(*dit)->name()]=(*dit)->file(); | 68 | m_namemap[(*dit)->name()]=(*dit)->file(); |
66 | m_filemap[(*dit)->file()]=(*dit)->name(); | 69 | m_filemap[(*dit)->file()]=(*dit)->name(); |
67 | } | 70 | } |
68 | } | 71 | } |
69 | return QString::null; | 72 | return QString::null; |
70 | } | 73 | } |
71 | 74 | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h index e148ac0..403241c 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.h +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h | |||
@@ -2,16 +2,18 @@ | |||
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H | 5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H |
6 | #define DOC_LISTER_INTERFACE_LISTER_H | 6 | #define DOC_LISTER_INTERFACE_LISTER_H |
7 | 7 | ||
8 | #include <iface/dirlister.h> | 8 | #include <iface/dirlister.h> |
9 | 9 | ||
10 | #include <qpe/applnk.h> | ||
11 | |||
10 | #include <qstring.h> | 12 | #include <qstring.h> |
11 | #include <qmap.h> | 13 | #include <qmap.h> |
12 | 14 | ||
13 | class Config; | 15 | class Config; |
14 | class AppLnk; | 16 | class AppLnk; |
15 | 17 | ||
16 | class Doc_DirLister : public PDirLister { | 18 | class Doc_DirLister : public PDirLister { |
17 | Q_OBJECT | 19 | Q_OBJECT |
@@ -33,16 +35,18 @@ public: | |||
33 | virtual QString nameToFname(const QString&name)const; | 35 | virtual QString nameToFname(const QString&name)const; |
34 | QString dirUp( const QString& )const; | 36 | QString dirUp( const QString& )const; |
35 | QWidget* widget(QWidget*parent); | 37 | QWidget* widget(QWidget*parent); |
36 | 38 | ||
37 | private: | 39 | private: |
38 | QMap<QString,QString> m_namemap,m_filemap; | 40 | QMap<QString,QString> m_namemap,m_filemap; |
39 | int m_catFilter; | 41 | int m_catFilter; |
40 | bool matchCat(const AppLnk* app); | 42 | bool matchCat(const AppLnk* app); |
43 | bool m_docreads; | ||
44 | DocLnkSet m_ds; | ||
41 | 45 | ||
42 | protected slots: | 46 | protected slots: |
43 | virtual void slotFullInfo(const QString&, const QString&); | 47 | virtual void slotFullInfo(const QString&, const QString&); |
44 | virtual void slotThumbInfo(const QString&, const QString&); | 48 | virtual void slotThumbInfo(const QString&, const QString&); |
45 | virtual void slotThumbNail(const QString&, const QPixmap&); | 49 | virtual void slotThumbNail(const QString&, const QPixmap&); |
46 | virtual void showCategory(int); | 50 | virtual void showCategory(int); |
47 | }; | 51 | }; |
48 | 52 | ||