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 @@ -32,25 +32,24 @@ #include <qtimer.h> #include <qstyle.h> using Opie::Core::OKeyConfigItem; /* * The Icons, Request Cache and IconViewItem for the IconView */ 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); QPixmap* pixmap()const; QString path()const { return m_path; } bool isDir()const { return m_isDir; } void setText( const QString& ); bool textOnly()const{return m_textOnly;} void setTextOnly(bool how){m_textOnly=how;} /* just for starting recalc of item rect! */ virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); @@ -89,30 +88,30 @@ namespace { IconViewItem::IconViewItem( QIconView* view,const QString& path, const QString& name, bool isDir ) : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), m_noInfo( false ),m_textOnly(false),m_Pixset(false) { if ( isDir && !_dirPix ) _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); 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()); } inline QPixmap* IconViewItem::pixmap()const { // owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() // << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() // << " " << iconView()->contentsY() << oendl; if (textOnly()&&!m_isDir) { if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); @@ -244,28 +243,25 @@ void PIconView::initKeys() { Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), this, SLOT(slotImageInfo()) ) ); m_viewManager->load(); m_viewManager->handleWidget( m_view ); } /* * 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 */ void PIconView::slotChangeDir(const QString& path) { if ( !currentView() ) return; PDirLister *lister = currentView()->dirLister(); if (!lister ) return; @@ -370,47 +366,54 @@ void PIconView::resetView() { *swicth view reloadDir and connect signals */ void PIconView::slotViewChanged( int i) { if (!m_views->count() ) { setCurrentView( 0l); return; } 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 ); /* connect to the signals of the lister */ PDirLister* lis = cur->dirLister(); connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), this, SLOT( slotThumbInfo(const QString&, const QString&))); connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), this, SLOT(slotThumbNail(const QString&, const QPixmap&))); connect(lis, SIGNAL(sig_start()), this, SLOT(slotStart())); 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())); } void PIconView::slotReloadDir() { slotChangeDir( m_path ); } /* * add files and folders */ 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 @@ -14,31 +14,35 @@ class PDirLister : public QObject { Q_OBJECT public: enum Factor { Width, Height, None }; PDirLister( const char* name ); virtual QString defaultPath()const = 0; 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(); void sig_start(); void sig_end(); // If this app ever happens to get multithreaded... void sig_thumbInfo( const QString&, const QString& ); void sig_fullInfo( const QString&, const QString& ); void sig_thumbNail( const QString&, const QPixmap& ); protected: 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 @@ -1,19 +1,19 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #ifndef PHUNK_INTERFACE_INFO_H #define PHUNK_INTERFACE_INFO_H #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; }; #endif 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 @@ -1,23 +1,22 @@ /* * GPLv2 * zecke@handhelds.org */ #include "dir_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> namespace { class DirImageWidget : public QHBox { public: DirImageWidget() { chkbox = new QCheckBox( QObject::tr("Show all files"), this ); @@ -25,27 +24,27 @@ namespace { ~DirImageWidget() {} QCheckBox* chkbox; }; } 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(); wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); 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 @@ -12,35 +12,25 @@ #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; - - 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(); } QString Dir_DirLister::setStartPath( const QString& path ) { m_currentDir.cd( path ); if (!m_currentDir.exists() ) m_currentDir.cd(defaultPath()); 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 @@ -29,29 +29,29 @@ namespace { } #endif DocInterfaceInfo::DocInterfaceInfo() { } 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) ); return wid; #endif return 0L; } 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 @@ -12,40 +12,41 @@ #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" ) { + /* 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&)) ); connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), this, SLOT(slotThumbNail(const QString&, const QPixmap&)) ); m_namemap.clear(); 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"); if (m_namemap.isEmpty()) { DocLnkSet ds; Global::findDocuments(&ds,Mtype_str); QListIterator<DocLnk> dit(ds.children()); for( ; dit.current(); ++dit) { // if (! (*dit)->isValid()) continue; m_namemap[(*dit)->name()]=(*dit)->file(); m_filemap[(*dit)->file()]=(*dit)->name(); @@ -69,84 +70,80 @@ QStringList Doc_DirLister::files()const { for (it = m_namemap.begin();it != m_namemap.end();++it) { out.append(it.key()); } return 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]; 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]; } + +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 @@ -20,22 +20,23 @@ public: 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; + QString dirUp( const QString& )const; private: QMap<QString,QString> m_namemap,m_filemap; protected slots: virtual void slotFullInfo(const QString&, const QString&); virtual void slotThumbInfo(const QString&, const QString&); virtual void slotThumbNail(const QString&, const QPixmap&); }; #endif 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 @@ -18,25 +18,25 @@ QDataStream & operator << (QDataStream & str, bool b) QDataStream & operator >> (QDataStream & str, bool & b) { Q_INT8 l; str >> l; b = bool(l); return str; } /* * ! 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; return s; } QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { return s << i.kind << i.file << i.info; } QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { s >> i.kind >> i.file >> i.info; return s; @@ -73,52 +73,52 @@ void SlaveMaster::thumbInfo( const QString& str) { } void SlaveMaster::imageInfo( const QString& str ) { m_inImageInfo.append( str ); if ( !m_started ) { QTimer::singleShot( 0, this, SLOT(slotTimerStart())); m_started = true; } } 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 ); if ( !m_started ) { QTimer::singleShot( 0, this, SLOT(slotTimerStart())); m_started = true; } } void SlaveMaster::recieve( const QCString& str, const QByteArray& at) { ImageInfos infos; PixmapInfos pixinfos; QDataStream stream( at, IO_ReadOnly ); if ( str == "pixmapsHandled(PixmapList)" ) 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(); for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) { if ( (*_it).kind ) emit sig_fullInfo( (*_it).file, (*_it).info ); else emit sig_thumbInfo( (*_it).file, (*_it).info ); } for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) @@ -140,15 +140,31 @@ void SlaveMaster::slotTimerStart() { } if ( !m_inThumbNail.isEmpty() ) { QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); env << m_inThumbNail; } m_inThumbInfo.clear(); 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 @@ -1,22 +1,32 @@ #ifndef OPIE_EYE_SLAVE_MASTER_H #define OPIE_EYE_SLAVE_MASTER_H #include <iface/dirlister.h> #include <iface/slaveiface.h> #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; public: static SlaveMaster *self(); void thumbInfo( const QString& ); void imageInfo( const QString& ); void thumbNail( const QString&, int w, int h ); QImage image( const QString&, PDirLister::Factor, int ); signals: 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 @@ -1,44 +1,23 @@ CONFIG += qt warn_on quick-app 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 LIBS += -lqpe -lopiecore2 -lopieui2 -lopiemm2 include ( $(OPIEDIR)/include.pro ) 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 |