-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 52 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 4 |
5 files changed, 44 insertions, 22 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index e70d6a6..7afb62d 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp @@ -51,17 +51,16 @@ Opie::Core::OKeyConfigManager* imageinfo::manager() if (!m_viewManager) { initKeys(); } return m_viewManager; } void imageinfo::initKeys() { - odebug << "init imageinfo keys" << oendl; #if 0 if (!m_cfg) { m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("imageinfo_keys" ); } #endif Opie::Core::OKeyPair::List lst; lst.append( Opie::Core::OKeyPair::upArrowKey() ); diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index c7e48cb..86db732 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -82,17 +82,17 @@ void ImageView::nextSlide() } emit dispNext(); m_slideTimer->start(m_slideValue*1000,true); } void ImageView::initKeys() { odebug << "init imageview keys" << oendl; if (!m_cfg) { - m_cfg = new Opie::Core::OConfig("phunkview"); + m_cfg = new Opie::Core::OConfig("opie-eye"); m_cfg->setGroup("image_view_keys" ); } Opie::Core::OKeyPair::List lst; lst.append( Opie::Core::OKeyPair::upArrowKey() ); lst.append( Opie::Core::OKeyPair::downArrowKey() ); lst.append( Opie::Core::OKeyPair::leftArrowKey() ); lst.append( Opie::Core::OKeyPair::rightArrowKey() ); lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); @@ -185,23 +185,23 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) m_gPrevNext->removeFrom(m); } if (m_gDisplayType) { m_gDisplayType->removeFrom(m); } delete m; } -void ImageView::setFullScreen(bool how) +void ImageView::setFullScreen(bool how,bool force) { m_isFullScreen = how; if (how) { m_ignore_next_in = true; setFixedSize(qApp->desktop()->size()); - showFullScreen(); + if (force) showFullScreen(); } else { setMinimumSize(10,10); } } void ImageView::focusInEvent(QFocusEvent *) { // Always do it here, no matter the size. @@ -229,10 +229,9 @@ void ImageView::enableFullscreen() // style to WSTyle_TopLevel. reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); // Enable fullscreen. /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus * so we must block it here! */ m_ignore_next_in = true; showFullScreen(); setUpdatesEnabled(true); - } diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 640905a..2408211 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h @@ -29,17 +29,17 @@ class ImageView:public Opie::MM::OImageScrollView Autorotate, Autoscale }; public: ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 ); virtual ~ImageView(); Opie::Core::OKeyConfigManager* manager(); - void setFullScreen(bool how); + void setFullScreen(bool how,bool force=true); bool fullScreen(){return m_isFullScreen;} virtual void enableFullscreen(); void stopSlide(); void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); signals: void dispImageInfo(const QString&); void dispNext(); diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 570ee45..ece51a1 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -38,18 +38,18 @@ //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) { setCaption( QObject::tr("Opie Eye Caramba" ) ); - m_cfg = new Opie::Core::OConfig("phunkview"); - m_cfg->setGroup("Zecke_view" ); + m_cfg = new Opie::Core::OConfig("opie-eye"); + m_cfg->setGroup("main" ); m_storage = new StorageInfo(); connect(m_storage, SIGNAL(disksChanged() ), this, SLOT( dirChanged() ) ); m_stack = new Opie::Ui::OWidgetStack( this ); setCentralWidget( m_stack ); @@ -103,17 +103,16 @@ void PMainWindow::slotToggleAutoscale() { if (!m_disp) return; bool cur = m_aAutoScale->isOn(); m_aAutoScale->setOn(!cur); } void PMainWindow::slotRotateToggled(bool how) { - odebug << "Autorotate: " << how << oendl; autoRotate = how; if (m_disp) { m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); } } void PMainWindow::slotScaleToggled(bool how) { @@ -221,20 +220,22 @@ void PMainWindow::initT( const char* name, T** ptr, int id) { } *ptr = new T(m_cfg, m_stack, name ); m_stack->addWidget( *ptr, id ); connect(*ptr, SIGNAL(sig_return()), this,SLOT(slotReturn())); } + void PMainWindow::initInfo() { initT<imageinfo>( "Image Info", &m_info, ImageInfo ); connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); } + void PMainWindow::initDisp() { initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); if (m_disp) { if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_disp->setMinimumSize(QApplication::desktop()->size()/2); } m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); m_disp->setAutoScale(!m_aAutoScale->isOn()); @@ -251,56 +252,76 @@ void PMainWindow::initDisp() { connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); slotFullScreenToggled(m_aFullScreen->isOn()); } } void PMainWindow::slotToggleFullScreen() { - odebug << "Toggle full " << oendl; bool current = !m_aFullScreen->isOn(); m_aFullScreen->setOn(current); } -void PMainWindow::slotFullScreenToggled(bool current) +void PMainWindow::slotFullScreenButton(bool current) +{ + if (m_disp) odebug << "Disp fenster ist hidden: "<<m_disp->isHidden()<<oendl; + if (!m_disp) return; + + /* I can not solve this effects here - it seems that we require some + status variable, too. so we will live with some interesting effects + meanwhile */ +#if 0 + bool th = m_disp->isHidden(); + setupViewWindow(current, false); + /* realy - after setting up the fullscreenmode while the window is hidden + it is unvisibile not hidden!!!!! Hell. */ + if (th) m_disp->hide(); +#endif + setupViewWindow(current, true); +} + +void PMainWindow::setupViewWindow(bool current, bool forceDisplay) { - odebug << "slotFullScreenToggled " << current << oendl; if (!m_disp) return; if (current) { - odebug << "full" << oendl; m_disp->setBackgroundColor(black); m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); m_disp->setVScrollBarMode(QScrollView::AlwaysOff); m_disp->setHScrollBarMode(QScrollView::AlwaysOff); m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); } else { setUpdatesEnabled(false); - odebug << "window" << oendl; if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_disp->setMinimumSize(QApplication::desktop()->size()/2); } else { m_disp->setMinimumSize(10,10); } if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_disp->reparent(0,QPoint(50,50)); } else { m_disp->reparent(0,QPoint(0,0)); } m_disp->setBackgroundColor(white); m_stack->addWidget(m_disp,ImageDisplay); m_disp->setVScrollBarMode(QScrollView::Auto); m_disp->setHScrollBarMode(QScrollView::Auto); + if (forceDisplay || m_disp->isVisible()) m_stack->raiseWidget(m_disp); if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_disp->resize(m_disp->minimumSize()); } setUpdatesEnabled(true); } - m_disp->setFullScreen(current); + m_disp->setFullScreen(current,forceDisplay); +} + +void PMainWindow::slotFullScreenToggled(bool current) +{ + setupViewWindow(current,true); } /** * With big Screen the plan could be to 'detach' the image * window if visible and to create a ne wone * init* already supports it but I make no use of it for * now. We set filename and raise * @@ -324,17 +345,16 @@ void PMainWindow::slotShowInfo( const QString& inf ) { m_aViewfile->setEnabled(true); m_aStartSlide->setEnabled(false); fsButton->hide(); } m_stack->raiseWidget( ImageInfo ); } void PMainWindow::slotDisplay( const QString& inf ) { - odebug << "slotDisplay: " << inf << oendl; if ( !m_disp ) { initDisp(); } m_disp->setImage( inf ); if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { if (m_gPrevNext->isEnabled()==false) { m_gPrevNext->addTo(toolBar); m_gPrevNext->setEnabled(true); @@ -342,17 +362,16 @@ void PMainWindow::slotDisplay( const QString& inf ) { m_aDirUp->setEnabled(false); m_aShowInfo->setEnabled(true); m_aViewfile->setEnabled(false); m_aStartSlide->setEnabled(false); fsButton->hide(); } } if (m_disp->fullScreen()) { - //m_disp->showFullScreen(); qwsDisplay()->requestFocus( m_disp->winId(), TRUE); } else { m_stack->raiseWidget( ImageDisplay ); } } void PMainWindow::raiseIconView() { setUpdatesEnabled(false); @@ -513,17 +532,17 @@ void PMainWindow::setupActions() connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); m_gPrevNext->insert(m_aPrevious); m_gPrevNext->insert(m_aNext); m_aFullScreen = new QAction( tr( "Show images fullscreen" ), Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); m_aFullScreen->setToggleAction(true); m_aFullScreen->setOn(false); - connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenToggled(bool))); + connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool))); m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); m_aAutoRotate->setToggleAction(true); if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { m_aAutoRotate->setOn(true); autoRotate = true; } else { @@ -564,33 +583,35 @@ void PMainWindow::setupToolbar() connect( this, SIGNAL( changeDir( const QString& ) ), m_view, SLOT(slotChangeDir( const QString& ) ) ); if (m_aBeam) { m_aBeam->addTo( toolBar ); } m_aShowInfo->addTo(toolBar); m_aTrash->addTo(toolBar); - m_aSetup->addTo(toolBar); +// m_aSetup->addTo(toolBar); m_gDisplayType->addTo(toolBar); if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_gPrevNext->addTo(toolBar); } else { m_gPrevNext->setEnabled(false); } } void PMainWindow::setupMenu() { fileMenu = new QPopupMenu( menuBar() ); menuBar()->insertItem( tr( "File" ), fileMenu ); dispMenu = new QPopupMenu( menuBar() ); menuBar()->insertItem( tr( "Show" ), dispMenu ); + settingsMenu = new QPopupMenu( menuBar() ); + menuBar()->insertItem( tr( "Settings" ), settingsMenu ); m_aViewfile->addTo(fileMenu); m_aShowInfo->addTo(fileMenu); m_aStartSlide->addTo(fileMenu); fileMenu->insertSeparator(); m_aDirUp->addTo( fileMenu ); @@ -599,28 +620,29 @@ void PMainWindow::setupMenu() connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); dirChanged(); if ( m_aBeam ) { fileMenu->insertSeparator(); m_aBeam->addTo( fileMenu ); } fileMenu->insertSeparator(); - m_aSetup->addTo(fileMenu); m_aTrash->addTo(fileMenu); - m_aHideToolbar->addTo(dispMenu); listviewMenu = new QPopupMenu(dispMenu); dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); m_gListViewMode->addTo(listviewMenu); dispMenu->insertSeparator(); m_aFullScreen->addTo(dispMenu); m_gDisplayType->addTo(dispMenu); dispMenu->insertSeparator(); m_gPrevNext->addTo(dispMenu); + + m_aSetup->addTo(settingsMenu); + m_aHideToolbar->addTo(settingsMenu); } void PMainWindow::listviewselected(QAction*which) { if (!which || which->isOn()==false) return; int val = 1; // QString name; diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 65151fc..703965b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -59,34 +59,36 @@ public slots: virtual void slotToggleFullScreen(); virtual void slotFullScreenToggled(bool); protected slots: void raiseIconView(); void closeEvent( QCloseEvent* ); void showToolbar(bool); void listviewselected(QAction*); + void slotFullScreenButton(bool); private: template<class T> void initT( const char* name, T**, int ); void initInfo(); void initDisp(); + void setupViewWindow(bool full, bool forceDisplay); private: Opie::Core::OConfig *m_cfg; Opie::Ui::OWidgetStack *m_stack; PIconView* m_view; imageinfo *m_info; ImageView *m_disp; bool autoRotate; bool autoScale; bool zoomerOn; QToolButton*fsButton; QToolBar *toolBar; - QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu; + QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; QAction *m_aNext,*m_aPrevious,*m_aFullScreen; QAction *m_aAutoRotate,*m_aAutoScale,*m_aZoomer; /* init funs */ void setupActions(); |