From c978418067f228bd21cef23a13009d591e55f8df Mon Sep 17 00:00:00 2001 From: alwin Date: Sun, 04 Apr 2004 14:10:59 +0000 Subject: resizing when getting larger thumbnails works default thumbnail for that is 128 pix instead of 64 --- (limited to 'noncore') 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 @@ #include #include #include +#include #include #include @@ -18,6 +19,8 @@ #include #include +#define THUMBSIZE 128 + imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ),currentFile(_path) { @@ -30,11 +33,12 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF setCaption( tr( "Image info" ) ); imageinfoLayout = new QVBoxLayout( this ); imageinfoLayout->setSpacing(2); - imageinfoLayout->setMargin(2); + imageinfoLayout->setMargin(4); PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); - PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); - PixmapLabel1->setScaledContents( TRUE ); + PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); + QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); + imageinfoLayout->addWidget( PixmapLabel1 ); Line1 = new QFrame( this, "Line1" ); @@ -45,9 +49,12 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF 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" ) ); + TextView1->setFrameShadow( QTextView::Sunken ); + TextView1->setResizePolicy( QTextView::AutoOneFit ); + TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); + TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); +// TextView1->setVScrollBarMode(QScrollView::AlwaysOn); + QWhatsThis::add( TextView1, tr("Displays info of selected image") ); imageinfoLayout->addWidget( TextView1 ); SlaveMaster* master = SlaveMaster::self(); @@ -61,12 +68,14 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF void imageinfo::slotChangeName(const QString&_path) { currentFile=_path; - fnameLabel->setText("
"+currentFile+"
"); + QFileInfo fi(_path); + fnameLabel->setText("
"+fi.fileName()+"
"); SlaveMaster::self()->imageInfo( currentFile ); - QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, 64, 64 ); + QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); if (!m_pix) { PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); + SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); } else { PixmapLabel1->setPixmap(*m_pix); } @@ -85,16 +94,20 @@ void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) qDebug(_t); QString t = _t; t.replace(QRegExp("\n"),"
"); +/* t.replace(QRegeExp("",""); + t.replace(QRegeExp("","");*/ 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 ); + if (_pix.width()>0) { + PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); + PixmapLabel1->setPixmap( _pix ); + PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); + } } } -- cgit v0.9.0.2