summaryrefslogtreecommitdiff
path: root/noncore
authoralwin <alwin>2004-10-30 02:18:52 (UTC)
committer alwin <alwin>2004-10-30 02:18:52 (UTC)
commit3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25 (patch) (side-by-side diff)
tree087361e8ec23fcae50ab146d6d2e2d366a54fe74 /noncore
parentdca4423e3b0966fe26ba4183e5b6ad4666c61e86 (diff)
downloadopie-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') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp94
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp28
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp1
5 files changed, 131 insertions, 4 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
@@ -242,6 +242,10 @@ void PIconView::initKeys() {
Resource::loadPixmap("DocumentTypeWord"), InfoItem,
Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
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();
m_viewManager->handleWidget( m_view );
}
@@ -564,11 +568,76 @@ void PIconView::slotEnd() {
m_updatet = false;
}
+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()
{
bool isDir = false;
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;
/* if we got a name we have a next item */
m_view->setCurrentItem(m_view->currentItem()->nextItem());
@@ -579,7 +648,15 @@ void PIconView::slotShowPrev()
{
bool isDir = false;
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;
/* if we got a name we have a prev item */
m_view->setCurrentItem(m_view->currentItem()->prevItem());
@@ -598,6 +675,19 @@ void PIconView::slotShowImage( const QString& name) {
QString r_name = lister->nameToFname(name);
emit sig_display( r_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() {
bool isDir = false;
QString name = currentFileName(isDir);
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index a424c5c..bccbb0e 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -27,7 +27,7 @@ class PIconView : public QVBox {
Q_OBJECT
friend class PIconViewItem;
enum ActionIds {
- BeamItem, DeleteItem, ViewItem, InfoItem
+ BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem
};
public:
PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
@@ -38,10 +38,13 @@ public:
signals:
void sig_showInfo( const QString& );
void sig_display( const QString& );
+ void sig_startslide(int timeout);
public slots:
virtual void slotShowNext();
virtual void slotShowPrev();
+ virtual void slotShowLast();
+ virtual bool slotShowFirst();
protected:
void resizeEvent( QResizeEvent* );
@@ -68,6 +71,7 @@ private slots:
void slotShowImage( const QString& );
void slotImageInfo();
void slotImageInfo( const QString& );
+ void slotStartSlide();
void slotStart();
void slotEnd();
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 5522131..b699aa1 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -7,6 +7,7 @@
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpopupmenu.h>
+#include <qtimer.h>
using namespace Opie::Core;
@@ -18,8 +19,10 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name
m_cfg = cfg;
m_isFullScreen = false;
m_ignore_next_in = false;
+ m_slideTimer = 0;
QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
initKeys();
+ m_slideValue = 5;
}
ImageView::~ImageView()
@@ -36,6 +39,29 @@ Opie::Core::OKeyConfigManager* ImageView::manager()
return m_viewManager;
}
+void ImageView::startSlide(int value)
+{
+ if (!m_slideTimer) {
+ m_slideTimer = new QTimer(this);
+ }
+ m_slideValue=value;
+ connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
+ m_slideTimer->start(m_slideValue*1000,true);
+}
+
+void ImageView::nextSlide()
+{
+ if (!m_slideTimer) {
+ return;
+ }
+ if (isHidden()) {
+ delete m_slideTimer;
+ m_slideTimer = 0;
+ return;
+ }
+ emit dispNext();
+ m_slideTimer->start(m_slideValue*1000,true);
+}
void ImageView::initKeys()
{
odebug << "init imageview keys" << oendl;
@@ -139,7 +165,7 @@ void ImageView::setFullScreen(bool how)
setFixedSize(qApp->desktop()->size());
showFullScreen();
} else {
- setMinimumSize(10,10);
+ setMinimumSize(10,10);
}
}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 18697e0..f0e6541 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -5,6 +5,8 @@
#include <qwidget.h>
+class QTimer;
+
namespace Opie {
namespace Core {
class OConfig;
@@ -51,10 +53,14 @@ protected:
bool m_isFullScreen:1;
bool m_ignore_next_in:1;
int focus_in_count;
+ QTimer*m_slideTimer;
+ int m_slideValue;
virtual void focusInEvent ( QFocusEvent * );
public slots:
virtual void hide();
+ virtual void startSlide(int);
+ virtual void nextSlide();
protected slots:
virtual void slotShowImageInfo();
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 438fbf2..3c946b6 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -311,6 +311,7 @@ void PMainWindow::initDisp() {
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)));
}
}