-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 30 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 16 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 24 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 1 |
4 files changed, 27 insertions, 44 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 @@ -109,9 +109,8 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) } odebug << "Popup " << oendl; QPopupMenu *m = new QPopupMenu(0); if (!m) return; - bool old = fullScreen(); m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); if (fullScreen()) { m->insertSeparator(); m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); @@ -128,8 +127,15 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) void ImageView::setFullScreen(bool how) { m_isFullScreen = how; + if (how) { + m_ignore_next_in = true; + setFixedSize(qApp->desktop()->size()); + showFullScreen(); + } else { + setMinimumSize(10,10); + } } void ImageView::focusInEvent(QFocusEvent *) { @@ -139,30 +145,30 @@ void ImageView::focusInEvent(QFocusEvent *) if (m_ignore_next_in){m_ignore_next_in=false;return;} if (fullScreen()) enableFullscreen(); } +void ImageView::hide() +{ + if (fullScreen()) { + m_ignore_next_in = true; + showNormal(); + } + QWidget::hide(); +} void ImageView::enableFullscreen() { - // This call is needed because showFullScreen won't work - // correctly if the widget already considers itself to be fullscreen. if (!fullScreen()) return; if (m_ignore_next_in) {m_ignore_next_in = false;return;} setUpdatesEnabled(false); - parentWidget()->showNormal(); // This is needed because showNormal() forcefully changes the window // style to WSTyle_TopLevel. - parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); + reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); // Enable fullscreen. /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus * so we must block it here! */ m_ignore_next_in = true; - parentWidget()->showFullScreen(); + showFullScreen(); setUpdatesEnabled(true); -} -ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f) - : QWidget(parent,name,f) -{ - // Make sure size is correct - setFixedSize(qApp->desktop()->size()); } + diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index f3c37b5..18697e0 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h @@ -52,26 +52,14 @@ protected: bool m_ignore_next_in:1; int focus_in_count; virtual void focusInEvent ( QFocusEvent * ); +public slots: + virtual void hide(); protected slots: virtual void slotShowImageInfo(); virtual void keyReleaseEvent(QKeyEvent * e); virtual void contentsMousePressEvent ( QMouseEvent * e); }; -class ImageWidget:public QWidget -{ - Q_OBJECT -public: - ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder); - virtual ~ImageWidget(){}; - -protected: - -public slots: - -protected slots: -}; - #endif diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index cdaf34c..274a22a 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -32,9 +32,8 @@ #include <qtimer.h> #include <qframe.h> - //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) @@ -42,9 +41,8 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) { setCaption( QObject::tr("Opie Eye Caramba" ) ); m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("Zecke_view" ); - tFrame = 0; // qDebug( "Process-wide OApplication object @ %0x", oApp ); /* * Initialize ToolBar and IconView * And Connect Them @@ -145,11 +143,8 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) zoomerOn = true; } PMainWindow::~PMainWindow() { - odebug << "Shutting down" << oendl; - if (tFrame) delete tFrame; - odebug << "Shutting down done" << oendl; } void PMainWindow::slotToggleZoomer() { @@ -324,30 +319,23 @@ void PMainWindow::slotToggleFullScreen() { odebug << "Toggle full " << oendl; if (!m_disp) return; bool current = !m_disp->fullScreen(); - m_disp->setFullScreen(current); odebug << "Current = " << current << oendl; if (current) { odebug << "full" << oendl; m_disp->setBackgroundColor(black); - if (!tFrame) { - tFrame = new ImageWidget(0,0,WStyle_Customize|WStyle_NoBorder); - tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); - tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height()); - } - m_disp->reparent(tFrame,QPoint(0,0)); + m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); m_disp->setVScrollBarMode(QScrollView::AlwaysOff); m_disp->setHScrollBarMode(QScrollView::AlwaysOff); m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); - tFrame->showFullScreen(); + //m_disp->showFullScreen(); + //qwsDisplay()->requestFocus( m_disp->winId(), TRUE); } else { setUpdatesEnabled(false); odebug << "window" << oendl; m_disp->reparent(0,QPoint(0,0)); m_disp->showNormal(); - /* don't forget it! */ - tFrame->hide(); m_disp->setBackgroundColor(white); m_stack->addWidget(m_disp,ImageDisplay); m_disp->setVScrollBarMode(QScrollView::Auto); m_disp->setHScrollBarMode(QScrollView::Auto); @@ -356,8 +344,9 @@ void PMainWindow::slotToggleFullScreen() m_disp->resize(m_disp->minimumSize()); } setUpdatesEnabled(true); } + m_disp->setFullScreen(current); } /** * With big Screen the plan could be to 'detach' the image @@ -397,9 +386,10 @@ void PMainWindow::slotDisplay( const QString& inf ) { fsButton->hide(); viewModeButton->hide(); } if (m_disp->fullScreen()) { - tFrame->show();//FullScreen(); + //m_disp->showFullScreen(); + qwsDisplay()->requestFocus( m_disp->winId(), TRUE); } else { m_stack->raiseWidget( ImageDisplay ); } } @@ -438,9 +428,9 @@ void PMainWindow::raiseIconView() { fsButton->show(); viewModeButton->show(); } if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { - tFrame->hide(); + m_disp->hide(); } m_stack->raiseWidget( IconView ); setUpdatesEnabled(true); repaint(); diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 9e94c60..6fa1ab6 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -67,9 +67,8 @@ private: ImageView *m_disp; bool autoRotate; bool autoScale; bool zoomerOn; - ImageWidget*tFrame; QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton; private slots: |