author | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 18:31:44 (UTC) |
commit | 81cd1a4a916fb00b6c8867bdc1d945db155b12c0 (patch) (side-by-side diff) | |
tree | ce302c254c8c2160a86ffc0a5abe6cfd51fd33b3 /noncore/graphics/opie-eye/impl | |
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
Diffstat (limited to 'noncore/graphics/opie-eye/impl') (more/less context) (ignore whitespace changes)
-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 |
9 files changed, 331 insertions, 3 deletions
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 @@ -1,21 +1,21 @@ /* * GPLv2 * zecke@handhelds.org */ #ifndef DIR_IFACE_INFO_H #define DIR_IFACE_INFO_H -#include <iface/ifaceinfo.h>s +#include <iface/ifaceinfo.h> class DirInterfaceInfo : public PInterfaceInfo { public: DirInterfaceInfo(); - ~DirInterfaceInfo(); + virtual ~DirInterfaceInfo(); QString name()const; QWidget* configWidget(const Config&); void writeConfig( QWidget* wid, Config& ); }; #endif 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 @@ -11,25 +11,25 @@ #include <qpe/config.h> #include <qpe/qpeapplication.h> using namespace Opie::Core; /* QT */ #include <qdir.h> #include <qfileinfo.h> Dir_DirLister::Dir_DirLister( bool list ) : PDirLister( "dir_dir_lister" ) { m_allFiles = list; - owarn << "All Files " << m_allFiles << "" << oendl; + owarn << "All Files " << m_allFiles << "" << oendl; SlaveMaster* master = SlaveMaster::self(); connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); } @@ -86,12 +86,17 @@ void Dir_DirLister::thumbNail( const QString& str, int w, int h) { QImage Dir_DirLister::image( const QString& str, Factor f, int m) { return SlaveMaster::self()->image( str, f, m ); } void Dir_DirLister::imageInfo( const QString& str) { SlaveMaster::self()->thumbInfo( str ); } void Dir_DirLister::fullImageInfo( const QString& str) { SlaveMaster::self()->imageInfo( str ); } + +QString Dir_DirLister::nameToFname(const QString&name)const +{ + return name; +} 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 @@ -2,33 +2,36 @@ * GPLv2 zecke@handhelds.org */ #ifndef DIR_LISTER_INTERFACE_LISTER_H #define DIR_LISTER_INTERFACE_LISTER_H #include <qdir.h> #include <iface/dirlister.h> class Config; class Dir_DirLister : public PDirLister { + Q_OBJECT public: Dir_DirLister( bool ); + virtual ~Dir_DirLister(){} QString defaultPath()const; QString setStartPath( const QString& ); QString currentPath()const; QStringList folders()const; QStringList files()const; void deleteImage( const QString& ); void thumbNail( const QString&, int, int ); QImage image( const QString&, Factor, int ); void imageInfo( const QString& ); void fullImageInfo( const QString& ); + virtual QString nameToFname(const QString&name)const; private: bool m_allFiles; QDir m_currentDir; }; #endif 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 @@ +#include "doc_lister.h" +#include "doc_ifaceinfo.h" +#include "doc_dirview.h" + +PHUNK_VIEW_INTERFACE("Document View", Doc_DirView ); + + +Doc_DirView::Doc_DirView( const Config& cfg) + : PDirView(cfg) +{ + m_lister = 0; + m_info = 0; +} + +Doc_DirView::~Doc_DirView() { +} + +PInterfaceInfo* Doc_DirView::interfaceInfo()const{ + if (!m_info ) + m_info =new DocInterfaceInfo; + return m_info; +} + +PDirLister* Doc_DirView::dirLister()const{ + if (!m_lister ) + m_lister = new Doc_DirLister(); + return m_lister; +} 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 @@ +/* + * GPLv2 only zecke@handhelds.org + */ + +#ifndef DOC_DIR_VIEW_H +#define DOC_DIR_VIEW_H + +#include <iface/dirview.h> + + +struct Doc_DirView : public PDirView { + Doc_DirView( const Config& ); + ~Doc_DirView(); + + PInterfaceInfo* interfaceInfo()const; + PDirLister* dirLister()const; +private: + bool m_cfg : 1; + mutable PDirLister* m_lister; + mutable PInterfaceInfo *m_info; +}; + + +#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 @@ +/* + * GPLv2 + * zecke@handhelds.org + */ + +#include "doc_ifaceinfo.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; + +/* QT */ +#include <qwidget.h> +#include <qcheckbox.h> +#include <qhbox.h> +#include <qlabel.h> + +#if 0 +namespace { + class DirImageWidget : public QHBox { + public: + DirImageWidget() { + chkbox = new QCheckBox( QObject::tr("Show all files"), this ); + } + ~DirImageWidget() {} + QCheckBox* chkbox; + }; +} +#endif + +DocInterfaceInfo::DocInterfaceInfo() { +} +DocInterfaceInfo::~DocInterfaceInfo() { +} + +QString DocInterfaceInfo::name()const { + return QString::fromLatin1(QObject::tr("DocView" )); +} + +QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { +#if 0 + DirImageWidget* wid = new DirImageWidget(); + wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); + + return wid; +#endif + return 0L; +} + +void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { +#if 0 + owarn << "Write Config" << oendl; + DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); + cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); +#endif +} 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 @@ +/* + * GPLv2 + * zecke@handhelds.org + */ + +#ifndef DOC_IFACE_INFO_H +#define DOC_IFACE_INFO_H + +#include <iface/ifaceinfo.h> + +class DocInterfaceInfo : public PInterfaceInfo { +public: + DocInterfaceInfo(); + virtual ~DocInterfaceInfo(); + + QString name()const; + QWidget* configWidget(const Config&); + void writeConfig( QWidget* wid, Config& ); +}; + +#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 @@ +/* + * GPLv2 zecke@handhelds.org + */ + +#include "doc_lister.h" + +#include <lib/slavemaster.h> + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +#include <qpe/qpeapplication.h> +#include <qpe/applnk.h> + +using namespace Opie::Core; + +/* QT */ +#include <qdir.h> +#include <qfileinfo.h> + +Doc_DirLister::Doc_DirLister() + : PDirLister( "doc_dir_lister" ) +{ + SlaveMaster* master = SlaveMaster::self(); + connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); + connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); + connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), + this, SLOT(slotThumbInfo(const QString&, const QString&)) ); + connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), + this, SLOT(slotFullInfo(const QString&, const QString&)) ); + connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), + this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); + +} + +QString Doc_DirLister::defaultPath()const { + return ""; QPEApplication::documentDir(); +} + +QString Doc_DirLister::setStartPath( const QString& path ) { + m_namemap.clear(); + m_out.clear(); + static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); + owarn << "Set start path" << oendl; + DocLnkSet ds; + Global::findDocuments(&ds,Mtype_str); + QListIterator<DocLnk> dit(ds.children()); + for( ; dit.current(); ++dit) { + owarn << (*dit)->file() << oendl; + m_namemap[(*dit)->name()]=(*dit)->file(); + m_filemap[(*dit)->file()]=(*dit)->name(); + m_out.append((*dit)->name()); + } + owarn << "Set start path end" << oendl; + return ""; +} + +QString Doc_DirLister::currentPath()const { + return ""; +} + + +QStringList Doc_DirLister::folders()const { + return QStringList(); +} + +QStringList Doc_DirLister::files()const { + return m_out; +} + +void Doc_DirLister::deleteImage( const QString& ) { +} + +void Doc_DirLister::thumbNail( const QString& str, int w, int h) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return; + } + QString fname = m_namemap[str]; + SlaveMaster::self()->thumbNail( fname, w, h ); +} + +QImage Doc_DirLister::image( const QString& str, Factor f, int m) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return QImage(); + } + QString fname = m_namemap[str]; + return SlaveMaster::self()->image( fname, f, m ); +} + +void Doc_DirLister::imageInfo( const QString& str) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return; + } + QString fname = m_namemap[str]; + owarn << "Image info: " << fname << oendl; + SlaveMaster::self()->thumbInfo( fname ); +} + +void Doc_DirLister::fullImageInfo( const QString& str) { + if (m_namemap.find(str)==m_namemap.end()) { + owarn << "Item " << str << " not found" << oendl; + return; + } + QString fname = m_namemap[str]; + SlaveMaster::self()->imageInfo( fname ); +} + +void Doc_DirLister::slotFullInfo(const QString&f, const QString&t) +{ + if (m_filemap.find(f)==m_filemap.end()) { + owarn << "Item " << f << " not found" << oendl; + return; + } + QString name = m_filemap[f]; + emit sig_fullInfo(name, t); +} + +void Doc_DirLister::slotThumbInfo(const QString&f, const QString&t) +{ + if (m_filemap.find(f)==m_filemap.end()) { + owarn << "Item " << f << " not found" << oendl; + return; + } + QString name = m_filemap[f]; + emit sig_thumbInfo(name, t); +} + +void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&p) +{ + if (m_filemap.find(f)==m_filemap.end()) { + owarn << "Item " << f << " not found" << oendl; + return; + } + QString name = m_filemap[f]; + emit sig_thumbNail(name, p); +} + +QString Doc_DirLister::nameToFname(const QString&name)const +{ + if (m_namemap.find(name)==m_namemap.end()) { + owarn << "Item " << name << " not found" << oendl; + return QString::null; + } + return m_namemap[name]; +} 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 @@ +/* + * GPLv2 zecke@handhelds.org + */ + +#ifndef DOC_LISTER_INTERFACE_LISTER_H +#define DOC_LISTER_INTERFACE_LISTER_H + +#include <iface/dirlister.h> + +#include <qstring.h> +#include <qmap.h> + +class Config; +class Doc_DirLister : public PDirLister { + Q_OBJECT +public: + Doc_DirLister(); + virtual ~Doc_DirLister(){} + + QString defaultPath()const; + QString setStartPath( const QString& ); + QString currentPath()const; + QStringList folders()const; + QStringList files()const; + + void deleteImage( const QString& ); + void thumbNail( const QString&, int, int ); + QImage image( const QString&, Factor, int ); + void imageInfo( const QString& ); + void fullImageInfo( const QString& ); + virtual QString nameToFname(const QString&name)const; + +private: + QMap<QString,QString> m_namemap,m_filemap; + QStringList m_out; +protected slots: + virtual void slotFullInfo(const QString&, const QString&); + virtual void slotThumbInfo(const QString&, const QString&); + virtual void slotThumbNail(const QString&, const QPixmap&); +}; + +#endif |