summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
index 177df77..2580215 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
@@ -11,6 +11,7 @@
11#include <qimage.h> 11#include <qimage.h>
12#include <qpixmap.h> 12#include <qpixmap.h>
13#include <qstring.h> 13#include <qstring.h>
14#include <qfileinfo.h>
14 15
15#include <lib/slavemaster.h> 16#include <lib/slavemaster.h>
16#include <lib/imagecache.h> 17#include <lib/imagecache.h>
@@ -18,6 +19,8 @@
18#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
19#include <qpe/resource.h> 20#include <qpe/resource.h>
20 21
22#define THUMBSIZE 128
23
21imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) 24imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl )
22 : QWidget( parent, name, fl ),currentFile(_path) 25 : QWidget( parent, name, fl ),currentFile(_path)
23{ 26{
@@ -30,11 +33,12 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF
30 setCaption( tr( "Image info" ) ); 33 setCaption( tr( "Image info" ) );
31 imageinfoLayout = new QVBoxLayout( this ); 34 imageinfoLayout = new QVBoxLayout( this );
32 imageinfoLayout->setSpacing(2); 35 imageinfoLayout->setSpacing(2);
33 imageinfoLayout->setMargin(2); 36 imageinfoLayout->setMargin(4);
34 37
35 PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); 38 PixmapLabel1 = new QLabel( this, "PixmapLabel1" );
36 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); 39 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) );
37 PixmapLabel1->setScaledContents( TRUE ); 40 QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") );
41
38 imageinfoLayout->addWidget( PixmapLabel1 ); 42 imageinfoLayout->addWidget( PixmapLabel1 );
39 43
40 Line1 = new QFrame( this, "Line1" ); 44 Line1 = new QFrame( this, "Line1" );
@@ -45,9 +49,12 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF
45 imageinfoLayout->addWidget( fnameLabel); 49 imageinfoLayout->addWidget( fnameLabel);
46 50
47 TextView1 = new QTextView( this, "TextView1" ); 51 TextView1 = new QTextView( this, "TextView1" );
48 TextView1->setFrameShadow( QTextView::Plain ); 52 TextView1->setFrameShadow( QTextView::Sunken );
49 QToolTip::add( TextView1, tr( "Displays info of selected image" ) ); 53 TextView1->setResizePolicy( QTextView::AutoOneFit );
50 QWhatsThis::add( TextView1, tr( "Displays info of selected image" ) ); 54 TextView1->setBackgroundOrigin( QTextView::ParentOrigin );
55 TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) );
56// TextView1->setVScrollBarMode(QScrollView::AlwaysOn);
57 QWhatsThis::add( TextView1, tr("Displays info of selected image") );
51 imageinfoLayout->addWidget( TextView1 ); 58 imageinfoLayout->addWidget( TextView1 );
52 59
53 SlaveMaster* master = SlaveMaster::self(); 60 SlaveMaster* master = SlaveMaster::self();
@@ -61,12 +68,14 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF
61void imageinfo::slotChangeName(const QString&_path) 68void imageinfo::slotChangeName(const QString&_path)
62{ 69{
63 currentFile=_path; 70 currentFile=_path;
64 fnameLabel->setText("<qt><center><b>"+currentFile+"</b></center></qt>"); 71 QFileInfo fi(_path);
72 fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>");
65 SlaveMaster::self()->imageInfo( currentFile ); 73 SlaveMaster::self()->imageInfo( currentFile );
66 74
67 QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, 64, 64 ); 75 QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE );
68 if (!m_pix) { 76 if (!m_pix) {
69 PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); 77 PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" )));
78 SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE);
70 } else { 79 } else {
71 PixmapLabel1->setPixmap(*m_pix); 80 PixmapLabel1->setPixmap(*m_pix);
72 } 81 }
@@ -85,16 +94,20 @@ void imageinfo::slot_fullInfo(const QString&_path, const QString&_t)
85 qDebug(_t); 94 qDebug(_t);
86 QString t = _t; 95 QString t = _t;
87 t.replace(QRegExp("\n"),"<br>"); 96 t.replace(QRegExp("\n"),"<br>");
97/* t.replace(QRegeExp("<qt>","");
98 t.replace(QRegeExp("</qt>","");*/
88 TextView1->setText(t); 99 TextView1->setText(t);
89 } 100 }
90} 101}
91 102
92void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) 103void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix)
93{ 104{
94 if (_pix.width()>0)
95 PPixmapCache::self()->insertImage( _path, _pix, 64, 64 );
96 if (_path == currentFile) { 105 if (_path == currentFile) {
97 PixmapLabel1->setPixmap( _pix ); 106 if (_pix.width()>0) {
107 PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE );
108 PixmapLabel1->setPixmap( _pix );
109 PixmapLabel1->resize(QSize(_pix.width(),_pix.height()));
110 }
98 } 111 }
99} 112}
100 113