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 | |||
@@ -52,48 +52,49 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
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()); |
@@ -412,55 +413,68 @@ 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 ); |
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 | |||
@@ -44,48 +44,49 @@ 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 */ |