Logo Search packages:      
Sourcecode: k4dirstat version File versions  Download package

void KDirTreeViewItem::updateSummary (  )

Recursively update the visual representation of the summary fields. This update is as lazy as possible for optimum performance.

Definition at line 1234 of file kdirtreeview.cpp.

References KDirStat::KDirTreeView::doPacManAnimation(), firstChild(), KDirStat::KFileInfo::isBusy(), KDirStat::KFileInfo::isDir(), KDirStat::KFileInfo::isDotEntry(), KDirStat::KFileInfo::isExcluded(), KDirStat::KFileInfo::latestMtime(), next(), KDirStat::KFileInfo::parent(), KDirStat::KDirInfo::pendingReadJobs(), KDirStat::KFileInfo::pendingReadJobs(), KDirStat::KFileInfo::readState(), setIcon(), KDirStat::KFileInfo::totalFiles(), KDirStat::KFileInfo::totalItems(), KDirStat::KDirInfo::totalSize(), KDirStat::KFileInfo::totalSize(), KDirStat::KFileInfo::totalSubDirs(), and updateSummary().

Referenced by KDirStat::KDirTreeView::deleteChild(), setOpen(), updateSummary(), and KDirStat::KDirTreeView::updateSummary().

{
    // _view->incDebugCount(2);

    // Update this item

    setIcon();
    setText( _view->latestMtimeCol(),           "  " + localeTimeDate( _orig->latestMtime() ) );

    if ( _orig->isDir() || _orig->isDotEntry() )
    {
      QString prefix = " ";

      if ( _orig->readState() == KDirAborted )
          prefix = " >";

      setText( _view->totalSizeCol(),           prefix + formatSize(  _orig->totalSize()  ) );
      setText( _view->totalItemsCol(),    prefix + formatCount( _orig->totalItems() ) );
      setText( _view->totalFilesCol(),    prefix + formatCount( _orig->totalFiles() ) );

      if ( _view->readJobsCol() >= 0 )
      {
#if SEPARATE_READ_JOBS_COL
          setText( _view->readJobsCol(),  " " + formatCount( _orig->pendingReadJobs(), true ) );
#else
          int jobs            = _orig->pendingReadJobs();
          QString text  = "";

          if ( jobs > 0 )
          {
            text = i18n( "[%1 Read Jobs]" ).arg( formatCount( _orig->pendingReadJobs(), true ) );
          }

          setText( _view->readJobsCol(), text );
#endif
      }
    }

    if ( _orig->isDir() )
    {
      setText( _view->totalSubDirsCol(),  " " + formatCount( _orig->totalSubDirs() ) );

      if ( _orig->isExcluded() )
          setText( _view->percentBarCol(),      i18n( "[excluded]" ) );
    }


    // Calculate and display percentage

    if ( _orig->parent() &&                     // only if there is a parent as calculation base
       _orig->parent()->pendingReadJobs() < 1   &&    // not before subtree is finished reading
       _orig->parent()->totalSize() > 0 &&            // avoid division by zero
       ! _orig->isExcluded() )                  // not if this is an excluded object (dir)
    {
       _percent = ( 100.0 * _orig->totalSize() ) / (float) _orig->parent()->totalSize();
       setText( _view->percentNumCol(), formatPercent ( _percent ) );
    }
    else
    {
      _percent = 0.0;
      setText( _view->percentNumCol(), "" );
    }

    if ( _view->doPacManAnimation() && _orig->isBusy() )
    {
      if ( ! _pacMan )
          _pacMan = new KPacManAnimation( _view, height()-4, true );

      repaint();
    }


    if ( ! isOpen() )   // Lazy update: Nobody can see the children
      return;           // -> don't update them.


    // Update all children

    KDirTreeViewItem *child = firstChild();

    while ( child )
    {
      child->updateSummary();
      child = child->next();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index