summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp31
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp3
-rw-r--r--noncore/graphics/opie-eye/iface/dirlister.h3
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_ifacceinfo.h4
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.cpp7
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.h3
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_dirview.cpp28
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_dirview.h24
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.cpp57
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_ifaceinfo.h21
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.cpp148
-rw-r--r--noncore/graphics/opie-eye/impl/doc/doc_lister.h42
-rw-r--r--noncore/graphics/opie-eye/phunk_view.pro8
13 files changed, 362 insertions, 17 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 660c4fa..087db30 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -346,5 +346,5 @@ void PIconView::loadViews() {
ViewMap* map = viewMap();
for ( it = map->begin(); it != map->end(); ++it )
- m_views->insertItem( QObject::tr(it.key() ) );
+ m_views->insertItem( it.key() );
}
@@ -363,7 +363,13 @@ void PIconView::slotViewChanged( int i) {
PDirView* cur = currentView();
- delete cur;
+ if (cur) delete cur;
QString str = m_views->text(i);
- cur = (*(*viewMap())[str])(*m_cfg);
+ ViewMap* map = viewMap();
+ if (!map) {setCurrentView(0l); return;}
+ if (map->find(str) == map->end()) {
+ owarn << "Key not found" << oendl;
+ setCurrentView(0l); return;
+ }
+ cur = (*(*map)[str])(*m_cfg);
setCurrentView( cur );
@@ -407,7 +413,11 @@ void PIconView::addFiles( const QStringList& lst) {
IconViewItem * _iv;
QPixmap*m_pix = 0;
+ QString pre = "";
+ if (!m_path.isEmpty()) {
+ pre = m_path+"/";
+ }
for (it=lst.begin(); it!= lst.end(); ++it ) {
- m_pix = PPixmapCache::self()->cachedImage( m_path+"/"+(*it), 64, 64 );
- _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
+ m_pix = PPixmapCache::self()->cachedImage( pre+(*it), 64, 64 );
+ _iv = new IconViewItem( m_view, pre+(*it), (*it) );
if (m_mode==3) {
_iv->setTextOnly(true);
@@ -544,9 +554,10 @@ void PIconView::slotShowImage()
QString name = currentFileName(isDir);
if (isDir) return;
-
slotShowImage( name );
}
void PIconView::slotShowImage( const QString& name) {
- emit sig_display( name );
+ PDirLister *lister = currentView()->dirLister();
+ QString r_name = lister->nameToFname(name);
+ emit sig_display( r_name );
}
void PIconView::slotImageInfo() {
@@ -559,5 +570,7 @@ void PIconView::slotImageInfo() {
void PIconView::slotImageInfo( const QString& name) {
- emit sig_showInfo( name );
+ PDirLister *lister = currentView()->dirLister();
+ QString r_name = lister->nameToFname(name);
+ emit sig_showInfo(r_name );
}
@@ -580,6 +593,4 @@ void PIconView::resizeEvent( QResizeEvent* re ) {
void PIconView::calculateGrid() {
- odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl;
- odebug << "Size of view: " << m_view->size() << oendl;
int dw = QApplication::desktop()->width();
int viewerWidth = dw-style().scrollBarExtent().width();
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 58f02ef..058fca0 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -35,5 +35,6 @@
-OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
+//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
+OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
diff --git a/noncore/graphics/opie-eye/iface/dirlister.h b/noncore/graphics/opie-eye/iface/dirlister.h
index fcc55ec..9c7b2a9 100644
--- a/noncore/graphics/opie-eye/iface/dirlister.h
+++ b/noncore/graphics/opie-eye/iface/dirlister.h
@@ -30,4 +30,5 @@ public slots:
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:
@@ -42,5 +43,5 @@ signals:
protected:
- ~PDirLister();
+ virtual ~PDirLister();
};
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
@@ -7,10 +7,10 @@
#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;
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
@@ -21,5 +21,5 @@ Dir_DirLister::Dir_DirLister( bool list )
{
m_allFiles = list;
- owarn << "All Files " << m_allFiles << "" << oendl;
+ owarn << "All Files " << m_allFiles << "" << oendl;
SlaveMaster* master = SlaveMaster::self();
@@ -96,2 +96,7 @@ 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
@@ -12,6 +12,8 @@
class Config;
class Dir_DirLister : public PDirLister {
+ Q_OBJECT
public:
Dir_DirLister( bool );
+ virtual ~Dir_DirLister(){}
QString defaultPath()const;
@@ -26,4 +28,5 @@ public:
void imageInfo( const QString& );
void fullImageInfo( const QString& );
+ virtual QString nameToFname(const QString&name)const;
private:
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
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro
index 57e69b6..0a57a0f 100644
--- a/noncore/graphics/opie-eye/phunk_view.pro
+++ b/noncore/graphics/opie-eye/phunk_view.pro
@@ -13,5 +13,7 @@ HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \
gui/imageinfoui.h \
gui/imageview.h \
- gui/viewmodebutton.h
+ gui/viewmodebutton.h \
+ impl/doc/doc_lister.h impl/doc/doc_dirview.h \
+ impl/doc/doc_ifaceinfo.h
# A list header files
@@ -25,5 +27,7 @@ SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \
gui/imageinfoui.cpp \
gui/imageview.cpp \
- gui/viewmodebutton.cpp
+ gui/viewmodebutton.cpp \
+ impl/doc/doc_lister.cpp impl/doc/doc_dirview.cpp \
+ impl/doc/doc_ifaceinfo.cpp
# A list of source files