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
@@ -1,87 +1,131 @@
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>
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 )
12 : Opie::MM::OImageScrollView(parent,name,fl) 14 : Opie::MM::OImageScrollView(parent,name,fl)
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}
26 30
27Opie::Core::OKeyConfigManager* ImageView::manager() 31Opie::Core::OKeyConfigManager* ImageView::manager()
28{ 32{
29 if (!m_viewManager) { 33 if (!m_viewManager) {
30 initKeys(); 34 initKeys();
31 } 35 }
32 return m_viewManager; 36 return m_viewManager;
33} 37}
34 38
35void ImageView::initKeys() 39void ImageView::initKeys()
36{ 40{
37 odebug << "init imageview keys" << oendl; 41 odebug << "init imageview keys" << oendl;
38 if (!m_cfg) { 42 if (!m_cfg) {
39 m_cfg = new Opie::Core::OConfig("phunkview"); 43 m_cfg = new Opie::Core::OConfig("phunkview");
40 m_cfg->setGroup("image_view_keys" ); 44 m_cfg->setGroup("image_view_keys" );
41 } 45 }
42 Opie::Core::OKeyPair::List lst; 46 Opie::Core::OKeyPair::List lst;
43 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 47 lst.append( Opie::Core::OKeyPair::upArrowKey() );
44 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 48 lst.append( Opie::Core::OKeyPair::downArrowKey() );
45 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 49 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
46 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 50 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
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),
63 this, SIGNAL(dispPrev()))); 77 this, SIGNAL(dispPrev())));
64 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", 78 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
65 Resource::loadPixmap("fullscreen"), FullScreen, 79 Resource::loadPixmap("fullscreen"), FullScreen,
66 Opie::Core::OKeyPair(Qt::Key_F,0), 80 Opie::Core::OKeyPair(Qt::Key_F,0),
67 this, SIGNAL(toggleFullScreen()))); 81 this, SIGNAL(toggleFullScreen())));
68 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", 82 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer",
69 Resource::loadPixmap("mag"), Zoomer, 83 Resource::loadPixmap("mag"), Zoomer,
70 Opie::Core::OKeyPair(Qt::Key_T,0), 84 Opie::Core::OKeyPair(Qt::Key_T,0),
71 this, SIGNAL(toggleZoomer()))); 85 this, SIGNAL(toggleZoomer())));
72 m_viewManager->handleWidget( this ); 86 m_viewManager->handleWidget( this );
73 m_viewManager->load(); 87 m_viewManager->load();
74} 88}
75 89
76void ImageView::keyReleaseEvent(QKeyEvent * e) 90void ImageView::keyReleaseEvent(QKeyEvent * e)
77{ 91{
78 if (!e || e->state()!=0) { 92 if (!e || e->state()!=0) {
79 return; 93 return;
80 } 94 }
81 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); 95 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe();
82} 96}
83 97
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
@@ -1,50 +1,56 @@
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
6namespace Opie { 6namespace Opie {
7 namespace Core { 7 namespace Core {
8 class OConfig; 8 class OConfig;
9 class OKeyConfigManager; 9 class OKeyConfigManager;
10 } 10 }
11} 11}
12 12
13class ImageView:public Opie::MM::OImageScrollView 13class ImageView:public Opie::MM::OImageScrollView
14{ 14{
15 Q_OBJECT 15 Q_OBJECT
16 16
17 enum ActionIds { 17 enum ActionIds {
18 ViewInfo, 18 ViewInfo,
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&);
34 void dispNext(); 36 void dispNext();
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;
43 void initKeys(); 47 void initKeys();
44 bool m_isFullScreen:1; 48 bool m_isFullScreen:1;
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
@@ -1,76 +1,77 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include "imageview.h" 6#include "imageview.h"
7 7
8#include "iconview.h" 8#include "iconview.h"
9#include "filesystem.h" 9#include "filesystem.h"
10#include "imageinfoui.h" 10#include "imageinfoui.h"
11#include "viewmodebutton.h" 11#include "viewmodebutton.h"
12 12
13#include <iface/ifaceinfo.h> 13#include <iface/ifaceinfo.h>
14#include <iface/dirview.h> 14#include <iface/dirview.h>
15 15
16#include <opie2/odebug.h> 16#include <opie2/odebug.h>
17#include <opie2/owidgetstack.h> 17#include <opie2/owidgetstack.h>
18#include <opie2/oapplicationfactory.h> 18#include <opie2/oapplicationfactory.h>
19#include <opie2/otabwidget.h> 19#include <opie2/otabwidget.h>
20#include <opie2/okeyconfigwidget.h> 20#include <opie2/okeyconfigwidget.h>
21 21
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
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 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" )
38 38
39PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 39PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
40 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 40 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
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
49 */ 50 */
50 QToolBar *bar = new QToolBar( this ); 51 QToolBar *bar = new QToolBar( this );
51 bar->setHorizontalStretchable( true ); 52 bar->setHorizontalStretchable( true );
52 setToolBarsMovable( false ); 53 setToolBarsMovable( false );
53 54
54 m_stack = new Opie::Ui::OWidgetStack( this ); 55 m_stack = new Opie::Ui::OWidgetStack( this );
55 setCentralWidget( m_stack ); 56 setCentralWidget( m_stack );
56 57
57 m_view = new PIconView( m_stack, m_cfg ); 58 m_view = new PIconView( m_stack, m_cfg );
58 m_stack->addWidget( m_view, IconView ); 59 m_stack->addWidget( m_view, IconView );
59 m_stack->raiseWidget( IconView ); 60 m_stack->raiseWidget( IconView );
60 connect(m_view, SIGNAL(sig_display(const QString&)), 61 connect(m_view, SIGNAL(sig_display(const QString&)),
61 this, SLOT(slotDisplay(const QString&))); 62 this, SLOT(slotDisplay(const QString&)));
62 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 63 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
63 this, SLOT(slotShowInfo(const QString&)) ); 64 this, SLOT(slotShowInfo(const QString&)) );
64 65
65 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 66 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
66 67
67 upButton = new QToolButton( bar ); 68 upButton = new QToolButton( bar );
68 upButton->setIconSet( Resource::loadIconSet( "up" ) ); 69 upButton->setIconSet( Resource::loadIconSet( "up" ) );
69 connect( upButton, SIGNAL(clicked()), 70 connect( upButton, SIGNAL(clicked()),
70 m_view, SLOT(slotDirUp()) ); 71 m_view, SLOT(slotDirUp()) );
71 72
72 fsButton = new PFileSystem( bar ); 73 fsButton = new PFileSystem( bar );
73 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 74 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
74 m_view, SLOT(slotChangeDir( const QString& ) ) ); 75 m_view, SLOT(slotChangeDir( const QString& ) ) );
75 76
76 QToolButton*btn = new QToolButton( bar ); 77 QToolButton*btn = new QToolButton( bar );
@@ -99,98 +100,115 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
99 100
100 btn = new QToolButton( bar ); 101 btn = new QToolButton( bar );
101 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 102 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
102 connect( btn, SIGNAL(clicked() ), 103 connect( btn, SIGNAL(clicked() ),
103 this, SLOT(slotConfig() ) ); 104 this, SLOT(slotConfig() ) );
104 105
105 106
106 107
107 prevButton = new QToolButton(bar); 108 prevButton = new QToolButton(bar);
108 prevButton->setIconSet( Resource::loadIconSet( "back" ) ); 109 prevButton->setIconSet( Resource::loadIconSet( "back" ) );
109 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); 110 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev()));
110 111
111 nextButton = new QToolButton(bar); 112 nextButton = new QToolButton(bar);
112 nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); 113 nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
113 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); 114 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext()));
114 115
115 rotateButton = new QToolButton(bar); 116 rotateButton = new QToolButton(bar);
116 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 117 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
117 rotateButton->setToggleButton(true); 118 rotateButton->setToggleButton(true);
118 119
119 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 120 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
120 rotateButton->setOn(true); 121 rotateButton->setOn(true);
121 autoRotate = true; 122 autoRotate = true;
122 prevButton->hide(); 123 prevButton->hide();
123 nextButton->hide(); 124 nextButton->hide();
124 } else { 125 } else {
125 rotateButton->setOn(false); 126 rotateButton->setOn(false);
126 autoRotate = false; 127 autoRotate = false;
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" ) );
140 zoomButton->setToggleButton(true); 141 zoomButton->setToggleButton(true);
141 zoomButton->setOn(true); 142 zoomButton->setOn(true);
142 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 143 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
143 zoomerOn = true; 144 zoomerOn = true;
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{
152 if (!m_disp) return; 155 if (!m_disp) return;
153 bool cur = zoomButton->isOn(); 156 bool cur = zoomButton->isOn();
154 zoomButton->setOn(!cur); 157 zoomButton->setOn(!cur);
155} 158}
156 159
157void PMainWindow::slotZoomerToggled(bool how) 160void PMainWindow::slotZoomerToggled(bool how)
158{ 161{
159 zoomerOn = how; 162 zoomerOn = how;
160 if (m_disp) { 163 if (m_disp) {
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) {
169 m_disp->setAutoRotate(how); 187 m_disp->setAutoRotate(how);
170 } 188 }
171} 189}
172 190
173void PMainWindow::slotScaleToggled(bool how) 191void PMainWindow::slotScaleToggled(bool how)
174{ 192{
175 autoScale = !how; 193 autoScale = !how;
176 if (!how) { 194 if (!how) {
177 autoRotate = how; 195 autoRotate = how;
178 } 196 }
179 if (m_disp) { 197 if (m_disp) {
180 m_disp->setAutoScaleRotate(autoScale,autoRotate); 198 m_disp->setAutoScaleRotate(autoScale,autoRotate);
181 } 199 }
182 if (!autoScale) { 200 if (!autoScale) {
183 rotateButton->setOn(false); 201 rotateButton->setOn(false);
184 } 202 }
185 rotateButton->setEnabled(!how); 203 rotateButton->setEnabled(!how);
186} 204}
187 205
188void PMainWindow::slotConfig() { 206void PMainWindow::slotConfig() {
189 /* 207 /*
190 * have a tab with the possible views 208 * have a tab with the possible views
191 * a tab for globals image cache size.. scaled loading 209 * a tab for globals image cache size.. scaled loading
192 * and one tab for the KeyConfigs 210 * and one tab for the KeyConfigs
193 */ 211 */
194 QDialog dlg(this, 0, true); 212 QDialog dlg(this, 0, true);
195 dlg.setCaption( tr("Phunk View - Config" ) ); 213 dlg.setCaption( tr("Phunk View - Config" ) );
196 214
@@ -266,150 +284,167 @@ void PMainWindow::initT( const char* name, T** ptr, int id) {
266 if ( *ptr ) { 284 if ( *ptr ) {
267 (*ptr)->disconnect(this, SLOT(slotReturn())); 285 (*ptr)->disconnect(this, SLOT(slotReturn()));
268 (*ptr)->setDestructiveClose(); 286 (*ptr)->setDestructiveClose();
269 m_stack->removeWidget( *ptr ); 287 m_stack->removeWidget( *ptr );
270 } 288 }
271 *ptr = new T(m_cfg, m_stack, name ); 289 *ptr = new T(m_cfg, m_stack, name );
272 m_stack->addWidget( *ptr, id ); 290 m_stack->addWidget( *ptr, id );
273 291
274 connect(*ptr, SIGNAL(sig_return()), 292 connect(*ptr, SIGNAL(sig_return()),
275 this,SLOT(slotReturn())); 293 this,SLOT(slotReturn()));
276 294
277} 295}
278void PMainWindow::initInfo() { 296void PMainWindow::initInfo() {
279 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 297 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
280 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 298 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
281} 299}
282void PMainWindow::initDisp() { 300void PMainWindow::initDisp() {
283 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 301 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
284 if (m_disp) { 302 if (m_disp) {
285 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 303 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
286 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 304 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
287 } 305 }
288 m_disp->setAutoScale(autoScale); 306 m_disp->setAutoScale(autoScale);
289 m_disp->setAutoRotate(autoRotate); 307 m_disp->setAutoRotate(autoRotate);
290 m_disp->setShowZoomer(zoomerOn); 308 m_disp->setShowZoomer(zoomerOn);
291 m_disp->setBackgroundColor(white); 309 m_disp->setBackgroundColor(white);
292 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 310 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
293 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 311 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
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()
302{ 322{
303 odebug << "Toggle full " << oendl; 323 odebug << "Toggle full " << oendl;
304 if (!m_disp) return; 324 if (!m_disp) return;
305 bool current = !m_disp->fullScreen(); 325 bool current = !m_disp->fullScreen();
306 m_disp->setFullScreen(current); 326 m_disp->setFullScreen(current);
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);
322 m_stack->raiseWidget(m_disp); 351 m_stack->raiseWidget(m_disp);
323 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 352 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
324 m_disp->resize(m_disp->minimumSize()); 353 m_disp->resize(m_disp->minimumSize());
325 } 354 }
326 } 355 }
327} 356}
328 357
329/** 358/**
330 * With big Screen the plan could be to 'detach' the image 359 * With big Screen the plan could be to 'detach' the image
331 * window if visible and to create a ne wone 360 * window if visible and to create a ne wone
332 * init* already supports it but I make no use of it for 361 * init* already supports it but I make no use of it for
333 * now. We set filename and raise 362 * now. We set filename and raise
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 );
342 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 374 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
343 prevButton->hide(); 375 prevButton->hide();
344 nextButton->hide(); 376 nextButton->hide();
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 ) {
356 if ( !m_disp ) { 385 if ( !m_disp ) {
357 initDisp(); 386 initDisp();
358 } 387 }
359 m_disp->setImage( inf ); 388 m_disp->setImage( inf );
360 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 389 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
361 prevButton->show(); 390 prevButton->show();
362 nextButton->show(); 391 nextButton->show();
363 upButton->hide(); 392 upButton->hide();
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}
373 403
374void PMainWindow::slotReturn() { 404void PMainWindow::slotReturn() {
375 raiseIconView(); 405 raiseIconView();
376} 406}
377 407
378 408
379void PMainWindow::closeEvent( QCloseEvent* ev ) { 409void PMainWindow::closeEvent( QCloseEvent* ev ) {
380 /* 410 /*
381 * return from view 411 * return from view
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
394void PMainWindow::raiseIconView() { 429void PMainWindow::raiseIconView() {
395 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 430 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
396 prevButton->hide(); 431 prevButton->hide();
397 nextButton->hide(); 432 nextButton->hide();
398 upButton->show(); 433 upButton->show();
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
408void PMainWindow::setDocument( const QString& showImg ) { 443void PMainWindow::setDocument( const QString& showImg ) {
409 QString file = showImg; 444 QString file = showImg;
410 DocLnk lnk(showImg); 445 DocLnk lnk(showImg);
411 if (lnk.isValid() ) 446 if (lnk.isValid() )
412 file = lnk.file(); 447 file = lnk.file();
413 448
414 slotDisplay( file ); 449 slotDisplay( file );
415} 450}
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
@@ -15,61 +15,64 @@
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 PIconView; 25class PIconView;
26class imageinfo; 26class imageinfo;
27 27
28class PMainWindow : public QMainWindow { 28class PMainWindow : public QMainWindow {
29 Q_OBJECT 29 Q_OBJECT
30 enum Views { IconView, ImageInfo, ImageDisplay }; 30 enum Views { IconView, ImageInfo, ImageDisplay };
31public: 31public:
32 static QString appName() { return QString::fromLatin1("opie-eye" ); } 32 static QString appName() { return QString::fromLatin1("opie-eye" ); }
33 PMainWindow(QWidget*, const char*, WFlags ); 33 PMainWindow(QWidget*, const char*, WFlags );
34 ~PMainWindow(); 34 ~PMainWindow();
35 35
36signals: 36signals:
37 void configChanged(); 37 void configChanged();
38 38
39public slots: 39public slots:
40 void slotShowInfo( const QString& inf ); 40 void slotShowInfo( const QString& inf );
41 void slotDisplay( const QString& inf ); 41 void slotDisplay( const QString& inf );
42 void slotReturn(); 42 void slotReturn();
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:
51 void raiseIconView(); 53 void raiseIconView();
52 void closeEvent( QCloseEvent* ); 54 void closeEvent( QCloseEvent* );
53 55
54private: 56private:
55 template<class T> void initT( const char* name, T**, int ); 57 template<class T> void initT( const char* name, T**, int );
56 void initInfo(); 58 void initInfo();
57 void initDisp(); 59 void initDisp();
58 60
59private: 61private:
60 Opie::Core::OConfig *m_cfg; 62 Opie::Core::OConfig *m_cfg;
61 Opie::Ui::OWidgetStack *m_stack; 63 Opie::Ui::OWidgetStack *m_stack;
62 PIconView* m_view; 64 PIconView* m_view;
63 imageinfo *m_info; 65 imageinfo *m_info;
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};
74 77
75#endif 78#endif