author | alwin <alwin> | 2005-03-05 16:28:16 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-05 16:28:16 (UTC) |
commit | c017febf6f4092bb968d12df5a30a0af30066048 (patch) (unidiff) | |
tree | cfeefc7fc3c2ee8a4485219e5dea502783f3db36 | |
parent | 206e91c510caba81f41704f11b097307d8daa6cb (diff) | |
download | opie-c017febf6f4092bb968d12df5a30a0af30066048.zip opie-c017febf6f4092bb968d12df5a30a0af30066048.tar.gz opie-c017febf6f4092bb968d12df5a30a0af30066048.tar.bz2 |
prepare for toggle of display mode of the different views
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 85 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 6 |
2 files changed, 61 insertions, 30 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 90e2e99..a96bfbd 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -48,6 +48,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
48 | readConfig(); | 48 | readConfig(); |
49 | m_setDocCalled = false; | 49 | m_setDocCalled = false; |
50 | m_polishDone = false; | 50 | m_polishDone = false; |
51 | m_SmallWindow = QApplication::desktop()->size().width()<330; | ||
51 | 52 | ||
52 | m_storage = new StorageInfo(); | 53 | m_storage = new StorageInfo(); |
53 | connect(m_storage, SIGNAL(disksChanged() ), | 54 | connect(m_storage, SIGNAL(disksChanged() ), |
@@ -75,6 +76,9 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
75 | setupMenu(); | 76 | setupMenu(); |
76 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); | 77 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); |
77 | m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); | 78 | m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); |
79 | if (m_aForceSmall) { | ||
80 | m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true)); | ||
81 | } | ||
78 | odebug << "mainwindow constructor done" << oendl; | 82 | odebug << "mainwindow constructor done" << oendl; |
79 | } | 83 | } |
80 | 84 | ||
@@ -254,9 +258,9 @@ void PMainWindow::initInfo() { | |||
254 | void PMainWindow::initDisp() { | 258 | void PMainWindow::initDisp() { |
255 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 259 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
256 | if (m_disp) { | 260 | if (m_disp) { |
257 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 261 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
258 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 262 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
259 | } | 263 | // } |
260 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 264 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
261 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 265 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
262 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 266 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
@@ -306,17 +310,14 @@ void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | |||
306 | m_disp->setFullScreen(current,forceDisplay); | 310 | m_disp->setFullScreen(current,forceDisplay); |
307 | } else { | 311 | } else { |
308 | setUpdatesEnabled(false); | 312 | setUpdatesEnabled(false); |
313 | #if 0 | ||
309 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 314 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
310 | 315 | ||
311 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 316 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
312 | } else { | 317 | } else { |
313 | //m_disp->setMinimumSize(10,10); | 318 | //m_disp->setMinimumSize(10,10); |
314 | } | 319 | } |
315 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 320 | #endif |
316 | m_disp->reparent(0,QPoint(10,10)); | ||
317 | } else { | ||
318 | m_disp->reparent(0,QPoint(0,0)); | ||
319 | } | ||
320 | m_disp->setBackgroundColor(white); | 321 | m_disp->setBackgroundColor(white); |
321 | m_stack->addWidget(m_disp,ImageDisplay); | 322 | m_stack->addWidget(m_disp,ImageDisplay); |
322 | m_disp->setVScrollBarMode(QScrollView::Auto); | 323 | m_disp->setVScrollBarMode(QScrollView::Auto); |
@@ -354,17 +355,17 @@ void PMainWindow::slotShowInfo( const QString& inf ) { | |||
354 | initInfo(); | 355 | initInfo(); |
355 | } | 356 | } |
356 | m_info->setPath( inf ); | 357 | m_info->setPath( inf ); |
357 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 358 | if (m_SmallWindow) { |
358 | m_aNext->removeFrom(toolBar); | 359 | m_aNext->removeFrom(toolBar); |
359 | m_aPrevious->removeFrom(toolBar); | 360 | m_aPrevious->removeFrom(toolBar); |
360 | m_aNext->setEnabled(false); | ||
361 | m_aPrevious->setEnabled(false); | ||
362 | m_aDirUp->setEnabled(false); | ||
363 | m_aShowInfo->setEnabled(false); | ||
364 | m_aViewfile->setEnabled(true); | ||
365 | m_aStartSlide->setEnabled(false); | ||
366 | fsButton->hide(); | 361 | fsButton->hide(); |
367 | } | 362 | } |
363 | m_aNext->setEnabled(false); | ||
364 | m_aPrevious->setEnabled(false); | ||
365 | m_aDirUp->setEnabled(false); | ||
366 | m_aShowInfo->setEnabled(false); | ||
367 | m_aViewfile->setEnabled(true); | ||
368 | m_aStartSlide->setEnabled(false); | ||
368 | m_stack->raiseWidget( ImageInfo ); | 369 | m_stack->raiseWidget( ImageInfo ); |
369 | } | 370 | } |
370 | 371 | ||
@@ -375,18 +376,18 @@ void PMainWindow::slotDisplay( const QString& inf ) { | |||
375 | initDisp(); | 376 | initDisp(); |
376 | } | 377 | } |
377 | m_disp->setImage( inf ); | 378 | m_disp->setImage( inf ); |
378 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 379 | if (m_SmallWindow) { |
379 | if (m_gPrevNext->isEnabled()==false) { | 380 | if (m_gPrevNext->isEnabled()==false) { |
380 | m_gPrevNext->addTo(toolBar); | 381 | m_gPrevNext->addTo(toolBar); |
381 | m_gPrevNext->setEnabled(true); | ||
382 | |||
383 | m_aDirUp->setEnabled(false); | ||
384 | m_aShowInfo->setEnabled(true); | ||
385 | m_aViewfile->setEnabled(false); | ||
386 | m_aStartSlide->setEnabled(false); | ||
387 | fsButton->hide(); | 382 | fsButton->hide(); |
388 | } | 383 | } |
389 | } | 384 | } |
385 | m_gPrevNext->setEnabled(true); | ||
386 | m_aDirUp->setEnabled(false); | ||
387 | m_aShowInfo->setEnabled(true); | ||
388 | m_aViewfile->setEnabled(false); | ||
389 | m_aStartSlide->setEnabled(false); | ||
390 | |||
390 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { | 391 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { |
391 | slotFullScreenToggled(m_aFullScreen->isOn()); | 392 | slotFullScreenToggled(m_aFullScreen->isOn()); |
392 | } | 393 | } |
@@ -399,15 +400,16 @@ void PMainWindow::slotDisplay( const QString& inf ) { | |||
399 | 400 | ||
400 | void PMainWindow::raiseIconView() { | 401 | void PMainWindow::raiseIconView() { |
401 | setUpdatesEnabled(false); | 402 | setUpdatesEnabled(false); |
402 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 403 | if (m_SmallWindow) { |
403 | m_gPrevNext->removeFrom(toolBar); | 404 | m_gPrevNext->removeFrom(toolBar); |
404 | m_gPrevNext->setEnabled(false); | ||
405 | m_aDirUp->setEnabled(true); | ||
406 | m_aShowInfo->setEnabled(true); | ||
407 | m_aViewfile->setEnabled(true); | ||
408 | m_aStartSlide->setEnabled(true); | ||
409 | fsButton->show(); | 405 | fsButton->show(); |
410 | } | 406 | } |
407 | m_gPrevNext->setEnabled(false); | ||
408 | m_aDirUp->setEnabled(true); | ||
409 | m_aShowInfo->setEnabled(true); | ||
410 | m_aViewfile->setEnabled(true); | ||
411 | m_aStartSlide->setEnabled(true); | ||
412 | |||
411 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 413 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
412 | m_disp->stopSlide(); | 414 | m_disp->stopSlide(); |
413 | m_disp->hide(); | 415 | m_disp->hide(); |
@@ -622,6 +624,14 @@ void PMainWindow::setupActions() | |||
622 | 624 | ||
623 | m_hGroup = new QActionGroup(this,"actioncollection",false); | 625 | m_hGroup = new QActionGroup(this,"actioncollection",false); |
624 | m_hGroup->insert(m_aFullScreen); | 626 | m_hGroup->insert(m_aFullScreen); |
627 | |||
628 | if (!m_SmallWindow) { | ||
629 | m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); | ||
630 | m_aForceSmall->setToggleAction(true); | ||
631 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); | ||
632 | } else { | ||
633 | m_aForceSmall = 0; | ||
634 | } | ||
625 | } | 635 | } |
626 | 636 | ||
627 | void PMainWindow::setupToolbar() | 637 | void PMainWindow::setupToolbar() |
@@ -647,7 +657,7 @@ void PMainWindow::setupToolbar() | |||
647 | 657 | ||
648 | m_gDisplayType->addTo(toolBar); | 658 | m_gDisplayType->addTo(toolBar); |
649 | 659 | ||
650 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 660 | if (!m_SmallWindow) { |
651 | m_gPrevNext->addTo(toolBar); | 661 | m_gPrevNext->addTo(toolBar); |
652 | } else { | 662 | } else { |
653 | m_gPrevNext->setEnabled(false); | 663 | m_gPrevNext->setEnabled(false); |
@@ -690,6 +700,10 @@ void PMainWindow::setupMenu() | |||
690 | m_gDisplayType->addTo(dispMenu); | 700 | m_gDisplayType->addTo(dispMenu); |
691 | dispMenu->insertSeparator(); | 701 | dispMenu->insertSeparator(); |
692 | m_gPrevNext->addTo(dispMenu); | 702 | m_gPrevNext->addTo(dispMenu); |
703 | if (m_aForceSmall) { | ||
704 | dispMenu->insertSeparator(); | ||
705 | m_aForceSmall->addTo(dispMenu); | ||
706 | } | ||
693 | 707 | ||
694 | m_aSetup->addTo(settingsMenu); | 708 | m_aSetup->addTo(settingsMenu); |
695 | m_aHideToolbar->addTo(settingsMenu); | 709 | m_aHideToolbar->addTo(settingsMenu); |
@@ -737,3 +751,18 @@ void PMainWindow::polish() | |||
737 | } | 751 | } |
738 | } | 752 | } |
739 | } | 753 | } |
754 | |||
755 | void PMainWindow::slotForceSmall(bool how) | ||
756 | { | ||
757 | odebug << "Disable separate windows: " << how << oendl; | ||
758 | if (m_stack) { | ||
759 | if (how) { | ||
760 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); | ||
761 | } else { | ||
762 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | ||
763 | } | ||
764 | } | ||
765 | if (autoSave) { | ||
766 | m_cfg->writeEntry("dontshowseperate",how); | ||
767 | } | ||
768 | } | ||
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 2f54090..a49a9d3 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h | |||
@@ -80,9 +80,10 @@ private: | |||
80 | PIconView* m_view; | 80 | PIconView* m_view; |
81 | imageinfo *m_info; | 81 | imageinfo *m_info; |
82 | ImageView *m_disp; | 82 | ImageView *m_disp; |
83 | bool autoSave; | 83 | bool autoSave:1; |
84 | bool m_setDocCalled:1; | 84 | bool m_setDocCalled:1; |
85 | bool m_polishDone:1; | 85 | bool m_polishDone:1; |
86 | bool m_SmallWindow:1; | ||
86 | QToolButton*fsButton; | 87 | QToolButton*fsButton; |
87 | QToolBar *toolBar; | 88 | QToolBar *toolBar; |
88 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; | 89 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; |
@@ -90,7 +91,7 @@ private: | |||
90 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; | 91 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; |
91 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; | 92 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; |
92 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; | 93 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; |
93 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; | 94 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall; |
94 | 95 | ||
95 | /* init funs */ | 96 | /* init funs */ |
96 | void readConfig(); | 97 | void readConfig(); |
@@ -105,6 +106,7 @@ private slots: | |||
105 | void slotConfig(); | 106 | void slotConfig(); |
106 | void slotSelectDir(int); | 107 | void slotSelectDir(int); |
107 | void dirChanged(); | 108 | void dirChanged(); |
109 | void slotForceSmall(bool); | ||
108 | }; | 110 | }; |
109 | 111 | ||
110 | #endif | 112 | #endif |