author | zecke <zecke> | 2004-08-27 22:22:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-27 22:22:44 (UTC) |
commit | 7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac (patch) (unidiff) | |
tree | 1d189e90585190465233a67c7c9a2a740cb1d98a | |
parent | a6e7ebcee38719a9f33ede08ed4c8a364c2ecb20 (diff) | |
download | opie-7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac.zip opie-7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac.tar.gz opie-7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac.tar.bz2 |
-Removal of debug messages
-Cleanups of .pro files
-Cleanups of source code
And finally the long awaited DigiCam (dcim) Backend
25 files changed, 487 insertions, 72 deletions
diff --git a/noncore/graphics/opie-eye/.cvsignore b/noncore/graphics/opie-eye/.cvsignore new file mode 100644 index 0000000..52494fb --- a/dev/null +++ b/noncore/graphics/opie-eye/.cvsignore | |||
@@ -0,0 +1,2 @@ | |||
1 | Makefile | ||
2 | *.moc | ||
diff --git a/noncore/graphics/opie-eye/gui/gui.pro b/noncore/graphics/opie-eye/gui/gui.pro new file mode 100644 index 0000000..b9f0bf8 --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/gui.pro | |||
@@ -0,0 +1,15 @@ | |||
1 | HEADERS += gui/filesystem.h \ | ||
2 | gui/iconview.h \ | ||
3 | gui/imageinfoui.h \ | ||
4 | gui/imageview.h \ | ||
5 | gui/mainwindow.h \ | ||
6 | gui/viewmodebutton.h | ||
7 | |||
8 | SOURCES += gui/filesystem.cpp \ | ||
9 | gui/iconview.cpp \ | ||
10 | gui/imageinfoui.cpp \ | ||
11 | gui/imageview.cpp \ | ||
12 | gui/mainwindow.cpp \ | ||
13 | gui/viewmodebutton.cpp | ||
14 | |||
15 | |||
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 652acc9..7196aba 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -1,500 +1,503 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "iconview.h" | 6 | #include "iconview.h" |
7 | 7 | ||
8 | #include <lib/imagecache.h> | 8 | #include <lib/imagecache.h> |
9 | #include <gui/imageinfoui.h> | 9 | #include <gui/imageinfoui.h> |
10 | 10 | ||
11 | #include <iface/dirview.h> | 11 | #include <iface/dirview.h> |
12 | #include <iface/dirlister.h> | 12 | #include <iface/dirlister.h> |
13 | 13 | ||
14 | #include <opie2/oconfig.h> | 14 | #include <opie2/oconfig.h> |
15 | #include <opie2/okeyconfigwidget.h> | 15 | #include <opie2/okeyconfigwidget.h> |
16 | #include <opie2/odebug.h> | 16 | #include <opie2/odebug.h> |
17 | #include <opie2/oimagescrollview.h> | 17 | #include <opie2/oimagescrollview.h> |
18 | 18 | ||
19 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
20 | #include <qpe/qpemessagebox.h> | 20 | #include <qpe/qpemessagebox.h> |
21 | #include <qpe/ir.h> | 21 | #include <qpe/ir.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | 24 | ||
25 | #include <qiconview.h> | 25 | #include <qiconview.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qhbox.h> | 27 | #include <qhbox.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | #include <qmainwindow.h> | 31 | #include <qmainwindow.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qstyle.h> | 33 | #include <qstyle.h> |
34 | 34 | ||
35 | 35 | ||
36 | using Opie::Core::OKeyConfigItem; | 36 | using Opie::Core::OKeyConfigItem; |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * The Icons, Request Cache and IconViewItem for the IconView | 39 | * The Icons, Request Cache and IconViewItem for the IconView |
40 | */ | 40 | */ |
41 | namespace { | 41 | namespace { |
42 | static QPixmap* _dirPix = 0; | 42 | static QPixmap* _dirPix = 0; |
43 | static QPixmap* _unkPix = 0; | 43 | static QPixmap* _unkPix = 0; |
44 | static QPixmap* _picPix = 0; | ||
45 | static QPixmap* _emptyPix = 0; | 44 | static QPixmap* _emptyPix = 0; |
46 | class IconViewItem : public QIconViewItem { | 45 | class IconViewItem : public QIconViewItem { |
47 | public: | 46 | public: |
48 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); | 47 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); |
49 | QPixmap* pixmap()const; | 48 | QPixmap* pixmap()const; |
50 | QString path()const { return m_path; } | 49 | QString path()const { return m_path; } |
51 | bool isDir()const { return m_isDir; } | 50 | bool isDir()const { return m_isDir; } |
52 | void setText( const QString& ); | 51 | void setText( const QString& ); |
53 | bool textOnly()const{return m_textOnly;} | 52 | bool textOnly()const{return m_textOnly;} |
54 | void setTextOnly(bool how){m_textOnly=how;} | 53 | void setTextOnly(bool how){m_textOnly=how;} |
55 | /* just for starting recalc of item rect! */ | 54 | /* just for starting recalc of item rect! */ |
56 | virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); | 55 | virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); |
57 | /* just for starting recalc of item rect! */ | 56 | /* just for starting recalc of item rect! */ |
58 | virtual void setPixmap( const QPixmap & icon); | 57 | virtual void setPixmap( const QPixmap & icon); |
59 | 58 | ||
60 | protected: | 59 | protected: |
61 | mutable QPixmap* m_pix; | 60 | mutable QPixmap* m_pix; |
62 | 61 | ||
63 | private: | 62 | private: |
64 | QString m_path; | 63 | QString m_path; |
65 | bool m_isDir : 1; | 64 | bool m_isDir : 1; |
66 | bool m_noInfo :1; | 65 | bool m_noInfo :1; |
67 | bool m_textOnly:1; | 66 | bool m_textOnly:1; |
68 | bool m_NameOnly:1; | 67 | bool m_NameOnly:1; |
69 | bool m_Pixset:1; | 68 | bool m_Pixset:1; |
70 | }; | 69 | }; |
71 | class TextViewItem : public IconViewItem { | 70 | class TextViewItem : public IconViewItem { |
72 | TextViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); | 71 | TextViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); |
73 | QPixmap *pixmap()const; | 72 | QPixmap *pixmap()const; |
74 | void setText( const QString& ); | 73 | void setText( const QString& ); |
75 | }; | 74 | }; |
76 | class ThumbViewItem : public IconViewItem { | 75 | class ThumbViewItem : public IconViewItem { |
77 | ThumbViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); | 76 | ThumbViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); |
78 | QPixmap *pixmap()const; | 77 | QPixmap *pixmap()const; |
79 | void setText( const QString& ); | 78 | void setText( const QString& ); |
80 | }; | 79 | }; |
81 | 80 | ||
82 | 81 | ||
83 | /* | 82 | /* |
84 | * If we request an Image or String | 83 | * If we request an Image or String |
85 | * we add it to the map | 84 | * we add it to the map |
86 | */ | 85 | */ |
87 | static QMap<QString, IconViewItem*> g_stringInf; | 86 | static QMap<QString, IconViewItem*> g_stringInf; |
88 | static QMap<QString, IconViewItem*> g_stringPix; | 87 | static QMap<QString, IconViewItem*> g_stringPix; |
89 | 88 | ||
90 | IconViewItem::IconViewItem( QIconView* view,const QString& path, | 89 | IconViewItem::IconViewItem( QIconView* view,const QString& path, |
91 | const QString& name, bool isDir ) | 90 | const QString& name, bool isDir ) |
92 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), | 91 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), |
93 | m_noInfo( false ),m_textOnly(false),m_Pixset(false) | 92 | m_noInfo( false ),m_textOnly(false),m_Pixset(false) |
94 | { | 93 | { |
95 | if ( isDir && !_dirPix ) | 94 | if ( isDir && !_dirPix ) |
96 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); | 95 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); |
97 | else if ( !isDir && !_unkPix ) | 96 | else if ( !isDir && !_unkPix ) |
98 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); | 97 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); |
99 | } | 98 | } |
100 | 99 | ||
101 | inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw) | 100 | inline void IconViewItem::setPixmap( const QPixmap & , bool, bool ) |
102 | { | 101 | { |
103 | m_Pixset = true; | 102 | m_Pixset = true; |
104 | calcRect(text()); | 103 | calcRect(text()); |
105 | } | 104 | } |
106 | inline void IconViewItem::setPixmap( const QPixmap & icon) | 105 | inline void IconViewItem::setPixmap( const QPixmap & ) |
107 | { | 106 | { |
108 | m_Pixset = true; | 107 | m_Pixset = true; |
109 | calcRect(text()); | 108 | calcRect(text()); |
110 | } | 109 | } |
111 | 110 | ||
112 | inline QPixmap* IconViewItem::pixmap()const { | 111 | inline QPixmap* IconViewItem::pixmap()const { |
113 | // owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() | 112 | // owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() |
114 | // << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() | 113 | // << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() |
115 | // << " " << iconView()->contentsY() << oendl; | 114 | // << " " << iconView()->contentsY() << oendl; |
116 | 115 | ||
117 | if (textOnly()&&!m_isDir) { | 116 | if (textOnly()&&!m_isDir) { |
118 | if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); | 117 | if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); |
119 | return _emptyPix; | 118 | return _emptyPix; |
120 | } | 119 | } |
121 | if ( m_isDir ) | 120 | if ( m_isDir ) |
122 | return _dirPix; | 121 | return _dirPix; |
123 | else{ | 122 | else{ |
124 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { | 123 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { |
125 | currentView()->dirLister()->imageInfo( m_path ); | 124 | currentView()->dirLister()->imageInfo( m_path ); |
126 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); | 125 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); |
127 | } | 126 | } |
128 | 127 | ||
129 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); | 128 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); |
130 | if (!m_pix && !g_stringPix.contains( m_path )) { | 129 | if (!m_pix && !g_stringPix.contains( m_path )) { |
131 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); | 130 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); |
132 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); | 131 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); |
133 | } | 132 | } |
134 | return m_pix ? m_pix : _unkPix; | 133 | return m_pix ? m_pix : _unkPix; |
135 | } | 134 | } |
136 | } | 135 | } |
137 | inline void IconViewItem::setText( const QString& str ) { | 136 | inline void IconViewItem::setText( const QString& str ) { |
138 | QString text = QIconViewItem::text()+"\n"+str; | 137 | QString text = QIconViewItem::text()+"\n"+str; |
139 | m_noInfo = true; | 138 | m_noInfo = true; |
140 | QIconViewItem::setText( text ); | 139 | QIconViewItem::setText( text ); |
141 | } | 140 | } |
142 | } | 141 | } |
143 | 142 | ||
144 | 143 | ||
145 | /* | 144 | /* |
146 | * Set up the GUI.. initialize the slave set up gui | 145 | * Set up the GUI.. initialize the slave set up gui |
147 | * and also load a dir | 146 | * and also load a dir |
148 | */ | 147 | */ |
149 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 148 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
150 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 149 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
151 | { | 150 | { |
152 | { | 151 | { |
153 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 152 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
154 | } | 153 | } |
155 | m_path = QDir::homeDirPath(); | 154 | m_path = QDir::homeDirPath(); |
156 | m_mode = 0; | 155 | m_mode = 0; |
157 | 156 | ||
158 | QHBox *hbox = new QHBox( this ); | 157 | QHBox *hbox = new QHBox( this ); |
159 | QLabel* lbl = new QLabel( hbox ); | 158 | QLabel* lbl = new QLabel( hbox ); |
160 | lbl->setText( tr("View as" ) ); | 159 | lbl->setText( tr("View as" ) ); |
161 | 160 | ||
162 | m_views = new QComboBox( hbox, "View As" ); | 161 | m_views = new QComboBox( hbox, "View As" ); |
163 | 162 | ||
164 | m_view= new QIconView( this ); | 163 | m_view= new QIconView( this ); |
165 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 164 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
166 | this, SLOT(slotClicked(QIconViewItem*)) ); | 165 | this, SLOT(slotClicked(QIconViewItem*)) ); |
167 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 166 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
168 | this, SLOT(slotClicked(QIconViewItem*)) ); | 167 | this, SLOT(slotClicked(QIconViewItem*)) ); |
169 | 168 | ||
170 | m_view->setArrangement( QIconView::LeftToRight ); | 169 | m_view->setArrangement( QIconView::LeftToRight ); |
171 | 170 | ||
172 | m_mode = m_cfg->readNumEntry("ListViewMode", 1); | 171 | m_mode = m_cfg->readNumEntry("ListViewMode", 1); |
173 | QString lastView = m_cfg->readEntry("LastView",""); | 172 | QString lastView = m_cfg->readEntry("LastView",""); |
174 | 173 | ||
175 | if (m_mode < 1 || m_mode>3) m_mode = 1; | 174 | if (m_mode < 1 || m_mode>3) m_mode = 1; |
176 | 175 | ||
177 | m_view->setItemTextPos( QIconView::Right ); | 176 | m_view->setItemTextPos( QIconView::Right ); |
178 | 177 | ||
179 | calculateGrid(); | 178 | calculateGrid(); |
180 | 179 | ||
181 | initKeys(); | 180 | initKeys(); |
182 | 181 | ||
183 | loadViews(); | 182 | loadViews(); |
184 | int cc=0; | 183 | int cc=0; |
185 | for (; cc<m_views->count();++cc) { | 184 | for (; cc<m_views->count();++cc) { |
186 | if (m_views->text(cc)==lastView) { | 185 | if (m_views->text(cc)==lastView) { |
187 | break; | 186 | break; |
188 | } | 187 | } |
189 | } | 188 | } |
190 | if (cc<m_views->count()) { | 189 | if (cc<m_views->count()) { |
191 | m_views->setCurrentItem(cc); | 190 | m_views->setCurrentItem(cc); |
192 | slotViewChanged(cc); | 191 | slotViewChanged(cc); |
193 | } else { | 192 | } else { |
194 | slotViewChanged(m_views->currentItem()); | 193 | slotViewChanged(m_views->currentItem()); |
195 | } | 194 | } |
196 | connect( m_views, SIGNAL(activated(int)), | 195 | connect( m_views, SIGNAL(activated(int)), |
197 | this, SLOT(slotViewChanged(int)) ); | 196 | this, SLOT(slotViewChanged(int)) ); |
198 | } | 197 | } |
199 | 198 | ||
200 | /* | 199 | /* |
201 | * Unref the slave and save the keyboard manager | 200 | * Unref the slave and save the keyboard manager |
202 | */ | 201 | */ |
203 | PIconView::~PIconView() { | 202 | PIconView::~PIconView() { |
204 | { | 203 | { |
205 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 204 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
206 | } | 205 | } |
207 | m_viewManager->save(); | 206 | m_viewManager->save(); |
208 | delete m_viewManager; | 207 | delete m_viewManager; |
209 | } | 208 | } |
210 | 209 | ||
211 | Opie::Core::OKeyConfigManager* PIconView::manager() { | 210 | Opie::Core::OKeyConfigManager* PIconView::manager() { |
212 | return m_viewManager; | 211 | return m_viewManager; |
213 | } | 212 | } |
214 | 213 | ||
215 | 214 | ||
216 | /* | 215 | /* |
217 | * init the KeyBoard Shortcuts | 216 | * init the KeyBoard Shortcuts |
218 | * called from the c'tor | 217 | * called from the c'tor |
219 | */ | 218 | */ |
220 | void PIconView::initKeys() { | 219 | void PIconView::initKeys() { |
221 | Opie::Core::OKeyPair::List lst; | 220 | Opie::Core::OKeyPair::List lst; |
222 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 221 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
223 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 222 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
224 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 223 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
225 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 224 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
226 | lst.append( Opie::Core::OKeyPair::returnKey() ); | 225 | lst.append( Opie::Core::OKeyPair::returnKey() ); |
227 | 226 | ||
228 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", | 227 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", |
229 | lst, false,this, "keyconfig name" ); | 228 | lst, false,this, "keyconfig name" ); |
230 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 229 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
231 | Resource::loadPixmap("beam"), BeamItem, | 230 | Resource::loadPixmap("beam"), BeamItem, |
232 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), | 231 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), |
233 | this, SLOT(slotBeam())) ); | 232 | this, SLOT(slotBeam())) ); |
234 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", | 233 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", |
235 | Resource::loadPixmap("trash"), DeleteItem, | 234 | Resource::loadPixmap("trash"), DeleteItem, |
236 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), | 235 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), |
237 | this, SLOT(slotTrash())) ); | 236 | this, SLOT(slotTrash())) ); |
238 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", | 237 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", |
239 | Resource::loadPixmap("1to1"), ViewItem, | 238 | Resource::loadPixmap("1to1"), ViewItem, |
240 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 239 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
241 | this, SLOT(slotShowImage()))); | 240 | this, SLOT(slotShowImage()))); |
242 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", | 241 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", |
243 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, | 242 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, |
244 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), | 243 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), |
245 | this, SLOT(slotImageInfo()) ) ); | 244 | this, SLOT(slotImageInfo()) ) ); |
246 | m_viewManager->load(); | 245 | m_viewManager->load(); |
247 | m_viewManager->handleWidget( m_view ); | 246 | m_viewManager->handleWidget( m_view ); |
248 | } | 247 | } |
249 | 248 | ||
250 | 249 | ||
251 | /* | 250 | /* |
252 | * change one dir up | 251 | * change one dir up |
253 | */ | 252 | */ |
254 | void PIconView::slotDirUp() | 253 | void PIconView::slotDirUp() |
255 | { | 254 | { |
256 | if (m_path.isEmpty()) return; | 255 | slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); |
257 | QDir dir( m_path ); | ||
258 | dir.cdUp(); | ||
259 | slotChangeDir( dir.absPath() ); | ||
260 | } | 256 | } |
261 | 257 | ||
262 | /* | 258 | /* |
263 | * change the dir | 259 | * change the dir |
264 | */ | 260 | */ |
265 | void PIconView::slotChangeDir(const QString& path) { | 261 | void PIconView::slotChangeDir(const QString& path) { |
266 | if ( !currentView() ) | 262 | if ( !currentView() ) |
267 | return; | 263 | return; |
268 | 264 | ||
269 | PDirLister *lister = currentView()->dirLister(); | 265 | PDirLister *lister = currentView()->dirLister(); |
270 | if (!lister ) | 266 | if (!lister ) |
271 | return; | 267 | return; |
272 | 268 | ||
273 | /* | 269 | /* |
274 | * Say what we want and take what we get | 270 | * Say what we want and take what we get |
275 | */ | 271 | */ |
276 | lister->setStartPath( path ); | 272 | lister->setStartPath( path ); |
277 | m_path = lister->currentPath(); | 273 | m_path = lister->currentPath(); |
278 | 274 | ||
279 | m_view->viewport()->setUpdatesEnabled( false ); | 275 | m_view->viewport()->setUpdatesEnabled( false ); |
280 | m_view->clear(); | 276 | m_view->clear(); |
281 | 277 | ||
282 | /* | 278 | /* |
283 | * add files and folders | 279 | * add files and folders |
284 | */ | 280 | */ |
285 | addFolders( lister->folders() ); | 281 | addFolders( lister->folders() ); |
286 | addFiles( lister->files() ); | 282 | addFiles( lister->files() ); |
287 | m_view->viewport()->setUpdatesEnabled( true ); | 283 | m_view->viewport()->setUpdatesEnabled( true ); |
288 | 284 | ||
289 | // Also invalidate the cache. We can't cancel the operations anyway | 285 | // Also invalidate the cache. We can't cancel the operations anyway |
290 | g_stringPix.clear(); | 286 | g_stringPix.clear(); |
291 | g_stringInf.clear(); | 287 | g_stringInf.clear(); |
292 | 288 | ||
293 | // looks ugly | 289 | // looks ugly |
294 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); | 290 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); |
295 | } | 291 | } |
296 | 292 | ||
297 | /** | 293 | /** |
298 | * get the current file name | 294 | * get the current file name |
299 | * @param isDir see if this is a dir or real file | 295 | * @param isDir see if this is a dir or real file |
300 | */ | 296 | */ |
301 | QString PIconView::currentFileName(bool &isDir)const { | 297 | QString PIconView::currentFileName(bool &isDir)const { |
302 | isDir = false; | 298 | isDir = false; |
303 | QIconViewItem* _it = m_view->currentItem(); | 299 | QIconViewItem* _it = m_view->currentItem(); |
304 | if ( !_it ) | 300 | if ( !_it ) |
305 | return QString::null; | 301 | return QString::null; |
306 | 302 | ||
307 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 303 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
308 | isDir = it->isDir(); | 304 | isDir = it->isDir(); |
309 | return it->path(); | 305 | return it->path(); |
310 | } | 306 | } |
311 | 307 | ||
312 | QString PIconView::nextFileName(bool &isDir)const | 308 | QString PIconView::nextFileName(bool &isDir)const |
313 | { | 309 | { |
314 | isDir = false; | 310 | isDir = false; |
315 | QIconViewItem* _it1 = m_view->currentItem(); | 311 | QIconViewItem* _it1 = m_view->currentItem(); |
316 | if ( !_it1 ) | 312 | if ( !_it1 ) |
317 | return QString::null; | 313 | return QString::null; |
318 | QIconViewItem* _it = _it1->nextItem(); | 314 | QIconViewItem* _it = _it1->nextItem(); |
319 | if ( !_it ) | 315 | if ( !_it ) |
320 | return QString::null; | 316 | return QString::null; |
321 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 317 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
322 | isDir = it->isDir(); | 318 | isDir = it->isDir(); |
323 | return it->path(); | 319 | return it->path(); |
324 | } | 320 | } |
325 | 321 | ||
326 | QString PIconView::prevFileName(bool &isDir)const{ | 322 | QString PIconView::prevFileName(bool &isDir)const{ |
327 | isDir = false; | 323 | isDir = false; |
328 | QIconViewItem* _it = m_view->currentItem(); | 324 | QIconViewItem* _it = m_view->currentItem(); |
329 | if ( !_it ) | 325 | if ( !_it ) |
330 | return QString::null; | 326 | return QString::null; |
331 | _it = _it->prevItem(); | 327 | _it = _it->prevItem(); |
332 | if ( !_it ) | 328 | if ( !_it ) |
333 | return QString::null; | 329 | return QString::null; |
334 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 330 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
335 | isDir = it->isDir(); | 331 | isDir = it->isDir(); |
336 | return it->path(); | 332 | return it->path(); |
337 | } | 333 | } |
338 | 334 | ||
339 | void PIconView::slotTrash() { | 335 | void PIconView::slotTrash() { |
340 | bool isDir; | 336 | bool isDir; |
341 | QString pa = currentFileName( isDir ); | 337 | QString pa = currentFileName( isDir ); |
342 | if ( isDir && pa.isEmpty() ) | 338 | if ( isDir && pa.isEmpty() ) |
343 | return; | 339 | return; |
344 | 340 | ||
345 | if (!QPEMessageBox::confirmDelete( this, | 341 | if (!QPEMessageBox::confirmDelete( this, |
346 | tr("Delete Image" ), | 342 | tr("Delete Image" ), |
347 | tr("the Image %1" ).arg(pa))) | 343 | tr("the Image %1" ).arg(pa))) |
348 | return | 344 | return |
349 | 345 | ||
350 | 346 | ||
351 | currentView()->dirLister()->deleteImage( pa ); | 347 | currentView()->dirLister()->deleteImage( pa ); |
352 | delete m_view->currentItem(); | 348 | delete m_view->currentItem(); |
353 | } | 349 | } |
354 | 350 | ||
355 | /* | 351 | /* |
356 | * see what views are available | 352 | * see what views are available |
357 | */ | 353 | */ |
358 | void PIconView::loadViews() { | 354 | void PIconView::loadViews() { |
359 | ViewMap::Iterator it; | 355 | ViewMap::Iterator it; |
360 | ViewMap* map = viewMap(); | 356 | ViewMap* map = viewMap(); |
361 | for ( it = map->begin(); it != map->end(); ++it ) | 357 | for ( it = map->begin(); it != map->end(); ++it ) |
362 | m_views->insertItem( it.key() ); | 358 | m_views->insertItem( it.key() ); |
363 | } | 359 | } |
364 | 360 | ||
365 | void PIconView::resetView() { | 361 | void PIconView::resetView() { |
366 | slotViewChanged(m_views->currentItem()); | 362 | slotViewChanged(m_views->currentItem()); |
367 | } | 363 | } |
368 | 364 | ||
369 | /* | 365 | /* |
370 | *swicth view reloadDir and connect signals | 366 | *swicth view reloadDir and connect signals |
371 | */ | 367 | */ |
372 | void PIconView::slotViewChanged( int i) { | 368 | void PIconView::slotViewChanged( int i) { |
373 | if (!m_views->count() ) { | 369 | if (!m_views->count() ) { |
374 | setCurrentView( 0l); | 370 | setCurrentView( 0l); |
375 | return; | 371 | return; |
376 | } | 372 | } |
377 | 373 | ||
378 | PDirView* cur = currentView(); | 374 | PDirView* cur = currentView(); |
379 | if (cur) delete cur; | 375 | if (cur) delete cur; |
380 | QString str = m_views->text(i); | 376 | QString str = m_views->text(i); |
381 | ViewMap* map = viewMap(); | 377 | ViewMap* map = viewMap(); |
382 | if (!map) {setCurrentView(0l); return;} | 378 | if (!map) { |
379 | setCurrentView(0l); | ||
380 | return; | ||
381 | } | ||
382 | |||
383 | if (map->find(str) == map->end()) { | 383 | if (map->find(str) == map->end()) { |
384 | owarn << "Key not found" << oendl; | 384 | owarn << "Key not found" << oendl; |
385 | setCurrentView(0l); return; | 385 | setCurrentView(0l); |
386 | return; | ||
386 | } | 387 | } |
388 | |||
387 | m_cfg->writeEntry("LastView",str); | 389 | m_cfg->writeEntry("LastView",str); |
388 | m_cfg->write(); | 390 | m_cfg->write(); |
389 | cur = (*(*map)[str])(*m_cfg); | 391 | cur = (*(*map)[str])(*m_cfg); |
390 | setCurrentView( cur ); | 392 | setCurrentView( cur ); |
391 | 393 | ||
392 | /* connect to the signals of the lister */ | 394 | /* connect to the signals of the lister */ |
393 | PDirLister* lis = cur->dirLister(); | 395 | PDirLister* lis = cur->dirLister(); |
394 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), | 396 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), |
395 | this, SLOT( slotThumbInfo(const QString&, const QString&))); | 397 | this, SLOT( slotThumbInfo(const QString&, const QString&))); |
396 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 398 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
397 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 399 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
398 | connect(lis, SIGNAL(sig_start()), | 400 | connect(lis, SIGNAL(sig_start()), |
399 | this, SLOT(slotStart())); | 401 | this, SLOT(slotStart())); |
400 | connect(lis, SIGNAL(sig_end()) , | 402 | connect(lis, SIGNAL(sig_end()) , |
401 | this, SLOT(slotEnd()) ); | 403 | this, SLOT(slotEnd()) ); |
402 | 404 | ||
403 | 405 | ||
404 | /* reload now */ | 406 | /* reload now with default Path*/ |
407 | m_path = lis->defaultPath(); | ||
405 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); | 408 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); |
406 | } | 409 | } |
407 | 410 | ||
408 | 411 | ||
409 | void PIconView::slotReloadDir() { | 412 | void PIconView::slotReloadDir() { |
410 | slotChangeDir( m_path ); | 413 | slotChangeDir( m_path ); |
411 | } | 414 | } |
412 | 415 | ||
413 | 416 | ||
414 | /* | 417 | /* |
415 | * add files and folders | 418 | * add files and folders |
416 | */ | 419 | */ |
417 | void PIconView::addFolders( const QStringList& lst) { | 420 | void PIconView::addFolders( const QStringList& lst) { |
418 | QStringList::ConstIterator it; | 421 | QStringList::ConstIterator it; |
419 | IconViewItem * _iv; | 422 | IconViewItem * _iv; |
420 | 423 | ||
421 | for(it=lst.begin(); it != lst.end(); ++it ) { | 424 | for(it=lst.begin(); it != lst.end(); ++it ) { |
422 | _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); | 425 | _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); |
423 | if (m_mode==3) _iv->setTextOnly(true); | 426 | if (m_mode==3) _iv->setTextOnly(true); |
424 | } | 427 | } |
425 | } | 428 | } |
426 | 429 | ||
427 | void PIconView::addFiles( const QStringList& lst) { | 430 | void PIconView::addFiles( const QStringList& lst) { |
428 | QStringList::ConstIterator it; | 431 | QStringList::ConstIterator it; |
429 | IconViewItem * _iv; | 432 | IconViewItem * _iv; |
430 | QPixmap*m_pix = 0; | 433 | QPixmap*m_pix = 0; |
431 | QString pre = ""; | 434 | QString pre = ""; |
432 | if (!m_path.isEmpty()) { | 435 | if (!m_path.isEmpty()) { |
433 | pre = m_path+"/"; | 436 | pre = m_path+"/"; |
434 | } | 437 | } |
435 | for (it=lst.begin(); it!= lst.end(); ++it ) { | 438 | for (it=lst.begin(); it!= lst.end(); ++it ) { |
436 | m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); | 439 | m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); |
437 | _iv = new IconViewItem( m_view, pre+(*it), (*it) ); | 440 | _iv = new IconViewItem( m_view, pre+(*it), (*it) ); |
438 | if (m_mode==3) { | 441 | if (m_mode==3) { |
439 | _iv->setTextOnly(true); | 442 | _iv->setTextOnly(true); |
440 | _iv->setPixmap(QPixmap()); | 443 | _iv->setPixmap(QPixmap()); |
441 | 444 | ||
442 | 445 | ||
443 | 446 | ||
444 | } else { | 447 | } else { |
445 | if (m_pix) _iv->setPixmap(*m_pix); | 448 | if (m_pix) _iv->setPixmap(*m_pix); |
446 | } | 449 | } |
447 | } | 450 | } |
448 | 451 | ||
449 | } | 452 | } |
450 | 453 | ||
451 | /* | 454 | /* |
452 | * user clicked on the item. Change dir or view | 455 | * user clicked on the item. Change dir or view |
453 | */ | 456 | */ |
454 | void PIconView::slotClicked(QIconViewItem* _it) { | 457 | void PIconView::slotClicked(QIconViewItem* _it) { |
455 | if(!_it ) | 458 | if(!_it ) |
456 | return; | 459 | return; |
457 | 460 | ||
458 | IconViewItem* it = static_cast<IconViewItem*>(_it); | 461 | IconViewItem* it = static_cast<IconViewItem*>(_it); |
459 | if( it->isDir() ) | 462 | if( it->isDir() ) |
460 | slotChangeDir( it->path() ); | 463 | slotChangeDir( it->path() ); |
461 | else // view image | 464 | else // view image |
462 | slotShowImage(); | 465 | slotShowImage(); |
463 | } | 466 | } |
464 | 467 | ||
465 | /* | 468 | /* |
466 | * Return was pressed. which is triggered by the keydown | 469 | * Return was pressed. which is triggered by the keydown |
467 | * handler. The problem is that the key up will be handled | 470 | * handler. The problem is that the key up will be handled |
468 | * by the ImageDisplayer and goes to the next image | 471 | * by the ImageDisplayer and goes to the next image |
469 | */ | 472 | */ |
470 | void PIconView::slotRetrun( QIconViewItem *_it ) { | 473 | void PIconView::slotRetrun( QIconViewItem *_it ) { |
471 | if(!_it ) | 474 | if(!_it ) |
472 | return; | 475 | return; |
473 | 476 | ||
474 | IconViewItem* it = static_cast<IconViewItem*>(_it); | 477 | IconViewItem* it = static_cast<IconViewItem*>(_it); |
475 | if( it->isDir() ) | 478 | if( it->isDir() ) |
476 | slotChangeDir( it->path() ); | 479 | slotChangeDir( it->path() ); |
477 | else | 480 | else |
478 | QTimer::singleShot(0, this, SLOT(slotShowImage()) ); | 481 | QTimer::singleShot(0, this, SLOT(slotShowImage()) ); |
479 | } | 482 | } |
480 | 483 | ||
481 | /* | 484 | /* |
482 | * got thumb info add to the cache if items is visible | 485 | * got thumb info add to the cache if items is visible |
483 | * we later need update after processing of slave is done | 486 | * we later need update after processing of slave is done |
484 | */ | 487 | */ |
485 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | 488 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { |
486 | IconViewItem* item = g_stringInf[_path]; | 489 | IconViewItem* item = g_stringInf[_path]; |
487 | if (!item ) | 490 | if (!item ) |
488 | return; | 491 | return; |
489 | 492 | ||
490 | if (m_mode == 2) { | 493 | if (m_mode == 2) { |
491 | return; | 494 | return; |
492 | } | 495 | } |
493 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 496 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
494 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 497 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
495 | m_updatet = true; | 498 | m_updatet = true; |
496 | 499 | ||
497 | item->setText( str ); | 500 | item->setText( str ); |
498 | g_stringInf.remove( _path ); | 501 | g_stringInf.remove( _path ); |
499 | } | 502 | } |
500 | 503 | ||
diff --git a/noncore/graphics/opie-eye/iface/dirlister.cpp b/noncore/graphics/opie-eye/iface/dirlister.cpp index 7cf4361..e0ae63b 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.cpp +++ b/noncore/graphics/opie-eye/iface/dirlister.cpp | |||
@@ -1,9 +1,22 @@ | |||
1 | #include "dirlister.h" | 1 | #include "dirlister.h" |
2 | 2 | ||
3 | #include <qdir.h> | ||
3 | 4 | ||
4 | PDirLister::PDirLister( const char* name ) | 5 | PDirLister::PDirLister( const char* name ) |
5 | : QObject( 0, name ) | 6 | : QObject( 0, name ) |
6 | {} | 7 | {} |
7 | 8 | ||
8 | PDirLister::~PDirLister() | 9 | PDirLister::~PDirLister() |
9 | {} | 10 | {} |
11 | |||
12 | /** | ||
13 | * Change dir one level up. The default implementation | ||
14 | * is to use QDir to change the dir. | ||
15 | * If you've a flat filesystem return \par path immediately. | ||
16 | */ | ||
17 | QString PDirLister::dirUp( const QString& path )const { | ||
18 | QDir dir( path ); | ||
19 | dir.cdUp(); | ||
20 | |||
21 | return dir.absPath(); | ||
22 | } | ||
diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h index 9c7b2a9..68e8495 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.h +++ b/noncore/graphics/opie-eye/iface/dirlister.h | |||
@@ -1,48 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef PHUNK_DIR_LISTER_H | 6 | #ifndef PHUNK_DIR_LISTER_H |
7 | #define PHUNK_DIR_LISTER_H | 7 | #define PHUNK_DIR_LISTER_H |
8 | 8 | ||
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qstringlist.h> | 11 | #include <qstringlist.h> |
12 | 12 | ||
13 | 13 | ||
14 | class PDirLister : public QObject { | 14 | class PDirLister : public QObject { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | enum Factor { Width, Height, None }; | 17 | enum Factor { Width, Height, None }; |
18 | 18 | ||
19 | PDirLister( const char* name ); | 19 | PDirLister( const char* name ); |
20 | 20 | ||
21 | virtual QString defaultPath()const = 0; | 21 | virtual QString defaultPath()const = 0; |
22 | virtual QString setStartPath( const QString& ) = 0; | 22 | virtual QString setStartPath( const QString& ) = 0; |
23 | virtual QString currentPath()const = 0; | 23 | virtual QString currentPath()const = 0; |
24 | virtual QStringList folders()const = 0; | 24 | virtual QStringList folders()const = 0; |
25 | virtual QStringList files()const = 0; | 25 | virtual QStringList files()const = 0; |
26 | virtual QString nameToFname(const QString&name)const = 0; | ||
27 | virtual QString dirUp(const QString&)const ; | ||
28 | |||
29 | |||
26 | public slots: | 30 | public slots: |
27 | virtual void deleteImage( const QString& ) = 0; | 31 | virtual void deleteImage( const QString& ) = 0; |
28 | virtual void imageInfo( const QString&) = 0; | 32 | virtual void imageInfo( const QString&) = 0; |
29 | virtual void fullImageInfo( const QString& ) = 0; | 33 | virtual void fullImageInfo( const QString& ) = 0; |
30 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; | 34 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; |
31 | virtual QImage image( const QString&, Factor, int max = 0) = 0; | 35 | virtual QImage image( const QString&, Factor, int max = 0) = 0; |
32 | virtual QString nameToFname(const QString&name)const = 0; | 36 | |
33 | 37 | ||
34 | signals: | 38 | signals: |
35 | void sig_dirchanged(); | 39 | void sig_dirchanged(); |
36 | void sig_filechanged(); | 40 | void sig_filechanged(); |
37 | void sig_start(); | 41 | void sig_start(); |
38 | void sig_end(); | 42 | void sig_end(); |
39 | // If this app ever happens to get multithreaded... | 43 | // If this app ever happens to get multithreaded... |
40 | void sig_thumbInfo( const QString&, const QString& ); | 44 | void sig_thumbInfo( const QString&, const QString& ); |
41 | void sig_fullInfo( const QString&, const QString& ); | 45 | void sig_fullInfo( const QString&, const QString& ); |
42 | void sig_thumbNail( const QString&, const QPixmap& ); | 46 | void sig_thumbNail( const QString&, const QPixmap& ); |
43 | 47 | ||
44 | protected: | 48 | protected: |
45 | virtual ~PDirLister(); | 49 | virtual ~PDirLister(); |
46 | }; | 50 | }; |
47 | 51 | ||
48 | #endif | 52 | #endif |
diff --git a/noncore/graphics/opie-eye/iface/iface.pro b/noncore/graphics/opie-eye/iface/iface.pro new file mode 100644 index 0000000..2ec499a --- a/dev/null +++ b/noncore/graphics/opie-eye/iface/iface.pro | |||
@@ -0,0 +1,7 @@ | |||
1 | HEADERS += iface/dirlister.h \ | ||
2 | iface/dirview.h \ | ||
3 | iface/ifaceinfo.h \ | ||
4 | iface/slaveiface.h | ||
5 | |||
6 | SOURCES += iface/dirlister.cpp \ | ||
7 | iface/dirview.cpp | ||
diff --git a/noncore/graphics/opie-eye/iface/ifaceinfo.h b/noncore/graphics/opie-eye/iface/ifaceinfo.h index 74e0db6..3af2fce 100644 --- a/noncore/graphics/opie-eye/iface/ifaceinfo.h +++ b/noncore/graphics/opie-eye/iface/ifaceinfo.h | |||
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef PHUNK_INTERFACE_INFO_H | 6 | #ifndef PHUNK_INTERFACE_INFO_H |
7 | #define PHUNK_INTERFACE_INFO_H | 7 | #define PHUNK_INTERFACE_INFO_H |
8 | 8 | ||
9 | #include <qstring.h> | 9 | #include <qstring.h> |
10 | 10 | ||
11 | class QWidget; | 11 | class QWidget; |
12 | class Config; | 12 | class Config; |
13 | struct PInterfaceInfo { | 13 | struct PInterfaceInfo { |
14 | virtual QString name()const = 0; | 14 | virtual QString name()const = 0; |
15 | virtual QWidget* configWidget( const Config& ) = 0; | 15 | virtual QWidget* configWidget( const Config& ) = 0; |
16 | virtual void writeConfig( QWidget* wid, Config& ) = 0; | 16 | virtual void writeConfig( QWidget* wid, Config& ) = 0; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | #endif | 19 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim.pro b/noncore/graphics/opie-eye/impl/dcim/dcim.pro new file mode 100644 index 0000000..a8e8f05 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim.pro | |||
@@ -0,0 +1,10 @@ | |||
1 | HEADERS += impl/dcim/dcim_dirview.h \ | ||
2 | impl/dcim/dcim_ifaceinfo.h \ | ||
3 | impl/dcim/dcim_lister.h | ||
4 | |||
5 | |||
6 | |||
7 | SOURCES += impl/dcim/dcim_dirview.cpp \ | ||
8 | impl/dcim/dcim_ifaceinfo.cpp \ | ||
9 | impl/dcim/dcim_lister.cpp | ||
10 | |||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp new file mode 100644 index 0000000..e55c27a --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #include "dcim_dirview.h" | ||
2 | |||
3 | #include "dcim_lister.h" | ||
4 | #include "dcim_ifaceinfo.h" | ||
5 | |||
6 | PHUNK_VIEW_INTERFACE( "Digital Camera", DCIM_DirView ); | ||
7 | |||
8 | DCIM_DirView::DCIM_DirView( const Config& cfg ) | ||
9 | : PDirView( cfg ), m_lister( 0l ), m_info( 0l ) | ||
10 | {} | ||
11 | |||
12 | DCIM_DirView::~DCIM_DirView() | ||
13 | {} | ||
14 | |||
15 | PInterfaceInfo* DCIM_DirView::interfaceInfo()const { | ||
16 | if ( !m_info ) | ||
17 | m_info = new DCIM_InterfaceInfo; | ||
18 | |||
19 | return m_info; | ||
20 | } | ||
21 | |||
22 | |||
23 | PDirLister* DCIM_DirView::dirLister()const { | ||
24 | if ( !m_lister ) | ||
25 | m_lister = new DCIM_DirLister(); | ||
26 | |||
27 | return m_lister; | ||
28 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h new file mode 100644 index 0000000..7fc38ec --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * GPLv2 only zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DCIM_DIR_VIEW_H | ||
6 | #define DCIM_DIR_VIEW_H | ||
7 | |||
8 | #include <iface/dirview.h> | ||
9 | |||
10 | /* | ||
11 | * Implementation for USB Host Digital Cameras | ||
12 | * like my Casio QV 500 and boring Yakumo | ||
13 | */ | ||
14 | struct DCIM_DirView : public PDirView { | ||
15 | DCIM_DirView( const Config& ); | ||
16 | ~DCIM_DirView(); | ||
17 | |||
18 | PInterfaceInfo* interfaceInfo()const; | ||
19 | PDirLister * dirLister ()const; | ||
20 | |||
21 | private: | ||
22 | mutable PDirLister *m_lister; | ||
23 | mutable PInterfaceInfo *m_info ; | ||
24 | }; | ||
25 | |||
26 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.cpp new file mode 100644 index 0000000..ca94dc5 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.cpp | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | |||
7 | #include "dcim_ifaceinfo.h" | ||
8 | |||
9 | #include <qobject.h> | ||
10 | |||
11 | DCIM_InterfaceInfo::DCIM_InterfaceInfo() {} | ||
12 | DCIM_InterfaceInfo::~DCIM_InterfaceInfo() {} | ||
13 | |||
14 | QString DCIM_InterfaceInfo::name()const { | ||
15 | return QObject::tr( "Digital Camera View" ); | ||
16 | } | ||
17 | |||
18 | QWidget* DCIM_InterfaceInfo::configWidget( const Config& ) { | ||
19 | return 0l; | ||
20 | } | ||
21 | |||
22 | void DCIM_InterfaceInfo::writeConfig( QWidget*, Config& ) {} | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.h b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.h new file mode 100644 index 0000000..6396047 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #ifndef DCIM_IFACE_INFO_H | ||
7 | #define DCIM_IFACE_INFO_H | ||
8 | |||
9 | #include <iface/ifaceinfo.h> | ||
10 | |||
11 | class DCIM_InterfaceInfo : public PInterfaceInfo { | ||
12 | public: | ||
13 | DCIM_InterfaceInfo(); | ||
14 | virtual ~DCIM_InterfaceInfo(); | ||
15 | |||
16 | QString name()const; | ||
17 | QWidget* configWidget( const Config& ); | ||
18 | void writeConfig( QWidget* wid, Config& ); | ||
19 | }; | ||
20 | |||
21 | |||
22 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp new file mode 100644 index 0000000..3c3d702 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp | |||
@@ -0,0 +1,181 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #include "dcim_lister.h" | ||
6 | #include <lib/slavemaster.h> | ||
7 | |||
8 | #include <opie2/odebug.h> | ||
9 | #include <qpe/storage.h> | ||
10 | |||
11 | #include <qdir.h> | ||
12 | #include <qfileinfo.h> | ||
13 | #include <qimage.h> | ||
14 | |||
15 | DCIM_DirLister::DCIM_DirLister() | ||
16 | : PDirLister( "dcim_dirlister" ) | ||
17 | { | ||
18 | |||
19 | /* | ||
20 | * create a SlaveMaster and lets connect the signal of | ||
21 | * it to our interface | ||
22 | */ | ||
23 | SlaveHelper::slaveConnectSignals( this ); | ||
24 | m_mode = ListingUnknown; | ||
25 | } | ||
26 | |||
27 | DCIM_DirLister::~DCIM_DirLister() {} | ||
28 | |||
29 | QString DCIM_DirLister::defaultPath()const { | ||
30 | m_mode = ListingStart; | ||
31 | return QString::null; | ||
32 | } | ||
33 | |||
34 | QString DCIM_DirLister::setStartPath( const QString& str) { | ||
35 | /** | ||
36 | * IconView adds a '/' to path. Lets strip | ||
37 | * that. | ||
38 | */ | ||
39 | QString st = str.mid( 1 ); | ||
40 | if ( ListingStart == m_mode && m_map.contains( st ) ) { | ||
41 | m_path = m_map[st]+ "/dcim"; | ||
42 | m_mode = ListingFolder; | ||
43 | }else if ( m_mode == ListingFolder ) { | ||
44 | m_mode = ListingFiles; | ||
45 | m_path = str; | ||
46 | }else if ( m_mode == ListingReFolder ) { | ||
47 | m_mode = ListingFolder; | ||
48 | } | ||
49 | |||
50 | owarn << " StartPath2 " << str << " " << m_path << oendl; | ||
51 | |||
52 | return m_path; | ||
53 | } | ||
54 | |||
55 | |||
56 | QString DCIM_DirLister::currentPath()const { | ||
57 | return m_path; | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * depending on the mode we will either | ||
62 | * Find Digital Cameras | ||
63 | */ | ||
64 | QStringList DCIM_DirLister::folders()const { | ||
65 | QStringList lst; | ||
66 | |||
67 | switch( m_mode ) { | ||
68 | case ListingUnknown: | ||
69 | case ListingStart: | ||
70 | lst = findCameras(); | ||
71 | break; | ||
72 | case ListingFolder: | ||
73 | lst = findAlbums(); | ||
74 | break; | ||
75 | case ListingFiles: | ||
76 | default: | ||
77 | break; | ||
78 | } | ||
79 | |||
80 | return lst; | ||
81 | } | ||
82 | |||
83 | QStringList DCIM_DirLister::files()const { | ||
84 | if ( m_mode != ListingFiles ) | ||
85 | return QStringList(); | ||
86 | else | ||
87 | return findImages(); | ||
88 | } | ||
89 | |||
90 | QString DCIM_DirLister::dirUp( const QString& p )const { | ||
91 | QString str; | ||
92 | |||
93 | switch( m_mode ) { | ||
94 | case ListingFiles: | ||
95 | m_mode = ListingReFolder; | ||
96 | str = PDirLister::dirUp( p ); | ||
97 | break; | ||
98 | case ListingFolder: | ||
99 | m_mode = ListingStart; | ||
100 | break; | ||
101 | case ListingUnknown: | ||
102 | case ListingStart: | ||
103 | default: | ||
104 | break; | ||
105 | } | ||
106 | |||
107 | /* down cases */ | ||
108 | owarn << " New String " << str << " old path " << m_mode << oendl; | ||
109 | m_path = str; | ||
110 | return str; | ||
111 | } | ||
112 | |||
113 | |||
114 | QStringList DCIM_DirLister::findCameras()const { | ||
115 | QStringList lst; | ||
116 | StorageInfo inf; | ||
117 | |||
118 | m_map.clear(); | ||
119 | |||
120 | const QList<FileSystem> &list = inf.fileSystems(); | ||
121 | QListIterator<FileSystem> it( list ); | ||
122 | |||
123 | |||
124 | FileSystem *sys; | ||
125 | for ( sys = it.current(); (sys=it.current())!=0 ; ++it ) | ||
126 | if ( QFileInfo( sys->path() + "/dcim/" ).exists() ) { | ||
127 | lst << sys->name(); | ||
128 | m_map.insert( sys->name(), sys->path() ); | ||
129 | } | ||
130 | |||
131 | if ( lst.isEmpty() ) { | ||
132 | m_mode = ListingUnknown; | ||
133 | lst << QObject::tr("Error no Camera Dir found"); | ||
134 | }else | ||
135 | m_mode = ListingStart; | ||
136 | |||
137 | return lst; | ||
138 | } | ||
139 | |||
140 | QStringList DCIM_DirLister::findAlbums()const { | ||
141 | QStringList lst = QDir( m_path ).entryList( QDir::Dirs ); | ||
142 | lst.remove( "." ); | ||
143 | lst.remove( ".." ); | ||
144 | |||
145 | return lst; | ||
146 | } | ||
147 | |||
148 | QStringList DCIM_DirLister::findImages()const { | ||
149 | return QDir( m_path ).entryList("*.jpg *.jpeg *.png", QDir::Files ); | ||
150 | } | ||
151 | |||
152 | void DCIM_DirLister::deleteImage( const QString& fl ) { | ||
153 | QFileInfo inf( fl ); | ||
154 | QFile::remove( fl ); | ||
155 | QFile::remove( inf.dirPath ()+"/preview"+ | ||
156 | inf.fileName() ); | ||
157 | } | ||
158 | |||
159 | void DCIM_DirLister::thumbNail( const QString& _str, int w, int h ) { | ||
160 | QFileInfo inf( _str ); | ||
161 | QString str = QFileInfo( inf.dirPath()+"/preview"+ inf.fileName() ).exists() ? | ||
162 | inf.dirPath()+"/preview"+ inf.fileName() : _str; | ||
163 | |||
164 | SlaveMaster::self()->thumbNail( str, w, h ); | ||
165 | } | ||
166 | |||
167 | QImage DCIM_DirLister::image( const QString& str, Factor f, int m ) { | ||
168 | return SlaveMaster::self()->image( str, f, m ); | ||
169 | } | ||
170 | |||
171 | void DCIM_DirLister::imageInfo( const QString& str ) { | ||
172 | SlaveMaster::self()->thumbInfo( str ); | ||
173 | } | ||
174 | |||
175 | void DCIM_DirLister::fullImageInfo( const QString& str ) { | ||
176 | SlaveMaster::self()->imageInfo( str ); | ||
177 | } | ||
178 | |||
179 | QString DCIM_DirLister::nameToFname( const QString& name )const { | ||
180 | return name; | ||
181 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_lister.h b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.h new file mode 100644 index 0000000..d0a2031 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DCIM_LISTER_H | ||
6 | #define DCIM_LISTER_H | ||
7 | |||
8 | #include <iface/dirlister.h> | ||
9 | |||
10 | #include <qmap.h> | ||
11 | |||
12 | class Config; | ||
13 | |||
14 | /** | ||
15 | * The DirLister is responsible for | ||
16 | * telling the GUI about files and folders | ||
17 | * and to load them. | ||
18 | * The DCIM is a special FileSystem lister | ||
19 | * in the that it starts with an overview | ||
20 | * of available 'Cameras'. It looks via 'Storage' | ||
21 | * for paths including a 'dcim' directory. | ||
22 | * And offers these as folders. | ||
23 | * Then it only lists Images. It tries to use | ||
24 | * the 'preview' directory to generate a thumbnail | ||
25 | * but will use the full image for the QImage | ||
26 | * call. | ||
27 | * | ||
28 | */ | ||
29 | class DCIM_DirLister : public PDirLister { | ||
30 | Q_OBJECT | ||
31 | public: | ||
32 | enum ListMode{ | ||
33 | ListingUnknown = -1, | ||
34 | ListingStart=1, /* give an overview over files */ | ||
35 | ListingFolder, /* give access to albums */ | ||
36 | ListingFiles, /* list the content of the album */ | ||
37 | ListingReFolder | ||
38 | }; | ||
39 | DCIM_DirLister(); | ||
40 | ~DCIM_DirLister(); | ||
41 | |||
42 | QString defaultPath()const; | ||
43 | QString setStartPath( const QString& ); | ||
44 | |||
45 | QString currentPath()const; | ||
46 | QStringList folders()const; | ||
47 | QStringList files() const; | ||
48 | |||
49 | void deleteImage( const QString& ); | ||
50 | |||
51 | void thumbNail( const QString&, int, int ); | ||
52 | QImage image( const QString&, Factor, int ); | ||
53 | void imageInfo( const QString& ); | ||
54 | void fullImageInfo( const QString& ); | ||
55 | |||
56 | |||
57 | virtual QString nameToFname( const QString& )const; | ||
58 | virtual QString dirUp(const QString& )const; | ||
59 | |||
60 | private: | ||
61 | QStringList findCameras()const; | ||
62 | QStringList findAlbums ()const; | ||
63 | QStringList findImages ()const; | ||
64 | |||
65 | private: | ||
66 | mutable QString m_path; | ||
67 | mutable ListMode m_mode; | ||
68 | mutable QMap<QString, QString> m_map; | ||
69 | }; | ||
70 | |||
71 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir.pro b/noncore/graphics/opie-eye/impl/dir/dir.pro new file mode 100644 index 0000000..675c327 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir.pro | |||
@@ -0,0 +1,10 @@ | |||
1 | HEADERS += impl/dir/dir_dirview.h \ | ||
2 | impl/dir/dir_ifaceinfo.h \ | ||
3 | impl/dir/dir_lister.h | ||
4 | |||
5 | |||
6 | |||
7 | SOURCES += impl/dir/dir_dirview.cpp \ | ||
8 | impl/dir/dir_ifaceinfo.cpp \ | ||
9 | impl/dir/dir_lister.cpp | ||
10 | |||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp index 5599ad1..f4a6a87 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp | |||
@@ -1,51 +1,50 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 | 2 | * GPLv2 |
3 | * zecke@handhelds.org | 3 | * zecke@handhelds.org |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "dir_ifaceinfo.h" | 6 | #include "dir_ifaceinfo.h" |
7 | 7 | ||
8 | /* OPIE */ | 8 | /* OPIE */ |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | using namespace Opie::Core; | ||
12 | 11 | ||
13 | /* QT */ | 12 | /* QT */ |
14 | #include <qwidget.h> | 13 | #include <qwidget.h> |
15 | #include <qcheckbox.h> | 14 | #include <qcheckbox.h> |
16 | #include <qhbox.h> | 15 | #include <qhbox.h> |
17 | #include <qlabel.h> | 16 | #include <qlabel.h> |
18 | 17 | ||
19 | namespace { | 18 | namespace { |
20 | class DirImageWidget : public QHBox { | 19 | class DirImageWidget : public QHBox { |
21 | public: | 20 | public: |
22 | DirImageWidget() { | 21 | DirImageWidget() { |
23 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); | 22 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); |
24 | } | 23 | } |
25 | ~DirImageWidget() {} | 24 | ~DirImageWidget() {} |
26 | QCheckBox* chkbox; | 25 | QCheckBox* chkbox; |
27 | }; | 26 | }; |
28 | } | 27 | } |
29 | 28 | ||
30 | 29 | ||
31 | DirInterfaceInfo::DirInterfaceInfo() { | 30 | DirInterfaceInfo::DirInterfaceInfo() { |
32 | } | 31 | } |
33 | DirInterfaceInfo::~DirInterfaceInfo() { | 32 | DirInterfaceInfo::~DirInterfaceInfo() { |
34 | } | 33 | } |
35 | 34 | ||
36 | QString DirInterfaceInfo::name()const { | 35 | QString DirInterfaceInfo::name()const { |
37 | return QString::fromLatin1(QObject::tr("DirView" )); | 36 | return QObject::tr("Directory View" ); |
38 | } | 37 | } |
39 | 38 | ||
40 | QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { | 39 | QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { |
41 | DirImageWidget* wid = new DirImageWidget(); | 40 | DirImageWidget* wid = new DirImageWidget(); |
42 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); | 41 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); |
43 | 42 | ||
44 | return wid; | 43 | return wid; |
45 | } | 44 | } |
46 | 45 | ||
47 | void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { | 46 | void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { |
48 | owarn << "Write Config" << oendl; | 47 | owarn << "Write Config" << oendl; |
49 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); | 48 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); |
50 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); | 49 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); |
51 | } | 50 | } |
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index 3717297..d8b332a 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | |||
@@ -1,102 +1,92 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "dir_lister.h" | 5 | #include "dir_lister.h" |
6 | 6 | ||
7 | #include <lib/slavemaster.h> | 7 | #include <lib/slavemaster.h> |
8 | 8 | ||
9 | /* OPIE */ | 9 | /* OPIE */ |
10 | #include <opie2/odebug.h> | 10 | #include <opie2/odebug.h> |
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <qfileinfo.h> | 17 | #include <qfileinfo.h> |
18 | 18 | ||
19 | Dir_DirLister::Dir_DirLister( bool list ) | 19 | Dir_DirLister::Dir_DirLister( bool list ) |
20 | : PDirLister( "dir_dir_lister" ) | 20 | : PDirLister( "dir_dir_lister" ) |
21 | { | 21 | { |
22 | m_allFiles = list; | 22 | m_allFiles = list; |
23 | owarn << "All Files " << m_allFiles << "" << oendl; | 23 | owarn << "All Files " << m_allFiles << "" << oendl; |
24 | 24 | SlaveHelper::slaveConnectSignals( this ); | |
25 | SlaveMaster* master = SlaveMaster::self(); | ||
26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | ||
27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | ||
28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | ||
29 | this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); | ||
30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
31 | this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); | ||
32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | ||
33 | this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); | ||
34 | |||
35 | } | 25 | } |
36 | 26 | ||
37 | QString Dir_DirLister::defaultPath()const { | 27 | QString Dir_DirLister::defaultPath()const { |
38 | return QPEApplication::documentDir(); | 28 | return QPEApplication::documentDir(); |
39 | } | 29 | } |
40 | 30 | ||
41 | QString Dir_DirLister::setStartPath( const QString& path ) { | 31 | QString Dir_DirLister::setStartPath( const QString& path ) { |
42 | m_currentDir.cd( path ); | 32 | m_currentDir.cd( path ); |
43 | if (!m_currentDir.exists() ) | 33 | if (!m_currentDir.exists() ) |
44 | m_currentDir.cd(defaultPath()); | 34 | m_currentDir.cd(defaultPath()); |
45 | 35 | ||
46 | 36 | ||
47 | return m_currentDir.absPath(); | 37 | return m_currentDir.absPath(); |
48 | } | 38 | } |
49 | 39 | ||
50 | QString Dir_DirLister::currentPath()const { | 40 | QString Dir_DirLister::currentPath()const { |
51 | return m_currentDir.absPath(); | 41 | return m_currentDir.absPath(); |
52 | } | 42 | } |
53 | 43 | ||
54 | 44 | ||
55 | QStringList Dir_DirLister::folders()const { | 45 | QStringList Dir_DirLister::folders()const { |
56 | return m_currentDir.entryList( QDir::Dirs ); | 46 | return m_currentDir.entryList( QDir::Dirs ); |
57 | } | 47 | } |
58 | 48 | ||
59 | QStringList Dir_DirLister::files()const { | 49 | QStringList Dir_DirLister::files()const { |
60 | if ( m_allFiles ) | 50 | if ( m_allFiles ) |
61 | return m_currentDir.entryList( QDir::Files ); | 51 | return m_currentDir.entryList( QDir::Files ); |
62 | else { | 52 | else { |
63 | QStringList out; | 53 | QStringList out; |
64 | QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); | 54 | QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); |
65 | for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { | 55 | for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { |
66 | QFileInfo inf( *it ); | 56 | QFileInfo inf( *it ); |
67 | QString ext = inf.extension(false).lower(); | 57 | QString ext = inf.extension(false).lower(); |
68 | if( ext == QString::fromLatin1("jpg") || | 58 | if( ext == QString::fromLatin1("jpg") || |
69 | ext == QString::fromLatin1("jpeg" ) || | 59 | ext == QString::fromLatin1("jpeg" ) || |
70 | ext == QString::fromLatin1("png" ) || | 60 | ext == QString::fromLatin1("png" ) || |
71 | ext == QString::fromLatin1("bmp" ) || | 61 | ext == QString::fromLatin1("bmp" ) || |
72 | ext == QString::fromLatin1("gif" ) ) | 62 | ext == QString::fromLatin1("gif" ) ) |
73 | out.append( *it ); | 63 | out.append( *it ); |
74 | } | 64 | } |
75 | return out; | 65 | return out; |
76 | } | 66 | } |
77 | } | 67 | } |
78 | 68 | ||
79 | void Dir_DirLister::deleteImage( const QString& fl) { | 69 | void Dir_DirLister::deleteImage( const QString& fl) { |
80 | QFile::remove( fl ); | 70 | QFile::remove( fl ); |
81 | } | 71 | } |
82 | 72 | ||
83 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { | 73 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { |
84 | SlaveMaster::self()->thumbNail( str, w, h ); | 74 | SlaveMaster::self()->thumbNail( str, w, h ); |
85 | } | 75 | } |
86 | 76 | ||
87 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { | 77 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { |
88 | return SlaveMaster::self()->image( str, f, m ); | 78 | return SlaveMaster::self()->image( str, f, m ); |
89 | } | 79 | } |
90 | 80 | ||
91 | void Dir_DirLister::imageInfo( const QString& str) { | 81 | void Dir_DirLister::imageInfo( const QString& str) { |
92 | SlaveMaster::self()->thumbInfo( str ); | 82 | SlaveMaster::self()->thumbInfo( str ); |
93 | } | 83 | } |
94 | 84 | ||
95 | void Dir_DirLister::fullImageInfo( const QString& str) { | 85 | void Dir_DirLister::fullImageInfo( const QString& str) { |
96 | SlaveMaster::self()->imageInfo( str ); | 86 | SlaveMaster::self()->imageInfo( str ); |
97 | } | 87 | } |
98 | 88 | ||
99 | QString Dir_DirLister::nameToFname(const QString&name)const | 89 | QString Dir_DirLister::nameToFname(const QString&name)const |
100 | { | 90 | { |
101 | return name; | 91 | return name; |
102 | } | 92 | } |
diff --git a/noncore/graphics/opie-eye/impl/doc/doc.pro b/noncore/graphics/opie-eye/impl/doc/doc.pro new file mode 100644 index 0000000..076aa3b --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc.pro | |||
@@ -0,0 +1,7 @@ | |||
1 | HEADERS += impl/doc/doc_dirview.h \ | ||
2 | impl/doc/doc_ifaceinfo.h \ | ||
3 | impl/doc/doc_lister.h | ||
4 | |||
5 | SOURCES += impl/doc/doc_dirview.cpp \ | ||
6 | impl/doc/doc_ifaceinfo.cpp \ | ||
7 | impl/doc/doc_lister.cpp | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp index a6d6f3c..356a4b6 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | |||
@@ -1,57 +1,57 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 | 2 | * GPLv2 |
3 | * zecke@handhelds.org | 3 | * zecke@handhelds.org |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "doc_ifaceinfo.h" | 6 | #include "doc_ifaceinfo.h" |
7 | 7 | ||
8 | /* OPIE */ | 8 | /* OPIE */ |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
12 | 12 | ||
13 | /* QT */ | 13 | /* QT */ |
14 | #include <qwidget.h> | 14 | #include <qwidget.h> |
15 | #include <qcheckbox.h> | 15 | #include <qcheckbox.h> |
16 | #include <qhbox.h> | 16 | #include <qhbox.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | 18 | ||
19 | #if 0 | 19 | #if 0 |
20 | namespace { | 20 | namespace { |
21 | class DirImageWidget : public QHBox { | 21 | class DirImageWidget : public QHBox { |
22 | public: | 22 | public: |
23 | DirImageWidget() { | 23 | DirImageWidget() { |
24 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); | 24 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); |
25 | } | 25 | } |
26 | ~DirImageWidget() {} | 26 | ~DirImageWidget() {} |
27 | QCheckBox* chkbox; | 27 | QCheckBox* chkbox; |
28 | }; | 28 | }; |
29 | } | 29 | } |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | DocInterfaceInfo::DocInterfaceInfo() { | 32 | DocInterfaceInfo::DocInterfaceInfo() { |
33 | } | 33 | } |
34 | DocInterfaceInfo::~DocInterfaceInfo() { | 34 | DocInterfaceInfo::~DocInterfaceInfo() { |
35 | } | 35 | } |
36 | 36 | ||
37 | QString DocInterfaceInfo::name()const { | 37 | QString DocInterfaceInfo::name()const { |
38 | return QString::fromLatin1(QObject::tr("DocView" )); | 38 | return QString::fromLatin1(QObject::tr("DocView" )); |
39 | } | 39 | } |
40 | 40 | ||
41 | QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { | 41 | QWidget* DocInterfaceInfo::configWidget(const Config& ) { |
42 | #if 0 | 42 | #if 0 |
43 | DirImageWidget* wid = new DirImageWidget(); | 43 | DirImageWidget* wid = new DirImageWidget(); |
44 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); | 44 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); |
45 | 45 | ||
46 | return wid; | 46 | return wid; |
47 | #endif | 47 | #endif |
48 | return 0L; | 48 | return 0L; |
49 | } | 49 | } |
50 | 50 | ||
51 | void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { | 51 | void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { |
52 | #if 0 | 52 | #if 0 |
53 | owarn << "Write Config" << oendl; | 53 | owarn << "Write Config" << oendl; |
54 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); | 54 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); |
55 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); | 55 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); |
56 | #endif | 56 | #endif |
57 | } | 57 | } |
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index d4d1831..722fb95 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -1,152 +1,149 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "doc_lister.h" | 5 | #include "doc_lister.h" |
6 | 6 | ||
7 | #include <lib/slavemaster.h> | 7 | #include <lib/slavemaster.h> |
8 | 8 | ||
9 | /* OPIE */ | 9 | /* OPIE */ |
10 | #include <opie2/odebug.h> | 10 | #include <opie2/odebug.h> |
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | #include <qpe/applnk.h> | 13 | #include <qpe/applnk.h> |
14 | 14 | ||
15 | using namespace Opie::Core; | 15 | using namespace Opie::Core; |
16 | 16 | ||
17 | /* QT */ | 17 | /* QT */ |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qfileinfo.h> | 19 | #include <qfileinfo.h> |
20 | 20 | ||
21 | Doc_DirLister::Doc_DirLister() | 21 | Doc_DirLister::Doc_DirLister() |
22 | : PDirLister( "doc_dir_lister" ) | 22 | : PDirLister( "doc_dir_lister" ) |
23 | { | 23 | { |
24 | /* connect the signals */ | ||
24 | SlaveMaster* master = SlaveMaster::self(); | 25 | SlaveMaster* master = SlaveMaster::self(); |
25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 29 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 31 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 33 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
33 | 34 | ||
34 | m_namemap.clear(); | 35 | m_namemap.clear(); |
35 | m_filemap.clear(); | 36 | m_filemap.clear(); |
36 | } | 37 | } |
37 | 38 | ||
38 | QString Doc_DirLister::defaultPath()const { | 39 | QString Doc_DirLister::defaultPath()const { |
39 | return ""; QPEApplication::documentDir(); | 40 | return QString::null; |
40 | } | 41 | } |
41 | 42 | ||
42 | QString Doc_DirLister::setStartPath(const QString&) { | 43 | QString Doc_DirLister::setStartPath(const QString&) { |
43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 44 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
44 | if (m_namemap.isEmpty()) { | 45 | if (m_namemap.isEmpty()) { |
45 | DocLnkSet ds; | 46 | DocLnkSet ds; |
46 | Global::findDocuments(&ds,Mtype_str); | 47 | Global::findDocuments(&ds,Mtype_str); |
47 | QListIterator<DocLnk> dit(ds.children()); | 48 | QListIterator<DocLnk> dit(ds.children()); |
48 | for( ; dit.current(); ++dit) { | 49 | for( ; dit.current(); ++dit) { |
49 | // if (! (*dit)->isValid()) continue; | 50 | // if (! (*dit)->isValid()) continue; |
50 | m_namemap[(*dit)->name()]=(*dit)->file(); | 51 | m_namemap[(*dit)->name()]=(*dit)->file(); |
51 | m_filemap[(*dit)->file()]=(*dit)->name(); | 52 | m_filemap[(*dit)->file()]=(*dit)->name(); |
52 | } | 53 | } |
53 | } | 54 | } |
54 | return QString::null; | 55 | return QString::null; |
55 | } | 56 | } |
56 | 57 | ||
57 | QString Doc_DirLister::currentPath()const { | 58 | QString Doc_DirLister::currentPath()const { |
58 | return QString::null; | 59 | return QString::null; |
59 | } | 60 | } |
60 | 61 | ||
61 | 62 | ||
62 | QStringList Doc_DirLister::folders()const { | 63 | QStringList Doc_DirLister::folders()const { |
63 | return QStringList(); | 64 | return QStringList(); |
64 | } | 65 | } |
65 | 66 | ||
66 | QStringList Doc_DirLister::files()const { | 67 | QStringList Doc_DirLister::files()const { |
67 | QStringList out; | 68 | QStringList out; |
68 | QMap<QString,QString>::ConstIterator it; | 69 | QMap<QString,QString>::ConstIterator it; |
69 | for (it = m_namemap.begin();it != m_namemap.end();++it) { | 70 | for (it = m_namemap.begin();it != m_namemap.end();++it) { |
70 | out.append(it.key()); | 71 | out.append(it.key()); |
71 | } | 72 | } |
72 | return out; | 73 | return out; |
73 | } | 74 | } |
74 | 75 | ||
75 | void Doc_DirLister::deleteImage( const QString& ) | 76 | void Doc_DirLister::deleteImage( const QString& ) |
76 | { | 77 | { |
77 | } | 78 | } |
78 | 79 | ||
79 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | 80 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { |
80 | if (m_namemap.find(str)==m_namemap.end()) { | 81 | if (m_namemap.find(str)==m_namemap.end()) { |
81 | owarn << "Item " << str << " not found" << oendl; | ||
82 | return; | 82 | return; |
83 | } | 83 | } |
84 | QString fname = m_namemap[str]; | 84 | QString fname = m_namemap[str]; |
85 | SlaveMaster::self()->thumbNail( fname, w, h ); | 85 | SlaveMaster::self()->thumbNail( fname, w, h ); |
86 | } | 86 | } |
87 | 87 | ||
88 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | 88 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { |
89 | if (m_namemap.find(str)==m_namemap.end()) { | 89 | if (m_namemap.find(str)==m_namemap.end()) { |
90 | owarn << "Item " << str << " not found" << oendl; | ||
91 | return QImage(); | 90 | return QImage(); |
92 | } | 91 | } |
93 | QString fname = m_namemap[str]; | 92 | QString fname = m_namemap[str]; |
94 | return SlaveMaster::self()->image( fname, f, m ); | 93 | return SlaveMaster::self()->image( fname, f, m ); |
95 | } | 94 | } |
96 | 95 | ||
97 | void Doc_DirLister::imageInfo( const QString& str) { | 96 | void Doc_DirLister::imageInfo( const QString& str) { |
98 | if (m_namemap.find(str)==m_namemap.end()) { | 97 | if (m_namemap.find(str)==m_namemap.end()) { |
99 | owarn << "Item " << str << " not found" << oendl; | ||
100 | return; | 98 | return; |
101 | } | 99 | } |
102 | QString fname = m_namemap[str]; | 100 | QString fname = m_namemap[str]; |
103 | SlaveMaster::self()->thumbInfo( fname ); | 101 | SlaveMaster::self()->thumbInfo( fname ); |
104 | } | 102 | } |
105 | 103 | ||
106 | void Doc_DirLister::fullImageInfo( const QString& str) { | 104 | void Doc_DirLister::fullImageInfo( const QString& str) { |
107 | if (m_namemap.find(str)==m_namemap.end()) { | 105 | if (m_namemap.find(str)==m_namemap.end()) { |
108 | owarn << "Item " << str << " not found" << oendl; | ||
109 | return; | 106 | return; |
110 | } | 107 | } |
111 | QString fname = m_namemap[str]; | 108 | QString fname = m_namemap[str]; |
112 | SlaveMaster::self()->imageInfo( fname ); | 109 | SlaveMaster::self()->imageInfo( fname ); |
113 | } | 110 | } |
114 | 111 | ||
115 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | 112 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) |
116 | { | 113 | { |
117 | if (m_filemap.find(f)==m_filemap.end()) { | 114 | if (m_filemap.find(f)==m_filemap.end()) { |
118 | owarn << "Item " << f << " not found" << oendl; | ||
119 | return; | 115 | return; |
120 | } | 116 | } |
121 | QString name = m_filemap[f]; | 117 | QString name = m_filemap[f]; |
122 | emit sig_fullInfo(name, t); | 118 | emit sig_fullInfo(name, t); |
123 | } | 119 | } |
124 | 120 | ||
125 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | 121 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) |
126 | { | 122 | { |
127 | if (m_filemap.find(f)==m_filemap.end()) { | 123 | if (m_filemap.find(f)==m_filemap.end()) { |
128 | owarn << "Item " << f << " not found" << oendl; | ||
129 | return; | 124 | return; |
130 | } | 125 | } |
131 | QString name = m_filemap[f]; | 126 | QString name = m_filemap[f]; |
132 | emit sig_thumbInfo(name, t); | 127 | emit sig_thumbInfo(name, t); |
133 | } | 128 | } |
134 | 129 | ||
135 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | 130 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) |
136 | { | 131 | { |
137 | if (m_filemap.find(f)==m_filemap.end()) { | 132 | if (m_filemap.find(f)==m_filemap.end()) { |
138 | owarn << "Item " << f << " not found" << oendl; | ||
139 | return; | 133 | return; |
140 | } | 134 | } |
141 | QString name = m_filemap[f]; | 135 | QString name = m_filemap[f]; |
142 | emit sig_thumbNail(name, p); | 136 | emit sig_thumbNail(name, p); |
143 | } | 137 | } |
144 | 138 | ||
145 | QString Doc_DirLister::nameToFname(const QString&name)const | 139 | QString Doc_DirLister::nameToFname(const QString&name)const |
146 | { | 140 | { |
147 | if (m_namemap.find(name)==m_namemap.end()) { | 141 | if (m_namemap.find(name)==m_namemap.end()) { |
148 | owarn << "Item " << name << " not found" << oendl; | ||
149 | return QString::null; | 142 | return QString::null; |
150 | } | 143 | } |
151 | return m_namemap[name]; | 144 | return m_namemap[name]; |
152 | } | 145 | } |
146 | |||
147 | QString Doc_DirLister::dirUp( const QString& p ) const{ | ||
148 | return p; | ||
149 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h index a65b616..5884a35 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.h +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h | |||
@@ -1,41 +1,42 @@ | |||
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 <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qmap.h> | 11 | #include <qmap.h> |
12 | 12 | ||
13 | class Config; | 13 | class Config; |
14 | class Doc_DirLister : public PDirLister { | 14 | class Doc_DirLister : public PDirLister { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | Doc_DirLister(); | 17 | Doc_DirLister(); |
18 | virtual ~Doc_DirLister(){} | 18 | virtual ~Doc_DirLister(){} |
19 | 19 | ||
20 | QString defaultPath()const; | 20 | QString defaultPath()const; |
21 | QString setStartPath( const QString& ); | 21 | QString setStartPath( const QString& ); |
22 | QString currentPath()const; | 22 | QString currentPath()const; |
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 | QString dirUp( const QString& )const; | ||
32 | 33 | ||
33 | private: | 34 | private: |
34 | QMap<QString,QString> m_namemap,m_filemap; | 35 | QMap<QString,QString> m_namemap,m_filemap; |
35 | protected slots: | 36 | protected slots: |
36 | virtual void slotFullInfo(const QString&, const QString&); | 37 | virtual void slotFullInfo(const QString&, const QString&); |
37 | virtual void slotThumbInfo(const QString&, const QString&); | 38 | virtual void slotThumbInfo(const QString&, const QString&); |
38 | virtual void slotThumbNail(const QString&, const QPixmap&); | 39 | virtual void slotThumbNail(const QString&, const QPixmap&); |
39 | }; | 40 | }; |
40 | 41 | ||
41 | #endif | 42 | #endif |
diff --git a/noncore/graphics/opie-eye/lib/slavemaster.cpp b/noncore/graphics/opie-eye/lib/slavemaster.cpp index 5bb7ab8..d7165cc 100644 --- a/noncore/graphics/opie-eye/lib/slavemaster.cpp +++ b/noncore/graphics/opie-eye/lib/slavemaster.cpp | |||
@@ -1,154 +1,170 @@ | |||
1 | #include "slavemaster.h" | 1 | #include "slavemaster.h" |
2 | 2 | ||
3 | /* OPIE */ | 3 | /* OPIE */ |
4 | #include <opie2/odebug.h> | 4 | #include <opie2/odebug.h> |
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | #include <qpe/qcopenvelope_qws.h> | 6 | #include <qpe/qcopenvelope_qws.h> |
7 | using namespace Opie::Core; | 7 | using namespace Opie::Core; |
8 | 8 | ||
9 | /* QT */ | 9 | /* QT */ |
10 | #include <qcopchannel_qws.h> | 10 | #include <qcopchannel_qws.h> |
11 | #include <qtimer.h> | 11 | #include <qtimer.h> |
12 | 12 | ||
13 | QDataStream & operator << (QDataStream & str, bool b) | 13 | QDataStream & operator << (QDataStream & str, bool b) |
14 | { | 14 | { |
15 | str << Q_INT8(b); | 15 | str << Q_INT8(b); |
16 | return str; | 16 | return str; |
17 | } | 17 | } |
18 | QDataStream & operator >> (QDataStream & str, bool & b) | 18 | QDataStream & operator >> (QDataStream & str, bool & b) |
19 | { | 19 | { |
20 | Q_INT8 l; | 20 | Q_INT8 l; |
21 | str >> l; | 21 | str >> l; |
22 | b = bool(l); | 22 | b = bool(l); |
23 | return str; | 23 | return str; |
24 | } | 24 | } |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * ! We don't put a Pixmap in!!!! | 27 | * ! We don't put a Pixmap in!!!! |
28 | */ | 28 | */ |
29 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { | 29 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { |
30 | owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; | 30 | owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; |
31 | return s << inf.file << inf.width << inf.height; | 31 | return s << inf.file << inf.width << inf.height; |
32 | } | 32 | } |
33 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { | 33 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { |
34 | s >> inf.file >> inf.pixmap >> inf.width >> inf.height; | 34 | s >> inf.file >> inf.pixmap >> inf.width >> inf.height; |
35 | return s; | 35 | return s; |
36 | } | 36 | } |
37 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { | 37 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { |
38 | return s << i.kind << i.file << i.info; | 38 | return s << i.kind << i.file << i.info; |
39 | } | 39 | } |
40 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { | 40 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { |
41 | s >> i.kind >> i.file >> i.info; | 41 | s >> i.kind >> i.file >> i.info; |
42 | return s; | 42 | return s; |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | SlaveMaster* SlaveMaster::m_master = 0; | 47 | SlaveMaster* SlaveMaster::m_master = 0; |
48 | 48 | ||
49 | SlaveMaster::SlaveMaster() | 49 | SlaveMaster::SlaveMaster() |
50 | : m_started( false ) | 50 | : m_started( false ) |
51 | { | 51 | { |
52 | QCopChannel *chan= new QCopChannel( "QPE/opie-eye",this ); | 52 | QCopChannel *chan= new QCopChannel( "QPE/opie-eye",this ); |
53 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), | 53 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), |
54 | this, SLOT(recieve(const QCString&,const QByteArray&)) ); | 54 | this, SLOT(recieve(const QCString&,const QByteArray&)) ); |
55 | } | 55 | } |
56 | 56 | ||
57 | SlaveMaster::~SlaveMaster() { | 57 | SlaveMaster::~SlaveMaster() { |
58 | } | 58 | } |
59 | 59 | ||
60 | SlaveMaster* SlaveMaster::self() { | 60 | SlaveMaster* SlaveMaster::self() { |
61 | if ( !m_master ) | 61 | if ( !m_master ) |
62 | m_master = new SlaveMaster; | 62 | m_master = new SlaveMaster; |
63 | return m_master; | 63 | return m_master; |
64 | } | 64 | } |
65 | 65 | ||
66 | void SlaveMaster::thumbInfo( const QString& str) { | 66 | void SlaveMaster::thumbInfo( const QString& str) { |
67 | m_inThumbInfo.append( str ); | 67 | m_inThumbInfo.append( str ); |
68 | 68 | ||
69 | if ( !m_started ) { | 69 | if ( !m_started ) { |
70 | QTimer::singleShot( 0, this, SLOT(slotTimerStart())); | 70 | QTimer::singleShot( 0, this, SLOT(slotTimerStart())); |
71 | m_started = true; | 71 | m_started = true; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | void SlaveMaster::imageInfo( const QString& str ) { | 75 | void SlaveMaster::imageInfo( const QString& str ) { |
76 | m_inImageInfo.append( str ); | 76 | m_inImageInfo.append( str ); |
77 | if ( !m_started ) { | 77 | if ( !m_started ) { |
78 | QTimer::singleShot( 0, this, SLOT(slotTimerStart())); | 78 | QTimer::singleShot( 0, this, SLOT(slotTimerStart())); |
79 | m_started = true; | 79 | m_started = true; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void SlaveMaster::thumbNail( const QString& str, int w, int h ) { | 83 | void SlaveMaster::thumbNail( const QString& str, int w, int h ) { |
84 | if ( str.isEmpty() ) { | 84 | if ( str.isEmpty() ) { |
85 | owarn << "Asking for empty nail" << oendl; | 85 | owarn << "Asking for empty nail" << oendl; |
86 | return; | 86 | return; |
87 | } | 87 | } |
88 | owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl; | 88 | owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl; |
89 | PixmapInfo item; | 89 | PixmapInfo item; |
90 | item.file = str; item.width = w; item.height = h; | 90 | item.file = str; item.width = w; item.height = h; |
91 | item.pixmap = QPixmap(); | 91 | item.pixmap = QPixmap(); |
92 | m_inThumbNail.append( item ); | 92 | m_inThumbNail.append( item ); |
93 | 93 | ||
94 | if ( !m_started ) { | 94 | if ( !m_started ) { |
95 | QTimer::singleShot( 0, this, SLOT(slotTimerStart())); | 95 | QTimer::singleShot( 0, this, SLOT(slotTimerStart())); |
96 | m_started = true; | 96 | m_started = true; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | void SlaveMaster::recieve( const QCString& str, const QByteArray& at) { | 101 | void SlaveMaster::recieve( const QCString& str, const QByteArray& at) { |
102 | 102 | ||
103 | ImageInfos infos; | 103 | ImageInfos infos; |
104 | PixmapInfos pixinfos; | 104 | PixmapInfos pixinfos; |
105 | 105 | ||
106 | QDataStream stream( at, IO_ReadOnly ); | 106 | QDataStream stream( at, IO_ReadOnly ); |
107 | if ( str == "pixmapsHandled(PixmapList)" ) | 107 | if ( str == "pixmapsHandled(PixmapList)" ) |
108 | stream >> pixinfos; | 108 | stream >> pixinfos; |
109 | else if ( str == "pixmapsHandled(StringList)" ) | 109 | else if ( str == "pixmapsHandled(StringList)" ) |
110 | stream >> infos; | 110 | stream >> infos; |
111 | 111 | ||
112 | owarn << "PixInfos " << pixinfos.count() << "" << oendl; | 112 | owarn << "PixInfos " << pixinfos.count() << "" << oendl; |
113 | 113 | ||
114 | bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() ); | 114 | bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() ); |
115 | if ( got_data ) { | 115 | if ( got_data ) { |
116 | emit sig_start(); | 116 | emit sig_start(); |
117 | for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) { | 117 | for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) { |
118 | if ( (*_it).kind ) | 118 | if ( (*_it).kind ) |
119 | emit sig_fullInfo( (*_it).file, (*_it).info ); | 119 | emit sig_fullInfo( (*_it).file, (*_it).info ); |
120 | else | 120 | else |
121 | emit sig_thumbInfo( (*_it).file, (*_it).info ); | 121 | emit sig_thumbInfo( (*_it).file, (*_it).info ); |
122 | } | 122 | } |
123 | 123 | ||
124 | for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) | 124 | for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) |
125 | emit sig_thumbNail( (*it).file, (*it).pixmap ); | 125 | emit sig_thumbNail( (*it).file, (*it).pixmap ); |
126 | emit sig_end(); | 126 | emit sig_end(); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | void SlaveMaster::slotTimerStart() { | 130 | void SlaveMaster::slotTimerStart() { |
131 | m_started = false; | 131 | m_started = false; |
132 | 132 | ||
133 | if ( !m_inThumbInfo.isEmpty() ) { | 133 | if ( !m_inThumbInfo.isEmpty() ) { |
134 | QCopEnvelope env("QPE/opie-eye_slave", "thumbInfos(QStringList)" ); | 134 | QCopEnvelope env("QPE/opie-eye_slave", "thumbInfos(QStringList)" ); |
135 | env << m_inThumbInfo; | 135 | env << m_inThumbInfo; |
136 | } | 136 | } |
137 | if ( !m_inImageInfo.isEmpty() ) { | 137 | if ( !m_inImageInfo.isEmpty() ) { |
138 | QCopEnvelope env("QPE/opie-eye_slave", "fullInfos(QStringList)" ); | 138 | QCopEnvelope env("QPE/opie-eye_slave", "fullInfos(QStringList)" ); |
139 | env << m_inImageInfo; | 139 | env << m_inImageInfo; |
140 | } | 140 | } |
141 | if ( !m_inThumbNail.isEmpty() ) { | 141 | if ( !m_inThumbNail.isEmpty() ) { |
142 | QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); | 142 | QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); |
143 | env << m_inThumbNail; | 143 | env << m_inThumbNail; |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | m_inThumbInfo.clear(); | 147 | m_inThumbInfo.clear(); |
148 | m_inImageInfo.clear(); | 148 | m_inImageInfo.clear(); |
149 | m_inThumbNail.clear(); | 149 | m_inThumbNail.clear(); |
150 | } | 150 | } |
151 | 151 | ||
152 | QImage SlaveMaster::image( const QString& str, PDirLister::Factor, int ) { | 152 | QImage SlaveMaster::image( const QString& , PDirLister::Factor, int ) { |
153 | return QImage(); | 153 | return QImage(); |
154 | } | 154 | } |
155 | |||
156 | |||
157 | namespace SlaveHelper { | ||
158 | void slaveConnectSignals( QObject* target ) { | ||
159 | SlaveMaster* master = SlaveMaster::self(); | ||
160 | |||
161 | QObject::connect( master, SIGNAL(sig_start()), target, SIGNAL(sig_start()) ); | ||
162 | QObject::connect( master, SIGNAL(sig_end()), target, SIGNAL(sig_end()) ); | ||
163 | QObject::connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | ||
164 | target, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); | ||
165 | QObject::connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
166 | target, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); | ||
167 | QObject::connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | ||
168 | target, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); | ||
169 | } | ||
170 | } | ||
diff --git a/noncore/graphics/opie-eye/lib/slavemaster.h b/noncore/graphics/opie-eye/lib/slavemaster.h index f5284a6..98c3403 100644 --- a/noncore/graphics/opie-eye/lib/slavemaster.h +++ b/noncore/graphics/opie-eye/lib/slavemaster.h | |||
@@ -1,43 +1,53 @@ | |||
1 | #ifndef OPIE_EYE_SLAVE_MASTER_H | 1 | #ifndef OPIE_EYE_SLAVE_MASTER_H |
2 | #define OPIE_EYE_SLAVE_MASTER_H | 2 | #define OPIE_EYE_SLAVE_MASTER_H |
3 | 3 | ||
4 | #include <iface/dirlister.h> | 4 | #include <iface/dirlister.h> |
5 | #include <iface/slaveiface.h> | 5 | #include <iface/slaveiface.h> |
6 | 6 | ||
7 | #include <qobject.h> | 7 | #include <qobject.h> |
8 | #include <qstring.h> | 8 | #include <qstring.h> |
9 | #include <qsize.h> | 9 | #include <qsize.h> |
10 | 10 | ||
11 | namespace SlaveHelper { | ||
12 | /** | ||
13 | * Small Helper to create a SlaveMaster | ||
14 | * and to connect its' signals to the | ||
15 | * object. To use the object as a proxy | ||
16 | */ | ||
17 | void slaveConnectSignals( QObject* ); | ||
18 | } | ||
19 | |||
20 | |||
11 | class SlaveMaster : public QObject { | 21 | class SlaveMaster : public QObject { |
12 | Q_OBJECT | 22 | Q_OBJECT |
13 | typedef QValueList<ImageInfo> ImageInfos; | 23 | typedef QValueList<ImageInfo> ImageInfos; |
14 | typedef QValueList<PixmapInfo> PixmapInfos; | 24 | typedef QValueList<PixmapInfo> PixmapInfos; |
15 | public: | 25 | public: |
16 | static SlaveMaster *self(); | 26 | static SlaveMaster *self(); |
17 | 27 | ||
18 | void thumbInfo( const QString& ); | 28 | void thumbInfo( const QString& ); |
19 | void imageInfo( const QString& ); | 29 | void imageInfo( const QString& ); |
20 | void thumbNail( const QString&, int w, int h ); | 30 | void thumbNail( const QString&, int w, int h ); |
21 | QImage image( const QString&, PDirLister::Factor, int ); | 31 | QImage image( const QString&, PDirLister::Factor, int ); |
22 | signals: | 32 | signals: |
23 | void sig_start(); | 33 | void sig_start(); |
24 | void sig_end(); | 34 | void sig_end(); |
25 | 35 | ||
26 | void sig_thumbInfo( const QString&, const QString& ); | 36 | void sig_thumbInfo( const QString&, const QString& ); |
27 | void sig_fullInfo( const QString&, const QString& ); | 37 | void sig_fullInfo( const QString&, const QString& ); |
28 | void sig_thumbNail( const QString&, const QPixmap& ); | 38 | void sig_thumbNail( const QString&, const QPixmap& ); |
29 | private slots: | 39 | private slots: |
30 | void recieve( const QCString&, const QByteArray& ); | 40 | void recieve( const QCString&, const QByteArray& ); |
31 | void slotTimerStart(); | 41 | void slotTimerStart(); |
32 | private: | 42 | private: |
33 | SlaveMaster(); | 43 | SlaveMaster(); |
34 | ~SlaveMaster(); | 44 | ~SlaveMaster(); |
35 | static SlaveMaster *m_master; | 45 | static SlaveMaster *m_master; |
36 | bool m_started : 1; | 46 | bool m_started : 1; |
37 | QStringList m_inThumbInfo; | 47 | QStringList m_inThumbInfo; |
38 | QStringList m_inImageInfo; | 48 | QStringList m_inImageInfo; |
39 | PixmapInfos m_inThumbNail; | 49 | PixmapInfos m_inThumbNail; |
40 | }; | 50 | }; |
41 | 51 | ||
42 | 52 | ||
43 | #endif | 53 | #endif |
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 0a57a0f..b266f9a 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro | |||
@@ -1,44 +1,23 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | DESTDIR = $(OPIEDIR)/bin | 2 | DESTDIR = $(OPIEDIR)/bin |
3 | TEMPLATE = app | 3 | TEMPLATE = app |
4 | TARGET = opie-eye | 4 | TARGET = opie-eye |
5 | # the name of the resulting object | 5 | # the name of the resulting object |
6 | 6 | ||
7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ | 7 | |
8 | lib/imagecache.h impl/dir/dir_dirview.h \ | 8 | include( gui/gui.pro ) |
9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ | 9 | include( lib/lib.pro ) |
10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ | 10 | include( iface/iface.pro ) |
11 | lib/slavemaster.h \ | 11 | include( impl/doc/doc.pro ) |
12 | iface/slaveiface.h \ | 12 | include( impl/dir/dir.pro ) |
13 | gui/imageinfoui.h \ | 13 | include( impl/dcim/dcim.pro ) |
14 | gui/imageview.h \ | 14 | |
15 | gui/viewmodebutton.h \ | ||
16 | impl/doc/doc_lister.h impl/doc/doc_dirview.h \ | ||
17 | impl/doc/doc_ifaceinfo.h | ||
18 | |||
19 | # A list header files | ||
20 | |||
21 | |||
22 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | ||
23 | lib/imagecache.cpp lib/viewmap.cpp \ | ||
24 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ | ||
25 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | ||
26 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ | ||
27 | gui/imageinfoui.cpp \ | ||
28 | gui/imageview.cpp \ | ||
29 | gui/viewmodebutton.cpp \ | ||
30 | impl/doc/doc_lister.cpp impl/doc/doc_dirview.cpp \ | ||
31 | impl/doc/doc_ifaceinfo.cpp | ||
32 | # A list of source files | ||
33 | |||
34 | INTERFACES = | ||
35 | # list of ui files | ||
36 | 15 | ||
37 | INCLUDEPATH += . $(OPIEDIR)/include | 16 | INCLUDEPATH += . $(OPIEDIR)/include |
38 | DEPENDPATH += $(OPIEDIR)/include | 17 | DEPENDPATH += $(OPIEDIR)/include |
39 | 18 | ||
40 | 19 | ||
41 | 20 | ||
42 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiemm2 | 21 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiemm2 |
43 | 22 | ||
44 | include ( $(OPIEDIR)/include.pro ) | 23 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/graphics/opie-eye/slave/.cvsignore b/noncore/graphics/opie-eye/slave/.cvsignore new file mode 100644 index 0000000..52494fb --- a/dev/null +++ b/noncore/graphics/opie-eye/slave/.cvsignore | |||
@@ -0,0 +1,2 @@ | |||
1 | Makefile | ||
2 | *.moc | ||