author | alwin <alwin> | 2005-03-23 18:26:46 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-23 18:26:46 (UTC) |
commit | 76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5 (patch) (unidiff) | |
tree | 8269bc37e5d3addf36194e231e84bce8a9e49e8b | |
parent | 73928229c1ed258a78e815d9089667f0d99e72d8 (diff) | |
download | opie-76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5.zip opie-76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5.tar.gz opie-76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5.tar.bz2 |
dirty hack let opie-eye crash
fixed display problems the right way now I hope
ToDo:
fix flicker when switching images in fullscreen mode while window is
visible
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 27 |
2 files changed, 8 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 03df321..6c3f9cb 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -183,104 +183,104 @@ void ImageView::keyReleaseEvent(QKeyEvent * e) | |||
183 | if (!e || e->state()!=0) { | 183 | if (!e || e->state()!=0) { |
184 | return; | 184 | return; |
185 | } | 185 | } |
186 | if (e->key()==Qt::Key_Escape) { | 186 | if (e->key()==Qt::Key_Escape) { |
187 | if (fullScreen()) { | 187 | if (fullScreen()) { |
188 | emit hideMe(); | 188 | emit hideMe(); |
189 | } | 189 | } |
190 | if (closeIfHide) { | 190 | if (closeIfHide) { |
191 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 191 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | void ImageView::setCloseIfHide(bool how) | 196 | void ImageView::setCloseIfHide(bool how) |
197 | { | 197 | { |
198 | closeIfHide = how; | 198 | closeIfHide = how; |
199 | } | 199 | } |
200 | 200 | ||
201 | void ImageView::slotShowImageInfo() | 201 | void ImageView::slotShowImageInfo() |
202 | { | 202 | { |
203 | emit dispImageInfo(m_lastName); | 203 | emit dispImageInfo(m_lastName); |
204 | } | 204 | } |
205 | 205 | ||
206 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 206 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
207 | { | 207 | { |
208 | if (e->button()==1) { | 208 | if (e->button()==1) { |
209 | return OImageScrollView::contentsMousePressEvent(e); | 209 | return OImageScrollView::contentsMousePressEvent(e); |
210 | } | 210 | } |
211 | odebug << "Popup " << oendl; | 211 | odebug << "Popup " << oendl; |
212 | QPopupMenu *m = new QPopupMenu(this); | 212 | QPopupMenu *m = new QPopupMenu(this); |
213 | if (!m) return; | 213 | if (!m) return; |
214 | if (m_hGroup) { | 214 | if (m_hGroup) { |
215 | m_hGroup->addTo(m); | 215 | m_hGroup->addTo(m); |
216 | } | 216 | } |
217 | if (fullScreen()) { | 217 | if (fullScreen()) { |
218 | if (m_gPrevNext) { | 218 | if (m_gPrevNext) { |
219 | m->insertSeparator(); | 219 | m->insertSeparator(); |
220 | m_gPrevNext->addTo(m); | 220 | m_gPrevNext->addTo(m); |
221 | } | 221 | } |
222 | if (m_gDisplayType) { | 222 | if (m_gDisplayType) { |
223 | m->insertSeparator(); | 223 | m->insertSeparator(); |
224 | m_gDisplayType->addTo(m); | 224 | m_gDisplayType->addTo(m); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | m->setFocus(); | 227 | m->setFocus(); |
228 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 228 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
229 | if (m_hGroup) { | 229 | if (m_hGroup) { |
230 | m_hGroup->removeFrom(m); | 230 | m_hGroup->removeFrom(m); |
231 | } | 231 | } |
232 | if (m_gPrevNext) { | 232 | if (m_gPrevNext) { |
233 | m_gPrevNext->removeFrom(m); | 233 | m_gPrevNext->removeFrom(m); |
234 | } | 234 | } |
235 | if (m_gDisplayType) { | 235 | if (m_gDisplayType) { |
236 | m_gDisplayType->removeFrom(m); | 236 | m_gDisplayType->removeFrom(m); |
237 | } | 237 | } |
238 | delete m; | 238 | delete m; |
239 | } | 239 | } |
240 | 240 | ||
241 | void ImageView::setFullScreen(bool how,bool force) | 241 | void ImageView::setFullScreen(bool how,bool force) |
242 | { | 242 | { |
243 | m_isFullScreen = how; | 243 | m_isFullScreen = how; |
244 | if (how) { | 244 | if (how) { |
245 | m_ignore_next_in = true; | 245 | m_ignore_next_in = true; |
246 | // setFixedSize(qApp->desktop()->size()); | 246 | // setFixedSize(qApp->desktop()->size()); |
247 | setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); | 247 | setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); |
248 | if (force) showFullScreen(); | 248 | if (force) showFullScreen(); |
249 | } else { | 249 | } else { |
250 | // setMinimumSize(10,10); | 250 | // setMinimumSize(10,10); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | void ImageView::focusInEvent(QFocusEvent *) | 254 | void ImageView::focusInEvent(QFocusEvent *) |
255 | { | 255 | { |
256 | // Always do it here, no matter the size. | 256 | // Always do it here, no matter the size. |
257 | odebug << "Focus in (view)" << oendl; | 257 | odebug << "Focus in (view)" << oendl; |
258 | //if (fullScreen()) parentWidget()->showNormal(); | 258 | //if (fullScreen()) parentWidget()->showNormal(); |
259 | if (m_ignore_next_in){m_ignore_next_in=false;return;} | 259 | if (m_ignore_next_in){m_ignore_next_in=false;return;} |
260 | if (fullScreen()) enableFullscreen(); | 260 | if (fullScreen()) enableFullscreen(); |
261 | } | 261 | } |
262 | 262 | ||
263 | void ImageView::hide() | 263 | void ImageView::hide() |
264 | { | 264 | { |
265 | if (fullScreen()) { | 265 | if (fullScreen()) { |
266 | m_ignore_next_in = true; | 266 | m_ignore_next_in = true; |
267 | showNormal(); | 267 | showNormal(); |
268 | } | 268 | } |
269 | QWidget::hide(); | 269 | QWidget::hide(); |
270 | } | 270 | } |
271 | void ImageView::enableFullscreen() | 271 | void ImageView::enableFullscreen() |
272 | { | 272 | { |
273 | if (!fullScreen()) return; | 273 | if (!fullScreen()) return; |
274 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} | 274 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} |
275 | 275 | ||
276 | setUpdatesEnabled(false); | 276 | setUpdatesEnabled(false); |
277 | // This is needed because showNormal() forcefully changes the window | 277 | // This is needed because showNormal() forcefully changes the window |
278 | // style to WSTyle_TopLevel. | 278 | // style to WSTyle_TopLevel. |
279 | reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 279 | reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
280 | // Enable fullscreen. | 280 | // Enable fullscreen. |
281 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus | 281 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus |
282 | * so we must block it here! */ | 282 | * so we must block it here! */ |
283 | m_ignore_next_in = true; | 283 | m_ignore_next_in = true; |
284 | showFullScreen(); | 284 | showFullScreen(); |
285 | setUpdatesEnabled(true); | 285 | setUpdatesEnabled(true); |
286 | } | 286 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 3a89dfd..d11e4e1 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -214,300 +214,287 @@ void PMainWindow::slotConfig() { | |||
214 | if ( act ) { | 214 | if ( act ) { |
215 | keyWid->save(); | 215 | keyWid->save(); |
216 | m_disp->manager()->save(); | 216 | m_disp->manager()->save(); |
217 | m_info->manager()->save(); | 217 | m_info->manager()->save(); |
218 | m_view->manager()->save(); | 218 | m_view->manager()->save(); |
219 | bSetup->save_values(); | 219 | bSetup->save_values(); |
220 | m_view->resetView(); | 220 | m_view->resetView(); |
221 | readConfig(); | 221 | readConfig(); |
222 | } | 222 | } |
223 | delete keyWid; | 223 | delete keyWid; |
224 | 224 | ||
225 | m_stack->raiseWidget(w); | 225 | m_stack->raiseWidget(w); |
226 | if (remdisp) { | 226 | if (remdisp) { |
227 | m_disp->hide(); | 227 | m_disp->hide(); |
228 | } | 228 | } |
229 | if (reminfo) { | 229 | if (reminfo) { |
230 | m_info->hide(); | 230 | m_info->hide(); |
231 | } | 231 | } |
232 | if (m_disp) { | 232 | if (m_disp) { |
233 | m_disp->setIntensity(m_Intensity,true); | 233 | m_disp->setIntensity(m_Intensity,true); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | /* | 237 | /* |
238 | * create a new image info component | 238 | * create a new image info component |
239 | * and detach the current one | 239 | * and detach the current one |
240 | * we will make the other delete on exit | 240 | * we will make the other delete on exit |
241 | */ | 241 | */ |
242 | template<class T> | 242 | template<class T> |
243 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 243 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
244 | if ( *ptr ) { | 244 | if ( *ptr ) { |
245 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 245 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
246 | (*ptr)->setDestructiveClose(); | 246 | (*ptr)->setDestructiveClose(); |
247 | m_stack->removeWidget( *ptr ); | 247 | m_stack->removeWidget( *ptr ); |
248 | } | 248 | } |
249 | *ptr = new T(m_cfg, m_stack, name ); | 249 | *ptr = new T(m_cfg, m_stack, name ); |
250 | m_stack->addWidget( *ptr, id ); | 250 | m_stack->addWidget( *ptr, id ); |
251 | 251 | ||
252 | connect(*ptr, SIGNAL(sig_return()), | 252 | connect(*ptr, SIGNAL(sig_return()), |
253 | this,SLOT(slotReturn())); | 253 | this,SLOT(slotReturn())); |
254 | 254 | ||
255 | } | 255 | } |
256 | 256 | ||
257 | void PMainWindow::initInfo() { | 257 | void PMainWindow::initInfo() { |
258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void PMainWindow::initDisp() { | 262 | void PMainWindow::initDisp() { |
263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
264 | if (m_disp) { | 264 | if (m_disp) { |
265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
267 | // } | 267 | // } |
268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
271 | m_disp->setShowZoomer(m_aZoomer->isOn()); | 271 | m_disp->setShowZoomer(m_aZoomer->isOn()); |
272 | m_disp->setBackgroundColor(white); | 272 | m_disp->setBackgroundColor(white); |
273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | 281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); |
282 | slotFullScreenToggled(m_aFullScreen->isOn()); | 282 | slotFullScreenToggled(m_aFullScreen->isOn()); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | void PMainWindow::slotToggleFullScreen() | 286 | void PMainWindow::slotToggleFullScreen() |
287 | { | 287 | { |
288 | bool current = !m_aFullScreen->isOn(); | 288 | bool current = !m_aFullScreen->isOn(); |
289 | m_aFullScreen->setOn(current); | 289 | m_aFullScreen->setOn(current); |
290 | } | 290 | } |
291 | 291 | ||
292 | void PMainWindow::slotFullScreenButton(bool current) | 292 | void PMainWindow::slotFullScreenButton(bool current) |
293 | { | 293 | { |
294 | if (autoSave) { | 294 | if (autoSave) { |
295 | m_cfg->writeEntry("fullscreen",current); | 295 | m_cfg->writeEntry("fullscreen",current); |
296 | } | 296 | } |
297 | if (!m_disp) return; | 297 | if (!m_disp) return; |
298 | if (m_disp->isVisible()) { | 298 | if (m_disp->isVisible()) { |
299 | setupViewWindow(current, true); | 299 | setupViewWindow(current, true); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | 303 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) |
304 | { | 304 | { |
305 | if (!m_disp) { | 305 | if (!m_disp) { |
306 | return; | 306 | return; |
307 | } | 307 | } |
308 | if (current) { | 308 | if (current) { |
309 | m_disp->setBackgroundColor(black); | 309 | m_disp->setBackgroundColor(black); |
310 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 310 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
311 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 311 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
312 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 312 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
313 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 313 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
314 | m_disp->setFullScreen(current,forceDisplay); | 314 | m_disp->setFullScreen(current,forceDisplay); |
315 | } else { | 315 | } else { |
316 | setUpdatesEnabled(false); | 316 | setUpdatesEnabled(false); |
317 | #if 0 | 317 | #if 0 |
318 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 318 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
319 | 319 | ||
320 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 320 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
321 | } else { | 321 | } else { |
322 | //m_disp->setMinimumSize(10,10); | 322 | //m_disp->setMinimumSize(10,10); |
323 | } | 323 | } |
324 | #endif | 324 | #endif |
325 | m_disp->setBackgroundColor(white); | 325 | m_disp->setBackgroundColor(white); |
326 | m_stack->addWidget(m_disp,ImageDisplay); | 326 | m_stack->addWidget(m_disp,ImageDisplay); |
327 | m_disp->setVScrollBarMode(QScrollView::Auto); | 327 | m_disp->setVScrollBarMode(QScrollView::Auto); |
328 | m_disp->setHScrollBarMode(QScrollView::Auto); | 328 | m_disp->setHScrollBarMode(QScrollView::Auto); |
329 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 329 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
330 | m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); | 330 | m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); |
331 | } | 331 | } |
332 | if (forceDisplay || m_disp->isVisible()) { | 332 | if (forceDisplay || m_disp->isVisible()) { |
333 | m_stack->raiseWidget(m_disp); | 333 | m_stack->raiseWidget(m_disp); |
334 | m_disp->setFocus(); | 334 | m_disp->setFocus(); |
335 | } | 335 | } |
336 | setUpdatesEnabled(true); | 336 | setUpdatesEnabled(true); |
337 | } | 337 | } |
338 | m_disp->setFullScreen(current,forceDisplay); | 338 | m_disp->setFullScreen(current,forceDisplay); |
339 | } | 339 | } |
340 | 340 | ||
341 | void PMainWindow::slotFullScreenToggled(bool current) | 341 | void PMainWindow::slotFullScreenToggled(bool current) |
342 | { | 342 | { |
343 | setupViewWindow(current,true); | 343 | setupViewWindow(current,true); |
344 | } | 344 | } |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * With big Screen the plan could be to 'detach' the image | 347 | * With big Screen the plan could be to 'detach' the image |
348 | * window if visible and to create a ne wone | 348 | * window if visible and to create a ne wone |
349 | * init* already supports it but I make no use of it for | 349 | * init* already supports it but I make no use of it for |
350 | * now. We set filename and raise | 350 | * now. We set filename and raise |
351 | * | 351 | * |
352 | * ### FIXME and talk to alwin | 352 | * ### FIXME and talk to alwin |
353 | */ | 353 | */ |
354 | void PMainWindow::slotShowInfo( const QString& inf ) { | 354 | void PMainWindow::slotShowInfo( const QString& inf ) { |
355 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 355 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
356 | return; | 356 | return; |
357 | } | 357 | } |
358 | if ( !m_info ) { | 358 | if ( !m_info ) { |
359 | initInfo(); | 359 | initInfo(); |
360 | } | 360 | } |
361 | m_info->setPath( inf ); | 361 | m_info->setPath( inf ); |
362 | if (m_SmallWindow) { | 362 | if (m_SmallWindow) { |
363 | m_aNext->removeFrom(toolBar); | 363 | m_aNext->removeFrom(toolBar); |
364 | m_aPrevious->removeFrom(toolBar); | 364 | m_aPrevious->removeFrom(toolBar); |
365 | fsButton->hide(); | 365 | fsButton->hide(); |
366 | } | 366 | } |
367 | m_aNext->setEnabled(false); | 367 | m_aNext->setEnabled(false); |
368 | m_aPrevious->setEnabled(false); | 368 | m_aPrevious->setEnabled(false); |
369 | m_aDirUp->setEnabled(false); | 369 | m_aDirUp->setEnabled(false); |
370 | m_aShowInfo->setEnabled(false); | 370 | m_aShowInfo->setEnabled(false); |
371 | m_aViewfile->setEnabled(true); | 371 | m_aViewfile->setEnabled(true); |
372 | m_aStartSlide->setEnabled(false); | 372 | m_aStartSlide->setEnabled(false); |
373 | m_stack->raiseWidget( ImageInfo ); | 373 | m_stack->raiseWidget( ImageInfo ); |
374 | } | 374 | } |
375 | 375 | ||
376 | void PMainWindow::slotDisplay( const QString& inf ) { | 376 | void PMainWindow::slotDisplay( const QString& inf ) { |
377 | bool nwindow = false; | 377 | bool nwindow = false; |
378 | bool disp_hack = false; | ||
379 | int lb; | ||
380 | if (m_disp && m_disp->fullScreen()) { | ||
381 | lb = m_disp->Intensity(); | ||
382 | delete m_disp; | ||
383 | m_disp = 0; | ||
384 | |||
385 | disp_hack = true; | ||
386 | } | ||
387 | if ( !m_disp ) { | 378 | if ( !m_disp ) { |
388 | nwindow = true; | 379 | nwindow = true; |
389 | initDisp(); | 380 | initDisp(); |
390 | m_disp->setIntensity((disp_hack?lb:m_Intensity)); | 381 | m_disp->setIntensity(m_Intensity); |
382 | m_setCurrentBrightness->setEnabled(true); | ||
391 | } | 383 | } |
392 | m_setCurrentBrightness->setEnabled(true); | ||
393 | |||
394 | Opie::Ui::OWait wdlg; | ||
395 | wdlg.setTimerLength(30); | ||
396 | wdlg.show(); | ||
397 | //qApp->processEvents(20); | ||
398 | m_disp->setImage( inf ); | 384 | m_disp->setImage( inf ); |
399 | wdlg.hide(); | ||
400 | //qApp->processEvents(20); | ||
401 | if (m_SmallWindow) { | 385 | if (m_SmallWindow) { |
402 | if (m_gPrevNext->isEnabled()==false) { | 386 | if (m_gPrevNext->isEnabled()==false) { |
403 | m_gPrevNext->addTo(toolBar); | 387 | m_gPrevNext->addTo(toolBar); |
404 | fsButton->hide(); | 388 | fsButton->hide(); |
405 | } | 389 | } |
406 | } | 390 | } |
407 | m_gPrevNext->setEnabled(true); | 391 | m_gPrevNext->setEnabled(true); |
408 | m_aDirUp->setEnabled(false); | 392 | m_aDirUp->setEnabled(false); |
409 | m_aShowInfo->setEnabled(true); | 393 | m_aShowInfo->setEnabled(true); |
410 | m_aViewfile->setEnabled(false); | 394 | m_aViewfile->setEnabled(false); |
411 | m_aStartSlide->setEnabled(false); | 395 | m_aStartSlide->setEnabled(false); |
412 | 396 | ||
413 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { | 397 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { |
414 | slotFullScreenToggled(m_aFullScreen->isOn()); | 398 | slotFullScreenToggled(m_aFullScreen->isOn()); |
415 | } | 399 | } |
416 | if (m_disp->fullScreen()) { | 400 | if (m_disp->fullScreen()) { |
417 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 401 | if (!m_disp->isVisible()) { |
402 | m_disp->showFullScreen(); | ||
403 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | ||
404 | } | ||
418 | } else { | 405 | } else { |
419 | m_stack->raiseWidget( ImageDisplay ); | 406 | m_stack->raiseWidget( ImageDisplay ); |
420 | } | 407 | } |
421 | } | 408 | } |
422 | 409 | ||
423 | void PMainWindow::raiseIconView() { | 410 | void PMainWindow::raiseIconView() { |
424 | setUpdatesEnabled(false); | 411 | setUpdatesEnabled(false); |
425 | if (m_SmallWindow) { | 412 | if (m_SmallWindow) { |
426 | m_gPrevNext->removeFrom(toolBar); | 413 | m_gPrevNext->removeFrom(toolBar); |
427 | fsButton->show(); | 414 | fsButton->show(); |
428 | } | 415 | } |
429 | m_gPrevNext->setEnabled(false); | 416 | m_gPrevNext->setEnabled(false); |
430 | m_aDirUp->setEnabled(true); | 417 | m_aDirUp->setEnabled(true); |
431 | m_aShowInfo->setEnabled(true); | 418 | m_aShowInfo->setEnabled(true); |
432 | m_aViewfile->setEnabled(true); | 419 | m_aViewfile->setEnabled(true); |
433 | m_aStartSlide->setEnabled(true); | 420 | m_aStartSlide->setEnabled(true); |
434 | 421 | ||
435 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 422 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
436 | m_disp->stopSlide(); | 423 | m_disp->stopSlide(); |
437 | m_disp->hide(); | 424 | m_disp->hide(); |
438 | } | 425 | } |
439 | m_stack->raiseWidget( IconView ); | 426 | m_stack->raiseWidget( IconView ); |
440 | setUpdatesEnabled(true); | 427 | setUpdatesEnabled(true); |
441 | repaint(); | 428 | repaint(); |
442 | } | 429 | } |
443 | 430 | ||
444 | void PMainWindow::slotReturn() { | 431 | void PMainWindow::slotReturn() { |
445 | raiseIconView(); | 432 | raiseIconView(); |
446 | } | 433 | } |
447 | 434 | ||
448 | 435 | ||
449 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 436 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
450 | /* | 437 | /* |
451 | * return from view | 438 | * return from view |
452 | * or properly quit | 439 | * or properly quit |
453 | */ | 440 | */ |
454 | if (!m_setDocCalled) { | 441 | if (!m_setDocCalled) { |
455 | if ( m_stack->visibleWidget() == m_info || | 442 | if ( m_stack->visibleWidget() == m_info || |
456 | m_stack->visibleWidget() == m_disp ) { | 443 | m_stack->visibleWidget() == m_disp ) { |
457 | ev->ignore(); | 444 | ev->ignore(); |
458 | raiseIconView(); | 445 | raiseIconView(); |
459 | return; | 446 | return; |
460 | } | 447 | } |
461 | } | 448 | } |
462 | if (m_disp && m_disp->fullScreen()) { | 449 | if (m_disp && m_disp->fullScreen()) { |
463 | /* otherwise opie-eye crashes in bigscreen mode! */ | 450 | /* otherwise opie-eye crashes in bigscreen mode! */ |
464 | m_disp->reparent(0,QPoint(0,0)); | 451 | m_disp->reparent(0,QPoint(0,0)); |
465 | m_stack->addWidget(m_disp,ImageDisplay); | 452 | m_stack->addWidget(m_disp,ImageDisplay); |
466 | } | 453 | } |
467 | ev->accept(); | 454 | ev->accept(); |
468 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 455 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
469 | } | 456 | } |
470 | 457 | ||
471 | void PMainWindow::setDocument( const QString& showImg ) | 458 | void PMainWindow::setDocument( const QString& showImg ) |
472 | { | 459 | { |
473 | QString file = showImg; | 460 | QString file = showImg; |
474 | DocLnk lnk(showImg); | 461 | DocLnk lnk(showImg); |
475 | if (lnk.isValid() ) | 462 | if (lnk.isValid() ) |
476 | file = lnk.file(); | 463 | file = lnk.file(); |
477 | slotDisplay( file ); | 464 | slotDisplay( file ); |
478 | #if 0 | 465 | #if 0 |
479 | if (!m_polishDone) { | 466 | if (!m_polishDone) { |
480 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); | 467 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); |
481 | } | 468 | } |
482 | #endif | 469 | #endif |
483 | } | 470 | } |
484 | 471 | ||
485 | void PMainWindow::check_view_fullscreen() | 472 | void PMainWindow::check_view_fullscreen() |
486 | { | 473 | { |
487 | if (!m_view) return; | 474 | if (!m_view) return; |
488 | if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { | 475 | if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { |
489 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 476 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
490 | } | 477 | } |
491 | } | 478 | } |
492 | 479 | ||
493 | void PMainWindow::slotSelectDir(int id) | 480 | void PMainWindow::slotSelectDir(int id) |
494 | { | 481 | { |
495 | emit changeDir( m_dev[fsMenu->text(id )] ); | 482 | emit changeDir( m_dev[fsMenu->text(id )] ); |
496 | } | 483 | } |
497 | 484 | ||
498 | void PMainWindow::dirChanged() | 485 | void PMainWindow::dirChanged() |
499 | { | 486 | { |
500 | fsMenu->clear(); | 487 | fsMenu->clear(); |
501 | m_dev.clear(); | 488 | m_dev.clear(); |
502 | 489 | ||
503 | /* home dir, too */ | 490 | /* home dir, too */ |
504 | QString f = getenv( "HOME" ); | 491 | QString f = getenv( "HOME" ); |
505 | if (!f.isEmpty()) { | 492 | if (!f.isEmpty()) { |
506 | m_dev.insert("Home directory",f); | 493 | m_dev.insert("Home directory",f); |
507 | fsMenu->insertItem("Home directory"); | 494 | fsMenu->insertItem("Home directory"); |
508 | } | 495 | } |
509 | const QList<FileSystem> &fs = m_storage->fileSystems(); | 496 | const QList<FileSystem> &fs = m_storage->fileSystems(); |
510 | QListIterator<FileSystem> it(fs ); | 497 | QListIterator<FileSystem> it(fs ); |
511 | for ( ; it.current(); ++it ) { | 498 | for ( ; it.current(); ++it ) { |
512 | const QString disk = (*it)->name(); | 499 | const QString disk = (*it)->name(); |
513 | const QString path = (*it)->path(); | 500 | const QString path = (*it)->path(); |