author | zecke <zecke> | 2004-08-27 22:22:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-27 22:22:44 (UTC) |
commit | 7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac (patch) (side-by-side diff) | |
tree | 1d189e90585190465233a67c7c9a2a740cb1d98a /noncore | |
parent | a6e7ebcee38719a9f33ede08ed4c8a364c2ecb20 (diff) | |
download | opie-7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac.zip opie-7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac.tar.gz opie-7d1ca5dba4cab829d9f7a8c79fb772dc3b643eac.tar.bz2 |
-Removal of debug messages
-Cleanups of .pro files
-Cleanups of source code
And finally the long awaited DigiCam (dcim) Backend
25 files changed, 487 insertions, 72 deletions
diff --git a/noncore/graphics/opie-eye/.cvsignore b/noncore/graphics/opie-eye/.cvsignore new file mode 100644 index 0000000..52494fb --- a/dev/null +++ b/noncore/graphics/opie-eye/.cvsignore @@ -0,0 +1,2 @@ +Makefile +*.moc diff --git a/noncore/graphics/opie-eye/gui/gui.pro b/noncore/graphics/opie-eye/gui/gui.pro new file mode 100644 index 0000000..b9f0bf8 --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/gui.pro @@ -0,0 +1,15 @@ +HEADERS += gui/filesystem.h \ + gui/iconview.h \ + gui/imageinfoui.h \ + gui/imageview.h \ + gui/mainwindow.h \ + gui/viewmodebutton.h + +SOURCES += gui/filesystem.cpp \ + gui/iconview.cpp \ + gui/imageinfoui.cpp \ + gui/imageview.cpp \ + gui/mainwindow.cpp \ + gui/viewmodebutton.cpp + + diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 652acc9..7196aba 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -40,9 +40,8 @@ using Opie::Core::OKeyConfigItem; */ namespace { static QPixmap* _dirPix = 0; static QPixmap* _unkPix = 0; - static QPixmap* _picPix = 0; static QPixmap* _emptyPix = 0; class IconViewItem : public QIconViewItem { public: IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); @@ -97,14 +96,14 @@ namespace { else if ( !isDir && !_unkPix ) _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); } - inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw) + inline void IconViewItem::setPixmap( const QPixmap & , bool, bool ) { m_Pixset = true; calcRect(text()); } - inline void IconViewItem::setPixmap( const QPixmap & icon) + inline void IconViewItem::setPixmap( const QPixmap & ) { m_Pixset = true; calcRect(text()); } @@ -252,12 +251,9 @@ void PIconView::initKeys() { * change one dir up */ void PIconView::slotDirUp() { - if (m_path.isEmpty()) return; - QDir dir( m_path ); - dir.cdUp(); - slotChangeDir( dir.absPath() ); + slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); } /* * change the dir @@ -378,13 +374,19 @@ void PIconView::slotViewChanged( int i) { PDirView* cur = currentView(); if (cur) delete cur; QString str = m_views->text(i); ViewMap* map = viewMap(); - if (!map) {setCurrentView(0l); return;} + if (!map) { + setCurrentView(0l); + return; + } + if (map->find(str) == map->end()) { owarn << "Key not found" << oendl; - setCurrentView(0l); return; + setCurrentView(0l); + return; } + m_cfg->writeEntry("LastView",str); m_cfg->write(); cur = (*(*map)[str])(*m_cfg); setCurrentView( cur ); @@ -400,9 +402,10 @@ void PIconView::slotViewChanged( int i) { connect(lis, SIGNAL(sig_end()) , this, SLOT(slotEnd()) ); - /* reload now */ + /* reload now with default Path*/ + m_path = lis->defaultPath(); QTimer::singleShot( 0, this, SLOT(slotReloadDir())); } diff --git a/noncore/graphics/opie-eye/iface/dirlister.cpp b/noncore/graphics/opie-eye/iface/dirlister.cpp index 7cf4361..e0ae63b 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.cpp +++ b/noncore/graphics/opie-eye/iface/dirlister.cpp @@ -1,9 +1,22 @@ #include "dirlister.h" +#include <qdir.h> PDirLister::PDirLister( const char* name ) : QObject( 0, name ) {} PDirLister::~PDirLister() {} + +/** + * Change dir one level up. The default implementation + * is to use QDir to change the dir. + * If you've a flat filesystem return \par path immediately. + */ +QString PDirLister::dirUp( const QString& path )const { + QDir dir( path ); + dir.cdUp(); + + return dir.absPath(); +} diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h index 9c7b2a9..68e8495 100644 --- a/noncore/graphics/opie-eye/iface/dirlister.h +++ b/noncore/graphics/opie-eye/iface/dirlister.h @@ -22,15 +22,19 @@ public: virtual QString setStartPath( const QString& ) = 0; virtual QString currentPath()const = 0; virtual QStringList folders()const = 0; virtual QStringList files()const = 0; + virtual QString nameToFname(const QString&name)const = 0; + virtual QString dirUp(const QString&)const ; + + public slots: virtual void deleteImage( const QString& ) = 0; virtual void imageInfo( const QString&) = 0; virtual void fullImageInfo( const QString& ) = 0; virtual void thumbNail( const QString&, int max_wid, int max_h ) = 0; virtual QImage image( const QString&, Factor, int max = 0) = 0; - virtual QString nameToFname(const QString&name)const = 0; + signals: void sig_dirchanged(); void sig_filechanged(); diff --git a/noncore/graphics/opie-eye/iface/iface.pro b/noncore/graphics/opie-eye/iface/iface.pro new file mode 100644 index 0000000..2ec499a --- a/dev/null +++ b/noncore/graphics/opie-eye/iface/iface.pro @@ -0,0 +1,7 @@ +HEADERS += iface/dirlister.h \ + iface/dirview.h \ + iface/ifaceinfo.h \ + iface/slaveiface.h + +SOURCES += iface/dirlister.cpp \ + iface/dirview.cpp diff --git a/noncore/graphics/opie-eye/iface/ifaceinfo.h b/noncore/graphics/opie-eye/iface/ifaceinfo.h index 74e0db6..3af2fce 100644 --- a/noncore/graphics/opie-eye/iface/ifaceinfo.h +++ b/noncore/graphics/opie-eye/iface/ifaceinfo.h @@ -9,9 +9,9 @@ #include <qstring.h> class QWidget; class Config; -struct PInterfaceInfo { +struct PInterfaceInfo { virtual QString name()const = 0; virtual QWidget* configWidget( const Config& ) = 0; virtual void writeConfig( QWidget* wid, Config& ) = 0; }; 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 @@ +HEADERS += impl/dcim/dcim_dirview.h \ + impl/dcim/dcim_ifaceinfo.h \ + impl/dcim/dcim_lister.h + + + +SOURCES += impl/dcim/dcim_dirview.cpp \ + impl/dcim/dcim_ifaceinfo.cpp \ + impl/dcim/dcim_lister.cpp + 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 @@ +#include "dcim_dirview.h" + +#include "dcim_lister.h" +#include "dcim_ifaceinfo.h" + +PHUNK_VIEW_INTERFACE( "Digital Camera", DCIM_DirView ); + +DCIM_DirView::DCIM_DirView( const Config& cfg ) + : PDirView( cfg ), m_lister( 0l ), m_info( 0l ) +{} + +DCIM_DirView::~DCIM_DirView() +{} + +PInterfaceInfo* DCIM_DirView::interfaceInfo()const { + if ( !m_info ) + m_info = new DCIM_InterfaceInfo; + + return m_info; +} + + +PDirLister* DCIM_DirView::dirLister()const { + if ( !m_lister ) + m_lister = new DCIM_DirLister(); + + return m_lister; +} 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 @@ +/* + * GPLv2 only zecke@handhelds.org + */ + +#ifndef DCIM_DIR_VIEW_H +#define DCIM_DIR_VIEW_H + +#include <iface/dirview.h> + +/* + * Implementation for USB Host Digital Cameras + * like my Casio QV 500 and boring Yakumo + */ +struct DCIM_DirView : public PDirView { + DCIM_DirView( const Config& ); + ~DCIM_DirView(); + + PInterfaceInfo* interfaceInfo()const; + PDirLister * dirLister ()const; + +private: + mutable PDirLister *m_lister; + mutable PInterfaceInfo *m_info ; +}; + +#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 @@ +/* + * GPLv2 + * zecke@handhelds.org + */ + + +#include "dcim_ifaceinfo.h" + +#include <qobject.h> + +DCIM_InterfaceInfo::DCIM_InterfaceInfo() {} +DCIM_InterfaceInfo::~DCIM_InterfaceInfo() {} + +QString DCIM_InterfaceInfo::name()const { + return QObject::tr( "Digital Camera View" ); +} + +QWidget* DCIM_InterfaceInfo::configWidget( const Config& ) { + return 0l; +} + +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 @@ +/* + * GPLv2 + * zecke@handhelds.org + */ + +#ifndef DCIM_IFACE_INFO_H +#define DCIM_IFACE_INFO_H + +#include <iface/ifaceinfo.h> + +class DCIM_InterfaceInfo : public PInterfaceInfo { +public: + DCIM_InterfaceInfo(); + virtual ~DCIM_InterfaceInfo(); + + QString name()const; + QWidget* configWidget( const Config& ); + void writeConfig( QWidget* wid, Config& ); +}; + + +#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 @@ +/* + * GPLv2 zecke@handhelds.org + */ + +#include "dcim_lister.h" +#include <lib/slavemaster.h> + +#include <opie2/odebug.h> +#include <qpe/storage.h> + +#include <qdir.h> +#include <qfileinfo.h> +#include <qimage.h> + +DCIM_DirLister::DCIM_DirLister() + : PDirLister( "dcim_dirlister" ) +{ + + /* + * create a SlaveMaster and lets connect the signal of + * it to our interface + */ + SlaveHelper::slaveConnectSignals( this ); + m_mode = ListingUnknown; +} + +DCIM_DirLister::~DCIM_DirLister() {} + +QString DCIM_DirLister::defaultPath()const { + m_mode = ListingStart; + return QString::null; +} + +QString DCIM_DirLister::setStartPath( const QString& str) { + /** + * IconView adds a '/' to path. Lets strip + * that. + */ + QString st = str.mid( 1 ); + if ( ListingStart == m_mode && m_map.contains( st ) ) { + m_path = m_map[st]+ "/dcim"; + m_mode = ListingFolder; + }else if ( m_mode == ListingFolder ) { + m_mode = ListingFiles; + m_path = str; + }else if ( m_mode == ListingReFolder ) { + m_mode = ListingFolder; + } + + owarn << " StartPath2 " << str << " " << m_path << oendl; + + return m_path; +} + + +QString DCIM_DirLister::currentPath()const { + return m_path; +} + +/* + * depending on the mode we will either + * Find Digital Cameras + */ +QStringList DCIM_DirLister::folders()const { + QStringList lst; + + switch( m_mode ) { + case ListingUnknown: + case ListingStart: + lst = findCameras(); + break; + case ListingFolder: + lst = findAlbums(); + break; + case ListingFiles: + default: + break; + } + + return lst; +} + +QStringList DCIM_DirLister::files()const { + if ( m_mode != ListingFiles ) + return QStringList(); + else + return findImages(); +} + +QString DCIM_DirLister::dirUp( const QString& p )const { + QString str; + + switch( m_mode ) { + case ListingFiles: + m_mode = ListingReFolder; + str = PDirLister::dirUp( p ); + break; + case ListingFolder: + m_mode = ListingStart; + break; + case ListingUnknown: + case ListingStart: + default: + break; + } + + /* down cases */ + owarn << " New String " << str << " old path " << m_mode << oendl; + m_path = str; + return str; +} + + +QStringList DCIM_DirLister::findCameras()const { + QStringList lst; + StorageInfo inf; + + m_map.clear(); + + const QList<FileSystem> &list = inf.fileSystems(); + QListIterator<FileSystem> it( list ); + + + FileSystem *sys; + for ( sys = it.current(); (sys=it.current())!=0 ; ++it ) + if ( QFileInfo( sys->path() + "/dcim/" ).exists() ) { + lst << sys->name(); + m_map.insert( sys->name(), sys->path() ); + } + + if ( lst.isEmpty() ) { + m_mode = ListingUnknown; + lst << QObject::tr("Error no Camera Dir found"); + }else + m_mode = ListingStart; + + return lst; +} + +QStringList DCIM_DirLister::findAlbums()const { + QStringList lst = QDir( m_path ).entryList( QDir::Dirs ); + lst.remove( "." ); + lst.remove( ".." ); + + return lst; +} + +QStringList DCIM_DirLister::findImages()const { + return QDir( m_path ).entryList("*.jpg *.jpeg *.png", QDir::Files ); +} + +void DCIM_DirLister::deleteImage( const QString& fl ) { + QFileInfo inf( fl ); + QFile::remove( fl ); + QFile::remove( inf.dirPath ()+"/preview"+ + inf.fileName() ); +} + +void DCIM_DirLister::thumbNail( const QString& _str, int w, int h ) { + QFileInfo inf( _str ); + QString str = QFileInfo( inf.dirPath()+"/preview"+ inf.fileName() ).exists() ? + inf.dirPath()+"/preview"+ inf.fileName() : _str; + + SlaveMaster::self()->thumbNail( str, w, h ); +} + +QImage DCIM_DirLister::image( const QString& str, Factor f, int m ) { + return SlaveMaster::self()->image( str, f, m ); +} + +void DCIM_DirLister::imageInfo( const QString& str ) { + SlaveMaster::self()->thumbInfo( str ); +} + +void DCIM_DirLister::fullImageInfo( const QString& str ) { + SlaveMaster::self()->imageInfo( str ); +} + +QString DCIM_DirLister::nameToFname( const QString& name )const { + return name; +} 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 @@ +/* + * GPLv2 zecke@handhelds.org + */ + +#ifndef DCIM_LISTER_H +#define DCIM_LISTER_H + +#include <iface/dirlister.h> + +#include <qmap.h> + +class Config; + +/** + * The DirLister is responsible for + * telling the GUI about files and folders + * and to load them. + * The DCIM is a special FileSystem lister + * in the that it starts with an overview + * of available 'Cameras'. It looks via 'Storage' + * for paths including a 'dcim' directory. + * And offers these as folders. + * Then it only lists Images. It tries to use + * the 'preview' directory to generate a thumbnail + * but will use the full image for the QImage + * call. + * + */ +class DCIM_DirLister : public PDirLister { + Q_OBJECT +public: + enum ListMode{ + ListingUnknown = -1, + ListingStart=1, /* give an overview over files */ + ListingFolder, /* give access to albums */ + ListingFiles, /* list the content of the album */ + ListingReFolder + }; + DCIM_DirLister(); + ~DCIM_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& )const; + virtual QString dirUp(const QString& )const; + +private: + QStringList findCameras()const; + QStringList findAlbums ()const; + QStringList findImages ()const; + +private: + mutable QString m_path; + mutable ListMode m_mode; + mutable QMap<QString, QString> m_map; +}; + +#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 @@ +HEADERS += impl/dir/dir_dirview.h \ + impl/dir/dir_ifaceinfo.h \ + impl/dir/dir_lister.h + + + +SOURCES += impl/dir/dir_dirview.cpp \ + impl/dir/dir_ifaceinfo.cpp \ + impl/dir/dir_lister.cpp + 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 @@ -7,9 +7,8 @@ /* OPIE */ #include <opie2/odebug.h> #include <qpe/config.h> -using namespace Opie::Core; /* QT */ #include <qwidget.h> #include <qcheckbox.h> @@ -33,9 +32,9 @@ DirInterfaceInfo::DirInterfaceInfo() { DirInterfaceInfo::~DirInterfaceInfo() { } QString DirInterfaceInfo::name()const { - return QString::fromLatin1(QObject::tr("DirView" )); + return QObject::tr("Directory View" ); } QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { DirImageWidget* wid = new DirImageWidget(); @@ -44,8 +43,8 @@ QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { return wid; } void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { - owarn << "Write Config" << oendl; + owarn << "Write Config" << oendl; DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); } 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 @@ -20,19 +20,9 @@ Dir_DirLister::Dir_DirLister( bool list ) : PDirLister( "dir_dir_lister" ) { m_allFiles = list; 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&)) ); - + SlaveHelper::slaveConnectSignals( this ); } QString Dir_DirLister::defaultPath()const { return QPEApplication::documentDir(); 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 @@ +HEADERS += impl/doc/doc_dirview.h \ + impl/doc/doc_ifaceinfo.h \ + impl/doc/doc_lister.h + +SOURCES += impl/doc/doc_dirview.cpp \ + impl/doc/doc_ifaceinfo.cpp \ + 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 @@ -37,9 +37,9 @@ DocInterfaceInfo::~DocInterfaceInfo() { QString DocInterfaceInfo::name()const { return QString::fromLatin1(QObject::tr("DocView" )); } -QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { +QWidget* DocInterfaceInfo::configWidget(const Config& ) { #if 0 DirImageWidget* wid = new DirImageWidget(); wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); @@ -49,9 +49,9 @@ QWidget* DocInterfaceInfo::configWidget(const Config& cfg) { } void DocInterfaceInfo::writeConfig( QWidget* , Config& ) { #if 0 - owarn << "Write Config" << oendl; + 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_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 @@ -20,11 +20,12 @@ using namespace Opie::Core; Doc_DirLister::Doc_DirLister() : PDirLister( "doc_dir_lister" ) { + /* connect the signals */ 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_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&)) ); @@ -35,9 +36,9 @@ Doc_DirLister::Doc_DirLister() m_filemap.clear(); } QString Doc_DirLister::defaultPath()const { - return ""; QPEApplication::documentDir(); + return QString::null; } QString Doc_DirLister::setStartPath(const QString&) { static const QString Mtype_str("image/jpeg;image/gif;image/bmp;image/png"); @@ -77,36 +78,32 @@ 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]; 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 ); @@ -114,9 +111,8 @@ void Doc_DirLister::fullImageInfo( const QString& str) { 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); @@ -124,9 +120,8 @@ void Doc_DirLister::slotFullInfo(const QString&f, const QString&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); @@ -134,9 +129,8 @@ void Doc_DirLister::slotThumbInfo(const QString&f, const QString&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); @@ -144,9 +138,12 @@ void Doc_DirLister::slotThumbNail(const QString&f, const QPixmap&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]; } + +QString Doc_DirLister::dirUp( const QString& p ) const{ + return p; +} 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 @@ -28,8 +28,9 @@ public: QImage image( const QString&, Factor, int ); void imageInfo( const QString& ); void fullImageInfo( const QString& ); virtual QString nameToFname(const QString&name)const; + QString dirUp( const QString& )const; private: QMap<QString,QString> m_namemap,m_filemap; protected slots: diff --git a/noncore/graphics/opie-eye/lib/slavemaster.cpp b/noncore/graphics/opie-eye/lib/slavemaster.cpp index 5bb7ab8..d7165cc 100644 --- a/noncore/graphics/opie-eye/lib/slavemaster.cpp +++ b/noncore/graphics/opie-eye/lib/slavemaster.cpp @@ -26,9 +26,9 @@ QDataStream & operator >> (QDataStream & str, bool & b) /* * ! We don't put a Pixmap in!!!! */ QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { - owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; + owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; return s << inf.file << inf.width << inf.height; } QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { s >> inf.file >> inf.pixmap >> inf.width >> inf.height; @@ -81,12 +81,12 @@ void SlaveMaster::imageInfo( const QString& str ) { } void SlaveMaster::thumbNail( const QString& str, int w, int h ) { if ( str.isEmpty() ) { - owarn << "Asking for empty nail" << oendl; + owarn << "Asking for empty nail" << oendl; return; } - owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl; + owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl; PixmapInfo item; item.file = str; item.width = w; item.height = h; item.pixmap = QPixmap(); m_inThumbNail.append( item ); @@ -108,9 +108,9 @@ void SlaveMaster::recieve( const QCString& str, const QByteArray& at) { stream >> pixinfos; else if ( str == "pixmapsHandled(StringList)" ) stream >> infos; - owarn << "PixInfos " << pixinfos.count() << "" << oendl; + owarn << "PixInfos " << pixinfos.count() << "" << oendl; bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() ); if ( got_data ) { emit sig_start(); @@ -148,7 +148,23 @@ void SlaveMaster::slotTimerStart() { m_inImageInfo.clear(); m_inThumbNail.clear(); } -QImage SlaveMaster::image( const QString& str, PDirLister::Factor, int ) { +QImage SlaveMaster::image( const QString& , PDirLister::Factor, int ) { return QImage(); } + + +namespace SlaveHelper { +void slaveConnectSignals( QObject* target ) { + SlaveMaster* master = SlaveMaster::self(); + + QObject::connect( master, SIGNAL(sig_start()), target, SIGNAL(sig_start()) ); + QObject::connect( master, SIGNAL(sig_end()), target, SIGNAL(sig_end()) ); + QObject::connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), + target, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); + QObject::connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), + target, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); + QObject::connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), + target, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); +} +} diff --git a/noncore/graphics/opie-eye/lib/slavemaster.h b/noncore/graphics/opie-eye/lib/slavemaster.h index f5284a6..98c3403 100644 --- a/noncore/graphics/opie-eye/lib/slavemaster.h +++ b/noncore/graphics/opie-eye/lib/slavemaster.h @@ -7,8 +7,18 @@ #include <qobject.h> #include <qstring.h> #include <qsize.h> +namespace SlaveHelper { +/** + * Small Helper to create a SlaveMaster + * and to connect its' signals to the + * object. To use the object as a proxy + */ +void slaveConnectSignals( QObject* ); +} + + class SlaveMaster : public QObject { Q_OBJECT typedef QValueList<ImageInfo> ImageInfos; typedef QValueList<PixmapInfo> PixmapInfos; diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 0a57a0f..b266f9a 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro @@ -3,37 +3,16 @@ DESTDIR = $(OPIEDIR)/bin TEMPLATE = app TARGET = opie-eye # the name of the resulting object -HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ - lib/imagecache.h impl/dir/dir_dirview.h \ - iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ - impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ - lib/slavemaster.h \ - iface/slaveiface.h \ - gui/imageinfoui.h \ - gui/imageview.h \ - gui/viewmodebutton.h \ - impl/doc/doc_lister.h impl/doc/doc_dirview.h \ - impl/doc/doc_ifaceinfo.h - -# A list header files - - -SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ - lib/imagecache.cpp lib/viewmap.cpp \ - impl/dir/dir_dirview.cpp iface/dirlister.cpp \ - iface/dirview.cpp impl/dir/dir_lister.cpp \ - impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ - gui/imageinfoui.cpp \ - gui/imageview.cpp \ - gui/viewmodebutton.cpp \ - impl/doc/doc_lister.cpp impl/doc/doc_dirview.cpp \ - impl/doc/doc_ifaceinfo.cpp -# A list of source files - -INTERFACES = -# list of ui files + +include( gui/gui.pro ) +include( lib/lib.pro ) +include( iface/iface.pro ) +include( impl/doc/doc.pro ) +include( impl/dir/dir.pro ) +include( impl/dcim/dcim.pro ) + INCLUDEPATH += . $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include diff --git a/noncore/graphics/opie-eye/slave/.cvsignore b/noncore/graphics/opie-eye/slave/.cvsignore new file mode 100644 index 0000000..52494fb --- a/dev/null +++ b/noncore/graphics/opie-eye/slave/.cvsignore @@ -0,0 +1,2 @@ +Makefile +*.moc |