summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/imageinfoui.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/imageinfoui.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp114
1 files changed, 114 insertions, 0 deletions
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 @@
1#include "imageinfoui.h"
2
3#include <qframe.h>
4#include <qlabel.h>
5#include <qpushbutton.h>
6#include <qtextview.h>
7#include <qlayout.h>
8#include <qvariant.h>
9#include <qtooltip.h>
10#include <qwhatsthis.h>
11#include <qimage.h>
12#include <qpixmap.h>
13#include <qstring.h>
14
15#include <lib/slavemaster.h>
16#include <lib/imagecache.h>
17
18#include <qpe/qcopenvelope_qws.h>
19#include <qpe/resource.h>
20
21imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl )
22 : QWidget( parent, name, fl ),currentFile(_path)
23{
24 {
25 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
26 }
27 if ( !name )
28 setName( "imageinfo" );
29 resize( 289, 335 );
30 setCaption( tr( "Image info" ) );
31 imageinfoLayout = new QVBoxLayout( this );
32 imageinfoLayout->setSpacing(2);
33 imageinfoLayout->setMargin(2);
34
35 PixmapLabel1 = new QLabel( this, "PixmapLabel1" );
36 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1->sizePolicy().hasHeightForWidth() ) );
37 PixmapLabel1->setScaledContents( TRUE );
38 imageinfoLayout->addWidget( PixmapLabel1 );
39
40 Line1 = new QFrame( this, "Line1" );
41 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
42 imageinfoLayout->addWidget( Line1 );
43
44 fnameLabel = new QLabel( this, "FnameLabel" );
45 imageinfoLayout->addWidget( fnameLabel);
46
47 TextView1 = new QTextView( this, "TextView1" );
48 TextView1->setFrameShadow( QTextView::Plain );
49 QToolTip::add( TextView1, tr( "Displays info of selected image" ) );
50 QWhatsThis::add( TextView1, tr( "Displays info of selected image" ) );
51 imageinfoLayout->addWidget( TextView1 );
52
53 SlaveMaster* master = SlaveMaster::self();
54 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
55 this, SLOT(slot_fullInfo(const QString&, const QString&)) );
56 connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
57 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
58 slotChangeName(_path);
59}
60
61void imageinfo::slotChangeName(const QString&_path)
62{
63 currentFile=_path;
64 fnameLabel->setText("<qt><center><b>"+currentFile+"</b></center></qt>");
65 SlaveMaster::self()->imageInfo( currentFile );
66
67 QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, 64, 64 );
68 if (!m_pix) {
69 PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" )));
70 } else {
71 PixmapLabel1->setPixmap(*m_pix);
72 }
73}
74
75imageinfo::~imageinfo()
76{
77 {
78 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
79 }
80}
81
82void imageinfo::slot_fullInfo(const QString&_path, const QString&_t)
83{
84 if (_path == currentFile) {
85 qDebug(_t);
86 QString t = _t;
87 t.replace(QRegExp("\n"),"<br>");
88 TextView1->setText(t);
89 }
90}
91
92void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix)
93{
94 if (_pix.width()>0)
95 PPixmapCache::self()->insertImage( _path, _pix, 64, 64 );
96 if (_path == currentFile) {
97 PixmapLabel1->setPixmap( _pix );
98 }
99}
100
101/* for testing */
102infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name)
103 :QDialog(parent,name,true,WStyle_ContextHelp)
104{
105 QVBoxLayout*dlglayout = new QVBoxLayout(this);
106 dlglayout->setSpacing(2);
107 dlglayout->setMargin(1);
108 imageinfo*inf = new imageinfo(fname,this);
109 dlglayout->addWidget(inf);
110}
111
112infoDlg::~infoDlg()
113{
114}