-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 @@ -6,6 +6,8 @@ #include <qpe/resource.h> #include <qpe/qpeapplication.h> +#include <qpe/qcopenvelope_qws.h> + #include <qpopupmenu.h> #include <qtimer.h> #include <qaction.h> @@ -27,7 +29,35 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name 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) @@ -179,7 +209,7 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) 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); @@ -213,10 +243,11 @@ 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); } } 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 @@ -9,6 +9,8 @@ class QTimer; class QActionGroup; class QAction; +class QCopChannel; + namespace Opie { namespace Core { class OConfig; @@ -57,17 +59,22 @@ protected: 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(); 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 @@ -255,7 +255,7 @@ 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()); @@ -294,22 +294,26 @@ void PMainWindow::slotFullScreenButton(bool current) 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)); } @@ -317,10 +321,12 @@ void PMainWindow::setupViewWindow(bool current, bool forceDisplay) 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); } |