summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
@@ -233,24 +233,28 @@ void PIconView::initKeys() {
m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
Resource::loadPixmap("trash"), DeleteItem,
Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
this, SLOT(slotTrash())) );
m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
Resource::loadPixmap("1to1"), ViewItem,
Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
this, SLOT(slotShowImage())));
m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
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 );
}
/*
* change one dir up
*/
void PIconView::slotDirUp()
{
slotChangeDir( currentView()->dirLister()->dirUp( m_path ) );
}
@@ -555,58 +559,144 @@ void PIconView::slotBeamDone( Ir* ir) {
void PIconView::slotStart() {
m_view->viewport()->setUpdatesEnabled( false );
}
void PIconView::slotEnd() {
if ( m_updatet )
m_view->arrangeItemsInGrid( );
m_view->viewport()->setUpdatesEnabled( true );
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());
slotShowImage(name);
}
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());
slotShowImage(name);
}
void PIconView::slotShowImage()
{
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
slotShowImage( name );
}
void PIconView::slotShowImage( const QString& name) {
PDirLister *lister = currentView()->dirLister();
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);
if (isDir) return;
slotImageInfo( name );
}
void PIconView::slotImageInfo( const QString& name) {
PDirLister *lister = currentView()->dirLister();
QString r_name = lister->nameToFname(name);
emit sig_showInfo(r_name );
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
@@ -18,39 +18,42 @@ class Ir;
namespace Opie {
namespace Core{
class OConfig;
class OKeyConfigManager;
}
}
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 );
~PIconView();
void resetView();
Opie::Core::OKeyConfigManager* manager();
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* );
private:
void initKeys();
QString currentFileName(bool &isDir)const;
QString nextFileName(bool &isDir)const;
QString prevFileName(bool &isDir)const;
void loadViews();
void calculateGrid();
@@ -59,24 +62,25 @@ private slots:
void slotChangeDir(const QString&);
void slotTrash();
void slotViewChanged( int );
void slotReloadDir();
void slotRename();
void slotBeam();
void slotBeamDone( Ir* );
void slotShowImage();
void slotShowImage( const QString& );
void slotImageInfo();
void slotImageInfo( const QString& );
+ void slotStartSlide();
void slotStart();
void slotEnd();
/* for performance reasons make it inline in the future */
void addFolders( const QStringList& );
void addFiles( const QStringList& );
void slotClicked(QIconViewItem* );
void slotRetrun(QIconViewItem* );
/**/
void slotThumbInfo(const QString&, const QString&);
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
@@ -1,50 +1,76 @@
#include "imageview.h"
#include <opie2/odebug.h>
#include <opie2/oconfig.h>
#include <opie2/okeyconfigwidget.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpopupmenu.h>
+#include <qtimer.h>
using namespace Opie::Core;
ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
: Opie::MM::OImageScrollView(parent,name,fl)
{
m_viewManager = 0;
focus_in_count = 0;
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()
{
odebug << "Delete Imageview" << oendl;
delete m_viewManager;
}
Opie::Core::OKeyConfigManager* ImageView::manager()
{
if (!m_viewManager) {
initKeys();
}
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;
if (!m_cfg) {
m_cfg = new Opie::Core::OConfig("phunkview");
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() );
@@ -130,25 +156,25 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
void ImageView::setFullScreen(bool how)
{
m_isFullScreen = how;
if (how) {
m_ignore_next_in = true;
setFixedSize(qApp->desktop()->size());
showFullScreen();
} else {
- setMinimumSize(10,10);
+ 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();
}
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
@@ -1,19 +1,21 @@
#ifndef _IMAGE_VIEW_H
#define _IMAGE_VIEW_H
#include <opie2/oimagescrollview.h>
#include <qwidget.h>
+class QTimer;
+
namespace Opie {
namespace Core {
class OConfig;
class OKeyConfigManager;
}
}
class ImageView:public Opie::MM::OImageScrollView
{
Q_OBJECT
enum ActionIds {
@@ -42,24 +44,28 @@ signals:
void hideMe();
void toggleZoomer();
void toggleAutoscale();
void toggleAutorotate();
protected:
Opie::Core::OConfig * m_cfg;
Opie::Core::OKeyConfigManager*m_viewManager;
void initKeys();
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();
virtual void keyReleaseEvent(QKeyEvent * e);
virtual void contentsMousePressEvent ( QMouseEvent * e);
};
#endif
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
@@ -302,24 +302,25 @@ void PMainWindow::initDisp() {
m_disp->setAutoScale(autoScale);
m_disp->setAutoRotate(autoRotate);
m_disp->setShowZoomer(zoomerOn);
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)));
}
}
void PMainWindow::slotToggleFullScreen()
{
odebug << "Toggle full " << oendl;
if (!m_disp) return;
bool current = !m_disp->fullScreen();
odebug << "Current = " << current << oendl;
if (current) {
odebug << "full" << oendl;
m_disp->setBackgroundColor(black);