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 | |
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 ;)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 94 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 28 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 1 |
5 files changed, 131 insertions, 4 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 | |||
@@ -244,2 +244,6 @@ void PIconView::initKeys() { | |||
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(); |
@@ -566,2 +570,60 @@ void PIconView::slotEnd() { | |||
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() |
@@ -570,3 +632,10 @@ void PIconView::slotShowNext() | |||
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; |
@@ -581,3 +650,11 @@ void PIconView::slotShowPrev() | |||
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; |
@@ -600,2 +677,15 @@ void PIconView::slotShowImage( const QString& 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() { |
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index a424c5c..bccbb0e 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h | |||
@@ -29,3 +29,3 @@ class PIconView : public QVBox { | |||
29 | enum ActionIds { | 29 | enum ActionIds { |
30 | BeamItem, DeleteItem, ViewItem, InfoItem | 30 | BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem |
31 | }; | 31 | }; |
@@ -40,2 +40,3 @@ signals: | |||
40 | void sig_display( const QString& ); | 40 | void sig_display( const QString& ); |
41 | void sig_startslide(int timeout); | ||
41 | 42 | ||
@@ -44,2 +45,4 @@ public slots: | |||
44 | virtual void slotShowPrev(); | 45 | virtual void slotShowPrev(); |
46 | virtual void slotShowLast(); | ||
47 | virtual bool slotShowFirst(); | ||
45 | 48 | ||
@@ -70,2 +73,3 @@ private slots: | |||
70 | void slotImageInfo( const QString& ); | 73 | void slotImageInfo( const QString& ); |
74 | void slotStartSlide(); | ||
71 | 75 | ||
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 5522131..b699aa1 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -9,2 +9,3 @@ | |||
9 | #include <qpopupmenu.h> | 9 | #include <qpopupmenu.h> |
10 | #include <qtimer.h> | ||
10 | 11 | ||
@@ -20,4 +21,6 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
20 | m_ignore_next_in = false; | 21 | m_ignore_next_in = false; |
22 | m_slideTimer = 0; | ||
21 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); | 23 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); |
22 | initKeys(); | 24 | initKeys(); |
25 | m_slideValue = 5; | ||
23 | } | 26 | } |
@@ -38,2 +41,25 @@ Opie::Core::OKeyConfigManager* ImageView::manager() | |||
38 | 41 | ||
42 | void ImageView::startSlide(int value) | ||
43 | { | ||
44 | if (!m_slideTimer) { | ||
45 | m_slideTimer = new QTimer(this); | ||
46 | } | ||
47 | m_slideValue=value; | ||
48 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); | ||
49 | m_slideTimer->start(m_slideValue*1000,true); | ||
50 | } | ||
51 | |||
52 | void ImageView::nextSlide() | ||
53 | { | ||
54 | if (!m_slideTimer) { | ||
55 | return; | ||
56 | } | ||
57 | if (isHidden()) { | ||
58 | delete m_slideTimer; | ||
59 | m_slideTimer = 0; | ||
60 | return; | ||
61 | } | ||
62 | emit dispNext(); | ||
63 | m_slideTimer->start(m_slideValue*1000,true); | ||
64 | } | ||
39 | void ImageView::initKeys() | 65 | void ImageView::initKeys() |
@@ -141,3 +167,3 @@ void ImageView::setFullScreen(bool how) | |||
141 | } else { | 167 | } else { |
142 | setMinimumSize(10,10); | 168 | setMinimumSize(10,10); |
143 | } | 169 | } |
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 18697e0..f0e6541 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -7,2 +7,4 @@ | |||
7 | 7 | ||
8 | class QTimer; | ||
9 | |||
8 | namespace Opie { | 10 | namespace Opie { |
@@ -53,2 +55,4 @@ protected: | |||
53 | int focus_in_count; | 55 | int focus_in_count; |
56 | QTimer*m_slideTimer; | ||
57 | int m_slideValue; | ||
54 | virtual void focusInEvent ( QFocusEvent * ); | 58 | virtual void focusInEvent ( QFocusEvent * ); |
@@ -57,2 +61,4 @@ public slots: | |||
57 | virtual void hide(); | 61 | virtual void hide(); |
62 | virtual void startSlide(int); | ||
63 | virtual void nextSlide(); | ||
58 | 64 | ||
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 438fbf2..3c946b6 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -313,2 +313,3 @@ void PMainWindow::initDisp() { | |||
313 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 313 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
314 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | ||
314 | } | 315 | } |