summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui
authorzecke <zecke>2004-04-06 10:37:23 (UTC)
committer zecke <zecke>2004-04-06 10:37:23 (UTC)
commit8981e35697647315d88cdf95e912b0fe2f9d5375 (patch) (unidiff)
tree4631dc800cb6d45d38d69d43f14e305ce0123d10 /noncore/graphics/opie-eye/gui
parent2a4ec8132bea9c4c8308038d555755eabc1eee46 (diff)
downloadopie-8981e35697647315d88cdf95e912b0fe2f9d5375.zip
opie-8981e35697647315d88cdf95e912b0fe2f9d5375.tar.gz
opie-8981e35697647315d88cdf95e912b0fe2f9d5375.tar.bz2
Add some documentation and remove qWarnings
Diffstat (limited to 'noncore/graphics/opie-eye/gui') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 4ced52d..c07a1e5 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -198,13 +198,12 @@ void PIconView::initKeys() {
198 * change one dir up 198 * change one dir up
199 */ 199 */
200void PIconView::slotDirUp() { 200void PIconView::slotDirUp() {
201 QDir dir( m_path ); 201 QDir dir( m_path );
202 dir.cdUp(); 202 dir.cdUp();
203 slotChangeDir( dir.absPath() ); 203 slotChangeDir( dir.absPath() );
204
205} 204}
206 205
207/* 206/*
208 * change the dir 207 * change the dir
209 */ 208 */
210void PIconView::slotChangeDir(const QString& path) { 209void PIconView::slotChangeDir(const QString& path) {
@@ -212,29 +211,40 @@ void PIconView::slotChangeDir(const QString& path) {
212 return; 211 return;
213 212
214 PDirLister *lister = currentView()->dirLister(); 213 PDirLister *lister = currentView()->dirLister();
215 if (!lister ) 214 if (!lister )
216 return; 215 return;
217 216
217 /*
218 * Say what we want and take what we get
219 */
218 lister->setStartPath( path ); 220 lister->setStartPath( path );
219 m_path = lister->currentPath(); 221 m_path = lister->currentPath();
220 222
221 m_view->viewport()->setUpdatesEnabled( false ); 223 m_view->viewport()->setUpdatesEnabled( false );
222 m_view->clear(); 224 m_view->clear();
225
226 /*
227 * add files and folders
228 */
223 addFolders( lister->folders() ); 229 addFolders( lister->folders() );
224 addFiles( lister->files() ); 230 addFiles( lister->files() );
225 m_view->viewport()->setUpdatesEnabled( true ); 231 m_view->viewport()->setUpdatesEnabled( true );
226 232
227 // Also invalidate the cache. We can't cancel the operations anyway 233 // Also invalidate the cache. We can't cancel the operations anyway
228 g_stringPix.clear(); 234 g_stringPix.clear();
229 g_stringInf.clear(); 235 g_stringInf.clear();
230 236
231 // looks ugly 237 // looks ugly
232 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); 238 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) );
233} 239}
234 240
241/**
242 * get the current file name
243 * @param isDir see if this is a dir or real file
244 */
235QString PIconView::currentFileName(bool &isDir)const { 245QString PIconView::currentFileName(bool &isDir)const {
236 isDir = false; 246 isDir = false;
237 QIconViewItem* _it = m_view->currentItem(); 247 QIconViewItem* _it = m_view->currentItem();
238 if ( !_it ) 248 if ( !_it )
239 return QString::null; 249 return QString::null;
240 250
@@ -255,23 +265,30 @@ void PIconView::slotTrash() {
255 return 265 return
256 266
257 267
258 currentView()->dirLister()->deleteImage( pa ); 268 currentView()->dirLister()->deleteImage( pa );
259 delete m_view->currentItem(); 269 delete m_view->currentItem();
260} 270}
271
272/*
273 * see what views are available
274 */
261void PIconView::loadViews() { 275void PIconView::loadViews() {
262 ViewMap::Iterator it; 276 ViewMap::Iterator it;
263 ViewMap* map = viewMap(); 277 ViewMap* map = viewMap();
264 for ( it = map->begin(); it != map->end(); ++it ) 278 for ( it = map->begin(); it != map->end(); ++it )
265 m_views->insertItem( QObject::tr(it.key() ) ); 279 m_views->insertItem( QObject::tr(it.key() ) );
266} 280}
267 281
268void PIconView::resetView() { 282void PIconView::resetView() {
269 slotViewChanged(m_views->currentItem()); 283 slotViewChanged(m_views->currentItem());
270} 284}
271 285
286/*
287 *swicth view reloadDir and connect signals
288 */
272void PIconView::slotViewChanged( int i) { 289void PIconView::slotViewChanged( int i) {
273 if (!m_views->count() ) { 290 if (!m_views->count() ) {
274 setCurrentView( 0l); 291 setCurrentView( 0l);
275 return; 292 return;
276 } 293 }
277 294
@@ -300,12 +317,15 @@ void PIconView::slotViewChanged( int i) {
300 317
301void PIconView::slotReloadDir() { 318void PIconView::slotReloadDir() {
302 slotChangeDir( m_path ); 319 slotChangeDir( m_path );
303} 320}
304 321
305 322
323/*
324 * add files and folders
325 */
306void PIconView::addFolders( const QStringList& lst) { 326void PIconView::addFolders( const QStringList& lst) {
307 QStringList::ConstIterator it; 327 QStringList::ConstIterator it;
308 328
309 for(it=lst.begin(); it != lst.end(); ++it ) 329 for(it=lst.begin(); it != lst.end(); ++it )
310 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); 330 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
311 331
@@ -316,35 +336,46 @@ void PIconView::addFiles( const QStringList& lst) {
316 QStringList::ConstIterator it; 336 QStringList::ConstIterator it;
317 for (it=lst.begin(); it!= lst.end(); ++it ) 337 for (it=lst.begin(); it!= lst.end(); ++it )
318 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); 338 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
319 339
320} 340}
321 341
342/*
343 * user clicked on the item. Change dir or view
344 */
322void PIconView::slotClicked(QIconViewItem* _it) { 345void PIconView::slotClicked(QIconViewItem* _it) {
323 if(!_it ) 346 if(!_it )
324 return; 347 return;
325 348
326 IconViewItem* it = static_cast<IconViewItem*>(_it); 349 IconViewItem* it = static_cast<IconViewItem*>(_it);
327 if( it->isDir() ) 350 if( it->isDir() )
328 slotChangeDir( it->path() ); 351 slotChangeDir( it->path() );
329 else // view image 352 else // view image
330 slotShowImage(); 353 slotShowImage();
331} 354}
332 355
356/*
357 * got thumb info add to the cache if items is visible
358 * we later need update after processing of slave is done
359 */
333void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 360void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
334 IconViewItem* item = g_stringInf[_path]; 361 IconViewItem* item = g_stringInf[_path];
335 if (!item ) 362 if (!item )
336 return; 363 return;
337 364
338 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 365 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
339 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 366 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
340 m_updatet = true; 367 m_updatet = true;
341 368
342 item->setText( str ); 369 item->setText( str );
343 g_stringInf.remove( _path ); 370 g_stringInf.remove( _path );
344} 371}
372
373/*
374 * got thumbnail and see if it is visible so we need to update later
375 */
345void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 376void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
346 IconViewItem* item = g_stringPix[_path]; 377 IconViewItem* item = g_stringPix[_path];
347 if (!item ) 378 if (!item )
348 return; 379 return;
349 380
350 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 381 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
@@ -356,16 +387,23 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
356 387
357 388
358 g_stringPix.remove( _path ); 389 g_stringPix.remove( _path );
359} 390}
360 391
361 392
393/*
394 * FIXME rename
395 */
362void PIconView::slotRename() { 396void PIconView::slotRename() {
363 397
364} 398}
365 399
400
401/*
402 * BEAM the current file
403 */
366void PIconView::slotBeam() { 404void PIconView::slotBeam() {
367 bool isDir; 405 bool isDir;
368 QString pa = currentFileName( isDir ); 406 QString pa = currentFileName( isDir );
369 if ( isDir && pa.isEmpty() ) 407 if ( isDir && pa.isEmpty() )
370 return; 408 return;
371 409
@@ -373,12 +411,15 @@ void PIconView::slotBeam() {
373 connect( ir, SIGNAL(done(Ir*)), 411 connect( ir, SIGNAL(done(Ir*)),
374 this, SLOT(slotBeamDone(Ir*))); 412 this, SLOT(slotBeamDone(Ir*)));
375 ir->send(pa, tr( "Image" ) ); 413 ir->send(pa, tr( "Image" ) );
376 414
377} 415}
378 416
417/*
418 * BEAM done clean up
419 */
379void PIconView::slotBeamDone( Ir* ir) { 420void PIconView::slotBeamDone( Ir* ir) {
380 delete ir; 421 delete ir;
381} 422}
382 423
383void PIconView::slotStart() { 424void PIconView::slotStart() {
384 m_view->viewport()->setUpdatesEnabled( false ); 425 m_view->viewport()->setUpdatesEnabled( false );
@@ -390,24 +431,22 @@ void PIconView::slotEnd() {
390 m_view->viewport()->setUpdatesEnabled( true ); 431 m_view->viewport()->setUpdatesEnabled( true );
391 m_updatet = false; 432 m_updatet = false;
392} 433}
393 434
394void PIconView::slotShowImage() 435void PIconView::slotShowImage()
395{ 436{
396 qWarning( "SLotShowImage" );
397 bool isDir = false; 437 bool isDir = false;
398 QString name = currentFileName(isDir); 438 QString name = currentFileName(isDir);
399 if (isDir) return; 439 if (isDir) return;
400 440
401 slotShowImage( name ); 441 slotShowImage( name );
402} 442}
403void PIconView::slotShowImage( const QString& name) { 443void PIconView::slotShowImage( const QString& name) {
404 emit sig_display( name ); 444 emit sig_display( name );
405} 445}
406void PIconView::slotImageInfo() { 446void PIconView::slotImageInfo() {
407 qWarning( "SlotImageInfo" );
408 bool isDir = false; 447 bool isDir = false;
409 QString name = currentFileName(isDir); 448 QString name = currentFileName(isDir);
410 if (isDir) return; 449 if (isDir) return;
411 450
412 slotImageInfo( name ); 451 slotImageInfo( name );
413} 452}