author | alwin <alwin> | 2004-11-10 23:42:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-10 23:42:14 (UTC) |
commit | 79060b829e9231cddc0acfe2dd2b7da3f13dfbc4 (patch) (unidiff) | |
tree | 0e7a6a344bfce1aaf76bedd939a9765014f6ec09 | |
parent | a57e46d9b290712fa1ff106a1be133f4f9751a96 (diff) | |
download | opie-79060b829e9231cddc0acfe2dd2b7da3f13dfbc4.zip opie-79060b829e9231cddc0acfe2dd2b7da3f13dfbc4.tar.gz opie-79060b829e9231cddc0acfe2dd2b7da3f13dfbc4.tar.bz2 |
lister modules can insert special widgets.
doc_dirlister will insert a category select widget
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 22 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/iface/dirlister.h | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/iface/dirview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_dirview.h | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 41 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 7 |
12 files changed, 91 insertions, 8 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 5472ead..948477c 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -182,38 +182,39 @@ namespace { | |||
182 | 182 | ||
183 | 183 | ||
184 | /* | 184 | /* |
185 | * Set up the GUI.. initialize the slave set up gui | 185 | * Set up the GUI.. initialize the slave set up gui |
186 | * and also load a dir | 186 | * and also load a dir |
187 | */ | 187 | */ |
188 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 188 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
189 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 189 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
190 | { | 190 | { |
191 | { | 191 | { |
192 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 192 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
193 | } | 193 | } |
194 | m_path = QDir::homeDirPath(); | 194 | m_path = QDir::homeDirPath(); |
195 | m_mode = 0; | 195 | m_mode = 0; |
196 | m_iconsize = 32; | 196 | m_iconsize = 32; |
197 | m_internalReset = false; | 197 | m_internalReset = false; |
198 | m_customWidget = 0; | ||
198 | 199 | ||
199 | QHBox *hbox = new QHBox( this ); | 200 | m_hbox = new QHBox( this ); |
200 | QLabel* lbl = new QLabel( hbox ); | 201 | QLabel* lbl = new QLabel( m_hbox ); |
201 | lbl->setText( tr("View as" ) ); | 202 | lbl->setText( tr("View as" ) ); |
202 | 203 | ||
203 | m_views = new QComboBox( hbox, "View As" ); | 204 | m_views = new QComboBox( m_hbox, "View As" ); |
204 | 205 | ||
205 | m_view= new QIconView( this ); | 206 | m_view= new QIconView( this ); |
206 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 207 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
207 | this, SLOT(slotClicked(QIconViewItem*)) ); | 208 | this, SLOT(slotClicked(QIconViewItem*)) ); |
208 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 209 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
209 | this, SLOT(slotClicked(QIconViewItem*)) ); | 210 | this, SLOT(slotClicked(QIconViewItem*)) ); |
210 | 211 | ||
211 | m_view->setArrangement( QIconView::LeftToRight ); | 212 | m_view->setArrangement( QIconView::LeftToRight ); |
212 | 213 | ||
213 | m_mode = m_cfg->readNumEntry("ListViewMode", 1); | 214 | m_mode = m_cfg->readNumEntry("ListViewMode", 1); |
214 | QString lastView = m_cfg->readEntry("LastView",""); | 215 | QString lastView = m_cfg->readEntry("LastView",""); |
215 | 216 | ||
216 | if (m_mode < 1 || m_mode>3) m_mode = 1; | 217 | if (m_mode < 1 || m_mode>3) m_mode = 1; |
217 | 218 | ||
218 | m_view->setItemTextPos( QIconView::Right ); | 219 | m_view->setItemTextPos( QIconView::Right ); |
219 | if (m_mode >1) { | 220 | if (m_mode >1) { |
@@ -436,63 +437,74 @@ void PIconView::resetView() { | |||
436 | } else { | 437 | } else { |
437 | m_iconsize = 64; | 438 | m_iconsize = 64; |
438 | } | 439 | } |
439 | slotViewChanged(m_views->currentItem()); | 440 | slotViewChanged(m_views->currentItem()); |
440 | m_internalReset = false; | 441 | m_internalReset = false; |
441 | } | 442 | } |
442 | 443 | ||
443 | /* | 444 | /* |
444 | *swicth view reloadDir and connect signals | 445 | *swicth view reloadDir and connect signals |
445 | */ | 446 | */ |
446 | void PIconView::slotViewChanged( int i) { | 447 | void PIconView::slotViewChanged( int i) { |
447 | if (!m_views->count() ) { | 448 | if (!m_views->count() ) { |
448 | setCurrentView( 0l); | 449 | setCurrentView( 0l); |
449 | return; | 450 | return; |
450 | } | 451 | } |
451 | 452 | ||
453 | if (m_customWidget) { | ||
454 | delete m_customWidget; | ||
455 | m_customWidget = 0; | ||
456 | } | ||
452 | PDirView* cur = currentView(); | 457 | PDirView* cur = currentView(); |
453 | if (cur) delete cur; | 458 | if (cur) { |
459 | delete cur; | ||
460 | } | ||
454 | QString str = m_views->text(i); | 461 | QString str = m_views->text(i); |
455 | ViewMap* map = viewMap(); | 462 | ViewMap* map = viewMap(); |
456 | if (!map) { | 463 | if (!map) { |
457 | setCurrentView(0l); | 464 | setCurrentView(0l); |
458 | return; | 465 | return; |
459 | } | 466 | } |
460 | 467 | ||
461 | if (map->find(str) == map->end()) { | 468 | if (map->find(str) == map->end()) { |
462 | owarn << "Key not found" << oendl; | 469 | owarn << "Key not found" << oendl; |
463 | setCurrentView(0l); | 470 | setCurrentView(0l); |
464 | return; | 471 | return; |
465 | } | 472 | } |
466 | 473 | ||
467 | m_cfg->writeEntry("LastView",str); | 474 | m_cfg->writeEntry("LastView",str); |
468 | m_cfg->write(); | 475 | m_cfg->write(); |
469 | cur = (*(*map)[str])(*m_cfg); | 476 | cur = (*(*map)[str])(*m_cfg); |
470 | setCurrentView( cur ); | 477 | setCurrentView( cur ); |
478 | m_customWidget = cur->widget(m_hbox); | ||
479 | if (m_customWidget) { | ||
480 | odebug << "Got a widget" << oendl; | ||
481 | m_customWidget->show(); | ||
482 | } | ||
471 | 483 | ||
472 | /* connect to the signals of the lister */ | 484 | /* connect to the signals of the lister */ |
473 | PDirLister* lis = cur->dirLister(); | 485 | PDirLister* lis = cur->dirLister(); |
474 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), | 486 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), |
475 | this, SLOT( slotThumbInfo(const QString&, const QString&))); | 487 | this, SLOT( slotThumbInfo(const QString&, const QString&))); |
476 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 488 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
477 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 489 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
478 | connect(lis, SIGNAL(sig_start()), | 490 | connect(lis, SIGNAL(sig_start()), |
479 | this, SLOT(slotStart())); | 491 | this, SLOT(slotStart())); |
480 | connect(lis, SIGNAL(sig_end()) , | 492 | connect(lis, SIGNAL(sig_end()) , |
481 | this, SLOT(slotEnd()) ); | 493 | this, SLOT(slotEnd()) ); |
482 | 494 | connect(lis,SIGNAL(sig_reloadDir()),this,SLOT(slotReloadDir())); | |
483 | 495 | ||
484 | /* reload now with default Path | 496 | /* reload now with default Path |
485 | * but only if it isn't a reset like from setupdlg | 497 | * but only if it isn't a reset like from setupdlg |
486 | */ | 498 | */ |
487 | if (!m_internalReset) { | 499 | if (!m_internalReset) { |
488 | m_path = lis->defaultPath(); | 500 | m_path = lis->defaultPath(); |
489 | } | 501 | } |
490 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); | 502 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); |
491 | } | 503 | } |
492 | 504 | ||
493 | 505 | ||
494 | void PIconView::slotReloadDir() { | 506 | void PIconView::slotReloadDir() { |
495 | slotChangeDir( m_path ); | 507 | slotChangeDir( m_path ); |
496 | } | 508 | } |
497 | 509 | ||
498 | 510 | ||
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index b018c51..78dda58 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h | |||
@@ -84,19 +84,21 @@ private slots: | |||
84 | 84 | ||
85 | /**/ | 85 | /**/ |
86 | void slotThumbInfo(const QString&, const QString&); | 86 | void slotThumbInfo(const QString&, const QString&); |
87 | void slotThumbNail(const QString&, const QPixmap&); | 87 | void slotThumbNail(const QString&, const QPixmap&); |
88 | 88 | ||
89 | void slotChangeMode( int ); | 89 | void slotChangeMode( int ); |
90 | private: | 90 | private: |
91 | Opie::Core::OKeyConfigManager *m_viewManager; | 91 | Opie::Core::OKeyConfigManager *m_viewManager; |
92 | Opie::Core::OConfig *m_cfg; | 92 | Opie::Core::OConfig *m_cfg; |
93 | QComboBox* m_views; | 93 | QComboBox* m_views; |
94 | QIconView* m_view; | 94 | QIconView* m_view; |
95 | QString m_path; | 95 | QString m_path; |
96 | bool m_updatet : 1; | 96 | bool m_updatet : 1; |
97 | int m_mode; | 97 | int m_mode; |
98 | bool m_internalReset:1; | 98 | bool m_internalReset:1; |
99 | int m_iconsize; | 99 | int m_iconsize; |
100 | QHBox*m_hbox; | ||
101 | QWidget*m_customWidget; | ||
100 | }; | 102 | }; |
101 | 103 | ||
102 | #endif | 104 | #endif |
diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h index 68e8495..6997f52 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.h +++ b/noncore/graphics/opie-eye/iface/dirlister.h | |||
@@ -31,22 +31,23 @@ public slots: | |||
31 | virtual void deleteImage( const QString& ) = 0; | 31 | virtual void deleteImage( const QString& ) = 0; |
32 | virtual void imageInfo( const QString&) = 0; | 32 | virtual void imageInfo( const QString&) = 0; |
33 | virtual void fullImageInfo( const QString& ) = 0; | 33 | virtual void fullImageInfo( const QString& ) = 0; |
34 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; | 34 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; |
35 | virtual QImage image( const QString&, Factor, int max = 0) = 0; | 35 | virtual QImage image( const QString&, Factor, int max = 0) = 0; |
36 | 36 | ||
37 | 37 | ||
38 | signals: | 38 | signals: |
39 | void sig_dirchanged(); | 39 | void sig_dirchanged(); |
40 | void sig_filechanged(); | 40 | void sig_filechanged(); |
41 | void sig_start(); | 41 | void sig_start(); |
42 | void sig_end(); | 42 | void sig_end(); |
43 | // If this app ever happens to get multithreaded... | 43 | // If this app ever happens to get multithreaded... |
44 | void sig_thumbInfo( const QString&, const QString& ); | 44 | void sig_thumbInfo( const QString&, const QString& ); |
45 | void sig_fullInfo( const QString&, const QString& ); | 45 | void sig_fullInfo( const QString&, const QString& ); |
46 | void sig_thumbNail( const QString&, const QPixmap& ); | 46 | void sig_thumbNail( const QString&, const QPixmap& ); |
47 | void sig_reloadDir(); | ||
47 | 48 | ||
48 | protected: | 49 | protected: |
49 | virtual ~PDirLister(); | 50 | virtual ~PDirLister(); |
50 | }; | 51 | }; |
51 | 52 | ||
52 | #endif | 53 | #endif |
diff --git a/noncore/graphics/opie-eye/iface/dirview.h b/noncore/graphics/opie-eye/iface/dirview.h index 20d9062..3c05b60 100644 --- a/noncore/graphics/opie-eye/iface/dirview.h +++ b/noncore/graphics/opie-eye/iface/dirview.h | |||
@@ -1,36 +1,38 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef PHUNK_DIR_VIEW_H | 6 | #ifndef PHUNK_DIR_VIEW_H |
7 | #define PHUNK_DIR_VIEW_H | 7 | #define PHUNK_DIR_VIEW_H |
8 | 8 | ||
9 | #include <qmap.h> | 9 | #include <qmap.h> |
10 | 10 | ||
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | 12 | ||
13 | class PInterfaceInfo; | 13 | class PInterfaceInfo; |
14 | class PDirLister; | 14 | class PDirLister; |
15 | class QWidget; | ||
15 | 16 | ||
16 | struct PDirView { | 17 | struct PDirView { |
17 | PDirView( const Config& ); | 18 | PDirView( const Config& ); |
18 | virtual ~PDirView(); | 19 | virtual ~PDirView(); |
19 | virtual PInterfaceInfo* interfaceInfo()const = 0; | 20 | virtual PInterfaceInfo* interfaceInfo()const = 0; |
20 | virtual PDirLister* dirLister()const = 0; | 21 | virtual PDirLister* dirLister()const = 0; |
22 | virtual QWidget* widget(QWidget*)=0; | ||
21 | }; | 23 | }; |
22 | 24 | ||
23 | typedef PDirView* (*phunkViewCreateFunc )(const Config& ); | 25 | typedef PDirView* (*phunkViewCreateFunc )(const Config& ); |
24 | typedef QMap<QString,phunkViewCreateFunc> ViewMap; | 26 | typedef QMap<QString,phunkViewCreateFunc> ViewMap; |
25 | 27 | ||
26 | ViewMap* viewMap(); | 28 | ViewMap* viewMap(); |
27 | PDirView* currentView(); | 29 | PDirView* currentView(); |
28 | void setCurrentView( PDirView* ); | 30 | void setCurrentView( PDirView* ); |
29 | 31 | ||
30 | 32 | ||
31 | 33 | ||
32 | #define PHUNK_VIEW_INTERFACE( NAME, IMPL ) \ | 34 | #define PHUNK_VIEW_INTERFACE( NAME, IMPL ) \ |
33 | static PDirView *create_ ## IMPL( const Config& cfg ) { \ | 35 | static PDirView *create_ ## IMPL( const Config& cfg ) { \ |
34 | return new IMPL( cfg ); \ | 36 | return new IMPL( cfg ); \ |
35 | } \ | 37 | } \ |
36 | static ViewMap::Iterator dummy_ ## IMPL = viewMap()->insert( NAME, create_ ## IMPL ); | 38 | static ViewMap::Iterator dummy_ ## IMPL = viewMap()->insert( NAME, create_ ## IMPL ); |
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp index e55c27a..3f6044f 100644 --- a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp | |||
@@ -13,16 +13,21 @@ DCIM_DirView::~DCIM_DirView() | |||
13 | {} | 13 | {} |
14 | 14 | ||
15 | PInterfaceInfo* DCIM_DirView::interfaceInfo()const { | 15 | PInterfaceInfo* DCIM_DirView::interfaceInfo()const { |
16 | if ( !m_info ) | 16 | if ( !m_info ) |
17 | m_info = new DCIM_InterfaceInfo; | 17 | m_info = new DCIM_InterfaceInfo; |
18 | 18 | ||
19 | return m_info; | 19 | return m_info; |
20 | } | 20 | } |
21 | 21 | ||
22 | 22 | ||
23 | PDirLister* DCIM_DirView::dirLister()const { | 23 | PDirLister* DCIM_DirView::dirLister()const { |
24 | if ( !m_lister ) | 24 | if ( !m_lister ) |
25 | m_lister = new DCIM_DirLister(); | 25 | m_lister = new DCIM_DirLister(); |
26 | 26 | ||
27 | return m_lister; | 27 | return m_lister; |
28 | } | 28 | } |
29 | |||
30 | QWidget* DCIM_DirView::widget(QWidget*) | ||
31 | { | ||
32 | return 0L; | ||
33 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h index 7fc38ec..8394b34 100644 --- a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h | |||
@@ -4,23 +4,23 @@ | |||
4 | 4 | ||
5 | #ifndef DCIM_DIR_VIEW_H | 5 | #ifndef DCIM_DIR_VIEW_H |
6 | #define DCIM_DIR_VIEW_H | 6 | #define DCIM_DIR_VIEW_H |
7 | 7 | ||
8 | #include <iface/dirview.h> | 8 | #include <iface/dirview.h> |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Implementation for USB Host Digital Cameras | 11 | * Implementation for USB Host Digital Cameras |
12 | * like my Casio QV 500 and boring Yakumo | 12 | * like my Casio QV 500 and boring Yakumo |
13 | */ | 13 | */ |
14 | struct DCIM_DirView : public PDirView { | 14 | struct DCIM_DirView : public PDirView { |
15 | DCIM_DirView( const Config& ); | 15 | DCIM_DirView( const Config& ); |
16 | ~DCIM_DirView(); | 16 | ~DCIM_DirView(); |
17 | 17 | ||
18 | PInterfaceInfo* interfaceInfo()const; | 18 | PInterfaceInfo* interfaceInfo()const; |
19 | PDirLister * dirLister ()const; | 19 | PDirLister * dirLister ()const; |
20 | 20 | virtual QWidget* widget(QWidget*); | |
21 | private: | 21 | private: |
22 | mutable PDirLister *m_lister; | 22 | mutable PDirLister *m_lister; |
23 | mutable PInterfaceInfo *m_info ; | 23 | mutable PInterfaceInfo *m_info ; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #endif | 26 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp index fc502d4..9c2c840 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp | |||
@@ -18,16 +18,21 @@ Dir_DirView::Dir_DirView( const Config& cfg) | |||
18 | Dir_DirView::~Dir_DirView() { | 18 | Dir_DirView::~Dir_DirView() { |
19 | } | 19 | } |
20 | 20 | ||
21 | PInterfaceInfo* Dir_DirView::interfaceInfo()const{ | 21 | PInterfaceInfo* Dir_DirView::interfaceInfo()const{ |
22 | if (!m_info ) { | 22 | if (!m_info ) { |
23 | m_info = new DirInterfaceInfo; | 23 | m_info = new DirInterfaceInfo; |
24 | } | 24 | } |
25 | return m_info; | 25 | return m_info; |
26 | } | 26 | } |
27 | 27 | ||
28 | PDirLister* Dir_DirView::dirLister()const{ | 28 | PDirLister* Dir_DirView::dirLister()const{ |
29 | if (!m_lister ) { | 29 | if (!m_lister ) { |
30 | m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth); | 30 | m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth); |
31 | } | 31 | } |
32 | return m_lister; | 32 | return m_lister; |
33 | } | 33 | } |
34 | |||
35 | QWidget* Dir_DirView::widget(QWidget*) | ||
36 | { | ||
37 | return 0L; | ||
38 | } \ No newline at end of file | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h index 89cf6c9..ae53a5c 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h +++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h | |||
@@ -1,26 +1,27 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 only zecke@handhelds.org | 2 | * GPLv2 only zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef DIR_DIR_VIEW_H | 5 | #ifndef DIR_DIR_VIEW_H |
6 | #define DIR_DIR_VIEW_H | 6 | #define DIR_DIR_VIEW_H |
7 | 7 | ||
8 | #include <iface/dirview.h> | 8 | #include <iface/dirview.h> |
9 | 9 | ||
10 | 10 | ||
11 | struct Dir_DirView : public PDirView { | 11 | struct Dir_DirView : public PDirView { |
12 | Dir_DirView( const Config& ); | 12 | Dir_DirView( const Config& ); |
13 | ~Dir_DirView(); | 13 | ~Dir_DirView(); |
14 | 14 | ||
15 | PInterfaceInfo* interfaceInfo()const; | 15 | PInterfaceInfo* interfaceInfo()const; |
16 | PDirLister* dirLister()const; | 16 | PDirLister* dirLister()const; |
17 | virtual QWidget* widget(QWidget*); | ||
17 | private: | 18 | private: |
18 | bool m_cfg : 1; | 19 | bool m_cfg : 1; |
19 | bool m_recursive:1; | 20 | bool m_recursive:1; |
20 | int m_recursive_depth; | 21 | int m_recursive_depth; |
21 | mutable PDirLister* m_lister; | 22 | mutable PDirLister* m_lister; |
22 | mutable PInterfaceInfo *m_info; | 23 | mutable PInterfaceInfo *m_info; |
23 | }; | 24 | }; |
24 | 25 | ||
25 | 26 | ||
26 | #endif | 27 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp index 0d6e25f..2cc897b 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | |||
@@ -13,16 +13,23 @@ Doc_DirView::Doc_DirView( const Config& cfg) | |||
13 | } | 13 | } |
14 | 14 | ||
15 | Doc_DirView::~Doc_DirView() { | 15 | Doc_DirView::~Doc_DirView() { |
16 | } | 16 | } |
17 | 17 | ||
18 | PInterfaceInfo* Doc_DirView::interfaceInfo()const{ | 18 | PInterfaceInfo* Doc_DirView::interfaceInfo()const{ |
19 | if (!m_info ) | 19 | if (!m_info ) |
20 | m_info =new DocInterfaceInfo; | 20 | m_info =new DocInterfaceInfo; |
21 | return m_info; | 21 | return m_info; |
22 | } | 22 | } |
23 | 23 | ||
24 | PDirLister* Doc_DirView::dirLister()const{ | 24 | PDirLister* Doc_DirView::dirLister()const{ |
25 | if (!m_lister ) | 25 | if (!m_lister ) |
26 | m_lister = new Doc_DirLister(); | 26 | m_lister = new Doc_DirLister(); |
27 | return m_lister; | 27 | return m_lister; |
28 | } | 28 | } |
29 | |||
30 | QWidget* Doc_DirView::widget(QWidget*parent) | ||
31 | { | ||
32 | if (!m_lister) | ||
33 | dirLister(); | ||
34 | return m_lister->widget(parent); | ||
35 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.h b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h index 3a2fd71..55ba6f2 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_dirview.h +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h | |||
@@ -1,24 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 only zecke@handhelds.org | 2 | * GPLv2 only zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef DOC_DIR_VIEW_H | 5 | #ifndef DOC_DIR_VIEW_H |
6 | #define DOC_DIR_VIEW_H | 6 | #define DOC_DIR_VIEW_H |
7 | 7 | ||
8 | #include <iface/dirview.h> | 8 | #include <iface/dirview.h> |
9 | 9 | ||
10 | class Doc_DirLister; | ||
10 | 11 | ||
11 | struct Doc_DirView : public PDirView { | 12 | struct Doc_DirView : public PDirView { |
12 | Doc_DirView( const Config& ); | 13 | Doc_DirView( const Config& ); |
13 | ~Doc_DirView(); | 14 | ~Doc_DirView(); |
14 | 15 | ||
15 | PInterfaceInfo* interfaceInfo()const; | 16 | PInterfaceInfo* interfaceInfo()const; |
16 | PDirLister* dirLister()const; | 17 | PDirLister* dirLister()const; |
18 | QWidget* widget(QWidget*parent); | ||
17 | private: | 19 | private: |
18 | bool m_cfg : 1; | 20 | bool m_cfg : 1; |
19 | mutable PDirLister* m_lister; | 21 | mutable Doc_DirLister* m_lister; |
20 | mutable PInterfaceInfo *m_info; | 22 | mutable PInterfaceInfo *m_info; |
21 | }; | 23 | }; |
22 | 24 | ||
23 | 25 | ||
24 | #endif | 26 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index 722fb95..d60149f 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -1,66 +1,80 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "doc_lister.h" | 5 | #include "doc_lister.h" |
6 | 6 | ||
7 | #include <lib/slavemaster.h> | 7 | #include <lib/slavemaster.h> |
8 | 8 | ||
9 | /* OPIE */ | 9 | /* OPIE */ |
10 | #include <opie2/odebug.h> | 10 | #include <opie2/odebug.h> |
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | #include <qpe/applnk.h> | 13 | #include <qpe/applnk.h> |
14 | 14 | ||
15 | #include <qtopia/private/categories.h> | ||
16 | #include <qtopia/categoryselect.h> | ||
17 | |||
15 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
16 | 19 | ||
17 | /* QT */ | 20 | /* QT */ |
18 | #include <qdir.h> | 21 | #include <qdir.h> |
19 | #include <qfileinfo.h> | 22 | #include <qfileinfo.h> |
20 | 23 | ||
21 | Doc_DirLister::Doc_DirLister() | 24 | Doc_DirLister::Doc_DirLister() |
22 | : PDirLister( "doc_dir_lister" ) | 25 | : PDirLister( "doc_dir_lister" ) |
23 | { | 26 | { |
24 | /* connect the signals */ | 27 | /* connect the signals */ |
28 | m_catFilter = 0; | ||
25 | SlaveMaster* master = SlaveMaster::self(); | 29 | SlaveMaster* master = SlaveMaster::self(); |
26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 30 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 31 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 32 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
29 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 33 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 34 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
31 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 35 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 36 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
33 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 37 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
34 | 38 | ||
35 | m_namemap.clear(); | 39 | m_namemap.clear(); |
36 | m_filemap.clear(); | 40 | m_filemap.clear(); |
37 | } | 41 | } |
38 | 42 | ||
39 | QString Doc_DirLister::defaultPath()const { | 43 | QString Doc_DirLister::defaultPath()const { |
40 | return QString::null; | 44 | return QString::null; |
41 | } | 45 | } |
42 | 46 | ||
47 | bool Doc_DirLister::matchCat(const AppLnk* app) | ||
48 | { | ||
49 | if (!app) return false; | ||
50 | if (m_catFilter==0 || app->categories().contains(m_catFilter) || m_catFilter == -1 && app->categories().count() == 0 ) { | ||
51 | return true; | ||
52 | } | ||
53 | return false; | ||
54 | } | ||
55 | |||
43 | QString Doc_DirLister::setStartPath(const QString&) { | 56 | QString Doc_DirLister::setStartPath(const QString&) { |
44 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 57 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
45 | if (m_namemap.isEmpty()) { | 58 | if (m_namemap.isEmpty()) { |
46 | DocLnkSet ds; | 59 | DocLnkSet ds; |
47 | Global::findDocuments(&ds,Mtype_str); | 60 | Global::findDocuments(&ds,Mtype_str); |
48 | QListIterator<DocLnk> dit(ds.children()); | 61 | QListIterator<DocLnk> dit(ds.children()); |
49 | for( ; dit.current(); ++dit) { | 62 | for( ; dit.current(); ++dit) { |
50 | // if (! (*dit)->isValid()) continue; | 63 | if (! (*dit)->isValid()) continue; |
64 | if (!matchCat((*dit))) continue; | ||
51 | m_namemap[(*dit)->name()]=(*dit)->file(); | 65 | m_namemap[(*dit)->name()]=(*dit)->file(); |
52 | m_filemap[(*dit)->file()]=(*dit)->name(); | 66 | m_filemap[(*dit)->file()]=(*dit)->name(); |
53 | } | 67 | } |
54 | } | 68 | } |
55 | return QString::null; | 69 | return QString::null; |
56 | } | 70 | } |
57 | 71 | ||
58 | QString Doc_DirLister::currentPath()const { | 72 | QString Doc_DirLister::currentPath()const { |
59 | return QString::null; | 73 | return QString::null; |
60 | } | 74 | } |
61 | 75 | ||
62 | 76 | ||
63 | QStringList Doc_DirLister::folders()const { | 77 | QStringList Doc_DirLister::folders()const { |
64 | return QStringList(); | 78 | return QStringList(); |
65 | } | 79 | } |
66 | 80 | ||
@@ -134,16 +148,41 @@ void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | |||
134 | } | 148 | } |
135 | QString name = m_filemap[f]; | 149 | QString name = m_filemap[f]; |
136 | emit sig_thumbNail(name, p); | 150 | emit sig_thumbNail(name, p); |
137 | } | 151 | } |
138 | 152 | ||
139 | QString Doc_DirLister::nameToFname(const QString&name)const | 153 | QString Doc_DirLister::nameToFname(const QString&name)const |
140 | { | 154 | { |
141 | if (m_namemap.find(name)==m_namemap.end()) { | 155 | if (m_namemap.find(name)==m_namemap.end()) { |
142 | return QString::null; | 156 | return QString::null; |
143 | } | 157 | } |
144 | return m_namemap[name]; | 158 | return m_namemap[name]; |
145 | } | 159 | } |
146 | 160 | ||
147 | QString Doc_DirLister::dirUp( const QString& p ) const{ | 161 | QString Doc_DirLister::dirUp( const QString& p ) const{ |
148 | return p; | 162 | return p; |
149 | } | 163 | } |
164 | |||
165 | QWidget* Doc_DirLister::widget(QWidget*parent) | ||
166 | { | ||
167 | CategorySelect * catmb = new CategorySelect(parent); | ||
168 | Categories cats( 0 ); | ||
169 | cats.load( categoryFileName() ); | ||
170 | QArray<int> vl( 0 ); | ||
171 | catmb->setCategories( vl, "Document View", // No tr | ||
172 | "Document View" ); | ||
173 | catmb->setRemoveCategoryEdit( TRUE ); | ||
174 | catmb->setAllCategories( TRUE ); | ||
175 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); | ||
176 | catmb->setCurrentCategory(-2); | ||
177 | return catmb; | ||
178 | } | ||
179 | |||
180 | void Doc_DirLister::showCategory(int which) | ||
181 | { | ||
182 | Categories cat; | ||
183 | cat.load( categoryFileName() ); | ||
184 | m_catFilter = which==-2?0:which; | ||
185 | m_namemap.clear(); | ||
186 | setStartPath(""); | ||
187 | emit sig_reloadDir(); | ||
188 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h index 5884a35..e148ac0 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.h +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h | |||
@@ -1,42 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H | 5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H |
6 | #define DOC_LISTER_INTERFACE_LISTER_H | 6 | #define DOC_LISTER_INTERFACE_LISTER_H |
7 | 7 | ||
8 | #include <iface/dirlister.h> | 8 | #include <iface/dirlister.h> |
9 | 9 | ||
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qmap.h> | 11 | #include <qmap.h> |
12 | 12 | ||
13 | class Config; | 13 | class Config; |
14 | class AppLnk; | ||
15 | |||
14 | class Doc_DirLister : public PDirLister { | 16 | class Doc_DirLister : public PDirLister { |
15 | Q_OBJECT | 17 | Q_OBJECT |
16 | public: | 18 | public: |
17 | Doc_DirLister(); | 19 | Doc_DirLister(); |
18 | virtual ~Doc_DirLister(){} | 20 | virtual ~Doc_DirLister(){} |
19 | 21 | ||
20 | QString defaultPath()const; | 22 | QString defaultPath()const; |
21 | QString setStartPath( const QString& ); | 23 | QString setStartPath( const QString& ); |
22 | QString currentPath()const; | 24 | QString currentPath()const; |
23 | QStringList folders()const; | 25 | QStringList folders()const; |
24 | QStringList files()const; | 26 | QStringList files()const; |
25 | 27 | ||
26 | void deleteImage( const QString& ); | 28 | void deleteImage( const QString& ); |
27 | void thumbNail( const QString&, int, int ); | 29 | void thumbNail( const QString&, int, int ); |
28 | QImage image( const QString&, Factor, int ); | 30 | QImage image( const QString&, Factor, int ); |
29 | void imageInfo( const QString& ); | 31 | void imageInfo( const QString& ); |
30 | void fullImageInfo( const QString& ); | 32 | void fullImageInfo( const QString& ); |
31 | virtual QString nameToFname(const QString&name)const; | 33 | virtual QString nameToFname(const QString&name)const; |
32 | QString dirUp( const QString& )const; | 34 | QString dirUp( const QString& )const; |
35 | QWidget* widget(QWidget*parent); | ||
33 | 36 | ||
34 | private: | 37 | private: |
35 | QMap<QString,QString> m_namemap,m_filemap; | 38 | QMap<QString,QString> m_namemap,m_filemap; |
39 | int m_catFilter; | ||
40 | bool matchCat(const AppLnk* app); | ||
41 | |||
36 | protected slots: | 42 | protected slots: |
37 | virtual void slotFullInfo(const QString&, const QString&); | 43 | virtual void slotFullInfo(const QString&, const QString&); |
38 | virtual void slotThumbInfo(const QString&, const QString&); | 44 | virtual void slotThumbInfo(const QString&, const QString&); |
39 | virtual void slotThumbNail(const QString&, const QPixmap&); | 45 | virtual void slotThumbNail(const QString&, const QPixmap&); |
46 | virtual void showCategory(int); | ||
40 | }; | 47 | }; |
41 | 48 | ||
42 | #endif | 49 | #endif |