author | zecke <zecke> | 2004-03-22 23:32:41 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-22 23:32:41 (UTC) |
commit | 428b687982966dc2efabaf6dbcc55ad0ea30aa10 (patch) (unidiff) | |
tree | 86da20abd2e4b97a59dc32e17996bde5ee74cc91 /noncore/graphics/opie-eye/impl/dir | |
parent | 7ce623c6351646ce738a81e103632d73c5454ecc (diff) | |
download | opie-428b687982966dc2efabaf6dbcc55ad0ea30aa10.zip opie-428b687982966dc2efabaf6dbcc55ad0ea30aa10.tar.gz opie-428b687982966dc2efabaf6dbcc55ad0ea30aa10.tar.bz2 |
Initial Check in of the Eye Of Zilla. This ImageViewer features
Image Infos, EXIF, Jpeg,Png,Gif support. It supports scaled loading
of Jpegs. an smart image cache....
GUI needs some work and we need to find a bug in QCOP as well.
TODO:
Add Image Service for example Mailer
Add ImageCanvas/Zoomer/Display
Diffstat (limited to 'noncore/graphics/opie-eye/impl/dir') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp | 29 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_dirview.h | 24 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h | 21 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp | 47 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.h | 21 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 94 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.h | 34 |
7 files changed, 270 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp new file mode 100644 index 0000000..97e3dcb --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | #include "dir_lister.h" | ||
2 | #include "dir_ifaceinfo.h" | ||
3 | #include "dir_dirview.h" | ||
4 | |||
5 | PHUNK_VIEW_INTERFACE("Dir View", Dir_DirView ); | ||
6 | |||
7 | |||
8 | Dir_DirView::Dir_DirView( const Config& cfg) | ||
9 | : PDirView(cfg) | ||
10 | { | ||
11 | m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", true); | ||
12 | m_lister = 0; | ||
13 | m_info = 0; | ||
14 | } | ||
15 | |||
16 | Dir_DirView::~Dir_DirView() { | ||
17 | } | ||
18 | |||
19 | PInterfaceInfo* Dir_DirView::interfaceInfo()const{ | ||
20 | if (!m_info ) | ||
21 | m_info =new DirInterfaceInfo; | ||
22 | return m_info; | ||
23 | } | ||
24 | |||
25 | PDirLister* Dir_DirView::dirLister()const{ | ||
26 | if (!m_lister ) | ||
27 | m_lister = new Dir_DirLister(m_cfg); | ||
28 | return m_lister; | ||
29 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h new file mode 100644 index 0000000..3b9b7a6 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * GPLv2 only zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DIR_DIR_VIEW_H | ||
6 | #define DIR_DIR_VIEW_H | ||
7 | |||
8 | #include <iface/dirview.h> | ||
9 | |||
10 | |||
11 | struct Dir_DirView : public PDirView { | ||
12 | Dir_DirView( const Config& ); | ||
13 | ~Dir_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/dir/dir_ifacceinfo.h b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h new file mode 100644 index 0000000..8c6262f --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #ifndef DIR_IFACE_INFO_H | ||
7 | #define DIR_IFACE_INFO_H | ||
8 | |||
9 | #include <iface/ifaceinfo.h>s | ||
10 | |||
11 | class DirInterfaceInfo : public PInterfaceInfo { | ||
12 | public: | ||
13 | DirInterfaceInfo(); | ||
14 | ~DirInterfaceInfo(); | ||
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/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp new file mode 100644 index 0000000..79f4510 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #include <qwidget.h> | ||
7 | #include <qcheckbox.h> | ||
8 | #include <qhbox.h> | ||
9 | #include <qlabel.h> | ||
10 | |||
11 | #include <qpe/config.h> | ||
12 | |||
13 | #include "dir_ifaceinfo.h" | ||
14 | |||
15 | namespace { | ||
16 | class DirImageWidget : public QHBox { | ||
17 | public: | ||
18 | DirImageWidget() { | ||
19 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); | ||
20 | } | ||
21 | ~DirImageWidget() {} | ||
22 | QCheckBox* chkbox; | ||
23 | }; | ||
24 | } | ||
25 | |||
26 | |||
27 | DirInterfaceInfo::DirInterfaceInfo() { | ||
28 | } | ||
29 | DirInterfaceInfo::~DirInterfaceInfo() { | ||
30 | } | ||
31 | |||
32 | QString DirInterfaceInfo::name()const { | ||
33 | return QString::fromLatin1(QObject::tr("DirView" )); | ||
34 | } | ||
35 | |||
36 | QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { | ||
37 | DirImageWidget* wid = new DirImageWidget(); | ||
38 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); | ||
39 | |||
40 | return wid; | ||
41 | } | ||
42 | |||
43 | void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { | ||
44 | qWarning( "Write Config" ); | ||
45 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); | ||
46 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); | ||
47 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.h b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.h new file mode 100644 index 0000000..c919dde --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #ifndef DIR_IFACE_INFO_H | ||
7 | #define DIR_IFACE_INFO_H | ||
8 | |||
9 | #include <iface/ifaceinfo.h> | ||
10 | |||
11 | class DirInterfaceInfo : public PInterfaceInfo { | ||
12 | public: | ||
13 | DirInterfaceInfo(); | ||
14 | virtual ~DirInterfaceInfo(); | ||
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/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp new file mode 100644 index 0000000..ffea29e --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #include "dir_lister.h" | ||
6 | |||
7 | #include <lib/slavemaster.h> | ||
8 | |||
9 | |||
10 | #include <qpe/config.h> | ||
11 | #include <qpe/qpeapplication.h> | ||
12 | |||
13 | #include <qdir.h> | ||
14 | #include <qfileinfo.h> | ||
15 | |||
16 | |||
17 | Dir_DirLister::Dir_DirLister( bool list ) | ||
18 | : PDirLister( "dir_dir_lister" ) | ||
19 | { | ||
20 | m_allFiles = list; | ||
21 | qWarning("All Files %d", m_allFiles ); | ||
22 | |||
23 | SlaveMaster* master = SlaveMaster::self(); | ||
24 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | ||
25 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | ||
26 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | ||
27 | this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); | ||
28 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
29 | this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); | ||
30 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | ||
31 | this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); | ||
32 | |||
33 | } | ||
34 | |||
35 | QString Dir_DirLister::defaultPath()const { | ||
36 | return QPEApplication::documentDir(); | ||
37 | } | ||
38 | |||
39 | QString Dir_DirLister::setStartPath( const QString& path ) { | ||
40 | m_currentDir.cd( path ); | ||
41 | if (!m_currentDir.exists() ) | ||
42 | m_currentDir.cd(defaultPath()); | ||
43 | |||
44 | |||
45 | return m_currentDir.absPath(); | ||
46 | } | ||
47 | |||
48 | QString Dir_DirLister::currentPath()const { | ||
49 | return m_currentDir.absPath(); | ||
50 | } | ||
51 | |||
52 | |||
53 | QStringList Dir_DirLister::folders()const { | ||
54 | return m_currentDir.entryList( QDir::Dirs ); | ||
55 | } | ||
56 | |||
57 | QStringList Dir_DirLister::files()const { | ||
58 | if ( m_allFiles ) | ||
59 | return m_currentDir.entryList( QDir::Files ); | ||
60 | else { | ||
61 | QStringList out; | ||
62 | QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable ); | ||
63 | for (QStringList::Iterator it = list.begin(); it != list.end();++it ) { | ||
64 | QFileInfo inf( *it ); | ||
65 | QString ext = inf.extension(false).lower(); | ||
66 | if( ext == QString::fromLatin1("jpg") || | ||
67 | ext == QString::fromLatin1("jpeg" ) || | ||
68 | ext == QString::fromLatin1("png" ) || | ||
69 | ext == QString::fromLatin1("gif" ) ) | ||
70 | out.append( *it ); | ||
71 | } | ||
72 | return out; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | void Dir_DirLister::deleteImage( const QString& fl) { | ||
77 | QFile::remove( fl ); | ||
78 | } | ||
79 | |||
80 | void Dir_DirLister::thumbNail( const QString& str, int w, int h) { | ||
81 | SlaveMaster::self()->thumbNail( str, w, h ); | ||
82 | } | ||
83 | |||
84 | QImage Dir_DirLister::image( const QString& str, Factor f, int m) { | ||
85 | return SlaveMaster::self()->image( str, f, m ); | ||
86 | } | ||
87 | |||
88 | void Dir_DirLister::imageInfo( const QString& str) { | ||
89 | SlaveMaster::self()->thumbInfo( str ); | ||
90 | } | ||
91 | |||
92 | void Dir_DirLister::fullImageInfo( const QString& str) { | ||
93 | SlaveMaster::self()->imageInfo( str ); | ||
94 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.h b/noncore/graphics/opie-eye/impl/dir/dir_lister.h new file mode 100644 index 0000000..fc63bb0 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DIR_LISTER_INTERFACE_LISTER_H | ||
6 | #define DIR_LISTER_INTERFACE_LISTER_H | ||
7 | |||
8 | #include <qdir.h> | ||
9 | |||
10 | #include <iface/dirlister.h> | ||
11 | |||
12 | class Config; | ||
13 | class Dir_DirLister : public PDirLister { | ||
14 | public: | ||
15 | Dir_DirLister( bool ); | ||
16 | |||
17 | QString defaultPath()const; | ||
18 | QString setStartPath( const QString& ); | ||
19 | QString currentPath()const; | ||
20 | QStringList folders()const; | ||
21 | QStringList files()const; | ||
22 | |||
23 | void deleteImage( const QString& ); | ||
24 | void thumbNail( const QString&, int, int ); | ||
25 | QImage image( const QString&, Factor, int ); | ||
26 | void imageInfo( const QString& ); | ||
27 | void fullImageInfo( const QString& ); | ||
28 | |||
29 | private: | ||
30 | bool m_allFiles; | ||
31 | QDir m_currentDir; | ||
32 | }; | ||
33 | |||
34 | #endif | ||