-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 45 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 11 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 3 |
3 files changed, 19 insertions, 40 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 5b00dea..03f3c1c 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -1,36 +1,36 @@ | |||
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 | 10 | ||
11 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
12 | 12 | ||
13 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) | 13 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) |
14 | : Opie::MM::OImageScrollView(parent,name,fl) | 14 | : Opie::MM::OImageScrollView(parent,name,fl) |
15 | { | 15 | { |
16 | m_viewManager = 0; | 16 | m_viewManager = 0; |
17 | m_focus_out = false; | 17 | focus_in_count = 0; |
18 | block_next_focus = true; | ||
19 | m_cfg = cfg; | 18 | m_cfg = cfg; |
20 | m_isFullScreen = false; | 19 | m_isFullScreen = false; |
20 | m_ignore_next_in = false; | ||
21 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); | 21 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); |
22 | initKeys(); | 22 | initKeys(); |
23 | } | 23 | } |
24 | 24 | ||
25 | ImageView::~ImageView() | 25 | ImageView::~ImageView() |
26 | { | 26 | { |
27 | odebug << "Delete Imageview" << oendl; | 27 | odebug << "Delete Imageview" << oendl; |
28 | if (m_viewManager) { | 28 | if (m_viewManager) { |
29 | delete m_viewManager; | 29 | delete m_viewManager; |
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | Opie::Core::OKeyConfigManager* ImageView::manager() | 33 | Opie::Core::OKeyConfigManager* ImageView::manager() |
34 | { | 34 | { |
35 | if (!m_viewManager) { | 35 | if (!m_viewManager) { |
36 | initKeys(); | 36 | initKeys(); |
@@ -94,92 +94,75 @@ void ImageView::keyReleaseEvent(QKeyEvent * e) | |||
94 | if (!e || e->state()!=0) { | 94 | if (!e || e->state()!=0) { |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); | 97 | if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); |
98 | } | 98 | } |
99 | 99 | ||
100 | void ImageView::slotShowImageInfo() | 100 | void ImageView::slotShowImageInfo() |
101 | { | 101 | { |
102 | emit dispImageInfo(m_lastName); | 102 | emit dispImageInfo(m_lastName); |
103 | } | 103 | } |
104 | 104 | ||
105 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 105 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
106 | { | 106 | { |
107 | if (e->button()==1) { | 107 | if (e->button()==1) { |
108 | return OImageScrollView::contentsMousePressEvent(e); | 108 | return OImageScrollView::contentsMousePressEvent(e); |
109 | } | 109 | } |
110 | // if (!fullScreen()) return; | ||
111 | odebug << "Popup " << oendl; | 110 | odebug << "Popup " << oendl; |
112 | QPopupMenu *m = new QPopupMenu(0); | 111 | QPopupMenu *m = new QPopupMenu(0); |
113 | if (!m) return; | 112 | if (!m) return; |
114 | bool old = fullScreen(); | 113 | bool old = fullScreen(); |
115 | m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); | 114 | m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); |
116 | if (fullScreen()) { | 115 | if (fullScreen()) { |
117 | m->insertSeparator(); | 116 | m->insertSeparator(); |
118 | m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); | 117 | m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); |
119 | m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); | 118 | m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); |
120 | m->insertSeparator(); | 119 | m->insertSeparator(); |
121 | m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); | 120 | m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); |
122 | m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); | 121 | m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); |
123 | m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); | 122 | m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); |
124 | } | 123 | } |
125 | m->setFocus(); | 124 | m->setFocus(); |
126 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 125 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
127 | delete m; | 126 | delete m; |
128 | /* if we were fullScreen() and must overlap the taskbar again */ | ||
129 | if (fullScreen() && old) { | ||
130 | enableFullscreen(); | ||
131 | } | ||
132 | } | 127 | } |
133 | 128 | ||
134 | void ImageView::setFullScreen(bool how) | 129 | void ImageView::setFullScreen(bool how) |
135 | { | 130 | { |
136 | m_isFullScreen = how; | 131 | m_isFullScreen = how; |
137 | } | 132 | } |
138 | 133 | ||
139 | void ImageView::focusInEvent(QFocusEvent *) | 134 | void ImageView::focusInEvent(QFocusEvent *) |
140 | { | 135 | { |
141 | // Always do it here, no matter the size. | 136 | // Always do it here, no matter the size. |
142 | odebug << "Focus in" << oendl; | 137 | odebug << "Focus in (view)" << oendl; |
143 | } | 138 | //if (fullScreen()) parentWidget()->showNormal(); |
144 | 139 | if (m_ignore_next_in){m_ignore_next_in=false;return;} | |
145 | void ImageView::focusOutEvent(QFocusEvent *) | 140 | if (fullScreen()) enableFullscreen(); |
146 | { | ||
147 | odebug << "Focus out" << oendl; | ||
148 | } | 141 | } |
149 | 142 | ||
150 | void ImageView::enableFullscreen() | 143 | void ImageView::enableFullscreen() |
151 | { | 144 | { |
152 | // This call is needed because showFullScreen won't work | 145 | // This call is needed because showFullScreen won't work |
153 | // correctly if the widget already considers itself to be fullscreen. | 146 | // correctly if the widget already considers itself to be fullscreen. |
147 | if (!fullScreen()) return; | ||
148 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} | ||
149 | |||
154 | setUpdatesEnabled(false); | 150 | setUpdatesEnabled(false); |
155 | odebug << "showNormal();" << oendl; | ||
156 | parentWidget()->showNormal(); | 151 | parentWidget()->showNormal(); |
157 | odebug << "showNormal(); done " << oendl; | ||
158 | // This is needed because showNormal() forcefully changes the window | 152 | // This is needed because showNormal() forcefully changes the window |
159 | // style to WSTyle_TopLevel. | 153 | // style to WSTyle_TopLevel. |
160 | odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));" << oendl; | ||
161 | parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 154 | parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
162 | odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); done" << oendl; | ||
163 | // Enable fullscreen. | 155 | // Enable fullscreen. |
164 | odebug << "showFullScreen();" << oendl; | 156 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus |
157 | * so we must block it here! */ | ||
158 | m_ignore_next_in = true; | ||
165 | parentWidget()->showFullScreen(); | 159 | parentWidget()->showFullScreen(); |
166 | odebug << "showFullScreen(); done" << oendl; | ||
167 | setUpdatesEnabled(true); | 160 | setUpdatesEnabled(true); |
168 | } | 161 | } |
169 | 162 | ||
170 | void ImageWidget::show() | ||
171 | { | ||
172 | QWidget::show(); | ||
173 | } | ||
174 | |||
175 | void ImageWidget::hide() | ||
176 | { | ||
177 | QWidget::hide(); | ||
178 | } | ||
179 | |||
180 | ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f) | 163 | ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f) |
181 | : QWidget(parent,name,f) | 164 | : QWidget(parent,name,f) |
182 | { | 165 | { |
183 | // Make sure size is correct | 166 | // Make sure size is correct |
184 | setFixedSize(qApp->desktop()->size()); | 167 | setFixedSize(qApp->desktop()->size()); |
185 | } | 168 | } |
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 5f15bc9..f3c37b5 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -18,63 +18,60 @@ class ImageView:public Opie::MM::OImageScrollView | |||
18 | 18 | ||
19 | enum ActionIds { | 19 | enum ActionIds { |
20 | ViewInfo, | 20 | ViewInfo, |
21 | FullScreen, | 21 | FullScreen, |
22 | ShowNext, | 22 | ShowNext, |
23 | ShowPrevious, | 23 | ShowPrevious, |
24 | Zoomer, | 24 | Zoomer, |
25 | Autorotate, | 25 | Autorotate, |
26 | Autoscale | 26 | Autoscale |
27 | }; | 27 | }; |
28 | 28 | ||
29 | public: | 29 | public: |
30 | ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); | 30 | ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); |
31 | virtual ~ImageView(); | 31 | virtual ~ImageView(); |
32 | Opie::Core::OKeyConfigManager* manager(); | 32 | Opie::Core::OKeyConfigManager* manager(); |
33 | void setFullScreen(bool how); | 33 | void setFullScreen(bool how); |
34 | virtual void enableFullscreen(); | ||
35 | bool fullScreen(){return m_isFullScreen;} | 34 | bool fullScreen(){return m_isFullScreen;} |
35 | virtual void enableFullscreen(); | ||
36 | 36 | ||
37 | signals: | 37 | signals: |
38 | void dispImageInfo(const QString&); | 38 | void dispImageInfo(const QString&); |
39 | void dispNext(); | 39 | void dispNext(); |
40 | void dispPrev(); | 40 | void dispPrev(); |
41 | void toggleFullScreen(); | 41 | void toggleFullScreen(); |
42 | void hideMe(); | 42 | void hideMe(); |
43 | void toggleZoomer(); | 43 | void toggleZoomer(); |
44 | void toggleAutoscale(); | 44 | void toggleAutoscale(); |
45 | void toggleAutorotate(); | 45 | void toggleAutorotate(); |
46 | 46 | ||
47 | protected: | 47 | protected: |
48 | Opie::Core::OConfig * m_cfg; | 48 | Opie::Core::OConfig * m_cfg; |
49 | Opie::Core::OKeyConfigManager*m_viewManager; | 49 | Opie::Core::OKeyConfigManager*m_viewManager; |
50 | void initKeys(); | 50 | void initKeys(); |
51 | bool m_isFullScreen:1; | 51 | bool m_isFullScreen:1; |
52 | bool m_focus_out:1; | 52 | bool m_ignore_next_in:1; |
53 | bool block_next_focus:1; | 53 | int focus_in_count; |
54 | |||
55 | virtual void focusInEvent ( QFocusEvent * ); | 54 | virtual void focusInEvent ( QFocusEvent * ); |
56 | virtual void focusOutEvent ( QFocusEvent * ); | 55 | |
57 | 56 | ||
58 | protected slots: | 57 | protected slots: |
59 | virtual void slotShowImageInfo(); | 58 | virtual void slotShowImageInfo(); |
60 | virtual void keyReleaseEvent(QKeyEvent * e); | 59 | virtual void keyReleaseEvent(QKeyEvent * e); |
61 | virtual void contentsMousePressEvent ( QMouseEvent * e); | 60 | virtual void contentsMousePressEvent ( QMouseEvent * e); |
62 | }; | 61 | }; |
63 | 62 | ||
64 | class ImageWidget:public QWidget | 63 | class ImageWidget:public QWidget |
65 | { | 64 | { |
66 | Q_OBJECT | 65 | Q_OBJECT |
67 | public: | 66 | public: |
68 | ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder); | 67 | ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder); |
69 | virtual ~ImageWidget(){}; | 68 | virtual ~ImageWidget(){}; |
70 | 69 | ||
71 | protected: | 70 | protected: |
72 | 71 | ||
73 | public slots: | 72 | public slots: |
74 | virtual void show(); | ||
75 | virtual void hide(); | ||
76 | 73 | ||
77 | protected slots: | 74 | protected slots: |
78 | }; | 75 | }; |
79 | 76 | ||
80 | #endif | 77 | #endif |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index fa1680c..cdaf34c 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -385,34 +385,33 @@ void PMainWindow::slotShowInfo( const QString& inf ) { | |||
385 | m_stack->raiseWidget( ImageInfo ); | 385 | m_stack->raiseWidget( ImageInfo ); |
386 | } | 386 | } |
387 | 387 | ||
388 | void PMainWindow::slotDisplay( const QString& inf ) { | 388 | void PMainWindow::slotDisplay( const QString& inf ) { |
389 | if ( !m_disp ) { | 389 | if ( !m_disp ) { |
390 | initDisp(); | 390 | initDisp(); |
391 | } | 391 | } |
392 | m_disp->setImage( inf ); | 392 | m_disp->setImage( inf ); |
393 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 393 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
394 | prevButton->show(); | 394 | prevButton->show(); |
395 | nextButton->show(); | 395 | nextButton->show(); |
396 | upButton->hide(); | 396 | upButton->hide(); |
397 | fsButton->hide(); | 397 | fsButton->hide(); |
398 | viewModeButton->hide(); | 398 | viewModeButton->hide(); |
399 | } | 399 | } |
400 | if (m_disp->fullScreen()) { | 400 | if (m_disp->fullScreen()) { |
401 | // tFrame->showFullScreen(); | 401 | tFrame->show();//FullScreen(); |
402 | m_disp->enableFullscreen(); | ||
403 | } else { | 402 | } else { |
404 | m_stack->raiseWidget( ImageDisplay ); | 403 | m_stack->raiseWidget( ImageDisplay ); |
405 | } | 404 | } |
406 | } | 405 | } |
407 | 406 | ||
408 | void PMainWindow::slotReturn() { | 407 | void PMainWindow::slotReturn() { |
409 | raiseIconView(); | 408 | raiseIconView(); |
410 | } | 409 | } |
411 | 410 | ||
412 | 411 | ||
413 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 412 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
414 | /* | 413 | /* |
415 | * return from view | 414 | * return from view |
416 | * or properly quit | 415 | * or properly quit |
417 | */ | 416 | */ |
418 | if ( m_stack->visibleWidget() == m_info || | 417 | if ( m_stack->visibleWidget() == m_info || |