-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 @@ | |||
6 | 6 | ||
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/qcopenvelope_qws.h> | ||
10 | |||
9 | #include <qpopupmenu.h> | 11 | #include <qpopupmenu.h> |
10 | #include <qtimer.h> | 12 | #include <qtimer.h> |
11 | #include <qaction.h> | 13 | #include <qaction.h> |
@@ -27,7 +29,35 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
27 | m_gDisplayType = 0; | 29 | m_gDisplayType = 0; |
28 | m_gPrevNext = 0; | 30 | m_gPrevNext = 0; |
29 | m_hGroup = 0; | 31 | m_hGroup = 0; |
32 | m_Rotated = false; | ||
30 | closeIfHide = false; | 33 | closeIfHide = false; |
34 | int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()? | ||
35 | QApplication::desktop()->size().height():QApplication::desktop()->size().width(); | ||
36 | if (min>320) { | ||
37 | // bigscreen | ||
38 | setMinimumSize(min/3,min/3); | ||
39 | } else { | ||
40 | setMinimumSize(10,10); | ||
41 | } | ||
42 | m_sysChannel = new QCopChannel( "QPE/System", this ); | ||
43 | connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | ||
44 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); | ||
45 | } | ||
46 | |||
47 | void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) | ||
48 | { | ||
49 | int _newrotation; | ||
50 | QDataStream stream( data, IO_ReadOnly ); | ||
51 | odebug << "received system message: " << msg << oendl; | ||
52 | if ( msg == "setCurrentRotation(int)" ) | ||
53 | { | ||
54 | stream >> _newrotation; | ||
55 | odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl; | ||
56 | if (!fullScreen()) { | ||
57 | m_rotation = _newrotation; | ||
58 | return; | ||
59 | } | ||
60 | } | ||
31 | } | 61 | } |
32 | 62 | ||
33 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) | 63 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) |
@@ -179,7 +209,7 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
179 | return OImageScrollView::contentsMousePressEvent(e); | 209 | return OImageScrollView::contentsMousePressEvent(e); |
180 | } | 210 | } |
181 | odebug << "Popup " << oendl; | 211 | odebug << "Popup " << oendl; |
182 | QPopupMenu *m = new QPopupMenu(0); | 212 | QPopupMenu *m = new QPopupMenu(this); |
183 | if (!m) return; | 213 | if (!m) return; |
184 | if (m_hGroup) { | 214 | if (m_hGroup) { |
185 | m_hGroup->addTo(m); | 215 | m_hGroup->addTo(m); |
@@ -213,10 +243,11 @@ void ImageView::setFullScreen(bool how,bool force) | |||
213 | m_isFullScreen = how; | 243 | m_isFullScreen = how; |
214 | if (how) { | 244 | if (how) { |
215 | m_ignore_next_in = true; | 245 | m_ignore_next_in = true; |
216 | setFixedSize(qApp->desktop()->size()); | 246 | // setFixedSize(qApp->desktop()->size()); |
247 | setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); | ||
217 | if (force) showFullScreen(); | 248 | if (force) showFullScreen(); |
218 | } else { | 249 | } else { |
219 | setMinimumSize(10,10); | 250 | // setMinimumSize(10,10); |
220 | } | 251 | } |
221 | } | 252 | } |
222 | 253 | ||
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; | |||
9 | class QActionGroup; | 9 | class QActionGroup; |
10 | class QAction; | 10 | class QAction; |
11 | 11 | ||
12 | class QCopChannel; | ||
13 | |||
12 | namespace Opie { | 14 | namespace Opie { |
13 | namespace Core { | 15 | namespace Core { |
14 | class OConfig; | 16 | class OConfig; |
@@ -57,17 +59,22 @@ protected: | |||
57 | void initKeys(); | 59 | void initKeys(); |
58 | bool m_isFullScreen:1; | 60 | bool m_isFullScreen:1; |
59 | bool m_ignore_next_in:1; | 61 | bool m_ignore_next_in:1; |
62 | bool m_Rotated:1; | ||
63 | |||
60 | int focus_in_count; | 64 | int focus_in_count; |
61 | QTimer*m_slideTimer; | 65 | QTimer*m_slideTimer; |
62 | int m_slideValue; | 66 | int m_slideValue; |
63 | virtual void focusInEvent ( QFocusEvent * ); | 67 | virtual void focusInEvent ( QFocusEvent * ); |
64 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; | 68 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; |
65 | bool closeIfHide:1; | 69 | bool closeIfHide:1; |
70 | QCopChannel* m_sysChannel; | ||
71 | int m_rotation; | ||
66 | 72 | ||
67 | public slots: | 73 | public slots: |
68 | virtual void hide(); | 74 | virtual void hide(); |
69 | virtual void startSlide(int); | 75 | virtual void startSlide(int); |
70 | virtual void nextSlide(); | 76 | virtual void nextSlide(); |
77 | virtual void systemMessage( const QCString&, const QByteArray& ); | ||
71 | 78 | ||
72 | protected slots: | 79 | protected slots: |
73 | virtual void slotShowImageInfo(); | 80 | 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() { | |||
255 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 255 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
256 | if (m_disp) { | 256 | if (m_disp) { |
257 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 257 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
258 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 258 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
259 | } | 259 | } |
260 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 260 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
261 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 261 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
@@ -294,22 +294,26 @@ void PMainWindow::slotFullScreenButton(bool current) | |||
294 | 294 | ||
295 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | 295 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) |
296 | { | 296 | { |
297 | if (!m_disp) return; | 297 | if (!m_disp) { |
298 | return; | ||
299 | } | ||
298 | if (current) { | 300 | if (current) { |
299 | m_disp->setBackgroundColor(black); | 301 | m_disp->setBackgroundColor(black); |
300 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 302 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
301 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 303 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
302 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 304 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
303 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 305 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
306 | m_disp->setFullScreen(current,forceDisplay); | ||
304 | } else { | 307 | } else { |
305 | setUpdatesEnabled(false); | 308 | setUpdatesEnabled(false); |
306 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 309 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
307 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 310 | |
311 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | ||
308 | } else { | 312 | } else { |
309 | m_disp->setMinimumSize(10,10); | 313 | //m_disp->setMinimumSize(10,10); |
310 | } | 314 | } |
311 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 315 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
312 | m_disp->reparent(0,QPoint(50,50)); | 316 | m_disp->reparent(0,QPoint(10,10)); |
313 | } else { | 317 | } else { |
314 | m_disp->reparent(0,QPoint(0,0)); | 318 | m_disp->reparent(0,QPoint(0,0)); |
315 | } | 319 | } |
@@ -317,10 +321,12 @@ void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | |||
317 | m_stack->addWidget(m_disp,ImageDisplay); | 321 | m_stack->addWidget(m_disp,ImageDisplay); |
318 | m_disp->setVScrollBarMode(QScrollView::Auto); | 322 | m_disp->setVScrollBarMode(QScrollView::Auto); |
319 | m_disp->setHScrollBarMode(QScrollView::Auto); | 323 | m_disp->setHScrollBarMode(QScrollView::Auto); |
320 | if (forceDisplay || m_disp->isVisible()) | ||
321 | m_stack->raiseWidget(m_disp); | ||
322 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 324 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
323 | m_disp->resize(m_disp->minimumSize()); | 325 | m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); |
326 | } | ||
327 | if (forceDisplay || m_disp->isVisible()) { | ||
328 | m_stack->raiseWidget(m_disp); | ||
329 | m_disp->setFocus(); | ||
324 | } | 330 | } |
325 | setUpdatesEnabled(true); | 331 | setUpdatesEnabled(true); |
326 | } | 332 | } |