author | alwin <alwin> | 2004-04-04 14:10:59 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-04 14:10:59 (UTC) |
commit | c978418067f228bd21cef23a13009d591e55f8df (patch) (unidiff) | |
tree | 8330f83fc484ee3be9cf3bf867b5ccca5dae4db9 | |
parent | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (diff) | |
download | opie-c978418067f228bd21cef23a13009d591e55f8df.zip opie-c978418067f228bd21cef23a13009d591e55f8df.tar.gz opie-c978418067f228bd21cef23a13009d591e55f8df.tar.bz2 |
resizing when getting larger thumbnails works
default thumbnail for that is 128 pix instead of 64
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 35 |
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 | |||
@@ -12,4 +12,5 @@ | |||
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> |
@@ -19,4 +20,6 @@ | |||
19 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
20 | 21 | ||
22 | #define THUMBSIZE 128 | ||
23 | |||
21 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) | 24 | imageinfo::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) |
@@ -31,9 +34,10 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF | |||
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 | ||
@@ -46,7 +50,10 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF | |||
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 | ||
@@ -62,10 +69,12 @@ void 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); |
@@ -86,4 +95,6 @@ void imageinfo::slot_fullInfo(const QString&_path, const QString&_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 | } |
@@ -92,8 +103,10 @@ void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) | |||
92 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) | 103 | void 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 | } |