summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/imageview.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/imageview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 03f3c1c..b4f3110 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -110,7 +110,6 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
110 odebug << "Popup " << oendl; 110 odebug << "Popup " << oendl;
111 QPopupMenu *m = new QPopupMenu(0); 111 QPopupMenu *m = new QPopupMenu(0);
112 if (!m) return; 112 if (!m) return;
113 bool old = fullScreen();
114 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); 113 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen()));
115 if (fullScreen()) { 114 if (fullScreen()) {
116 m->insertSeparator(); 115 m->insertSeparator();
@@ -129,6 +128,13 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
129void ImageView::setFullScreen(bool how) 128void ImageView::setFullScreen(bool how)
130{ 129{
131 m_isFullScreen = how; 130 m_isFullScreen = how;
131 if (how) {
132 m_ignore_next_in = true;
133 setFixedSize(qApp->desktop()->size());
134 showFullScreen();
135 } else {
136 setMinimumSize(10,10);
137 }
132} 138}
133 139
134void ImageView::focusInEvent(QFocusEvent *) 140void ImageView::focusInEvent(QFocusEvent *)
@@ -140,29 +146,29 @@ void ImageView::focusInEvent(QFocusEvent *)
140 if (fullScreen()) enableFullscreen(); 146 if (fullScreen()) enableFullscreen();
141} 147}
142 148
149void ImageView::hide()
150{
151 if (fullScreen()) {
152 m_ignore_next_in = true;
153 showNormal();
154 }
155 QWidget::hide();
156}
143void ImageView::enableFullscreen() 157void ImageView::enableFullscreen()
144{ 158{
145 // This call is needed because showFullScreen won't work
146 // correctly if the widget already considers itself to be fullscreen.
147 if (!fullScreen()) return; 159 if (!fullScreen()) return;
148 if (m_ignore_next_in) {m_ignore_next_in = false;return;} 160 if (m_ignore_next_in) {m_ignore_next_in = false;return;}
149 161
150 setUpdatesEnabled(false); 162 setUpdatesEnabled(false);
151 parentWidget()->showNormal();
152 // This is needed because showNormal() forcefully changes the window 163 // This is needed because showNormal() forcefully changes the window
153 // style to WSTyle_TopLevel. 164 // style to WSTyle_TopLevel.
154 parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 165 reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
155 // Enable fullscreen. 166 // Enable fullscreen.
156 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus 167 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
157 * so we must block it here! */ 168 * so we must block it here! */
158 m_ignore_next_in = true; 169 m_ignore_next_in = true;
159 parentWidget()->showFullScreen(); 170 showFullScreen();
160 setUpdatesEnabled(true); 171 setUpdatesEnabled(true);
161}
162 172
163ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f)
164 : QWidget(parent,name,f)
165{
166 // Make sure size is correct
167 setFixedSize(qApp->desktop()->size());
168} 173}
174