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 | |||
@@ -231,56 +231,56 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
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 | |||
@@ -262,204 +262,191 @@ void PMainWindow::initInfo() { | |||
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); |