author | alwin <alwin> | 2004-04-20 22:58:27 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-20 22:58:27 (UTC) |
commit | c61b410ba0051c266501933f7f675291684613f8 (patch) (side-by-side diff) | |
tree | 2bdb8278bb271bcb305652dea528709735b0a08d | |
parent | 4348554f74290f477af9a338cdabf363883c9472 (diff) | |
download | opie-c61b410ba0051c266501933f7f675291684613f8.zip opie-c61b410ba0051c266501933f7f675291684613f8.tar.gz opie-c61b410ba0051c266501933f7f675291684613f8.tar.bz2 |
some gui stuff - fullscreen now works better on smallscreen, bigscreen
has some more problems...
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 46 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 8 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 63 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 5 |
4 files changed, 105 insertions, 17 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 88a8bc6..5b34ca2 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -7,2 +7,4 @@ #include <qpe/resource.h> +#include <qpe/qpeapplication.h> +#include <qpopupmenu.h> @@ -16,2 +18,3 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name m_isFullScreen = false; + QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); initKeys(); @@ -21,2 +24,3 @@ ImageView::~ImageView() { + odebug << "Delete Imageview" << oendl; if (m_viewManager) { @@ -50,2 +54,3 @@ void ImageView::initKeys() lst, false,this, "image_view_keys" ); + m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", @@ -55,5 +60,14 @@ void ImageView::initKeys() + m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", + Resource::loadPixmap("rotate"), Autorotate, + Opie::Core::OKeyPair(Qt::Key_R,0), + this, SIGNAL(toggleAutorotate()))); + m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", + Resource::loadPixmap("1to1"), Autoscale, + Opie::Core::OKeyPair(Qt::Key_S,0), + this, SIGNAL(toggleAutoscale()))); + m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", Resource::loadPixmap("forward"), ShowNext, - Opie::Core::OKeyPair(Qt::Key_N,0), + Opie::Core::OKeyPair(Qt::Key_Return,0), this, SIGNAL(dispNext()))); @@ -87 +101,31 @@ void ImageView::slotShowImageInfo() } + +void ImageView::contentsMousePressEvent ( QMouseEvent * e) +{ + if (e->button()==1) { + return OImageScrollView::contentsMousePressEvent(e); + } + if (!fullScreen()) return; +#if 0 + // doesn't work right (repainting problems) + 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); + m->setFocus(); + m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); + delete m; + parentWidget()->showFullScreen(); +#endif +} + +void ImageView::setFullScreen(bool how) +{ + m_isFullScreen = how; +} diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 6bf930f..445bee9 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h @@ -22,2 +22,4 @@ class ImageView:public Opie::MM::OImageScrollView Zoomer, + Autorotate, + Autoscale }; @@ -28,3 +30,3 @@ public: Opie::Core::OKeyConfigManager* manager(); - void setFullScreen(bool how){m_isFullScreen = how;} + void setFullScreen(bool how); bool fullScreen(){return m_isFullScreen;} @@ -38,2 +40,4 @@ signals: void toggleZoomer(); + void toggleAutoscale(); + void toggleAutorotate(); @@ -48,3 +52,5 @@ protected slots: virtual void keyReleaseEvent(QKeyEvent * e); + virtual void contentsMousePressEvent ( QMouseEvent * e); }; + #endif 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 @@ -32,3 +32,3 @@ #include <qtimer.h> - +#include <qframe.h> @@ -44,2 +44,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) m_cfg->setGroup("Zecke_view" ); + tFrame = 0; // qDebug( "Process-wide OApplication object @ %0x", oApp ); @@ -130,7 +131,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) - 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; @@ -147,2 +148,4 @@ PMainWindow::~PMainWindow() { odebug << "Shutting down" << oendl; + if (tFrame) delete tFrame; + odebug << "Shutting down done" << oendl; } @@ -164,2 +167,17 @@ 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) @@ -297,2 +315,4 @@ void PMainWindow::initDisp() { connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); + connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); + connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); } @@ -310,3 +330,8 @@ void PMainWindow::slotToggleFullScreen() 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); @@ -314,5 +339,9 @@ void PMainWindow::slotToggleFullScreen() 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); @@ -337,2 +366,5 @@ void PMainWindow::slotToggleFullScreen() void PMainWindow::slotShowInfo( const QString& inf ) { + if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { + return; + } if ( !m_info ) { @@ -348,5 +380,2 @@ void PMainWindow::slotShowInfo( const QString& inf ) { } - if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { - m_disp->hide(); - } m_stack->raiseWidget( ImageInfo ); @@ -367,3 +396,4 @@ void PMainWindow::slotDisplay( const QString& inf ) { if (m_disp->fullScreen()) { - m_disp->show(); + tFrame->setActiveWindow(); + tFrame->showFullScreen(); } else { @@ -385,6 +415,11 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { 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(); @@ -402,3 +437,3 @@ void PMainWindow::raiseIconView() { if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { - m_disp->hide(); + tFrame->hide(); } diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index e51a3ff..1f90f9f 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -46,2 +46,4 @@ public slots: void slotToggleZoomer(); + void slotToggleAutorotate(); + void slotToggleAutoscale(); void setDocument( const QString& ); @@ -67,4 +69,5 @@ private: bool zoomerOn; + QWidget*tFrame; QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; - QToolButton*nextButton,*prevButton,*zoomButton; + QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton; |