-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 31 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/iface/dirlister.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | 28 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.h | 24 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | 57 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h | 21 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 148 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 42 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 8 |
13 files changed, 362 insertions, 17 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 660c4fa..087db30 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -156,462 +156,473 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | |||
156 | m_mode = 0; | 156 | m_mode = 0; |
157 | 157 | ||
158 | QHBox *hbox = new QHBox( this ); | 158 | QHBox *hbox = new QHBox( this ); |
159 | QLabel* lbl = new QLabel( hbox ); | 159 | QLabel* lbl = new QLabel( hbox ); |
160 | lbl->setText( tr("View as" ) ); | 160 | lbl->setText( tr("View as" ) ); |
161 | 161 | ||
162 | m_views = new QComboBox( hbox, "View As" ); | 162 | m_views = new QComboBox( hbox, "View As" ); |
163 | connect( m_views, SIGNAL(activated(int)), | 163 | connect( m_views, SIGNAL(activated(int)), |
164 | this, SLOT(slotViewChanged(int)) ); | 164 | this, SLOT(slotViewChanged(int)) ); |
165 | 165 | ||
166 | m_view= new QIconView( this ); | 166 | m_view= new QIconView( this ); |
167 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 167 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
168 | this, SLOT(slotClicked(QIconViewItem*)) ); | 168 | this, SLOT(slotClicked(QIconViewItem*)) ); |
169 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 169 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
170 | this, SLOT(slotClicked(QIconViewItem*)) ); | 170 | this, SLOT(slotClicked(QIconViewItem*)) ); |
171 | 171 | ||
172 | m_view->setArrangement( QIconView::LeftToRight ); | 172 | m_view->setArrangement( QIconView::LeftToRight ); |
173 | 173 | ||
174 | m_mode = cfg->readNumEntry("ListViewMode", 1); | 174 | m_mode = cfg->readNumEntry("ListViewMode", 1); |
175 | 175 | ||
176 | if (m_mode < 1 || m_mode>3) m_mode = 1; | 176 | if (m_mode < 1 || m_mode>3) m_mode = 1; |
177 | 177 | ||
178 | m_view->setItemTextPos( QIconView::Right ); | 178 | m_view->setItemTextPos( QIconView::Right ); |
179 | 179 | ||
180 | calculateGrid(); | 180 | calculateGrid(); |
181 | 181 | ||
182 | initKeys(); | 182 | initKeys(); |
183 | 183 | ||
184 | loadViews(); | 184 | loadViews(); |
185 | slotViewChanged( m_views->currentItem() ); | 185 | slotViewChanged( m_views->currentItem() ); |
186 | } | 186 | } |
187 | 187 | ||
188 | /* | 188 | /* |
189 | * Unref the slave and save the keyboard manager | 189 | * Unref the slave and save the keyboard manager |
190 | */ | 190 | */ |
191 | PIconView::~PIconView() { | 191 | PIconView::~PIconView() { |
192 | { | 192 | { |
193 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 193 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
194 | } | 194 | } |
195 | m_viewManager->save(); | 195 | m_viewManager->save(); |
196 | delete m_viewManager; | 196 | delete m_viewManager; |
197 | } | 197 | } |
198 | 198 | ||
199 | Opie::Core::OKeyConfigManager* PIconView::manager() { | 199 | Opie::Core::OKeyConfigManager* PIconView::manager() { |
200 | return m_viewManager; | 200 | return m_viewManager; |
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | /* | 204 | /* |
205 | * init the KeyBoard Shortcuts | 205 | * init the KeyBoard Shortcuts |
206 | * called from the c'tor | 206 | * called from the c'tor |
207 | */ | 207 | */ |
208 | void PIconView::initKeys() { | 208 | void PIconView::initKeys() { |
209 | Opie::Core::OKeyPair::List lst; | 209 | Opie::Core::OKeyPair::List lst; |
210 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 210 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
211 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 211 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
212 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 212 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
213 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 213 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
214 | lst.append( Opie::Core::OKeyPair::returnKey() ); | 214 | lst.append( Opie::Core::OKeyPair::returnKey() ); |
215 | 215 | ||
216 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", | 216 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", |
217 | lst, false,this, "keyconfig name" ); | 217 | lst, false,this, "keyconfig name" ); |
218 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 218 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
219 | Resource::loadPixmap("beam"), BeamItem, | 219 | Resource::loadPixmap("beam"), BeamItem, |
220 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), | 220 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), |
221 | this, SLOT(slotBeam())) ); | 221 | this, SLOT(slotBeam())) ); |
222 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", | 222 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", |
223 | Resource::loadPixmap("trash"), DeleteItem, | 223 | Resource::loadPixmap("trash"), DeleteItem, |
224 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), | 224 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), |
225 | this, SLOT(slotTrash())) ); | 225 | this, SLOT(slotTrash())) ); |
226 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", | 226 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", |
227 | Resource::loadPixmap("1to1"), ViewItem, | 227 | Resource::loadPixmap("1to1"), ViewItem, |
228 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 228 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
229 | this, SLOT(slotShowImage()))); | 229 | this, SLOT(slotShowImage()))); |
230 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", | 230 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", |
231 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, | 231 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, |
232 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), | 232 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), |
233 | this, SLOT(slotImageInfo()) ) ); | 233 | this, SLOT(slotImageInfo()) ) ); |
234 | m_viewManager->load(); | 234 | m_viewManager->load(); |
235 | m_viewManager->handleWidget( m_view ); | 235 | m_viewManager->handleWidget( m_view ); |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | /* | 239 | /* |
240 | * change one dir up | 240 | * change one dir up |
241 | */ | 241 | */ |
242 | void PIconView::slotDirUp() { | 242 | void PIconView::slotDirUp() { |
243 | QDir dir( m_path ); | 243 | QDir dir( m_path ); |
244 | dir.cdUp(); | 244 | dir.cdUp(); |
245 | slotChangeDir( dir.absPath() ); | 245 | slotChangeDir( dir.absPath() ); |
246 | } | 246 | } |
247 | 247 | ||
248 | /* | 248 | /* |
249 | * change the dir | 249 | * change the dir |
250 | */ | 250 | */ |
251 | void PIconView::slotChangeDir(const QString& path) { | 251 | void PIconView::slotChangeDir(const QString& path) { |
252 | if ( !currentView() ) | 252 | if ( !currentView() ) |
253 | return; | 253 | return; |
254 | 254 | ||
255 | PDirLister *lister = currentView()->dirLister(); | 255 | PDirLister *lister = currentView()->dirLister(); |
256 | if (!lister ) | 256 | if (!lister ) |
257 | return; | 257 | return; |
258 | 258 | ||
259 | /* | 259 | /* |
260 | * Say what we want and take what we get | 260 | * Say what we want and take what we get |
261 | */ | 261 | */ |
262 | lister->setStartPath( path ); | 262 | lister->setStartPath( path ); |
263 | m_path = lister->currentPath(); | 263 | m_path = lister->currentPath(); |
264 | 264 | ||
265 | m_view->viewport()->setUpdatesEnabled( false ); | 265 | m_view->viewport()->setUpdatesEnabled( false ); |
266 | m_view->clear(); | 266 | m_view->clear(); |
267 | 267 | ||
268 | /* | 268 | /* |
269 | * add files and folders | 269 | * add files and folders |
270 | */ | 270 | */ |
271 | addFolders( lister->folders() ); | 271 | addFolders( lister->folders() ); |
272 | addFiles( lister->files() ); | 272 | addFiles( lister->files() ); |
273 | m_view->viewport()->setUpdatesEnabled( true ); | 273 | m_view->viewport()->setUpdatesEnabled( true ); |
274 | 274 | ||
275 | // Also invalidate the cache. We can't cancel the operations anyway | 275 | // Also invalidate the cache. We can't cancel the operations anyway |
276 | g_stringPix.clear(); | 276 | g_stringPix.clear(); |
277 | g_stringInf.clear(); | 277 | g_stringInf.clear(); |
278 | 278 | ||
279 | // looks ugly | 279 | // looks ugly |
280 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); | 280 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); |
281 | } | 281 | } |
282 | 282 | ||
283 | /** | 283 | /** |
284 | * get the current file name | 284 | * get the current file name |
285 | * @param isDir see if this is a dir or real file | 285 | * @param isDir see if this is a dir or real file |
286 | */ | 286 | */ |
287 | QString PIconView::currentFileName(bool &isDir)const { | 287 | QString PIconView::currentFileName(bool &isDir)const { |
288 | isDir = false; | 288 | isDir = false; |
289 | QIconViewItem* _it = m_view->currentItem(); | 289 | QIconViewItem* _it = m_view->currentItem(); |
290 | if ( !_it ) | 290 | if ( !_it ) |
291 | return QString::null; | 291 | return QString::null; |
292 | 292 | ||
293 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 293 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
294 | isDir = it->isDir(); | 294 | isDir = it->isDir(); |
295 | return it->path(); | 295 | return it->path(); |
296 | } | 296 | } |
297 | 297 | ||
298 | QString PIconView::nextFileName(bool &isDir)const | 298 | QString PIconView::nextFileName(bool &isDir)const |
299 | { | 299 | { |
300 | isDir = false; | 300 | isDir = false; |
301 | QIconViewItem* _it1 = m_view->currentItem(); | 301 | QIconViewItem* _it1 = m_view->currentItem(); |
302 | if ( !_it1 ) | 302 | if ( !_it1 ) |
303 | return QString::null; | 303 | return QString::null; |
304 | QIconViewItem* _it = _it1->nextItem(); | 304 | QIconViewItem* _it = _it1->nextItem(); |
305 | if ( !_it ) | 305 | if ( !_it ) |
306 | return QString::null; | 306 | return QString::null; |
307 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 307 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
308 | isDir = it->isDir(); | 308 | isDir = it->isDir(); |
309 | return it->path(); | 309 | return it->path(); |
310 | } | 310 | } |
311 | 311 | ||
312 | QString PIconView::prevFileName(bool &isDir)const{ | 312 | QString PIconView::prevFileName(bool &isDir)const{ |
313 | isDir = false; | 313 | isDir = false; |
314 | QIconViewItem* _it = m_view->currentItem(); | 314 | QIconViewItem* _it = m_view->currentItem(); |
315 | if ( !_it ) | 315 | if ( !_it ) |
316 | return QString::null; | 316 | return QString::null; |
317 | _it = _it->prevItem(); | 317 | _it = _it->prevItem(); |
318 | if ( !_it ) | 318 | if ( !_it ) |
319 | return QString::null; | 319 | return QString::null; |
320 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 320 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
321 | isDir = it->isDir(); | 321 | isDir = it->isDir(); |
322 | return it->path(); | 322 | return it->path(); |
323 | } | 323 | } |
324 | 324 | ||
325 | void PIconView::slotTrash() { | 325 | void PIconView::slotTrash() { |
326 | bool isDir; | 326 | bool isDir; |
327 | QString pa = currentFileName( isDir ); | 327 | QString pa = currentFileName( isDir ); |
328 | if ( isDir && pa.isEmpty() ) | 328 | if ( isDir && pa.isEmpty() ) |
329 | return; | 329 | return; |
330 | 330 | ||
331 | if (!QPEMessageBox::confirmDelete( this, | 331 | if (!QPEMessageBox::confirmDelete( this, |
332 | tr("Delete Image" ), | 332 | tr("Delete Image" ), |
333 | tr("the Image %1" ).arg(pa))) | 333 | tr("the Image %1" ).arg(pa))) |
334 | return | 334 | return |
335 | 335 | ||
336 | 336 | ||
337 | currentView()->dirLister()->deleteImage( pa ); | 337 | currentView()->dirLister()->deleteImage( pa ); |
338 | delete m_view->currentItem(); | 338 | delete m_view->currentItem(); |
339 | } | 339 | } |
340 | 340 | ||
341 | /* | 341 | /* |
342 | * see what views are available | 342 | * see what views are available |
343 | */ | 343 | */ |
344 | void PIconView::loadViews() { | 344 | void PIconView::loadViews() { |
345 | ViewMap::Iterator it; | 345 | ViewMap::Iterator it; |
346 | ViewMap* map = viewMap(); | 346 | ViewMap* map = viewMap(); |
347 | for ( it = map->begin(); it != map->end(); ++it ) | 347 | for ( it = map->begin(); it != map->end(); ++it ) |
348 | m_views->insertItem( QObject::tr(it.key() ) ); | 348 | m_views->insertItem( it.key() ); |
349 | } | 349 | } |
350 | 350 | ||
351 | void PIconView::resetView() { | 351 | void PIconView::resetView() { |
352 | slotViewChanged(m_views->currentItem()); | 352 | slotViewChanged(m_views->currentItem()); |
353 | } | 353 | } |
354 | 354 | ||
355 | /* | 355 | /* |
356 | *swicth view reloadDir and connect signals | 356 | *swicth view reloadDir and connect signals |
357 | */ | 357 | */ |
358 | void PIconView::slotViewChanged( int i) { | 358 | void PIconView::slotViewChanged( int i) { |
359 | if (!m_views->count() ) { | 359 | if (!m_views->count() ) { |
360 | setCurrentView( 0l); | 360 | setCurrentView( 0l); |
361 | return; | 361 | return; |
362 | } | 362 | } |
363 | 363 | ||
364 | PDirView* cur = currentView(); | 364 | PDirView* cur = currentView(); |
365 | delete cur; | 365 | if (cur) delete cur; |
366 | QString str = m_views->text(i); | 366 | QString str = m_views->text(i); |
367 | cur = (*(*viewMap())[str])(*m_cfg); | 367 | ViewMap* map = viewMap(); |
368 | if (!map) {setCurrentView(0l); return;} | ||
369 | if (map->find(str) == map->end()) { | ||
370 | owarn << "Key not found" << oendl; | ||
371 | setCurrentView(0l); return; | ||
372 | } | ||
373 | cur = (*(*map)[str])(*m_cfg); | ||
368 | setCurrentView( cur ); | 374 | setCurrentView( cur ); |
369 | 375 | ||
370 | /* connect to the signals of the lister */ | 376 | /* connect to the signals of the lister */ |
371 | PDirLister* lis = cur->dirLister(); | 377 | PDirLister* lis = cur->dirLister(); |
372 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), | 378 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), |
373 | this, SLOT( slotThumbInfo(const QString&, const QString&))); | 379 | this, SLOT( slotThumbInfo(const QString&, const QString&))); |
374 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 380 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
375 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 381 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
376 | connect(lis, SIGNAL(sig_start()), | 382 | connect(lis, SIGNAL(sig_start()), |
377 | this, SLOT(slotStart())); | 383 | this, SLOT(slotStart())); |
378 | connect(lis, SIGNAL(sig_end()) , | 384 | connect(lis, SIGNAL(sig_end()) , |
379 | this, SLOT(slotEnd()) ); | 385 | this, SLOT(slotEnd()) ); |
380 | 386 | ||
381 | 387 | ||
382 | /* reload now */ | 388 | /* reload now */ |
383 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); | 389 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); |
384 | } | 390 | } |
385 | 391 | ||
386 | 392 | ||
387 | void PIconView::slotReloadDir() { | 393 | void PIconView::slotReloadDir() { |
388 | slotChangeDir( m_path ); | 394 | slotChangeDir( m_path ); |
389 | } | 395 | } |
390 | 396 | ||
391 | 397 | ||
392 | /* | 398 | /* |
393 | * add files and folders | 399 | * add files and folders |
394 | */ | 400 | */ |
395 | void PIconView::addFolders( const QStringList& lst) { | 401 | void PIconView::addFolders( const QStringList& lst) { |
396 | QStringList::ConstIterator it; | 402 | QStringList::ConstIterator it; |
397 | IconViewItem * _iv; | 403 | IconViewItem * _iv; |
398 | 404 | ||
399 | for(it=lst.begin(); it != lst.end(); ++it ) { | 405 | for(it=lst.begin(); it != lst.end(); ++it ) { |
400 | _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); | 406 | _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); |
401 | if (m_mode==3) _iv->setTextOnly(true); | 407 | if (m_mode==3) _iv->setTextOnly(true); |
402 | } | 408 | } |
403 | } | 409 | } |
404 | 410 | ||
405 | void PIconView::addFiles( const QStringList& lst) { | 411 | void PIconView::addFiles( const QStringList& lst) { |
406 | QStringList::ConstIterator it; | 412 | QStringList::ConstIterator it; |
407 | IconViewItem * _iv; | 413 | IconViewItem * _iv; |
408 | QPixmap*m_pix = 0; | 414 | QPixmap*m_pix = 0; |
415 | QString pre = ""; | ||
416 | if (!m_path.isEmpty()) { | ||
417 | pre = m_path+"/"; | ||
418 | } | ||
409 | for (it=lst.begin(); it!= lst.end(); ++it ) { | 419 | for (it=lst.begin(); it!= lst.end(); ++it ) { |
410 | m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 ); | 420 | m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); |
411 | _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); | 421 | _iv = new IconViewItem( m_view, pre+(*it), (*it) ); |
412 | if (m_mode==3) { | 422 | if (m_mode==3) { |
413 | _iv->setTextOnly(true); | 423 | _iv->setTextOnly(true); |
414 | _iv->setPixmap(QPixmap()); | 424 | _iv->setPixmap(QPixmap()); |
415 | } else { | 425 | } else { |
416 | if (m_pix) _iv->setPixmap(*m_pix); | 426 | if (m_pix) _iv->setPixmap(*m_pix); |
417 | } | 427 | } |
418 | } | 428 | } |
419 | 429 | ||
420 | } | 430 | } |
421 | 431 | ||
422 | /* | 432 | /* |
423 | * user clicked on the item. Change dir or view | 433 | * user clicked on the item. Change dir or view |
424 | */ | 434 | */ |
425 | void PIconView::slotClicked(QIconViewItem* _it) { | 435 | void PIconView::slotClicked(QIconViewItem* _it) { |
426 | if(!_it ) | 436 | if(!_it ) |
427 | return; | 437 | return; |
428 | 438 | ||
429 | IconViewItem* it = static_cast<IconViewItem*>(_it); | 439 | IconViewItem* it = static_cast<IconViewItem*>(_it); |
430 | if( it->isDir() ) | 440 | if( it->isDir() ) |
431 | slotChangeDir( it->path() ); | 441 | slotChangeDir( it->path() ); |
432 | else // view image | 442 | else // view image |
433 | slotShowImage(); | 443 | slotShowImage(); |
434 | } | 444 | } |
435 | 445 | ||
436 | /* | 446 | /* |
437 | * got thumb info add to the cache if items is visible | 447 | * got thumb info add to the cache if items is visible |
438 | * we later need update after processing of slave is done | 448 | * we later need update after processing of slave is done |
439 | */ | 449 | */ |
440 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | 450 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { |
441 | IconViewItem* item = g_stringInf[_path]; | 451 | IconViewItem* item = g_stringInf[_path]; |
442 | if (!item ) | 452 | if (!item ) |
443 | return; | 453 | return; |
444 | 454 | ||
445 | if (m_mode == 2) { | 455 | if (m_mode == 2) { |
446 | return; | 456 | return; |
447 | } | 457 | } |
448 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 458 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
449 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 459 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
450 | m_updatet = true; | 460 | m_updatet = true; |
451 | 461 | ||
452 | item->setText( str ); | 462 | item->setText( str ); |
453 | g_stringInf.remove( _path ); | 463 | g_stringInf.remove( _path ); |
454 | } | 464 | } |
455 | 465 | ||
456 | /* | 466 | /* |
457 | * got thumbnail and see if it is visible so we need to update later | 467 | * got thumbnail and see if it is visible so we need to update later |
458 | */ | 468 | */ |
459 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | 469 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { |
460 | IconViewItem* item = g_stringPix[_path]; | 470 | IconViewItem* item = g_stringPix[_path]; |
461 | if (!item ) | 471 | if (!item ) |
462 | return; | 472 | return; |
463 | 473 | ||
464 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 474 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
465 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 475 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
466 | m_updatet = true; | 476 | m_updatet = true; |
467 | 477 | ||
468 | if (pix.width()>0) { | 478 | if (pix.width()>0) { |
469 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); | 479 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); |
470 | item->setPixmap(pix,true); | 480 | item->setPixmap(pix,true); |
471 | } else { | 481 | } else { |
472 | PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 ); | 482 | PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 ); |
473 | } | 483 | } |
474 | g_stringPix.remove( _path ); | 484 | g_stringPix.remove( _path ); |
475 | } | 485 | } |
476 | 486 | ||
477 | 487 | ||
478 | /* | 488 | /* |
479 | * FIXME rename | 489 | * FIXME rename |
480 | */ | 490 | */ |
481 | void PIconView::slotRename() { | 491 | void PIconView::slotRename() { |
482 | 492 | ||
483 | } | 493 | } |
484 | 494 | ||
485 | 495 | ||
486 | /* | 496 | /* |
487 | * BEAM the current file | 497 | * BEAM the current file |
488 | */ | 498 | */ |
489 | void PIconView::slotBeam() { | 499 | void PIconView::slotBeam() { |
490 | bool isDir; | 500 | bool isDir; |
491 | QString pa = currentFileName( isDir ); | 501 | QString pa = currentFileName( isDir ); |
492 | if ( isDir && pa.isEmpty() ) | 502 | if ( isDir && pa.isEmpty() ) |
493 | return; | 503 | return; |
494 | 504 | ||
495 | Ir* ir = new Ir( this ); | 505 | Ir* ir = new Ir( this ); |
496 | connect( ir, SIGNAL(done(Ir*)), | 506 | connect( ir, SIGNAL(done(Ir*)), |
497 | this, SLOT(slotBeamDone(Ir*))); | 507 | this, SLOT(slotBeamDone(Ir*))); |
498 | ir->send(pa, tr( "Image" ) ); | 508 | ir->send(pa, tr( "Image" ) ); |
499 | } | 509 | } |
500 | 510 | ||
501 | /* | 511 | /* |
502 | * BEAM done clean up | 512 | * BEAM done clean up |
503 | */ | 513 | */ |
504 | void PIconView::slotBeamDone( Ir* ir) { | 514 | void PIconView::slotBeamDone( Ir* ir) { |
505 | delete ir; | 515 | delete ir; |
506 | } | 516 | } |
507 | 517 | ||
508 | void PIconView::slotStart() { | 518 | void PIconView::slotStart() { |
509 | m_view->viewport()->setUpdatesEnabled( false ); | 519 | m_view->viewport()->setUpdatesEnabled( false ); |
510 | } | 520 | } |
511 | 521 | ||
512 | void PIconView::slotEnd() { | 522 | void PIconView::slotEnd() { |
513 | if ( m_updatet ) | 523 | if ( m_updatet ) |
514 | m_view->arrangeItemsInGrid( ); | 524 | m_view->arrangeItemsInGrid( ); |
515 | m_view->viewport()->setUpdatesEnabled( true ); | 525 | m_view->viewport()->setUpdatesEnabled( true ); |
516 | m_updatet = false; | 526 | m_updatet = false; |
517 | } | 527 | } |
518 | 528 | ||
519 | void PIconView::slotShowNext() | 529 | void PIconView::slotShowNext() |
520 | { | 530 | { |
521 | bool isDir = false; | 531 | bool isDir = false; |
522 | QString name = nextFileName(isDir); | 532 | QString name = nextFileName(isDir); |
523 | if (name.isEmpty()) return; | 533 | if (name.isEmpty()) return; |
524 | if (isDir) return; | 534 | if (isDir) return; |
525 | /* if we got a name we have a next item */ | 535 | /* if we got a name we have a next item */ |
526 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); | 536 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); |
527 | slotShowImage(name); | 537 | slotShowImage(name); |
528 | } | 538 | } |
529 | 539 | ||
530 | void PIconView::slotShowPrev() | 540 | void PIconView::slotShowPrev() |
531 | { | 541 | { |
532 | bool isDir = false; | 542 | bool isDir = false; |
533 | QString name = prevFileName(isDir); | 543 | QString name = prevFileName(isDir); |
534 | if (name.isEmpty()) return; | 544 | if (name.isEmpty()) return; |
535 | if (isDir) return; | 545 | if (isDir) return; |
536 | /* if we got a name we have a prev item */ | 546 | /* if we got a name we have a prev item */ |
537 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); | 547 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); |
538 | slotShowImage(name); | 548 | slotShowImage(name); |
539 | } | 549 | } |
540 | 550 | ||
541 | void PIconView::slotShowImage() | 551 | void PIconView::slotShowImage() |
542 | { | 552 | { |
543 | bool isDir = false; | 553 | bool isDir = false; |
544 | QString name = currentFileName(isDir); | 554 | QString name = currentFileName(isDir); |
545 | if (isDir) return; | 555 | if (isDir) return; |
546 | |||
547 | slotShowImage( name ); | 556 | slotShowImage( name ); |
548 | } | 557 | } |
549 | void PIconView::slotShowImage( const QString& name) { | 558 | void PIconView::slotShowImage( const QString& name) { |
550 | emit sig_display( name ); | 559 | PDirLister *lister = currentView()->dirLister(); |
560 | QString r_name = lister->nameToFname(name); | ||
561 | emit sig_display( r_name ); | ||
551 | } | 562 | } |
552 | void PIconView::slotImageInfo() { | 563 | void PIconView::slotImageInfo() { |
553 | bool isDir = false; | 564 | bool isDir = false; |
554 | QString name = currentFileName(isDir); | 565 | QString name = currentFileName(isDir); |
555 | if (isDir) return; | 566 | if (isDir) return; |
556 | 567 | ||
557 | slotImageInfo( name ); | 568 | slotImageInfo( name ); |
558 | } | 569 | } |
559 | 570 | ||
560 | void PIconView::slotImageInfo( const QString& name) { | 571 | void PIconView::slotImageInfo( const QString& name) { |
561 | emit sig_showInfo( name ); | 572 | PDirLister *lister = currentView()->dirLister(); |
573 | QString r_name = lister->nameToFname(name); | ||
574 | emit sig_showInfo(r_name ); | ||
562 | } | 575 | } |
563 | 576 | ||
564 | 577 | ||
565 | void PIconView::slotChangeMode( int mode ) { | 578 | void PIconView::slotChangeMode( int mode ) { |
566 | if ( mode >= 1 && mode <= 3 ) | 579 | if ( mode >= 1 && mode <= 3 ) |
567 | m_mode = mode; | 580 | m_mode = mode; |
568 | 581 | ||
569 | m_cfg->writeEntry("ListViewMode", m_mode); | 582 | m_cfg->writeEntry("ListViewMode", m_mode); |
570 | calculateGrid(); | 583 | calculateGrid(); |
571 | slotReloadDir(); | 584 | slotReloadDir(); |
572 | } | 585 | } |
573 | 586 | ||
574 | 587 | ||
575 | void PIconView::resizeEvent( QResizeEvent* re ) { | 588 | void PIconView::resizeEvent( QResizeEvent* re ) { |
576 | QVBox::resizeEvent( re ); | 589 | QVBox::resizeEvent( re ); |
577 | calculateGrid(); | 590 | calculateGrid(); |
578 | } | 591 | } |
579 | 592 | ||
580 | 593 | ||
581 | void PIconView::calculateGrid() { | 594 | void PIconView::calculateGrid() { |
582 | odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; | ||
583 | odebug << "Size of view: " << m_view->size() << oendl; | ||
584 | int dw = QApplication::desktop()->width(); | 595 | int dw = QApplication::desktop()->width(); |
585 | int viewerWidth = dw-style().scrollBarExtent().width(); | 596 | int viewerWidth = dw-style().scrollBarExtent().width(); |
586 | 597 | ||
587 | QIconView::ItemTextPos pos; | 598 | QIconView::ItemTextPos pos; |
588 | switch( m_mode ) { | 599 | switch( m_mode ) { |
589 | case 2: | 600 | case 2: |
590 | pos = QIconView::Bottom; | 601 | pos = QIconView::Bottom; |
591 | break; | 602 | break; |
592 | case 3: | 603 | case 3: |
593 | case 1: | 604 | case 1: |
594 | default: | 605 | default: |
595 | pos = QIconView::Right; | 606 | pos = QIconView::Right; |
596 | break; | 607 | break; |
597 | } | 608 | } |
598 | m_view->setItemTextPos( pos ); | 609 | m_view->setItemTextPos( pos ); |
599 | switch (m_mode) { | 610 | switch (m_mode) { |
600 | case 2: | 611 | case 2: |
601 | m_view->setGridX(50); | 612 | m_view->setGridX(50); |
602 | m_view->setGridY(20); | 613 | m_view->setGridY(20); |
603 | PPixmapCache::self()->setMaxImages(40); | 614 | PPixmapCache::self()->setMaxImages(40); |
604 | break; | 615 | break; |
605 | case 3: | 616 | case 3: |
606 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); | 617 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); |
607 | m_view->setGridY(8); | 618 | m_view->setGridY(8); |
608 | PPixmapCache::self()->setMaxImages(2); | 619 | PPixmapCache::self()->setMaxImages(2); |
609 | break; | 620 | break; |
610 | case 1: | 621 | case 1: |
611 | default: | 622 | default: |
612 | m_view->setGridX( viewerWidth-3*m_view->spacing()); | 623 | m_view->setGridX( viewerWidth-3*m_view->spacing()); |
613 | m_view->setGridY( fontMetrics().height()*2+40 ); | 624 | m_view->setGridY( fontMetrics().height()*2+40 ); |
614 | PPixmapCache::self()->setMaxImages(20); | 625 | PPixmapCache::self()->setMaxImages(20); |
615 | break; | 626 | break; |
616 | } | 627 | } |
617 | } | 628 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 58f02ef..058fca0 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -1,229 +1,230 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include "imageview.h" | 6 | #include "imageview.h" |
7 | 7 | ||
8 | #include "iconview.h" | 8 | #include "iconview.h" |
9 | #include "filesystem.h" | 9 | #include "filesystem.h" |
10 | #include "imageinfoui.h" | 10 | #include "imageinfoui.h" |
11 | #include "viewmodebutton.h" | 11 | #include "viewmodebutton.h" |
12 | 12 | ||
13 | #include <iface/ifaceinfo.h> | 13 | #include <iface/ifaceinfo.h> |
14 | #include <iface/dirview.h> | 14 | #include <iface/dirview.h> |
15 | 15 | ||
16 | #include <opie2/odebug.h> | 16 | #include <opie2/odebug.h> |
17 | #include <opie2/owidgetstack.h> | 17 | #include <opie2/owidgetstack.h> |
18 | #include <opie2/oapplicationfactory.h> | 18 | #include <opie2/oapplicationfactory.h> |
19 | #include <opie2/otabwidget.h> | 19 | #include <opie2/otabwidget.h> |
20 | #include <opie2/okeyconfigwidget.h> | 20 | #include <opie2/okeyconfigwidget.h> |
21 | 21 | ||
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/ir.h> | 24 | #include <qpe/ir.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | 26 | ||
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qdialog.h> | 30 | #include <qdialog.h> |
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qframe.h> | 33 | #include <qframe.h> |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 37 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
38 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | ||
38 | 39 | ||
39 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 40 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
40 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 41 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
41 | { | 42 | { |
42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 43 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
43 | m_cfg = new Opie::Core::OConfig("phunkview"); | 44 | m_cfg = new Opie::Core::OConfig("phunkview"); |
44 | m_cfg->setGroup("Zecke_view" ); | 45 | m_cfg->setGroup("Zecke_view" ); |
45 | tFrame = 0; | 46 | tFrame = 0; |
46 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); | 47 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); |
47 | /* | 48 | /* |
48 | * Initialize ToolBar and IconView | 49 | * Initialize ToolBar and IconView |
49 | * And Connect Them | 50 | * And Connect Them |
50 | */ | 51 | */ |
51 | QToolBar *bar = new QToolBar( this ); | 52 | QToolBar *bar = new QToolBar( this ); |
52 | bar->setHorizontalStretchable( true ); | 53 | bar->setHorizontalStretchable( true ); |
53 | setToolBarsMovable( false ); | 54 | setToolBarsMovable( false ); |
54 | 55 | ||
55 | m_stack = new Opie::Ui::OWidgetStack( this ); | 56 | m_stack = new Opie::Ui::OWidgetStack( this ); |
56 | setCentralWidget( m_stack ); | 57 | setCentralWidget( m_stack ); |
57 | 58 | ||
58 | m_view = new PIconView( m_stack, m_cfg ); | 59 | m_view = new PIconView( m_stack, m_cfg ); |
59 | m_stack->addWidget( m_view, IconView ); | 60 | m_stack->addWidget( m_view, IconView ); |
60 | m_stack->raiseWidget( IconView ); | 61 | m_stack->raiseWidget( IconView ); |
61 | connect(m_view, SIGNAL(sig_display(const QString&)), | 62 | connect(m_view, SIGNAL(sig_display(const QString&)), |
62 | this, SLOT(slotDisplay(const QString&))); | 63 | this, SLOT(slotDisplay(const QString&))); |
63 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 64 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
64 | this, SLOT(slotShowInfo(const QString&)) ); | 65 | this, SLOT(slotShowInfo(const QString&)) ); |
65 | 66 | ||
66 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 67 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
67 | 68 | ||
68 | upButton = new QToolButton( bar ); | 69 | upButton = new QToolButton( bar ); |
69 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); | 70 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); |
70 | connect( upButton, SIGNAL(clicked()), | 71 | connect( upButton, SIGNAL(clicked()), |
71 | m_view, SLOT(slotDirUp()) ); | 72 | m_view, SLOT(slotDirUp()) ); |
72 | 73 | ||
73 | fsButton = new PFileSystem( bar ); | 74 | fsButton = new PFileSystem( bar ); |
74 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 75 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
75 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 76 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
76 | 77 | ||
77 | QToolButton*btn = new QToolButton( bar ); | 78 | QToolButton*btn = new QToolButton( bar ); |
78 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); | 79 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); |
79 | connect( btn, SIGNAL(clicked()), | 80 | connect( btn, SIGNAL(clicked()), |
80 | m_view, SLOT(slotRename()) ); | 81 | m_view, SLOT(slotRename()) ); |
81 | 82 | ||
82 | if ( Ir::supported() ) { | 83 | if ( Ir::supported() ) { |
83 | btn = new QToolButton( bar ); | 84 | btn = new QToolButton( bar ); |
84 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); | 85 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); |
85 | connect( btn, SIGNAL(clicked()), | 86 | connect( btn, SIGNAL(clicked()), |
86 | m_view, SLOT(slotBeam()) ); | 87 | m_view, SLOT(slotBeam()) ); |
87 | } | 88 | } |
88 | 89 | ||
89 | btn = new QToolButton( bar ); | 90 | btn = new QToolButton( bar ); |
90 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); | 91 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); |
91 | connect( btn, SIGNAL(clicked() ), | 92 | connect( btn, SIGNAL(clicked() ), |
92 | m_view, SLOT(slotTrash() ) ); | 93 | m_view, SLOT(slotTrash() ) ); |
93 | 94 | ||
94 | 95 | ||
95 | int mode = m_cfg->readNumEntry("ListViewMode", 1); | 96 | int mode = m_cfg->readNumEntry("ListViewMode", 1); |
96 | if (mode < 1 || mode>3) mode = 1; | 97 | if (mode < 1 || mode>3) mode = 1; |
97 | viewModeButton = new ViewModeButton( bar,mode ); | 98 | viewModeButton = new ViewModeButton( bar,mode ); |
98 | connect( viewModeButton, SIGNAL(changeMode(int)), | 99 | connect( viewModeButton, SIGNAL(changeMode(int)), |
99 | m_view, SLOT(slotChangeMode(int))); | 100 | m_view, SLOT(slotChangeMode(int))); |
100 | 101 | ||
101 | btn = new QToolButton( bar ); | 102 | btn = new QToolButton( bar ); |
102 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | 103 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); |
103 | connect( btn, SIGNAL(clicked() ), | 104 | connect( btn, SIGNAL(clicked() ), |
104 | this, SLOT(slotConfig() ) ); | 105 | this, SLOT(slotConfig() ) ); |
105 | 106 | ||
106 | 107 | ||
107 | 108 | ||
108 | prevButton = new QToolButton(bar); | 109 | prevButton = new QToolButton(bar); |
109 | prevButton->setIconSet( Resource::loadIconSet( "back" ) ); | 110 | prevButton->setIconSet( Resource::loadIconSet( "back" ) ); |
110 | connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); | 111 | connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); |
111 | 112 | ||
112 | nextButton = new QToolButton(bar); | 113 | nextButton = new QToolButton(bar); |
113 | nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); | 114 | nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); |
114 | connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); | 115 | connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); |
115 | 116 | ||
116 | rotateButton = new QToolButton(bar); | 117 | rotateButton = new QToolButton(bar); |
117 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); | 118 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); |
118 | rotateButton->setToggleButton(true); | 119 | rotateButton->setToggleButton(true); |
119 | 120 | ||
120 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 121 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
121 | rotateButton->setOn(true); | 122 | rotateButton->setOn(true); |
122 | autoRotate = true; | 123 | autoRotate = true; |
123 | prevButton->hide(); | 124 | prevButton->hide(); |
124 | nextButton->hide(); | 125 | nextButton->hide(); |
125 | } else { | 126 | } else { |
126 | rotateButton->setOn(false); | 127 | rotateButton->setOn(false); |
127 | autoRotate = false; | 128 | autoRotate = false; |
128 | } | 129 | } |
129 | 130 | ||
130 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 131 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
131 | 132 | ||
132 | scaleButton = new QToolButton(bar); | 133 | scaleButton = new QToolButton(bar); |
133 | scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); | 134 | scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); |
134 | scaleButton->setToggleButton(true); | 135 | scaleButton->setToggleButton(true); |
135 | scaleButton->setOn(false); | 136 | scaleButton->setOn(false); |
136 | connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 137 | connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
137 | autoScale = true; | 138 | autoScale = true; |
138 | 139 | ||
139 | zoomButton = new QToolButton(bar); | 140 | zoomButton = new QToolButton(bar); |
140 | zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); | 141 | zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); |
141 | zoomButton->setToggleButton(true); | 142 | zoomButton->setToggleButton(true); |
142 | zoomButton->setOn(true); | 143 | zoomButton->setOn(true); |
143 | connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 144 | connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
144 | zoomerOn = true; | 145 | zoomerOn = true; |
145 | } | 146 | } |
146 | 147 | ||
147 | PMainWindow::~PMainWindow() { | 148 | PMainWindow::~PMainWindow() { |
148 | odebug << "Shutting down" << oendl; | 149 | odebug << "Shutting down" << oendl; |
149 | if (tFrame) delete tFrame; | 150 | if (tFrame) delete tFrame; |
150 | odebug << "Shutting down done" << oendl; | 151 | odebug << "Shutting down done" << oendl; |
151 | } | 152 | } |
152 | 153 | ||
153 | void PMainWindow::slotToggleZoomer() | 154 | void PMainWindow::slotToggleZoomer() |
154 | { | 155 | { |
155 | if (!m_disp) return; | 156 | if (!m_disp) return; |
156 | bool cur = zoomButton->isOn(); | 157 | bool cur = zoomButton->isOn(); |
157 | zoomButton->setOn(!cur); | 158 | zoomButton->setOn(!cur); |
158 | } | 159 | } |
159 | 160 | ||
160 | void PMainWindow::slotZoomerToggled(bool how) | 161 | void PMainWindow::slotZoomerToggled(bool how) |
161 | { | 162 | { |
162 | zoomerOn = how; | 163 | zoomerOn = how; |
163 | if (m_disp) { | 164 | if (m_disp) { |
164 | m_disp->setShowZoomer(zoomerOn); | 165 | m_disp->setShowZoomer(zoomerOn); |
165 | } | 166 | } |
166 | } | 167 | } |
167 | 168 | ||
168 | void PMainWindow::slotToggleAutorotate() | 169 | void PMainWindow::slotToggleAutorotate() |
169 | { | 170 | { |
170 | if (!m_disp) return; | 171 | if (!m_disp) return; |
171 | if (!rotateButton->isEnabled()) return; | 172 | if (!rotateButton->isEnabled()) return; |
172 | bool cur = rotateButton->isOn(); | 173 | bool cur = rotateButton->isOn(); |
173 | rotateButton->setOn(!cur); | 174 | rotateButton->setOn(!cur); |
174 | } | 175 | } |
175 | 176 | ||
176 | void PMainWindow::slotToggleAutoscale() | 177 | void PMainWindow::slotToggleAutoscale() |
177 | { | 178 | { |
178 | if (!m_disp) return; | 179 | if (!m_disp) return; |
179 | bool cur = scaleButton->isOn(); | 180 | bool cur = scaleButton->isOn(); |
180 | scaleButton->setOn(!cur); | 181 | scaleButton->setOn(!cur); |
181 | } | 182 | } |
182 | 183 | ||
183 | void PMainWindow::slotRotateToggled(bool how) | 184 | void PMainWindow::slotRotateToggled(bool how) |
184 | { | 185 | { |
185 | autoRotate = how; | 186 | autoRotate = how; |
186 | if (m_disp) { | 187 | if (m_disp) { |
187 | m_disp->setAutoRotate(how); | 188 | m_disp->setAutoRotate(how); |
188 | } | 189 | } |
189 | } | 190 | } |
190 | 191 | ||
191 | void PMainWindow::slotScaleToggled(bool how) | 192 | void PMainWindow::slotScaleToggled(bool how) |
192 | { | 193 | { |
193 | autoScale = !how; | 194 | autoScale = !how; |
194 | if (!how) { | 195 | if (!how) { |
195 | autoRotate = how; | 196 | autoRotate = how; |
196 | } | 197 | } |
197 | if (m_disp) { | 198 | if (m_disp) { |
198 | m_disp->setAutoScaleRotate(autoScale,autoRotate); | 199 | m_disp->setAutoScaleRotate(autoScale,autoRotate); |
199 | } | 200 | } |
200 | if (!autoScale) { | 201 | if (!autoScale) { |
201 | rotateButton->setOn(false); | 202 | rotateButton->setOn(false); |
202 | } | 203 | } |
203 | rotateButton->setEnabled(!how); | 204 | rotateButton->setEnabled(!how); |
204 | } | 205 | } |
205 | 206 | ||
206 | void PMainWindow::slotConfig() { | 207 | void PMainWindow::slotConfig() { |
207 | /* | 208 | /* |
208 | * have a tab with the possible views | 209 | * have a tab with the possible views |
209 | * a tab for globals image cache size.. scaled loading | 210 | * a tab for globals image cache size.. scaled loading |
210 | * and one tab for the KeyConfigs | 211 | * and one tab for the KeyConfigs |
211 | */ | 212 | */ |
212 | QDialog dlg(this, 0, true); | 213 | QDialog dlg(this, 0, true); |
213 | dlg.setCaption( tr("Phunk View - Config" ) ); | 214 | dlg.setCaption( tr("Phunk View - Config" ) ); |
214 | 215 | ||
215 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 216 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
216 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 217 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
217 | lay->addWidget( wid ); | 218 | lay->addWidget( wid ); |
218 | ViewMap *vM = viewMap(); | 219 | ViewMap *vM = viewMap(); |
219 | ViewMap::Iterator _it = vM->begin(); | 220 | ViewMap::Iterator _it = vM->begin(); |
220 | QMap<PDirView*, QWidget*> lst; | 221 | QMap<PDirView*, QWidget*> lst; |
221 | 222 | ||
222 | for( ; _it != vM->end(); ++_it ) { | 223 | for( ; _it != vM->end(); ++_it ) { |
223 | PDirView *view = (_it.data())(*m_cfg); | 224 | PDirView *view = (_it.data())(*m_cfg); |
224 | PInterfaceInfo *inf = view->interfaceInfo(); | 225 | PInterfaceInfo *inf = view->interfaceInfo(); |
225 | QWidget *_wid = inf->configWidget( *m_cfg ); | 226 | QWidget *_wid = inf->configWidget( *m_cfg ); |
226 | _wid->reparent(wid, QPoint() ); | 227 | _wid->reparent(wid, QPoint() ); |
227 | lst.insert( view, _wid ); | 228 | lst.insert( view, _wid ); |
228 | wid->addTab( _wid, "fileopen", inf->name() ); | 229 | wid->addTab( _wid, "fileopen", inf->name() ); |
229 | } | 230 | } |
diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h index fcc55ec..9c7b2a9 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.h +++ b/noncore/graphics/opie-eye/iface/dirlister.h | |||
@@ -1,47 +1,48 @@ | |||
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 | public slots: | 26 | public slots: |
27 | virtual void deleteImage( const QString& ) = 0; | 27 | virtual void deleteImage( const QString& ) = 0; |
28 | virtual void imageInfo( const QString&) = 0; | 28 | virtual void imageInfo( const QString&) = 0; |
29 | virtual void fullImageInfo( const QString& ) = 0; | 29 | virtual void fullImageInfo( const QString& ) = 0; |
30 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; | 30 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; |
31 | virtual QImage image( const QString&, Factor, int max = 0) = 0; | 31 | virtual QImage image( const QString&, Factor, int max = 0) = 0; |
32 | virtual QString nameToFname(const QString&name)const = 0; | ||
32 | 33 | ||
33 | signals: | 34 | signals: |
34 | void sig_dirchanged(); | 35 | void sig_dirchanged(); |
35 | void sig_filechanged(); | 36 | void sig_filechanged(); |
36 | void sig_start(); | 37 | void sig_start(); |
37 | void sig_end(); | 38 | void sig_end(); |
38 | // If this app ever happens to get multithreaded... | 39 | // If this app ever happens to get multithreaded... |
39 | void sig_thumbInfo( const QString&, const QString& ); | 40 | void sig_thumbInfo( const QString&, const QString& ); |
40 | void sig_fullInfo( const QString&, const QString& ); | 41 | void sig_fullInfo( const QString&, const QString& ); |
41 | void sig_thumbNail( const QString&, const QPixmap& ); | 42 | void sig_thumbNail( const QString&, const QPixmap& ); |
42 | 43 | ||
43 | protected: | 44 | protected: |
44 | ~PDirLister(); | 45 | virtual ~PDirLister(); |
45 | }; | 46 | }; |
46 | 47 | ||
47 | #endif | 48 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h index 8c6262f..c919dde 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h | |||
@@ -1,21 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 | 2 | * GPLv2 |
3 | * zecke@handhelds.org | 3 | * zecke@handhelds.org |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef DIR_IFACE_INFO_H | 6 | #ifndef DIR_IFACE_INFO_H |
7 | #define DIR_IFACE_INFO_H | 7 | #define DIR_IFACE_INFO_H |
8 | 8 | ||
9 | #include <iface/ifaceinfo.h>s | 9 | #include <iface/ifaceinfo.h> |
10 | 10 | ||
11 | class DirInterfaceInfo : public PInterfaceInfo { | 11 | class DirInterfaceInfo : public PInterfaceInfo { |
12 | public: | 12 | public: |
13 | DirInterfaceInfo(); | 13 | DirInterfaceInfo(); |
14 | ~DirInterfaceInfo(); | 14 | virtual ~DirInterfaceInfo(); |
15 | 15 | ||
16 | QString name()const; | 16 | QString name()const; |
17 | QWidget* configWidget(const Config&); | 17 | QWidget* configWidget(const Config&); |
18 | void writeConfig( QWidget* wid, Config& ); | 18 | void writeConfig( QWidget* wid, Config& ); |
19 | }; | 19 | }; |
20 | 20 | ||
21 | #endif | 21 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index 16758d7..3717297 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | |||
@@ -1,97 +1,102 @@ | |||
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 | ||
25 | SlaveMaster* master = SlaveMaster::self(); | 25 | SlaveMaster* master = SlaveMaster::self(); |
26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
29 | this, 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&)), | 30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
31 | this, 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&)), | 32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
33 | this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); | 33 | this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | QString Dir_DirLister::defaultPath()const { | 37 | QString Dir_DirLister::defaultPath()const { |
38 | return QPEApplication::documentDir(); | 38 | return QPEApplication::documentDir(); |
39 | } | 39 | } |
40 | 40 | ||
41 | QString Dir_DirLister::setStartPath( const QString& path ) { | 41 | QString Dir_DirLister::setStartPath( const QString& path ) { |
42 | m_currentDir.cd( path ); | 42 | m_currentDir.cd( path ); |
43 | if (!m_currentDir.exists() ) | 43 | if (!m_currentDir.exists() ) |
44 | m_currentDir.cd(defaultPath()); | 44 | m_currentDir.cd(defaultPath()); |
45 | 45 | ||
46 | 46 | ||
47 | return m_currentDir.absPath(); | 47 | return m_currentDir.absPath(); |
48 | } | 48 | } |
49 | 49 | ||
50 | QString Dir_DirLister::currentPath()const { | 50 | QString Dir_DirLister::currentPath()const { |
51 | return m_currentDir.absPath(); | 51 | return m_currentDir.absPath(); |
52 | } | 52 | } |
53 | 53 | ||
54 | 54 | ||
55 | QStringList Dir_DirLister::folders()const { | 55 | QStringList Dir_DirLister::folders()const { |
56 | return m_currentDir.entryList( QDir::Dirs ); | 56 | return m_currentDir.entryList( QDir::Dirs ); |
57 | } | 57 | } |
58 | 58 | ||
59 | QStringList Dir_DirLister::files()const { | 59 | QStringList Dir_DirLister::files()const { |
60 | if ( m_allFiles ) | 60 | if ( m_allFiles ) |
61 | return m_currentDir.entryList( QDir::Files ); | 61 | return m_currentDir.entryList( QDir::Files ); |
62 | else { | 62 | else { |
63 | QStringList out; | 63 | QStringList out; |
64 | QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); | 64 | QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); |
65 | for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { | 65 | for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { |
66 | QFileInfo inf( *it ); | 66 | QFileInfo inf( *it ); |
67 | QString ext = inf.extension(false).lower(); | 67 | QString ext = inf.extension(false).lower(); |
68 | if( ext == QString::fromLatin1("jpg") || | 68 | if( ext == QString::fromLatin1("jpg") || |
69 | ext == QString::fromLatin1("jpeg" ) || | 69 | ext == QString::fromLatin1("jpeg" ) || |
70 | ext == QString::fromLatin1("png" ) || | 70 | ext == QString::fromLatin1("png" ) || |
71 | ext == QString::fromLatin1("bmp" ) || | 71 | ext == QString::fromLatin1("bmp" ) || |
72 | ext == QString::fromLatin1("gif" ) ) | 72 | ext == QString::fromLatin1("gif" ) ) |
73 | out.append( *it ); | 73 | out.append( *it ); |
74 | } | 74 | } |
75 | return out; | 75 | return out; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | void Dir_DirLister::deleteImage( const QString& fl) { | 79 | void Dir_DirLister::deleteImage( const QString& fl) { |
80 | QFile::remove( fl ); | 80 | QFile::remove( fl ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { | 83 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { |
84 | SlaveMaster::self()->thumbNail( str, w, h ); | 84 | SlaveMaster::self()->thumbNail( str, w, h ); |
85 | } | 85 | } |
86 | 86 | ||
87 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { | 87 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { |
88 | return SlaveMaster::self()->image( str, f, m ); | 88 | return SlaveMaster::self()->image( str, f, m ); |
89 | } | 89 | } |
90 | 90 | ||
91 | void Dir_DirLister::imageInfo( const QString& str) { | 91 | void Dir_DirLister::imageInfo( const QString& str) { |
92 | SlaveMaster::self()->thumbInfo( str ); | 92 | SlaveMaster::self()->thumbInfo( str ); |
93 | } | 93 | } |
94 | 94 | ||
95 | void Dir_DirLister::fullImageInfo( const QString& str) { | 95 | void Dir_DirLister::fullImageInfo( const QString& str) { |
96 | SlaveMaster::self()->imageInfo( str ); | 96 | SlaveMaster::self()->imageInfo( str ); |
97 | } | 97 | } |
98 | |||
99 | QString Dir_DirLister::nameToFname(const QString&name)const | ||
100 | { | ||
101 | return name; | ||
102 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.h b/noncore/graphics/opie-eye/impl/dir/dir_lister.h index fc63bb0..d6ca6c0 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.h +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.h | |||
@@ -1,34 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef DIR_LISTER_INTERFACE_LISTER_H | 5 | #ifndef DIR_LISTER_INTERFACE_LISTER_H |
6 | #define DIR_LISTER_INTERFACE_LISTER_H | 6 | #define DIR_LISTER_INTERFACE_LISTER_H |
7 | 7 | ||
8 | #include <qdir.h> | 8 | #include <qdir.h> |
9 | 9 | ||
10 | #include <iface/dirlister.h> | 10 | #include <iface/dirlister.h> |
11 | 11 | ||
12 | class Config; | 12 | class Config; |
13 | class Dir_DirLister : public PDirLister { | 13 | class Dir_DirLister : public PDirLister { |
14 | Q_OBJECT | ||
14 | public: | 15 | public: |
15 | Dir_DirLister( bool ); | 16 | Dir_DirLister( bool ); |
17 | virtual ~Dir_DirLister(){} | ||
16 | 18 | ||
17 | QString defaultPath()const; | 19 | QString defaultPath()const; |
18 | QString setStartPath( const QString& ); | 20 | QString setStartPath( const QString& ); |
19 | QString currentPath()const; | 21 | QString currentPath()const; |
20 | QStringList folders()const; | 22 | QStringList folders()const; |
21 | QStringList files()const; | 23 | QStringList files()const; |
22 | 24 | ||
23 | void deleteImage( const QString& ); | 25 | void deleteImage( const QString& ); |
24 | void thumbNail( const QString&, int, int ); | 26 | void thumbNail( const QString&, int, int ); |
25 | QImage image( const QString&, Factor, int ); | 27 | QImage image( const QString&, Factor, int ); |
26 | void imageInfo( const QString& ); | 28 | void imageInfo( const QString& ); |
27 | void fullImageInfo( const QString& ); | 29 | void fullImageInfo( const QString& ); |
30 | virtual QString nameToFname(const QString&name)const; | ||
28 | 31 | ||
29 | private: | 32 | private: |
30 | bool m_allFiles; | 33 | bool m_allFiles; |
31 | QDir m_currentDir; | 34 | QDir m_currentDir; |
32 | }; | 35 | }; |
33 | 36 | ||
34 | #endif | 37 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp new file mode 100644 index 0000000..0d6e25f --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #include "doc_lister.h" | ||
2 | #include "doc_ifaceinfo.h" | ||
3 | #include "doc_dirview.h" | ||
4 | |||
5 | PHUNK_VIEW_INTERFACE("Document View", Doc_DirView ); | ||
6 | |||
7 | |||
8 | Doc_DirView::Doc_DirView( const Config& cfg) | ||
9 | : PDirView(cfg) | ||
10 | { | ||
11 | m_lister = 0; | ||
12 | m_info = 0; | ||
13 | } | ||
14 | |||
15 | Doc_DirView::~Doc_DirView() { | ||
16 | } | ||
17 | |||
18 | PInterfaceInfo* Doc_DirView::interfaceInfo()const{ | ||
19 | if (!m_info ) | ||
20 | m_info =new DocInterfaceInfo; | ||
21 | return m_info; | ||
22 | } | ||
23 | |||
24 | PDirLister* Doc_DirView::dirLister()const{ | ||
25 | if (!m_lister ) | ||
26 | m_lister = new Doc_DirLister(); | ||
27 | return m_lister; | ||
28 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.h b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h new file mode 100644 index 0000000..3a2fd71 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * GPLv2 only zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DOC_DIR_VIEW_H | ||
6 | #define DOC_DIR_VIEW_H | ||
7 | |||
8 | #include <iface/dirview.h> | ||
9 | |||
10 | |||
11 | struct Doc_DirView : public PDirView { | ||
12 | Doc_DirView( const Config& ); | ||
13 | ~Doc_DirView(); | ||
14 | |||
15 | PInterfaceInfo* interfaceInfo()const; | ||
16 | PDirLister* dirLister()const; | ||
17 | private: | ||
18 | bool m_cfg : 1; | ||
19 | mutable PDirLister* m_lister; | ||
20 | mutable PInterfaceInfo *m_info; | ||
21 | }; | ||
22 | |||
23 | |||
24 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp new file mode 100644 index 0000000..a6d6f3c --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #include "doc_ifaceinfo.h" | ||
7 | |||
8 | /* OPIE */ | ||
9 | #include <opie2/odebug.h> | ||
10 | #include <qpe/config.h> | ||
11 | using namespace Opie::Core; | ||
12 | |||
13 | /* QT */ | ||
14 | #include <qwidget.h> | ||
15 | #include <qcheckbox.h> | ||
16 | #include <qhbox.h> | ||
17 | #include <qlabel.h> | ||
18 | |||
19 | #if 0 | ||
20 | namespace { | ||
21 | class DirImageWidget : public QHBox { | ||
22 | public: | ||
23 | DirImageWidget() { | ||
24 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); | ||
25 | } | ||
26 | ~DirImageWidget() {} | ||
27 | QCheckBox* chkbox; | ||
28 | }; | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | DocInterfaceInfo::DocInterfaceInfo() { | ||
33 | } | ||
34 | DocInterfaceInfo::~DocInterfaceInfo() { | ||
35 | } | ||
36 | |||
37 | QString DocInterfaceInfo::name()const { | ||
38 | return QString::fromLatin1(QObject::tr("DocView" )); | ||
39 | } | ||
40 | |||
41 | QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { | ||
42 | #if 0 | ||
43 | DirImageWidget* wid = new DirImageWidget(); | ||
44 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); | ||
45 | |||
46 | return wid; | ||
47 | #endif | ||
48 | return 0L; | ||
49 | } | ||
50 | |||
51 | void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { | ||
52 | #if 0 | ||
53 | owarn << "Write Config" << oendl; | ||
54 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); | ||
55 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); | ||
56 | #endif | ||
57 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h new file mode 100644 index 0000000..73986c9 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #ifndef DOC_IFACE_INFO_H | ||
7 | #define DOC_IFACE_INFO_H | ||
8 | |||
9 | #include <iface/ifaceinfo.h> | ||
10 | |||
11 | class DocInterfaceInfo : public PInterfaceInfo { | ||
12 | public: | ||
13 | DocInterfaceInfo(); | ||
14 | virtual ~DocInterfaceInfo(); | ||
15 | |||
16 | QString name()const; | ||
17 | QWidget* configWidget(const Config&); | ||
18 | void writeConfig( QWidget* wid, Config& ); | ||
19 | }; | ||
20 | |||
21 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp new file mode 100644 index 0000000..f695a76 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #include "doc_lister.h" | ||
6 | |||
7 | #include <lib/slavemaster.h> | ||
8 | |||
9 | /* OPIE */ | ||
10 | #include <opie2/odebug.h> | ||
11 | #include <qpe/config.h> | ||
12 | #include <qpe/qpeapplication.h> | ||
13 | #include <qpe/applnk.h> | ||
14 | |||
15 | using namespace Opie::Core; | ||
16 | |||
17 | /* QT */ | ||
18 | #include <qdir.h> | ||
19 | #include <qfileinfo.h> | ||
20 | |||
21 | Doc_DirLister::Doc_DirLister() | ||
22 | : PDirLister( "doc_dir_lister" ) | ||
23 | { | ||
24 | SlaveMaster* master = SlaveMaster::self(); | ||
25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | ||
26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | ||
27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | ||
28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | ||
29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | ||
31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | ||
32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | ||
33 | |||
34 | } | ||
35 | |||
36 | QString Doc_DirLister::defaultPath()const { | ||
37 | return ""; QPEApplication::documentDir(); | ||
38 | } | ||
39 | |||
40 | QString Doc_DirLister::setStartPath( const QString& path ) { | ||
41 | m_namemap.clear(); | ||
42 | m_out.clear(); | ||
43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | ||
44 | owarn << "Set start path" << oendl; | ||
45 | DocLnkSet ds; | ||
46 | Global::findDocuments(&ds,Mtype_str); | ||
47 | QListIterator<DocLnk> dit(ds.children()); | ||
48 | for( ; dit.current(); ++dit) { | ||
49 | owarn << (*dit)->file() << oendl; | ||
50 | m_namemap[(*dit)->name()]=(*dit)->file(); | ||
51 | m_filemap[(*dit)->file()]=(*dit)->name(); | ||
52 | m_out.append((*dit)->name()); | ||
53 | } | ||
54 | owarn << "Set start path end" << oendl; | ||
55 | return ""; | ||
56 | } | ||
57 | |||
58 | QString Doc_DirLister::currentPath()const { | ||
59 | return ""; | ||
60 | } | ||
61 | |||
62 | |||
63 | QStringList Doc_DirLister::folders()const { | ||
64 | return QStringList(); | ||
65 | } | ||
66 | |||
67 | QStringList Doc_DirLister::files()const { | ||
68 | return m_out; | ||
69 | } | ||
70 | |||
71 | void Doc_DirLister::deleteImage( const QString& ) { | ||
72 | } | ||
73 | |||
74 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | ||
75 | if (m_namemap.find(str)==m_namemap.end()) { | ||
76 | owarn << "Item " << str << " not found" << oendl; | ||
77 | return; | ||
78 | } | ||
79 | QString fname = m_namemap[str]; | ||
80 | SlaveMaster::self()->thumbNail( fname, w, h ); | ||
81 | } | ||
82 | |||
83 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | ||
84 | if (m_namemap.find(str)==m_namemap.end()) { | ||
85 | owarn << "Item " << str << " not found" << oendl; | ||
86 | return QImage(); | ||
87 | } | ||
88 | QString fname = m_namemap[str]; | ||
89 | return SlaveMaster::self()->image( fname, f, m ); | ||
90 | } | ||
91 | |||
92 | void Doc_DirLister::imageInfo( const QString& str) { | ||
93 | if (m_namemap.find(str)==m_namemap.end()) { | ||
94 | owarn << "Item " << str << " not found" << oendl; | ||
95 | return; | ||
96 | } | ||
97 | QString fname = m_namemap[str]; | ||
98 | owarn << "Image info: " << fname << oendl; | ||
99 | SlaveMaster::self()->thumbInfo( fname ); | ||
100 | } | ||
101 | |||
102 | void Doc_DirLister::fullImageInfo( const QString& str) { | ||
103 | if (m_namemap.find(str)==m_namemap.end()) { | ||
104 | owarn << "Item " << str << " not found" << oendl; | ||
105 | return; | ||
106 | } | ||
107 | QString fname = m_namemap[str]; | ||
108 | SlaveMaster::self()->imageInfo( fname ); | ||
109 | } | ||
110 | |||
111 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | ||
112 | { | ||
113 | if (m_filemap.find(f)==m_filemap.end()) { | ||
114 | owarn << "Item " << f << " not found" << oendl; | ||
115 | return; | ||
116 | } | ||
117 | QString name = m_filemap[f]; | ||
118 | emit sig_fullInfo(name, t); | ||
119 | } | ||
120 | |||
121 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | ||
122 | { | ||
123 | if (m_filemap.find(f)==m_filemap.end()) { | ||
124 | owarn << "Item " << f << " not found" << oendl; | ||
125 | return; | ||
126 | } | ||
127 | QString name = m_filemap[f]; | ||
128 | emit sig_thumbInfo(name, t); | ||
129 | } | ||
130 | |||
131 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | ||
132 | { | ||
133 | if (m_filemap.find(f)==m_filemap.end()) { | ||
134 | owarn << "Item " << f << " not found" << oendl; | ||
135 | return; | ||
136 | } | ||
137 | QString name = m_filemap[f]; | ||
138 | emit sig_thumbNail(name, p); | ||
139 | } | ||
140 | |||
141 | QString Doc_DirLister::nameToFname(const QString&name)const | ||
142 | { | ||
143 | if (m_namemap.find(name)==m_namemap.end()) { | ||
144 | owarn << "Item " << name << " not found" << oendl; | ||
145 | return QString::null; | ||
146 | } | ||
147 | return m_namemap[name]; | ||
148 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h new file mode 100644 index 0000000..d89b579 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H | ||
6 | #define DOC_LISTER_INTERFACE_LISTER_H | ||
7 | |||
8 | #include <iface/dirlister.h> | ||
9 | |||
10 | #include <qstring.h> | ||
11 | #include <qmap.h> | ||
12 | |||
13 | class Config; | ||
14 | class Doc_DirLister : public PDirLister { | ||
15 | Q_OBJECT | ||
16 | public: | ||
17 | Doc_DirLister(); | ||
18 | virtual ~Doc_DirLister(){} | ||
19 | |||
20 | QString defaultPath()const; | ||
21 | QString setStartPath( const QString& ); | ||
22 | QString currentPath()const; | ||
23 | QStringList folders()const; | ||
24 | QStringList files()const; | ||
25 | |||
26 | void deleteImage( const QString& ); | ||
27 | void thumbNail( const QString&, int, int ); | ||
28 | QImage image( const QString&, Factor, int ); | ||
29 | void imageInfo( const QString& ); | ||
30 | void fullImageInfo( const QString& ); | ||
31 | virtual QString nameToFname(const QString&name)const; | ||
32 | |||
33 | private: | ||
34 | QMap<QString,QString> m_namemap,m_filemap; | ||
35 | QStringList m_out; | ||
36 | protected slots: | ||
37 | virtual void slotFullInfo(const QString&, const QString&); | ||
38 | virtual void slotThumbInfo(const QString&, const QString&); | ||
39 | virtual void slotThumbNail(const QString&, const QPixmap&); | ||
40 | }; | ||
41 | |||
42 | #endif | ||
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 57e69b6..0a57a0f 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro | |||
@@ -1,40 +1,44 @@ | |||
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 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ |
8 | lib/imagecache.h impl/dir/dir_dirview.h \ | 8 | lib/imagecache.h impl/dir/dir_dirview.h \ |
9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ | 9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ |
10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ | 10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ |
11 | lib/slavemaster.h \ | 11 | lib/slavemaster.h \ |
12 | iface/slaveiface.h \ | 12 | iface/slaveiface.h \ |
13 | gui/imageinfoui.h \ | 13 | gui/imageinfoui.h \ |
14 | gui/imageview.h \ | 14 | gui/imageview.h \ |
15 | gui/viewmodebutton.h | 15 | gui/viewmodebutton.h \ |
16 | impl/doc/doc_lister.h impl/doc/doc_dirview.h \ | ||
17 | impl/doc/doc_ifaceinfo.h | ||
16 | 18 | ||
17 | # A list header files | 19 | # A list header files |
18 | 20 | ||
19 | 21 | ||
20 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | 22 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ |
21 | lib/imagecache.cpp lib/viewmap.cpp \ | 23 | lib/imagecache.cpp lib/viewmap.cpp \ |
22 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ | 24 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ |
23 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | 25 | iface/dirview.cpp impl/dir/dir_lister.cpp \ |
24 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ | 26 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ |
25 | gui/imageinfoui.cpp \ | 27 | gui/imageinfoui.cpp \ |
26 | gui/imageview.cpp \ | 28 | gui/imageview.cpp \ |
27 | gui/viewmodebutton.cpp | 29 | gui/viewmodebutton.cpp \ |
30 | impl/doc/doc_lister.cpp impl/doc/doc_dirview.cpp \ | ||
31 | impl/doc/doc_ifaceinfo.cpp | ||
28 | # A list of source files | 32 | # A list of source files |
29 | 33 | ||
30 | INTERFACES = | 34 | INTERFACES = |
31 | # list of ui files | 35 | # list of ui files |
32 | 36 | ||
33 | INCLUDEPATH += . $(OPIEDIR)/include | 37 | INCLUDEPATH += . $(OPIEDIR)/include |
34 | DEPENDPATH += $(OPIEDIR)/include | 38 | DEPENDPATH += $(OPIEDIR)/include |
35 | 39 | ||
36 | 40 | ||
37 | 41 | ||
38 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiemm2 | 42 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiemm2 |
39 | 43 | ||
40 | include ( $(OPIEDIR)/include.pro ) | 44 | include ( $(OPIEDIR)/include.pro ) |