summaryrefslogtreecommitdiff
path: root/noncore/graphics
authorzecke <zecke>2004-04-02 19:28:09 (UTC)
committer zecke <zecke>2004-04-02 19:28:09 (UTC)
commit97bdc55663590ba430a4f322ad97aab9f4c02bf3 (patch) (unidiff)
tree8d340684ac97907b73d6b8abf995116f58680cdd /noncore/graphics
parent09d1ebb55ab44ebd129ff44b83b6b20054df77aa (diff)
downloadopie-97bdc55663590ba430a4f322ad97aab9f4c02bf3.zip
opie-97bdc55663590ba430a4f322ad97aab9f4c02bf3.tar.gz
opie-97bdc55663590ba430a4f322ad97aab9f4c02bf3.tar.bz2
-Fix realignment of the items but now it updates too often
-Fix slave not to include <qt></qt> for iconViewName
Diffstat (limited to 'noncore/graphics') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp29
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
-rw-r--r--noncore/graphics/opie-eye/slave/gif_slave.cpp3
-rw-r--r--noncore/graphics/opie-eye/slave/jpeg_slave.cpp5
-rw-r--r--noncore/graphics/opie-eye/slave/png_slave.cpp3
5 files changed, 20 insertions, 22 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index b3f0006..ed9fc9c 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -9,12 +9,13 @@
9 9
10#include <iface/dirview.h> 10#include <iface/dirview.h>
11#include <iface/dirlister.h> 11#include <iface/dirlister.h>
12 12
13#include <opie2/oconfig.h> 13#include <opie2/oconfig.h>
14#include <opie2/okeyconfigwidget.h> 14#include <opie2/okeyconfigwidget.h>
15#include <opie2/odebug.h>
15 16
16#include <qpe/resource.h> 17#include <qpe/resource.h>
17#include <qpe/qpemessagebox.h> 18#include <qpe/qpemessagebox.h>
18#include <qpe/ir.h> 19#include <qpe/ir.h>
19#include <qpe/qcopenvelope_qws.h> 20#include <qpe/qcopenvelope_qws.h>
20 21
@@ -39,13 +40,14 @@ namespace {
39 public: 40 public:
40 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); 41 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false);
41 QPixmap* pixmap()const; 42 QPixmap* pixmap()const;
42 QString path()const { return m_path; } 43 QString path()const { return m_path; }
43 bool isDir()const { return m_isDir; } 44 bool isDir()const { return m_isDir; }
44 void setText( const QString& ); 45 void setText( const QString& );
45 void reCalc(); 46
47
46 private: 48 private:
47 mutable QPixmap* m_pix; 49 mutable QPixmap* m_pix;
48 QString m_path; 50 QString m_path;
49 bool m_isDir : 1; 51 bool m_isDir : 1;
50 bool m_noInfo :1; 52 bool m_noInfo :1;
51 }; 53 };
@@ -67,12 +69,16 @@ namespace {
67 if ( isDir && !_dirPix ) 69 if ( isDir && !_dirPix )
68 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); 70 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
69 else if ( !isDir && !_unkPix ) 71 else if ( !isDir && !_unkPix )
70 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); 72 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
71 } 73 }
72 inline QPixmap* IconViewItem::pixmap()const { 74 inline QPixmap* IconViewItem::pixmap()const {
75 qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d",
76 rect().x(),rect().y(),rect().width(),rect().height(),
77 iconView()->contentsX(), iconView()->contentsY());
78
73 if ( m_isDir ) 79 if ( m_isDir )
74 return _dirPix; 80 return _dirPix;
75 else{ 81 else{
76 if (!m_noInfo && !g_stringInf.contains( m_path ) ) { 82 if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
77 currentView()->dirLister()->imageInfo( m_path ); 83 currentView()->dirLister()->imageInfo( m_path );
78 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); 84 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
@@ -87,18 +93,12 @@ namespace {
87 } 93 }
88 } 94 }
89 inline void IconViewItem::setText( const QString& str ) { 95 inline void IconViewItem::setText( const QString& str ) {
90 QString text = QIconViewItem::text()+"\n"+str; 96 QString text = QIconViewItem::text()+"\n"+str;
91 m_noInfo = true; 97 m_noInfo = true;
92 QIconViewItem::setText( text ); 98 QIconViewItem::setText( text );
93 reCalc();
94 }
95
96 inline void IconViewItem::reCalc()
97 {
98 calcRect();
99 } 99 }
100} 100}
101 101
102 102
103PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 103PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
104 : QVBox( wid ), m_cfg( cfg ) 104 : QVBox( wid ), m_cfg( cfg )
@@ -119,17 +119,16 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
119 m_view= new QIconView( this ); 119 m_view= new QIconView( this );
120 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 120 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
121 this, SLOT(slotClicked(QIconViewItem*)) ); 121 this, SLOT(slotClicked(QIconViewItem*)) );
122 122
123 m_view->setArrangement( QIconView::LeftToRight ); 123 m_view->setArrangement( QIconView::LeftToRight );
124 m_view->setItemTextPos( QIconView::Right ); 124 m_view->setItemTextPos( QIconView::Right );
125 m_view->setResizeMode(QIconView::Adjust);
126 125
127 int dw = QApplication::desktop()->width(); 126 int dw = QApplication::desktop()->width();
128 int viewerWidth = dw-style().scrollBarExtent().width(); 127 int viewerWidth = dw-style().scrollBarExtent().width();
129 m_view->setGridX( viewerWidth-2*m_view->spacing() ); 128 m_view->setGridX( viewerWidth-3*m_view->spacing());
130 m_view->setGridY( fontMetrics().height()*2+40 ); 129 m_view->setGridY( fontMetrics().height()*2+40 );
131 130
132 131
133 initKeys(); 132 initKeys();
134 133
135 loadViews(); 134 loadViews();
@@ -193,17 +192,17 @@ void PIconView::slotChangeDir(const QString& path) {
193 if (!lister ) 192 if (!lister )
194 return; 193 return;
195 194
196 lister->setStartPath( path ); 195 lister->setStartPath( path );
197 m_path = lister->currentPath(); 196 m_path = lister->currentPath();
198 197
199 m_view->setUpdatesEnabled( false ); 198 m_view->viewport()->setUpdatesEnabled( false );
200 m_view->clear(); 199 m_view->clear();
201 addFolders( lister->folders() ); 200 addFolders( lister->folders() );
202 addFiles( lister->files() ); 201 addFiles( lister->files() );
203 m_view->setUpdatesEnabled( true ); 202 m_view->viewport()->setUpdatesEnabled( true );
204 203
205 // Also invalidate the cache. We can't cancel the operations anyway 204 // Also invalidate the cache. We can't cancel the operations anyway
206 g_stringPix.clear(); 205 g_stringPix.clear();
207 g_stringInf.clear(); 206 g_stringInf.clear();
208 207
209 // looks ugly 208 // looks ugly
@@ -311,28 +310,25 @@ void PIconView::slotClicked(QIconViewItem* _it) {
311void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 310void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
312 if ( g_stringInf.contains( _path ) ) { 311 if ( g_stringInf.contains( _path ) ) {
313 IconViewItem* item = g_stringInf[_path]; 312 IconViewItem* item = g_stringInf[_path];
314 /* if set the view shows nonsens! 313 /* if set the view shows nonsens!
315 I dont know how to fix the format of displayed text :(*/ 314 I dont know how to fix the format of displayed text :(*/
316 item->setText( str ); 315 item->setText( str );
317 item->repaint();
318 g_stringInf.remove( _path ); 316 g_stringInf.remove( _path );
319 } 317 }
320} 318}
321void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 319void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
322 if ( g_stringPix.contains( _path ) ) { 320 if ( g_stringPix.contains( _path ) ) {
323 IconViewItem* item = g_stringPix[_path]; 321 IconViewItem* item = g_stringPix[_path];
324 322
325 if (pix.width()>0) { 323 if (pix.width()>0) {
326 PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); 324 PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
327 /* required for a recalculated rectangle. otherwise the view show nonsense! */ 325 /* required for a recalculated rectangle. otherwise the view show nonsense! */
328 item->reCalc();
329 } else { 326 } else {
330 PPixmapCache::self()->insertImage(_path,Resource::loadPixmap( "UnknownDocument" ),64,64 ); 327 PPixmapCache::self()->insertImage(_path,Resource::loadPixmap( "UnknownDocument" ),64,64 );
331 } 328 }
332 item->repaint();
333 g_stringPix.remove( _path ); 329 g_stringPix.remove( _path );
334 } 330 }
335} 331}
336 332
337 333
338void PIconView::slotRename() { 334void PIconView::slotRename() {
@@ -354,17 +350,18 @@ void PIconView::slotBeam() {
354 350
355void PIconView::slotBeamDone( Ir* ir) { 351void PIconView::slotBeamDone( Ir* ir) {
356 delete ir; 352 delete ir;
357} 353}
358 354
359void PIconView::slotStart() { 355void PIconView::slotStart() {
360 m_view->setUpdatesEnabled( false ); 356 m_view->viewport()->setUpdatesEnabled( false );
361} 357}
362 358
363void PIconView::slotEnd() { 359void PIconView::slotEnd() {
364 m_view->setUpdatesEnabled( true ); 360 m_view->arrangeItemsInGrid( );
361 m_view->viewport()->setUpdatesEnabled( true );
365} 362}
366 363
367void PIconView::slotShowImage() { 364void PIconView::slotShowImage() {
368 365
369} 366}
370void PIconView::slotShowImage( const QString& ) { 367void PIconView::slotShowImage( const QString& ) {
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 0314659..83ff4f1 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -106,13 +106,13 @@ void PMainWindow::slotConfig() {
106 for( ; _it != vM->end(); ++_it ) { 106 for( ; _it != vM->end(); ++_it ) {
107 PDirView *view = (_it.data())(*m_cfg); 107 PDirView *view = (_it.data())(*m_cfg);
108 PInterfaceInfo *inf = view->interfaceInfo(); 108 PInterfaceInfo *inf = view->interfaceInfo();
109 QWidget *_wid = inf->configWidget( *m_cfg ); 109 QWidget *_wid = inf->configWidget( *m_cfg );
110 _wid->reparent(wid, QPoint() ); 110 _wid->reparent(wid, QPoint() );
111 lst.insert( view, _wid ); 111 lst.insert( view, _wid );
112 wid->addTab( _wid, QString::null, inf->name() ); 112 wid->addTab( _wid, "fileopen", inf->name() );
113 } 113 }
114 114
115/* 115/*
116 * Add the KeyConfigWidget 116 * Add the KeyConfigWidget
117 */ 117 */
118 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 118 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
diff --git a/noncore/graphics/opie-eye/slave/gif_slave.cpp b/noncore/graphics/opie-eye/slave/gif_slave.cpp
index feb69b6..f0dc86e 100644
--- a/noncore/graphics/opie-eye/slave/gif_slave.cpp
+++ b/noncore/graphics/opie-eye/slave/gif_slave.cpp
@@ -283,14 +283,15 @@ QString GifSlave::iconViewName(const QString& str) {
283 QString st; 283 QString st;
284 get_gif_info(QFile::encodeName( str ).data(), st ); 284 get_gif_info(QFile::encodeName( str ).data(), st );
285 return st; 285 return st;
286} 286}
287 287
288QString GifSlave::fullImageInfo( const QString& str) { 288QString GifSlave::fullImageInfo( const QString& str) {
289 QString st; 289 QString st = "<qt>";
290 get_gif_info(QFile::encodeName( str ).data(), st, true ); 290 get_gif_info(QFile::encodeName( str ).data(), st, true );
291 st.append( "</qt>" );
291 return st; 292 return st;
292} 293}
293 294
294QPixmap GifSlave::pixmap(const QString& path, int width, int height ) { 295QPixmap GifSlave::pixmap(const QString& path, int width, int height ) {
295 static QImage img; 296 static QImage img;
296 img.load( path ); 297 img.load( path );
diff --git a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
index 95055fd..086b47f 100644
--- a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
+++ b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
@@ -1297,25 +1297,24 @@ JpegSlave::~JpegSlave() {}
1297QString JpegSlave::iconViewName( const QString& path) { 1297QString JpegSlave::iconViewName( const QString& path) {
1298 ExifData ImageInfo; 1298 ExifData ImageInfo;
1299 if ( !ImageInfo.scan( path ) ) 1299 if ( !ImageInfo.scan( path ) )
1300 return QString::null; 1300 return QString::null;
1301 1301
1302 QString tag; 1302 QString tag;
1303 tag = QObject::tr( "<qt>Comment: %1\n" ).arg( ImageInfo.getComment() ); 1303 tag = QObject::tr( "Comment: %1\n" ).arg( ImageInfo.getComment() );
1304 { 1304 {
1305// ODP fixme 1305// ODP fixme
1306 QString timestring = TimeString::dateString( parseDateTime( ImageInfo.getDateTime() ), FALSE ); 1306 QString timestring = TimeString::dateString( parseDateTime( ImageInfo.getDateTime() ), FALSE );
1307 tag += QObject::tr( "Date/Time: %1\n" ).arg( timestring ); 1307 tag += QObject::tr( "Date/Time: %1\n" ).arg( timestring );
1308 } 1308 }
1309 tag += QObject::tr( "Dimensions: %1x%2\n" ).arg(ImageInfo.getWidth()) 1309 tag += QObject::tr( "Dimensions: %1x%2\n" ).arg(ImageInfo.getWidth())
1310 .arg(ImageInfo.getHeight() ); 1310 .arg(ImageInfo.getHeight() );
1311 1311
1312 tag += color_mode_to_string( ImageInfo.getIsColor() ); 1312 tag += color_mode_to_string( ImageInfo.getIsColor() );
1313 1313
1314 tag += compression_to_string( ImageInfo.getCompressionLevel() ); 1314 tag += compression_to_string( ImageInfo.getCompressionLevel() );
1315 tag += QObject::tr( "</qt>" );
1316 1315
1317 return tag; 1316 return tag;
1318} 1317}
1319 1318
1320 1319
1321/* 1320/*
@@ -1324,13 +1323,13 @@ QString JpegSlave::iconViewName( const QString& path) {
1324QString JpegSlave::fullImageInfo( const QString& path) { 1323QString JpegSlave::fullImageInfo( const QString& path) {
1325 ExifData ImageInfo; 1324 ExifData ImageInfo;
1326 if ( !ImageInfo.scan( path ) ) 1325 if ( !ImageInfo.scan( path ) )
1327 return QString::null; 1326 return QString::null;
1328 1327
1329 QString tag, tmp; 1328 QString tag, tmp;
1330 tag = QObject::tr( "Comment: %1\n" ).arg( ImageInfo.getComment() ); 1329 tag = QObject::tr( "<qt>Comment: %1\n" ).arg( ImageInfo.getComment() );
1331 1330
1332 tmp = ImageInfo.getCameraMake(); 1331 tmp = ImageInfo.getCameraMake();
1333 if ( tmp.length() ) 1332 if ( tmp.length() )
1334 tag += QObject::tr( "Manufacturer: %1\n" ).arg( tmp ); 1333 tag += QObject::tr( "Manufacturer: %1\n" ).arg( tmp );
1335 tmp = ImageInfo.getCameraModel(); 1334 tmp = ImageInfo.getCameraModel();
1336 if ( tmp.length() ) 1335 if ( tmp.length() )
diff --git a/noncore/graphics/opie-eye/slave/png_slave.cpp b/noncore/graphics/opie-eye/slave/png_slave.cpp
index 72b93cc..86e1cdc 100644
--- a/noncore/graphics/opie-eye/slave/png_slave.cpp
+++ b/noncore/graphics/opie-eye/slave/png_slave.cpp
@@ -192,14 +192,15 @@ QString PNGSlave::iconViewName( const QString& path) {
192 QString str; 192 QString str;
193 read_comment( path, false, str ); 193 read_comment( path, false, str );
194 return str; 194 return str;
195} 195}
196 196
197QString PNGSlave::fullImageInfo( const QString& path) { 197QString PNGSlave::fullImageInfo( const QString& path) {
198 QString str; 198 QString str = "<qt>";
199 read_comment( path, true, str ); 199 read_comment( path, true, str );
200 str += "</qt>";
200 return str; 201 return str;
201} 202}
202 203
203 204
204QPixmap PNGSlave::pixmap( const QString& path, int width, int height) { 205QPixmap PNGSlave::pixmap( const QString& path, int width, int height) {
205 QImage img; img.load( path ); 206 QImage img; img.load( path );