summaryrefslogtreecommitdiff
path: root/noncore/graphics
authoralwin <alwin>2004-03-25 17:13:47 (UTC)
committer alwin <alwin>2004-03-25 17:13:47 (UTC)
commit97016caf3a660676a8a1ce300b7e4c7588262209 (patch) (unidiff)
treed59a6a50d71378516e4a457f2a0d7a839519c74f /noncore/graphics
parent2487430405f4faa9671a81a1db4be825c06bb601 (diff)
downloadopie-97016caf3a660676a8a1ce300b7e4c7588262209.zip
opie-97016caf3a660676a8a1ce300b7e4c7588262209.tar.gz
opie-97016caf3a660676a8a1ce300b7e4c7588262209.tar.bz2
some workarounds so the dirview displays the icons a little bit better
Diffstat (limited to 'noncore/graphics') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 729b64f..aeaa3c6 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -35,12 +35,13 @@ namespace {
35 public: 35 public:
36 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); 36 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false);
37 QPixmap* pixmap()const; 37 QPixmap* pixmap()const;
38 QString path()const { return m_path; } 38 QString path()const { return m_path; }
39 bool isDir()const { return m_isDir; } 39 bool isDir()const { return m_isDir; }
40 void setText( const QString& ); 40 void setText( const QString& );
41 void reCalc();
41 private: 42 private:
42 mutable QPixmap* m_pix; 43 mutable QPixmap* m_pix;
43 QString m_path; 44 QString m_path;
44 bool m_isDir : 1; 45 bool m_isDir : 1;
45 bool m_noInfo :1; 46 bool m_noInfo :1;
46 }; 47 };
@@ -83,12 +84,17 @@ namespace {
83 } 84 }
84 inline void IconViewItem::setText( const QString& str ) { 85 inline void IconViewItem::setText( const QString& str ) {
85 QString text = QIconViewItem::text()+"\n"+str; 86 QString text = QIconViewItem::text()+"\n"+str;
86 m_noInfo = true; 87 m_noInfo = true;
87 QIconViewItem::setText( text ); 88 QIconViewItem::setText( text );
88 } 89 }
90
91 inline void IconViewItem::reCalc()
92 {
93 calcRect();
94 }
89} 95}
90 96
91 97
92PIconView::PIconView( QWidget* wid, Config* cfg ) 98PIconView::PIconView( QWidget* wid, Config* cfg )
93 : QVBox( wid ), m_cfg( cfg ) 99 : QVBox( wid ), m_cfg( cfg )
94{ 100{
@@ -108,13 +114,13 @@ PIconView::PIconView( QWidget* wid, Config* cfg )
108 m_view= new QIconView( this ); 114 m_view= new QIconView( this );
109 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 115 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
110 this, SLOT(slotClicked(QIconViewItem*)) ); 116 this, SLOT(slotClicked(QIconViewItem*)) );
111 117
112 m_view->setArrangement( QIconView::LeftToRight ); 118 m_view->setArrangement( QIconView::LeftToRight );
113 m_view->setItemTextPos( QIconView::Right ); 119 m_view->setItemTextPos( QIconView::Right );
114 120 m_view->setResizeMode(QIconView::Adjust);
115 121
116 int dw = QApplication::desktop()->width(); 122 int dw = QApplication::desktop()->width();
117 int viewerWidth = dw-style().scrollBarExtent().width(); 123 int viewerWidth = dw-style().scrollBarExtent().width();
118 m_view->setGridX( viewerWidth-2*m_view->spacing() ); 124 m_view->setGridX( viewerWidth-2*m_view->spacing() );
119 m_view->setGridY( fontMetrics().height()*2+40 ); 125 m_view->setGridY( fontMetrics().height()*2+40 );
120 loadViews(); 126 loadViews();
@@ -255,21 +261,30 @@ void PIconView::slotClicked(QIconViewItem* _it) {
255 ; 261 ;
256} 262}
257 263
258void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 264void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
259 if ( g_stringInf.contains( _path ) ) { 265 if ( g_stringInf.contains( _path ) ) {
260 IconViewItem* item = g_stringInf[_path]; 266 IconViewItem* item = g_stringInf[_path];
261 item->setText( str ); 267 /* if set the view shows nonsens!
268 I dont know how to fix the format of displayed text :(*/
269 //item->setText( str );
262 item->repaint(); 270 item->repaint();
263 g_stringInf.remove( _path ); 271 g_stringInf.remove( _path );
264 } 272 }
265} 273}
266void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 274void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
267 if ( g_stringPix.contains( _path ) ) { 275 if ( g_stringPix.contains( _path ) ) {
268 IconViewItem* item = g_stringPix[_path]; 276 IconViewItem* item = g_stringPix[_path];
269 PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); 277
278 if (pix.width()>0) {
279 PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
280 /* required for a recalculated rectangle. otherwise the view show nonsense! */
281 item->reCalc();
282 } else {
283 PPixmapCache::self()->insertImage(_path,Resource::loadPixmap( "UnknownDocument" ),64,64 );
284 }
270 item->repaint(); 285 item->repaint();
271 g_stringPix.remove( _path ); 286 g_stringPix.remove( _path );
272 } 287 }
273} 288}
274 289
275 290