author | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
commit | 81cd1a4a916fb00b6c8867bdc1d945db155b12c0 (patch) (unidiff) | |
tree | ce302c254c8c2160a86ffc0a5abe6cfd51fd33b3 /noncore/graphics/opie-eye/gui/iconview.cpp | |
parent | ac414fa3802b471857bc84ecdd0d37200541b0a7 (diff) | |
download | opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.zip opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.gz opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.bz2 |
- added DocView mode
- fixed a bug in iconview and some small fixes more
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 31 |
1 files changed, 21 insertions, 10 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 | |||
@@ -342,13 +342,13 @@ void PIconView::slotTrash() { | |||
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 | ||
@@ -359,15 +359,21 @@ 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&))); |
@@ -403,15 +409,19 @@ void PIconView::addFolders( const QStringList& lst) { | |||
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 | } |
@@ -540,28 +550,31 @@ void PIconView::slotShowPrev() | |||
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; |
@@ -576,14 +589,12 @@ 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: |