-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 27 |
2 files changed, 8 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 03df321..6c3f9cb 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -183,104 +183,104 @@ void ImageView::keyReleaseEvent(QKeyEvent * e) if (!e || e->state()!=0) { return; } if (e->key()==Qt::Key_Escape) { if (fullScreen()) { emit hideMe(); } if (closeIfHide) { QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); } } } void ImageView::setCloseIfHide(bool how) { closeIfHide = how; } void ImageView::slotShowImageInfo() { emit dispImageInfo(m_lastName); } void ImageView::contentsMousePressEvent ( QMouseEvent * e) { if (e->button()==1) { return OImageScrollView::contentsMousePressEvent(e); } odebug << "Popup " << oendl; QPopupMenu *m = new QPopupMenu(this); if (!m) return; if (m_hGroup) { m_hGroup->addTo(m); } if (fullScreen()) { if (m_gPrevNext) { m->insertSeparator(); m_gPrevNext->addTo(m); } if (m_gDisplayType) { m->insertSeparator(); m_gDisplayType->addTo(m); } } m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); if (m_hGroup) { m_hGroup->removeFrom(m); } if (m_gPrevNext) { m_gPrevNext->removeFrom(m); } if (m_gDisplayType) { m_gDisplayType->removeFrom(m); } delete m; } void ImageView::setFullScreen(bool how,bool force) { m_isFullScreen = how; if (how) { m_ignore_next_in = true; // setFixedSize(qApp->desktop()->size()); setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); if (force) showFullScreen(); } else { // setMinimumSize(10,10); } } void ImageView::focusInEvent(QFocusEvent *) { // Always do it here, no matter the size. odebug << "Focus in (view)" << oendl; //if (fullScreen()) parentWidget()->showNormal(); if (m_ignore_next_in){m_ignore_next_in=false;return;} if (fullScreen()) enableFullscreen(); } void ImageView::hide() { if (fullScreen()) { m_ignore_next_in = true; showNormal(); } QWidget::hide(); } void ImageView::enableFullscreen() { if (!fullScreen()) return; if (m_ignore_next_in) {m_ignore_next_in = false;return;} setUpdatesEnabled(false); // This is needed because showNormal() forcefully changes the window // style to WSTyle_TopLevel. - reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); + reparent(0, WStyle_Customize | WStyle_NoBorderEx, 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/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 3a89dfd..d11e4e1 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -214,300 +214,287 @@ void PMainWindow::slotConfig() { if ( act ) { keyWid->save(); m_disp->manager()->save(); m_info->manager()->save(); m_view->manager()->save(); bSetup->save_values(); m_view->resetView(); readConfig(); } delete keyWid; m_stack->raiseWidget(w); if (remdisp) { m_disp->hide(); } if (reminfo) { m_info->hide(); } if (m_disp) { m_disp->setIntensity(m_Intensity,true); } } /* * create a new image info component * and detach the current one * we will make the other delete on exit */ template<class T> void PMainWindow::initT( const char* name, T** ptr, int id) { if ( *ptr ) { (*ptr)->disconnect(this, SLOT(slotReturn())); (*ptr)->setDestructiveClose(); m_stack->removeWidget( *ptr ); } *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_aUnscaled->isOn()); m_disp->setAutoRotate(m_aAutoRotate->isOn()); m_disp->setShowZoomer(m_aZoomer->isOn()); m_disp->setBackgroundColor(white); connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 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() { bool current = !m_aFullScreen->isOn(); m_aFullScreen->setOn(current); } void PMainWindow::slotFullScreenButton(bool current) { if (autoSave) { m_cfg->writeEntry("fullscreen",current); } if (!m_disp) return; if (m_disp->isVisible()) { setupViewWindow(current, true); } } void PMainWindow::setupViewWindow(bool current, bool forceDisplay) { if (!m_disp) { return; } if (current) { m_disp->setBackgroundColor(black); - m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); + m_disp->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); m_disp->setVScrollBarMode(QScrollView::AlwaysOff); m_disp->setHScrollBarMode(QScrollView::AlwaysOff); m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); m_disp->setFullScreen(current,forceDisplay); } else { setUpdatesEnabled(false); #if 0 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { //m_disp->setMinimumSize(QApplication::desktop()->size()/2); } else { //m_disp->setMinimumSize(10,10); } #endif m_disp->setBackgroundColor(white); m_stack->addWidget(m_disp,ImageDisplay); m_disp->setVScrollBarMode(QScrollView::Auto); m_disp->setHScrollBarMode(QScrollView::Auto); if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); } if (forceDisplay || m_disp->isVisible()) { m_stack->raiseWidget(m_disp); m_disp->setFocus(); } setUpdatesEnabled(true); } 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 * * ### FIXME and talk to alwin */ void PMainWindow::slotShowInfo( const QString& inf ) { if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { return; } if ( !m_info ) { initInfo(); } m_info->setPath( inf ); if (m_SmallWindow) { m_aNext->removeFrom(toolBar); m_aPrevious->removeFrom(toolBar); fsButton->hide(); } m_aNext->setEnabled(false); m_aPrevious->setEnabled(false); m_aDirUp->setEnabled(false); m_aShowInfo->setEnabled(false); m_aViewfile->setEnabled(true); m_aStartSlide->setEnabled(false); m_stack->raiseWidget( ImageInfo ); } void PMainWindow::slotDisplay( const QString& inf ) { bool nwindow = false; - bool disp_hack = false; - int lb; - if (m_disp && m_disp->fullScreen()) { - lb = m_disp->Intensity(); - delete m_disp; - m_disp = 0; - - disp_hack = true; - } if ( !m_disp ) { nwindow = true; initDisp(); - m_disp->setIntensity((disp_hack?lb:m_Intensity)); + m_disp->setIntensity(m_Intensity); + m_setCurrentBrightness->setEnabled(true); } - m_setCurrentBrightness->setEnabled(true); - - Opie::Ui::OWait wdlg; - wdlg.setTimerLength(30); - wdlg.show(); - //qApp->processEvents(20); m_disp->setImage( inf ); - wdlg.hide(); - //qApp->processEvents(20); if (m_SmallWindow) { if (m_gPrevNext->isEnabled()==false) { m_gPrevNext->addTo(toolBar); fsButton->hide(); } } m_gPrevNext->setEnabled(true); m_aDirUp->setEnabled(false); m_aShowInfo->setEnabled(true); m_aViewfile->setEnabled(false); m_aStartSlide->setEnabled(false); if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { slotFullScreenToggled(m_aFullScreen->isOn()); } if (m_disp->fullScreen()) { - qwsDisplay()->requestFocus( m_disp->winId(), TRUE); + if (!m_disp->isVisible()) { + m_disp->showFullScreen(); + qwsDisplay()->requestFocus( m_disp->winId(), TRUE); + } } else { m_stack->raiseWidget( ImageDisplay ); } } void PMainWindow::raiseIconView() { setUpdatesEnabled(false); if (m_SmallWindow) { m_gPrevNext->removeFrom(toolBar); fsButton->show(); } m_gPrevNext->setEnabled(false); m_aDirUp->setEnabled(true); m_aShowInfo->setEnabled(true); m_aViewfile->setEnabled(true); m_aStartSlide->setEnabled(true); if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { m_disp->stopSlide(); m_disp->hide(); } m_stack->raiseWidget( IconView ); setUpdatesEnabled(true); repaint(); } void PMainWindow::slotReturn() { raiseIconView(); } void PMainWindow::closeEvent( QCloseEvent* ev ) { /* * return from view * or properly quit */ if (!m_setDocCalled) { if ( m_stack->visibleWidget() == m_info || m_stack->visibleWidget() == m_disp ) { ev->ignore(); raiseIconView(); return; } } if (m_disp && m_disp->fullScreen()) { /* otherwise opie-eye crashes in bigscreen mode! */ m_disp->reparent(0,QPoint(0,0)); m_stack->addWidget(m_disp,ImageDisplay); } ev->accept(); QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); } void PMainWindow::setDocument( const QString& showImg ) { QString file = showImg; DocLnk lnk(showImg); if (lnk.isValid() ) file = lnk.file(); slotDisplay( file ); #if 0 if (!m_polishDone) { QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); } #endif } void PMainWindow::check_view_fullscreen() { if (!m_view) return; if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { qwsDisplay()->requestFocus( m_disp->winId(), TRUE); } } void PMainWindow::slotSelectDir(int id) { emit changeDir( m_dev[fsMenu->text(id )] ); } void PMainWindow::dirChanged() { fsMenu->clear(); m_dev.clear(); /* home dir, too */ QString f = getenv( "HOME" ); if (!f.isEmpty()) { m_dev.insert("Home directory",f); fsMenu->insertItem("Home directory"); } const QList<FileSystem> &fs = m_storage->fileSystems(); QListIterator<FileSystem> it(fs ); for ( ; it.current(); ++it ) { const QString disk = (*it)->name(); const QString path = (*it)->path(); |