author | alwin <alwin> | 2004-10-30 02:18:52 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-30 02:18:52 (UTC) |
commit | 3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25 (patch) (unidiff) | |
tree | 087361e8ec23fcae50ab146d6d2e2d366a54fe74 /noncore/graphics/opie-eye/gui/iconview.cpp | |
parent | dca4423e3b0966fe26ba4183e5b6ad4666c61e86 (diff) | |
download | opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.zip opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.tar.gz opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.tar.bz2 |
slide show implemented
on next/previous images: if end/begin of list is reached it starts
again on begin/end (it was required for slideshow so what ;)
zecke: so we have a feature for OPIE 1.1.7 ;)
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 | |||
@@ -242,6 +242,10 @@ void PIconView::initKeys() { | |||
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 | } |
@@ -564,11 +568,76 @@ void PIconView::slotEnd() { | |||
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()); |
@@ -579,7 +648,15 @@ 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()); |
@@ -598,6 +675,19 @@ void PIconView::slotShowImage( const QString& name) { | |||
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); |