summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-05 16:28:16 (UTC)
committer alwin <alwin>2005-03-05 16:28:16 (UTC)
commitc017febf6f4092bb968d12df5a30a0af30066048 (patch) (unidiff)
treecfeefc7fc3c2ee8a4485219e5dea502783f3db36
parent206e91c510caba81f41704f11b097307d8daa6cb (diff)
downloadopie-c017febf6f4092bb968d12df5a30a0af30066048.zip
opie-c017febf6f4092bb968d12df5a30a0af30066048.tar.gz
opie-c017febf6f4092bb968d12df5a30a0af30066048.tar.bz2
prepare for toggle of display mode of the different views
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp85
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h6
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
@@ -45,12 +45,13 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
45 setCaption( QObject::tr("Opie Eye" ) ); 45 setCaption( QObject::tr("Opie Eye" ) );
46 m_cfg = new Opie::Core::OConfig("opie-eye"); 46 m_cfg = new Opie::Core::OConfig("opie-eye");
47 m_cfg->setGroup("main" ); 47 m_cfg->setGroup("main" );
48 readConfig(); 48 readConfig();
49 m_setDocCalled = false; 49 m_setDocCalled = false;
50 m_polishDone = false; 50 m_polishDone = false;
51 m_SmallWindow = QApplication::desktop()->size().width()<330;
51 52
52 m_storage = new StorageInfo(); 53 m_storage = new StorageInfo();
53 connect(m_storage, SIGNAL(disksChanged() ), 54 connect(m_storage, SIGNAL(disksChanged() ),
54 this, SLOT( dirChanged() ) ); 55 this, SLOT( dirChanged() ) );
55 56
56 m_stack = new Opie::Ui::OWidgetStack( this ); 57 m_stack = new Opie::Ui::OWidgetStack( this );
@@ -72,12 +73,15 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
72 /* setup menu and toolbar */ 73 /* setup menu and toolbar */
73 setupActions(); 74 setupActions();
74 setupToolbar(); 75 setupToolbar();
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
81PMainWindow::~PMainWindow() { 85PMainWindow::~PMainWindow() {
82} 86}
83 87
@@ -251,15 +255,15 @@ void PMainWindow::initInfo() {
251 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 255 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
252} 256}
253 257
254void PMainWindow::initDisp() { 258void 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());
263 m_disp->setShowZoomer(m_aZoomer->isOn()); 267 m_disp->setShowZoomer(m_aZoomer->isOn());
264 m_disp->setBackgroundColor(white); 268 m_disp->setBackgroundColor(white);
265 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 269 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
@@ -303,23 +307,20 @@ void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
303 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 307 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
304 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 308 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
305 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 309 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
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);
323 m_disp->setHScrollBarMode(QScrollView::Auto); 324 m_disp->setHScrollBarMode(QScrollView::Auto);
324 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 325 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
325 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); 326 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60);
@@ -351,66 +352,67 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
351 return; 352 return;
352 } 353 }
353 if ( !m_info ) { 354 if ( !m_info ) {
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
371void PMainWindow::slotDisplay( const QString& inf ) { 372void PMainWindow::slotDisplay( const QString& inf ) {
372 bool nwindow = false; 373 bool nwindow = false;
373 if ( !m_disp ) { 374 if ( !m_disp ) {
374 nwindow = true; 375 nwindow = true;
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 }
393 if (m_disp->fullScreen()) { 394 if (m_disp->fullScreen()) {
394 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 395 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
395 } else { 396 } else {
396 m_stack->raiseWidget( ImageDisplay ); 397 m_stack->raiseWidget( ImageDisplay );
397 } 398 }
398} 399}
399 400
400void PMainWindow::raiseIconView() { 401void 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();
414 } 416 }
415 m_stack->raiseWidget( IconView ); 417 m_stack->raiseWidget( IconView );
416 setUpdatesEnabled(true); 418 setUpdatesEnabled(true);
@@ -619,12 +621,20 @@ void PMainWindow::setupActions()
619 m_gDisplayType->insert(m_aAutoRotate); 621 m_gDisplayType->insert(m_aAutoRotate);
620 m_gDisplayType->insert(m_aUnscaled); 622 m_gDisplayType->insert(m_aUnscaled);
621 m_gDisplayType->insert(m_aZoomer); 623 m_gDisplayType->insert(m_aZoomer);
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
627void PMainWindow::setupToolbar() 637void PMainWindow::setupToolbar()
628{ 638{
629 toolBar = new QToolBar( this ); 639 toolBar = new QToolBar( this );
630 addToolBar(toolBar); 640 addToolBar(toolBar);
@@ -644,13 +654,13 @@ void PMainWindow::setupToolbar()
644 m_aShowInfo->addTo(toolBar); 654 m_aShowInfo->addTo(toolBar);
645 m_aTrash->addTo(toolBar); 655 m_aTrash->addTo(toolBar);
646// m_aSetup->addTo(toolBar); 656// m_aSetup->addTo(toolBar);
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);
654 } 664 }
655} 665}
656 666
@@ -687,12 +697,16 @@ void PMainWindow::setupMenu()
687 m_gListViewMode->addTo(listviewMenu); 697 m_gListViewMode->addTo(listviewMenu);
688 dispMenu->insertSeparator(); 698 dispMenu->insertSeparator();
689 m_aFullScreen->addTo(dispMenu); 699 m_aFullScreen->addTo(dispMenu);
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);
696} 710}
697 711
698void PMainWindow::listviewselected(QAction*which) 712void PMainWindow::listviewselected(QAction*which)
@@ -734,6 +748,21 @@ void PMainWindow::polish()
734 if (m_aFullScreen->isOn()) { 748 if (m_aFullScreen->isOn()) {
735 QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); 749 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
736 } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 750 } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
737 } 751 }
738 } 752 }
739} 753}
754
755void 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
@@ -77,23 +77,24 @@ private:
77private: 77private:
78 Opie::Core::OConfig *m_cfg; 78 Opie::Core::OConfig *m_cfg;
79 Opie::Ui::OWidgetStack *m_stack; 79 Opie::Ui::OWidgetStack *m_stack;
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;
89 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; 90 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide;
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();
97 void setupActions(); 98 void setupActions();
98 void setupToolbar(); 99 void setupToolbar();
99 void setupMenu(); 100 void setupMenu();
@@ -102,9 +103,10 @@ private:
102 QMap<QString, QString> m_dev; 103 QMap<QString, QString> m_dev;
103 104
104private slots: 105private 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