author | alwin <alwin> | 2004-04-21 09:56:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 09:56:14 (UTC) |
commit | f4ab243362a9b93f17e92bbf3189324f66c8f686 (patch) (unidiff) | |
tree | 85fc40502c8a6fb76efb3ad2f2cf3f80c5af2cf6 | |
parent | c61b410ba0051c266501933f7f675291684613f8 (diff) | |
download | opie-f4ab243362a9b93f17e92bbf3189324f66c8f686.zip opie-f4ab243362a9b93f17e92bbf3189324f66c8f686.tar.gz opie-f4ab243362a9b93f17e92bbf3189324f66c8f686.tar.bz2 |
polish on fullscreen mode
-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 | |||
@@ -106,22 +106,28 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
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 | ||
@@ -130,2 +136,25 @@ void ImageView::setFullScreen(bool how) | |||
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 | |||
@@ -47,4 +47,5 @@ protected: | |||
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: |
@@ -52,4 +53,5 @@ protected slots: | |||
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 | ||
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 | |||
@@ -330,5 +330,5 @@ void PMainWindow::slotToggleFullScreen() | |||
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()); |
@@ -340,4 +340,5 @@ void PMainWindow::slotToggleFullScreen() | |||
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)); |
@@ -353,4 +354,5 @@ void PMainWindow::slotToggleFullScreen() | |||
353 | m_disp->resize(m_disp->minimumSize()); | 354 | m_disp->resize(m_disp->minimumSize()); |
354 | } | 355 | } |
356 | setUpdatesEnabled(true); | ||
355 | } | 357 | } |
356 | } | 358 | } |
@@ -428,4 +430,5 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { | |||
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(); |
@@ -439,4 +442,6 @@ void PMainWindow::raiseIconView() { | |||
439 | } | 442 | } |
440 | m_stack->raiseWidget( IconView ); | 443 | m_stack->raiseWidget( IconView ); |
444 | setUpdatesEnabled(true); | ||
445 | repaint(); | ||
441 | } | 446 | } |
442 | 447 | ||