summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 6fff5ab..438fbf2 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,446 +1,445 @@
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#include <qframe.h> 33#include <qframe.h>
34 34
35 35
36//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 36//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
37OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 37OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
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// odebug << "Process-wide OApplication object @ " << oApp << oendl;
46 /* 45 /*
47 * Initialize ToolBar and IconView 46 * Initialize ToolBar and IconView
48 * And Connect Them 47 * And Connect Them
49 */ 48 */
50 QToolBar *bar = new QToolBar( this ); 49 QToolBar *bar = new QToolBar( this );
51 bar->setHorizontalStretchable( true ); 50 bar->setHorizontalStretchable( true );
52 setToolBarsMovable( false ); 51 setToolBarsMovable( false );
53 52
54 m_stack = new Opie::Ui::OWidgetStack( this ); 53 m_stack = new Opie::Ui::OWidgetStack( this );
55 setCentralWidget( m_stack ); 54 setCentralWidget( m_stack );
56 55
57 m_view = new PIconView( m_stack, m_cfg ); 56 m_view = new PIconView( m_stack, m_cfg );
58 m_stack->addWidget( m_view, IconView ); 57 m_stack->addWidget( m_view, IconView );
59 m_stack->raiseWidget( IconView ); 58 m_stack->raiseWidget( IconView );
60 connect(m_view, SIGNAL(sig_display(const QString&)), 59 connect(m_view, SIGNAL(sig_display(const QString&)),
61 this, SLOT(slotDisplay(const QString&))); 60 this, SLOT(slotDisplay(const QString&)));
62 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 61 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
63 this, SLOT(slotShowInfo(const QString&)) ); 62 this, SLOT(slotShowInfo(const QString&)) );
64 63
65 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 64 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
66 65
67 upButton = new QToolButton( bar ); 66 upButton = new QToolButton( bar );
68 upButton->setIconSet( Resource::loadIconSet( "up" ) ); 67 upButton->setIconSet( Resource::loadIconSet( "up" ) );
69 connect( upButton, SIGNAL(clicked()), 68 connect( upButton, SIGNAL(clicked()),
70 m_view, SLOT(slotDirUp()) ); 69 m_view, SLOT(slotDirUp()) );
71 70
72 fsButton = new PFileSystem( bar ); 71 fsButton = new PFileSystem( bar );
73 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 72 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
74 m_view, SLOT(slotChangeDir( const QString& ) ) ); 73 m_view, SLOT(slotChangeDir( const QString& ) ) );
75 74
76 QToolButton*btn = new QToolButton( bar ); 75 QToolButton*btn = new QToolButton( bar );
77 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 76 btn->setIconSet( Resource::loadIconSet( "edit" ) );
78 connect( btn, SIGNAL(clicked()), 77 connect( btn, SIGNAL(clicked()),
79 m_view, SLOT(slotRename()) ); 78 m_view, SLOT(slotImageInfo()) );
80 79
81 if ( Ir::supported() ) { 80 if ( Ir::supported() ) {
82 btn = new QToolButton( bar ); 81 btn = new QToolButton( bar );
83 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 82 btn->setIconSet( Resource::loadIconSet( "beam" ) );
84 connect( btn, SIGNAL(clicked()), 83 connect( btn, SIGNAL(clicked()),
85 m_view, SLOT(slotBeam()) ); 84 m_view, SLOT(slotBeam()) );
86 } 85 }
87 86
88 btn = new QToolButton( bar ); 87 btn = new QToolButton( bar );
89 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 88 btn->setIconSet( Resource::loadIconSet( "trash" ) );
90 connect( btn, SIGNAL(clicked() ), 89 connect( btn, SIGNAL(clicked() ),
91 m_view, SLOT(slotTrash() ) ); 90 m_view, SLOT(slotTrash() ) );
92 91
93 92
94 int mode = m_cfg->readNumEntry("ListViewMode", 1); 93 int mode = m_cfg->readNumEntry("ListViewMode", 1);
95 if (mode < 1 || mode>3) mode = 1; 94 if (mode < 1 || mode>3) mode = 1;
96 viewModeButton = new ViewModeButton( bar,mode ); 95 viewModeButton = new ViewModeButton( bar,mode );
97 connect( viewModeButton, SIGNAL(changeMode(int)), 96 connect( viewModeButton, SIGNAL(changeMode(int)),
98 m_view, SLOT(slotChangeMode(int))); 97 m_view, SLOT(slotChangeMode(int)));
99 98
100 btn = new QToolButton( bar ); 99 btn = new QToolButton( bar );
101 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 100 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
102 connect( btn, SIGNAL(clicked() ), 101 connect( btn, SIGNAL(clicked() ),
103 this, SLOT(slotConfig() ) ); 102 this, SLOT(slotConfig() ) );
104 103
105 104
106 105
107 prevButton = new QToolButton(bar); 106 prevButton = new QToolButton(bar);
108 prevButton->setIconSet( Resource::loadIconSet( "back" ) ); 107 prevButton->setIconSet( Resource::loadIconSet( "back" ) );
109 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); 108 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev()));
110 109
111 nextButton = new QToolButton(bar); 110 nextButton = new QToolButton(bar);
112 nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); 111 nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
113 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); 112 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext()));
114 113
115 rotateButton = new QToolButton(bar); 114 rotateButton = new QToolButton(bar);
116 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 115 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
117 rotateButton->setToggleButton(true); 116 rotateButton->setToggleButton(true);
118 117
119 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 118 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
120 rotateButton->setOn(true); 119 rotateButton->setOn(true);
121 autoRotate = true; 120 autoRotate = true;
122 prevButton->hide(); 121 prevButton->hide();
123 nextButton->hide(); 122 nextButton->hide();
124 } else { 123 } else {
125 rotateButton->setOn(false); 124 rotateButton->setOn(false);
126 autoRotate = false; 125 autoRotate = false;
127 } 126 }
128 127
129 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 128 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
130 129
131 scaleButton = new QToolButton(bar); 130 scaleButton = new QToolButton(bar);
132 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); 131 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) );
133 scaleButton->setToggleButton(true); 132 scaleButton->setToggleButton(true);
134 scaleButton->setOn(false); 133 scaleButton->setOn(false);
135 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 134 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
136 autoScale = true; 135 autoScale = true;
137 136
138 zoomButton = new QToolButton(bar); 137 zoomButton = new QToolButton(bar);
139 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); 138 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
140 zoomButton->setToggleButton(true); 139 zoomButton->setToggleButton(true);
141 zoomButton->setOn(true); 140 zoomButton->setOn(true);
142 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 141 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
143 zoomerOn = true; 142 zoomerOn = true;
144} 143}
145 144
146PMainWindow::~PMainWindow() { 145PMainWindow::~PMainWindow() {
147} 146}
148 147
149void PMainWindow::slotToggleZoomer() 148void PMainWindow::slotToggleZoomer()
150{ 149{
151 if (!m_disp) return; 150 if (!m_disp) return;
152 bool cur = zoomButton->isOn(); 151 bool cur = zoomButton->isOn();
153 zoomButton->setOn(!cur); 152 zoomButton->setOn(!cur);
154} 153}
155 154
156void PMainWindow::slotZoomerToggled(bool how) 155void PMainWindow::slotZoomerToggled(bool how)
157{ 156{
158 zoomerOn = how; 157 zoomerOn = how;
159 if (m_disp) { 158 if (m_disp) {
160 m_disp->setShowZoomer(zoomerOn); 159 m_disp->setShowZoomer(zoomerOn);
161 } 160 }
162} 161}
163 162
164void PMainWindow::slotToggleAutorotate() 163void PMainWindow::slotToggleAutorotate()
165{ 164{
166 if (!m_disp) return; 165 if (!m_disp) return;
167 if (!rotateButton->isEnabled()) return; 166 if (!rotateButton->isEnabled()) return;
168 bool cur = rotateButton->isOn(); 167 bool cur = rotateButton->isOn();
169 rotateButton->setOn(!cur); 168 rotateButton->setOn(!cur);
170} 169}
171 170
172void PMainWindow::slotToggleAutoscale() 171void PMainWindow::slotToggleAutoscale()
173{ 172{
174 if (!m_disp) return; 173 if (!m_disp) return;
175 bool cur = scaleButton->isOn(); 174 bool cur = scaleButton->isOn();
176 scaleButton->setOn(!cur); 175 scaleButton->setOn(!cur);
177} 176}
178 177
179void PMainWindow::slotRotateToggled(bool how) 178void PMainWindow::slotRotateToggled(bool how)
180{ 179{
181 autoRotate = how; 180 autoRotate = how;
182 if (m_disp) { 181 if (m_disp) {
183 m_disp->setAutoRotate(how); 182 m_disp->setAutoRotate(how);
184 } 183 }
185} 184}
186 185
187void PMainWindow::slotScaleToggled(bool how) 186void PMainWindow::slotScaleToggled(bool how)
188{ 187{
189 autoScale = !how; 188 autoScale = !how;
190 if (!how) { 189 if (!how) {
191 autoRotate = how; 190 autoRotate = how;
192 } 191 }
193 if (m_disp) { 192 if (m_disp) {
194 m_disp->setAutoScaleRotate(autoScale,autoRotate); 193 m_disp->setAutoScaleRotate(autoScale,autoRotate);
195 } 194 }
196 if (!autoScale) { 195 if (!autoScale) {
197 rotateButton->setOn(false); 196 rotateButton->setOn(false);
198 } 197 }
199 rotateButton->setEnabled(!how); 198 rotateButton->setEnabled(!how);
200} 199}
201 200
202void PMainWindow::slotConfig() { 201void PMainWindow::slotConfig() {
203 /* 202 /*
204 * have a tab with the possible views 203 * have a tab with the possible views
205 * a tab for globals image cache size.. scaled loading 204 * a tab for globals image cache size.. scaled loading
206 * and one tab for the KeyConfigs 205 * and one tab for the KeyConfigs
207 */ 206 */
208 QDialog dlg(this, 0, true); 207 QDialog dlg(this, 0, true);
209 dlg.setCaption( tr("Phunk View - Config" ) ); 208 dlg.setCaption( tr("Phunk View - Config" ) );
210 209
211 QHBoxLayout *lay = new QHBoxLayout(&dlg); 210 QHBoxLayout *lay = new QHBoxLayout(&dlg);
212 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 211 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
213 lay->addWidget( wid ); 212 lay->addWidget( wid );
214 ViewMap *vM = viewMap(); 213 ViewMap *vM = viewMap();
215 ViewMap::Iterator _it = vM->begin(); 214 ViewMap::Iterator _it = vM->begin();
216 QMap<PDirView*, QWidget*> lst; 215 QMap<PDirView*, QWidget*> lst;
217 216
218 for( ; _it != vM->end(); ++_it ) { 217 for( ; _it != vM->end(); ++_it ) {
219 PDirView *view = (_it.data())(*m_cfg); 218 PDirView *view = (_it.data())(*m_cfg);
220 PInterfaceInfo *inf = view->interfaceInfo(); 219 PInterfaceInfo *inf = view->interfaceInfo();
221 QWidget *_wid = inf->configWidget( *m_cfg ); 220 QWidget *_wid = inf->configWidget( *m_cfg );
222 if (!_wid) continue; 221 if (!_wid) continue;
223 _wid->reparent(wid, QPoint() ); 222 _wid->reparent(wid, QPoint() );
224 lst.insert( view, _wid ); 223 lst.insert( view, _wid );
225 wid->addTab( _wid, "fileopen", inf->name() ); 224 wid->addTab( _wid, "fileopen", inf->name() );
226 } 225 }
227 226
228/* 227/*
229 * Add the KeyConfigWidget 228 * Add the KeyConfigWidget
230 */ 229 */
231 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 230 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
232 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 231 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
233 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 232 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
234 233
235 if ( !m_info ) { 234 if ( !m_info ) {
236 initInfo(); 235 initInfo();
237 } 236 }
238 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 237 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
239 238
240 if ( !m_disp ) { 239 if ( !m_disp ) {
241 initDisp(); 240 initDisp();
242 } 241 }
243 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 242 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
244 243
245 keyWid->load(); 244 keyWid->load();
246 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 245 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
247 246
248 247
249 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 248 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
250 249
251/* 250/*
252 * clean up 251 * clean up
253 *apply changes 252 *apply changes
254 */ 253 */
255 254
256 QMap<PDirView*, QWidget*>::Iterator it; 255 QMap<PDirView*, QWidget*>::Iterator it;
257 for ( it = lst.begin(); it != lst.end(); ++it ) { 256 for ( it = lst.begin(); it != lst.end(); ++it ) {
258 if ( act ) 257 if ( act )
259 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 258 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
260 delete it.key(); 259 delete it.key();
261 } 260 }
262 261
263 262
264 if ( act ) { 263 if ( act ) {
265 m_view->resetView(); 264 m_view->resetView();
266 keyWid->save(); 265 keyWid->save();
267 m_disp->manager()->save(); 266 m_disp->manager()->save();
268 m_info->manager()->save(); 267 m_info->manager()->save();
269 m_view->manager()->save(); 268 m_view->manager()->save();
270 } 269 }
271 delete keyWid; 270 delete keyWid;
272} 271}
273 272
274/* 273/*
275 * create a new image info component 274 * create a new image info component
276 * and detach the current one 275 * and detach the current one
277 * we will make the other delete on exit 276 * we will make the other delete on exit
278 */ 277 */
279template<class T> 278template<class T>
280void PMainWindow::initT( const char* name, T** ptr, int id) { 279void PMainWindow::initT( const char* name, T** ptr, int id) {
281 if ( *ptr ) { 280 if ( *ptr ) {
282 (*ptr)->disconnect(this, SLOT(slotReturn())); 281 (*ptr)->disconnect(this, SLOT(slotReturn()));
283 (*ptr)->setDestructiveClose(); 282 (*ptr)->setDestructiveClose();
284 m_stack->removeWidget( *ptr ); 283 m_stack->removeWidget( *ptr );
285 } 284 }
286 *ptr = new T(m_cfg, m_stack, name ); 285 *ptr = new T(m_cfg, m_stack, name );
287 m_stack->addWidget( *ptr, id ); 286 m_stack->addWidget( *ptr, id );
288 287
289 connect(*ptr, SIGNAL(sig_return()), 288 connect(*ptr, SIGNAL(sig_return()),
290 this,SLOT(slotReturn())); 289 this,SLOT(slotReturn()));
291 290
292} 291}
293void PMainWindow::initInfo() { 292void PMainWindow::initInfo() {
294 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 293 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
295 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 294 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
296} 295}
297void PMainWindow::initDisp() { 296void PMainWindow::initDisp() {
298 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 297 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
299 if (m_disp) { 298 if (m_disp) {
300 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 299 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
301 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 300 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
302 } 301 }
303 m_disp->setAutoScale(autoScale); 302 m_disp->setAutoScale(autoScale);
304 m_disp->setAutoRotate(autoRotate); 303 m_disp->setAutoRotate(autoRotate);
305 m_disp->setShowZoomer(zoomerOn); 304 m_disp->setShowZoomer(zoomerOn);
306 m_disp->setBackgroundColor(white); 305 m_disp->setBackgroundColor(white);
307 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 306 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
308 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 307 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
309 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 308 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
310 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 309 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
311 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 310 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
312 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 311 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
313 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 312 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
314 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 313 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
315 } 314 }
316} 315}
317 316
318void PMainWindow::slotToggleFullScreen() 317void PMainWindow::slotToggleFullScreen()
319{ 318{
320 odebug << "Toggle full " << oendl; 319 odebug << "Toggle full " << oendl;
321 if (!m_disp) return; 320 if (!m_disp) return;
322 bool current = !m_disp->fullScreen(); 321 bool current = !m_disp->fullScreen();
323 odebug << "Current = " << current << oendl; 322 odebug << "Current = " << current << oendl;
324 if (current) { 323 if (current) {
325 odebug << "full" << oendl; 324 odebug << "full" << oendl;
326 m_disp->setBackgroundColor(black); 325 m_disp->setBackgroundColor(black);
327 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 326 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
328 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 327 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
329 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 328 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
330 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 329 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
331 //m_disp->showFullScreen(); 330 //m_disp->showFullScreen();
332 //qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 331 //qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
333 } else { 332 } else {
334 setUpdatesEnabled(false); 333 setUpdatesEnabled(false);
335 odebug << "window" << oendl; 334 odebug << "window" << oendl;
336 m_disp->reparent(0,QPoint(0,0)); 335 m_disp->reparent(0,QPoint(0,0));
337 m_disp->showNormal(); 336 m_disp->showNormal();
338 m_disp->setBackgroundColor(white); 337 m_disp->setBackgroundColor(white);
339 m_stack->addWidget(m_disp,ImageDisplay); 338 m_stack->addWidget(m_disp,ImageDisplay);
340 m_disp->setVScrollBarMode(QScrollView::Auto); 339 m_disp->setVScrollBarMode(QScrollView::Auto);
341 m_disp->setHScrollBarMode(QScrollView::Auto); 340 m_disp->setHScrollBarMode(QScrollView::Auto);
342 m_stack->raiseWidget(m_disp); 341 m_stack->raiseWidget(m_disp);
343 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 342 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
344 m_disp->resize(m_disp->minimumSize()); 343 m_disp->resize(m_disp->minimumSize());
345 } 344 }
346 setUpdatesEnabled(true); 345 setUpdatesEnabled(true);
347 } 346 }
348 m_disp->setFullScreen(current); 347 m_disp->setFullScreen(current);
349} 348}
350 349
351/** 350/**
352 * With big Screen the plan could be to 'detach' the image 351 * With big Screen the plan could be to 'detach' the image
353 * window if visible and to create a ne wone 352 * window if visible and to create a ne wone
354 * init* already supports it but I make no use of it for 353 * init* already supports it but I make no use of it for
355 * now. We set filename and raise 354 * now. We set filename and raise
356 * 355 *
357 * ### FIXME and talk to alwin 356 * ### FIXME and talk to alwin
358 */ 357 */
359void PMainWindow::slotShowInfo( const QString& inf ) { 358void PMainWindow::slotShowInfo( const QString& inf ) {
360 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 359 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
361 return; 360 return;
362 } 361 }
363 if ( !m_info ) { 362 if ( !m_info ) {
364 initInfo(); 363 initInfo();
365 } 364 }
366 m_info->setPath( inf ); 365 m_info->setPath( inf );
367 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 366 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
368 prevButton->hide(); 367 prevButton->hide();
369 nextButton->hide(); 368 nextButton->hide();
370 upButton->hide(); 369 upButton->hide();
371 fsButton->hide(); 370 fsButton->hide();
372 viewModeButton->hide(); 371 viewModeButton->hide();
373 } 372 }
374 m_stack->raiseWidget( ImageInfo ); 373 m_stack->raiseWidget( ImageInfo );
375} 374}
376 375
377void PMainWindow::slotDisplay( const QString& inf ) { 376void PMainWindow::slotDisplay( const QString& inf ) {
378 if ( !m_disp ) { 377 if ( !m_disp ) {
379 initDisp(); 378 initDisp();
380 } 379 }
381 m_disp->setImage( inf ); 380 m_disp->setImage( inf );
382 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 381 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
383 prevButton->show(); 382 prevButton->show();
384 nextButton->show(); 383 nextButton->show();
385 upButton->hide(); 384 upButton->hide();
386 fsButton->hide(); 385 fsButton->hide();
387 viewModeButton->hide(); 386 viewModeButton->hide();
388 } 387 }
389 if (m_disp->fullScreen()) { 388 if (m_disp->fullScreen()) {
390 //m_disp->showFullScreen(); 389 //m_disp->showFullScreen();
391 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 390 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
392 } else { 391 } else {
393 m_stack->raiseWidget( ImageDisplay ); 392 m_stack->raiseWidget( ImageDisplay );
394 } 393 }
395} 394}
396 395
397void PMainWindow::slotReturn() { 396void PMainWindow::slotReturn() {
398 raiseIconView(); 397 raiseIconView();
399} 398}
400 399
401 400
402void PMainWindow::closeEvent( QCloseEvent* ev ) { 401void PMainWindow::closeEvent( QCloseEvent* ev ) {
403 /* 402 /*
404 * return from view 403 * return from view
405 * or properly quit 404 * or properly quit
406 */ 405 */
407 if ( m_stack->visibleWidget() == m_info || 406 if ( m_stack->visibleWidget() == m_info ||
408 m_stack->visibleWidget() == m_disp ) { 407 m_stack->visibleWidget() == m_disp ) {
409 ev->ignore(); 408 ev->ignore();
410 raiseIconView(); 409 raiseIconView();
411 return; 410 return;
412 } 411 }
413 if (m_disp && m_disp->fullScreen()) { 412 if (m_disp && m_disp->fullScreen()) {
414 /* otherwise opie-eye crashes in bigscreen mode! */ 413 /* otherwise opie-eye crashes in bigscreen mode! */
415 m_disp->reparent(0,QPoint(0,0)); 414 m_disp->reparent(0,QPoint(0,0));
416 m_stack->addWidget(m_disp,ImageDisplay); 415 m_stack->addWidget(m_disp,ImageDisplay);
417 } 416 }
418 ev->accept(); 417 ev->accept();
419 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 418 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
420} 419}
421 420
422void PMainWindow::raiseIconView() { 421void PMainWindow::raiseIconView() {
423 setUpdatesEnabled(false); 422 setUpdatesEnabled(false);
424 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 423 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
425 prevButton->hide(); 424 prevButton->hide();
426 nextButton->hide(); 425 nextButton->hide();
427 upButton->show(); 426 upButton->show();
428 fsButton->show(); 427 fsButton->show();
429 viewModeButton->show(); 428 viewModeButton->show();
430 } 429 }
431 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 430 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
432 m_disp->hide(); 431 m_disp->hide();
433 } 432 }
434 m_stack->raiseWidget( IconView ); 433 m_stack->raiseWidget( IconView );
435 setUpdatesEnabled(true); 434 setUpdatesEnabled(true);
436 repaint(); 435 repaint();
437} 436}
438 437
439void PMainWindow::setDocument( const QString& showImg ) { 438void PMainWindow::setDocument( const QString& showImg ) {
440 QString file = showImg; 439 QString file = showImg;
441 DocLnk lnk(showImg); 440 DocLnk lnk(showImg);
442 if (lnk.isValid() ) 441 if (lnk.isValid() )
443 file = lnk.file(); 442 file = lnk.file();
444 443
445 slotDisplay( file ); 444 slotDisplay( file );
446} 445}