-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 41 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 26 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 3 |
4 files changed, 62 insertions, 14 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 53376c0..5b00dea 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -16,2 +16,4 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
16 | m_viewManager = 0; | 16 | m_viewManager = 0; |
17 | m_focus_out = false; | ||
18 | block_next_focus = true; | ||
17 | m_cfg = cfg; | 19 | m_cfg = cfg; |
@@ -128,4 +130,2 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
128 | enableFullscreen(); | 130 | enableFullscreen(); |
129 | // parentWidget()->hide(); | ||
130 | // parentWidget()->show(); | ||
131 | } | 131 | } |
@@ -138,7 +138,11 @@ void ImageView::setFullScreen(bool how) | |||
138 | 138 | ||
139 | void ImageView::focusInEvent(QFocusEvent *) | 139 | void ImageView::focusInEvent(QFocusEvent *) |
140 | { | 140 | { |
141 | // Always do it here, no matter the size. | 141 | // Always do it here, no matter the size. |
142 | /* result in an endless loop */ | 142 | odebug << "Focus in" << oendl; |
143 | // if (fullScreen()) enableFullscreen(); | 143 | } |
144 | |||
145 | void ImageView::focusOutEvent(QFocusEvent *) | ||
146 | { | ||
147 | odebug << "Focus out" << oendl; | ||
144 | } | 148 | } |
@@ -147,14 +151,35 @@ void ImageView::enableFullscreen() | |||
147 | { | 151 | { |
148 | if (!fullScreen()) return; | ||
149 | // Make sure size is correct | ||
150 | parentWidget()->setFixedSize(qApp->desktop()->size()); | ||
151 | // This call is needed because showFullScreen won't work | 152 | // This call is needed because showFullScreen won't work |
152 | // correctly if the widget already considers itself to be fullscreen. | 153 | // correctly if the widget already considers itself to be fullscreen. |
154 | setUpdatesEnabled(false); | ||
155 | odebug << "showNormal();" << oendl; | ||
153 | parentWidget()->showNormal(); | 156 | parentWidget()->showNormal(); |
157 | odebug << "showNormal(); done " << oendl; | ||
154 | // This is needed because showNormal() forcefully changes the window | 158 | // This is needed because showNormal() forcefully changes the window |
155 | // style to WSTyle_TopLevel. | 159 | // style to WSTyle_TopLevel. |
160 | odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));" << oendl; | ||
156 | parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 161 | parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
162 | odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); done" << oendl; | ||
157 | // Enable fullscreen. | 163 | // Enable fullscreen. |
164 | odebug << "showFullScreen();" << oendl; | ||
158 | parentWidget()->showFullScreen(); | 165 | parentWidget()->showFullScreen(); |
166 | odebug << "showFullScreen(); done" << oendl; | ||
167 | setUpdatesEnabled(true); | ||
168 | } | ||
169 | |||
170 | void ImageWidget::show() | ||
171 | { | ||
172 | QWidget::show(); | ||
159 | } | 173 | } |
160 | 174 | ||
175 | void ImageWidget::hide() | ||
176 | { | ||
177 | QWidget::hide(); | ||
178 | } | ||
179 | |||
180 | ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f) | ||
181 | : QWidget(parent,name,f) | ||
182 | { | ||
183 | // Make sure size is correct | ||
184 | setFixedSize(qApp->desktop()->size()); | ||
185 | } | ||
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 4d2405f..5f15bc9 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -5,2 +5,4 @@ | |||
5 | 5 | ||
6 | #include <qwidget.h> | ||
7 | |||
6 | namespace Opie { | 8 | namespace Opie { |
@@ -31,2 +33,3 @@ public: | |||
31 | void setFullScreen(bool how); | 33 | void setFullScreen(bool how); |
34 | virtual void enableFullscreen(); | ||
32 | bool fullScreen(){return m_isFullScreen;} | 35 | bool fullScreen(){return m_isFullScreen;} |
@@ -48,3 +51,7 @@ protected: | |||
48 | bool m_isFullScreen:1; | 51 | bool m_isFullScreen:1; |
49 | void enableFullscreen(); | 52 | bool m_focus_out:1; |
53 | bool block_next_focus:1; | ||
54 | |||
55 | virtual void focusInEvent ( QFocusEvent * ); | ||
56 | virtual void focusOutEvent ( QFocusEvent * ); | ||
50 | 57 | ||
@@ -54,3 +61,18 @@ protected slots: | |||
54 | virtual void contentsMousePressEvent ( QMouseEvent * e); | 61 | virtual void contentsMousePressEvent ( QMouseEvent * e); |
55 | virtual void focusInEvent ( QFocusEvent * ); | 62 | }; |
63 | |||
64 | class ImageWidget:public QWidget | ||
65 | { | ||
66 | Q_OBJECT | ||
67 | public: | ||
68 | ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder); | ||
69 | virtual ~ImageWidget(){}; | ||
70 | |||
71 | protected: | ||
72 | |||
73 | public slots: | ||
74 | virtual void show(); | ||
75 | virtual void hide(); | ||
76 | |||
77 | protected slots: | ||
56 | }; | 78 | }; |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index ec6b051..fa1680c 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -333,3 +333,3 @@ void PMainWindow::slotToggleFullScreen() | |||
333 | if (!tFrame) { | 333 | if (!tFrame) { |
334 | tFrame = new QWidget(0,0,WStyle_Customize|WStyle_NoBorder); | 334 | tFrame = new ImageWidget(0,0,WStyle_Customize|WStyle_NoBorder); |
335 | tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 335 | tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
@@ -400,4 +400,4 @@ void PMainWindow::slotDisplay( const QString& inf ) { | |||
400 | if (m_disp->fullScreen()) { | 400 | if (m_disp->fullScreen()) { |
401 | tFrame->setActiveWindow(); | 401 | // tFrame->showFullScreen(); |
402 | tFrame->showFullScreen(); | 402 | m_disp->enableFullscreen(); |
403 | } else { | 403 | } else { |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 1f90f9f..9e94c60 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h | |||
@@ -24,2 +24,3 @@ namespace Core{ | |||
24 | class ImageView; | 24 | class ImageView; |
25 | class ImageWidget; | ||
25 | class PIconView; | 26 | class PIconView; |
@@ -69,3 +70,3 @@ private: | |||
69 | bool zoomerOn; | 70 | bool zoomerOn; |
70 | QWidget*tFrame; | 71 | ImageWidget*tFrame; |
71 | QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; | 72 | QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; |