summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-23 13:22:22 (UTC)
committer alwin <alwin>2004-04-23 13:22:22 (UTC)
commitda6a98dbc555018a29bf140ed8e890015240b322 (patch) (unidiff)
tree3b8b05451fcd2c653982e1cd63b92eb0fb8b9a72
parent33666eb31ae6d35aa527cf7bf22c2c2e0dcd6824 (diff)
downloadopie-da6a98dbc555018a29bf140ed8e890015240b322.zip
opie-da6a98dbc555018a29bf140ed8e890015240b322.tar.gz
opie-da6a98dbc555018a29bf140ed8e890015240b322.tar.bz2
ok, I think I have all tried to reduce flicker in fullscreen when opie-eye
get focus back. But as long I must repaint the fullScreenwidget my self when taskbar comes visible I can not do anymore.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp30
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h16
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp24
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h1
4 files changed, 27 insertions, 44 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 03f3c1c..b4f3110 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -101,68 +101,74 @@ void ImageView::slotShowImageInfo()
101{ 101{
102 emit dispImageInfo(m_lastName); 102 emit dispImageInfo(m_lastName);
103} 103}
104 104
105void ImageView::contentsMousePressEvent ( QMouseEvent * e) 105void ImageView::contentsMousePressEvent ( QMouseEvent * e)
106{ 106{
107 if (e->button()==1) { 107 if (e->button()==1) {
108 return OImageScrollView::contentsMousePressEvent(e); 108 return OImageScrollView::contentsMousePressEvent(e);
109 } 109 }
110 odebug << "Popup " << oendl; 110 odebug << "Popup " << oendl;
111 QPopupMenu *m = new QPopupMenu(0); 111 QPopupMenu *m = new QPopupMenu(0);
112 if (!m) return; 112 if (!m) return;
113 bool old = fullScreen();
114 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); 113 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen()));
115 if (fullScreen()) { 114 if (fullScreen()) {
116 m->insertSeparator(); 115 m->insertSeparator();
117 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); 116 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev()));
118 m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); 117 m->insertItem(tr("Next image"),this,SIGNAL(dispNext()));
119 m->insertSeparator(); 118 m->insertSeparator();
120 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); 119 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale()));
121 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); 120 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate()));
122 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); 121 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer()));
123 } 122 }
124 m->setFocus(); 123 m->setFocus();
125 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 124 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
126 delete m; 125 delete m;
127} 126}
128 127
129void ImageView::setFullScreen(bool how) 128void ImageView::setFullScreen(bool how)
130{ 129{
131 m_isFullScreen = how; 130 m_isFullScreen = how;
131 if (how) {
132 m_ignore_next_in = true;
133 setFixedSize(qApp->desktop()->size());
134 showFullScreen();
135 } else {
136 setMinimumSize(10,10);
137 }
132} 138}
133 139
134void ImageView::focusInEvent(QFocusEvent *) 140void ImageView::focusInEvent(QFocusEvent *)
135{ 141{
136 // Always do it here, no matter the size. 142 // Always do it here, no matter the size.
137 odebug << "Focus in (view)" << oendl; 143 odebug << "Focus in (view)" << oendl;
138 //if (fullScreen()) parentWidget()->showNormal(); 144 //if (fullScreen()) parentWidget()->showNormal();
139 if (m_ignore_next_in){m_ignore_next_in=false;return;} 145 if (m_ignore_next_in){m_ignore_next_in=false;return;}
140 if (fullScreen()) enableFullscreen(); 146 if (fullScreen()) enableFullscreen();
141} 147}
142 148
149void ImageView::hide()
150{
151 if (fullScreen()) {
152 m_ignore_next_in = true;
153 showNormal();
154 }
155 QWidget::hide();
156}
143void ImageView::enableFullscreen() 157void ImageView::enableFullscreen()
144{ 158{
145 // This call is needed because showFullScreen won't work
146 // correctly if the widget already considers itself to be fullscreen.
147 if (!fullScreen()) return; 159 if (!fullScreen()) return;
148 if (m_ignore_next_in) {m_ignore_next_in = false;return;} 160 if (m_ignore_next_in) {m_ignore_next_in = false;return;}
149 161
150 setUpdatesEnabled(false); 162 setUpdatesEnabled(false);
151 parentWidget()->showNormal();
152 // This is needed because showNormal() forcefully changes the window 163 // This is needed because showNormal() forcefully changes the window
153 // style to WSTyle_TopLevel. 164 // style to WSTyle_TopLevel.
154 parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 165 reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
155 // Enable fullscreen. 166 // Enable fullscreen.
156 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus 167 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
157 * so we must block it here! */ 168 * so we must block it here! */
158 m_ignore_next_in = true; 169 m_ignore_next_in = true;
159 parentWidget()->showFullScreen(); 170 showFullScreen();
160 setUpdatesEnabled(true); 171 setUpdatesEnabled(true);
161}
162 172
163ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f)
164 : QWidget(parent,name,f)
165{
166 // Make sure size is correct
167 setFixedSize(qApp->desktop()->size());
168} 173}
174
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index f3c37b5..18697e0 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -44,34 +44,22 @@ signals:
44 void toggleAutoscale(); 44 void toggleAutoscale();
45 void toggleAutorotate(); 45 void toggleAutorotate();
46 46
47protected: 47protected:
48 Opie::Core::OConfig * m_cfg; 48 Opie::Core::OConfig * m_cfg;
49 Opie::Core::OKeyConfigManager*m_viewManager; 49 Opie::Core::OKeyConfigManager*m_viewManager;
50 void initKeys(); 50 void initKeys();
51 bool m_isFullScreen:1; 51 bool m_isFullScreen:1;
52 bool m_ignore_next_in:1; 52 bool m_ignore_next_in:1;
53 int focus_in_count; 53 int focus_in_count;
54 virtual void focusInEvent ( QFocusEvent * ); 54 virtual void focusInEvent ( QFocusEvent * );
55 55
56public slots:
57 virtual void hide();
56 58
57protected slots: 59protected slots:
58 virtual void slotShowImageInfo(); 60 virtual void slotShowImageInfo();
59 virtual void keyReleaseEvent(QKeyEvent * e); 61 virtual void keyReleaseEvent(QKeyEvent * e);
60 virtual void contentsMousePressEvent ( QMouseEvent * e); 62 virtual void contentsMousePressEvent ( QMouseEvent * e);
61}; 63};
62 64
63class ImageWidget:public QWidget
64{
65 Q_OBJECT
66public:
67 ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder);
68 virtual ~ImageWidget(){};
69
70protected:
71
72public slots:
73
74protected slots:
75};
76
77#endif 65#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index cdaf34c..274a22a 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -24,35 +24,33 @@
24#include <qpe/ir.h> 24#include <qpe/ir.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26 26
27#include <qtoolbar.h> 27#include <qtoolbar.h>
28#include <qtoolbutton.h> 28#include <qtoolbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qdialog.h> 30#include <qdialog.h>
31#include <qmap.h> 31#include <qmap.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qframe.h> 33#include <qframe.h>
34 34
35 35
36
37//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 36//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
38OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 37OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
39 38
40PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 39PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
41 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 40 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
42{ 41{
43 setCaption( QObject::tr("Opie Eye Caramba" ) ); 42 setCaption( QObject::tr("Opie Eye Caramba" ) );
44 m_cfg = new Opie::Core::OConfig("phunkview"); 43 m_cfg = new Opie::Core::OConfig("phunkview");
45 m_cfg->setGroup("Zecke_view" ); 44 m_cfg->setGroup("Zecke_view" );
46 tFrame = 0;
47// qDebug( "Process-wide OApplication object @ %0x", oApp ); 45// qDebug( "Process-wide OApplication object @ %0x", oApp );
48 /* 46 /*
49 * Initialize ToolBar and IconView 47 * Initialize ToolBar and IconView
50 * And Connect Them 48 * And Connect Them
51 */ 49 */
52 QToolBar *bar = new QToolBar( this ); 50 QToolBar *bar = new QToolBar( this );
53 bar->setHorizontalStretchable( true ); 51 bar->setHorizontalStretchable( true );
54 setToolBarsMovable( false ); 52 setToolBarsMovable( false );
55 53
56 m_stack = new Opie::Ui::OWidgetStack( this ); 54 m_stack = new Opie::Ui::OWidgetStack( this );
57 setCentralWidget( m_stack ); 55 setCentralWidget( m_stack );
58 56
@@ -137,27 +135,24 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
137 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 135 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
138 autoScale = true; 136 autoScale = true;
139 137
140 zoomButton = new QToolButton(bar); 138 zoomButton = new QToolButton(bar);
141 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); 139 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
142 zoomButton->setToggleButton(true); 140 zoomButton->setToggleButton(true);
143 zoomButton->setOn(true); 141 zoomButton->setOn(true);
144 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 142 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
145 zoomerOn = true; 143 zoomerOn = true;
146} 144}
147 145
148PMainWindow::~PMainWindow() { 146PMainWindow::~PMainWindow() {
149 odebug << "Shutting down" << oendl;
150 if (tFrame) delete tFrame;
151 odebug << "Shutting down done" << oendl;
152} 147}
153 148
154void PMainWindow::slotToggleZoomer() 149void PMainWindow::slotToggleZoomer()
155{ 150{
156 if (!m_disp) return; 151 if (!m_disp) return;
157 bool cur = zoomButton->isOn(); 152 bool cur = zoomButton->isOn();
158 zoomButton->setOn(!cur); 153 zoomButton->setOn(!cur);
159} 154}
160 155
161void PMainWindow::slotZoomerToggled(bool how) 156void PMainWindow::slotZoomerToggled(bool how)
162{ 157{
163 zoomerOn = how; 158 zoomerOn = how;
@@ -316,56 +311,50 @@ void PMainWindow::initDisp() {
316 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 311 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
317 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 312 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
318 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 313 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
319 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 314 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
320 } 315 }
321} 316}
322 317
323void PMainWindow::slotToggleFullScreen() 318void PMainWindow::slotToggleFullScreen()
324{ 319{
325 odebug << "Toggle full " << oendl; 320 odebug << "Toggle full " << oendl;
326 if (!m_disp) return; 321 if (!m_disp) return;
327 bool current = !m_disp->fullScreen(); 322 bool current = !m_disp->fullScreen();
328 m_disp->setFullScreen(current);
329 odebug << "Current = " << current << oendl; 323 odebug << "Current = " << current << oendl;
330 if (current) { 324 if (current) {
331 odebug << "full" << oendl; 325 odebug << "full" << oendl;
332 m_disp->setBackgroundColor(black); 326 m_disp->setBackgroundColor(black);
333 if (!tFrame) { 327 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
334 tFrame = new ImageWidget(0,0,WStyle_Customize|WStyle_NoBorder);
335 tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height());
336 tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height());
337 }
338 m_disp->reparent(tFrame,QPoint(0,0));
339 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 328 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
340 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 329 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
341 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 330 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
342 tFrame->showFullScreen(); 331 //m_disp->showFullScreen();
332 //qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
343 } else { 333 } else {
344 setUpdatesEnabled(false); 334 setUpdatesEnabled(false);
345 odebug << "window" << oendl; 335 odebug << "window" << oendl;
346 m_disp->reparent(0,QPoint(0,0)); 336 m_disp->reparent(0,QPoint(0,0));
347 m_disp->showNormal(); 337 m_disp->showNormal();
348 /* don't forget it! */
349 tFrame->hide();
350 m_disp->setBackgroundColor(white); 338 m_disp->setBackgroundColor(white);
351 m_stack->addWidget(m_disp,ImageDisplay); 339 m_stack->addWidget(m_disp,ImageDisplay);
352 m_disp->setVScrollBarMode(QScrollView::Auto); 340 m_disp->setVScrollBarMode(QScrollView::Auto);
353 m_disp->setHScrollBarMode(QScrollView::Auto); 341 m_disp->setHScrollBarMode(QScrollView::Auto);
354 m_stack->raiseWidget(m_disp); 342 m_stack->raiseWidget(m_disp);
355 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 343 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
356 m_disp->resize(m_disp->minimumSize()); 344 m_disp->resize(m_disp->minimumSize());
357 } 345 }
358 setUpdatesEnabled(true); 346 setUpdatesEnabled(true);
359 } 347 }
348 m_disp->setFullScreen(current);
360} 349}
361 350
362/** 351/**
363 * With big Screen the plan could be to 'detach' the image 352 * With big Screen the plan could be to 'detach' the image
364 * window if visible and to create a ne wone 353 * window if visible and to create a ne wone
365 * init* already supports it but I make no use of it for 354 * init* already supports it but I make no use of it for
366 * now. We set filename and raise 355 * now. We set filename and raise
367 * 356 *
368 * ### FIXME and talk to alwin 357 * ### FIXME and talk to alwin
369 */ 358 */
370void PMainWindow::slotShowInfo( const QString& inf ) { 359void PMainWindow::slotShowInfo( const QString& inf ) {
371 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 360 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
@@ -389,25 +378,26 @@ void PMainWindow::slotDisplay( const QString& inf ) {
389 if ( !m_disp ) { 378 if ( !m_disp ) {
390 initDisp(); 379 initDisp();
391 } 380 }
392 m_disp->setImage( inf ); 381 m_disp->setImage( inf );
393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 382 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
394 prevButton->show(); 383 prevButton->show();
395 nextButton->show(); 384 nextButton->show();
396 upButton->hide(); 385 upButton->hide();
397 fsButton->hide(); 386 fsButton->hide();
398 viewModeButton->hide(); 387 viewModeButton->hide();
399 } 388 }
400 if (m_disp->fullScreen()) { 389 if (m_disp->fullScreen()) {
401 tFrame->show();//FullScreen(); 390 //m_disp->showFullScreen();
391 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
402 } else { 392 } else {
403 m_stack->raiseWidget( ImageDisplay ); 393 m_stack->raiseWidget( ImageDisplay );
404 } 394 }
405} 395}
406 396
407void PMainWindow::slotReturn() { 397void PMainWindow::slotReturn() {
408 raiseIconView(); 398 raiseIconView();
409} 399}
410 400
411 401
412void PMainWindow::closeEvent( QCloseEvent* ev ) { 402void PMainWindow::closeEvent( QCloseEvent* ev ) {
413 /* 403 /*
@@ -430,25 +420,25 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) {
430} 420}
431 421
432void PMainWindow::raiseIconView() { 422void PMainWindow::raiseIconView() {
433 setUpdatesEnabled(false); 423 setUpdatesEnabled(false);
434 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 424 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
435 prevButton->hide(); 425 prevButton->hide();
436 nextButton->hide(); 426 nextButton->hide();
437 upButton->show(); 427 upButton->show();
438 fsButton->show(); 428 fsButton->show();
439 viewModeButton->show(); 429 viewModeButton->show();
440 } 430 }
441 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 431 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
442 tFrame->hide(); 432 m_disp->hide();
443 } 433 }
444 m_stack->raiseWidget( IconView ); 434 m_stack->raiseWidget( IconView );
445 setUpdatesEnabled(true); 435 setUpdatesEnabled(true);
446 repaint(); 436 repaint();
447} 437}
448 438
449void PMainWindow::setDocument( const QString& showImg ) { 439void PMainWindow::setDocument( const QString& showImg ) {
450 QString file = showImg; 440 QString file = showImg;
451 DocLnk lnk(showImg); 441 DocLnk lnk(showImg);
452 if (lnk.isValid() ) 442 if (lnk.isValid() )
453 file = lnk.file(); 443 file = lnk.file();
454 444
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 9e94c60..6fa1ab6 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -59,21 +59,20 @@ private:
59 void initInfo(); 59 void initInfo();
60 void initDisp(); 60 void initDisp();
61 61
62private: 62private:
63 Opie::Core::OConfig *m_cfg; 63 Opie::Core::OConfig *m_cfg;
64 Opie::Ui::OWidgetStack *m_stack; 64 Opie::Ui::OWidgetStack *m_stack;
65 PIconView* m_view; 65 PIconView* m_view;
66 imageinfo *m_info; 66 imageinfo *m_info;
67 ImageView *m_disp; 67 ImageView *m_disp;
68 bool autoRotate; 68 bool autoRotate;
69 bool autoScale; 69 bool autoScale;
70 bool zoomerOn; 70 bool zoomerOn;
71 ImageWidget*tFrame;
72 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; 71 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton;
73 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton; 72 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton;
74 73
75private slots: 74private slots:
76 void slotConfig(); 75 void slotConfig();
77}; 76};
78 77
79#endif 78#endif