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
@@ -239,12 +239,16 @@ void PIconView::initKeys() {
239 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), 239 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
240 this, SLOT(slotShowImage()))); 240 this, SLOT(slotShowImage())));
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
249 253
250/* 254/*
@@ -561,28 +565,101 @@ void PIconView::slotEnd() {
561 if ( m_updatet ) 565 if ( m_updatet )
562 m_view->arrangeItemsInGrid( ); 566 m_view->arrangeItemsInGrid( );
563 m_view->viewport()->setUpdatesEnabled( true ); 567 m_view->viewport()->setUpdatesEnabled( true );
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());
575 slotShowImage(name); 644 slotShowImage(name);
576} 645}
577 646
578void PIconView::slotShowPrev() 647void 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);
587} 664}
588 665
@@ -595,12 +672,25 @@ void PIconView::slotShowImage()
595} 672}
596void PIconView::slotShowImage( const QString& name) { 673void 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
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);
604 if (isDir) return; 694 if (isDir) return;
605 695
606 slotImageInfo( name ); 696 slotImageInfo( name );
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
@@ -24,27 +24,30 @@ namespace Core{
24} 24}
25 25
26class PIconView : public QVBox { 26class 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 );
34 ~PIconView(); 34 ~PIconView();
35 void resetView(); 35 void resetView();
36 Opie::Core::OKeyConfigManager* manager(); 36 Opie::Core::OKeyConfigManager* manager();
37 37
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* );
48 51
49private: 52private:
50 void initKeys(); 53 void initKeys();
@@ -65,12 +68,13 @@ private slots:
65 void slotBeamDone( Ir* ); 68 void slotBeamDone( Ir* );
66 69
67 void slotShowImage(); 70 void slotShowImage();
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();
74 78
75/* for performance reasons make it inline in the future */ 79/* for performance reasons make it inline in the future */
76 void addFolders( const QStringList& ); 80 void addFolders( const QStringList& );
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
@@ -4,25 +4,28 @@
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5#include <opie2/okeyconfigwidget.h> 5#include <opie2/okeyconfigwidget.h>
6 6
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
13ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) 14ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
14 : Opie::MM::OImageScrollView(parent,name,fl) 15 : Opie::MM::OImageScrollView(parent,name,fl)
15{ 16{
16 m_viewManager = 0; 17 m_viewManager = 0;
17 focus_in_count = 0; 18 focus_in_count = 0;
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()
26{ 29{
27 odebug << "Delete Imageview" << oendl; 30 odebug << "Delete Imageview" << oendl;
28 delete m_viewManager; 31 delete m_viewManager;
@@ -33,12 +36,35 @@ Opie::Core::OKeyConfigManager* ImageView::manager()
33 if (!m_viewManager) { 36 if (!m_viewManager) {
34 initKeys(); 37 initKeys();
35 } 38 }
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;
42 if (!m_cfg) { 68 if (!m_cfg) {
43 m_cfg = new Opie::Core::OConfig("phunkview"); 69 m_cfg = new Opie::Core::OConfig("phunkview");
44 m_cfg->setGroup("image_view_keys" ); 70 m_cfg->setGroup("image_view_keys" );
@@ -136,13 +162,13 @@ void ImageView::setFullScreen(bool how)
136 m_isFullScreen = how; 162 m_isFullScreen = how;
137 if (how) { 163 if (how) {
138 m_ignore_next_in = true; 164 m_ignore_next_in = true;
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
146void ImageView::focusInEvent(QFocusEvent *) 172void ImageView::focusInEvent(QFocusEvent *)
147{ 173{
148 // Always do it here, no matter the size. 174 // Always do it here, no matter the size.
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
@@ -2,12 +2,14 @@
2#define _IMAGE_VIEW_H 2#define _IMAGE_VIEW_H
3 3
4#include <opie2/oimagescrollview.h> 4#include <opie2/oimagescrollview.h>
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;
11 class OKeyConfigManager; 13 class OKeyConfigManager;
12 } 14 }
13} 15}
@@ -48,16 +50,20 @@ protected:
48 Opie::Core::OConfig * m_cfg; 50 Opie::Core::OConfig * m_cfg;
49 Opie::Core::OKeyConfigManager*m_viewManager; 51 Opie::Core::OKeyConfigManager*m_viewManager;
50 void initKeys(); 52 void initKeys();
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();
61 virtual void keyReleaseEvent(QKeyEvent * e); 67 virtual void keyReleaseEvent(QKeyEvent * e);
62 virtual void contentsMousePressEvent ( QMouseEvent * e); 68 virtual void contentsMousePressEvent ( QMouseEvent * e);
63}; 69};
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
@@ -308,12 +308,13 @@ void PMainWindow::initDisp() {
308 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 308 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
309 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 309 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
310 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 310 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
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
317void PMainWindow::slotToggleFullScreen() 318void PMainWindow::slotToggleFullScreen()
318{ 319{
319 odebug << "Toggle full " << oendl; 320 odebug << "Toggle full " << oendl;