-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 53 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 7 |
3 files changed, 49 insertions, 13 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 5b34ca2..53376c0 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -92,40 +92,69 @@ void ImageView::keyReleaseEvent(QKeyEvent * e) | |||
92 | if (!e || e->state()!=0) { | 92 | if (!e || e->state()!=0) { |
93 | return; | 93 | return; |
94 | } | 94 | } |
95 | if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); | 95 | if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); |
96 | } | 96 | } |
97 | 97 | ||
98 | void ImageView::slotShowImageInfo() | 98 | void ImageView::slotShowImageInfo() |
99 | { | 99 | { |
100 | emit dispImageInfo(m_lastName); | 100 | emit dispImageInfo(m_lastName); |
101 | } | 101 | } |
102 | 102 | ||
103 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 103 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
104 | { | 104 | { |
105 | if (e->button()==1) { | 105 | if (e->button()==1) { |
106 | return OImageScrollView::contentsMousePressEvent(e); | 106 | return OImageScrollView::contentsMousePressEvent(e); |
107 | } | 107 | } |
108 | if (!fullScreen()) return; | 108 | // if (!fullScreen()) return; |
109 | #if 0 | ||
110 | // doesn't work right (repainting problems) | ||
111 | odebug << "Popup " << oendl; | 109 | odebug << "Popup " << oendl; |
112 | QPopupMenu *m = new QPopupMenu(0); | 110 | QPopupMenu *m = new QPopupMenu(0); |
113 | if (!m) return; | 111 | if (!m) return; |
114 | m->insertItem(tr("Previous image"),ShowPrevious); | 112 | bool old = fullScreen(); |
115 | m->insertItem(tr("Next image"),ShowNext); | 113 | m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); |
116 | m->insertSeparator(); | 114 | if (fullScreen()) { |
117 | m->insertItem(tr("Toggle fullscreen"),FullScreen); | 115 | m->insertSeparator(); |
118 | m->insertItem(tr("Toggle autoscale"),Autoscale); | 116 | m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); |
119 | m->insertItem(tr("Toggle autorotate"),Autorotate); | 117 | m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); |
120 | m->insertItem(tr("Toggle thumbnail"),Zoomer); | 118 | m->insertSeparator(); |
119 | m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); | ||
120 | m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); | ||
121 | m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); | ||
122 | } | ||
121 | m->setFocus(); | 123 | m->setFocus(); |
122 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 124 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
123 | delete m; | 125 | delete m; |
124 | parentWidget()->showFullScreen(); | 126 | /* if we were fullScreen() and must overlap the taskbar again */ |
125 | #endif | 127 | if (fullScreen() && old) { |
128 | enableFullscreen(); | ||
129 | // parentWidget()->hide(); | ||
130 | // parentWidget()->show(); | ||
131 | } | ||
126 | } | 132 | } |
127 | 133 | ||
128 | void ImageView::setFullScreen(bool how) | 134 | void ImageView::setFullScreen(bool how) |
129 | { | 135 | { |
130 | m_isFullScreen = how; | 136 | m_isFullScreen = how; |
131 | } | 137 | } |
138 | |||
139 | void ImageView::focusInEvent(QFocusEvent *) | ||
140 | { | ||
141 | // Always do it here, no matter the size. | ||
142 | /* result in an endless loop */ | ||
143 | // if (fullScreen()) enableFullscreen(); | ||
144 | } | ||
145 | |||
146 | void ImageView::enableFullscreen() | ||
147 | { | ||
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 | // correctly if the widget already considers itself to be fullscreen. | ||
153 | parentWidget()->showNormal(); | ||
154 | // This is needed because showNormal() forcefully changes the window | ||
155 | // style to WSTyle_TopLevel. | ||
156 | parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | ||
157 | // Enable fullscreen. | ||
158 | parentWidget()->showFullScreen(); | ||
159 | } | ||
160 | |||
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 445bee9..4d2405f 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -33,24 +33,26 @@ public: | |||
33 | 33 | ||
34 | signals: | 34 | signals: |
35 | void dispImageInfo(const QString&); | 35 | void dispImageInfo(const QString&); |
36 | void dispNext(); | 36 | void dispNext(); |
37 | void dispPrev(); | 37 | void dispPrev(); |
38 | void toggleFullScreen(); | 38 | void toggleFullScreen(); |
39 | void hideMe(); | 39 | void hideMe(); |
40 | void toggleZoomer(); | 40 | void toggleZoomer(); |
41 | void toggleAutoscale(); | 41 | void toggleAutoscale(); |
42 | void toggleAutorotate(); | 42 | void toggleAutorotate(); |
43 | 43 | ||
44 | protected: | 44 | protected: |
45 | Opie::Core::OConfig * m_cfg; | 45 | Opie::Core::OConfig * m_cfg; |
46 | Opie::Core::OKeyConfigManager*m_viewManager; | 46 | Opie::Core::OKeyConfigManager*m_viewManager; |
47 | void initKeys(); | 47 | void initKeys(); |
48 | bool m_isFullScreen:1; | 48 | bool m_isFullScreen:1; |
49 | void enableFullscreen(); | ||
49 | 50 | ||
50 | protected slots: | 51 | protected slots: |
51 | virtual void slotShowImageInfo(); | 52 | virtual void slotShowImageInfo(); |
52 | virtual void keyReleaseEvent(QKeyEvent * e); | 53 | virtual void keyReleaseEvent(QKeyEvent * e); |
53 | virtual void contentsMousePressEvent ( QMouseEvent * e); | 54 | virtual void contentsMousePressEvent ( QMouseEvent * e); |
55 | virtual void focusInEvent ( QFocusEvent * ); | ||
54 | }; | 56 | }; |
55 | 57 | ||
56 | #endif | 58 | #endif |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index a784f5b..58f02ef 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -316,55 +316,57 @@ void PMainWindow::initDisp() { | |||
316 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 316 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
317 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 317 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | void PMainWindow::slotToggleFullScreen() | 321 | void PMainWindow::slotToggleFullScreen() |
322 | { | 322 | { |
323 | odebug << "Toggle full " << oendl; | 323 | odebug << "Toggle full " << oendl; |
324 | if (!m_disp) return; | 324 | if (!m_disp) return; |
325 | bool current = !m_disp->fullScreen(); | 325 | bool current = !m_disp->fullScreen(); |
326 | m_disp->setFullScreen(current); | 326 | m_disp->setFullScreen(current); |
327 | odebug << "Current = " << current << oendl; | 327 | odebug << "Current = " << current << oendl; |
328 | if (current) { | 328 | if (current) { |
329 | odebug << "full" << oendl; | 329 | odebug << "full" << oendl; |
330 | m_disp->setBackgroundColor(black); | 330 | m_disp->setBackgroundColor(black); |
331 | if (!tFrame) { | 331 | if (!tFrame) { |
332 | tFrame = new QWidget(0,0,WType_TopLevel|WStyle_NoBorder|WStyle_StaysOnTop); | 332 | tFrame = new QWidget(0,0,WStyle_Customize|WStyle_NoBorder); |
333 | tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 333 | tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
334 | tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height()); | 334 | tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height()); |
335 | } | 335 | } |
336 | m_disp->reparent(tFrame,QPoint(0,0)); | 336 | m_disp->reparent(tFrame,QPoint(0,0)); |
337 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 337 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
338 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 338 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
339 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 339 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
340 | tFrame->showFullScreen(); | 340 | tFrame->showFullScreen(); |
341 | } else { | 341 | } else { |
342 | setUpdatesEnabled(false); | ||
342 | odebug << "window" << oendl; | 343 | odebug << "window" << oendl; |
343 | m_disp->reparent(0,QPoint(0,0)); | 344 | m_disp->reparent(0,QPoint(0,0)); |
344 | m_disp->showNormal(); | 345 | m_disp->showNormal(); |
345 | /* don't forget it! */ | 346 | /* don't forget it! */ |
346 | tFrame->hide(); | 347 | tFrame->hide(); |
347 | m_disp->setBackgroundColor(white); | 348 | m_disp->setBackgroundColor(white); |
348 | m_stack->addWidget(m_disp,ImageDisplay); | 349 | m_stack->addWidget(m_disp,ImageDisplay); |
349 | m_disp->setVScrollBarMode(QScrollView::Auto); | 350 | m_disp->setVScrollBarMode(QScrollView::Auto); |
350 | m_disp->setHScrollBarMode(QScrollView::Auto); | 351 | m_disp->setHScrollBarMode(QScrollView::Auto); |
351 | m_stack->raiseWidget(m_disp); | 352 | m_stack->raiseWidget(m_disp); |
352 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 353 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
353 | m_disp->resize(m_disp->minimumSize()); | 354 | m_disp->resize(m_disp->minimumSize()); |
354 | } | 355 | } |
356 | setUpdatesEnabled(true); | ||
355 | } | 357 | } |
356 | } | 358 | } |
357 | 359 | ||
358 | /** | 360 | /** |
359 | * With big Screen the plan could be to 'detach' the image | 361 | * With big Screen the plan could be to 'detach' the image |
360 | * window if visible and to create a ne wone | 362 | * window if visible and to create a ne wone |
361 | * init* already supports it but I make no use of it for | 363 | * init* already supports it but I make no use of it for |
362 | * now. We set filename and raise | 364 | * now. We set filename and raise |
363 | * | 365 | * |
364 | * ### FIXME and talk to alwin | 366 | * ### FIXME and talk to alwin |
365 | */ | 367 | */ |
366 | void PMainWindow::slotShowInfo( const QString& inf ) { | 368 | void PMainWindow::slotShowInfo( const QString& inf ) { |
367 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 369 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
368 | return; | 370 | return; |
369 | } | 371 | } |
370 | if ( !m_info ) { | 372 | if ( !m_info ) { |
@@ -414,37 +416,40 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { | |||
414 | if ( m_stack->visibleWidget() == m_info || | 416 | if ( m_stack->visibleWidget() == m_info || |
415 | m_stack->visibleWidget() == m_disp ) { | 417 | m_stack->visibleWidget() == m_disp ) { |
416 | ev->ignore(); | 418 | ev->ignore(); |
417 | raiseIconView(); | 419 | raiseIconView(); |
418 | return; | 420 | return; |
419 | } | 421 | } |
420 | if (m_disp && m_disp->fullScreen()) { | 422 | if (m_disp && m_disp->fullScreen()) { |
421 | /* otherwise opie-eye crashes in bigscreen mode! */ | 423 | /* otherwise opie-eye crashes in bigscreen mode! */ |
422 | m_disp->reparent(0,QPoint(0,0)); | 424 | m_disp->reparent(0,QPoint(0,0)); |
423 | m_stack->addWidget(m_disp,ImageDisplay); | 425 | m_stack->addWidget(m_disp,ImageDisplay); |
424 | } | 426 | } |
425 | ev->accept(); | 427 | ev->accept(); |
426 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 428 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
427 | } | 429 | } |
428 | 430 | ||
429 | void PMainWindow::raiseIconView() { | 431 | void PMainWindow::raiseIconView() { |
432 | setUpdatesEnabled(false); | ||
430 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 433 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
431 | prevButton->hide(); | 434 | prevButton->hide(); |
432 | nextButton->hide(); | 435 | nextButton->hide(); |
433 | upButton->show(); | 436 | upButton->show(); |
434 | fsButton->show(); | 437 | fsButton->show(); |
435 | viewModeButton->show(); | 438 | viewModeButton->show(); |
436 | } | 439 | } |
437 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 440 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
438 | tFrame->hide(); | 441 | tFrame->hide(); |
439 | } | 442 | } |
440 | m_stack->raiseWidget( IconView ); | 443 | m_stack->raiseWidget( IconView ); |
444 | setUpdatesEnabled(true); | ||
445 | repaint(); | ||
441 | } | 446 | } |
442 | 447 | ||
443 | void PMainWindow::setDocument( const QString& showImg ) { | 448 | void PMainWindow::setDocument( const QString& showImg ) { |
444 | QString file = showImg; | 449 | QString file = showImg; |
445 | DocLnk lnk(showImg); | 450 | DocLnk lnk(showImg); |
446 | if (lnk.isValid() ) | 451 | if (lnk.isValid() ) |
447 | file = lnk.file(); | 452 | file = lnk.file(); |
448 | 453 | ||
449 | slotDisplay( file ); | 454 | slotDisplay( file ); |
450 | } | 455 | } |