summaryrefslogtreecommitdiff
authorzecke <zecke>2005-03-06 14:07:46 (UTC)
committer zecke <zecke>2005-03-06 14:07:46 (UTC)
commita81251b503cba26ad326ac6c68a80a2930bef896 (patch) (unidiff)
tree07b028d708fe8add7b9766213f32d77e48c3f7be
parent125fa91f604cf9b7f3272798e72b6725fca9e23f (diff)
downloadopie-a81251b503cba26ad326ac6c68a80a2930bef896.zip
opie-a81251b503cba26ad326ac6c68a80a2930bef896.tar.gz
opie-a81251b503cba26ad326ac6c68a80a2930bef896.tar.bz2
-NoForce is the default mode of the OWidgetStack. There is no need
to set it here.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index a96bfbd..e532867 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,455 +1,453 @@
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#include "basesetup.h" 12#include "basesetup.h"
13 13
14#include <iface/ifaceinfo.h> 14#include <iface/ifaceinfo.h>
15#include <iface/dirview.h> 15#include <iface/dirview.h>
16 16
17#include <opie2/odebug.h> 17#include <opie2/odebug.h>
18#include <opie2/owidgetstack.h> 18#include <opie2/owidgetstack.h>
19#include <opie2/oapplicationfactory.h> 19#include <opie2/oapplicationfactory.h>
20#include <opie2/otabwidget.h> 20#include <opie2/otabwidget.h>
21#include <opie2/okeyconfigwidget.h> 21#include <opie2/okeyconfigwidget.h>
22 22
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/ir.h> 25#include <qpe/ir.h>
26#include <qpe/storage.h> 26#include <qpe/storage.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28 28
29#include <qtoolbar.h> 29#include <qtoolbar.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qmap.h> 33#include <qmap.h>
34#include <qtimer.h> 34#include <qtimer.h>
35#include <qframe.h> 35#include <qframe.h>
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qaction.h> 37#include <qaction.h>
38 38
39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
41 41
42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
44{ 44{
45 setCaption( QObject::tr("Opie Eye" ) ); 45 setCaption( QObject::tr("Opie Eye" ) );
46 m_cfg = new Opie::Core::OConfig("opie-eye"); 46 m_cfg = new Opie::Core::OConfig("opie-eye");
47 m_cfg->setGroup("main" ); 47 m_cfg->setGroup("main" );
48 readConfig(); 48 readConfig();
49 m_setDocCalled = false; 49 m_setDocCalled = false;
50 m_polishDone = false; 50 m_polishDone = false;
51 m_SmallWindow = QApplication::desktop()->size().width()<330; 51 m_SmallWindow = QApplication::desktop()->size().width()<330;
52 52
53 m_storage = new StorageInfo(); 53 m_storage = new StorageInfo();
54 connect(m_storage, SIGNAL(disksChanged() ), 54 connect(m_storage, SIGNAL(disksChanged() ),
55 this, SLOT( dirChanged() ) ); 55 this, SLOT( dirChanged() ) );
56 56
57 m_stack = new Opie::Ui::OWidgetStack( this ); 57 m_stack = new Opie::Ui::OWidgetStack( this );
58 setCentralWidget( m_stack ); 58 setCentralWidget( m_stack );
59 59
60 m_view = new PIconView( m_stack, m_cfg ); 60 m_view = new PIconView( m_stack, m_cfg );
61 m_stack->addWidget( m_view, IconView ); 61 m_stack->addWidget( m_view, IconView );
62 m_stack->raiseWidget( IconView ); 62 m_stack->raiseWidget( IconView );
63 63
64 connect(m_view, SIGNAL(sig_display(const QString&)), 64 connect(m_view, SIGNAL(sig_display(const QString&)),
65 this, SLOT(slotDisplay(const QString&))); 65 this, SLOT(slotDisplay(const QString&)));
66 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 66 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
67 this, SLOT(slotShowInfo(const QString&)) ); 67 this, SLOT(slotShowInfo(const QString&)) );
68 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 68 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
69 69
70 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
71
72 listviewMenu = 0; 70 listviewMenu = 0;
73 /* setup menu and toolbar */ 71 /* setup menu and toolbar */
74 setupActions(); 72 setupActions();
75 setupToolbar(); 73 setupToolbar();
76 setupMenu(); 74 setupMenu();
77 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); 75 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
78 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); 76 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
79 if (m_aForceSmall) { 77 if (m_aForceSmall) {
80 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true)); 78 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true));
81 } 79 }
82 odebug << "mainwindow constructor done" << oendl; 80 odebug << "mainwindow constructor done" << oendl;
83} 81}
84 82
85PMainWindow::~PMainWindow() { 83PMainWindow::~PMainWindow() {
86} 84}
87 85
88void PMainWindow::slotToggleZoomer() 86void PMainWindow::slotToggleZoomer()
89{ 87{
90 m_aZoomer->setOn(!m_aZoomer->isOn()); 88 m_aZoomer->setOn(!m_aZoomer->isOn());
91} 89}
92 90
93void PMainWindow::slotZoomerToggled(bool how) 91void PMainWindow::slotZoomerToggled(bool how)
94{ 92{
95 if (m_disp) { 93 if (m_disp) {
96 m_disp->setShowZoomer(how); 94 m_disp->setShowZoomer(how);
97 } 95 }
98 if (autoSave) { 96 if (autoSave) {
99 m_cfg->writeEntry("zoomeron",how); 97 m_cfg->writeEntry("zoomeron",how);
100 } 98 }
101} 99}
102 100
103void PMainWindow::slotToggleAutorotate() 101void PMainWindow::slotToggleAutorotate()
104{ 102{
105 if (!m_aAutoRotate->isEnabled()) return; 103 if (!m_aAutoRotate->isEnabled()) return;
106 m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); 104 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
107} 105}
108 106
109void PMainWindow::slotToggleAutoscale() 107void PMainWindow::slotToggleAutoscale()
110{ 108{
111 m_aUnscaled->setOn(!m_aUnscaled->isOn()); 109 m_aUnscaled->setOn(!m_aUnscaled->isOn());
112} 110}
113 111
114void PMainWindow::slotRotateToggled(bool how) 112void PMainWindow::slotRotateToggled(bool how)
115{ 113{
116 if (autoSave) { 114 if (autoSave) {
117 m_cfg->writeEntry("autorotate",how); 115 m_cfg->writeEntry("autorotate",how);
118 } 116 }
119 if (m_disp) { 117 if (m_disp) {
120 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); 118 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
121 } 119 }
122} 120}
123 121
124void PMainWindow::slotScaleToggled(bool how) 122void PMainWindow::slotScaleToggled(bool how)
125{ 123{
126 if (autoSave) { 124 if (autoSave) {
127 m_cfg->writeEntry("unscaled",how); 125 m_cfg->writeEntry("unscaled",how);
128 } 126 }
129 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; 127 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
130 odebug << "How: " << how << oendl; 128 odebug << "How: " << how << oendl;
131 if (how) { 129 if (how) {
132 m_aAutoRotate->setOn(false); 130 m_aAutoRotate->setOn(false);
133 } 131 }
134 if (m_disp) { 132 if (m_disp) {
135 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); 133 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
136 } 134 }
137 m_aAutoRotate->setEnabled(!how); 135 m_aAutoRotate->setEnabled(!how);
138 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; 136 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
139} 137}
140 138
141void PMainWindow::slotConfig() { 139void PMainWindow::slotConfig() {
142 /* 140 /*
143 * have a tab with the possible views 141 * have a tab with the possible views
144 * a tab for globals image cache size.. scaled loading 142 * a tab for globals image cache size.. scaled loading
145 * and one tab for the KeyConfigs 143 * and one tab for the KeyConfigs
146 */ 144 */
147 QDialog dlg(this, 0, true); 145 QDialog dlg(this, 0, true);
148 dlg.setCaption( tr("Opie Eye - Config" ) ); 146 dlg.setCaption( tr("Opie Eye - Config" ) );
149 147
150 QHBoxLayout *lay = new QHBoxLayout(&dlg); 148 QHBoxLayout *lay = new QHBoxLayout(&dlg);
151 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 149 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
152 lay->addWidget( wid ); 150 lay->addWidget( wid );
153 151
154 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 152 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
155 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 153 wid->addTab(bSetup,"SettingsIcon","Basics setup");
156 154
157 ViewMap *vM = viewMap(); 155 ViewMap *vM = viewMap();
158 ViewMap::Iterator _it = vM->begin(); 156 ViewMap::Iterator _it = vM->begin();
159 QMap<PDirView*, QWidget*> lst; 157 QMap<PDirView*, QWidget*> lst;
160 158
161 for( ; _it != vM->end(); ++_it ) { 159 for( ; _it != vM->end(); ++_it ) {
162 PDirView *view = (_it.data())(*m_cfg); 160 PDirView *view = (_it.data())(*m_cfg);
163 PInterfaceInfo *inf = view->interfaceInfo(); 161 PInterfaceInfo *inf = view->interfaceInfo();
164 QWidget *_wid = inf->configWidget( *m_cfg ); 162 QWidget *_wid = inf->configWidget( *m_cfg );
165 if (!_wid) continue; 163 if (!_wid) continue;
166 _wid->reparent(wid, QPoint() ); 164 _wid->reparent(wid, QPoint() );
167 lst.insert( view, _wid ); 165 lst.insert( view, _wid );
168 wid->addTab( _wid, "fileopen", inf->name() ); 166 wid->addTab( _wid, "fileopen", inf->name() );
169 } 167 }
170 168
171/* 169/*
172 * Add the KeyConfigWidget 170 * Add the KeyConfigWidget
173 */ 171 */
174 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 172 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
175 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 173 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
176 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 174 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
177 QWidget*w = m_stack->visibleWidget(); 175 QWidget*w = m_stack->visibleWidget();
178 176
179 bool reminfo = false; 177 bool reminfo = false;
180 if ( !m_info ) { 178 if ( !m_info ) {
181 reminfo = true; 179 reminfo = true;
182 initInfo(); 180 initInfo();
183 m_info->hide(); 181 m_info->hide();
184 } 182 }
185 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 183 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
186 184
187 bool remdisp = false; 185 bool remdisp = false;
188 if ( !m_disp ) { 186 if ( !m_disp ) {
189 remdisp = true; 187 remdisp = true;
190 initDisp(); 188 initDisp();
191 m_disp->hide(); 189 m_disp->hide();
192 } 190 }
193 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 191 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
194 192
195 keyWid->load(); 193 keyWid->load();
196 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 194 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
197 wid->setCurrentTab(0); 195 wid->setCurrentTab(0);
198 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 196 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
199 197
200/* 198/*
201 * clean up 199 * clean up
202 *apply changes 200 *apply changes
203 */ 201 */
204 202
205 QMap<PDirView*, QWidget*>::Iterator it; 203 QMap<PDirView*, QWidget*>::Iterator it;
206 for ( it = lst.begin(); it != lst.end(); ++it ) { 204 for ( it = lst.begin(); it != lst.end(); ++it ) {
207 if ( act ) 205 if ( act )
208 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 206 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
209 delete it.key(); 207 delete it.key();
210 } 208 }
211 209
212 210
213 if ( act ) { 211 if ( act ) {
214 keyWid->save(); 212 keyWid->save();
215 m_disp->manager()->save(); 213 m_disp->manager()->save();
216 m_info->manager()->save(); 214 m_info->manager()->save();
217 m_view->manager()->save(); 215 m_view->manager()->save();
218 bSetup->save_values(); 216 bSetup->save_values();
219 m_view->resetView(); 217 m_view->resetView();
220 readConfig(); 218 readConfig();
221 } 219 }
222 delete keyWid; 220 delete keyWid;
223 221
224 m_stack->raiseWidget(w); 222 m_stack->raiseWidget(w);
225 if (remdisp) { 223 if (remdisp) {
226 m_disp->hide(); 224 m_disp->hide();
227 } 225 }
228 if (reminfo) { 226 if (reminfo) {
229 m_info->hide(); 227 m_info->hide();
230 } 228 }
231} 229}
232 230
233/* 231/*
234 * create a new image info component 232 * create a new image info component
235 * and detach the current one 233 * and detach the current one
236 * we will make the other delete on exit 234 * we will make the other delete on exit
237 */ 235 */
238template<class T> 236template<class T>
239void PMainWindow::initT( const char* name, T** ptr, int id) { 237void PMainWindow::initT( const char* name, T** ptr, int id) {
240 if ( *ptr ) { 238 if ( *ptr ) {
241 (*ptr)->disconnect(this, SLOT(slotReturn())); 239 (*ptr)->disconnect(this, SLOT(slotReturn()));
242 (*ptr)->setDestructiveClose(); 240 (*ptr)->setDestructiveClose();
243 m_stack->removeWidget( *ptr ); 241 m_stack->removeWidget( *ptr );
244 } 242 }
245 *ptr = new T(m_cfg, m_stack, name ); 243 *ptr = new T(m_cfg, m_stack, name );
246 m_stack->addWidget( *ptr, id ); 244 m_stack->addWidget( *ptr, id );
247 245
248 connect(*ptr, SIGNAL(sig_return()), 246 connect(*ptr, SIGNAL(sig_return()),
249 this,SLOT(slotReturn())); 247 this,SLOT(slotReturn()));
250 248
251} 249}
252 250
253void PMainWindow::initInfo() { 251void PMainWindow::initInfo() {
254 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 252 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
255 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 253 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
256} 254}
257 255
258void PMainWindow::initDisp() { 256void PMainWindow::initDisp() {
259 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 257 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
260 if (m_disp) { 258 if (m_disp) {
261// if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 259// if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
262 //m_disp->setMinimumSize(QApplication::desktop()->size()/2); 260 //m_disp->setMinimumSize(QApplication::desktop()->size()/2);
263// } 261// }
264 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); 262 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
265 m_disp->setAutoScale(!m_aUnscaled->isOn()); 263 m_disp->setAutoScale(!m_aUnscaled->isOn());
266 m_disp->setAutoRotate(m_aAutoRotate->isOn()); 264 m_disp->setAutoRotate(m_aAutoRotate->isOn());
267 m_disp->setShowZoomer(m_aZoomer->isOn()); 265 m_disp->setShowZoomer(m_aZoomer->isOn());
268 m_disp->setBackgroundColor(white); 266 m_disp->setBackgroundColor(white);
269 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 267 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
270 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 268 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
271 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 269 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
272 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 270 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
273 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 271 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
274 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 272 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
275 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 273 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
276 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 274 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
277 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); 275 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
278 slotFullScreenToggled(m_aFullScreen->isOn()); 276 slotFullScreenToggled(m_aFullScreen->isOn());
279 } 277 }
280} 278}
281 279
282void PMainWindow::slotToggleFullScreen() 280void PMainWindow::slotToggleFullScreen()
283{ 281{
284 bool current = !m_aFullScreen->isOn(); 282 bool current = !m_aFullScreen->isOn();
285 m_aFullScreen->setOn(current); 283 m_aFullScreen->setOn(current);
286} 284}
287 285
288void PMainWindow::slotFullScreenButton(bool current) 286void PMainWindow::slotFullScreenButton(bool current)
289{ 287{
290 if (autoSave) { 288 if (autoSave) {
291 m_cfg->writeEntry("fullscreen",current); 289 m_cfg->writeEntry("fullscreen",current);
292 } 290 }
293 if (!m_disp) return; 291 if (!m_disp) return;
294 if (m_disp->isVisible()) { 292 if (m_disp->isVisible()) {
295 setupViewWindow(current, true); 293 setupViewWindow(current, true);
296 } 294 }
297} 295}
298 296
299void PMainWindow::setupViewWindow(bool current, bool forceDisplay) 297void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
300{ 298{
301 if (!m_disp) { 299 if (!m_disp) {
302 return; 300 return;
303 } 301 }
304 if (current) { 302 if (current) {
305 m_disp->setBackgroundColor(black); 303 m_disp->setBackgroundColor(black);
306 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 304 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
307 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 305 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
308 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 306 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
309 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 307 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
310 m_disp->setFullScreen(current,forceDisplay); 308 m_disp->setFullScreen(current,forceDisplay);
311 } else { 309 } else {
312 setUpdatesEnabled(false); 310 setUpdatesEnabled(false);
313#if 0 311#if 0
314 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 312 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
315 313
316 //m_disp->setMinimumSize(QApplication::desktop()->size()/2); 314 //m_disp->setMinimumSize(QApplication::desktop()->size()/2);
317 } else { 315 } else {
318 //m_disp->setMinimumSize(10,10); 316 //m_disp->setMinimumSize(10,10);
319 } 317 }
320#endif 318#endif
321 m_disp->setBackgroundColor(white); 319 m_disp->setBackgroundColor(white);
322 m_stack->addWidget(m_disp,ImageDisplay); 320 m_stack->addWidget(m_disp,ImageDisplay);
323 m_disp->setVScrollBarMode(QScrollView::Auto); 321 m_disp->setVScrollBarMode(QScrollView::Auto);
324 m_disp->setHScrollBarMode(QScrollView::Auto); 322 m_disp->setHScrollBarMode(QScrollView::Auto);
325 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 323 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
326 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); 324 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60);
327 } 325 }
328 if (forceDisplay || m_disp->isVisible()) { 326 if (forceDisplay || m_disp->isVisible()) {
329 m_stack->raiseWidget(m_disp); 327 m_stack->raiseWidget(m_disp);
330 m_disp->setFocus(); 328 m_disp->setFocus();
331 } 329 }
332 setUpdatesEnabled(true); 330 setUpdatesEnabled(true);
333 } 331 }
334 m_disp->setFullScreen(current,forceDisplay); 332 m_disp->setFullScreen(current,forceDisplay);
335} 333}
336 334
337void PMainWindow::slotFullScreenToggled(bool current) 335void PMainWindow::slotFullScreenToggled(bool current)
338{ 336{
339 setupViewWindow(current,true); 337 setupViewWindow(current,true);
340} 338}
341 339
342/** 340/**
343 * With big Screen the plan could be to 'detach' the image 341 * With big Screen the plan could be to 'detach' the image
344 * window if visible and to create a ne wone 342 * window if visible and to create a ne wone
345 * init* already supports it but I make no use of it for 343 * init* already supports it but I make no use of it for
346 * now. We set filename and raise 344 * now. We set filename and raise
347 * 345 *
348 * ### FIXME and talk to alwin 346 * ### FIXME and talk to alwin
349 */ 347 */
350void PMainWindow::slotShowInfo( const QString& inf ) { 348void PMainWindow::slotShowInfo( const QString& inf ) {
351 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 349 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
352 return; 350 return;
353 } 351 }
354 if ( !m_info ) { 352 if ( !m_info ) {
355 initInfo(); 353 initInfo();
356 } 354 }
357 m_info->setPath( inf ); 355 m_info->setPath( inf );
358 if (m_SmallWindow) { 356 if (m_SmallWindow) {
359 m_aNext->removeFrom(toolBar); 357 m_aNext->removeFrom(toolBar);
360 m_aPrevious->removeFrom(toolBar); 358 m_aPrevious->removeFrom(toolBar);
361 fsButton->hide(); 359 fsButton->hide();
362 } 360 }
363 m_aNext->setEnabled(false); 361 m_aNext->setEnabled(false);
364 m_aPrevious->setEnabled(false); 362 m_aPrevious->setEnabled(false);
365 m_aDirUp->setEnabled(false); 363 m_aDirUp->setEnabled(false);
366 m_aShowInfo->setEnabled(false); 364 m_aShowInfo->setEnabled(false);
367 m_aViewfile->setEnabled(true); 365 m_aViewfile->setEnabled(true);
368 m_aStartSlide->setEnabled(false); 366 m_aStartSlide->setEnabled(false);
369 m_stack->raiseWidget( ImageInfo ); 367 m_stack->raiseWidget( ImageInfo );
370} 368}
371 369
372void PMainWindow::slotDisplay( const QString& inf ) { 370void PMainWindow::slotDisplay( const QString& inf ) {
373 bool nwindow = false; 371 bool nwindow = false;
374 if ( !m_disp ) { 372 if ( !m_disp ) {
375 nwindow = true; 373 nwindow = true;
376 initDisp(); 374 initDisp();
377 } 375 }
378 m_disp->setImage( inf ); 376 m_disp->setImage( inf );
379 if (m_SmallWindow) { 377 if (m_SmallWindow) {
380 if (m_gPrevNext->isEnabled()==false) { 378 if (m_gPrevNext->isEnabled()==false) {
381 m_gPrevNext->addTo(toolBar); 379 m_gPrevNext->addTo(toolBar);
382 fsButton->hide(); 380 fsButton->hide();
383 } 381 }
384 } 382 }
385 m_gPrevNext->setEnabled(true); 383 m_gPrevNext->setEnabled(true);
386 m_aDirUp->setEnabled(false); 384 m_aDirUp->setEnabled(false);
387 m_aShowInfo->setEnabled(true); 385 m_aShowInfo->setEnabled(true);
388 m_aViewfile->setEnabled(false); 386 m_aViewfile->setEnabled(false);
389 m_aStartSlide->setEnabled(false); 387 m_aStartSlide->setEnabled(false);
390 388
391 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { 389 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) {
392 slotFullScreenToggled(m_aFullScreen->isOn()); 390 slotFullScreenToggled(m_aFullScreen->isOn());
393 } 391 }
394 if (m_disp->fullScreen()) { 392 if (m_disp->fullScreen()) {
395 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 393 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
396 } else { 394 } else {
397 m_stack->raiseWidget( ImageDisplay ); 395 m_stack->raiseWidget( ImageDisplay );
398 } 396 }
399} 397}
400 398
401void PMainWindow::raiseIconView() { 399void PMainWindow::raiseIconView() {
402 setUpdatesEnabled(false); 400 setUpdatesEnabled(false);
403 if (m_SmallWindow) { 401 if (m_SmallWindow) {
404 m_gPrevNext->removeFrom(toolBar); 402 m_gPrevNext->removeFrom(toolBar);
405 fsButton->show(); 403 fsButton->show();
406 } 404 }
407 m_gPrevNext->setEnabled(false); 405 m_gPrevNext->setEnabled(false);
408 m_aDirUp->setEnabled(true); 406 m_aDirUp->setEnabled(true);
409 m_aShowInfo->setEnabled(true); 407 m_aShowInfo->setEnabled(true);
410 m_aViewfile->setEnabled(true); 408 m_aViewfile->setEnabled(true);
411 m_aStartSlide->setEnabled(true); 409 m_aStartSlide->setEnabled(true);
412 410
413 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 411 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
414 m_disp->stopSlide(); 412 m_disp->stopSlide();
415 m_disp->hide(); 413 m_disp->hide();
416 } 414 }
417 m_stack->raiseWidget( IconView ); 415 m_stack->raiseWidget( IconView );
418 setUpdatesEnabled(true); 416 setUpdatesEnabled(true);
419 repaint(); 417 repaint();
420} 418}
421 419
422void PMainWindow::slotReturn() { 420void PMainWindow::slotReturn() {
423 raiseIconView(); 421 raiseIconView();
424} 422}
425 423
426 424
427void PMainWindow::closeEvent( QCloseEvent* ev ) { 425void PMainWindow::closeEvent( QCloseEvent* ev ) {
428 /* 426 /*
429 * return from view 427 * return from view
430 * or properly quit 428 * or properly quit
431 */ 429 */
432 if (!m_setDocCalled) { 430 if (!m_setDocCalled) {
433 if ( m_stack->visibleWidget() == m_info || 431 if ( m_stack->visibleWidget() == m_info ||
434 m_stack->visibleWidget() == m_disp ) { 432 m_stack->visibleWidget() == m_disp ) {
435 ev->ignore(); 433 ev->ignore();
436 raiseIconView(); 434 raiseIconView();
437 return; 435 return;
438 } 436 }
439 } 437 }
440 if (m_disp && m_disp->fullScreen()) { 438 if (m_disp && m_disp->fullScreen()) {
441 /* otherwise opie-eye crashes in bigscreen mode! */ 439 /* otherwise opie-eye crashes in bigscreen mode! */
442 m_disp->reparent(0,QPoint(0,0)); 440 m_disp->reparent(0,QPoint(0,0));
443 m_stack->addWidget(m_disp,ImageDisplay); 441 m_stack->addWidget(m_disp,ImageDisplay);
444 } 442 }
445 ev->accept(); 443 ev->accept();
446 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 444 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
447} 445}
448 446
449void PMainWindow::setDocument( const QString& showImg ) 447void PMainWindow::setDocument( const QString& showImg )
450{ 448{
451 QString file = showImg; 449 QString file = showImg;
452 DocLnk lnk(showImg); 450 DocLnk lnk(showImg);
453 if (lnk.isValid() ) 451 if (lnk.isValid() )
454 file = lnk.file(); 452 file = lnk.file();
455 slotDisplay( file ); 453 slotDisplay( file );