author | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
commit | 81cd1a4a916fb00b6c8867bdc1d945db155b12c0 (patch) (unidiff) | |
tree | ce302c254c8c2160a86ffc0a5abe6cfd51fd33b3 /noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |
parent | ac414fa3802b471857bc84ecdd0d37200541b0a7 (diff) | |
download | opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.zip opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.gz opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.bz2 |
- added DocView mode
- fixed a bug in iconview and some small fixes more
Diffstat (limited to 'noncore/graphics/opie-eye/impl/doc/doc_lister.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 148 |
1 files changed, 148 insertions, 0 deletions
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 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #include "doc_lister.h" | ||
6 | |||
7 | #include <lib/slavemaster.h> | ||
8 | |||
9 | /* OPIE */ | ||
10 | #include <opie2/odebug.h> | ||
11 | #include <qpe/config.h> | ||
12 | #include <qpe/qpeapplication.h> | ||
13 | #include <qpe/applnk.h> | ||
14 | |||
15 | using namespace Opie::Core; | ||
16 | |||
17 | /* QT */ | ||
18 | #include <qdir.h> | ||
19 | #include <qfileinfo.h> | ||
20 | |||
21 | Doc_DirLister::Doc_DirLister() | ||
22 | : PDirLister( "doc_dir_lister" ) | ||
23 | { | ||
24 | SlaveMaster* master = SlaveMaster::self(); | ||
25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | ||
26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | ||
27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | ||
28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | ||
29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | ||
31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | ||
32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | ||
33 | |||
34 | } | ||
35 | |||
36 | QString Doc_DirLister::defaultPath()const { | ||
37 | return ""; QPEApplication::documentDir(); | ||
38 | } | ||
39 | |||
40 | QString Doc_DirLister::setStartPath( const QString& path ) { | ||
41 | m_namemap.clear(); | ||
42 | m_out.clear(); | ||
43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | ||
44 | owarn << "Set start path" << oendl; | ||
45 | DocLnkSet ds; | ||
46 | Global::findDocuments(&ds,Mtype_str); | ||
47 | QListIterator<DocLnk> dit(ds.children()); | ||
48 | for( ; dit.current(); ++dit) { | ||
49 | owarn << (*dit)->file() << oendl; | ||
50 | m_namemap[(*dit)->name()]=(*dit)->file(); | ||
51 | m_filemap[(*dit)->file()]=(*dit)->name(); | ||
52 | m_out.append((*dit)->name()); | ||
53 | } | ||
54 | owarn << "Set start path end" << oendl; | ||
55 | return ""; | ||
56 | } | ||
57 | |||
58 | QString Doc_DirLister::currentPath()const { | ||
59 | return ""; | ||
60 | } | ||
61 | |||
62 | |||
63 | QStringList Doc_DirLister::folders()const { | ||
64 | return QStringList(); | ||
65 | } | ||
66 | |||
67 | QStringList Doc_DirLister::files()const { | ||
68 | return m_out; | ||
69 | } | ||
70 | |||
71 | void Doc_DirLister::deleteImage( const QString& ) { | ||
72 | } | ||
73 | |||
74 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | ||
75 | if (m_namemap.find(str)==m_namemap.end()) { | ||
76 | owarn << "Item " << str << " not found" << oendl; | ||
77 | return; | ||
78 | } | ||
79 | QString fname = m_namemap[str]; | ||
80 | SlaveMaster::self()->thumbNail( fname, w, h ); | ||
81 | } | ||
82 | |||
83 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | ||
84 | if (m_namemap.find(str)==m_namemap.end()) { | ||
85 | owarn << "Item " << str << " not found" << oendl; | ||
86 | return QImage(); | ||
87 | } | ||
88 | QString fname = m_namemap[str]; | ||
89 | return SlaveMaster::self()->image( fname, f, m ); | ||
90 | } | ||
91 | |||
92 | void Doc_DirLister::imageInfo( const QString& str) { | ||
93 | if (m_namemap.find(str)==m_namemap.end()) { | ||
94 | owarn << "Item " << str << " not found" << oendl; | ||
95 | return; | ||
96 | } | ||
97 | QString fname = m_namemap[str]; | ||
98 | owarn << "Image info: " << fname << oendl; | ||
99 | SlaveMaster::self()->thumbInfo( fname ); | ||
100 | } | ||
101 | |||
102 | void Doc_DirLister::fullImageInfo( const QString& str) { | ||
103 | if (m_namemap.find(str)==m_namemap.end()) { | ||
104 | owarn << "Item " << str << " not found" << oendl; | ||
105 | return; | ||
106 | } | ||
107 | QString fname = m_namemap[str]; | ||
108 | SlaveMaster::self()->imageInfo( fname ); | ||
109 | } | ||
110 | |||
111 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | ||
112 | { | ||
113 | if (m_filemap.find(f)==m_filemap.end()) { | ||
114 | owarn << "Item " << f << " not found" << oendl; | ||
115 | return; | ||
116 | } | ||
117 | QString name = m_filemap[f]; | ||
118 | emit sig_fullInfo(name, t); | ||
119 | } | ||
120 | |||
121 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | ||
122 | { | ||
123 | if (m_filemap.find(f)==m_filemap.end()) { | ||
124 | owarn << "Item " << f << " not found" << oendl; | ||
125 | return; | ||
126 | } | ||
127 | QString name = m_filemap[f]; | ||
128 | emit sig_thumbInfo(name, t); | ||
129 | } | ||
130 | |||
131 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | ||
132 | { | ||
133 | if (m_filemap.find(f)==m_filemap.end()) { | ||
134 | owarn << "Item " << f << " not found" << oendl; | ||
135 | return; | ||
136 | } | ||
137 | QString name = m_filemap[f]; | ||
138 | emit sig_thumbNail(name, p); | ||
139 | } | ||
140 | |||
141 | QString Doc_DirLister::nameToFname(const QString&name)const | ||
142 | { | ||
143 | if (m_namemap.find(name)==m_namemap.end()) { | ||
144 | owarn << "Item " << name << " not found" << oendl; | ||
145 | return QString::null; | ||
146 | } | ||
147 | return m_namemap[name]; | ||
148 | } | ||