-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 58 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 15 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 37 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 3 |
6 files changed, 90 insertions, 29 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 948477c..138e661 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -195,8 +195,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) m_mode = 0; m_iconsize = 32; m_internalReset = false; m_customWidget = 0; + m_setDocCalled = false; m_hbox = new QHBox( this ); QLabel* lbl = new QLabel( m_hbox ); lbl->setText( tr("View as" ) ); @@ -211,12 +212,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) m_view->setArrangement( QIconView::LeftToRight ); m_mode = m_cfg->readNumEntry("ListViewMode", 1); - QString lastView = m_cfg->readEntry("LastView",""); - if (m_mode < 1 || m_mode>3) m_mode = 1; - m_view->setItemTextPos( QIconView::Right ); if (m_mode >1) { m_view->setResizeMode(QIconView::Adjust); } else { @@ -226,26 +224,15 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) if (m_iconsize<12)m_iconsize = 12; if (m_iconsize>64)m_iconsize = 64; calculateGrid(); - initKeys(); - loadViews(); - int cc=0; - for (; cc<m_views->count();++cc) { - if (m_views->text(cc)==lastView) { - break; - } - } - if (cc<m_views->count()) { - m_views->setCurrentItem(cc); - slotViewChanged(cc); - } else { - slotViewChanged(m_views->currentItem()); } - connect( m_views, SIGNAL(activated(int)), - this, SLOT(slotViewChanged(int)) ); + +void PIconView::setDoccalled(bool how) +{ + m_setDocCalled = how; } /* * Unref the slave and save the keyboard manager @@ -440,8 +427,32 @@ void PIconView::resetView() { slotViewChanged(m_views->currentItem()); m_internalReset = false; } +void PIconView::polish() +{ + odebug << "===\n" + << "PIconView::polish()\n" + << "====" << oendl; + QVBox::polish(); + + QString lastView = m_cfg->readEntry("LastView",""); + int cc=0; + for (; cc<m_views->count();++cc) { + if (m_views->text(cc)==lastView) { + break; + } + } + if (cc<m_views->count()) { + m_views->setCurrentItem(cc); + slotViewChanged(cc); + } else { + slotViewChanged(m_views->currentItem()); + } + connect( m_views, SIGNAL(activated(int)), + this, SLOT(slotViewChanged(int)) ); +} + /* *swicth view reloadDir and connect signals */ void PIconView::slotViewChanged( int i) { @@ -528,17 +539,22 @@ void PIconView::addFiles( const QStringList& lst) { QString pre = ""; if (!m_path.isEmpty()) { pre = m_path+"/"; } + QString s = ""; + int pos; for (it=lst.begin(); it!= lst.end(); ++it ) { + s = (*it); + pos = s.find(char(0)); m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); + if (pos>-1) { + _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize ); + } else { _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); + } if (m_mode==3) { _iv->setTextOnly(true); _iv->setPixmap(QPixmap()); - - - } else { if (m_pix) _iv->setPixmap(*m_pix); } } diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index 78dda58..6e08fd8 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h @@ -34,8 +34,10 @@ public: ~PIconView(); void resetView(); Opie::Core::OKeyConfigManager* manager(); + void setDoccalled(bool); + signals: void sig_showInfo( const QString& ); void sig_display(const QString&); void sig_startslide(int timeout); @@ -44,8 +46,9 @@ public slots: virtual void slotShowNext(); virtual void slotShowPrev(); virtual void slotShowLast(); virtual bool slotShowFirst(); + virtual void polish(); protected: void resizeEvent( QResizeEvent* ); @@ -55,8 +58,9 @@ private: QString nextFileName(bool &isDir)const; QString prevFileName(bool &isDir)const; void loadViews(); void calculateGrid(QResizeEvent*e = 0); + bool m_setDocCalled:1; private slots: void slotDirUp(); void slotChangeDir(const QString&); diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index ebdfc60..ac6474c 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -26,8 +26,9 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name m_slideValue = 5; m_gDisplayType = 0; m_gPrevNext = 0; m_hGroup = 0; + closeIfHide = false; } void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) { @@ -151,9 +152,21 @@ void ImageView::keyReleaseEvent(QKeyEvent * e) { if (!e || e->state()!=0) { return; } - if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); + 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() { diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 2408211..f1067bb 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h @@ -38,8 +38,9 @@ public: bool fullScreen(){return m_isFullScreen;} virtual void enableFullscreen(); void stopSlide(); void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); + void setCloseIfHide(bool); signals: void dispImageInfo(const QString&); void dispNext(); @@ -60,8 +61,9 @@ protected: QTimer*m_slideTimer; int m_slideValue; virtual void focusInEvent ( QFocusEvent * ); QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; + bool closeIfHide:1; public slots: virtual void hide(); virtual void startSlide(int); diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index f443ccb..295f93f 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -45,8 +45,10 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) setCaption( QObject::tr("Opie Eye Caramba" ) ); m_cfg = new Opie::Core::OConfig("opie-eye"); m_cfg->setGroup("main" ); readConfig(); + m_setDocCalled = false; + m_polishDone = false; m_storage = new StorageInfo(); connect(m_storage, SIGNAL(disksChanged() ), this, SLOT( dirChanged() ) ); @@ -418,14 +420,16 @@ 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); @@ -435,18 +439,18 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { } void PMainWindow::setDocument( const QString& showImg ) { - bool first_start = m_disp==0; - QString file = showImg; DocLnk lnk(showImg); if (lnk.isValid() ) file = lnk.file(); slotDisplay( file ); - if (first_start && m_aFullScreen->isOn()) { +#if 0 + if (!m_polishDone) { QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); } +#endif } void PMainWindow::check_view_fullscreen() { @@ -688,23 +692,42 @@ void PMainWindow::setupMenu() void PMainWindow::listviewselected(QAction*which) { if (!which || which->isOn()==false) return; int val = 1; -// QString name; if (which==m_aDirName) { val = 3; -// name = "opie-eye/opie-eye-textview"; } else if (which==m_aDirShort) { val = 2; -// name = "opie-eye/opie-eye-thumbonly"; } else if (which==m_aDirLong) { val = 1; -// name = "opie-eye/opie-eye-thumb"; } emit changeListMode(val); } void PMainWindow::readConfig() { autoSave =m_cfg->readBoolEntry("savestatus",true); } + +void PMainWindow::polish() +{ + if (m_disp) { + odebug << "======================\n" + << "Called via setdocument\n" + << "======================" << oendl; + m_setDocCalled = true; + m_view->setDoccalled(true); + m_disp->setCloseIfHide(true); + } else { + m_setDocCalled = false; + m_view->setDoccalled(false); + } + m_polishDone = true; + QMainWindow::polish(); + if (m_setDocCalled) { + if (m_aFullScreen->isOn()) { + QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); + } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { + } + } +} diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 465e352..2f54090 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -57,8 +57,9 @@ public slots: void slotToggleAutoscale(); void setDocument( const QString& ); virtual void slotToggleFullScreen(); virtual void slotFullScreenToggled(bool); + virtual void polish(); protected slots: void raiseIconView(); void closeEvent( QCloseEvent* ); @@ -79,8 +80,10 @@ private: PIconView* m_view; imageinfo *m_info; ImageView *m_disp; bool autoSave; + bool m_setDocCalled:1; + bool m_polishDone:1; QToolButton*fsButton; QToolBar *toolBar; QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; |