summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index f173ecc..5472ead 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -89,58 +89,61 @@ namespace {
static QMap<QString, IconViewItem*> g_stringInf;
static QMap<QString, IconViewItem*> g_stringPix;
IconViewItem::IconViewItem( QIconView* view,const QString& path,
const QString& name, int a_iconsize, bool isDir)
: QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
m_noInfo( false ),m_textOnly(false),m_Pixset(false)
{
m_iconsize = a_iconsize;
if ( isDir ) {
if (!_dirPix ) {
_dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
}
} else {
if (!_unkPix ) {
_unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
}
}
check_pix();
}
inline void IconViewItem::check_pix()const
{
if (_dirPix && _dirPix->width()>m_iconsize) {
- QPixmap*Pix = new QPixmap(*_dirPix);
- Pix->resize(m_iconsize,m_iconsize);
- delete _dirPix;
- _dirPix = Pix;
+ QImage Pix = _dirPix->convertToImage();
+ *_dirPix = Pix.smoothScale(m_iconsize,m_iconsize);
}
if (!_cpyPix && _unkPix) {
if (_unkPix->width()>=m_iconsize) {
- _cpyPix = new QPixmap(*_unkPix);
- if (_unkPix->width()>m_iconsize)
- _cpyPix->resize(m_iconsize,m_iconsize);
+ QImage Pix = _unkPix->convertToImage();
+ _cpyPix = new QPixmap();
+ if (_unkPix->width()>m_iconsize) {
+ *_cpyPix = Pix.smoothScale(m_iconsize,m_iconsize);
+ } else {
+ _cpyPix->convertFromImage(Pix);
+ }
+
} else {
_cpyPix = new QPixmap(m_iconsize,m_iconsize);
_cpyPix->fill();
QPainter pa(_cpyPix);
int offset = (m_iconsize-_unkPix->width())/2;
int offy = (m_iconsize-_unkPix->height())/2;
if (offy<0) offy=0;
pa.drawPixmap(offset,offy,*_unkPix);
pa.end();
}
}
}
inline void IconViewItem::setPixmap( const QPixmap & , bool, bool )
{
m_Pixset = true;
calcRect(text());
}
inline void IconViewItem::setPixmap( const QPixmap & )
{
m_Pixset = true;
calcRect(text());
}