summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-21 09:56:14 (UTC)
committer alwin <alwin>2004-04-21 09:56:14 (UTC)
commitf4ab243362a9b93f17e92bbf3189324f66c8f686 (patch) (side-by-side diff)
tree85fc40502c8a6fb76efb3ad2f2cf3f80c5af2cf6
parentc61b410ba0051c266501933f7f675291684613f8 (diff)
downloadopie-f4ab243362a9b93f17e92bbf3189324f66c8f686.zip
opie-f4ab243362a9b93f17e92bbf3189324f66c8f686.tar.gz
opie-f4ab243362a9b93f17e92bbf3189324f66c8f686.tar.bz2
polish on fullscreen mode
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp53
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h2
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp7
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
@@ -84,48 +84,77 @@ void ImageView::initKeys()
Opie::Core::OKeyPair(Qt::Key_T,0),
this, SIGNAL(toggleZoomer())));
m_viewManager->handleWidget( this );
m_viewManager->load();
}
void ImageView::keyReleaseEvent(QKeyEvent * e)
{
if (!e || e->state()!=0) {
return;
}
if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe();
}
void ImageView::slotShowImageInfo()
{
emit dispImageInfo(m_lastName);
}
void ImageView::contentsMousePressEvent ( QMouseEvent * e)
{
if (e->button()==1) {
return OImageScrollView::contentsMousePressEvent(e);
}
- if (!fullScreen()) return;
-#if 0
- // doesn't work right (repainting problems)
+// if (!fullScreen()) return;
odebug << "Popup " << oendl;
QPopupMenu *m = new QPopupMenu(0);
if (!m) return;
- m->insertItem(tr("Previous image"),ShowPrevious);
- m->insertItem(tr("Next image"),ShowNext);
- m->insertSeparator();
- m->insertItem(tr("Toggle fullscreen"),FullScreen);
- m->insertItem(tr("Toggle autoscale"),Autoscale);
- m->insertItem(tr("Toggle autorotate"),Autorotate);
- m->insertItem(tr("Toggle thumbnail"),Zoomer);
+ bool old = fullScreen();
+ m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen()));
+ if (fullScreen()) {
+ m->insertSeparator();
+ m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev()));
+ m->insertItem(tr("Next image"),this,SIGNAL(dispNext()));
+ m->insertSeparator();
+ m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale()));
+ m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate()));
+ m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer()));
+ }
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
- parentWidget()->showFullScreen();
-#endif
+ /* if we were fullScreen() and must overlap the taskbar again */
+ if (fullScreen() && old) {
+ enableFullscreen();
+// parentWidget()->hide();
+// parentWidget()->show();
+ }
}
void ImageView::setFullScreen(bool how)
{
m_isFullScreen = how;
}
+
+void ImageView::focusInEvent(QFocusEvent *)
+{
+ // Always do it here, no matter the size.
+ /* result in an endless loop */
+// if (fullScreen()) enableFullscreen();
+}
+
+void ImageView::enableFullscreen()
+{
+ if (!fullScreen()) return;
+ // Make sure size is correct
+ parentWidget()->setFixedSize(qApp->desktop()->size());
+ // This call is needed because showFullScreen won't work
+ // correctly if the widget already considers itself to be fullscreen.
+ 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));
+ // Enable fullscreen.
+ parentWidget()->showFullScreen();
+}
+
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
@@ -25,32 +25,34 @@ class ImageView:public Opie::MM::OImageScrollView
};
public:
ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 );
virtual ~ImageView();
Opie::Core::OKeyConfigManager* manager();
void setFullScreen(bool how);
bool fullScreen(){return m_isFullScreen;}
signals:
void dispImageInfo(const QString&);
void dispNext();
void dispPrev();
void toggleFullScreen();
void hideMe();
void toggleZoomer();
void toggleAutoscale();
void toggleAutorotate();
protected:
Opie::Core::OConfig * m_cfg;
Opie::Core::OKeyConfigManager*m_viewManager;
void initKeys();
bool m_isFullScreen:1;
+ void enableFullscreen();
protected slots:
virtual void slotShowImageInfo();
virtual void keyReleaseEvent(QKeyEvent * e);
virtual void contentsMousePressEvent ( QMouseEvent * e);
+ virtual void focusInEvent ( QFocusEvent * );
};
#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
@@ -308,71 +308,73 @@ void PMainWindow::initDisp() {
m_disp->setShowZoomer(zoomerOn);
m_disp->setBackgroundColor(white);
connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
}
}
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 QWidget(0,0,WType_TopLevel|WStyle_NoBorder|WStyle_StaysOnTop);
+ tFrame = new QWidget(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->setVScrollBarMode(QScrollView::AlwaysOff);
m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
tFrame->showFullScreen();
} 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);
m_stack->raiseWidget(m_disp);
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_disp->resize(m_disp->minimumSize());
}
+ setUpdatesEnabled(true);
}
}
/**
* With big Screen the plan could be to 'detach' the image
* window if visible and to create a ne wone
* init* already supports it but I make no use of it for
* now. We set filename and raise
*
* ### FIXME and talk to alwin
*/
void PMainWindow::slotShowInfo( const QString& inf ) {
if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
return;
}
if ( !m_info ) {
initInfo();
}
m_info->setPath( inf );
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
prevButton->hide();
nextButton->hide();
upButton->hide();
fsButton->hide();
@@ -406,45 +408,48 @@ void PMainWindow::slotReturn() {
}
void PMainWindow::closeEvent( QCloseEvent* ev ) {
/*
* return from view
* or properly quit
*/
if ( m_stack->visibleWidget() == m_info ||
m_stack->visibleWidget() == m_disp ) {
ev->ignore();
raiseIconView();
return;
}
if (m_disp && m_disp->fullScreen()) {
/* otherwise opie-eye crashes in bigscreen mode! */
m_disp->reparent(0,QPoint(0,0));
m_stack->addWidget(m_disp,ImageDisplay);
}
ev->accept();
QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
}
void PMainWindow::raiseIconView() {
+ setUpdatesEnabled(false);
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
prevButton->hide();
nextButton->hide();
upButton->show();
fsButton->show();
viewModeButton->show();
}
if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
tFrame->hide();
}
m_stack->raiseWidget( IconView );
+ setUpdatesEnabled(true);
+ repaint();
}
void PMainWindow::setDocument( const QString& showImg ) {
QString file = showImg;
DocLnk lnk(showImg);
if (lnk.isValid() )
file = lnk.file();
slotDisplay( file );
}