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 | |||
@@ -229,32 +229,36 @@ void PIconView::initKeys() { | |||
229 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 229 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
230 | Resource::loadPixmap("beam"), BeamItem, | 230 | Resource::loadPixmap("beam"), BeamItem, |
231 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), | 231 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), |
232 | this, SLOT(slotBeam())) ); | 232 | this, SLOT(slotBeam())) ); |
233 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", | 233 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", |
234 | Resource::loadPixmap("trash"), DeleteItem, | 234 | Resource::loadPixmap("trash"), DeleteItem, |
235 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), | 235 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), |
236 | this, SLOT(slotTrash())) ); | 236 | this, SLOT(slotTrash())) ); |
237 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", | 237 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", |
238 | Resource::loadPixmap("1to1"), ViewItem, | 238 | Resource::loadPixmap("1to1"), ViewItem, |
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 | /* |
251 | * change one dir up | 255 | * change one dir up |
252 | */ | 256 | */ |
253 | void PIconView::slotDirUp() | 257 | void PIconView::slotDirUp() |
254 | { | 258 | { |
255 | slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); | 259 | slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); |
256 | } | 260 | } |
257 | 261 | ||
258 | /* | 262 | /* |
259 | * change the dir | 263 | * change the dir |
260 | */ | 264 | */ |
@@ -551,66 +555,152 @@ void PIconView::slotBeam() { | |||
551 | */ | 555 | */ |
552 | void PIconView::slotBeamDone( Ir* ir) { | 556 | void PIconView::slotBeamDone( Ir* ir) { |
553 | delete ir; | 557 | delete ir; |
554 | } | 558 | } |
555 | 559 | ||
556 | void PIconView::slotStart() { | 560 | void PIconView::slotStart() { |
557 | m_view->viewport()->setUpdatesEnabled( false ); | 561 | m_view->viewport()->setUpdatesEnabled( false ); |
558 | } | 562 | } |
559 | 563 | ||
560 | void PIconView::slotEnd() { | 564 | 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 | ||
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); |
576 | } | 645 | } |
577 | 646 | ||
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); |
587 | } | 664 | } |
588 | 665 | ||
589 | void PIconView::slotShowImage() | 666 | void PIconView::slotShowImage() |
590 | { | 667 | { |
591 | bool isDir = false; | 668 | bool isDir = false; |
592 | QString name = currentFileName(isDir); | 669 | QString name = currentFileName(isDir); |
593 | if (isDir) return; | 670 | if (isDir) return; |
594 | slotShowImage( name ); | 671 | slotShowImage( name ); |
595 | } | 672 | } |
596 | void PIconView::slotShowImage( const QString& name) { | 673 | 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; |
605 | 695 | ||
606 | slotImageInfo( name ); | 696 | slotImageInfo( name ); |
607 | } | 697 | } |
608 | 698 | ||
609 | void PIconView::slotImageInfo( const QString& name) { | 699 | void PIconView::slotImageInfo( const QString& name) { |
610 | PDirLister *lister = currentView()->dirLister(); | 700 | PDirLister *lister = currentView()->dirLister(); |
611 | QString r_name = lister->nameToFname(name); | 701 | QString r_name = lister->nameToFname(name); |
612 | emit sig_showInfo(r_name ); | 702 | emit sig_showInfo(r_name ); |
613 | } | 703 | } |
614 | 704 | ||
615 | 705 | ||
616 | void PIconView::slotChangeMode( int mode ) { | 706 | void PIconView::slotChangeMode( int mode ) { |
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 | |||
@@ -14,73 +14,77 @@ class QIconViewItem; | |||
14 | class QComboBox; | 14 | class QComboBox; |
15 | class PIconViewItem; | 15 | class PIconViewItem; |
16 | class PDirLister; | 16 | class PDirLister; |
17 | class Ir; | 17 | class Ir; |
18 | 18 | ||
19 | namespace Opie { | 19 | namespace Opie { |
20 | namespace Core{ | 20 | namespace Core{ |
21 | class OConfig; | 21 | class OConfig; |
22 | class OKeyConfigManager; | 22 | class OKeyConfigManager; |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | class PIconView : public QVBox { | 26 | 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 | }; |
32 | public: | 32 | public: |
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 | ||
38 | signals: | 38 | signals: |
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 | ||
42 | public slots: | 43 | public 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 | ||
46 | protected: | 49 | protected: |
47 | void resizeEvent( QResizeEvent* ); | 50 | void resizeEvent( QResizeEvent* ); |
48 | 51 | ||
49 | private: | 52 | private: |
50 | void initKeys(); | 53 | void initKeys(); |
51 | QString currentFileName(bool &isDir)const; | 54 | QString currentFileName(bool &isDir)const; |
52 | QString nextFileName(bool &isDir)const; | 55 | QString nextFileName(bool &isDir)const; |
53 | QString prevFileName(bool &isDir)const; | 56 | QString prevFileName(bool &isDir)const; |
54 | void loadViews(); | 57 | void loadViews(); |
55 | void calculateGrid(); | 58 | void calculateGrid(); |
56 | 59 | ||
57 | private slots: | 60 | private slots: |
58 | void slotDirUp(); | 61 | void slotDirUp(); |
59 | void slotChangeDir(const QString&); | 62 | void slotChangeDir(const QString&); |
60 | void slotTrash(); | 63 | void slotTrash(); |
61 | void slotViewChanged( int ); | 64 | void slotViewChanged( int ); |
62 | void slotReloadDir(); | 65 | void slotReloadDir(); |
63 | void slotRename(); | 66 | void slotRename(); |
64 | void slotBeam(); | 67 | void slotBeam(); |
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& ); |
77 | void addFiles( const QStringList& ); | 81 | void addFiles( const QStringList& ); |
78 | void slotClicked(QIconViewItem* ); | 82 | void slotClicked(QIconViewItem* ); |
79 | void slotRetrun(QIconViewItem* ); | 83 | void slotRetrun(QIconViewItem* ); |
80 | 84 | ||
81 | /**/ | 85 | /**/ |
82 | void slotThumbInfo(const QString&, const QString&); | 86 | void slotThumbInfo(const QString&, const QString&); |
83 | void slotThumbNail(const QString&, const QPixmap&); | 87 | void slotThumbNail(const QString&, const QPixmap&); |
84 | 88 | ||
85 | void slotChangeMode( int ); | 89 | void slotChangeMode( int ); |
86 | private: | 90 | private: |
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 | |||
@@ -1,54 +1,80 @@ | |||
1 | #include "imageview.h" | 1 | #include "imageview.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
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 | ||
11 | using namespace Opie::Core; | 12 | using namespace Opie::Core; |
12 | 13 | ||
13 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) | 14 | ImageView::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 | ||
25 | ImageView::~ImageView() | 28 | ImageView::~ImageView() |
26 | { | 29 | { |
27 | odebug << "Delete Imageview" << oendl; | 30 | odebug << "Delete Imageview" << oendl; |
28 | delete m_viewManager; | 31 | delete m_viewManager; |
29 | } | 32 | } |
30 | 33 | ||
31 | Opie::Core::OKeyConfigManager* ImageView::manager() | 34 | Opie::Core::OKeyConfigManager* ImageView::manager() |
32 | { | 35 | { |
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 | ||
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() |
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" ); |
45 | } | 71 | } |
46 | Opie::Core::OKeyPair::List lst; | 72 | Opie::Core::OKeyPair::List lst; |
47 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 73 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
48 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 74 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
49 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 75 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
50 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 76 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
51 | lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); | 77 | lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); |
52 | 78 | ||
53 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", | 79 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", |
54 | lst, false,this, "image_view_keys" ); | 80 | lst, false,this, "image_view_keys" ); |
@@ -126,33 +152,33 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
126 | m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); | 152 | m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); |
127 | m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); | 153 | m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); |
128 | } | 154 | } |
129 | m->setFocus(); | 155 | m->setFocus(); |
130 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 156 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
131 | delete m; | 157 | delete m; |
132 | } | 158 | } |
133 | 159 | ||
134 | void ImageView::setFullScreen(bool how) | 160 | void ImageView::setFullScreen(bool how) |
135 | { | 161 | { |
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 | ||
146 | void ImageView::focusInEvent(QFocusEvent *) | 172 | void ImageView::focusInEvent(QFocusEvent *) |
147 | { | 173 | { |
148 | // Always do it here, no matter the size. | 174 | // Always do it here, no matter the size. |
149 | odebug << "Focus in (view)" << oendl; | 175 | odebug << "Focus in (view)" << oendl; |
150 | //if (fullScreen()) parentWidget()->showNormal(); | 176 | //if (fullScreen()) parentWidget()->showNormal(); |
151 | if (m_ignore_next_in){m_ignore_next_in=false;return;} | 177 | if (m_ignore_next_in){m_ignore_next_in=false;return;} |
152 | if (fullScreen()) enableFullscreen(); | 178 | if (fullScreen()) enableFullscreen(); |
153 | } | 179 | } |
154 | 180 | ||
155 | void ImageView::hide() | 181 | void ImageView::hide() |
156 | { | 182 | { |
157 | if (fullScreen()) { | 183 | if (fullScreen()) { |
158 | m_ignore_next_in = true; | 184 | m_ignore_next_in = true; |
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 | |||
@@ -1,23 +1,25 @@ | |||
1 | #ifndef _IMAGE_VIEW_H | 1 | #ifndef _IMAGE_VIEW_H |
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 | ||
8 | class QTimer; | ||
9 | |||
8 | namespace Opie { | 10 | namespace Opie { |
9 | namespace Core { | 11 | namespace Core { |
10 | class OConfig; | 12 | class OConfig; |
11 | class OKeyConfigManager; | 13 | class OKeyConfigManager; |
12 | } | 14 | } |
13 | } | 15 | } |
14 | 16 | ||
15 | class ImageView:public Opie::MM::OImageScrollView | 17 | class ImageView:public Opie::MM::OImageScrollView |
16 | { | 18 | { |
17 | Q_OBJECT | 19 | Q_OBJECT |
18 | 20 | ||
19 | enum ActionIds { | 21 | enum ActionIds { |
20 | ViewInfo, | 22 | ViewInfo, |
21 | FullScreen, | 23 | FullScreen, |
22 | ShowNext, | 24 | ShowNext, |
23 | ShowPrevious, | 25 | ShowPrevious, |
@@ -38,28 +40,32 @@ signals: | |||
38 | void dispImageInfo(const QString&); | 40 | void dispImageInfo(const QString&); |
39 | void dispNext(); | 41 | void dispNext(); |
40 | void dispPrev(); | 42 | void dispPrev(); |
41 | void toggleFullScreen(); | 43 | void toggleFullScreen(); |
42 | void hideMe(); | 44 | void hideMe(); |
43 | void toggleZoomer(); | 45 | void toggleZoomer(); |
44 | void toggleAutoscale(); | 46 | void toggleAutoscale(); |
45 | void toggleAutorotate(); | 47 | void toggleAutorotate(); |
46 | 48 | ||
47 | protected: | 49 | 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 | ||
56 | public slots: | 60 | public slots: |
57 | virtual void hide(); | 61 | virtual void hide(); |
62 | virtual void startSlide(int); | ||
63 | virtual void nextSlide(); | ||
58 | 64 | ||
59 | protected slots: | 65 | protected 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 | }; |
64 | 70 | ||
65 | #endif | 71 | #endif |
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 | |||
@@ -298,32 +298,33 @@ void PMainWindow::initDisp() { | |||
298 | if (m_disp) { | 298 | if (m_disp) { |
299 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 299 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
300 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 300 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
301 | } | 301 | } |
302 | m_disp->setAutoScale(autoScale); | 302 | m_disp->setAutoScale(autoScale); |
303 | m_disp->setAutoRotate(autoRotate); | 303 | m_disp->setAutoRotate(autoRotate); |
304 | m_disp->setShowZoomer(zoomerOn); | 304 | m_disp->setShowZoomer(zoomerOn); |
305 | m_disp->setBackgroundColor(white); | 305 | m_disp->setBackgroundColor(white); |
306 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 306 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
307 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 307 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
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 | ||
317 | void PMainWindow::slotToggleFullScreen() | 318 | void PMainWindow::slotToggleFullScreen() |
318 | { | 319 | { |
319 | odebug << "Toggle full " << oendl; | 320 | odebug << "Toggle full " << oendl; |
320 | if (!m_disp) return; | 321 | if (!m_disp) return; |
321 | bool current = !m_disp->fullScreen(); | 322 | bool current = !m_disp->fullScreen(); |
322 | odebug << "Current = " << current << oendl; | 323 | odebug << "Current = " << current << oendl; |
323 | if (current) { | 324 | if (current) { |
324 | odebug << "full" << oendl; | 325 | odebug << "full" << oendl; |
325 | m_disp->setBackgroundColor(black); | 326 | m_disp->setBackgroundColor(black); |
326 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 327 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
327 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 328 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
328 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 329 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
329 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 330 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |