summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-15 16:14:56 (UTC)
committer alwin <alwin>2004-04-15 16:14:56 (UTC)
commita002be54e33d64e69c7edf2960d5e68a9a0609e4 (patch) (unidiff)
treec58f7bce41920a86f077d0c371bcf166a03d6489
parentfd31b11688704c214034a0e28ca7c0a56a6a2988 (diff)
downloadopie-a002be54e33d64e69c7edf2960d5e68a9a0609e4.zip
opie-a002be54e33d64e69c7edf2960d5e68a9a0609e4.tar.gz
opie-a002be54e33d64e69c7edf2960d5e68a9a0609e4.tar.bz2
previous/next image keys implemented
ToDo: make it via keywidget, this moment the keywidget sends a key twice (on press and on release)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp48
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp25
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h5
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
5 files changed, 86 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 5633312..f6e1816 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -267,8 +267,37 @@ QString PIconView::currentFileName(bool &isDir)const {
267 isDir = it->isDir(); 267 isDir = it->isDir();
268 return it->path(); 268 return it->path();
269} 269}
270 270
271QString PIconView::nextFileName(bool &isDir)const
272{
273 isDir = false;
274 QIconViewItem* _it1 = m_view->currentItem();
275 if ( !_it1 )
276 return QString::null;
277 QIconViewItem* _it = _it1->nextItem();
278 if ( !_it )
279 return QString::null;
280 IconViewItem* it = static_cast<IconViewItem*>( _it );
281 isDir = it->isDir();
282 m_view->setCurrentItem(_it);
283 return it->path();
284}
285
286QString PIconView::prevFileName(bool &isDir)const{
287 isDir = false;
288 QIconViewItem* _it = m_view->currentItem();
289 if ( !_it )
290 return QString::null;
291 _it = _it->prevItem();
292 if ( !_it )
293 return QString::null;
294 IconViewItem* it = static_cast<IconViewItem*>( _it );
295 isDir = it->isDir();
296 m_view->setCurrentItem(_it);
297 return it->path();
298}
299
271void PIconView::slotTrash() { 300void PIconView::slotTrash() {
272 bool isDir; 301 bool isDir;
273 QString pa = currentFileName( isDir ); 302 QString pa = currentFileName( isDir );
274 if ( isDir && pa.isEmpty() ) 303 if ( isDir && pa.isEmpty() )
@@ -445,8 +474,27 @@ void PIconView::slotEnd() {
445 m_view->viewport()->setUpdatesEnabled( true ); 474 m_view->viewport()->setUpdatesEnabled( true );
446 m_updatet = false; 475 m_updatet = false;
447} 476}
448 477
478void PIconView::slotShowNext()
479{
480 bool isDir = false;
481 QString name = nextFileName(isDir);
482 if (isDir) return;
483 if (name.isEmpty()) return;
484 odebug << "Show next: " << name << oendl;
485 slotShowImage(name);
486}
487
488void PIconView::slotShowPrev()
489{
490 bool isDir = false;
491 QString name = prevFileName(isDir);
492 if (isDir) return;
493 if (name.isEmpty()) return;
494 slotShowImage(name);
495}
496
449void PIconView::slotShowImage() 497void PIconView::slotShowImage()
450{ 498{
451 bool isDir = false; 499 bool isDir = false;
452 QString name = currentFileName(isDir); 500 QString name = currentFileName(isDir);
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 903c4fd..14ad168 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -38,14 +38,20 @@ public:
38signals: 38signals:
39 void sig_showInfo( const QString& ); 39 void sig_showInfo( const QString& );
40 void sig_display( const QString& ); 40 void sig_display( const QString& );
41 41
42public slots:
43 virtual void slotShowNext();
44 virtual void slotShowPrev();
45
42protected: 46protected:
43 void resizeEvent( QResizeEvent* ); 47 void resizeEvent( QResizeEvent* );
44 48
45private: 49private:
46 void initKeys(); 50 void initKeys();
47 QString currentFileName(bool &isDir)const; 51 QString currentFileName(bool &isDir)const;
52 QString nextFileName(bool &isDir)const;
53 QString prevFileName(bool &isDir)const;
48 void loadViews(); 54 void loadViews();
49 void calculateGrid(); 55 void calculateGrid();
50 56
51private slots: 57private slots:
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index db3ae74..aa2b9bc 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -49,12 +49,37 @@ void ImageView::initKeys()
49 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 49 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
50 Resource::loadPixmap("1to1"), ViewInfo, 50 Resource::loadPixmap("1to1"), ViewInfo,
51 Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton), 51 Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton),
52 this, SLOT(slotShowImageInfo()))); 52 this, SLOT(slotShowImageInfo())));
53#if 0
54 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Next image"), "nextimage",
55 Resource::loadPixmap("next"), ViewInfo,
56 Opie::Core::OKeyPair(Qt::Key_N,0),
57 this, SLOT(slotDispNext())));
58#endif
53 m_viewManager->handleWidget( this ); 59 m_viewManager->handleWidget( this );
54 m_viewManager->load(); 60 m_viewManager->load();
55} 61}
56 62
63void ImageView::keyReleaseEvent(QKeyEvent * e)
64{
65 if (!e || e->state()!=0) {
66 return;
67 }
68 if (e->key()==Qt::Key_N) slotDispNext();
69 if (e->key()==Qt::Key_P) slotDispPrev();
70}
71
72void ImageView::slotDispNext()
73{
74 emit dispNext();
75}
76
77void ImageView::slotDispPrev()
78{
79 emit dispPrev();
80}
81
57void ImageView::slotShowImageInfo() 82void ImageView::slotShowImageInfo()
58{ 83{
59 emit dispImageInfo(m_lastName); 84 emit dispImageInfo(m_lastName);
60} 85}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 1790c4f..f467f00 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -24,13 +24,18 @@ public:
24 Opie::Core::OKeyConfigManager* manager(); 24 Opie::Core::OKeyConfigManager* manager();
25 25
26signals: 26signals:
27 void dispImageInfo(const QString&); 27 void dispImageInfo(const QString&);
28 void dispNext();
29 void dispPrev();
28 30
29protected: 31protected:
30 Opie::Core::OConfig * m_cfg; 32 Opie::Core::OConfig * m_cfg;
31 Opie::Core::OKeyConfigManager*m_viewManager; 33 Opie::Core::OKeyConfigManager*m_viewManager;
32 void initKeys(); 34 void initKeys();
33protected slots: 35protected slots:
34 virtual void slotShowImageInfo(); 36 virtual void slotShowImageInfo();
37 virtual void slotDispNext();
38 virtual void slotDispPrev();
39 virtual void keyReleaseEvent(QKeyEvent * e);
35}; 40};
36#endif 41#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 09f562a..57be247 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -265,8 +265,10 @@ void PMainWindow::initDisp() {
265 m_disp->setAutoScale(autoScale); 265 m_disp->setAutoScale(autoScale);
266 m_disp->setAutoRotate(autoRotate); 266 m_disp->setAutoRotate(autoRotate);
267 m_disp->setShowZoomer(zoomerOn); 267 m_disp->setShowZoomer(zoomerOn);
268 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 268 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
269 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
270 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
269 } 271 }
270} 272}
271 273
272/** 274/**