summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-07 14:14:02 (UTC)
committer alwin <alwin>2004-11-07 14:14:02 (UTC)
commite11d189bfd48ab072da4753240a4ab0bbf81296f (patch) (unidiff)
tree0117c440ff2d95b2d967df8b1c9ccea00e818a65
parentebed03682190e26f1ff7d8fc90e34324114b9c40 (diff)
downloadopie-e11d189bfd48ab072da4753240a4ab0bbf81296f.zip
opie-e11d189bfd48ab072da4753240a4ab0bbf81296f.tar.gz
opie-e11d189bfd48ab072da4753240a4ab0bbf81296f.tar.bz2
when last view state was fullscreen and user tabbed on an image the
imagedisplay was behind the application gui 'cause gui was painted after the imagewindow. So now opie-eye starts a short timer in setDocument when first start checking the visibility of imagewindow.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp18
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h1
2 files changed, 17 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 67eb277..f443ccb 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,696 +1,710 @@
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 Caramba" ) ); 45 setCaption( QObject::tr("Opie Eye Caramba" ) );
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 49
50 m_storage = new StorageInfo(); 50 m_storage = new StorageInfo();
51 connect(m_storage, SIGNAL(disksChanged() ), 51 connect(m_storage, SIGNAL(disksChanged() ),
52 this, SLOT( dirChanged() ) ); 52 this, SLOT( dirChanged() ) );
53 53
54 m_stack = new Opie::Ui::OWidgetStack( this ); 54 m_stack = new Opie::Ui::OWidgetStack( this );
55 setCentralWidget( m_stack ); 55 setCentralWidget( m_stack );
56 56
57 m_view = new PIconView( m_stack, m_cfg ); 57 m_view = new PIconView( m_stack, m_cfg );
58 m_stack->addWidget( m_view, IconView ); 58 m_stack->addWidget( m_view, IconView );
59 m_stack->raiseWidget( IconView ); 59 m_stack->raiseWidget( IconView );
60 60
61 connect(m_view, SIGNAL(sig_display(const QString&)), 61 connect(m_view, SIGNAL(sig_display(const QString&)),
62 this, SLOT(slotDisplay(const QString&))); 62 this, SLOT(slotDisplay(const QString&)));
63 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 63 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
64 this, SLOT(slotShowInfo(const QString&)) ); 64 this, SLOT(slotShowInfo(const QString&)) );
65 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 65 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
66 66
67 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 67 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
68 68
69 listviewMenu = 0; 69 listviewMenu = 0;
70 /* setup menu and toolbar */ 70 /* setup menu and toolbar */
71 setupActions(); 71 setupActions();
72 setupToolbar(); 72 setupToolbar();
73 setupMenu(); 73 setupMenu();
74 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); 74 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
75 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); 75 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
76 odebug << "mainwindow constructor done" << oendl;
76} 77}
77 78
78PMainWindow::~PMainWindow() { 79PMainWindow::~PMainWindow() {
79} 80}
80 81
81void PMainWindow::slotToggleZoomer() 82void PMainWindow::slotToggleZoomer()
82{ 83{
83 m_aZoomer->setOn(!m_aZoomer->isOn()); 84 m_aZoomer->setOn(!m_aZoomer->isOn());
84} 85}
85 86
86void PMainWindow::slotZoomerToggled(bool how) 87void PMainWindow::slotZoomerToggled(bool how)
87{ 88{
88 if (m_disp) { 89 if (m_disp) {
89 m_disp->setShowZoomer(how); 90 m_disp->setShowZoomer(how);
90 } 91 }
91 if (autoSave) { 92 if (autoSave) {
92 m_cfg->writeEntry("zoomeron",how); 93 m_cfg->writeEntry("zoomeron",how);
93 } 94 }
94} 95}
95 96
96void PMainWindow::slotToggleAutorotate() 97void PMainWindow::slotToggleAutorotate()
97{ 98{
98 if (!m_aAutoRotate->isEnabled()) return; 99 if (!m_aAutoRotate->isEnabled()) return;
99 m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); 100 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
100} 101}
101 102
102void PMainWindow::slotToggleAutoscale() 103void PMainWindow::slotToggleAutoscale()
103{ 104{
104 m_aUnscaled->setOn(!m_aUnscaled->isOn()); 105 m_aUnscaled->setOn(!m_aUnscaled->isOn());
105} 106}
106 107
107void PMainWindow::slotRotateToggled(bool how) 108void PMainWindow::slotRotateToggled(bool how)
108{ 109{
109 if (autoSave) { 110 if (autoSave) {
110 m_cfg->writeEntry("autorotate",how); 111 m_cfg->writeEntry("autorotate",how);
111 } 112 }
112 if (m_disp) { 113 if (m_disp) {
113 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); 114 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
114 } 115 }
115} 116}
116 117
117void PMainWindow::slotScaleToggled(bool how) 118void PMainWindow::slotScaleToggled(bool how)
118{ 119{
119 if (autoSave) { 120 if (autoSave) {
120 m_cfg->writeEntry("unscaled",how); 121 m_cfg->writeEntry("unscaled",how);
121 } 122 }
122 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; 123 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
123 odebug << "How: " << how << oendl; 124 odebug << "How: " << how << oendl;
124 if (how) { 125 if (how) {
125 m_aAutoRotate->setOn(false); 126 m_aAutoRotate->setOn(false);
126 } 127 }
127 if (m_disp) { 128 if (m_disp) {
128 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); 129 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
129 } 130 }
130 m_aAutoRotate->setEnabled(!how); 131 m_aAutoRotate->setEnabled(!how);
131 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; 132 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
132} 133}
133 134
134void PMainWindow::slotConfig() { 135void PMainWindow::slotConfig() {
135 /* 136 /*
136 * have a tab with the possible views 137 * have a tab with the possible views
137 * a tab for globals image cache size.. scaled loading 138 * a tab for globals image cache size.. scaled loading
138 * and one tab for the KeyConfigs 139 * and one tab for the KeyConfigs
139 */ 140 */
140 QDialog dlg(this, 0, true); 141 QDialog dlg(this, 0, true);
141 dlg.setCaption( tr("Opie Eye - Config" ) ); 142 dlg.setCaption( tr("Opie Eye - Config" ) );
142 143
143 QHBoxLayout *lay = new QHBoxLayout(&dlg); 144 QHBoxLayout *lay = new QHBoxLayout(&dlg);
144 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 145 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
145 lay->addWidget( wid ); 146 lay->addWidget( wid );
146 147
147 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 148 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
148 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 149 wid->addTab(bSetup,"SettingsIcon","Basics setup");
149 150
150 ViewMap *vM = viewMap(); 151 ViewMap *vM = viewMap();
151 ViewMap::Iterator _it = vM->begin(); 152 ViewMap::Iterator _it = vM->begin();
152 QMap<PDirView*, QWidget*> lst; 153 QMap<PDirView*, QWidget*> lst;
153 154
154 for( ; _it != vM->end(); ++_it ) { 155 for( ; _it != vM->end(); ++_it ) {
155 PDirView *view = (_it.data())(*m_cfg); 156 PDirView *view = (_it.data())(*m_cfg);
156 PInterfaceInfo *inf = view->interfaceInfo(); 157 PInterfaceInfo *inf = view->interfaceInfo();
157 QWidget *_wid = inf->configWidget( *m_cfg ); 158 QWidget *_wid = inf->configWidget( *m_cfg );
158 if (!_wid) continue; 159 if (!_wid) continue;
159 _wid->reparent(wid, QPoint() ); 160 _wid->reparent(wid, QPoint() );
160 lst.insert( view, _wid ); 161 lst.insert( view, _wid );
161 wid->addTab( _wid, "fileopen", inf->name() ); 162 wid->addTab( _wid, "fileopen", inf->name() );
162 } 163 }
163 164
164/* 165/*
165 * Add the KeyConfigWidget 166 * Add the KeyConfigWidget
166 */ 167 */
167 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 168 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
168 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 169 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
169 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 170 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
170 QWidget*w = m_stack->visibleWidget(); 171 QWidget*w = m_stack->visibleWidget();
171 172
172 bool reminfo = false; 173 bool reminfo = false;
173 if ( !m_info ) { 174 if ( !m_info ) {
174 reminfo = true; 175 reminfo = true;
175 initInfo(); 176 initInfo();
176 m_info->hide(); 177 m_info->hide();
177 } 178 }
178 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 179 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
179 180
180 bool remdisp = false; 181 bool remdisp = false;
181 if ( !m_disp ) { 182 if ( !m_disp ) {
182 remdisp = true; 183 remdisp = true;
183 initDisp(); 184 initDisp();
184 m_disp->hide(); 185 m_disp->hide();
185 } 186 }
186 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 187 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
187 188
188 keyWid->load(); 189 keyWid->load();
189 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 190 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
190 wid->setCurrentTab(0); 191 wid->setCurrentTab(0);
191 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 192 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
192 193
193/* 194/*
194 * clean up 195 * clean up
195 *apply changes 196 *apply changes
196 */ 197 */
197 198
198 QMap<PDirView*, QWidget*>::Iterator it; 199 QMap<PDirView*, QWidget*>::Iterator it;
199 for ( it = lst.begin(); it != lst.end(); ++it ) { 200 for ( it = lst.begin(); it != lst.end(); ++it ) {
200 if ( act ) 201 if ( act )
201 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 202 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
202 delete it.key(); 203 delete it.key();
203 } 204 }
204 205
205 206
206 if ( act ) { 207 if ( act ) {
207 keyWid->save(); 208 keyWid->save();
208 m_disp->manager()->save(); 209 m_disp->manager()->save();
209 m_info->manager()->save(); 210 m_info->manager()->save();
210 m_view->manager()->save(); 211 m_view->manager()->save();
211 bSetup->save_values(); 212 bSetup->save_values();
212 m_view->resetView(); 213 m_view->resetView();
213 readConfig(); 214 readConfig();
214 } 215 }
215 delete keyWid; 216 delete keyWid;
216 217
217 m_stack->raiseWidget(w); 218 m_stack->raiseWidget(w);
218 if (remdisp) { 219 if (remdisp) {
219 m_disp->hide(); 220 m_disp->hide();
220 } 221 }
221 if (reminfo) { 222 if (reminfo) {
222 m_info->hide(); 223 m_info->hide();
223 } 224 }
224} 225}
225 226
226/* 227/*
227 * create a new image info component 228 * create a new image info component
228 * and detach the current one 229 * and detach the current one
229 * we will make the other delete on exit 230 * we will make the other delete on exit
230 */ 231 */
231template<class T> 232template<class T>
232void PMainWindow::initT( const char* name, T** ptr, int id) { 233void PMainWindow::initT( const char* name, T** ptr, int id) {
233 if ( *ptr ) { 234 if ( *ptr ) {
234 (*ptr)->disconnect(this, SLOT(slotReturn())); 235 (*ptr)->disconnect(this, SLOT(slotReturn()));
235 (*ptr)->setDestructiveClose(); 236 (*ptr)->setDestructiveClose();
236 m_stack->removeWidget( *ptr ); 237 m_stack->removeWidget( *ptr );
237 } 238 }
238 *ptr = new T(m_cfg, m_stack, name ); 239 *ptr = new T(m_cfg, m_stack, name );
239 m_stack->addWidget( *ptr, id ); 240 m_stack->addWidget( *ptr, id );
240 241
241 connect(*ptr, SIGNAL(sig_return()), 242 connect(*ptr, SIGNAL(sig_return()),
242 this,SLOT(slotReturn())); 243 this,SLOT(slotReturn()));
243 244
244} 245}
245 246
246void PMainWindow::initInfo() { 247void PMainWindow::initInfo() {
247 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 248 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
248 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 249 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
249} 250}
250 251
251void PMainWindow::initDisp() { 252void PMainWindow::initDisp() {
252 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 253 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
253 if (m_disp) { 254 if (m_disp) {
254 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 255 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
255 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 256 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
256 } 257 }
257 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); 258 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
258 m_disp->setAutoScale(!m_aUnscaled->isOn()); 259 m_disp->setAutoScale(!m_aUnscaled->isOn());
259 m_disp->setAutoRotate(m_aAutoRotate->isOn()); 260 m_disp->setAutoRotate(m_aAutoRotate->isOn());
260 m_disp->setShowZoomer(m_aZoomer->isOn()); 261 m_disp->setShowZoomer(m_aZoomer->isOn());
261 m_disp->setBackgroundColor(white); 262 m_disp->setBackgroundColor(white);
262 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 263 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
263 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 264 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
264 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 265 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
265 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 266 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
266 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 267 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
267 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 268 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
268 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 269 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
269 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 270 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
270 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); 271 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
271 slotFullScreenToggled(m_aFullScreen->isOn()); 272 slotFullScreenToggled(m_aFullScreen->isOn());
272 } 273 }
273} 274}
274 275
275void PMainWindow::slotToggleFullScreen() 276void PMainWindow::slotToggleFullScreen()
276{ 277{
277 bool current = !m_aFullScreen->isOn(); 278 bool current = !m_aFullScreen->isOn();
278 m_aFullScreen->setOn(current); 279 m_aFullScreen->setOn(current);
279} 280}
280 281
281void PMainWindow::slotFullScreenButton(bool current) 282void PMainWindow::slotFullScreenButton(bool current)
282{ 283{
283 if (autoSave) { 284 if (autoSave) {
284 m_cfg->writeEntry("fullscreen",current); 285 m_cfg->writeEntry("fullscreen",current);
285 } 286 }
286 if (!m_disp) return; 287 if (!m_disp) return;
287 if (m_disp->isVisible()) { 288 if (m_disp->isVisible()) {
288 setupViewWindow(current, true); 289 setupViewWindow(current, true);
289 } 290 }
290} 291}
291 292
292void PMainWindow::setupViewWindow(bool current, bool forceDisplay) 293void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
293{ 294{
294 if (!m_disp) return; 295 if (!m_disp) return;
295 if (current) { 296 if (current) {
296 m_disp->setBackgroundColor(black); 297 m_disp->setBackgroundColor(black);
297 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 298 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
298 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 299 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
299 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 300 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
300 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 301 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
301 } else { 302 } else {
302 setUpdatesEnabled(false); 303 setUpdatesEnabled(false);
303 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 304 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
304 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 305 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
305 } else { 306 } else {
306 m_disp->setMinimumSize(10,10); 307 m_disp->setMinimumSize(10,10);
307 } 308 }
308 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 309 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
309 m_disp->reparent(0,QPoint(50,50)); 310 m_disp->reparent(0,QPoint(50,50));
310 } else { 311 } else {
311 m_disp->reparent(0,QPoint(0,0)); 312 m_disp->reparent(0,QPoint(0,0));
312 } 313 }
313 m_disp->setBackgroundColor(white); 314 m_disp->setBackgroundColor(white);
314 m_stack->addWidget(m_disp,ImageDisplay); 315 m_stack->addWidget(m_disp,ImageDisplay);
315 m_disp->setVScrollBarMode(QScrollView::Auto); 316 m_disp->setVScrollBarMode(QScrollView::Auto);
316 m_disp->setHScrollBarMode(QScrollView::Auto); 317 m_disp->setHScrollBarMode(QScrollView::Auto);
317 if (forceDisplay || m_disp->isVisible()) 318 if (forceDisplay || m_disp->isVisible())
318 m_stack->raiseWidget(m_disp); 319 m_stack->raiseWidget(m_disp);
319 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 320 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
320 m_disp->resize(m_disp->minimumSize()); 321 m_disp->resize(m_disp->minimumSize());
321 } 322 }
322 setUpdatesEnabled(true); 323 setUpdatesEnabled(true);
323 } 324 }
324 m_disp->setFullScreen(current,forceDisplay); 325 m_disp->setFullScreen(current,forceDisplay);
325} 326}
326 327
327void PMainWindow::slotFullScreenToggled(bool current) 328void PMainWindow::slotFullScreenToggled(bool current)
328{ 329{
329 setupViewWindow(current,true); 330 setupViewWindow(current,true);
330} 331}
331 332
332/** 333/**
333 * With big Screen the plan could be to 'detach' the image 334 * With big Screen the plan could be to 'detach' the image
334 * window if visible and to create a ne wone 335 * window if visible and to create a ne wone
335 * init* already supports it but I make no use of it for 336 * init* already supports it but I make no use of it for
336 * now. We set filename and raise 337 * now. We set filename and raise
337 * 338 *
338 * ### FIXME and talk to alwin 339 * ### FIXME and talk to alwin
339 */ 340 */
340void PMainWindow::slotShowInfo( const QString& inf ) { 341void PMainWindow::slotShowInfo( const QString& inf ) {
341 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 342 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
342 return; 343 return;
343 } 344 }
344 if ( !m_info ) { 345 if ( !m_info ) {
345 initInfo(); 346 initInfo();
346 } 347 }
347 m_info->setPath( inf ); 348 m_info->setPath( inf );
348 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 349 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
349 m_aNext->removeFrom(toolBar); 350 m_aNext->removeFrom(toolBar);
350 m_aPrevious->removeFrom(toolBar); 351 m_aPrevious->removeFrom(toolBar);
351 m_aNext->setEnabled(false); 352 m_aNext->setEnabled(false);
352 m_aPrevious->setEnabled(false); 353 m_aPrevious->setEnabled(false);
353 m_aDirUp->setEnabled(false); 354 m_aDirUp->setEnabled(false);
354 m_aShowInfo->setEnabled(false); 355 m_aShowInfo->setEnabled(false);
355 m_aViewfile->setEnabled(true); 356 m_aViewfile->setEnabled(true);
356 m_aStartSlide->setEnabled(false); 357 m_aStartSlide->setEnabled(false);
357 fsButton->hide(); 358 fsButton->hide();
358 } 359 }
359 m_stack->raiseWidget( ImageInfo ); 360 m_stack->raiseWidget( ImageInfo );
360} 361}
361 362
362void PMainWindow::slotDisplay( const QString& inf ) { 363void PMainWindow::slotDisplay( const QString& inf ) {
363 bool nwindow = false; 364 bool nwindow = false;
364 if ( !m_disp ) { 365 if ( !m_disp ) {
365 nwindow = true; 366 nwindow = true;
366 initDisp(); 367 initDisp();
367 } 368 }
368 m_disp->setImage( inf ); 369 m_disp->setImage( inf );
369 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 370 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
370 if (m_gPrevNext->isEnabled()==false) { 371 if (m_gPrevNext->isEnabled()==false) {
371 m_gPrevNext->addTo(toolBar); 372 m_gPrevNext->addTo(toolBar);
372 m_gPrevNext->setEnabled(true); 373 m_gPrevNext->setEnabled(true);
373 374
374 m_aDirUp->setEnabled(false); 375 m_aDirUp->setEnabled(false);
375 m_aShowInfo->setEnabled(true); 376 m_aShowInfo->setEnabled(true);
376 m_aViewfile->setEnabled(false); 377 m_aViewfile->setEnabled(false);
377 m_aStartSlide->setEnabled(false); 378 m_aStartSlide->setEnabled(false);
378 fsButton->hide(); 379 fsButton->hide();
379 } 380 }
380 } 381 }
381 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { 382 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) {
382 slotFullScreenToggled(m_aFullScreen->isOn()); 383 slotFullScreenToggled(m_aFullScreen->isOn());
383 } 384 }
384 if (m_disp->fullScreen()) { 385 if (m_disp->fullScreen()) {
385 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 386 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
386 } else { 387 } else {
387 m_stack->raiseWidget( ImageDisplay ); 388 m_stack->raiseWidget( ImageDisplay );
388 } 389 }
389} 390}
390 391
391void PMainWindow::raiseIconView() { 392void PMainWindow::raiseIconView() {
392 setUpdatesEnabled(false); 393 setUpdatesEnabled(false);
393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 394 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
394 m_gPrevNext->removeFrom(toolBar); 395 m_gPrevNext->removeFrom(toolBar);
395 m_gPrevNext->setEnabled(false); 396 m_gPrevNext->setEnabled(false);
396 m_aDirUp->setEnabled(true); 397 m_aDirUp->setEnabled(true);
397 m_aShowInfo->setEnabled(true); 398 m_aShowInfo->setEnabled(true);
398 m_aViewfile->setEnabled(true); 399 m_aViewfile->setEnabled(true);
399 m_aStartSlide->setEnabled(true); 400 m_aStartSlide->setEnabled(true);
400 fsButton->show(); 401 fsButton->show();
401 } 402 }
402 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 403 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
403 m_disp->stopSlide(); 404 m_disp->stopSlide();
404 m_disp->hide(); 405 m_disp->hide();
405 } 406 }
406 m_stack->raiseWidget( IconView ); 407 m_stack->raiseWidget( IconView );
407 setUpdatesEnabled(true); 408 setUpdatesEnabled(true);
408 repaint(); 409 repaint();
409} 410}
410 411
411void PMainWindow::slotReturn() { 412void PMainWindow::slotReturn() {
412 raiseIconView(); 413 raiseIconView();
413} 414}
414 415
415 416
416void PMainWindow::closeEvent( QCloseEvent* ev ) { 417void PMainWindow::closeEvent( QCloseEvent* ev ) {
417 /* 418 /*
418 * return from view 419 * return from view
419 * or properly quit 420 * or properly quit
420 */ 421 */
421 if ( m_stack->visibleWidget() == m_info || 422 if ( m_stack->visibleWidget() == m_info ||
422 m_stack->visibleWidget() == m_disp ) { 423 m_stack->visibleWidget() == m_disp ) {
423 ev->ignore(); 424 ev->ignore();
424 raiseIconView(); 425 raiseIconView();
425 return; 426 return;
426 } 427 }
427 if (m_disp && m_disp->fullScreen()) { 428 if (m_disp && m_disp->fullScreen()) {
428 /* otherwise opie-eye crashes in bigscreen mode! */ 429 /* otherwise opie-eye crashes in bigscreen mode! */
429 m_disp->reparent(0,QPoint(0,0)); 430 m_disp->reparent(0,QPoint(0,0));
430 m_stack->addWidget(m_disp,ImageDisplay); 431 m_stack->addWidget(m_disp,ImageDisplay);
431 } 432 }
432 ev->accept(); 433 ev->accept();
433 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 434 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
434} 435}
435 436
436void PMainWindow::setDocument( const QString& showImg ) { 437void PMainWindow::setDocument( const QString& showImg )
438{
439 bool first_start = m_disp==0;
440
437 QString file = showImg; 441 QString file = showImg;
438 DocLnk lnk(showImg); 442 DocLnk lnk(showImg);
439 if (lnk.isValid() ) 443 if (lnk.isValid() )
440 file = lnk.file(); 444 file = lnk.file();
441
442 slotDisplay( file ); 445 slotDisplay( file );
446 if (first_start && m_aFullScreen->isOn()) {
447 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
448 }
449}
450
451void PMainWindow::check_view_fullscreen()
452{
453 if (!m_view) return;
454 if (!m_view->hasFocus()&&m_aFullScreen->isOn()) {
455 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
456 }
443} 457}
444 458
445void PMainWindow::slotSelectDir(int id) 459void PMainWindow::slotSelectDir(int id)
446{ 460{
447 emit changeDir( m_dev[fsMenu->text(id )] ); 461 emit changeDir( m_dev[fsMenu->text(id )] );
448} 462}
449 463
450void PMainWindow::dirChanged() 464void PMainWindow::dirChanged()
451{ 465{
452 fsMenu->clear(); 466 fsMenu->clear();
453 m_dev.clear(); 467 m_dev.clear();
454 468
455 /* home dir, too */ 469 /* home dir, too */
456 QString f = getenv( "HOME" ); 470 QString f = getenv( "HOME" );
457 if (!f.isEmpty()) { 471 if (!f.isEmpty()) {
458 m_dev.insert("Home directory",f); 472 m_dev.insert("Home directory",f);
459 fsMenu->insertItem("Home directory"); 473 fsMenu->insertItem("Home directory");
460 } 474 }
461 const QList<FileSystem> &fs = m_storage->fileSystems(); 475 const QList<FileSystem> &fs = m_storage->fileSystems();
462 QListIterator<FileSystem> it(fs ); 476 QListIterator<FileSystem> it(fs );
463 for ( ; it.current(); ++it ) { 477 for ( ; it.current(); ++it ) {
464 const QString disk = (*it)->name(); 478 const QString disk = (*it)->name();
465 const QString path = (*it)->path(); 479 const QString path = (*it)->path();
466 m_dev.insert( disk, path ); 480 m_dev.insert( disk, path );
467 fsMenu->insertItem( disk ); 481 fsMenu->insertItem( disk );
468 } 482 }
469} 483}
470 484
471void PMainWindow::showToolbar(bool how) 485void PMainWindow::showToolbar(bool how)
472{ 486{
473 if (!how) toolBar->hide(); 487 if (!how) toolBar->hide();
474 else toolBar->show(); 488 else toolBar->show();
475 if (autoSave) { 489 if (autoSave) {
476 m_cfg->writeEntry("showtoolbar",how); 490 m_cfg->writeEntry("showtoolbar",how);
477 } 491 }
478} 492}
479 493
480void PMainWindow::setupActions() 494void PMainWindow::setupActions()
481{ 495{
482 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); 496 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
483 m_aDirUp->setToggleAction(false); 497 m_aDirUp->setToggleAction(false);
484 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); 498 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
485 499
486 if ( Ir::supported() ) { 500 if ( Ir::supported() ) {
487 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); 501 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
488 m_aBeam->setToggleAction(false); 502 m_aBeam->setToggleAction(false);
489 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); 503 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
490 } else { 504 } else {
491 m_aBeam = 0; 505 m_aBeam = 0;
492 } 506 }
493 507
494 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); 508 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
495 m_aShowInfo->setToggleAction(false); 509 m_aShowInfo->setToggleAction(false);
496 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); 510 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
497 511
498 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); 512 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
499 m_aTrash->setToggleAction(false); 513 m_aTrash->setToggleAction(false);
500 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); 514 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
501 515
502 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); 516 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
503 m_aViewfile->setToggleAction(false); 517 m_aViewfile->setToggleAction(false);
504 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); 518 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
505 519
506 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); 520 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
507 m_aStartSlide->setToggleAction(false); 521 m_aStartSlide->setToggleAction(false);
508 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); 522 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
509 523
510 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); 524 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
511 m_aHideToolbar->setOn (true); 525 m_aHideToolbar->setOn (true);
512 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); 526 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
513 527
514 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); 528 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
515 m_aSetup->setToggleAction(false); 529 m_aSetup->setToggleAction(false);
516 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); 530 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
517 531
518 m_gListViewMode = new QActionGroup(this,"Select listmode",true); 532 m_gListViewMode = new QActionGroup(this,"Select listmode",true);
519 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); 533 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
520 534
521 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); 535 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
522 m_aDirLong->setToggleAction(true); 536 m_aDirLong->setToggleAction(true);
523 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); 537 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
524 m_aDirShort->setToggleAction(true); 538 m_aDirShort->setToggleAction(true);
525 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); 539 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
526 m_aDirName->setToggleAction(true); 540 m_aDirName->setToggleAction(true);
527 int mode = m_cfg->readNumEntry("ListViewMode", 1); 541 int mode = m_cfg->readNumEntry("ListViewMode", 1);
528 if (mode < 1 || mode>3) mode = 1; 542 if (mode < 1 || mode>3) mode = 1;
529 switch (mode) { 543 switch (mode) {
530 case 3: 544 case 3:
531 m_aDirName->setOn(true); 545 m_aDirName->setOn(true);
532 break; 546 break;
533 case 2: 547 case 2:
534 m_aDirShort->setOn(true); 548 m_aDirShort->setOn(true);
535 break; 549 break;
536 case 1: 550 case 1:
537 default: 551 default:
538 m_aDirLong->setOn(true); 552 m_aDirLong->setOn(true);
539 } 553 }
540 m_gListViewMode->insert(m_aDirLong); 554 m_gListViewMode->insert(m_aDirLong);
541 m_gListViewMode->insert(m_aDirShort); 555 m_gListViewMode->insert(m_aDirShort);
542 m_gListViewMode->insert(m_aDirName); 556 m_gListViewMode->insert(m_aDirName);
543 557
544 m_gPrevNext = new QActionGroup(this,"imageprevnext",false); 558 m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
545 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); 559 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
546 m_aNext->setToggleAction(false); 560 m_aNext->setToggleAction(false);
547 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); 561 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
548 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); 562 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
549 m_aPrevious->setToggleAction(false); 563 m_aPrevious->setToggleAction(false);
550 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); 564 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
551 m_gPrevNext->insert(m_aPrevious); 565 m_gPrevNext->insert(m_aPrevious);
552 m_gPrevNext->insert(m_aNext); 566 m_gPrevNext->insert(m_aNext);
553 567
554 m_aFullScreen = new QAction( tr( "Show images fullscreen" ), 568 m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
555 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); 569 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
556 m_aFullScreen->setToggleAction(true); 570 m_aFullScreen->setToggleAction(true);
557 if (autoSave) { 571 if (autoSave) {
558 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false)); 572 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false));
559 } else { 573 } else {
560 m_aFullScreen->setOn(false); 574 m_aFullScreen->setOn(false);
561 } 575 }
562 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool))); 576 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
563 577
564 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); 578 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
565 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); 579 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
566 m_aAutoRotate->setToggleAction(true); 580 m_aAutoRotate->setToggleAction(true);
567 581
568 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 582 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
569 m_aAutoRotate->setOn(true); 583 m_aAutoRotate->setOn(true);
570 } else { 584 } else {
571 m_aAutoRotate->setOn(false); 585 m_aAutoRotate->setOn(false);
572 } 586 }
573 if (autoSave) { 587 if (autoSave) {
574 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); 588 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn()));
575 } 589 }
576 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 590 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
577 591
578 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); 592 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
579 m_aUnscaled->setToggleAction(true); 593 m_aUnscaled->setToggleAction(true);
580 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 594 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
581 if (autoSave) { 595 if (autoSave) {
582 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); 596 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false));
583 } else { 597 } else {
584 m_aUnscaled->setOn(false); 598 m_aUnscaled->setOn(false);
585 } 599 }
586 600
587 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); 601 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
588 m_aZoomer->setToggleAction(true); 602 m_aZoomer->setToggleAction(true);
589 if (autoSave) { 603 if (autoSave) {
590 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); 604 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true));
591 } else { 605 } else {
592 m_aZoomer->setOn (true); 606 m_aZoomer->setOn (true);
593 } 607 }
594 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 608 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
595 m_gDisplayType->insert(m_aAutoRotate); 609 m_gDisplayType->insert(m_aAutoRotate);
596 m_gDisplayType->insert(m_aUnscaled); 610 m_gDisplayType->insert(m_aUnscaled);
597 m_gDisplayType->insert(m_aZoomer); 611 m_gDisplayType->insert(m_aZoomer);
598 612
599 m_hGroup = new QActionGroup(this,"actioncollection",false); 613 m_hGroup = new QActionGroup(this,"actioncollection",false);
600 m_hGroup->insert(m_aFullScreen); 614 m_hGroup->insert(m_aFullScreen);
601} 615}
602 616
603void PMainWindow::setupToolbar() 617void PMainWindow::setupToolbar()
604{ 618{
605 toolBar = new QToolBar( this ); 619 toolBar = new QToolBar( this );
606 addToolBar(toolBar); 620 addToolBar(toolBar);
607 toolBar->setHorizontalStretchable( true ); 621 toolBar->setHorizontalStretchable( true );
608 setToolBarsMovable( false ); 622 setToolBarsMovable( false );
609 m_aDirUp->addTo( toolBar ); 623 m_aDirUp->addTo( toolBar );
610 624
611 fsButton = new PFileSystem( toolBar ); 625 fsButton = new PFileSystem( toolBar );
612 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 626 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
613 m_view, SLOT(slotChangeDir( const QString& ) ) ); 627 m_view, SLOT(slotChangeDir( const QString& ) ) );
614 connect( this, SIGNAL( changeDir( const QString& ) ), 628 connect( this, SIGNAL( changeDir( const QString& ) ),
615 m_view, SLOT(slotChangeDir( const QString& ) ) ); 629 m_view, SLOT(slotChangeDir( const QString& ) ) );
616 630
617 if (m_aBeam) { 631 if (m_aBeam) {
618 m_aBeam->addTo( toolBar ); 632 m_aBeam->addTo( toolBar );
619 } 633 }
620 m_aShowInfo->addTo(toolBar); 634 m_aShowInfo->addTo(toolBar);
621 m_aTrash->addTo(toolBar); 635 m_aTrash->addTo(toolBar);
622// m_aSetup->addTo(toolBar); 636// m_aSetup->addTo(toolBar);
623 637
624 m_gDisplayType->addTo(toolBar); 638 m_gDisplayType->addTo(toolBar);
625 639
626 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 640 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
627 m_gPrevNext->addTo(toolBar); 641 m_gPrevNext->addTo(toolBar);
628 } else { 642 } else {
629 m_gPrevNext->setEnabled(false); 643 m_gPrevNext->setEnabled(false);
630 } 644 }
631} 645}
632 646
633void PMainWindow::setupMenu() 647void PMainWindow::setupMenu()
634{ 648{
635 fileMenu = new QPopupMenu( menuBar() ); 649 fileMenu = new QPopupMenu( menuBar() );
636 menuBar()->insertItem( tr( "File" ), fileMenu ); 650 menuBar()->insertItem( tr( "File" ), fileMenu );
637 dispMenu = new QPopupMenu( menuBar() ); 651 dispMenu = new QPopupMenu( menuBar() );
638 menuBar()->insertItem( tr( "Show" ), dispMenu ); 652 menuBar()->insertItem( tr( "Show" ), dispMenu );
639 settingsMenu = new QPopupMenu( menuBar() ); 653 settingsMenu = new QPopupMenu( menuBar() );
640 menuBar()->insertItem( tr( "Settings" ), settingsMenu ); 654 menuBar()->insertItem( tr( "Settings" ), settingsMenu );
641 655
642 m_aViewfile->addTo(fileMenu); 656 m_aViewfile->addTo(fileMenu);
643 m_aShowInfo->addTo(fileMenu); 657 m_aShowInfo->addTo(fileMenu);
644 m_aStartSlide->addTo(fileMenu); 658 m_aStartSlide->addTo(fileMenu);
645 659
646 fileMenu->insertSeparator(); 660 fileMenu->insertSeparator();
647 m_aDirUp->addTo( fileMenu ); 661 m_aDirUp->addTo( fileMenu );
648 662
649 fsMenu = new QPopupMenu(fileMenu); 663 fsMenu = new QPopupMenu(fileMenu);
650 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); 664 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
651 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); 665 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
652 dirChanged(); 666 dirChanged();
653 667
654 if ( m_aBeam ) { 668 if ( m_aBeam ) {
655 fileMenu->insertSeparator(); 669 fileMenu->insertSeparator();
656 m_aBeam->addTo( fileMenu ); 670 m_aBeam->addTo( fileMenu );
657 } 671 }
658 fileMenu->insertSeparator(); 672 fileMenu->insertSeparator();
659 m_aTrash->addTo(fileMenu); 673 m_aTrash->addTo(fileMenu);
660 674
661 listviewMenu = new QPopupMenu(dispMenu); 675 listviewMenu = new QPopupMenu(dispMenu);
662 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); 676 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
663 m_gListViewMode->addTo(listviewMenu); 677 m_gListViewMode->addTo(listviewMenu);
664 dispMenu->insertSeparator(); 678 dispMenu->insertSeparator();
665 m_aFullScreen->addTo(dispMenu); 679 m_aFullScreen->addTo(dispMenu);
666 m_gDisplayType->addTo(dispMenu); 680 m_gDisplayType->addTo(dispMenu);
667 dispMenu->insertSeparator(); 681 dispMenu->insertSeparator();
668 m_gPrevNext->addTo(dispMenu); 682 m_gPrevNext->addTo(dispMenu);
669 683
670 m_aSetup->addTo(settingsMenu); 684 m_aSetup->addTo(settingsMenu);
671 m_aHideToolbar->addTo(settingsMenu); 685 m_aHideToolbar->addTo(settingsMenu);
672} 686}
673 687
674void PMainWindow::listviewselected(QAction*which) 688void PMainWindow::listviewselected(QAction*which)
675{ 689{
676 if (!which || which->isOn()==false) return; 690 if (!which || which->isOn()==false) return;
677 int val = 1; 691 int val = 1;
678// QString name; 692// QString name;
679 693
680 if (which==m_aDirName) { 694 if (which==m_aDirName) {
681 val = 3; 695 val = 3;
682// name = "opie-eye/opie-eye-textview"; 696// name = "opie-eye/opie-eye-textview";
683 } else if (which==m_aDirShort) { 697 } else if (which==m_aDirShort) {
684 val = 2; 698 val = 2;
685// name = "opie-eye/opie-eye-thumbonly"; 699// name = "opie-eye/opie-eye-thumbonly";
686 } else if (which==m_aDirLong) { 700 } else if (which==m_aDirLong) {
687 val = 1; 701 val = 1;
688// name = "opie-eye/opie-eye-thumb"; 702// name = "opie-eye/opie-eye-thumb";
689 } 703 }
690 emit changeListMode(val); 704 emit changeListMode(val);
691} 705}
692 706
693void PMainWindow::readConfig() 707void PMainWindow::readConfig()
694{ 708{
695 autoSave =m_cfg->readBoolEntry("savestatus",true); 709 autoSave =m_cfg->readBoolEntry("savestatus",true);
696} 710}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 5707568..465e352 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -1,106 +1,107 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_MAIN_WINDOW_H 6#ifndef PHUNK_MAIN_WINDOW_H
7#define PHUNK_MAIN_WINDOW_H 7#define PHUNK_MAIN_WINDOW_H
8 8
9#include <opie2/oconfig.h> 9#include <opie2/oconfig.h>
10 10
11#include <qmainwindow.h> 11#include <qmainwindow.h>
12 12
13 13
14 14
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 ImageWidget; 25class ImageWidget;
26class PIconView; 26class PIconView;
27class imageinfo; 27class imageinfo;
28class QMenuBar; 28class QMenuBar;
29class QToolBar; 29class QToolBar;
30class QPopupMenu; 30class QPopupMenu;
31class QAction; 31class QAction;
32class QActionGroup; 32class QActionGroup;
33class StorageInfo; 33class StorageInfo;
34 34
35class PMainWindow : public QMainWindow { 35class PMainWindow : public QMainWindow {
36 Q_OBJECT 36 Q_OBJECT
37 enum Views { IconView, ImageInfo, ImageDisplay }; 37 enum Views { IconView, ImageInfo, ImageDisplay };
38public: 38public:
39 static QString appName() { return QString::fromLatin1("opie-eye" ); } 39 static QString appName() { return QString::fromLatin1("opie-eye" ); }
40 PMainWindow(QWidget*, const char*, WFlags ); 40 PMainWindow(QWidget*, const char*, WFlags );
41 ~PMainWindow(); 41 ~PMainWindow();
42 42
43signals: 43signals:
44 void configChanged(); 44 void configChanged();
45 void changeDir( const QString& ); 45 void changeDir( const QString& );
46 void changeListMode(int); 46 void changeListMode(int);
47 47
48public slots: 48public slots:
49 void slotShowInfo( const QString& inf ); 49 void slotShowInfo( const QString& inf );
50 void slotDisplay( const QString& inf ); 50 void slotDisplay( const QString& inf );
51 void slotReturn(); 51 void slotReturn();
52 void slotRotateToggled(bool); 52 void slotRotateToggled(bool);
53 void slotScaleToggled(bool); 53 void slotScaleToggled(bool);
54 void slotZoomerToggled(bool); 54 void slotZoomerToggled(bool);
55 void slotToggleZoomer(); 55 void slotToggleZoomer();
56 void slotToggleAutorotate(); 56 void slotToggleAutorotate();
57 void slotToggleAutoscale(); 57 void slotToggleAutoscale();
58 void setDocument( const QString& ); 58 void setDocument( const QString& );
59 virtual void slotToggleFullScreen(); 59 virtual void slotToggleFullScreen();
60 virtual void slotFullScreenToggled(bool); 60 virtual void slotFullScreenToggled(bool);
61 61
62protected slots: 62protected slots:
63 void raiseIconView(); 63 void raiseIconView();
64 void closeEvent( QCloseEvent* ); 64 void closeEvent( QCloseEvent* );
65 void showToolbar(bool); 65 void showToolbar(bool);
66 void listviewselected(QAction*); 66 void listviewselected(QAction*);
67 void slotFullScreenButton(bool); 67 void slotFullScreenButton(bool);
68 void check_view_fullscreen();
68 69
69private: 70private:
70 template<class T> void initT( const char* name, T**, int ); 71 template<class T> void initT( const char* name, T**, int );
71 void initInfo(); 72 void initInfo();
72 void initDisp(); 73 void initDisp();
73 void setupViewWindow(bool full, bool forceDisplay); 74 void setupViewWindow(bool full, bool forceDisplay);
74 75
75private: 76private:
76 Opie::Core::OConfig *m_cfg; 77 Opie::Core::OConfig *m_cfg;
77 Opie::Ui::OWidgetStack *m_stack; 78 Opie::Ui::OWidgetStack *m_stack;
78 PIconView* m_view; 79 PIconView* m_view;
79 imageinfo *m_info; 80 imageinfo *m_info;
80 ImageView *m_disp; 81 ImageView *m_disp;
81 bool autoSave; 82 bool autoSave;
82 QToolButton*fsButton; 83 QToolButton*fsButton;
83 QToolBar *toolBar; 84 QToolBar *toolBar;
84 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; 85 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu;
85 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; 86 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide;
86 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; 87 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong;
87 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; 88 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup;
88 QAction *m_aNext,*m_aPrevious,*m_aFullScreen; 89 QAction *m_aNext,*m_aPrevious,*m_aFullScreen;
89 QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; 90 QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer;
90 91
91 /* init funs */ 92 /* init funs */
92 void readConfig(); 93 void readConfig();
93 void setupActions(); 94 void setupActions();
94 void setupToolbar(); 95 void setupToolbar();
95 void setupMenu(); 96 void setupMenu();
96 /* for the device submenu - ToDo: Merge with the special button */ 97 /* for the device submenu - ToDo: Merge with the special button */
97 StorageInfo *m_storage; 98 StorageInfo *m_storage;
98 QMap<QString, QString> m_dev; 99 QMap<QString, QString> m_dev;
99 100
100private slots: 101private slots:
101 void slotConfig(); 102 void slotConfig();
102 void slotSelectDir(int); 103 void slotSelectDir(int);
103 void dirChanged(); 104 void dirChanged();
104}; 105};
105 106
106#endif 107#endif