summaryrefslogtreecommitdiff
Unidiff
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 {
89 static QMap<QString, IconViewItem*> g_stringInf; 89 static QMap<QString, IconViewItem*> g_stringInf;
90 static QMap<QString, IconViewItem*> g_stringPix; 90 static QMap<QString, IconViewItem*> g_stringPix;
91 91
92 IconViewItem::IconViewItem( QIconView* view,const QString& path, 92 IconViewItem::IconViewItem( QIconView* view,const QString& path,
93 const QString& name, int a_iconsize, bool isDir) 93 const QString& name, int a_iconsize, bool isDir)
94 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), 94 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
95 m_noInfo( false ),m_textOnly(false),m_Pixset(false) 95 m_noInfo( false ),m_textOnly(false),m_Pixset(false)
96 { 96 {
97 m_iconsize = a_iconsize; 97 m_iconsize = a_iconsize;
98 if ( isDir ) { 98 if ( isDir ) {
99 if (!_dirPix ) { 99 if (!_dirPix ) {
100 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); 100 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
101 } 101 }
102 } else { 102 } else {
103 if (!_unkPix ) { 103 if (!_unkPix ) {
104 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); 104 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
105 } 105 }
106 } 106 }
107 check_pix(); 107 check_pix();
108 } 108 }
109 109
110 inline void IconViewItem::check_pix()const 110 inline void IconViewItem::check_pix()const
111 { 111 {
112 if (_dirPix && _dirPix->width()>m_iconsize) { 112 if (_dirPix && _dirPix->width()>m_iconsize) {
113 QPixmap*Pix = new QPixmap(*_dirPix); 113 QImage Pix = _dirPix->convertToImage();
114 Pix->resize(m_iconsize,m_iconsize); 114 *_dirPix = Pix.smoothScale(m_iconsize,m_iconsize);
115 delete _dirPix;
116 _dirPix = Pix;
117 } 115 }
118 if (!_cpyPix && _unkPix) { 116 if (!_cpyPix && _unkPix) {
119 if (_unkPix->width()>=m_iconsize) { 117 if (_unkPix->width()>=m_iconsize) {
120 _cpyPix = new QPixmap(*_unkPix); 118 QImage Pix = _unkPix->convertToImage();
121 if (_unkPix->width()>m_iconsize) 119 _cpyPix = new QPixmap();
122 _cpyPix->resize(m_iconsize,m_iconsize); 120 if (_unkPix->width()>m_iconsize) {
121 *_cpyPix = Pix.smoothScale(m_iconsize,m_iconsize);
122 } else {
123 _cpyPix->convertFromImage(Pix);
124 }
125
123 } else { 126 } else {
124 _cpyPix = new QPixmap(m_iconsize,m_iconsize); 127 _cpyPix = new QPixmap(m_iconsize,m_iconsize);
125 _cpyPix->fill(); 128 _cpyPix->fill();
126 QPainter pa(_cpyPix); 129 QPainter pa(_cpyPix);
127 int offset = (m_iconsize-_unkPix->width())/2; 130 int offset = (m_iconsize-_unkPix->width())/2;
128 int offy = (m_iconsize-_unkPix->height())/2; 131 int offy = (m_iconsize-_unkPix->height())/2;
129 if (offy<0) offy=0; 132 if (offy<0) offy=0;
130 pa.drawPixmap(offset,offy,*_unkPix); 133 pa.drawPixmap(offset,offy,*_unkPix);
131 pa.end(); 134 pa.end();
132 } 135 }
133 } 136 }
134 } 137 }
135 138
136 inline void IconViewItem::setPixmap( const QPixmap & , bool, bool ) 139 inline void IconViewItem::setPixmap( const QPixmap & , bool, bool )
137 { 140 {
138 m_Pixset = true; 141 m_Pixset = true;
139 calcRect(text()); 142 calcRect(text());
140 } 143 }
141 inline void IconViewItem::setPixmap( const QPixmap & ) 144 inline void IconViewItem::setPixmap( const QPixmap & )
142 { 145 {
143 m_Pixset = true; 146 m_Pixset = true;
144 calcRect(text()); 147 calcRect(text());
145 } 148 }
146 149