summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp94
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp28
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp1
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
@@ -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
571void 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
599bool 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
567void PIconView::slotShowNext() 629void 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
679void 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
601void PIconView::slotImageInfo() { 691void PIconView::slotImageInfo() {
602 bool isDir = false; 692 bool isDir = false;
603 QString name = currentFileName(isDir); 693 QString name = currentFileName(isDir);
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
@@ -27,7 +27,7 @@ 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,SlideItem
31 }; 31 };
32public: 32public:
33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); 33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
@@ -38,10 +38,13 @@ public:
38signals: 38signals:
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 void sig_startslide(int timeout);
41 42
42public slots: 43public slots:
43 virtual void slotShowNext(); 44 virtual void slotShowNext();
44 virtual void slotShowPrev(); 45 virtual void slotShowPrev();
46 virtual void slotShowLast();
47 virtual bool slotShowFirst();
45 48
46protected: 49protected:
47 void resizeEvent( QResizeEvent* ); 50 void resizeEvent( QResizeEvent* );
@@ -68,6 +71,7 @@ private slots:
68 void slotShowImage( const QString& ); 71 void slotShowImage( const QString& );
69 void slotImageInfo(); 72 void slotImageInfo();
70 void slotImageInfo( const QString& ); 73 void slotImageInfo( const QString& );
74 void slotStartSlide();
71 75
72 void slotStart(); 76 void slotStart();
73 void slotEnd(); 77 void slotEnd();
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
@@ -7,6 +7,7 @@
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10#include <qtimer.h>
10 11
11using namespace Opie::Core; 12using namespace Opie::Core;
12 13
@@ -18,8 +19,10 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name
18 m_cfg = cfg; 19 m_cfg = cfg;
19 m_isFullScreen = false; 20 m_isFullScreen = false;
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}
24 27
25ImageView::~ImageView() 28ImageView::~ImageView()
@@ -36,6 +39,29 @@ Opie::Core::OKeyConfigManager* ImageView::manager()
36 return m_viewManager; 39 return m_viewManager;
37} 40}
38 41
42void 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
52void 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}
39void ImageView::initKeys() 65void ImageView::initKeys()
40{ 66{
41 odebug << "init imageview keys" << oendl; 67 odebug << "init imageview keys" << oendl;
@@ -139,7 +165,7 @@ void ImageView::setFullScreen(bool how)
139 setFixedSize(qApp->desktop()->size()); 165 setFixedSize(qApp->desktop()->size());
140 showFullScreen(); 166 showFullScreen();
141 } else { 167 } else {
142 setMinimumSize(10,10); 168 setMinimumSize(10,10);
143 } 169 }
144} 170}
145 171
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
@@ -5,6 +5,8 @@
5 5
6#include <qwidget.h> 6#include <qwidget.h>
7 7
8class QTimer;
9
8namespace Opie { 10namespace Opie {
9 namespace Core { 11 namespace Core {
10 class OConfig; 12 class OConfig;
@@ -51,10 +53,14 @@ protected:
51 bool m_isFullScreen:1; 53 bool m_isFullScreen:1;
52 bool m_ignore_next_in:1; 54 bool m_ignore_next_in:1;
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 * );
55 59
56public slots: 60public slots:
57 virtual void hide(); 61 virtual void hide();
62 virtual void startSlide(int);
63 virtual void nextSlide();
58 64
59protected slots: 65protected slots:
60 virtual void slotShowImageInfo(); 66 virtual void slotShowImageInfo();
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
@@ -311,6 +311,7 @@ void PMainWindow::initDisp() {
311 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 311 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
312 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 312 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
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 }
315} 316}
316 317