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 | |||
@@ -25,55 +25,58 @@ Doc_DirLister::Doc_DirLister() | |||
25 | : PDirLister( "doc_dir_lister" ) | 25 | : PDirLister( "doc_dir_lister" ) |
26 | { | 26 | { |
27 | /* connect the signals */ | 27 | /* connect the signals */ |
28 | m_catFilter = 0; | 28 | m_catFilter = 0; |
29 | SlaveMaster* master = SlaveMaster::self(); | 29 | SlaveMaster* master = SlaveMaster::self(); |
30 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 30 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
31 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 31 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
32 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 32 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
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 | { |
49 | if (!app) return false; | 50 | if (!app) return false; |
50 | if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { | 51 | if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { |
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 | ||
72 | QString Doc_DirLister::currentPath()const { | 75 | QString Doc_DirLister::currentPath()const { |
73 | return QString::null; | 76 | return QString::null; |
74 | } | 77 | } |
75 | 78 | ||
76 | 79 | ||
77 | QStringList Doc_DirLister::folders()const { | 80 | QStringList Doc_DirLister::folders()const { |
78 | return QStringList(); | 81 | return QStringList(); |
79 | } | 82 | } |
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 | |||
@@ -1,49 +1,53 @@ | |||
1 | /* | 1 | /* |
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 |
18 | public: | 20 | public: |
19 | Doc_DirLister(); | 21 | Doc_DirLister(); |
20 | virtual ~Doc_DirLister(){} | 22 | virtual ~Doc_DirLister(){} |
21 | 23 | ||
22 | QString defaultPath()const; | 24 | QString defaultPath()const; |
23 | QString setStartPath( const QString& ); | 25 | QString setStartPath( const QString& ); |
24 | QString currentPath()const; | 26 | QString currentPath()const; |
25 | QStringList folders()const; | 27 | QStringList folders()const; |
26 | QStringList files()const; | 28 | QStringList files()const; |
27 | 29 | ||
28 | void deleteImage( const QString& ); | 30 | void deleteImage( const QString& ); |
29 | void thumbNail( const QString&, int, int ); | 31 | void thumbNail( const QString&, int, int ); |
30 | QImage image( const QString&, Factor, int ); | 32 | QImage image( const QString&, Factor, int ); |
31 | void imageInfo( const QString& ); | 33 | void imageInfo( const QString& ); |
32 | void fullImageInfo( const QString& ); | 34 | void fullImageInfo( const QString& ); |
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 | ||
49 | #endif | 53 | #endif |