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.cpp | 30 |
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 | |||
@@ -107,13 +107,12 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
107 | if (e->button()==1) { | 107 | if (e->button()==1) { |
108 | return OImageScrollView::contentsMousePressEvent(e); | 108 | return OImageScrollView::contentsMousePressEvent(e); |
109 | } | 109 | } |
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(); |
117 | m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); | 116 | m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); |
118 | m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); | 117 | m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); |
119 | m->insertSeparator(); | 118 | m->insertSeparator(); |
@@ -126,43 +125,50 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
126 | delete m; | 125 | delete m; |
127 | } | 126 | } |
128 | 127 | ||
129 | void ImageView::setFullScreen(bool how) | 128 | void 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 | ||
134 | void ImageView::focusInEvent(QFocusEvent *) | 140 | void ImageView::focusInEvent(QFocusEvent *) |
135 | { | 141 | { |
136 | // Always do it here, no matter the size. | 142 | // Always do it here, no matter the size. |
137 | odebug << "Focus in (view)" << oendl; | 143 | odebug << "Focus in (view)" << oendl; |
138 | //if (fullScreen()) parentWidget()->showNormal(); | 144 | //if (fullScreen()) parentWidget()->showNormal(); |
139 | if (m_ignore_next_in){m_ignore_next_in=false;return;} | 145 | if (m_ignore_next_in){m_ignore_next_in=false;return;} |
140 | if (fullScreen()) enableFullscreen(); | 146 | if (fullScreen()) enableFullscreen(); |
141 | } | 147 | } |
142 | 148 | ||
149 | void ImageView::hide() | ||
150 | { | ||
151 | if (fullScreen()) { | ||
152 | m_ignore_next_in = true; | ||
153 | showNormal(); | ||
154 | } | ||
155 | QWidget::hide(); | ||
156 | } | ||
143 | void ImageView::enableFullscreen() | 157 | void 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 | ||
163 | ImageWidget::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 | |||