summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp46
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h8
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp63
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h5
4 files changed, 105 insertions, 17 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 88a8bc6..5b34ca2 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -4,8 +4,10 @@
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>
9#include <qpopupmenu.h>
8 10
9using namespace Opie::Core; 11using namespace Opie::Core;
10 12
11ImageView::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 )
@@ -13,13 +15,15 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name
13{ 15{
14 m_viewManager = 0; 16 m_viewManager = 0;
15 m_cfg = cfg; 17 m_cfg = cfg;
16 m_isFullScreen = false; 18 m_isFullScreen = false;
19 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
17 initKeys(); 20 initKeys();
18} 21}
19 22
20ImageView::~ImageView() 23ImageView::~ImageView()
21{ 24{
25 odebug << "Delete Imageview" << oendl;
22 if (m_viewManager) { 26 if (m_viewManager) {
23 delete m_viewManager; 27 delete m_viewManager;
24 } 28 }
25} 29}
@@ -47,16 +51,26 @@ void ImageView::initKeys()
47 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); 51 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0));
48 52
49 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", 53 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
50 lst, false,this, "image_view_keys" ); 54 lst, false,this, "image_view_keys" );
55
51 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 56 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
52 Resource::loadPixmap("1to1"), ViewInfo, 57 Resource::loadPixmap("1to1"), ViewInfo,
53 Opie::Core::OKeyPair(Qt::Key_I,0), 58 Opie::Core::OKeyPair(Qt::Key_I,0),
54 this, SLOT(slotShowImageInfo()))); 59 this, SLOT(slotShowImageInfo())));
55 60
61 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate",
62 Resource::loadPixmap("rotate"), Autorotate,
63 Opie::Core::OKeyPair(Qt::Key_R,0),
64 this, SIGNAL(toggleAutorotate())));
65 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
66 Resource::loadPixmap("1to1"), Autoscale,
67 Opie::Core::OKeyPair(Qt::Key_S,0),
68 this, SIGNAL(toggleAutoscale())));
69
56 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", 70 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
57 Resource::loadPixmap("forward"), ShowNext, 71 Resource::loadPixmap("forward"), ShowNext,
58 Opie::Core::OKeyPair(Qt::Key_N,0), 72 Opie::Core::OKeyPair(Qt::Key_Return,0),
59 this, SIGNAL(dispNext()))); 73 this, SIGNAL(dispNext())));
60 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", 74 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
61 Resource::loadPixmap("back"), ShowPrevious, 75 Resource::loadPixmap("back"), ShowPrevious,
62 Opie::Core::OKeyPair(Qt::Key_P,0), 76 Opie::Core::OKeyPair(Qt::Key_P,0),
@@ -84,4 +98,34 @@ void ImageView::keyReleaseEvent(QKeyEvent * e)
84void ImageView::slotShowImageInfo() 98void ImageView::slotShowImageInfo()
85{ 99{
86 emit dispImageInfo(m_lastName); 100 emit dispImageInfo(m_lastName);
87} 101}
102
103void ImageView::contentsMousePressEvent ( QMouseEvent * e)
104{
105 if (e->button()==1) {
106 return OImageScrollView::contentsMousePressEvent(e);
107 }
108 if (!fullScreen()) return;
109#if 0
110 // doesn't work right (repainting problems)
111 odebug << "Popup " << oendl;
112 QPopupMenu *m = new QPopupMenu(0);
113 if (!m) return;
114 m->insertItem(tr("Previous image"),ShowPrevious);
115 m->insertItem(tr("Next image"),ShowNext);
116 m->insertSeparator();
117 m->insertItem(tr("Toggle fullscreen"),FullScreen);
118 m->insertItem(tr("Toggle autoscale"),Autoscale);
119 m->insertItem(tr("Toggle autorotate"),Autorotate);
120 m->insertItem(tr("Toggle thumbnail"),Zoomer);
121 m->setFocus();
122 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
123 delete m;
124 parentWidget()->showFullScreen();
125#endif
126}
127
128void ImageView::setFullScreen(bool how)
129{
130 m_isFullScreen = how;
131}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 6bf930f..445bee9 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -19,15 +19,17 @@ class ImageView:public Opie::MM::OImageScrollView
19 FullScreen, 19 FullScreen,
20 ShowNext, 20 ShowNext,
21 ShowPrevious, 21 ShowPrevious,
22 Zoomer, 22 Zoomer,
23 Autorotate,
24 Autoscale
23 }; 25 };
24 26
25public: 27public:
26 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); 28 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 );
27 virtual ~ImageView(); 29 virtual ~ImageView();
28 Opie::Core::OKeyConfigManager* manager(); 30 Opie::Core::OKeyConfigManager* manager();
29 void setFullScreen(bool how){m_isFullScreen = how;} 31 void setFullScreen(bool how);
30 bool fullScreen(){return m_isFullScreen;} 32 bool fullScreen(){return m_isFullScreen;}
31 33
32signals: 34signals:
33 void dispImageInfo(const QString&); 35 void dispImageInfo(const QString&);
@@ -35,8 +37,10 @@ signals:
35 void dispPrev(); 37 void dispPrev();
36 void toggleFullScreen(); 38 void toggleFullScreen();
37 void hideMe(); 39 void hideMe();
38 void toggleZoomer(); 40 void toggleZoomer();
41 void toggleAutoscale();
42 void toggleAutorotate();
39 43
40protected: 44protected:
41 Opie::Core::OConfig * m_cfg; 45 Opie::Core::OConfig * m_cfg;
42 Opie::Core::OKeyConfigManager*m_viewManager; 46 Opie::Core::OKeyConfigManager*m_viewManager;
@@ -45,6 +49,8 @@ protected:
45 49
46protected slots: 50protected slots:
47 virtual void slotShowImageInfo(); 51 virtual void slotShowImageInfo();
48 virtual void keyReleaseEvent(QKeyEvent * e); 52 virtual void keyReleaseEvent(QKeyEvent * e);
53 virtual void contentsMousePressEvent ( QMouseEvent * e);
49}; 54};
55
50#endif 56#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 0484f73..a784f5b 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -29,9 +29,9 @@
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 33#include <qframe.h>
34 34
35 35
36 36
37OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 37OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
@@ -41,8 +41,9 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
41{ 41{
42 setCaption( QObject::tr("Opie Eye Caramba" ) ); 42 setCaption( QObject::tr("Opie Eye Caramba" ) );
43 m_cfg = new Opie::Core::OConfig("phunkview"); 43 m_cfg = new Opie::Core::OConfig("phunkview");
44 m_cfg->setGroup("Zecke_view" ); 44 m_cfg->setGroup("Zecke_view" );
45 tFrame = 0;
45// qDebug( "Process-wide OApplication object @ %0x", oApp ); 46// qDebug( "Process-wide OApplication object @ %0x", oApp );
46 /* 47 /*
47 * Initialize ToolBar and IconView 48 * Initialize ToolBar and IconView
48 * And Connect Them 49 * And Connect Them
@@ -127,13 +128,13 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
127 } 128 }
128 129
129 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 130 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
130 131
131 btn = new QToolButton(bar); 132 scaleButton = new QToolButton(bar);
132 btn->setIconSet( Resource::loadIconSet( "1to1" ) ); 133 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) );
133 btn->setToggleButton(true); 134 scaleButton->setToggleButton(true);
134 btn->setOn(false); 135 scaleButton->setOn(false);
135 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 136 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
136 autoScale = true; 137 autoScale = true;
137 138
138 zoomButton = new QToolButton(bar); 139 zoomButton = new QToolButton(bar);
139 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); 140 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
@@ -144,8 +145,10 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
144} 145}
145 146
146PMainWindow::~PMainWindow() { 147PMainWindow::~PMainWindow() {
147 odebug << "Shutting down" << oendl; 148 odebug << "Shutting down" << oendl;
149 if (tFrame) delete tFrame;
150 odebug << "Shutting down done" << oendl;
148} 151}
149 152
150void PMainWindow::slotToggleZoomer() 153void PMainWindow::slotToggleZoomer()
151{ 154{
@@ -161,8 +164,23 @@ void PMainWindow::slotZoomerToggled(bool how)
161 m_disp->setShowZoomer(zoomerOn); 164 m_disp->setShowZoomer(zoomerOn);
162 } 165 }
163} 166}
164 167
168void PMainWindow::slotToggleAutorotate()
169{
170 if (!m_disp) return;
171 if (!rotateButton->isEnabled()) return;
172 bool cur = rotateButton->isOn();
173 rotateButton->setOn(!cur);
174}
175
176void PMainWindow::slotToggleAutoscale()
177{
178 if (!m_disp) return;
179 bool cur = scaleButton->isOn();
180 scaleButton->setOn(!cur);
181}
182
165void PMainWindow::slotRotateToggled(bool how) 183void PMainWindow::slotRotateToggled(bool how)
166{ 184{
167 autoRotate = how; 185 autoRotate = how;
168 if (m_disp) { 186 if (m_disp) {
@@ -294,8 +312,10 @@ void PMainWindow::initDisp() {
294 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 312 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
295 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 313 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
296 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 314 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
297 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 315 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
316 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
317 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
298 } 318 }
299} 319}
300 320
301void PMainWindow::slotToggleFullScreen() 321void PMainWindow::slotToggleFullScreen()
@@ -307,15 +327,24 @@ void PMainWindow::slotToggleFullScreen()
307 odebug << "Current = " << current << oendl; 327 odebug << "Current = " << current << oendl;
308 if (current) { 328 if (current) {
309 odebug << "full" << oendl; 329 odebug << "full" << oendl;
310 m_disp->setBackgroundColor(black); 330 m_disp->setBackgroundColor(black);
311 m_disp->reparent(0,QPoint(0,0)); 331 if (!tFrame) {
332 tFrame = new QWidget(0,0,WType_TopLevel|WStyle_NoBorder|WStyle_StaysOnTop);
333 tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height());
334 tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height());
335 }
336 m_disp->reparent(tFrame,QPoint(0,0));
312 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 337 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
313 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 338 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
314 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 339 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
315 m_disp->showFullScreen(); 340 tFrame->showFullScreen();
316 } else { 341 } else {
317 odebug << "window" << oendl; 342 odebug << "window" << oendl;
343 m_disp->reparent(0,QPoint(0,0));
344 m_disp->showNormal();
345 /* don't forget it! */
346 tFrame->hide();
318 m_disp->setBackgroundColor(white); 347 m_disp->setBackgroundColor(white);
319 m_stack->addWidget(m_disp,ImageDisplay); 348 m_stack->addWidget(m_disp,ImageDisplay);
320 m_disp->setVScrollBarMode(QScrollView::Auto); 349 m_disp->setVScrollBarMode(QScrollView::Auto);
321 m_disp->setHScrollBarMode(QScrollView::Auto); 350 m_disp->setHScrollBarMode(QScrollView::Auto);
@@ -334,8 +363,11 @@ void PMainWindow::slotToggleFullScreen()
334 * 363 *
335 * ### FIXME and talk to alwin 364 * ### FIXME and talk to alwin
336 */ 365 */
337void PMainWindow::slotShowInfo( const QString& inf ) { 366void PMainWindow::slotShowInfo( const QString& inf ) {
367 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
368 return;
369 }
338 if ( !m_info ) { 370 if ( !m_info ) {
339 initInfo(); 371 initInfo();
340 } 372 }
341 m_info->setPath( inf ); 373 m_info->setPath( inf );
@@ -345,11 +377,8 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
345 upButton->hide(); 377 upButton->hide();
346 fsButton->hide(); 378 fsButton->hide();
347 viewModeButton->hide(); 379 viewModeButton->hide();
348 } 380 }
349 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
350 m_disp->hide();
351 }
352 m_stack->raiseWidget( ImageInfo ); 381 m_stack->raiseWidget( ImageInfo );
353} 382}
354 383
355void PMainWindow::slotDisplay( const QString& inf ) { 384void PMainWindow::slotDisplay( const QString& inf ) {
@@ -364,9 +393,10 @@ void PMainWindow::slotDisplay( const QString& inf ) {
364 fsButton->hide(); 393 fsButton->hide();
365 viewModeButton->hide(); 394 viewModeButton->hide();
366 } 395 }
367 if (m_disp->fullScreen()) { 396 if (m_disp->fullScreen()) {
368 m_disp->show(); 397 tFrame->setActiveWindow();
398 tFrame->showFullScreen();
369 } else { 399 } else {
370 m_stack->raiseWidget( ImageDisplay ); 400 m_stack->raiseWidget( ImageDisplay );
371 } 401 }
372} 402}
@@ -382,12 +412,17 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) {
382 * or properly quit 412 * or properly quit
383 */ 413 */
384 if ( m_stack->visibleWidget() == m_info || 414 if ( m_stack->visibleWidget() == m_info ||
385 m_stack->visibleWidget() == m_disp ) { 415 m_stack->visibleWidget() == m_disp ) {
386 raiseIconView();
387 ev->ignore(); 416 ev->ignore();
417 raiseIconView();
388 return; 418 return;
389 } 419 }
420 if (m_disp && m_disp->fullScreen()) {
421 /* otherwise opie-eye crashes in bigscreen mode! */
422 m_disp->reparent(0,QPoint(0,0));
423 m_stack->addWidget(m_disp,ImageDisplay);
424 }
390 ev->accept(); 425 ev->accept();
391 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 426 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
392} 427}
393 428
@@ -399,9 +434,9 @@ void PMainWindow::raiseIconView() {
399 fsButton->show(); 434 fsButton->show();
400 viewModeButton->show(); 435 viewModeButton->show();
401 } 436 }
402 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 437 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
403 m_disp->hide(); 438 tFrame->hide();
404 } 439 }
405 m_stack->raiseWidget( IconView ); 440 m_stack->raiseWidget( IconView );
406} 441}
407 442
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index e51a3ff..1f90f9f 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -43,8 +43,10 @@ public slots:
43 void slotRotateToggled(bool); 43 void slotRotateToggled(bool);
44 void slotScaleToggled(bool); 44 void slotScaleToggled(bool);
45 void slotZoomerToggled(bool); 45 void slotZoomerToggled(bool);
46 void slotToggleZoomer(); 46 void slotToggleZoomer();
47 void slotToggleAutorotate();
48 void slotToggleAutoscale();
47 void setDocument( const QString& ); 49 void setDocument( const QString& );
48 virtual void slotToggleFullScreen(); 50 virtual void slotToggleFullScreen();
49 51
50protected slots: 52protected slots:
@@ -64,10 +66,11 @@ private:
64 ImageView *m_disp; 66 ImageView *m_disp;
65 bool autoRotate; 67 bool autoRotate;
66 bool autoScale; 68 bool autoScale;
67 bool zoomerOn; 69 bool zoomerOn;
70 QWidget*tFrame;
68 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; 71 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton;
69 QToolButton*nextButton,*prevButton,*zoomButton; 72 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton;
70 73
71private slots: 74private slots:
72 void slotConfig(); 75 void slotConfig();
73}; 76};