Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 94 |
1 files changed, 92 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 7196aba..0499af9 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -241,8 +241,12 @@ void PIconView::initKeys() { | |||
241 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", | 241 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", |
242 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, | 242 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, |
243 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), | 243 | Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), |
244 | this, SLOT(slotImageInfo()) ) ); | 244 | this, SLOT(slotImageInfo()) ) ); |
245 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow", | ||
246 | Resource::loadPixmap("1to1"), SlideItem, | ||
247 | Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton), | ||
248 | this, SLOT(slotStartSlide()))); | ||
245 | m_viewManager->load(); | 249 | m_viewManager->load(); |
246 | m_viewManager->handleWidget( m_view ); | 250 | m_viewManager->handleWidget( m_view ); |
247 | } | 251 | } |
248 | 252 | ||
@@ -563,13 +567,78 @@ void PIconView::slotEnd() { | |||
563 | m_view->viewport()->setUpdatesEnabled( true ); | 567 | m_view->viewport()->setUpdatesEnabled( true ); |
564 | m_updatet = false; | 568 | m_updatet = false; |
565 | } | 569 | } |
566 | 570 | ||
571 | void PIconView::slotShowLast() | ||
572 | { | ||
573 | QIconViewItem* last_it = m_view->lastItem(); | ||
574 | if (!last_it) return; | ||
575 | m_view->setCurrentItem(last_it); | ||
576 | IconViewItem* it = static_cast<IconViewItem*>( last_it ); | ||
577 | bool isDir = it->isDir(); | ||
578 | QString name = it->path(); | ||
579 | if (!isDir && !name.isEmpty()) { | ||
580 | slotShowImage(name); | ||
581 | return; | ||
582 | } | ||
583 | bool first_loop = true; | ||
584 | while(isDir==true) { | ||
585 | if (!first_loop) { | ||
586 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); | ||
587 | } else { | ||
588 | first_loop = false; | ||
589 | } | ||
590 | name = prevFileName(isDir); | ||
591 | } | ||
592 | |||
593 | if (name.isEmpty()) return; | ||
594 | /* if we got a name we have a prev item */ | ||
595 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); | ||
596 | slotShowImage(name); | ||
597 | } | ||
598 | |||
599 | bool PIconView::slotShowFirst() | ||
600 | { | ||
601 | /* stop when reached - otherwise we may get an endless loop */ | ||
602 | QIconViewItem* first_it = m_view->firstItem(); | ||
603 | if (!first_it) return false; | ||
604 | m_view->setCurrentItem(first_it); | ||
605 | IconViewItem* it = static_cast<IconViewItem*>( first_it ); | ||
606 | bool isDir = it->isDir(); | ||
607 | QString name = it->path(); | ||
608 | if (!isDir && !name.isEmpty()) { | ||
609 | slotShowImage(name); | ||
610 | return false; | ||
611 | } | ||
612 | bool first_loop = true; | ||
613 | while(isDir==true) { | ||
614 | /* if name is empty isDir is false, too. */ | ||
615 | if (!first_loop) { | ||
616 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); | ||
617 | } else { | ||
618 | first_loop = false; | ||
619 | } | ||
620 | name = nextFileName(isDir); | ||
621 | } | ||
622 | if (name.isEmpty()) return false; | ||
623 | /* if we got a name we have a next item */ | ||
624 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); | ||
625 | slotShowImage(name); | ||
626 | return true; | ||
627 | } | ||
628 | |||
567 | void PIconView::slotShowNext() | 629 | void PIconView::slotShowNext() |
568 | { | 630 | { |
569 | bool isDir = false; | 631 | bool isDir = false; |
570 | QString name = nextFileName(isDir); | 632 | QString name = nextFileName(isDir); |
571 | if (name.isEmpty()) return; | 633 | while (isDir==true) { |
634 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); | ||
635 | name = nextFileName(isDir); | ||
636 | } | ||
637 | if (name.isEmpty()) { | ||
638 | slotShowFirst(); | ||
639 | return; | ||
640 | } | ||
572 | if (isDir) return; | 641 | if (isDir) return; |
573 | /* if we got a name we have a next item */ | 642 | /* if we got a name we have a next item */ |
574 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); | 643 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); |
575 | slotShowImage(name); | 644 | slotShowImage(name); |
@@ -578,9 +647,17 @@ void PIconView::slotShowNext() | |||
578 | void PIconView::slotShowPrev() | 647 | void PIconView::slotShowPrev() |
579 | { | 648 | { |
580 | bool isDir = false; | 649 | bool isDir = false; |
581 | QString name = prevFileName(isDir); | 650 | QString name = prevFileName(isDir); |
582 | if (name.isEmpty()) return; | 651 | while (isDir==true) { |
652 | /* if name is empty isDir is false, too. */ | ||
653 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); | ||
654 | name = prevFileName(isDir); | ||
655 | } | ||
656 | if (name.isEmpty()) { | ||
657 | slotShowLast(); | ||
658 | return; | ||
659 | } | ||
583 | if (isDir) return; | 660 | if (isDir) return; |
584 | /* if we got a name we have a prev item */ | 661 | /* if we got a name we have a prev item */ |
585 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); | 662 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); |
586 | slotShowImage(name); | 663 | slotShowImage(name); |
@@ -597,8 +674,21 @@ void PIconView::slotShowImage( const QString& name) { | |||
597 | PDirLister *lister = currentView()->dirLister(); | 674 | PDirLister *lister = currentView()->dirLister(); |
598 | QString r_name = lister->nameToFname(name); | 675 | QString r_name = lister->nameToFname(name); |
599 | emit sig_display( r_name ); | 676 | emit sig_display( r_name ); |
600 | } | 677 | } |
678 | |||
679 | void PIconView::slotStartSlide() { | ||
680 | bool isDir = false; | ||
681 | QString name = currentFileName(isDir); | ||
682 | if (isDir) { | ||
683 | if (!slotShowFirst()) | ||
684 | return; | ||
685 | } else { | ||
686 | slotShowImage( name ); | ||
687 | } | ||
688 | emit sig_startslide(2); | ||
689 | } | ||
690 | |||
601 | void PIconView::slotImageInfo() { | 691 | void PIconView::slotImageInfo() { |
602 | bool isDir = false; | 692 | bool isDir = false; |
603 | QString name = currentFileName(isDir); | 693 | QString name = currentFileName(isDir); |
604 | if (isDir) return; | 694 | if (isDir) return; |