author | alwin <alwin> | 2004-04-15 16:14:56 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-15 16:14:56 (UTC) |
commit | a002be54e33d64e69c7edf2960d5e68a9a0609e4 (patch) (unidiff) | |
tree | c58f7bce41920a86f077d0c371bcf166a03d6489 | |
parent | fd31b11688704c214034a0e28ca7c0a56a6a2988 (diff) | |
download | opie-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)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 48 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 25 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 2 |
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 | |||
@@ -268,6 +268,35 @@ QString PIconView::currentFileName(bool &isDir)const { | |||
268 | return it->path(); | 268 | return it->path(); |
269 | } | 269 | } |
270 | 270 | ||
271 | QString 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 | |||
286 | QString 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 | |||
271 | void PIconView::slotTrash() { | 300 | void PIconView::slotTrash() { |
272 | bool isDir; | 301 | bool isDir; |
273 | QString pa = currentFileName( isDir ); | 302 | QString pa = currentFileName( isDir ); |
@@ -446,6 +475,25 @@ void PIconView::slotEnd() { | |||
446 | m_updatet = false; | 475 | m_updatet = false; |
447 | } | 476 | } |
448 | 477 | ||
478 | void 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 | |||
488 | void 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 | |||
449 | void PIconView::slotShowImage() | 497 | void PIconView::slotShowImage() |
450 | { | 498 | { |
451 | bool isDir = false; | 499 | bool isDir = false; |
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 | |||
@@ -39,12 +39,18 @@ signals: | |||
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 | ||
42 | public slots: | ||
43 | virtual void slotShowNext(); | ||
44 | virtual void slotShowPrev(); | ||
45 | |||
42 | protected: | 46 | protected: |
43 | void resizeEvent( QResizeEvent* ); | 47 | void resizeEvent( QResizeEvent* ); |
44 | 48 | ||
45 | private: | 49 | private: |
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 | ||
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 | |||
@@ -50,10 +50,35 @@ void ImageView::initKeys() | |||
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 | ||
63 | void 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 | |||
72 | void ImageView::slotDispNext() | ||
73 | { | ||
74 | emit dispNext(); | ||
75 | } | ||
76 | |||
77 | void ImageView::slotDispPrev() | ||
78 | { | ||
79 | emit dispPrev(); | ||
80 | } | ||
81 | |||
57 | void ImageView::slotShowImageInfo() | 82 | void ImageView::slotShowImageInfo() |
58 | { | 83 | { |
59 | emit dispImageInfo(m_lastName); | 84 | emit dispImageInfo(m_lastName); |
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 | |||
@@ -25,6 +25,8 @@ public: | |||
25 | 25 | ||
26 | signals: | 26 | signals: |
27 | void dispImageInfo(const QString&); | 27 | void dispImageInfo(const QString&); |
28 | void dispNext(); | ||
29 | void dispPrev(); | ||
28 | 30 | ||
29 | protected: | 31 | protected: |
30 | Opie::Core::OConfig * m_cfg; | 32 | Opie::Core::OConfig * m_cfg; |
@@ -32,5 +34,8 @@ protected: | |||
32 | void initKeys(); | 34 | void initKeys(); |
33 | protected slots: | 35 | protected 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 | |||
@@ -266,6 +266,8 @@ void PMainWindow::initDisp() { | |||
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 | ||