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/dir_lister.cpp | |
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/dir_lister.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 94 |
1 files changed, 94 insertions, 0 deletions
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 | } | ||