-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 37 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 22 |
3 files changed, 55 insertions, 11 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index ac6474c..03df321 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -1,16 +1,18 @@ #include "imageview.h" #include <opie2/odebug.h> #include <opie2/oconfig.h> #include <opie2/okeyconfigwidget.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> +#include <qpe/qcopenvelope_qws.h> + #include <qpopupmenu.h> #include <qtimer.h> #include <qaction.h> using namespace Opie::Core; ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) : Opie::MM::OImageScrollView(parent,name,fl) @@ -22,17 +24,45 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name m_ignore_next_in = false; m_slideTimer = 0; QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); initKeys(); m_slideValue = 5; m_gDisplayType = 0; m_gPrevNext = 0; m_hGroup = 0; + m_Rotated = false; closeIfHide = false; + int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()? + QApplication::desktop()->size().height():QApplication::desktop()->size().width(); + if (min>320) { + // bigscreen + setMinimumSize(min/3,min/3); + } else { + setMinimumSize(10,10); + } + m_sysChannel = new QCopChannel( "QPE/System", this ); + connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); +} + +void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) +{ + int _newrotation; + QDataStream stream( data, IO_ReadOnly ); + odebug << "received system message: " << msg << oendl; + if ( msg == "setCurrentRotation(int)" ) + { + stream >> _newrotation; + odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl; + if (!fullScreen()) { + m_rotation = _newrotation; + return; + } + } } void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) { m_gDisplayType = disptypeGroup; m_gPrevNext = nextprevGroup; m_hGroup = hGroup; } @@ -174,17 +204,17 @@ void ImageView::slotShowImageInfo() } void ImageView::contentsMousePressEvent ( QMouseEvent * e) { if (e->button()==1) { return OImageScrollView::contentsMousePressEvent(e); } odebug << "Popup " << oendl; - QPopupMenu *m = new QPopupMenu(0); + QPopupMenu *m = new QPopupMenu(this); if (!m) return; if (m_hGroup) { m_hGroup->addTo(m); } if (fullScreen()) { if (m_gPrevNext) { m->insertSeparator(); m_gPrevNext->addTo(m); @@ -208,20 +238,21 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) delete m; } void ImageView::setFullScreen(bool how,bool force) { m_isFullScreen = how; if (how) { m_ignore_next_in = true; - setFixedSize(qApp->desktop()->size()); +// setFixedSize(qApp->desktop()->size()); + setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); if (force) showFullScreen(); } else { - setMinimumSize(10,10); +// setMinimumSize(10,10); } } void ImageView::focusInEvent(QFocusEvent *) { // Always do it here, no matter the size. odebug << "Focus in (view)" << oendl; //if (fullScreen()) parentWidget()->showNormal(); diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index f1067bb..e8c8df7 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h @@ -4,16 +4,18 @@ #include <opie2/oimagescrollview.h> #include <qwidget.h> class QTimer; class QActionGroup; class QAction; +class QCopChannel; + namespace Opie { namespace Core { class OConfig; class OKeyConfigManager; } } class ImageView:public Opie::MM::OImageScrollView @@ -52,27 +54,32 @@ signals: void toggleAutorotate(); protected: Opie::Core::OConfig * m_cfg; Opie::Core::OKeyConfigManager*m_viewManager; void initKeys(); bool m_isFullScreen:1; bool m_ignore_next_in:1; + bool m_Rotated:1; + int focus_in_count; QTimer*m_slideTimer; int m_slideValue; virtual void focusInEvent ( QFocusEvent * ); QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; bool closeIfHide:1; + QCopChannel* m_sysChannel; + int m_rotation; public slots: virtual void hide(); virtual void startSlide(int); virtual void nextSlide(); + virtual void systemMessage( const QCString&, const QByteArray& ); protected slots: virtual void slotShowImageInfo(); 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 7570ee3..90e2e99 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -250,17 +250,17 @@ void PMainWindow::initInfo() { initT<imageinfo>( "Image Info", &m_info, ImageInfo ); connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); } void PMainWindow::initDisp() { initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); if (m_disp) { if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { - m_disp->setMinimumSize(QApplication::desktop()->size()/2); + //m_disp->setMinimumSize(QApplication::desktop()->size()/2); } m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); m_disp->setAutoScale(!m_aUnscaled->isOn()); m_disp->setAutoRotate(m_aAutoRotate->isOn()); m_disp->setShowZoomer(m_aZoomer->isOn()); 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())); @@ -289,43 +289,49 @@ void PMainWindow::slotFullScreenButton(bool current) if (!m_disp) return; if (m_disp->isVisible()) { setupViewWindow(current, true); } } void PMainWindow::setupViewWindow(bool current, bool forceDisplay) { - if (!m_disp) return; + if (!m_disp) { + return; + } if (current) { m_disp->setBackgroundColor(black); 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()); + m_disp->setFullScreen(current,forceDisplay); } else { setUpdatesEnabled(false); if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { - m_disp->setMinimumSize(QApplication::desktop()->size()/2); + + //m_disp->setMinimumSize(QApplication::desktop()->size()/2); } else { - m_disp->setMinimumSize(10,10); + //m_disp->setMinimumSize(10,10); } if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { - m_disp->reparent(0,QPoint(50,50)); + m_disp->reparent(0,QPoint(10,10)); } else { m_disp->reparent(0,QPoint(0,0)); } m_disp->setBackgroundColor(white); m_stack->addWidget(m_disp,ImageDisplay); m_disp->setVScrollBarMode(QScrollView::Auto); m_disp->setHScrollBarMode(QScrollView::Auto); - if (forceDisplay || m_disp->isVisible()) - m_stack->raiseWidget(m_disp); if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { - m_disp->resize(m_disp->minimumSize()); + m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); + } + if (forceDisplay || m_disp->isVisible()) { + m_stack->raiseWidget(m_disp); + m_disp->setFocus(); } setUpdatesEnabled(true); } m_disp->setFullScreen(current,forceDisplay); } void PMainWindow::slotFullScreenToggled(bool current) { |