Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 0484f73..a784f5b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -31,5 +31,5 @@ #include <qmap.h> #include <qtimer.h> - +#include <qframe.h> @@ -43,4 +43,5 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("Zecke_view" ); + tFrame = 0; // qDebug( "Process-wide OApplication object @ %0x", oApp ); /* @@ -129,9 +130,9 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); - btn = new QToolButton(bar); - btn->setIconSet( Resource::loadIconSet( "1to1" ) ); - btn->setToggleButton(true); - btn->setOn(false); - connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); + scaleButton = new QToolButton(bar); + scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); + scaleButton->setToggleButton(true); + scaleButton->setOn(false); + connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); autoScale = true; @@ -146,4 +147,6 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) PMainWindow::~PMainWindow() { odebug << "Shutting down" << oendl; + if (tFrame) delete tFrame; + odebug << "Shutting down done" << oendl; } @@ -163,4 +166,19 @@ void PMainWindow::slotZoomerToggled(bool how) } +void PMainWindow::slotToggleAutorotate() +{ + if (!m_disp) return; + if (!rotateButton->isEnabled()) return; + bool cur = rotateButton->isOn(); + rotateButton->setOn(!cur); +} + +void PMainWindow::slotToggleAutoscale() +{ + if (!m_disp) return; + bool cur = scaleButton->isOn(); + scaleButton->setOn(!cur); +} + void PMainWindow::slotRotateToggled(bool how) { @@ -296,4 +314,6 @@ void PMainWindow::initDisp() { 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())); } } @@ -309,11 +329,20 @@ void PMainWindow::slotToggleFullScreen() odebug << "full" << oendl; m_disp->setBackgroundColor(black); - m_disp->reparent(0,QPoint(0,0)); + if (!tFrame) { + tFrame = new QWidget(0,0,WType_TopLevel|WStyle_NoBorder|WStyle_StaysOnTop); + 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()); - m_disp->showFullScreen(); + tFrame->showFullScreen(); } else { 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); @@ -336,4 +365,7 @@ void PMainWindow::slotToggleFullScreen() */ void PMainWindow::slotShowInfo( const QString& inf ) { + if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { + return; + } if ( !m_info ) { initInfo(); @@ -347,7 +379,4 @@ void PMainWindow::slotShowInfo( const QString& inf ) { viewModeButton->hide(); } - if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { - m_disp->hide(); - } m_stack->raiseWidget( ImageInfo ); } @@ -366,5 +395,6 @@ void PMainWindow::slotDisplay( const QString& inf ) { } if (m_disp->fullScreen()) { - m_disp->show(); + tFrame->setActiveWindow(); + tFrame->showFullScreen(); } else { m_stack->raiseWidget( ImageDisplay ); @@ -384,8 +414,13 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { if ( m_stack->visibleWidget() == m_info || m_stack->visibleWidget() == m_disp ) { - raiseIconView(); 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())); @@ -401,5 +436,5 @@ void PMainWindow::raiseIconView() { } if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { - m_disp->hide(); + tFrame->hide(); } m_stack->raiseWidget( IconView ); |