author | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
commit | 81cd1a4a916fb00b6c8867bdc1d945db155b12c0 (patch) (unidiff) | |
tree | ce302c254c8c2160a86ffc0a5abe6cfd51fd33b3 /noncore/graphics/opie-eye | |
parent | ac414fa3802b471857bc84ecdd0d37200541b0a7 (diff) | |
download | opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.zip opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.gz opie-81cd1a4a916fb00b6c8867bdc1d945db155b12c0.tar.bz2 |
- added DocView mode
- fixed a bug in iconview and some small fixes more
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 31 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/iface/dirlister.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | 28 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_dirview.h | 24 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | 57 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h | 21 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 148 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 42 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 8 |
13 files changed, 362 insertions, 17 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 660c4fa..087db30 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -344,9 +344,9 @@ void PIconView::slotTrash() { | |||
344 | void PIconView::loadViews() { | 344 | void PIconView::loadViews() { |
345 | ViewMap::Iterator it; | 345 | ViewMap::Iterator it; |
346 | ViewMap* map = viewMap(); | 346 | ViewMap* map = viewMap(); |
347 | for ( it = map->begin(); it != map->end(); ++it ) | 347 | for ( it = map->begin(); it != map->end(); ++it ) |
348 | m_views->insertItem( QObject::tr(it.key() ) ); | 348 | m_views->insertItem( it.key() ); |
349 | } | 349 | } |
350 | 350 | ||
351 | void PIconView::resetView() { | 351 | void PIconView::resetView() { |
352 | slotViewChanged(m_views->currentItem()); | 352 | slotViewChanged(m_views->currentItem()); |
@@ -361,11 +361,17 @@ void PIconView::slotViewChanged( int i) { | |||
361 | return; | 361 | return; |
362 | } | 362 | } |
363 | 363 | ||
364 | PDirView* cur = currentView(); | 364 | PDirView* cur = currentView(); |
365 | delete cur; | 365 | if (cur) delete cur; |
366 | QString str = m_views->text(i); | 366 | QString str = m_views->text(i); |
367 | cur = (*(*viewMap())[str])(*m_cfg); | 367 | ViewMap* map = viewMap(); |
368 | if (!map) {setCurrentView(0l); return;} | ||
369 | if (map->find(str) == map->end()) { | ||
370 | owarn << "Key not found" << oendl; | ||
371 | setCurrentView(0l); return; | ||
372 | } | ||
373 | cur = (*(*map)[str])(*m_cfg); | ||
368 | setCurrentView( cur ); | 374 | setCurrentView( cur ); |
369 | 375 | ||
370 | /* connect to the signals of the lister */ | 376 | /* connect to the signals of the lister */ |
371 | PDirLister* lis = cur->dirLister(); | 377 | PDirLister* lis = cur->dirLister(); |
@@ -405,11 +411,15 @@ void PIconView::addFolders( const QStringList& lst) { | |||
405 | void PIconView::addFiles( const QStringList& lst) { | 411 | void PIconView::addFiles( const QStringList& lst) { |
406 | QStringList::ConstIterator it; | 412 | QStringList::ConstIterator it; |
407 | IconViewItem * _iv; | 413 | IconViewItem * _iv; |
408 | QPixmap*m_pix = 0; | 414 | QPixmap*m_pix = 0; |
415 | QString pre = ""; | ||
416 | if (!m_path.isEmpty()) { | ||
417 | pre = m_path+"/"; | ||
418 | } | ||
409 | for (it=lst.begin(); it!= lst.end(); ++it ) { | 419 | for (it=lst.begin(); it!= lst.end(); ++it ) { |
410 | m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 ); | 420 | m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 ); |
411 | _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); | 421 | _iv = new IconViewItem( m_view, pre+(*it), (*it) ); |
412 | if (m_mode==3) { | 422 | if (m_mode==3) { |
413 | _iv->setTextOnly(true); | 423 | _iv->setTextOnly(true); |
414 | _iv->setPixmap(QPixmap()); | 424 | _iv->setPixmap(QPixmap()); |
415 | } else { | 425 | } else { |
@@ -542,13 +552,14 @@ void PIconView::slotShowImage() | |||
542 | { | 552 | { |
543 | bool isDir = false; | 553 | bool isDir = false; |
544 | QString name = currentFileName(isDir); | 554 | QString name = currentFileName(isDir); |
545 | if (isDir) return; | 555 | if (isDir) return; |
546 | |||
547 | slotShowImage( name ); | 556 | slotShowImage( name ); |
548 | } | 557 | } |
549 | void PIconView::slotShowImage( const QString& name) { | 558 | void PIconView::slotShowImage( const QString& name) { |
550 | emit sig_display( name ); | 559 | PDirLister *lister = currentView()->dirLister(); |
560 | QString r_name = lister->nameToFname(name); | ||
561 | emit sig_display( r_name ); | ||
551 | } | 562 | } |
552 | void PIconView::slotImageInfo() { | 563 | void PIconView::slotImageInfo() { |
553 | bool isDir = false; | 564 | bool isDir = false; |
554 | QString name = currentFileName(isDir); | 565 | QString name = currentFileName(isDir); |
@@ -557,9 +568,11 @@ void PIconView::slotImageInfo() { | |||
557 | slotImageInfo( name ); | 568 | slotImageInfo( name ); |
558 | } | 569 | } |
559 | 570 | ||
560 | void PIconView::slotImageInfo( const QString& name) { | 571 | void PIconView::slotImageInfo( const QString& name) { |
561 | emit sig_showInfo( name ); | 572 | PDirLister *lister = currentView()->dirLister(); |
573 | QString r_name = lister->nameToFname(name); | ||
574 | emit sig_showInfo(r_name ); | ||
562 | } | 575 | } |
563 | 576 | ||
564 | 577 | ||
565 | void PIconView::slotChangeMode( int mode ) { | 578 | void PIconView::slotChangeMode( int mode ) { |
@@ -578,10 +591,8 @@ void PIconView::resizeEvent( QResizeEvent* re ) { | |||
578 | } | 591 | } |
579 | 592 | ||
580 | 593 | ||
581 | void PIconView::calculateGrid() { | 594 | void PIconView::calculateGrid() { |
582 | odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; | ||
583 | odebug << "Size of view: " << m_view->size() << oendl; | ||
584 | int dw = QApplication::desktop()->width(); | 595 | int dw = QApplication::desktop()->width(); |
585 | int viewerWidth = dw-style().scrollBarExtent().width(); | 596 | int viewerWidth = dw-style().scrollBarExtent().width(); |
586 | 597 | ||
587 | QIconView::ItemTextPos pos; | 598 | QIconView::ItemTextPos pos; |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 58f02ef..058fca0 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -33,9 +33,10 @@ | |||
33 | #include <qframe.h> | 33 | #include <qframe.h> |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 37 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
38 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | ||
38 | 39 | ||
39 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 40 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
40 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 41 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
41 | { | 42 | { |
diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h index fcc55ec..9c7b2a9 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.h +++ b/noncore/graphics/opie-eye/iface/dirlister.h | |||
@@ -28,8 +28,9 @@ public slots: | |||
28 | virtual void imageInfo( const QString&) = 0; | 28 | virtual void imageInfo( const QString&) = 0; |
29 | virtual void fullImageInfo( const QString& ) = 0; | 29 | virtual void fullImageInfo( const QString& ) = 0; |
30 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; | 30 | virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; |
31 | virtual QImage image( const QString&, Factor, int max = 0) = 0; | 31 | virtual QImage image( const QString&, Factor, int max = 0) = 0; |
32 | virtual QString nameToFname(const QString&name)const = 0; | ||
32 | 33 | ||
33 | signals: | 34 | signals: |
34 | void sig_dirchanged(); | 35 | void sig_dirchanged(); |
35 | void sig_filechanged(); | 36 | void sig_filechanged(); |
@@ -40,8 +41,8 @@ signals: | |||
40 | void sig_fullInfo( const QString&, const QString& ); | 41 | void sig_fullInfo( const QString&, const QString& ); |
41 | void sig_thumbNail( const QString&, const QPixmap& ); | 42 | void sig_thumbNail( const QString&, const QPixmap& ); |
42 | 43 | ||
43 | protected: | 44 | protected: |
44 | ~PDirLister(); | 45 | virtual ~PDirLister(); |
45 | }; | 46 | }; |
46 | 47 | ||
47 | #endif | 48 | #endif |
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h index 8c6262f..c919dde 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h | |||
@@ -5,14 +5,14 @@ | |||
5 | 5 | ||
6 | #ifndef DIR_IFACE_INFO_H | 6 | #ifndef DIR_IFACE_INFO_H |
7 | #define DIR_IFACE_INFO_H | 7 | #define DIR_IFACE_INFO_H |
8 | 8 | ||
9 | #include <iface/ifaceinfo.h>s | 9 | #include <iface/ifaceinfo.h> |
10 | 10 | ||
11 | class DirInterfaceInfo : public PInterfaceInfo { | 11 | class DirInterfaceInfo : public PInterfaceInfo { |
12 | public: | 12 | public: |
13 | DirInterfaceInfo(); | 13 | DirInterfaceInfo(); |
14 | ~DirInterfaceInfo(); | 14 | virtual ~DirInterfaceInfo(); |
15 | 15 | ||
16 | QString name()const; | 16 | QString name()const; |
17 | QWidget* configWidget(const Config&); | 17 | QWidget* configWidget(const Config&); |
18 | void writeConfig( QWidget* wid, Config& ); | 18 | void writeConfig( QWidget* wid, Config& ); |
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index 16758d7..3717297 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | |||
@@ -19,9 +19,9 @@ using namespace Opie::Core; | |||
19 | Dir_DirLister::Dir_DirLister( bool list ) | 19 | Dir_DirLister::Dir_DirLister( bool list ) |
20 | : PDirLister( "dir_dir_lister" ) | 20 | : PDirLister( "dir_dir_lister" ) |
21 | { | 21 | { |
22 | m_allFiles = list; | 22 | m_allFiles = list; |
23 | owarn << "All Files " << m_allFiles << "" << oendl; | 23 | owarn << "All Files " << m_allFiles << "" << oendl; |
24 | 24 | ||
25 | SlaveMaster* master = SlaveMaster::self(); | 25 | SlaveMaster* master = SlaveMaster::self(); |
26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
@@ -94,4 +94,9 @@ void Dir_DirLister::imageInfo( const QString& str) { | |||
94 | 94 | ||
95 | void Dir_DirLister::fullImageInfo( const QString& str) { | 95 | void Dir_DirLister::fullImageInfo( const QString& str) { |
96 | SlaveMaster::self()->imageInfo( str ); | 96 | SlaveMaster::self()->imageInfo( str ); |
97 | } | 97 | } |
98 | |||
99 | QString Dir_DirLister::nameToFname(const QString&name)const | ||
100 | { | ||
101 | return name; | ||
102 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.h b/noncore/graphics/opie-eye/impl/dir/dir_lister.h index fc63bb0..d6ca6c0 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.h +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.h | |||
@@ -10,10 +10,12 @@ | |||
10 | #include <iface/dirlister.h> | 10 | #include <iface/dirlister.h> |
11 | 11 | ||
12 | class Config; | 12 | class Config; |
13 | class Dir_DirLister : public PDirLister { | 13 | class Dir_DirLister : public PDirLister { |
14 | Q_OBJECT | ||
14 | public: | 15 | public: |
15 | Dir_DirLister( bool ); | 16 | Dir_DirLister( bool ); |
17 | virtual ~Dir_DirLister(){} | ||
16 | 18 | ||
17 | QString defaultPath()const; | 19 | QString defaultPath()const; |
18 | QString setStartPath( const QString& ); | 20 | QString setStartPath( const QString& ); |
19 | QString currentPath()const; | 21 | QString currentPath()const; |
@@ -24,8 +26,9 @@ public: | |||
24 | void thumbNail( const QString&, int, int ); | 26 | void thumbNail( const QString&, int, int ); |
25 | QImage image( const QString&, Factor, int ); | 27 | QImage image( const QString&, Factor, int ); |
26 | void imageInfo( const QString& ); | 28 | void imageInfo( const QString& ); |
27 | void fullImageInfo( const QString& ); | 29 | void fullImageInfo( const QString& ); |
30 | virtual QString nameToFname(const QString&name)const; | ||
28 | 31 | ||
29 | private: | 32 | private: |
30 | bool m_allFiles; | 33 | bool m_allFiles; |
31 | QDir m_currentDir; | 34 | QDir m_currentDir; |
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp new file mode 100644 index 0000000..0d6e25f --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #include "doc_lister.h" | ||
2 | #include "doc_ifaceinfo.h" | ||
3 | #include "doc_dirview.h" | ||
4 | |||
5 | PHUNK_VIEW_INTERFACE("Document View", Doc_DirView ); | ||
6 | |||
7 | |||
8 | Doc_DirView::Doc_DirView( const Config& cfg) | ||
9 | : PDirView(cfg) | ||
10 | { | ||
11 | m_lister = 0; | ||
12 | m_info = 0; | ||
13 | } | ||
14 | |||
15 | Doc_DirView::~Doc_DirView() { | ||
16 | } | ||
17 | |||
18 | PInterfaceInfo* Doc_DirView::interfaceInfo()const{ | ||
19 | if (!m_info ) | ||
20 | m_info =new DocInterfaceInfo; | ||
21 | return m_info; | ||
22 | } | ||
23 | |||
24 | PDirLister* Doc_DirView::dirLister()const{ | ||
25 | if (!m_lister ) | ||
26 | m_lister = new Doc_DirLister(); | ||
27 | return m_lister; | ||
28 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_dirview.h b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h new file mode 100644 index 0000000..3a2fd71 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_dirview.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * GPLv2 only zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DOC_DIR_VIEW_H | ||
6 | #define DOC_DIR_VIEW_H | ||
7 | |||
8 | #include <iface/dirview.h> | ||
9 | |||
10 | |||
11 | struct Doc_DirView : public PDirView { | ||
12 | Doc_DirView( const Config& ); | ||
13 | ~Doc_DirView(); | ||
14 | |||
15 | PInterfaceInfo* interfaceInfo()const; | ||
16 | PDirLister* dirLister()const; | ||
17 | private: | ||
18 | bool m_cfg : 1; | ||
19 | mutable PDirLister* m_lister; | ||
20 | mutable PInterfaceInfo *m_info; | ||
21 | }; | ||
22 | |||
23 | |||
24 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp new file mode 100644 index 0000000..a6d6f3c --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #include "doc_ifaceinfo.h" | ||
7 | |||
8 | /* OPIE */ | ||
9 | #include <opie2/odebug.h> | ||
10 | #include <qpe/config.h> | ||
11 | using namespace Opie::Core; | ||
12 | |||
13 | /* QT */ | ||
14 | #include <qwidget.h> | ||
15 | #include <qcheckbox.h> | ||
16 | #include <qhbox.h> | ||
17 | #include <qlabel.h> | ||
18 | |||
19 | #if 0 | ||
20 | namespace { | ||
21 | class DirImageWidget : public QHBox { | ||
22 | public: | ||
23 | DirImageWidget() { | ||
24 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); | ||
25 | } | ||
26 | ~DirImageWidget() {} | ||
27 | QCheckBox* chkbox; | ||
28 | }; | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | DocInterfaceInfo::DocInterfaceInfo() { | ||
33 | } | ||
34 | DocInterfaceInfo::~DocInterfaceInfo() { | ||
35 | } | ||
36 | |||
37 | QString DocInterfaceInfo::name()const { | ||
38 | return QString::fromLatin1(QObject::tr("DocView" )); | ||
39 | } | ||
40 | |||
41 | QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { | ||
42 | #if 0 | ||
43 | DirImageWidget* wid = new DirImageWidget(); | ||
44 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); | ||
45 | |||
46 | return wid; | ||
47 | #endif | ||
48 | return 0L; | ||
49 | } | ||
50 | |||
51 | void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { | ||
52 | #if 0 | ||
53 | owarn << "Write Config" << oendl; | ||
54 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); | ||
55 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); | ||
56 | #endif | ||
57 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h new file mode 100644 index 0000000..73986c9 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #ifndef DOC_IFACE_INFO_H | ||
7 | #define DOC_IFACE_INFO_H | ||
8 | |||
9 | #include <iface/ifaceinfo.h> | ||
10 | |||
11 | class DocInterfaceInfo : public PInterfaceInfo { | ||
12 | public: | ||
13 | DocInterfaceInfo(); | ||
14 | virtual ~DocInterfaceInfo(); | ||
15 | |||
16 | QString name()const; | ||
17 | QWidget* configWidget(const Config&); | ||
18 | void writeConfig( QWidget* wid, Config& ); | ||
19 | }; | ||
20 | |||
21 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp new file mode 100644 index 0000000..f695a76 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #include "doc_lister.h" | ||
6 | |||
7 | #include <lib/slavemaster.h> | ||
8 | |||
9 | /* OPIE */ | ||
10 | #include <opie2/odebug.h> | ||
11 | #include <qpe/config.h> | ||
12 | #include <qpe/qpeapplication.h> | ||
13 | #include <qpe/applnk.h> | ||
14 | |||
15 | using namespace Opie::Core; | ||
16 | |||
17 | /* QT */ | ||
18 | #include <qdir.h> | ||
19 | #include <qfileinfo.h> | ||
20 | |||
21 | Doc_DirLister::Doc_DirLister() | ||
22 | : PDirLister( "doc_dir_lister" ) | ||
23 | { | ||
24 | SlaveMaster* master = SlaveMaster::self(); | ||
25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | ||
26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | ||
27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | ||
28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | ||
29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | ||
31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | ||
32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | ||
33 | |||
34 | } | ||
35 | |||
36 | QString Doc_DirLister::defaultPath()const { | ||
37 | return ""; QPEApplication::documentDir(); | ||
38 | } | ||
39 | |||
40 | QString Doc_DirLister::setStartPath( const QString& path ) { | ||
41 | m_namemap.clear(); | ||
42 | m_out.clear(); | ||
43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | ||
44 | owarn << "Set start path" << oendl; | ||
45 | DocLnkSet ds; | ||
46 | Global::findDocuments(&ds,Mtype_str); | ||
47 | QListIterator<DocLnk> dit(ds.children()); | ||
48 | for( ; dit.current(); ++dit) { | ||
49 | owarn << (*dit)->file() << oendl; | ||
50 | m_namemap[(*dit)->name()]=(*dit)->file(); | ||
51 | m_filemap[(*dit)->file()]=(*dit)->name(); | ||
52 | m_out.append((*dit)->name()); | ||
53 | } | ||
54 | owarn << "Set start path end" << oendl; | ||
55 | return ""; | ||
56 | } | ||
57 | |||
58 | QString Doc_DirLister::currentPath()const { | ||
59 | return ""; | ||
60 | } | ||
61 | |||
62 | |||
63 | QStringList Doc_DirLister::folders()const { | ||
64 | return QStringList(); | ||
65 | } | ||
66 | |||
67 | QStringList Doc_DirLister::files()const { | ||
68 | return m_out; | ||
69 | } | ||
70 | |||
71 | void Doc_DirLister::deleteImage( const QString& ) { | ||
72 | } | ||
73 | |||
74 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | ||
75 | if (m_namemap.find(str)==m_namemap.end()) { | ||
76 | owarn << "Item " << str << " not found" << oendl; | ||
77 | return; | ||
78 | } | ||
79 | QString fname = m_namemap[str]; | ||
80 | SlaveMaster::self()->thumbNail( fname, w, h ); | ||
81 | } | ||
82 | |||
83 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | ||
84 | if (m_namemap.find(str)==m_namemap.end()) { | ||
85 | owarn << "Item " << str << " not found" << oendl; | ||
86 | return QImage(); | ||
87 | } | ||
88 | QString fname = m_namemap[str]; | ||
89 | return SlaveMaster::self()->image( fname, f, m ); | ||
90 | } | ||
91 | |||
92 | void Doc_DirLister::imageInfo( const QString& str) { | ||
93 | if (m_namemap.find(str)==m_namemap.end()) { | ||
94 | owarn << "Item " << str << " not found" << oendl; | ||
95 | return; | ||
96 | } | ||
97 | QString fname = m_namemap[str]; | ||
98 | owarn << "Image info: " << fname << oendl; | ||
99 | SlaveMaster::self()->thumbInfo( fname ); | ||
100 | } | ||
101 | |||
102 | void Doc_DirLister::fullImageInfo( const QString& str) { | ||
103 | if (m_namemap.find(str)==m_namemap.end()) { | ||
104 | owarn << "Item " << str << " not found" << oendl; | ||
105 | return; | ||
106 | } | ||
107 | QString fname = m_namemap[str]; | ||
108 | SlaveMaster::self()->imageInfo( fname ); | ||
109 | } | ||
110 | |||
111 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | ||
112 | { | ||
113 | if (m_filemap.find(f)==m_filemap.end()) { | ||
114 | owarn << "Item " << f << " not found" << oendl; | ||
115 | return; | ||
116 | } | ||
117 | QString name = m_filemap[f]; | ||
118 | emit sig_fullInfo(name, t); | ||
119 | } | ||
120 | |||
121 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | ||
122 | { | ||
123 | if (m_filemap.find(f)==m_filemap.end()) { | ||
124 | owarn << "Item " << f << " not found" << oendl; | ||
125 | return; | ||
126 | } | ||
127 | QString name = m_filemap[f]; | ||
128 | emit sig_thumbInfo(name, t); | ||
129 | } | ||
130 | |||
131 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | ||
132 | { | ||
133 | if (m_filemap.find(f)==m_filemap.end()) { | ||
134 | owarn << "Item " << f << " not found" << oendl; | ||
135 | return; | ||
136 | } | ||
137 | QString name = m_filemap[f]; | ||
138 | emit sig_thumbNail(name, p); | ||
139 | } | ||
140 | |||
141 | QString Doc_DirLister::nameToFname(const QString&name)const | ||
142 | { | ||
143 | if (m_namemap.find(name)==m_namemap.end()) { | ||
144 | owarn << "Item " << name << " not found" << oendl; | ||
145 | return QString::null; | ||
146 | } | ||
147 | return m_namemap[name]; | ||
148 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h new file mode 100644 index 0000000..d89b579 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DOC_LISTER_INTERFACE_LISTER_H | ||
6 | #define DOC_LISTER_INTERFACE_LISTER_H | ||
7 | |||
8 | #include <iface/dirlister.h> | ||
9 | |||
10 | #include <qstring.h> | ||
11 | #include <qmap.h> | ||
12 | |||
13 | class Config; | ||
14 | class Doc_DirLister : public PDirLister { | ||
15 | Q_OBJECT | ||
16 | public: | ||
17 | Doc_DirLister(); | ||
18 | virtual ~Doc_DirLister(){} | ||
19 | |||
20 | QString defaultPath()const; | ||
21 | QString setStartPath( const QString& ); | ||
22 | QString currentPath()const; | ||
23 | QStringList folders()const; | ||
24 | QStringList files()const; | ||
25 | |||
26 | void deleteImage( const QString& ); | ||
27 | void thumbNail( const QString&, int, int ); | ||
28 | QImage image( const QString&, Factor, int ); | ||
29 | void imageInfo( const QString& ); | ||
30 | void fullImageInfo( const QString& ); | ||
31 | virtual QString nameToFname(const QString&name)const; | ||
32 | |||
33 | private: | ||
34 | QMap<QString,QString> m_namemap,m_filemap; | ||
35 | QStringList m_out; | ||
36 | protected slots: | ||
37 | virtual void slotFullInfo(const QString&, const QString&); | ||
38 | virtual void slotThumbInfo(const QString&, const QString&); | ||
39 | virtual void slotThumbNail(const QString&, const QPixmap&); | ||
40 | }; | ||
41 | |||
42 | #endif | ||
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 57e69b6..0a57a0f 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro | |||
@@ -11,9 +11,11 @@ HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ | |||
11 | lib/slavemaster.h \ | 11 | lib/slavemaster.h \ |
12 | iface/slaveiface.h \ | 12 | iface/slaveiface.h \ |
13 | gui/imageinfoui.h \ | 13 | gui/imageinfoui.h \ |
14 | gui/imageview.h \ | 14 | gui/imageview.h \ |
15 | gui/viewmodebutton.h | 15 | gui/viewmodebutton.h \ |
16 | impl/doc/doc_lister.h impl/doc/doc_dirview.h \ | ||
17 | impl/doc/doc_ifaceinfo.h | ||
16 | 18 | ||
17 | # A list header files | 19 | # A list header files |
18 | 20 | ||
19 | 21 | ||
@@ -23,9 +25,11 @@ SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | |||
23 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | 25 | iface/dirview.cpp impl/dir/dir_lister.cpp \ |
24 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ | 26 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ |
25 | gui/imageinfoui.cpp \ | 27 | gui/imageinfoui.cpp \ |
26 | gui/imageview.cpp \ | 28 | gui/imageview.cpp \ |
27 | gui/viewmodebutton.cpp | 29 | gui/viewmodebutton.cpp \ |
30 | impl/doc/doc_lister.cpp impl/doc/doc_dirview.cpp \ | ||
31 | impl/doc/doc_ifaceinfo.cpp | ||
28 | # A list of source files | 32 | # A list of source files |
29 | 33 | ||
30 | INTERFACES = | 34 | INTERFACES = |
31 | # list of ui files | 35 | # list of ui files |