Diffstat (limited to 'noncore/graphics/opie-eye/impl') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim.pro | 10 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp | 28 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h | 26 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.cpp | 22 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.h | 22 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp | 181 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dcim/dcim_lister.h | 71 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir.pro | 10 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | 12 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc.pro | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | 17 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/impl/doc/doc_lister.h | 1 |
14 files changed, 390 insertions, 26 deletions
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim.pro b/noncore/graphics/opie-eye/impl/dcim/dcim.pro new file mode 100644 index 0000000..a8e8f05 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim.pro | |||
@@ -0,0 +1,10 @@ | |||
1 | HEADERS += impl/dcim/dcim_dirview.h \ | ||
2 | impl/dcim/dcim_ifaceinfo.h \ | ||
3 | impl/dcim/dcim_lister.h | ||
4 | |||
5 | |||
6 | |||
7 | SOURCES += impl/dcim/dcim_dirview.cpp \ | ||
8 | impl/dcim/dcim_ifaceinfo.cpp \ | ||
9 | impl/dcim/dcim_lister.cpp | ||
10 | |||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp new file mode 100644 index 0000000..e55c27a --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #include "dcim_dirview.h" | ||
2 | |||
3 | #include "dcim_lister.h" | ||
4 | #include "dcim_ifaceinfo.h" | ||
5 | |||
6 | PHUNK_VIEW_INTERFACE( "Digital Camera", DCIM_DirView ); | ||
7 | |||
8 | DCIM_DirView::DCIM_DirView( const Config& cfg ) | ||
9 | : PDirView( cfg ), m_lister( 0l ), m_info( 0l ) | ||
10 | {} | ||
11 | |||
12 | DCIM_DirView::~DCIM_DirView() | ||
13 | {} | ||
14 | |||
15 | PInterfaceInfo* DCIM_DirView::interfaceInfo()const { | ||
16 | if ( !m_info ) | ||
17 | m_info = new DCIM_InterfaceInfo; | ||
18 | |||
19 | return m_info; | ||
20 | } | ||
21 | |||
22 | |||
23 | PDirLister* DCIM_DirView::dirLister()const { | ||
24 | if ( !m_lister ) | ||
25 | m_lister = new DCIM_DirLister(); | ||
26 | |||
27 | return m_lister; | ||
28 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h new file mode 100644 index 0000000..7fc38ec --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_dirview.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * GPLv2 only zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DCIM_DIR_VIEW_H | ||
6 | #define DCIM_DIR_VIEW_H | ||
7 | |||
8 | #include <iface/dirview.h> | ||
9 | |||
10 | /* | ||
11 | * Implementation for USB Host Digital Cameras | ||
12 | * like my Casio QV 500 and boring Yakumo | ||
13 | */ | ||
14 | struct DCIM_DirView : public PDirView { | ||
15 | DCIM_DirView( const Config& ); | ||
16 | ~DCIM_DirView(); | ||
17 | |||
18 | PInterfaceInfo* interfaceInfo()const; | ||
19 | PDirLister * dirLister ()const; | ||
20 | |||
21 | private: | ||
22 | mutable PDirLister *m_lister; | ||
23 | mutable PInterfaceInfo *m_info ; | ||
24 | }; | ||
25 | |||
26 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.cpp new file mode 100644 index 0000000..ca94dc5 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.cpp | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | |||
7 | #include "dcim_ifaceinfo.h" | ||
8 | |||
9 | #include <qobject.h> | ||
10 | |||
11 | DCIM_InterfaceInfo::DCIM_InterfaceInfo() {} | ||
12 | DCIM_InterfaceInfo::~DCIM_InterfaceInfo() {} | ||
13 | |||
14 | QString DCIM_InterfaceInfo::name()const { | ||
15 | return QObject::tr( "Digital Camera View" ); | ||
16 | } | ||
17 | |||
18 | QWidget* DCIM_InterfaceInfo::configWidget( const Config& ) { | ||
19 | return 0l; | ||
20 | } | ||
21 | |||
22 | void DCIM_InterfaceInfo::writeConfig( QWidget*, Config& ) {} | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.h b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.h new file mode 100644 index 0000000..6396047 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_ifaceinfo.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * GPLv2 | ||
3 | * zecke@handhelds.org | ||
4 | */ | ||
5 | |||
6 | #ifndef DCIM_IFACE_INFO_H | ||
7 | #define DCIM_IFACE_INFO_H | ||
8 | |||
9 | #include <iface/ifaceinfo.h> | ||
10 | |||
11 | class DCIM_InterfaceInfo : public PInterfaceInfo { | ||
12 | public: | ||
13 | DCIM_InterfaceInfo(); | ||
14 | virtual ~DCIM_InterfaceInfo(); | ||
15 | |||
16 | QString name()const; | ||
17 | QWidget* configWidget( const Config& ); | ||
18 | void writeConfig( QWidget* wid, Config& ); | ||
19 | }; | ||
20 | |||
21 | |||
22 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp new file mode 100644 index 0000000..3c3d702 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.cpp | |||
@@ -0,0 +1,181 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #include "dcim_lister.h" | ||
6 | #include <lib/slavemaster.h> | ||
7 | |||
8 | #include <opie2/odebug.h> | ||
9 | #include <qpe/storage.h> | ||
10 | |||
11 | #include <qdir.h> | ||
12 | #include <qfileinfo.h> | ||
13 | #include <qimage.h> | ||
14 | |||
15 | DCIM_DirLister::DCIM_DirLister() | ||
16 | : PDirLister( "dcim_dirlister" ) | ||
17 | { | ||
18 | |||
19 | /* | ||
20 | * create a SlaveMaster and lets connect the signal of | ||
21 | * it to our interface | ||
22 | */ | ||
23 | SlaveHelper::slaveConnectSignals( this ); | ||
24 | m_mode = ListingUnknown; | ||
25 | } | ||
26 | |||
27 | DCIM_DirLister::~DCIM_DirLister() {} | ||
28 | |||
29 | QString DCIM_DirLister::defaultPath()const { | ||
30 | m_mode = ListingStart; | ||
31 | return QString::null; | ||
32 | } | ||
33 | |||
34 | QString DCIM_DirLister::setStartPath( const QString& str) { | ||
35 | /** | ||
36 | * IconView adds a '/' to path. Lets strip | ||
37 | * that. | ||
38 | */ | ||
39 | QString st = str.mid( 1 ); | ||
40 | if ( ListingStart == m_mode && m_map.contains( st ) ) { | ||
41 | m_path = m_map[st]+ "/dcim"; | ||
42 | m_mode = ListingFolder; | ||
43 | }else if ( m_mode == ListingFolder ) { | ||
44 | m_mode = ListingFiles; | ||
45 | m_path = str; | ||
46 | }else if ( m_mode == ListingReFolder ) { | ||
47 | m_mode = ListingFolder; | ||
48 | } | ||
49 | |||
50 | owarn << " StartPath2 " << str << " " << m_path << oendl; | ||
51 | |||
52 | return m_path; | ||
53 | } | ||
54 | |||
55 | |||
56 | QString DCIM_DirLister::currentPath()const { | ||
57 | return m_path; | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * depending on the mode we will either | ||
62 | * Find Digital Cameras | ||
63 | */ | ||
64 | QStringList DCIM_DirLister::folders()const { | ||
65 | QStringList lst; | ||
66 | |||
67 | switch( m_mode ) { | ||
68 | case ListingUnknown: | ||
69 | case ListingStart: | ||
70 | lst = findCameras(); | ||
71 | break; | ||
72 | case ListingFolder: | ||
73 | lst = findAlbums(); | ||
74 | break; | ||
75 | case ListingFiles: | ||
76 | default: | ||
77 | break; | ||
78 | } | ||
79 | |||
80 | return lst; | ||
81 | } | ||
82 | |||
83 | QStringList DCIM_DirLister::files()const { | ||
84 | if ( m_mode != ListingFiles ) | ||
85 | return QStringList(); | ||
86 | else | ||
87 | return findImages(); | ||
88 | } | ||
89 | |||
90 | QString DCIM_DirLister::dirUp( const QString& p )const { | ||
91 | QString str; | ||
92 | |||
93 | switch( m_mode ) { | ||
94 | case ListingFiles: | ||
95 | m_mode = ListingReFolder; | ||
96 | str = PDirLister::dirUp( p ); | ||
97 | break; | ||
98 | case ListingFolder: | ||
99 | m_mode = ListingStart; | ||
100 | break; | ||
101 | case ListingUnknown: | ||
102 | case ListingStart: | ||
103 | default: | ||
104 | break; | ||
105 | } | ||
106 | |||
107 | /* down cases */ | ||
108 | owarn << " New String " << str << " old path " << m_mode << oendl; | ||
109 | m_path = str; | ||
110 | return str; | ||
111 | } | ||
112 | |||
113 | |||
114 | QStringList DCIM_DirLister::findCameras()const { | ||
115 | QStringList lst; | ||
116 | StorageInfo inf; | ||
117 | |||
118 | m_map.clear(); | ||
119 | |||
120 | const QList<FileSystem> &list = inf.fileSystems(); | ||
121 | QListIterator<FileSystem> it( list ); | ||
122 | |||
123 | |||
124 | FileSystem *sys; | ||
125 | for ( sys = it.current(); (sys=it.current())!=0 ; ++it ) | ||
126 | if ( QFileInfo( sys->path() + "/dcim/" ).exists() ) { | ||
127 | lst << sys->name(); | ||
128 | m_map.insert( sys->name(), sys->path() ); | ||
129 | } | ||
130 | |||
131 | if ( lst.isEmpty() ) { | ||
132 | m_mode = ListingUnknown; | ||
133 | lst << QObject::tr("Error no Camera Dir found"); | ||
134 | }else | ||
135 | m_mode = ListingStart; | ||
136 | |||
137 | return lst; | ||
138 | } | ||
139 | |||
140 | QStringList DCIM_DirLister::findAlbums()const { | ||
141 | QStringList lst = QDir( m_path ).entryList( QDir::Dirs ); | ||
142 | lst.remove( "." ); | ||
143 | lst.remove( ".." ); | ||
144 | |||
145 | return lst; | ||
146 | } | ||
147 | |||
148 | QStringList DCIM_DirLister::findImages()const { | ||
149 | return QDir( m_path ).entryList("*.jpg *.jpeg *.png", QDir::Files ); | ||
150 | } | ||
151 | |||
152 | void DCIM_DirLister::deleteImage( const QString& fl ) { | ||
153 | QFileInfo inf( fl ); | ||
154 | QFile::remove( fl ); | ||
155 | QFile::remove( inf.dirPath ()+"/preview"+ | ||
156 | inf.fileName() ); | ||
157 | } | ||
158 | |||
159 | void DCIM_DirLister::thumbNail( const QString& _str, int w, int h ) { | ||
160 | QFileInfo inf( _str ); | ||
161 | QString str = QFileInfo( inf.dirPath()+"/preview"+ inf.fileName() ).exists() ? | ||
162 | inf.dirPath()+"/preview"+ inf.fileName() : _str; | ||
163 | |||
164 | SlaveMaster::self()->thumbNail( str, w, h ); | ||
165 | } | ||
166 | |||
167 | QImage DCIM_DirLister::image( const QString& str, Factor f, int m ) { | ||
168 | return SlaveMaster::self()->image( str, f, m ); | ||
169 | } | ||
170 | |||
171 | void DCIM_DirLister::imageInfo( const QString& str ) { | ||
172 | SlaveMaster::self()->thumbInfo( str ); | ||
173 | } | ||
174 | |||
175 | void DCIM_DirLister::fullImageInfo( const QString& str ) { | ||
176 | SlaveMaster::self()->imageInfo( str ); | ||
177 | } | ||
178 | |||
179 | QString DCIM_DirLister::nameToFname( const QString& name )const { | ||
180 | return name; | ||
181 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/dcim/dcim_lister.h b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.h new file mode 100644 index 0000000..d0a2031 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dcim/dcim_lister.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * GPLv2 zecke@handhelds.org | ||
3 | */ | ||
4 | |||
5 | #ifndef DCIM_LISTER_H | ||
6 | #define DCIM_LISTER_H | ||
7 | |||
8 | #include <iface/dirlister.h> | ||
9 | |||
10 | #include <qmap.h> | ||
11 | |||
12 | class Config; | ||
13 | |||
14 | /** | ||
15 | * The DirLister is responsible for | ||
16 | * telling the GUI about files and folders | ||
17 | * and to load them. | ||
18 | * The DCIM is a special FileSystem lister | ||
19 | * in the that it starts with an overview | ||
20 | * of available 'Cameras'. It looks via 'Storage' | ||
21 | * for paths including a 'dcim' directory. | ||
22 | * And offers these as folders. | ||
23 | * Then it only lists Images. It tries to use | ||
24 | * the 'preview' directory to generate a thumbnail | ||
25 | * but will use the full image for the QImage | ||
26 | * call. | ||
27 | * | ||
28 | */ | ||
29 | class DCIM_DirLister : public PDirLister { | ||
30 | Q_OBJECT | ||
31 | public: | ||
32 | enum ListMode{ | ||
33 | ListingUnknown = -1, | ||
34 | ListingStart=1, /* give an overview over files */ | ||
35 | ListingFolder, /* give access to albums */ | ||
36 | ListingFiles, /* list the content of the album */ | ||
37 | ListingReFolder | ||
38 | }; | ||
39 | DCIM_DirLister(); | ||
40 | ~DCIM_DirLister(); | ||
41 | |||
42 | QString defaultPath()const; | ||
43 | QString setStartPath( const QString& ); | ||
44 | |||
45 | QString currentPath()const; | ||
46 | QStringList folders()const; | ||
47 | QStringList files() const; | ||
48 | |||
49 | void deleteImage( const QString& ); | ||
50 | |||
51 | void thumbNail( const QString&, int, int ); | ||
52 | QImage image( const QString&, Factor, int ); | ||
53 | void imageInfo( const QString& ); | ||
54 | void fullImageInfo( const QString& ); | ||
55 | |||
56 | |||
57 | virtual QString nameToFname( const QString& )const; | ||
58 | virtual QString dirUp(const QString& )const; | ||
59 | |||
60 | private: | ||
61 | QStringList findCameras()const; | ||
62 | QStringList findAlbums ()const; | ||
63 | QStringList findImages ()const; | ||
64 | |||
65 | private: | ||
66 | mutable QString m_path; | ||
67 | mutable ListMode m_mode; | ||
68 | mutable QMap<QString, QString> m_map; | ||
69 | }; | ||
70 | |||
71 | #endif | ||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir.pro b/noncore/graphics/opie-eye/impl/dir/dir.pro new file mode 100644 index 0000000..675c327 --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/dir/dir.pro | |||
@@ -0,0 +1,10 @@ | |||
1 | HEADERS += impl/dir/dir_dirview.h \ | ||
2 | impl/dir/dir_ifaceinfo.h \ | ||
3 | impl/dir/dir_lister.h | ||
4 | |||
5 | |||
6 | |||
7 | SOURCES += impl/dir/dir_dirview.cpp \ | ||
8 | impl/dir/dir_ifaceinfo.cpp \ | ||
9 | impl/dir/dir_lister.cpp | ||
10 | |||
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp index 5599ad1..f4a6a87 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp | |||
@@ -1,51 +1,50 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 | 2 | * GPLv2 |
3 | * zecke@handhelds.org | 3 | * zecke@handhelds.org |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "dir_ifaceinfo.h" | 6 | #include "dir_ifaceinfo.h" |
7 | 7 | ||
8 | /* OPIE */ | 8 | /* OPIE */ |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | using namespace Opie::Core; | ||
12 | 11 | ||
13 | /* QT */ | 12 | /* QT */ |
14 | #include <qwidget.h> | 13 | #include <qwidget.h> |
15 | #include <qcheckbox.h> | 14 | #include <qcheckbox.h> |
16 | #include <qhbox.h> | 15 | #include <qhbox.h> |
17 | #include <qlabel.h> | 16 | #include <qlabel.h> |
18 | 17 | ||
19 | namespace { | 18 | namespace { |
20 | class DirImageWidget : public QHBox { | 19 | class DirImageWidget : public QHBox { |
21 | public: | 20 | public: |
22 | DirImageWidget() { | 21 | DirImageWidget() { |
23 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); | 22 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); |
24 | } | 23 | } |
25 | ~DirImageWidget() {} | 24 | ~DirImageWidget() {} |
26 | QCheckBox* chkbox; | 25 | QCheckBox* chkbox; |
27 | }; | 26 | }; |
28 | } | 27 | } |
29 | 28 | ||
30 | 29 | ||
31 | DirInterfaceInfo::DirInterfaceInfo() { | 30 | DirInterfaceInfo::DirInterfaceInfo() { |
32 | } | 31 | } |
33 | DirInterfaceInfo::~DirInterfaceInfo() { | 32 | DirInterfaceInfo::~DirInterfaceInfo() { |
34 | } | 33 | } |
35 | 34 | ||
36 | QString DirInterfaceInfo::name()const { | 35 | QString DirInterfaceInfo::name()const { |
37 | return QString::fromLatin1(QObject::tr("DirView" )); | 36 | return QObject::tr("Directory View" ); |
38 | } | 37 | } |
39 | 38 | ||
40 | QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { | 39 | QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { |
41 | DirImageWidget* wid = new DirImageWidget(); | 40 | DirImageWidget* wid = new DirImageWidget(); |
42 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); | 41 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); |
43 | 42 | ||
44 | return wid; | 43 | return wid; |
45 | } | 44 | } |
46 | 45 | ||
47 | void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { | 46 | void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { |
48 | owarn << "Write Config" << oendl; | 47 | owarn << "Write Config" << oendl; |
49 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); | 48 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); |
50 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); | 49 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); |
51 | } | 50 | } |
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index 3717297..d8b332a 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp | |||
@@ -1,58 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "dir_lister.h" | 5 | #include "dir_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 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <qfileinfo.h> | 17 | #include <qfileinfo.h> |
18 | 18 | ||
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 | SlaveHelper::slaveConnectSignals( this ); | |
25 | SlaveMaster* master = SlaveMaster::self(); | ||
26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | ||
27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | ||
28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | ||
29 | this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); | ||
30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
31 | this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); | ||
32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | ||
33 | this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); | ||
34 | |||
35 | } | 25 | } |
36 | 26 | ||
37 | QString Dir_DirLister::defaultPath()const { | 27 | QString Dir_DirLister::defaultPath()const { |
38 | return QPEApplication::documentDir(); | 28 | return QPEApplication::documentDir(); |
39 | } | 29 | } |
40 | 30 | ||
41 | QString Dir_DirLister::setStartPath( const QString& path ) { | 31 | QString Dir_DirLister::setStartPath( const QString& path ) { |
42 | m_currentDir.cd( path ); | 32 | m_currentDir.cd( path ); |
43 | if (!m_currentDir.exists() ) | 33 | if (!m_currentDir.exists() ) |
44 | m_currentDir.cd(defaultPath()); | 34 | m_currentDir.cd(defaultPath()); |
45 | 35 | ||
46 | 36 | ||
47 | return m_currentDir.absPath(); | 37 | return m_currentDir.absPath(); |
48 | } | 38 | } |
49 | 39 | ||
50 | QString Dir_DirLister::currentPath()const { | 40 | QString Dir_DirLister::currentPath()const { |
51 | return m_currentDir.absPath(); | 41 | return m_currentDir.absPath(); |
52 | } | 42 | } |
53 | 43 | ||
54 | 44 | ||
55 | QStringList Dir_DirLister::folders()const { | 45 | QStringList Dir_DirLister::folders()const { |
56 | return m_currentDir.entryList( QDir::Dirs ); | 46 | return m_currentDir.entryList( QDir::Dirs ); |
57 | } | 47 | } |
58 | 48 | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc.pro b/noncore/graphics/opie-eye/impl/doc/doc.pro new file mode 100644 index 0000000..076aa3b --- a/dev/null +++ b/noncore/graphics/opie-eye/impl/doc/doc.pro | |||
@@ -0,0 +1,7 @@ | |||
1 | HEADERS += impl/doc/doc_dirview.h \ | ||
2 | impl/doc/doc_ifaceinfo.h \ | ||
3 | impl/doc/doc_lister.h | ||
4 | |||
5 | SOURCES += impl/doc/doc_dirview.cpp \ | ||
6 | impl/doc/doc_ifaceinfo.cpp \ | ||
7 | impl/doc/doc_lister.cpp | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp index a6d6f3c..356a4b6 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp | |||
@@ -17,41 +17,41 @@ using namespace Opie::Core; | |||
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | 18 | ||
19 | #if 0 | 19 | #if 0 |
20 | namespace { | 20 | namespace { |
21 | class DirImageWidget : public QHBox { | 21 | class DirImageWidget : public QHBox { |
22 | public: | 22 | public: |
23 | DirImageWidget() { | 23 | DirImageWidget() { |
24 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); | 24 | chkbox = new QCheckBox( QObject::tr("Show all files"), this ); |
25 | } | 25 | } |
26 | ~DirImageWidget() {} | 26 | ~DirImageWidget() {} |
27 | QCheckBox* chkbox; | 27 | QCheckBox* chkbox; |
28 | }; | 28 | }; |
29 | } | 29 | } |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | DocInterfaceInfo::DocInterfaceInfo() { | 32 | DocInterfaceInfo::DocInterfaceInfo() { |
33 | } | 33 | } |
34 | DocInterfaceInfo::~DocInterfaceInfo() { | 34 | DocInterfaceInfo::~DocInterfaceInfo() { |
35 | } | 35 | } |
36 | 36 | ||
37 | QString DocInterfaceInfo::name()const { | 37 | QString DocInterfaceInfo::name()const { |
38 | return QString::fromLatin1(QObject::tr("DocView" )); | 38 | return QString::fromLatin1(QObject::tr("DocView" )); |
39 | } | 39 | } |
40 | 40 | ||
41 | QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { | 41 | QWidget* DocInterfaceInfo::configWidget(const Config& ) { |
42 | #if 0 | 42 | #if 0 |
43 | DirImageWidget* wid = new DirImageWidget(); | 43 | DirImageWidget* wid = new DirImageWidget(); |
44 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); | 44 | wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); |
45 | 45 | ||
46 | return wid; | 46 | return wid; |
47 | #endif | 47 | #endif |
48 | return 0L; | 48 | return 0L; |
49 | } | 49 | } |
50 | 50 | ||
51 | void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { | 51 | void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { |
52 | #if 0 | 52 | #if 0 |
53 | owarn << "Write Config" << oendl; | 53 | owarn << "Write Config" << oendl; |
54 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); | 54 | DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); |
55 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); | 55 | cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); |
56 | #endif | 56 | #endif |
57 | } | 57 | } |
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp index d4d1831..722fb95 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.cpp | |||
@@ -1,152 +1,149 @@ | |||
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 | using namespace Opie::Core; | 15 | using namespace Opie::Core; |
16 | 16 | ||
17 | /* QT */ | 17 | /* QT */ |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qfileinfo.h> | 19 | #include <qfileinfo.h> |
20 | 20 | ||
21 | Doc_DirLister::Doc_DirLister() | 21 | Doc_DirLister::Doc_DirLister() |
22 | : PDirLister( "doc_dir_lister" ) | 22 | : PDirLister( "doc_dir_lister" ) |
23 | { | 23 | { |
24 | /* connect the signals */ | ||
24 | SlaveMaster* master = SlaveMaster::self(); | 25 | SlaveMaster* master = SlaveMaster::self(); |
25 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); | 26 | connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); |
26 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); | 27 | connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); |
27 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), | 28 | connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), |
28 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); | 29 | this, SLOT(slotThumbInfo(const QString&, const QString&)) ); |
29 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 30 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
30 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); | 31 | this, SLOT(slotFullInfo(const QString&, const QString&)) ); |
31 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), | 32 | connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), |
32 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); | 33 | this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); |
33 | 34 | ||
34 | m_namemap.clear(); | 35 | m_namemap.clear(); |
35 | m_filemap.clear(); | 36 | m_filemap.clear(); |
36 | } | 37 | } |
37 | 38 | ||
38 | QString Doc_DirLister::defaultPath()const { | 39 | QString Doc_DirLister::defaultPath()const { |
39 | return ""; QPEApplication::documentDir(); | 40 | return QString::null; |
40 | } | 41 | } |
41 | 42 | ||
42 | QString Doc_DirLister::setStartPath(const QString&) { | 43 | QString Doc_DirLister::setStartPath(const QString&) { |
43 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); | 44 | static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); |
44 | if (m_namemap.isEmpty()) { | 45 | if (m_namemap.isEmpty()) { |
45 | DocLnkSet ds; | 46 | DocLnkSet ds; |
46 | Global::findDocuments(&ds,Mtype_str); | 47 | Global::findDocuments(&ds,Mtype_str); |
47 | QListIterator<DocLnk> dit(ds.children()); | 48 | QListIterator<DocLnk> dit(ds.children()); |
48 | for( ; dit.current(); ++dit) { | 49 | for( ; dit.current(); ++dit) { |
49 | // if (! (*dit)->isValid()) continue; | 50 | // if (! (*dit)->isValid()) continue; |
50 | m_namemap[(*dit)->name()]=(*dit)->file(); | 51 | m_namemap[(*dit)->name()]=(*dit)->file(); |
51 | m_filemap[(*dit)->file()]=(*dit)->name(); | 52 | m_filemap[(*dit)->file()]=(*dit)->name(); |
52 | } | 53 | } |
53 | } | 54 | } |
54 | return QString::null; | 55 | return QString::null; |
55 | } | 56 | } |
56 | 57 | ||
57 | QString Doc_DirLister::currentPath()const { | 58 | QString Doc_DirLister::currentPath()const { |
58 | return QString::null; | 59 | return QString::null; |
59 | } | 60 | } |
60 | 61 | ||
61 | 62 | ||
62 | QStringList Doc_DirLister::folders()const { | 63 | QStringList Doc_DirLister::folders()const { |
63 | return QStringList(); | 64 | return QStringList(); |
64 | } | 65 | } |
65 | 66 | ||
66 | QStringList Doc_DirLister::files()const { | 67 | QStringList Doc_DirLister::files()const { |
67 | QStringList out; | 68 | QStringList out; |
68 | QMap<QString,QString>::ConstIterator it; | 69 | QMap<QString,QString>::ConstIterator it; |
69 | for (it = m_namemap.begin();it != m_namemap.end();++it) { | 70 | for (it = m_namemap.begin();it != m_namemap.end();++it) { |
70 | out.append(it.key()); | 71 | out.append(it.key()); |
71 | } | 72 | } |
72 | return out; | 73 | return out; |
73 | } | 74 | } |
74 | 75 | ||
75 | void Doc_DirLister::deleteImage( const QString& ) | 76 | void Doc_DirLister::deleteImage( const QString& ) |
76 | { | 77 | { |
77 | } | 78 | } |
78 | 79 | ||
79 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { | 80 | void Doc_DirLister::thumbNail( const QString& str, int w, int h) { |
80 | if (m_namemap.find(str)==m_namemap.end()) { | 81 | if (m_namemap.find(str)==m_namemap.end()) { |
81 | owarn << "Item " << str << " not found" << oendl; | ||
82 | return; | 82 | return; |
83 | } | 83 | } |
84 | QString fname = m_namemap[str]; | 84 | QString fname = m_namemap[str]; |
85 | SlaveMaster::self()->thumbNail( fname, w, h ); | 85 | SlaveMaster::self()->thumbNail( fname, w, h ); |
86 | } | 86 | } |
87 | 87 | ||
88 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { | 88 | QImage Doc_DirLister::image( const QString& str, Factor f, int m) { |
89 | if (m_namemap.find(str)==m_namemap.end()) { | 89 | if (m_namemap.find(str)==m_namemap.end()) { |
90 | owarn << "Item " << str << " not found" << oendl; | ||
91 | return QImage(); | 90 | return QImage(); |
92 | } | 91 | } |
93 | QString fname = m_namemap[str]; | 92 | QString fname = m_namemap[str]; |
94 | return SlaveMaster::self()->image( fname, f, m ); | 93 | return SlaveMaster::self()->image( fname, f, m ); |
95 | } | 94 | } |
96 | 95 | ||
97 | void Doc_DirLister::imageInfo( const QString& str) { | 96 | void Doc_DirLister::imageInfo( const QString& str) { |
98 | if (m_namemap.find(str)==m_namemap.end()) { | 97 | if (m_namemap.find(str)==m_namemap.end()) { |
99 | owarn << "Item " << str << " not found" << oendl; | ||
100 | return; | 98 | return; |
101 | } | 99 | } |
102 | QString fname = m_namemap[str]; | 100 | QString fname = m_namemap[str]; |
103 | SlaveMaster::self()->thumbInfo( fname ); | 101 | SlaveMaster::self()->thumbInfo( fname ); |
104 | } | 102 | } |
105 | 103 | ||
106 | void Doc_DirLister::fullImageInfo( const QString& str) { | 104 | void Doc_DirLister::fullImageInfo( const QString& str) { |
107 | if (m_namemap.find(str)==m_namemap.end()) { | 105 | if (m_namemap.find(str)==m_namemap.end()) { |
108 | owarn << "Item " << str << " not found" << oendl; | ||
109 | return; | 106 | return; |
110 | } | 107 | } |
111 | QString fname = m_namemap[str]; | 108 | QString fname = m_namemap[str]; |
112 | SlaveMaster::self()->imageInfo( fname ); | 109 | SlaveMaster::self()->imageInfo( fname ); |
113 | } | 110 | } |
114 | 111 | ||
115 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) | 112 | void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) |
116 | { | 113 | { |
117 | if (m_filemap.find(f)==m_filemap.end()) { | 114 | if (m_filemap.find(f)==m_filemap.end()) { |
118 | owarn << "Item " << f << " not found" << oendl; | ||
119 | return; | 115 | return; |
120 | } | 116 | } |
121 | QString name = m_filemap[f]; | 117 | QString name = m_filemap[f]; |
122 | emit sig_fullInfo(name, t); | 118 | emit sig_fullInfo(name, t); |
123 | } | 119 | } |
124 | 120 | ||
125 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) | 121 | void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) |
126 | { | 122 | { |
127 | if (m_filemap.find(f)==m_filemap.end()) { | 123 | if (m_filemap.find(f)==m_filemap.end()) { |
128 | owarn << "Item " << f << " not found" << oendl; | ||
129 | return; | 124 | return; |
130 | } | 125 | } |
131 | QString name = m_filemap[f]; | 126 | QString name = m_filemap[f]; |
132 | emit sig_thumbInfo(name, t); | 127 | emit sig_thumbInfo(name, t); |
133 | } | 128 | } |
134 | 129 | ||
135 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) | 130 | void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) |
136 | { | 131 | { |
137 | if (m_filemap.find(f)==m_filemap.end()) { | 132 | if (m_filemap.find(f)==m_filemap.end()) { |
138 | owarn << "Item " << f << " not found" << oendl; | ||
139 | return; | 133 | return; |
140 | } | 134 | } |
141 | QString name = m_filemap[f]; | 135 | QString name = m_filemap[f]; |
142 | emit sig_thumbNail(name, p); | 136 | emit sig_thumbNail(name, p); |
143 | } | 137 | } |
144 | 138 | ||
145 | QString Doc_DirLister::nameToFname(const QString&name)const | 139 | QString Doc_DirLister::nameToFname(const QString&name)const |
146 | { | 140 | { |
147 | if (m_namemap.find(name)==m_namemap.end()) { | 141 | if (m_namemap.find(name)==m_namemap.end()) { |
148 | owarn << "Item " << name << " not found" << oendl; | ||
149 | return QString::null; | 142 | return QString::null; |
150 | } | 143 | } |
151 | return m_namemap[name]; | 144 | return m_namemap[name]; |
152 | } | 145 | } |
146 | |||
147 | QString Doc_DirLister::dirUp( const QString& p ) const{ | ||
148 | return p; | ||
149 | } | ||
diff --git a/noncore/graphics/opie-eye/impl/doc/doc_lister.h b/noncore/graphics/opie-eye/impl/doc/doc_lister.h index a65b616..5884a35 100644 --- a/noncore/graphics/opie-eye/impl/doc/doc_lister.h +++ b/noncore/graphics/opie-eye/impl/doc/doc_lister.h | |||
@@ -8,34 +8,35 @@ | |||
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 Doc_DirLister : public PDirLister { | 14 | class Doc_DirLister : public PDirLister { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | Doc_DirLister(); | 17 | Doc_DirLister(); |
18 | virtual ~Doc_DirLister(){} | 18 | virtual ~Doc_DirLister(){} |
19 | 19 | ||
20 | QString defaultPath()const; | 20 | QString defaultPath()const; |
21 | QString setStartPath( const QString& ); | 21 | QString setStartPath( const QString& ); |
22 | QString currentPath()const; | 22 | QString currentPath()const; |
23 | QStringList folders()const; | 23 | QStringList folders()const; |
24 | QStringList files()const; | 24 | QStringList files()const; |
25 | 25 | ||
26 | void deleteImage( const QString& ); | 26 | void deleteImage( const QString& ); |
27 | void thumbNail( const QString&, int, int ); | 27 | void thumbNail( const QString&, int, int ); |
28 | QImage image( const QString&, Factor, int ); | 28 | QImage image( const QString&, Factor, int ); |
29 | void imageInfo( const QString& ); | 29 | void imageInfo( const QString& ); |
30 | void fullImageInfo( const QString& ); | 30 | void fullImageInfo( const QString& ); |
31 | virtual QString nameToFname(const QString&name)const; | 31 | virtual QString nameToFname(const QString&name)const; |
32 | QString dirUp( const QString& )const; | ||
32 | 33 | ||
33 | private: | 34 | private: |
34 | QMap<QString,QString> m_namemap,m_filemap; | 35 | QMap<QString,QString> m_namemap,m_filemap; |
35 | protected slots: | 36 | protected slots: |
36 | virtual void slotFullInfo(const QString&, const QString&); | 37 | virtual void slotFullInfo(const QString&, const QString&); |
37 | virtual void slotThumbInfo(const QString&, const QString&); | 38 | virtual void slotThumbInfo(const QString&, const QString&); |
38 | virtual void slotThumbNail(const QString&, const QPixmap&); | 39 | virtual void slotThumbNail(const QString&, const QPixmap&); |
39 | }; | 40 | }; |
40 | 41 | ||
41 | #endif | 42 | #endif |