summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-22 13:15:08 (UTC)
committer alwin <alwin>2004-04-22 13:15:08 (UTC)
commit162c71d6528515ea4b28520e9708c8ce9ca7fba2 (patch) (unidiff)
treeea538ee02a3edec808aacb1b4813221fd4939ac7
parentb9509b7b90d7c70c5407f6774512037ff77fcec4 (diff)
downloadopie-162c71d6528515ea4b28520e9708c8ce9ca7fba2.zip
opie-162c71d6528515ea4b28520e9708c8ce9ca7fba2.tar.gz
opie-162c71d6528515ea4b28520e9708c8ce9ca7fba2.tar.bz2
resolved some problems with fullscreen mode.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp41
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h26
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp6
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h3
4 files changed, 62 insertions, 14 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 53376c0..5b00dea 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,32 +1,34 @@
1#include "imageview.h" 1#include "imageview.h"
2 2
3#include <opie2/odebug.h> 3#include <opie2/odebug.h>
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5#include <opie2/okeyconfigwidget.h> 5#include <opie2/okeyconfigwidget.h>
6 6
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12 12
13ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) 13ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
14 : Opie::MM::OImageScrollView(parent,name,fl) 14 : Opie::MM::OImageScrollView(parent,name,fl)
15{ 15{
16 m_viewManager = 0; 16 m_viewManager = 0;
17 m_focus_out = false;
18 block_next_focus = true;
17 m_cfg = cfg; 19 m_cfg = cfg;
18 m_isFullScreen = false; 20 m_isFullScreen = false;
19 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); 21 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
20 initKeys(); 22 initKeys();
21} 23}
22 24
23ImageView::~ImageView() 25ImageView::~ImageView()
24{ 26{
25 odebug << "Delete Imageview" << oendl; 27 odebug << "Delete Imageview" << oendl;
26 if (m_viewManager) { 28 if (m_viewManager) {
27 delete m_viewManager; 29 delete m_viewManager;
28 } 30 }
29} 31}
30 32
31Opie::Core::OKeyConfigManager* ImageView::manager() 33Opie::Core::OKeyConfigManager* ImageView::manager()
32{ 34{
@@ -113,48 +115,71 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
113 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); 115 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen()));
114 if (fullScreen()) { 116 if (fullScreen()) {
115 m->insertSeparator(); 117 m->insertSeparator();
116 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); 118 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev()));
117 m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); 119 m->insertItem(tr("Next image"),this,SIGNAL(dispNext()));
118 m->insertSeparator(); 120 m->insertSeparator();
119 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); 121 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale()));
120 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); 122 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate()));
121 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); 123 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer()));
122 } 124 }
123 m->setFocus(); 125 m->setFocus();
124 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 126 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
125 delete m; 127 delete m;
126 /* if we were fullScreen() and must overlap the taskbar again */ 128 /* if we were fullScreen() and must overlap the taskbar again */
127 if (fullScreen() && old) { 129 if (fullScreen() && old) {
128 enableFullscreen(); 130 enableFullscreen();
129// parentWidget()->hide();
130// parentWidget()->show();
131 } 131 }
132} 132}
133 133
134void ImageView::setFullScreen(bool how) 134void ImageView::setFullScreen(bool how)
135{ 135{
136 m_isFullScreen = how; 136 m_isFullScreen = how;
137} 137}
138 138
139void ImageView::focusInEvent(QFocusEvent *) 139void ImageView::focusInEvent(QFocusEvent *)
140{ 140{
141 // Always do it here, no matter the size. 141 // Always do it here, no matter the size.
142 /* result in an endless loop */ 142 odebug << "Focus in" << oendl;
143// if (fullScreen()) enableFullscreen(); 143}
144
145void ImageView::focusOutEvent(QFocusEvent *)
146{
147 odebug << "Focus out" << oendl;
144} 148}
145 149
146void ImageView::enableFullscreen() 150void ImageView::enableFullscreen()
147{ 151{
148 if (!fullScreen()) return;
149 // Make sure size is correct
150 parentWidget()->setFixedSize(qApp->desktop()->size());
151 // This call is needed because showFullScreen won't work 152 // This call is needed because showFullScreen won't work
152 // correctly if the widget already considers itself to be fullscreen. 153 // correctly if the widget already considers itself to be fullscreen.
154 setUpdatesEnabled(false);
155 odebug << "showNormal();" << oendl;
153 parentWidget()->showNormal(); 156 parentWidget()->showNormal();
157 odebug << "showNormal(); done " << oendl;
154 // This is needed because showNormal() forcefully changes the window 158 // This is needed because showNormal() forcefully changes the window
155 // style to WSTyle_TopLevel. 159 // style to WSTyle_TopLevel.
160 odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));" << oendl;
156 parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 161 parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
162 odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); done" << oendl;
157 // Enable fullscreen. 163 // Enable fullscreen.
164 odebug << "showFullScreen();" << oendl;
158 parentWidget()->showFullScreen(); 165 parentWidget()->showFullScreen();
166 odebug << "showFullScreen(); done" << oendl;
167 setUpdatesEnabled(true);
168}
169
170void ImageWidget::show()
171{
172 QWidget::show();
159} 173}
160 174
175void ImageWidget::hide()
176{
177 QWidget::hide();
178}
179
180ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f)
181 : QWidget(parent,name,f)
182{
183 // Make sure size is correct
184 setFixedSize(qApp->desktop()->size());
185}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 4d2405f..5f15bc9 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -1,58 +1,80 @@
1#ifndef _IMAGE_VIEW_H 1#ifndef _IMAGE_VIEW_H
2#define _IMAGE_VIEW_H 2#define _IMAGE_VIEW_H
3 3
4#include <opie2/oimagescrollview.h> 4#include <opie2/oimagescrollview.h>
5 5
6#include <qwidget.h>
7
6namespace Opie { 8namespace Opie {
7 namespace Core { 9 namespace Core {
8 class OConfig; 10 class OConfig;
9 class OKeyConfigManager; 11 class OKeyConfigManager;
10 } 12 }
11} 13}
12 14
13class ImageView:public Opie::MM::OImageScrollView 15class ImageView:public Opie::MM::OImageScrollView
14{ 16{
15 Q_OBJECT 17 Q_OBJECT
16 18
17 enum ActionIds { 19 enum ActionIds {
18 ViewInfo, 20 ViewInfo,
19 FullScreen, 21 FullScreen,
20 ShowNext, 22 ShowNext,
21 ShowPrevious, 23 ShowPrevious,
22 Zoomer, 24 Zoomer,
23 Autorotate, 25 Autorotate,
24 Autoscale 26 Autoscale
25 }; 27 };
26 28
27public: 29public:
28 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); 30 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 );
29 virtual ~ImageView(); 31 virtual ~ImageView();
30 Opie::Core::OKeyConfigManager* manager(); 32 Opie::Core::OKeyConfigManager* manager();
31 void setFullScreen(bool how); 33 void setFullScreen(bool how);
34 virtual void enableFullscreen();
32 bool fullScreen(){return m_isFullScreen;} 35 bool fullScreen(){return m_isFullScreen;}
33 36
34signals: 37signals:
35 void dispImageInfo(const QString&); 38 void dispImageInfo(const QString&);
36 void dispNext(); 39 void dispNext();
37 void dispPrev(); 40 void dispPrev();
38 void toggleFullScreen(); 41 void toggleFullScreen();
39 void hideMe(); 42 void hideMe();
40 void toggleZoomer(); 43 void toggleZoomer();
41 void toggleAutoscale(); 44 void toggleAutoscale();
42 void toggleAutorotate(); 45 void toggleAutorotate();
43 46
44protected: 47protected:
45 Opie::Core::OConfig * m_cfg; 48 Opie::Core::OConfig * m_cfg;
46 Opie::Core::OKeyConfigManager*m_viewManager; 49 Opie::Core::OKeyConfigManager*m_viewManager;
47 void initKeys(); 50 void initKeys();
48 bool m_isFullScreen:1; 51 bool m_isFullScreen:1;
49 void enableFullscreen(); 52 bool m_focus_out:1;
53 bool block_next_focus:1;
54
55 virtual void focusInEvent ( QFocusEvent * );
56 virtual void focusOutEvent ( QFocusEvent * );
50 57
51protected slots: 58protected slots:
52 virtual void slotShowImageInfo(); 59 virtual void slotShowImageInfo();
53 virtual void keyReleaseEvent(QKeyEvent * e); 60 virtual void keyReleaseEvent(QKeyEvent * e);
54 virtual void contentsMousePressEvent ( QMouseEvent * e); 61 virtual void contentsMousePressEvent ( QMouseEvent * e);
55 virtual void focusInEvent ( QFocusEvent * ); 62};
63
64class ImageWidget:public QWidget
65{
66 Q_OBJECT
67public:
68 ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder);
69 virtual ~ImageWidget(){};
70
71protected:
72
73public slots:
74 virtual void show();
75 virtual void hide();
76
77protected slots:
56}; 78};
57 79
58#endif 80#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index ec6b051..fa1680c 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -318,33 +318,33 @@ void PMainWindow::initDisp() {
318 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 318 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
319 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 319 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
320 } 320 }
321} 321}
322 322
323void PMainWindow::slotToggleFullScreen() 323void PMainWindow::slotToggleFullScreen()
324{ 324{
325 odebug << "Toggle full " << oendl; 325 odebug << "Toggle full " << oendl;
326 if (!m_disp) return; 326 if (!m_disp) return;
327 bool current = !m_disp->fullScreen(); 327 bool current = !m_disp->fullScreen();
328 m_disp->setFullScreen(current); 328 m_disp->setFullScreen(current);
329 odebug << "Current = " << current << oendl; 329 odebug << "Current = " << current << oendl;
330 if (current) { 330 if (current) {
331 odebug << "full" << oendl; 331 odebug << "full" << oendl;
332 m_disp->setBackgroundColor(black); 332 m_disp->setBackgroundColor(black);
333 if (!tFrame) { 333 if (!tFrame) {
334 tFrame = new QWidget(0,0,WStyle_Customize|WStyle_NoBorder); 334 tFrame = new ImageWidget(0,0,WStyle_Customize|WStyle_NoBorder);
335 tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); 335 tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height());
336 tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height()); 336 tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height());
337 } 337 }
338 m_disp->reparent(tFrame,QPoint(0,0)); 338 m_disp->reparent(tFrame,QPoint(0,0));
339 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 339 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
340 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 340 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
341 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 341 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
342 tFrame->showFullScreen(); 342 tFrame->showFullScreen();
343 } else { 343 } else {
344 setUpdatesEnabled(false); 344 setUpdatesEnabled(false);
345 odebug << "window" << oendl; 345 odebug << "window" << oendl;
346 m_disp->reparent(0,QPoint(0,0)); 346 m_disp->reparent(0,QPoint(0,0));
347 m_disp->showNormal(); 347 m_disp->showNormal();
348 /* don't forget it! */ 348 /* don't forget it! */
349 tFrame->hide(); 349 tFrame->hide();
350 m_disp->setBackgroundColor(white); 350 m_disp->setBackgroundColor(white);
@@ -385,34 +385,34 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
385 m_stack->raiseWidget( ImageInfo ); 385 m_stack->raiseWidget( ImageInfo );
386} 386}
387 387
388void PMainWindow::slotDisplay( const QString& inf ) { 388void PMainWindow::slotDisplay( const QString& inf ) {
389 if ( !m_disp ) { 389 if ( !m_disp ) {
390 initDisp(); 390 initDisp();
391 } 391 }
392 m_disp->setImage( inf ); 392 m_disp->setImage( inf );
393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
394 prevButton->show(); 394 prevButton->show();
395 nextButton->show(); 395 nextButton->show();
396 upButton->hide(); 396 upButton->hide();
397 fsButton->hide(); 397 fsButton->hide();
398 viewModeButton->hide(); 398 viewModeButton->hide();
399 } 399 }
400 if (m_disp->fullScreen()) { 400 if (m_disp->fullScreen()) {
401 tFrame->setActiveWindow(); 401// tFrame->showFullScreen();
402 tFrame->showFullScreen(); 402 m_disp->enableFullscreen();
403 } else { 403 } else {
404 m_stack->raiseWidget( ImageDisplay ); 404 m_stack->raiseWidget( ImageDisplay );
405 } 405 }
406} 406}
407 407
408void PMainWindow::slotReturn() { 408void PMainWindow::slotReturn() {
409 raiseIconView(); 409 raiseIconView();
410} 410}
411 411
412 412
413void PMainWindow::closeEvent( QCloseEvent* ev ) { 413void PMainWindow::closeEvent( QCloseEvent* ev ) {
414 /* 414 /*
415 * return from view 415 * return from view
416 * or properly quit 416 * or properly quit
417 */ 417 */
418 if ( m_stack->visibleWidget() == m_info || 418 if ( m_stack->visibleWidget() == m_info ||
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 1f90f9f..9e94c60 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -9,32 +9,33 @@
9#include <opie2/oconfig.h> 9#include <opie2/oconfig.h>
10 10
11#include <qmainwindow.h> 11#include <qmainwindow.h>
12 12
13 13
14 14
15namespace Opie { 15namespace Opie {
16namespace Ui{ 16namespace Ui{
17 class OWidgetStack; 17 class OWidgetStack;
18} 18}
19namespace Core{ 19namespace Core{
20 class OKeyConfigManager; 20 class OKeyConfigManager;
21} 21}
22} 22}
23 23
24class ImageView; 24class ImageView;
25class ImageWidget;
25class PIconView; 26class PIconView;
26class imageinfo; 27class imageinfo;
27 28
28class PMainWindow : public QMainWindow { 29class PMainWindow : public QMainWindow {
29 Q_OBJECT 30 Q_OBJECT
30 enum Views { IconView, ImageInfo, ImageDisplay }; 31 enum Views { IconView, ImageInfo, ImageDisplay };
31public: 32public:
32 static QString appName() { return QString::fromLatin1("opie-eye" ); } 33 static QString appName() { return QString::fromLatin1("opie-eye" ); }
33 PMainWindow(QWidget*, const char*, WFlags ); 34 PMainWindow(QWidget*, const char*, WFlags );
34 ~PMainWindow(); 35 ~PMainWindow();
35 36
36signals: 37signals:
37 void configChanged(); 38 void configChanged();
38 39
39public slots: 40public slots:
40 void slotShowInfo( const QString& inf ); 41 void slotShowInfo( const QString& inf );
@@ -54,25 +55,25 @@ protected slots:
54 void closeEvent( QCloseEvent* ); 55 void closeEvent( QCloseEvent* );
55 56
56private: 57private:
57 template<class T> void initT( const char* name, T**, int ); 58 template<class T> void initT( const char* name, T**, int );
58 void initInfo(); 59 void initInfo();
59 void initDisp(); 60 void initDisp();
60 61
61private: 62private:
62 Opie::Core::OConfig *m_cfg; 63 Opie::Core::OConfig *m_cfg;
63 Opie::Ui::OWidgetStack *m_stack; 64 Opie::Ui::OWidgetStack *m_stack;
64 PIconView* m_view; 65 PIconView* m_view;
65 imageinfo *m_info; 66 imageinfo *m_info;
66 ImageView *m_disp; 67 ImageView *m_disp;
67 bool autoRotate; 68 bool autoRotate;
68 bool autoScale; 69 bool autoScale;
69 bool zoomerOn; 70 bool zoomerOn;
70 QWidget*tFrame; 71 ImageWidget*tFrame;
71 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; 72 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton;
72 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton; 73 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton;
73 74
74private slots: 75private slots:
75 void slotConfig(); 76 void slotConfig();
76}; 77};
77 78
78#endif 79#endif