author | alwin <alwin> | 2004-04-04 02:44:21 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-04 02:44:21 (UTC) |
commit | df0b892f8ec86ae6d21351a8ce1677d904dcdb2a (patch) (side-by-side diff) | |
tree | 57dfd32247fe39ff480cc5e174675150112ed46f /noncore/graphics/opie-eye | |
parent | 354ad5e87ce582ee45b52cd6019bb94348958584 (diff) | |
download | opie-df0b892f8ec86ae6d21351a8ce1677d904dcdb2a.zip opie-df0b892f8ec86ae6d21351a8ce1677d904dcdb2a.tar.gz opie-df0b892f8ec86ae6d21351a8ce1677d904dcdb2a.tar.bz2 |
first shot of an image info widget (this moment encapsulated just in a test
dlg which will removed later)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 13 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 114 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.h | 48 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 8 |
4 files changed, 177 insertions, 6 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index f415d39..ac4b899 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -6,6 +6,7 @@ #include "iconview.h" #include <lib/imagecache.h> +#include <gui/imageinfoui.h> #include <iface/dirview.h> #include <iface/dirlister.h> @@ -18,7 +19,7 @@ #include <qpe/qpemessagebox.h> #include <qpe/ir.h> #include <qpe/qcopenvelope_qws.h> - +#include <qpe/qpeapplication.h> #include <qiconview.h> #include <qlabel.h> @@ -376,8 +377,14 @@ void PIconView::slotShowImage( const QString& ) { } void PIconView::slotImageInfo() { - + qDebug("image info"); + bool isDir = false; + QString name = currentFileName(isDir); + if (isDir) return; + infoDlg dlg(name); + QPEApplication::execDialog(&dlg); } -void PIconView::slotImageInfo( const QString& ) { +void PIconView::slotImageInfo( const QString& ) { + } diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp new file mode 100644 index 0000000..177df77 --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp @@ -0,0 +1,114 @@ +#include "imageinfoui.h" + +#include <qframe.h> +#include <qlabel.h> +#include <qpushbutton.h> +#include <qtextview.h> +#include <qlayout.h> +#include <qvariant.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qimage.h> +#include <qpixmap.h> +#include <qstring.h> + +#include <lib/slavemaster.h> +#include <lib/imagecache.h> + +#include <qpe/qcopenvelope_qws.h> +#include <qpe/resource.h> + +imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ),currentFile(_path) +{ + { + QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); + } + if ( !name ) + setName( "imageinfo" ); + resize( 289, 335 ); + setCaption( tr( "Image info" ) ); + imageinfoLayout = new QVBoxLayout( this ); + imageinfoLayout->setSpacing(2); + imageinfoLayout->setMargin(2); + + PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); + PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); + PixmapLabel1->setScaledContents( TRUE ); + imageinfoLayout->addWidget( PixmapLabel1 ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + imageinfoLayout->addWidget( Line1 ); + + fnameLabel = new QLabel( this, "FnameLabel" ); + imageinfoLayout->addWidget( fnameLabel); + + TextView1 = new QTextView( this, "TextView1" ); + TextView1->setFrameShadow( QTextView::Plain ); + QToolTip::add( TextView1, tr( "Displays info of selected image" ) ); + QWhatsThis::add( TextView1, tr( "Displays info of selected image" ) ); + imageinfoLayout->addWidget( TextView1 ); + + SlaveMaster* master = SlaveMaster::self(); + connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), + this, SLOT(slot_fullInfo(const QString&, const QString&)) ); + connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), + this, SLOT(slotThumbNail(const QString&, const QPixmap&))); + slotChangeName(_path); +} + +void imageinfo::slotChangeName(const QString&_path) +{ + currentFile=_path; + fnameLabel->setText("<qt><center><b>"+currentFile+"</b></center></qt>"); + SlaveMaster::self()->imageInfo( currentFile ); + + QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, 64, 64 ); + if (!m_pix) { + PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); + } else { + PixmapLabel1->setPixmap(*m_pix); + } +} + +imageinfo::~imageinfo() +{ + { + QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); + } +} + +void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) +{ + if (_path == currentFile) { + qDebug(_t); + QString t = _t; + t.replace(QRegExp("\n"),"<br>"); + TextView1->setText(t); + } +} + +void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) +{ + if (_pix.width()>0) + PPixmapCache::self()->insertImage( _path, _pix, 64, 64 ); + if (_path == currentFile) { + PixmapLabel1->setPixmap( _pix ); + } +} + +/* for testing */ +infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) + :QDialog(parent,name,true,WStyle_ContextHelp) +{ + QVBoxLayout*dlglayout = new QVBoxLayout(this); + dlglayout->setSpacing(2); + dlglayout->setMargin(1); + imageinfo*inf = new imageinfo(fname,this); + dlglayout->addWidget(inf); +} + +infoDlg::~infoDlg() +{ +} diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h new file mode 100644 index 0000000..34ec937 --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/imageinfoui.h @@ -0,0 +1,48 @@ +#ifndef IMAGEINFO_H +#define IMAGEINFO_H + +#include <qvariant.h> +#include <qwidget.h> +#include <qdialog.h> + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QFrame; +class QLabel; +class QTextView; + +class imageinfo : public QWidget +{ + Q_OBJECT + +public: + imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~imageinfo(); + + QLabel* PixmapLabel1; + QLabel* fnameLabel; + QFrame* Line1; + QTextView* TextView1; + +protected: + QVBoxLayout* imageinfoLayout; + QString currentFile; + +protected slots: + virtual void slot_fullInfo(const QString&, const QString&); + virtual void slotThumbNail(const QString&, const QPixmap&); + + virtual void slotChangeName(const QString&); +}; + +/* for testing purpose */ +class infoDlg:public QDialog +{ + Q_OBJECT +public: + infoDlg(const QString&,QWidget * parent=0, const char * name=0); + virtual ~infoDlg(); +}; + +#endif // IMAGEINFO_H diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 3547af0..17fa22c 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro @@ -9,7 +9,8 @@ HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.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 + iface/slaveiface.h \ + gui/imageinfoui.h # A list header files @@ -18,10 +19,11 @@ 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 + impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ + gui/imageinfoui.cpp # A list of source files -INTERFACES = +INTERFACES = # list of ui files INCLUDEPATH += . $(OPIEDIR)/include |