-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 48 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 25 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 2 |
5 files changed, 86 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 5633312..f6e1816 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -175,329 +175,377 @@ Opie::Core::OKeyConfigManager* PIconView::manager() { | |||
175 | 175 | ||
176 | 176 | ||
177 | /* | 177 | /* |
178 | * init the KeyBoard Shortcuts | 178 | * init the KeyBoard Shortcuts |
179 | * called from the c'tor | 179 | * called from the c'tor |
180 | */ | 180 | */ |
181 | void PIconView::initKeys() { | 181 | void PIconView::initKeys() { |
182 | Opie::Core::OKeyPair::List lst; | 182 | Opie::Core::OKeyPair::List lst; |
183 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 183 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
184 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 184 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
185 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 185 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
186 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 186 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
187 | lst.append( Opie::Core::OKeyPair::returnKey() ); | 187 | lst.append( Opie::Core::OKeyPair::returnKey() ); |
188 | 188 | ||
189 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", | 189 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", |
190 | lst, false,this, "keyconfig name" ); | 190 | lst, false,this, "keyconfig name" ); |
191 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 191 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
192 | Resource::loadPixmap("beam"), BeamItem, | 192 | Resource::loadPixmap("beam"), BeamItem, |
193 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), | 193 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), |
194 | this, SLOT(slotBeam())) ); | 194 | this, SLOT(slotBeam())) ); |
195 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", | 195 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", |
196 | Resource::loadPixmap("trash"), DeleteItem, | 196 | Resource::loadPixmap("trash"), DeleteItem, |
197 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), | 197 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), |
198 | this, SLOT(slotTrash())) ); | 198 | this, SLOT(slotTrash())) ); |
199 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", | 199 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", |
200 | Resource::loadPixmap("1to1"), ViewItem, | 200 | Resource::loadPixmap("1to1"), ViewItem, |
201 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 201 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
202 | this, SLOT(slotShowImage()))); | 202 | this, SLOT(slotShowImage()))); |
203 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", | 203 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", |
204 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, | 204 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, |
205 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), | 205 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), |
206 | this, SLOT(slotImageInfo()) ) ); | 206 | this, SLOT(slotImageInfo()) ) ); |
207 | m_viewManager->load(); | 207 | m_viewManager->load(); |
208 | m_viewManager->handleWidget( m_view ); | 208 | m_viewManager->handleWidget( m_view ); |
209 | } | 209 | } |
210 | 210 | ||
211 | 211 | ||
212 | /* | 212 | /* |
213 | * change one dir up | 213 | * change one dir up |
214 | */ | 214 | */ |
215 | void PIconView::slotDirUp() { | 215 | void PIconView::slotDirUp() { |
216 | QDir dir( m_path ); | 216 | QDir dir( m_path ); |
217 | dir.cdUp(); | 217 | dir.cdUp(); |
218 | slotChangeDir( dir.absPath() ); | 218 | slotChangeDir( dir.absPath() ); |
219 | } | 219 | } |
220 | 220 | ||
221 | /* | 221 | /* |
222 | * change the dir | 222 | * change the dir |
223 | */ | 223 | */ |
224 | void PIconView::slotChangeDir(const QString& path) { | 224 | void PIconView::slotChangeDir(const QString& path) { |
225 | if ( !currentView() ) | 225 | if ( !currentView() ) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | PDirLister *lister = currentView()->dirLister(); | 228 | PDirLister *lister = currentView()->dirLister(); |
229 | if (!lister ) | 229 | if (!lister ) |
230 | return; | 230 | return; |
231 | 231 | ||
232 | /* | 232 | /* |
233 | * Say what we want and take what we get | 233 | * Say what we want and take what we get |
234 | */ | 234 | */ |
235 | lister->setStartPath( path ); | 235 | lister->setStartPath( path ); |
236 | m_path = lister->currentPath(); | 236 | m_path = lister->currentPath(); |
237 | 237 | ||
238 | m_view->viewport()->setUpdatesEnabled( false ); | 238 | m_view->viewport()->setUpdatesEnabled( false ); |
239 | m_view->clear(); | 239 | m_view->clear(); |
240 | 240 | ||
241 | /* | 241 | /* |
242 | * add files and folders | 242 | * add files and folders |
243 | */ | 243 | */ |
244 | addFolders( lister->folders() ); | 244 | addFolders( lister->folders() ); |
245 | addFiles( lister->files() ); | 245 | addFiles( lister->files() ); |
246 | m_view->viewport()->setUpdatesEnabled( true ); | 246 | m_view->viewport()->setUpdatesEnabled( true ); |
247 | 247 | ||
248 | // Also invalidate the cache. We can't cancel the operations anyway | 248 | // Also invalidate the cache. We can't cancel the operations anyway |
249 | g_stringPix.clear(); | 249 | g_stringPix.clear(); |
250 | g_stringInf.clear(); | 250 | g_stringInf.clear(); |
251 | 251 | ||
252 | // looks ugly | 252 | // looks ugly |
253 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); | 253 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); |
254 | } | 254 | } |
255 | 255 | ||
256 | /** | 256 | /** |
257 | * get the current file name | 257 | * get the current file name |
258 | * @param isDir see if this is a dir or real file | 258 | * @param isDir see if this is a dir or real file |
259 | */ | 259 | */ |
260 | QString PIconView::currentFileName(bool &isDir)const { | 260 | QString PIconView::currentFileName(bool &isDir)const { |
261 | isDir = false; | 261 | isDir = false; |
262 | QIconViewItem* _it = m_view->currentItem(); | 262 | QIconViewItem* _it = m_view->currentItem(); |
263 | if ( !_it ) | 263 | if ( !_it ) |
264 | return QString::null; | 264 | return QString::null; |
265 | 265 | ||
266 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 266 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
267 | isDir = it->isDir(); | 267 | isDir = it->isDir(); |
268 | return it->path(); | 268 | return it->path(); |
269 | } | 269 | } |
270 | 270 | ||
271 | QString PIconView::nextFileName(bool &isDir)const | ||
272 | { | ||
273 | isDir = false; | ||
274 | QIconViewItem* _it1 = m_view->currentItem(); | ||
275 | if ( !_it1 ) | ||
276 | return QString::null; | ||
277 | QIconViewItem* _it = _it1->nextItem(); | ||
278 | if ( !_it ) | ||
279 | return QString::null; | ||
280 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | ||
281 | isDir = it->isDir(); | ||
282 | m_view->setCurrentItem(_it); | ||
283 | return it->path(); | ||
284 | } | ||
285 | |||
286 | QString PIconView::prevFileName(bool &isDir)const{ | ||
287 | isDir = false; | ||
288 | QIconViewItem* _it = m_view->currentItem(); | ||
289 | if ( !_it ) | ||
290 | return QString::null; | ||
291 | _it = _it->prevItem(); | ||
292 | if ( !_it ) | ||
293 | return QString::null; | ||
294 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | ||
295 | isDir = it->isDir(); | ||
296 | m_view->setCurrentItem(_it); | ||
297 | return it->path(); | ||
298 | } | ||
299 | |||
271 | void PIconView::slotTrash() { | 300 | void PIconView::slotTrash() { |
272 | bool isDir; | 301 | bool isDir; |
273 | QString pa = currentFileName( isDir ); | 302 | QString pa = currentFileName( isDir ); |
274 | if ( isDir && pa.isEmpty() ) | 303 | if ( isDir && pa.isEmpty() ) |
275 | return; | 304 | return; |
276 | 305 | ||
277 | if (!QPEMessageBox::confirmDelete( this, | 306 | if (!QPEMessageBox::confirmDelete( this, |
278 | tr("Delete Image" ), | 307 | tr("Delete Image" ), |
279 | tr("the Image %1" ).arg(pa))) | 308 | tr("the Image %1" ).arg(pa))) |
280 | return | 309 | return |
281 | 310 | ||
282 | 311 | ||
283 | currentView()->dirLister()->deleteImage( pa ); | 312 | currentView()->dirLister()->deleteImage( pa ); |
284 | delete m_view->currentItem(); | 313 | delete m_view->currentItem(); |
285 | } | 314 | } |
286 | 315 | ||
287 | /* | 316 | /* |
288 | * see what views are available | 317 | * see what views are available |
289 | */ | 318 | */ |
290 | void PIconView::loadViews() { | 319 | void PIconView::loadViews() { |
291 | ViewMap::Iterator it; | 320 | ViewMap::Iterator it; |
292 | ViewMap* map = viewMap(); | 321 | ViewMap* map = viewMap(); |
293 | for ( it = map->begin(); it != map->end(); ++it ) | 322 | for ( it = map->begin(); it != map->end(); ++it ) |
294 | m_views->insertItem( QObject::tr(it.key() ) ); | 323 | m_views->insertItem( QObject::tr(it.key() ) ); |
295 | } | 324 | } |
296 | 325 | ||
297 | void PIconView::resetView() { | 326 | void PIconView::resetView() { |
298 | slotViewChanged(m_views->currentItem()); | 327 | slotViewChanged(m_views->currentItem()); |
299 | } | 328 | } |
300 | 329 | ||
301 | /* | 330 | /* |
302 | *swicth view reloadDir and connect signals | 331 | *swicth view reloadDir and connect signals |
303 | */ | 332 | */ |
304 | void PIconView::slotViewChanged( int i) { | 333 | void PIconView::slotViewChanged( int i) { |
305 | if (!m_views->count() ) { | 334 | if (!m_views->count() ) { |
306 | setCurrentView( 0l); | 335 | setCurrentView( 0l); |
307 | return; | 336 | return; |
308 | } | 337 | } |
309 | 338 | ||
310 | PDirView* cur = currentView(); | 339 | PDirView* cur = currentView(); |
311 | delete cur; | 340 | delete cur; |
312 | QString str = m_views->text(i); | 341 | QString str = m_views->text(i); |
313 | cur = (*(*viewMap())[str])(*m_cfg); | 342 | cur = (*(*viewMap())[str])(*m_cfg); |
314 | setCurrentView( cur ); | 343 | setCurrentView( cur ); |
315 | 344 | ||
316 | /* connect to the signals of the lister */ | 345 | /* connect to the signals of the lister */ |
317 | PDirLister* lis = cur->dirLister(); | 346 | PDirLister* lis = cur->dirLister(); |
318 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), | 347 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), |
319 | this, SLOT( slotThumbInfo(const QString&, const QString&))); | 348 | this, SLOT( slotThumbInfo(const QString&, const QString&))); |
320 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 349 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
321 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 350 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
322 | connect(lis, SIGNAL(sig_start()), | 351 | connect(lis, SIGNAL(sig_start()), |
323 | this, SLOT(slotStart())); | 352 | this, SLOT(slotStart())); |
324 | connect(lis, SIGNAL(sig_end()) , | 353 | connect(lis, SIGNAL(sig_end()) , |
325 | this, SLOT(slotEnd()) ); | 354 | this, SLOT(slotEnd()) ); |
326 | 355 | ||
327 | 356 | ||
328 | /* reload now */ | 357 | /* reload now */ |
329 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); | 358 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); |
330 | } | 359 | } |
331 | 360 | ||
332 | 361 | ||
333 | void PIconView::slotReloadDir() { | 362 | void PIconView::slotReloadDir() { |
334 | slotChangeDir( m_path ); | 363 | slotChangeDir( m_path ); |
335 | } | 364 | } |
336 | 365 | ||
337 | 366 | ||
338 | /* | 367 | /* |
339 | * add files and folders | 368 | * add files and folders |
340 | */ | 369 | */ |
341 | void PIconView::addFolders( const QStringList& lst) { | 370 | void PIconView::addFolders( const QStringList& lst) { |
342 | QStringList::ConstIterator it; | 371 | QStringList::ConstIterator it; |
343 | 372 | ||
344 | for(it=lst.begin(); it != lst.end(); ++it ) | 373 | for(it=lst.begin(); it != lst.end(); ++it ) |
345 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); | 374 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); |
346 | 375 | ||
347 | 376 | ||
348 | } | 377 | } |
349 | 378 | ||
350 | void PIconView::addFiles( const QStringList& lst) { | 379 | void PIconView::addFiles( const QStringList& lst) { |
351 | QStringList::ConstIterator it; | 380 | QStringList::ConstIterator it; |
352 | for (it=lst.begin(); it!= lst.end(); ++it ) | 381 | for (it=lst.begin(); it!= lst.end(); ++it ) |
353 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); | 382 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); |
354 | 383 | ||
355 | } | 384 | } |
356 | 385 | ||
357 | /* | 386 | /* |
358 | * user clicked on the item. Change dir or view | 387 | * user clicked on the item. Change dir or view |
359 | */ | 388 | */ |
360 | void PIconView::slotClicked(QIconViewItem* _it) { | 389 | void PIconView::slotClicked(QIconViewItem* _it) { |
361 | if(!_it ) | 390 | if(!_it ) |
362 | return; | 391 | return; |
363 | 392 | ||
364 | IconViewItem* it = static_cast<IconViewItem*>(_it); | 393 | IconViewItem* it = static_cast<IconViewItem*>(_it); |
365 | if( it->isDir() ) | 394 | if( it->isDir() ) |
366 | slotChangeDir( it->path() ); | 395 | slotChangeDir( it->path() ); |
367 | else // view image | 396 | else // view image |
368 | slotShowImage(); | 397 | slotShowImage(); |
369 | } | 398 | } |
370 | 399 | ||
371 | /* | 400 | /* |
372 | * got thumb info add to the cache if items is visible | 401 | * got thumb info add to the cache if items is visible |
373 | * we later need update after processing of slave is done | 402 | * we later need update after processing of slave is done |
374 | */ | 403 | */ |
375 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | 404 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { |
376 | IconViewItem* item = g_stringInf[_path]; | 405 | IconViewItem* item = g_stringInf[_path]; |
377 | if (!item ) | 406 | if (!item ) |
378 | return; | 407 | return; |
379 | 408 | ||
380 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 409 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
381 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 410 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
382 | m_updatet = true; | 411 | m_updatet = true; |
383 | 412 | ||
384 | item->setText( str ); | 413 | item->setText( str ); |
385 | g_stringInf.remove( _path ); | 414 | g_stringInf.remove( _path ); |
386 | } | 415 | } |
387 | 416 | ||
388 | /* | 417 | /* |
389 | * got thumbnail and see if it is visible so we need to update later | 418 | * got thumbnail and see if it is visible so we need to update later |
390 | */ | 419 | */ |
391 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | 420 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { |
392 | IconViewItem* item = g_stringPix[_path]; | 421 | IconViewItem* item = g_stringPix[_path]; |
393 | if (!item ) | 422 | if (!item ) |
394 | return; | 423 | return; |
395 | 424 | ||
396 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 425 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
397 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 426 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
398 | m_updatet = true; | 427 | m_updatet = true; |
399 | 428 | ||
400 | if (pix.width()>0) | 429 | if (pix.width()>0) |
401 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); | 430 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); |
402 | 431 | ||
403 | 432 | ||
404 | g_stringPix.remove( _path ); | 433 | g_stringPix.remove( _path ); |
405 | } | 434 | } |
406 | 435 | ||
407 | 436 | ||
408 | /* | 437 | /* |
409 | * FIXME rename | 438 | * FIXME rename |
410 | */ | 439 | */ |
411 | void PIconView::slotRename() { | 440 | void PIconView::slotRename() { |
412 | 441 | ||
413 | } | 442 | } |
414 | 443 | ||
415 | 444 | ||
416 | /* | 445 | /* |
417 | * BEAM the current file | 446 | * BEAM the current file |
418 | */ | 447 | */ |
419 | void PIconView::slotBeam() { | 448 | void PIconView::slotBeam() { |
420 | bool isDir; | 449 | bool isDir; |
421 | QString pa = currentFileName( isDir ); | 450 | QString pa = currentFileName( isDir ); |
422 | if ( isDir && pa.isEmpty() ) | 451 | if ( isDir && pa.isEmpty() ) |
423 | return; | 452 | return; |
424 | 453 | ||
425 | Ir* ir = new Ir( this ); | 454 | Ir* ir = new Ir( this ); |
426 | connect( ir, SIGNAL(done(Ir*)), | 455 | connect( ir, SIGNAL(done(Ir*)), |
427 | this, SLOT(slotBeamDone(Ir*))); | 456 | this, SLOT(slotBeamDone(Ir*))); |
428 | ir->send(pa, tr( "Image" ) ); | 457 | ir->send(pa, tr( "Image" ) ); |
429 | } | 458 | } |
430 | 459 | ||
431 | /* | 460 | /* |
432 | * BEAM done clean up | 461 | * BEAM done clean up |
433 | */ | 462 | */ |
434 | void PIconView::slotBeamDone( Ir* ir) { | 463 | void PIconView::slotBeamDone( Ir* ir) { |
435 | delete ir; | 464 | delete ir; |
436 | } | 465 | } |
437 | 466 | ||
438 | void PIconView::slotStart() { | 467 | void PIconView::slotStart() { |
439 | m_view->viewport()->setUpdatesEnabled( false ); | 468 | m_view->viewport()->setUpdatesEnabled( false ); |
440 | } | 469 | } |
441 | 470 | ||
442 | void PIconView::slotEnd() { | 471 | void PIconView::slotEnd() { |
443 | if ( m_updatet ) | 472 | if ( m_updatet ) |
444 | m_view->arrangeItemsInGrid( ); | 473 | m_view->arrangeItemsInGrid( ); |
445 | m_view->viewport()->setUpdatesEnabled( true ); | 474 | m_view->viewport()->setUpdatesEnabled( true ); |
446 | m_updatet = false; | 475 | m_updatet = false; |
447 | } | 476 | } |
448 | 477 | ||
478 | void PIconView::slotShowNext() | ||
479 | { | ||
480 | bool isDir = false; | ||
481 | QString name = nextFileName(isDir); | ||
482 | if (isDir) return; | ||
483 | if (name.isEmpty()) return; | ||
484 | odebug << "Show next: " << name << oendl; | ||
485 | slotShowImage(name); | ||
486 | } | ||
487 | |||
488 | void PIconView::slotShowPrev() | ||
489 | { | ||
490 | bool isDir = false; | ||
491 | QString name = prevFileName(isDir); | ||
492 | if (isDir) return; | ||
493 | if (name.isEmpty()) return; | ||
494 | slotShowImage(name); | ||
495 | } | ||
496 | |||
449 | void PIconView::slotShowImage() | 497 | void PIconView::slotShowImage() |
450 | { | 498 | { |
451 | bool isDir = false; | 499 | bool isDir = false; |
452 | QString name = currentFileName(isDir); | 500 | QString name = currentFileName(isDir); |
453 | if (isDir) return; | 501 | if (isDir) return; |
454 | 502 | ||
455 | slotShowImage( name ); | 503 | slotShowImage( name ); |
456 | } | 504 | } |
457 | void PIconView::slotShowImage( const QString& name) { | 505 | void PIconView::slotShowImage( const QString& name) { |
458 | emit sig_display( name ); | 506 | emit sig_display( name ); |
459 | } | 507 | } |
460 | void PIconView::slotImageInfo() { | 508 | void PIconView::slotImageInfo() { |
461 | bool isDir = false; | 509 | bool isDir = false; |
462 | QString name = currentFileName(isDir); | 510 | QString name = currentFileName(isDir); |
463 | if (isDir) return; | 511 | if (isDir) return; |
464 | 512 | ||
465 | slotImageInfo( name ); | 513 | slotImageInfo( name ); |
466 | } | 514 | } |
467 | 515 | ||
468 | void PIconView::slotImageInfo( const QString& name) { | 516 | void PIconView::slotImageInfo( const QString& name) { |
469 | emit sig_showInfo( name ); | 517 | emit sig_showInfo( name ); |
470 | } | 518 | } |
471 | 519 | ||
472 | 520 | ||
473 | void PIconView::slotChangeMode( int mode ) { | 521 | void PIconView::slotChangeMode( int mode ) { |
474 | if ( mode >= 1 && mode <= 3 ) | 522 | if ( mode >= 1 && mode <= 3 ) |
475 | m_mode = mode; | 523 | m_mode = mode; |
476 | 524 | ||
477 | QIconView::ItemTextPos pos; | 525 | QIconView::ItemTextPos pos; |
478 | switch( m_mode ) { | 526 | switch( m_mode ) { |
479 | case 2: | 527 | case 2: |
480 | pos = QIconView::Bottom; | 528 | pos = QIconView::Bottom; |
481 | break; | 529 | break; |
482 | case 3: | 530 | case 3: |
483 | case 1: | 531 | case 1: |
484 | default: | 532 | default: |
485 | pos = QIconView::Right; | 533 | pos = QIconView::Right; |
486 | break; | 534 | break; |
487 | } | 535 | } |
488 | m_view->setItemTextPos( pos ); | 536 | m_view->setItemTextPos( pos ); |
489 | 537 | ||
490 | calculateGrid(); | 538 | calculateGrid(); |
491 | slotReloadDir(); | 539 | slotReloadDir(); |
492 | } | 540 | } |
493 | 541 | ||
494 | 542 | ||
495 | void PIconView::resizeEvent( QResizeEvent* re ) { | 543 | void PIconView::resizeEvent( QResizeEvent* re ) { |
496 | QVBox::resizeEvent( re ); | 544 | QVBox::resizeEvent( re ); |
497 | calculateGrid(); | 545 | calculateGrid(); |
498 | } | 546 | } |
499 | 547 | ||
500 | 548 | ||
501 | void PIconView::calculateGrid() { | 549 | void PIconView::calculateGrid() { |
502 | 550 | ||
503 | } | 551 | } |
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index 903c4fd..14ad168 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h | |||
@@ -1,89 +1,95 @@ | |||
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_ICON_VIEW_H | 6 | #ifndef PHUNK_ICON_VIEW_H |
7 | #define PHUNK_ICON_VIEW_H | 7 | #define PHUNK_ICON_VIEW_H |
8 | 8 | ||
9 | #include <qvbox.h> | 9 | #include <qvbox.h> |
10 | 10 | ||
11 | 11 | ||
12 | class QIconView; | 12 | class QIconView; |
13 | class QIconViewItem; | 13 | class QIconViewItem; |
14 | class QComboBox; | 14 | class QComboBox; |
15 | class PIconViewItem; | 15 | class PIconViewItem; |
16 | class PDirLister; | 16 | class PDirLister; |
17 | class Ir; | 17 | class Ir; |
18 | 18 | ||
19 | namespace Opie { | 19 | namespace Opie { |
20 | namespace Core{ | 20 | namespace Core{ |
21 | class OConfig; | 21 | class OConfig; |
22 | class OKeyConfigManager; | 22 | class OKeyConfigManager; |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | class PIconView : public QVBox { | 26 | class PIconView : public QVBox { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | friend class PIconViewItem; | 28 | friend class PIconViewItem; |
29 | enum ActionIds { | 29 | enum ActionIds { |
30 | BeamItem, DeleteItem, ViewItem, InfoItem | 30 | BeamItem, DeleteItem, ViewItem, InfoItem |
31 | }; | 31 | }; |
32 | public: | 32 | public: |
33 | PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); | 33 | PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); |
34 | ~PIconView(); | 34 | ~PIconView(); |
35 | void resetView(); | 35 | void resetView(); |
36 | Opie::Core::OKeyConfigManager* manager(); | 36 | Opie::Core::OKeyConfigManager* manager(); |
37 | 37 | ||
38 | signals: | 38 | signals: |
39 | void sig_showInfo( const QString& ); | 39 | void sig_showInfo( const QString& ); |
40 | void sig_display( const QString& ); | 40 | void sig_display( const QString& ); |
41 | 41 | ||
42 | public slots: | ||
43 | virtual void slotShowNext(); | ||
44 | virtual void slotShowPrev(); | ||
45 | |||
42 | protected: | 46 | protected: |
43 | void resizeEvent( QResizeEvent* ); | 47 | void resizeEvent( QResizeEvent* ); |
44 | 48 | ||
45 | private: | 49 | private: |
46 | void initKeys(); | 50 | void initKeys(); |
47 | QString currentFileName(bool &isDir)const; | 51 | QString currentFileName(bool &isDir)const; |
52 | QString nextFileName(bool &isDir)const; | ||
53 | QString prevFileName(bool &isDir)const; | ||
48 | void loadViews(); | 54 | void loadViews(); |
49 | void calculateGrid(); | 55 | void calculateGrid(); |
50 | 56 | ||
51 | private slots: | 57 | private slots: |
52 | void slotDirUp(); | 58 | void slotDirUp(); |
53 | void slotChangeDir(const QString&); | 59 | void slotChangeDir(const QString&); |
54 | void slotTrash(); | 60 | void slotTrash(); |
55 | void slotViewChanged( int ); | 61 | void slotViewChanged( int ); |
56 | void slotReloadDir(); | 62 | void slotReloadDir(); |
57 | void slotRename(); | 63 | void slotRename(); |
58 | void slotBeam(); | 64 | void slotBeam(); |
59 | void slotBeamDone( Ir* ); | 65 | void slotBeamDone( Ir* ); |
60 | 66 | ||
61 | void slotShowImage(); | 67 | void slotShowImage(); |
62 | void slotShowImage( const QString& ); | 68 | void slotShowImage( const QString& ); |
63 | void slotImageInfo(); | 69 | void slotImageInfo(); |
64 | void slotImageInfo( const QString& ); | 70 | void slotImageInfo( const QString& ); |
65 | 71 | ||
66 | void slotStart(); | 72 | void slotStart(); |
67 | void slotEnd(); | 73 | void slotEnd(); |
68 | 74 | ||
69 | /* for performance reasons make it inline in the future */ | 75 | /* for performance reasons make it inline in the future */ |
70 | void addFolders( const QStringList& ); | 76 | void addFolders( const QStringList& ); |
71 | void addFiles( const QStringList& ); | 77 | void addFiles( const QStringList& ); |
72 | void slotClicked(QIconViewItem* ); | 78 | void slotClicked(QIconViewItem* ); |
73 | 79 | ||
74 | /**/ | 80 | /**/ |
75 | void slotThumbInfo(const QString&, const QString&); | 81 | void slotThumbInfo(const QString&, const QString&); |
76 | void slotThumbNail(const QString&, const QPixmap&); | 82 | void slotThumbNail(const QString&, const QPixmap&); |
77 | 83 | ||
78 | void slotChangeMode( int ); | 84 | void slotChangeMode( int ); |
79 | private: | 85 | private: |
80 | Opie::Core::OKeyConfigManager *m_viewManager; | 86 | Opie::Core::OKeyConfigManager *m_viewManager; |
81 | Opie::Core::OConfig *m_cfg; | 87 | Opie::Core::OConfig *m_cfg; |
82 | QComboBox* m_views; | 88 | QComboBox* m_views; |
83 | QIconView* m_view; | 89 | QIconView* m_view; |
84 | QString m_path; | 90 | QString m_path; |
85 | bool m_updatet : 1; | 91 | bool m_updatet : 1; |
86 | int m_mode; | 92 | int m_mode; |
87 | }; | 93 | }; |
88 | 94 | ||
89 | #endif | 95 | #endif |
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index db3ae74..aa2b9bc 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -1,60 +1,85 @@ | |||
1 | #include "imageview.h" | 1 | #include "imageview.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <opie2/oconfig.h> | 4 | #include <opie2/oconfig.h> |
5 | #include <opie2/okeyconfigwidget.h> | 5 | #include <opie2/okeyconfigwidget.h> |
6 | 6 | ||
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | 8 | ||
9 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
10 | 10 | ||
11 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) | 11 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) |
12 | : Opie::MM::OImageScrollView(parent,name,fl) | 12 | : Opie::MM::OImageScrollView(parent,name,fl) |
13 | { | 13 | { |
14 | m_viewManager = 0; | 14 | m_viewManager = 0; |
15 | m_cfg = cfg; | 15 | m_cfg = cfg; |
16 | initKeys(); | 16 | initKeys(); |
17 | } | 17 | } |
18 | 18 | ||
19 | ImageView::~ImageView() | 19 | ImageView::~ImageView() |
20 | { | 20 | { |
21 | if (m_viewManager) { | 21 | if (m_viewManager) { |
22 | delete m_viewManager; | 22 | delete m_viewManager; |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | Opie::Core::OKeyConfigManager* ImageView::manager() | 26 | Opie::Core::OKeyConfigManager* ImageView::manager() |
27 | { | 27 | { |
28 | if (!m_viewManager) { | 28 | if (!m_viewManager) { |
29 | initKeys(); | 29 | initKeys(); |
30 | } | 30 | } |
31 | return m_viewManager; | 31 | return m_viewManager; |
32 | } | 32 | } |
33 | 33 | ||
34 | void ImageView::initKeys() | 34 | void ImageView::initKeys() |
35 | { | 35 | { |
36 | odebug << "init imageview keys" << oendl; | 36 | odebug << "init imageview keys" << oendl; |
37 | if (!m_cfg) { | 37 | if (!m_cfg) { |
38 | m_cfg = new Opie::Core::OConfig("phunkview"); | 38 | m_cfg = new Opie::Core::OConfig("phunkview"); |
39 | m_cfg->setGroup("image_view_keys" ); | 39 | m_cfg->setGroup("image_view_keys" ); |
40 | } | 40 | } |
41 | Opie::Core::OKeyPair::List lst; | 41 | Opie::Core::OKeyPair::List lst; |
42 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 42 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
43 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 43 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
44 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 44 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
45 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 45 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
46 | 46 | ||
47 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", | 47 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", |
48 | lst, false,this, "image_view_keys" ); | 48 | lst, false,this, "image_view_keys" ); |
49 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", | 49 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", |
50 | Resource::loadPixmap("1to1"), ViewInfo, | 50 | Resource::loadPixmap("1to1"), ViewInfo, |
51 | Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton), | 51 | Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton), |
52 | this, SLOT(slotShowImageInfo()))); | 52 | this, SLOT(slotShowImageInfo()))); |
53 | #if 0 | ||
54 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Next image"), "nextimage", | ||
55 | Resource::loadPixmap("next"), ViewInfo, | ||
56 | Opie::Core::OKeyPair(Qt::Key_N,0), | ||
57 | this, SLOT(slotDispNext()))); | ||
58 | #endif | ||
53 | m_viewManager->handleWidget( this ); | 59 | m_viewManager->handleWidget( this ); |
54 | m_viewManager->load(); | 60 | m_viewManager->load(); |
55 | } | 61 | } |
56 | 62 | ||
63 | void ImageView::keyReleaseEvent(QKeyEvent * e) | ||
64 | { | ||
65 | if (!e || e->state()!=0) { | ||
66 | return; | ||
67 | } | ||
68 | if (e->key()==Qt::Key_N) slotDispNext(); | ||
69 | if (e->key()==Qt::Key_P) slotDispPrev(); | ||
70 | } | ||
71 | |||
72 | void ImageView::slotDispNext() | ||
73 | { | ||
74 | emit dispNext(); | ||
75 | } | ||
76 | |||
77 | void ImageView::slotDispPrev() | ||
78 | { | ||
79 | emit dispPrev(); | ||
80 | } | ||
81 | |||
57 | void ImageView::slotShowImageInfo() | 82 | void ImageView::slotShowImageInfo() |
58 | { | 83 | { |
59 | emit dispImageInfo(m_lastName); | 84 | emit dispImageInfo(m_lastName); |
60 | } | 85 | } |
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 1790c4f..f467f00 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -1,36 +1,41 @@ | |||
1 | #ifndef _IMAGE_VIEW_H | 1 | #ifndef _IMAGE_VIEW_H |
2 | #define _IMAGE_VIEW_H | 2 | #define _IMAGE_VIEW_H |
3 | 3 | ||
4 | #include <opie2/oimagescrollview.h> | 4 | #include <opie2/oimagescrollview.h> |
5 | 5 | ||
6 | namespace Opie { | 6 | namespace Opie { |
7 | namespace Core { | 7 | namespace Core { |
8 | class OConfig; | 8 | class OConfig; |
9 | class OKeyConfigManager; | 9 | class OKeyConfigManager; |
10 | } | 10 | } |
11 | } | 11 | } |
12 | 12 | ||
13 | class ImageView:public Opie::MM::OImageScrollView | 13 | class ImageView:public Opie::MM::OImageScrollView |
14 | { | 14 | { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | enum ActionIds { | 17 | enum ActionIds { |
18 | ViewInfo | 18 | ViewInfo |
19 | }; | 19 | }; |
20 | 20 | ||
21 | public: | 21 | public: |
22 | ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); | 22 | ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); |
23 | virtual ~ImageView(); | 23 | virtual ~ImageView(); |
24 | Opie::Core::OKeyConfigManager* manager(); | 24 | Opie::Core::OKeyConfigManager* manager(); |
25 | 25 | ||
26 | signals: | 26 | signals: |
27 | void dispImageInfo(const QString&); | 27 | void dispImageInfo(const QString&); |
28 | void dispNext(); | ||
29 | void dispPrev(); | ||
28 | 30 | ||
29 | protected: | 31 | protected: |
30 | Opie::Core::OConfig * m_cfg; | 32 | Opie::Core::OConfig * m_cfg; |
31 | Opie::Core::OKeyConfigManager*m_viewManager; | 33 | Opie::Core::OKeyConfigManager*m_viewManager; |
32 | void initKeys(); | 34 | void initKeys(); |
33 | protected slots: | 35 | protected slots: |
34 | virtual void slotShowImageInfo(); | 36 | virtual void slotShowImageInfo(); |
37 | virtual void slotDispNext(); | ||
38 | virtual void slotDispPrev(); | ||
39 | virtual void keyReleaseEvent(QKeyEvent * e); | ||
35 | }; | 40 | }; |
36 | #endif | 41 | #endif |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 09f562a..57be247 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -173,155 +173,157 @@ void PMainWindow::slotConfig() { | |||
173 | 173 | ||
174 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 174 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
175 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 175 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
176 | lay->addWidget( wid ); | 176 | lay->addWidget( wid ); |
177 | ViewMap *vM = viewMap(); | 177 | ViewMap *vM = viewMap(); |
178 | ViewMap::Iterator _it = vM->begin(); | 178 | ViewMap::Iterator _it = vM->begin(); |
179 | QMap<PDirView*, QWidget*> lst; | 179 | QMap<PDirView*, QWidget*> lst; |
180 | 180 | ||
181 | for( ; _it != vM->end(); ++_it ) { | 181 | for( ; _it != vM->end(); ++_it ) { |
182 | PDirView *view = (_it.data())(*m_cfg); | 182 | PDirView *view = (_it.data())(*m_cfg); |
183 | PInterfaceInfo *inf = view->interfaceInfo(); | 183 | PInterfaceInfo *inf = view->interfaceInfo(); |
184 | QWidget *_wid = inf->configWidget( *m_cfg ); | 184 | QWidget *_wid = inf->configWidget( *m_cfg ); |
185 | _wid->reparent(wid, QPoint() ); | 185 | _wid->reparent(wid, QPoint() ); |
186 | lst.insert( view, _wid ); | 186 | lst.insert( view, _wid ); |
187 | wid->addTab( _wid, "fileopen", inf->name() ); | 187 | wid->addTab( _wid, "fileopen", inf->name() ); |
188 | } | 188 | } |
189 | 189 | ||
190 | /* | 190 | /* |
191 | * Add the KeyConfigWidget | 191 | * Add the KeyConfigWidget |
192 | */ | 192 | */ |
193 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 193 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
194 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 194 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
195 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 195 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
196 | 196 | ||
197 | if ( !m_info ) { | 197 | if ( !m_info ) { |
198 | initInfo(); | 198 | initInfo(); |
199 | } | 199 | } |
200 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); | 200 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); |
201 | 201 | ||
202 | if ( !m_disp ) { | 202 | if ( !m_disp ) { |
203 | initDisp(); | 203 | initDisp(); |
204 | } | 204 | } |
205 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); | 205 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); |
206 | 206 | ||
207 | keyWid->load(); | 207 | keyWid->load(); |
208 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 208 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
209 | 209 | ||
210 | 210 | ||
211 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | 211 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); |
212 | 212 | ||
213 | /* | 213 | /* |
214 | * clean up | 214 | * clean up |
215 | *apply changes | 215 | *apply changes |
216 | */ | 216 | */ |
217 | 217 | ||
218 | QMap<PDirView*, QWidget*>::Iterator it; | 218 | QMap<PDirView*, QWidget*>::Iterator it; |
219 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 219 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
220 | if ( act ) | 220 | if ( act ) |
221 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); | 221 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); |
222 | delete it.key(); | 222 | delete it.key(); |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | if ( act ) { | 226 | if ( act ) { |
227 | m_view->resetView(); | 227 | m_view->resetView(); |
228 | keyWid->save(); | 228 | keyWid->save(); |
229 | m_disp->manager()->save(); | 229 | m_disp->manager()->save(); |
230 | m_info->manager()->save(); | 230 | m_info->manager()->save(); |
231 | m_view->manager()->save(); | 231 | m_view->manager()->save(); |
232 | } | 232 | } |
233 | delete keyWid; | 233 | delete keyWid; |
234 | } | 234 | } |
235 | 235 | ||
236 | /* | 236 | /* |
237 | * create a new image info component | 237 | * create a new image info component |
238 | * and detach the current one | 238 | * and detach the current one |
239 | * we will make the other delete on exit | 239 | * we will make the other delete on exit |
240 | */ | 240 | */ |
241 | template<class T> | 241 | template<class T> |
242 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 242 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
243 | if ( *ptr ) { | 243 | if ( *ptr ) { |
244 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 244 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
245 | (*ptr)->setDestructiveClose(); | 245 | (*ptr)->setDestructiveClose(); |
246 | m_stack->removeWidget( *ptr ); | 246 | m_stack->removeWidget( *ptr ); |
247 | } | 247 | } |
248 | *ptr = new T(m_cfg, m_stack, name ); | 248 | *ptr = new T(m_cfg, m_stack, name ); |
249 | m_stack->addWidget( *ptr, id ); | 249 | m_stack->addWidget( *ptr, id ); |
250 | 250 | ||
251 | connect(*ptr, SIGNAL(sig_return()), | 251 | connect(*ptr, SIGNAL(sig_return()), |
252 | this,SLOT(slotReturn())); | 252 | this,SLOT(slotReturn())); |
253 | 253 | ||
254 | } | 254 | } |
255 | void PMainWindow::initInfo() { | 255 | void PMainWindow::initInfo() { |
256 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 256 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
257 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 257 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
258 | } | 258 | } |
259 | void PMainWindow::initDisp() { | 259 | void PMainWindow::initDisp() { |
260 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 260 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
261 | if (m_disp) { | 261 | if (m_disp) { |
262 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 262 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
263 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 263 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
264 | } | 264 | } |
265 | m_disp->setAutoScale(autoScale); | 265 | m_disp->setAutoScale(autoScale); |
266 | m_disp->setAutoRotate(autoRotate); | 266 | m_disp->setAutoRotate(autoRotate); |
267 | m_disp->setShowZoomer(zoomerOn); | 267 | m_disp->setShowZoomer(zoomerOn); |
268 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 268 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
269 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | ||
270 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | ||
269 | } | 271 | } |
270 | } | 272 | } |
271 | 273 | ||
272 | /** | 274 | /** |
273 | * With big Screen the plan could be to 'detach' the image | 275 | * With big Screen the plan could be to 'detach' the image |
274 | * window if visible and to create a ne wone | 276 | * window if visible and to create a ne wone |
275 | * init* already supports it but I make no use of it for | 277 | * init* already supports it but I make no use of it for |
276 | * now. We set filename and raise | 278 | * now. We set filename and raise |
277 | * | 279 | * |
278 | * ### FIXME and talk to alwin | 280 | * ### FIXME and talk to alwin |
279 | */ | 281 | */ |
280 | void PMainWindow::slotShowInfo( const QString& inf ) { | 282 | void PMainWindow::slotShowInfo( const QString& inf ) { |
281 | if ( !m_info ) { | 283 | if ( !m_info ) { |
282 | initInfo(); | 284 | initInfo(); |
283 | } | 285 | } |
284 | m_info->setPath( inf ); | 286 | m_info->setPath( inf ); |
285 | m_stack->raiseWidget( ImageInfo ); | 287 | m_stack->raiseWidget( ImageInfo ); |
286 | } | 288 | } |
287 | 289 | ||
288 | void PMainWindow::slotDisplay( const QString& inf ) { | 290 | void PMainWindow::slotDisplay( const QString& inf ) { |
289 | if ( !m_disp ) { | 291 | if ( !m_disp ) { |
290 | initDisp(); | 292 | initDisp(); |
291 | } | 293 | } |
292 | m_disp->setImage( inf ); | 294 | m_disp->setImage( inf ); |
293 | m_stack->raiseWidget( ImageDisplay ); | 295 | m_stack->raiseWidget( ImageDisplay ); |
294 | } | 296 | } |
295 | 297 | ||
296 | void PMainWindow::slotReturn() { | 298 | void PMainWindow::slotReturn() { |
297 | raiseIconView(); | 299 | raiseIconView(); |
298 | } | 300 | } |
299 | 301 | ||
300 | 302 | ||
301 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 303 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
302 | /* | 304 | /* |
303 | * return from view | 305 | * return from view |
304 | * or properly quit | 306 | * or properly quit |
305 | */ | 307 | */ |
306 | if ( m_stack->visibleWidget() == m_info || | 308 | if ( m_stack->visibleWidget() == m_info || |
307 | m_stack->visibleWidget() == m_disp ) { | 309 | m_stack->visibleWidget() == m_disp ) { |
308 | raiseIconView(); | 310 | raiseIconView(); |
309 | ev->ignore(); | 311 | ev->ignore(); |
310 | return; | 312 | return; |
311 | } | 313 | } |
312 | ev->accept(); | 314 | ev->accept(); |
313 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 315 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
314 | } | 316 | } |
315 | 317 | ||
316 | void PMainWindow::raiseIconView() { | 318 | void PMainWindow::raiseIconView() { |
317 | m_stack->raiseWidget( IconView ); | 319 | m_stack->raiseWidget( IconView ); |
318 | } | 320 | } |
319 | 321 | ||
320 | void PMainWindow::setDocument( const QString& showImg ) { | 322 | void PMainWindow::setDocument( const QString& showImg ) { |
321 | QString file = showImg; | 323 | QString file = showImg; |
322 | DocLnk lnk(showImg); | 324 | DocLnk lnk(showImg); |
323 | if (lnk.isValid() ) | 325 | if (lnk.isValid() ) |
324 | file = lnk.file(); | 326 | file = lnk.file(); |
325 | 327 | ||
326 | slotDisplay( file ); | 328 | slotDisplay( file ); |
327 | } | 329 | } |