author | alwin <alwin> | 2004-10-30 02:18:52 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-30 02:18:52 (UTC) |
commit | 3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25 (patch) (side-by-side diff) | |
tree | 087361e8ec23fcae50ab146d6d2e2d366a54fe74 /noncore/graphics/opie-eye/gui/iconview.cpp | |
parent | dca4423e3b0966fe26ba4183e5b6ad4666c61e86 (diff) | |
download | opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.zip opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.tar.gz opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.tar.bz2 |
slide show implemented
on next/previous images: if end/begin of list is reached it starts
again on begin/end (it was required for slideshow so what ;)
zecke: so we have a feature for OPIE 1.1.7 ;)
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 94 |
1 files changed, 92 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 7196aba..0499af9 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -244,2 +244,6 @@ void PIconView::initKeys() { this, SLOT(slotImageInfo()) ) ); + m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow", + Resource::loadPixmap("1to1"), SlideItem, + Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton), + this, SLOT(slotStartSlide()))); m_viewManager->load(); @@ -566,2 +570,60 @@ void PIconView::slotEnd() { +void PIconView::slotShowLast() +{ + QIconViewItem* last_it = m_view->lastItem(); + if (!last_it) return; + m_view->setCurrentItem(last_it); + IconViewItem* it = static_cast<IconViewItem*>( last_it ); + bool isDir = it->isDir(); + QString name = it->path(); + if (!isDir && !name.isEmpty()) { + slotShowImage(name); + return; + } + bool first_loop = true; + while(isDir==true) { + if (!first_loop) { + m_view->setCurrentItem(m_view->currentItem()->prevItem()); + } else { + first_loop = false; + } + name = prevFileName(isDir); + } + + if (name.isEmpty()) return; + /* if we got a name we have a prev item */ + m_view->setCurrentItem(m_view->currentItem()->prevItem()); + slotShowImage(name); +} + +bool PIconView::slotShowFirst() +{ + /* stop when reached - otherwise we may get an endless loop */ + QIconViewItem* first_it = m_view->firstItem(); + if (!first_it) return false; + m_view->setCurrentItem(first_it); + IconViewItem* it = static_cast<IconViewItem*>( first_it ); + bool isDir = it->isDir(); + QString name = it->path(); + if (!isDir && !name.isEmpty()) { + slotShowImage(name); + return false; + } + bool first_loop = true; + while(isDir==true) { + /* if name is empty isDir is false, too. */ + if (!first_loop) { + m_view->setCurrentItem(m_view->currentItem()->nextItem()); + } else { + first_loop = false; + } + name = nextFileName(isDir); + } + if (name.isEmpty()) return false; + /* if we got a name we have a next item */ + m_view->setCurrentItem(m_view->currentItem()->nextItem()); + slotShowImage(name); + return true; +} + void PIconView::slotShowNext() @@ -570,3 +632,10 @@ void PIconView::slotShowNext() QString name = nextFileName(isDir); - if (name.isEmpty()) return; + while (isDir==true) { + m_view->setCurrentItem(m_view->currentItem()->nextItem()); + name = nextFileName(isDir); + } + if (name.isEmpty()) { + slotShowFirst(); + return; + } if (isDir) return; @@ -581,3 +650,11 @@ void PIconView::slotShowPrev() QString name = prevFileName(isDir); - if (name.isEmpty()) return; + while (isDir==true) { + /* if name is empty isDir is false, too. */ + m_view->setCurrentItem(m_view->currentItem()->prevItem()); + name = prevFileName(isDir); + } + if (name.isEmpty()) { + slotShowLast(); + return; + } if (isDir) return; @@ -600,2 +677,15 @@ void PIconView::slotShowImage( const QString& name) { } + +void PIconView::slotStartSlide() { + bool isDir = false; + QString name = currentFileName(isDir); + if (isDir) { + if (!slotShowFirst()) + return; + } else { + slotShowImage( name ); + } + emit sig_startslide(2); +} + void PIconView::slotImageInfo() { |