Diffstat (limited to 'noncore/graphics/opie-eye/gui/imageview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index a20c879..c7e48cb 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -5,12 +5,13 @@ | |||
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 | #include <qtimer.h> |
11 | #include <qaction.h> | ||
11 | 12 | ||
12 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
13 | 14 | ||
14 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) | 15 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) |
15 | : Opie::MM::OImageScrollView(parent,name,fl) | 16 | : Opie::MM::OImageScrollView(parent,name,fl) |
16 | { | 17 | { |
@@ -20,12 +21,22 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
20 | m_isFullScreen = false; | 21 | m_isFullScreen = false; |
21 | m_ignore_next_in = false; | 22 | m_ignore_next_in = false; |
22 | m_slideTimer = 0; | 23 | m_slideTimer = 0; |
23 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); | 24 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); |
24 | initKeys(); | 25 | initKeys(); |
25 | m_slideValue = 5; | 26 | m_slideValue = 5; |
27 | m_gDisplayType = 0; | ||
28 | m_gPrevNext = 0; | ||
29 | m_hGroup = 0; | ||
30 | } | ||
31 | |||
32 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) | ||
33 | { | ||
34 | m_gDisplayType = disptypeGroup; | ||
35 | m_gPrevNext = nextprevGroup; | ||
36 | m_hGroup = hGroup; | ||
26 | } | 37 | } |
27 | 38 | ||
28 | ImageView::~ImageView() | 39 | ImageView::~ImageView() |
29 | { | 40 | { |
30 | odebug << "Delete Imageview" << oendl; | 41 | odebug << "Delete Imageview" << oendl; |
31 | delete m_viewManager; | 42 | delete m_viewManager; |
@@ -46,12 +57,22 @@ void ImageView::startSlide(int value) | |||
46 | } | 57 | } |
47 | m_slideValue=value; | 58 | m_slideValue=value; |
48 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); | 59 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); |
49 | m_slideTimer->start(m_slideValue*1000,true); | 60 | m_slideTimer->start(m_slideValue*1000,true); |
50 | } | 61 | } |
51 | 62 | ||
63 | void ImageView::stopSlide() | ||
64 | { | ||
65 | if (!m_slideTimer) { | ||
66 | return; | ||
67 | } | ||
68 | m_slideTimer->stop(); | ||
69 | delete m_slideTimer; | ||
70 | m_slideTimer = 0; | ||
71 | } | ||
72 | |||
52 | void ImageView::nextSlide() | 73 | void ImageView::nextSlide() |
53 | { | 74 | { |
54 | if (!m_slideTimer) { | 75 | if (!m_slideTimer) { |
55 | return; | 76 | return; |
56 | } | 77 | } |
57 | if (isHidden()) { | 78 | if (isHidden()) { |
@@ -139,24 +160,36 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
139 | if (e->button()==1) { | 160 | if (e->button()==1) { |
140 | return OImageScrollView::contentsMousePressEvent(e); | 161 | return OImageScrollView::contentsMousePressEvent(e); |
141 | } | 162 | } |
142 | odebug << "Popup " << oendl; | 163 | odebug << "Popup " << oendl; |
143 | QPopupMenu *m = new QPopupMenu(0); | 164 | QPopupMenu *m = new QPopupMenu(0); |
144 | if (!m) return; | 165 | if (!m) return; |
145 | m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); | 166 | if (m_hGroup) { |
167 | m_hGroup->addTo(m); | ||
168 | } | ||
146 | if (fullScreen()) { | 169 | if (fullScreen()) { |
170 | if (m_gPrevNext) { | ||
147 | m->insertSeparator(); | 171 | m->insertSeparator(); |
148 | m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); | 172 | m_gPrevNext->addTo(m); |
149 | m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); | 173 | } |
174 | if (m_gDisplayType) { | ||
150 | m->insertSeparator(); | 175 | m->insertSeparator(); |
151 | m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); | 176 | m_gDisplayType->addTo(m); |
152 | m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); | 177 | } |
153 | m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); | ||
154 | } | 178 | } |
155 | m->setFocus(); | 179 | m->setFocus(); |
156 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 180 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
181 | if (m_hGroup) { | ||
182 | m_hGroup->removeFrom(m); | ||
183 | } | ||
184 | if (m_gPrevNext) { | ||
185 | m_gPrevNext->removeFrom(m); | ||
186 | } | ||
187 | if (m_gDisplayType) { | ||
188 | m_gDisplayType->removeFrom(m); | ||
189 | } | ||
157 | delete m; | 190 | delete m; |
158 | } | 191 | } |
159 | 192 | ||
160 | void ImageView::setFullScreen(bool how) | 193 | void ImageView::setFullScreen(bool how) |
161 | { | 194 | { |
162 | m_isFullScreen = how; | 195 | m_isFullScreen = how; |