author | alwin <alwin> | 2004-11-07 14:14:02 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-07 14:14:02 (UTC) |
commit | e11d189bfd48ab072da4753240a4ab0bbf81296f (patch) (unidiff) | |
tree | 0117c440ff2d95b2d967df8b1c9ccea00e818a65 | |
parent | ebed03682190e26f1ff7d8fc90e34324114b9c40 (diff) | |
download | opie-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.
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 18 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 1 |
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,171 +1,172 @@ | |||
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" ) |
40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
41 | 41 | ||
42 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 42 | PMainWindow::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 | ||
78 | PMainWindow::~PMainWindow() { | 79 | PMainWindow::~PMainWindow() { |
79 | } | 80 | } |
80 | 81 | ||
81 | void PMainWindow::slotToggleZoomer() | 82 | void PMainWindow::slotToggleZoomer() |
82 | { | 83 | { |
83 | m_aZoomer->setOn(!m_aZoomer->isOn()); | 84 | m_aZoomer->setOn(!m_aZoomer->isOn()); |
84 | } | 85 | } |
85 | 86 | ||
86 | void PMainWindow::slotZoomerToggled(bool how) | 87 | void 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 | ||
96 | void PMainWindow::slotToggleAutorotate() | 97 | void 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 | ||
102 | void PMainWindow::slotToggleAutoscale() | 103 | void PMainWindow::slotToggleAutoscale() |
103 | { | 104 | { |
104 | m_aUnscaled->setOn(!m_aUnscaled->isOn()); | 105 | m_aUnscaled->setOn(!m_aUnscaled->isOn()); |
105 | } | 106 | } |
106 | 107 | ||
107 | void PMainWindow::slotRotateToggled(bool how) | 108 | void 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 | ||
117 | void PMainWindow::slotScaleToggled(bool how) | 118 | void 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 | ||
134 | void PMainWindow::slotConfig() { | 135 | void 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 | ||
@@ -340,199 +341,212 @@ void PMainWindow::slotFullScreenToggled(bool current) | |||
340 | void PMainWindow::slotShowInfo( const QString& inf ) { | 341 | void 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 | ||
362 | void PMainWindow::slotDisplay( const QString& inf ) { | 363 | void 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 | ||
391 | void PMainWindow::raiseIconView() { | 392 | void 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 | ||
411 | void PMainWindow::slotReturn() { | 412 | void PMainWindow::slotReturn() { |
412 | raiseIconView(); | 413 | raiseIconView(); |
413 | } | 414 | } |
414 | 415 | ||
415 | 416 | ||
416 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 417 | void 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 | ||
436 | void PMainWindow::setDocument( const QString& showImg ) { | 437 | void 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 | |||
451 | void 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 | ||
445 | void PMainWindow::slotSelectDir(int id) | 459 | void 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 | ||
450 | void PMainWindow::dirChanged() | 464 | void 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 | ||
471 | void PMainWindow::showToolbar(bool how) | 485 | void 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 | ||
480 | void PMainWindow::setupActions() | 494 | void 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); |
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 | ||
15 | namespace Opie { | 15 | namespace Opie { |
16 | namespace Ui{ | 16 | namespace Ui{ |
17 | class OWidgetStack; | 17 | class OWidgetStack; |
18 | } | 18 | } |
19 | namespace Core{ | 19 | namespace Core{ |
20 | class OKeyConfigManager; | 20 | class OKeyConfigManager; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | class ImageView; | 24 | class ImageView; |
25 | class ImageWidget; | 25 | class ImageWidget; |
26 | class PIconView; | 26 | class PIconView; |
27 | class imageinfo; | 27 | class imageinfo; |
28 | class QMenuBar; | 28 | class QMenuBar; |
29 | class QToolBar; | 29 | class QToolBar; |
30 | class QPopupMenu; | 30 | class QPopupMenu; |
31 | class QAction; | 31 | class QAction; |
32 | class QActionGroup; | 32 | class QActionGroup; |
33 | class StorageInfo; | 33 | class StorageInfo; |
34 | 34 | ||
35 | class PMainWindow : public QMainWindow { | 35 | class PMainWindow : public QMainWindow { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | enum Views { IconView, ImageInfo, ImageDisplay }; | 37 | enum Views { IconView, ImageInfo, ImageDisplay }; |
38 | public: | 38 | public: |
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 | ||
43 | signals: | 43 | signals: |
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 | ||
48 | public slots: | 48 | public 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 | ||
62 | protected slots: | 62 | protected 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 | ||
69 | private: | 70 | private: |
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 | ||
75 | private: | 76 | private: |
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 | ||
100 | private slots: | 101 | private 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 |