author | zecke <zecke> | 2002-10-05 20:49:38 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-05 20:49:38 (UTC) |
commit | 19c0a4610292a95281a64655cef9c2d695a214dc (patch) (side-by-side diff) | |
tree | dde4afda2629a6e10d545d9492ada7b43e431ee7 /libopie/ofileselector/olister.cpp | |
parent | d7f9d00fcc9261db9c4af4f1b4afde9d50e8a2a2 (diff) | |
download | opie-19c0a4610292a95281a64655cef9c2d695a214dc.zip opie-19c0a4610292a95281a64655cef9c2d695a214dc.tar.gz opie-19c0a4610292a95281a64655cef9c2d695a214dc.tar.bz2 |
more steps to make ofileselector modular
We now got the API for a factory so switching should work in future
and we now got a OPixmapProvider which provides us with pixmaps....
So an ImageViewer could install a differen OPixmapProvider
and a different OFileView to make Previewing
work
Diffstat (limited to 'libopie/ofileselector/olister.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/ofileselector/olister.cpp | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/libopie/ofileselector/olister.cpp b/libopie/ofileselector/olister.cpp index 6c43043..b6b03cd 100644 --- a/libopie/ofileselector/olister.cpp +++ b/libopie/ofileselector/olister.cpp @@ -1,72 +1,106 @@ #include "olister.h" #include "ofileview.h" +#include "opixmapprovider.h" #include "ofileselector.h" OLister::OLister( OFileSelector* view) : m_view( view ) { + m_prov = new OPixmapProvider( view ); } OLister::~OLister() { + delete m_prov; +} +void OLister::setPixmapProvider( OPixmapProvider* prov ) { + delete m_prov; + m_prov = prov; } bool OLister::showFiles()const { return m_view->showFiles(); } bool OLister::showDirs()const { return m_view->showDirs(); } void OLister::addFile( const QString& mine, QFileInfo* info, bool isSymlink ) { - view()->currentView()->addFile( mine, + int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : + OPixmapProvider::File; + QPixmap pix = provider()->pixmap(t, mine, + info); + view()->currentView()->addFile( pix, + mine, info, isSymlink ); } void OLister::addFile( const QString& mine, const QString& path, const QString& file, bool isSymlink ) { - view()->currentView()->addFile( mine, + int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : + OPixmapProvider::File; + + QPixmap pix = provider()->pixmap(t, mine, path, file ); + view()->currentView()->addFile( pix, + mine, path, file, isSymlink ); } void OLister::addDir( const QString& mine, QFileInfo* info, bool isSymlink ) { - - view()->currentView()->addDir( mine, + int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : + OPixmapProvider::Dir; + QPixmap pix = provider()->pixmap(t, mine, info ); + view()->currentView()->addDir( pix, + mine, info, isSymlink ); } void OLister::addDir( const QString& mine, const QString& path, const QString& dir, bool isSymlink ) { - view()->currentView()->addDir( mine, + + int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : + OPixmapProvider::Dir; + QPixmap pix = provider()->pixmap(t, mine, path, dir ); + + view()->currentView()->addDir( pix, + mine, path, dir, isSymlink ); } void OLister::addSymlink( const QString& mine, QFileInfo* info, bool isSymlink ) { - view()->currentView()->addSymlink( mine, + QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, info ); + view()->currentView()->addSymlink( pix, + mine, info, isSymlink ); } void OLister::addSymlink( const QString& mine, const QString& path, const QString& name, bool isSymlink ) { - view()->currentView()->addSymlink( mine, + QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, + path, name ); + view()->currentView()->addSymlink( pix, + mine, path, name, isSymlink ); } OFileSelector* OLister::view() { return m_view; } +OPixmapProvider* OLister::provider() { + return m_prov; +} bool OLister::compliesMime( const QString& mime ) { return view()->compliesMime( mime ); } |