Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

QY2DiskUsageListItem Class Reference

#include <QY2DiskUsageList.h>

Inheritance diagram for QY2DiskUsageListItem:

QY2ListViewItem YQPkgDiskUsageListItem List of all members.

Public Member Functions

virtual FSize usedSize () const =0
virtual FSize totalSize () const =0
virtual FSize freeSize () const
virtual int usedPercent () const
virtual QString name () const =0
virtual QString deviceName () const
virtual void updateStatus ()
virtual void updateData ()
void setText (int column, const QString &text)
void setText (int column, const FSize &size)
virtual int compare (QListViewItem *other, int col, bool ascending) const
int nameCol () const
int percentageBarCol () const
int percentageCol () const
int usedSizeCol () const
int freeSizeCol () const
int totalSizeCol () const
int deviceNameCol () const

Protected Member Functions

 QY2DiskUsageListItem (QY2DiskUsageList *parent)
virtual ~QY2DiskUsageListItem ()
void init (bool allFields)
virtual void paintCell (QPainter *painter, const QColorGroup &colorGroup, int column, int width, int alignment)
void paintPercentageBar (float percent, QPainter *painter, int indent, int width, const QColor &fillColor, const QColor &barBackground)
QColor contrastingColor (const QColor &desiredColor, const QColor &contrastColor)
virtual QColor interpolateColor (int val, int minVal, int maxVal, const QColor &minColor, const QColor &maxColor)
int interpolate (int from, int minFrom, int maxFrom, int minTo, int maxTo)

Protected Attributes

QY2DiskUsageList_diskUsageList

Detailed Description

Abstract base class for one partition ( mount point ) to display in a QY2DiskUsageList.

This class contains pure virtuals, so it cannot be used directly.


Constructor & Destructor Documentation

QY2DiskUsageListItem::QY2DiskUsageListItem QY2DiskUsageList parent  )  [protected]
 

Constructor.

Call updateData() after the constructor for the initial display update. Unfortunately, this cannot be done automatically in the constructor since it uses virtual methods that are not available yet at this point.

QY2DiskUsageListItem::~QY2DiskUsageListItem  )  [protected, virtual]
 

Destructor.


Member Function Documentation

int QY2DiskUsageListItem::compare QListViewItem *  other,
int  col,
bool  ascending
const [virtual]
 

Comparison function used for sorting the list. Returns: -1 if this < other 0 if this == other +1 if this > other

Reimplemented from QY2ListViewItem.

Reimplemented from QY2ListViewItem.

QColor QY2DiskUsageListItem::contrastingColor const QColor &  desiredColor,
const QColor &  contrastColor
[protected]
 

Return a color that contrasts to 'contrastColor'.

Stolen from KDirStat::KDirTreeView with the author's permission.

virtual QString QY2DiskUsageListItem::deviceName  )  const [inline, virtual]
 

The device name of this partition.

Derived classes may choose to reimplement this method. This default implementation returns an empty string.

Reimplemented in YQPkgDiskUsageListItem.

int QY2DiskUsageListItem::deviceNameCol  )  const [inline]
 

FSize QY2DiskUsageListItem::freeSize  )  const [virtual]
 

The current free size of this partition.

Derived classes can choose reimpmenent this if it is less expensive than calculating this value each time from usedSize() and totalSize() which is the default implementation.

int QY2DiskUsageListItem::freeSizeCol  )  const [inline]
 

void QY2DiskUsageListItem::init bool  allFields  )  [protected]
 

( Re- ) initialize fields - all displayed fields ( if 'allFields' is 'true' ) or only the varying fields ( used, free, percentage ).

int QY2DiskUsageListItem::interpolate int  from,
int  minFrom,
int  maxFrom,
int  minTo,
int  maxTo
[protected]
 

Interpolate ( translate ) a value 'from' in the range between 'minFrom' and 'maxFrom' to a range between 'minTo' and 'maxTo'.

QColor QY2DiskUsageListItem::interpolateColor int  val,
int  minVal,
int  maxVal,
const QColor &  minColor,
const QColor &  maxColor
[protected, virtual]
 

Interpolate ( in the HSV color space ) a color between 'minColor' and 'maxColor' for a current value 'val' so that 'minVal' corresponds to 'minColor' and 'maxVal' to 'maxColor'.

Returns the interpolated color.

virtual QString QY2DiskUsageListItem::name  )  const [pure virtual]
 

The name to display for this partition. It makes most sense to use the mount point here ( but this is not a requirement ). This is what will be displayed in the "Name" column.

Derived classes need to implement this method.

Implemented in YQPkgDiskUsageListItem.

int QY2DiskUsageListItem::nameCol  )  const [inline]
 

void QY2DiskUsageListItem::paintCell QPainter *  painter,
const QColorGroup &  colorGroup,
int  column,
int  width,
int  alignment
[protected, virtual]
 

Paint method.

Reimplemented from QY2ListViewItem.

Reimplemented from QY2ListViewItem.

void QY2DiskUsageListItem::paintPercentageBar float  percent,
QPainter *  painter,
int  indent,
int  width,
const QColor &  fillColor,
const QColor &  barBackground
[protected]
 

Paint a percentage bar into a QListViewItem cell. 'width' is the width of the entire cell. 'indent' is the number of pixels to indent the bar.

Stolen from KDirStat::KDirTreeView with the author's permission.

int QY2DiskUsageListItem::percentageBarCol  )  const [inline]
 

int QY2DiskUsageListItem::percentageCol  )  const [inline]
 

void QY2DiskUsageListItem::setText int  column,
const FSize size
 

Set a column text via FSize.

void QY2DiskUsageListItem::setText int  column,
const QString &  text
[inline]
 

Re-declare ordinary setText() method so the compiler doesn't get confused which one to use.

virtual FSize QY2DiskUsageListItem::totalSize  )  const [pure virtual]
 

The total size of this partition.

Derived classes need to implement this method.

Implemented in YQPkgDiskUsageListItem.

int QY2DiskUsageListItem::totalSizeCol  )  const [inline]
 

void QY2DiskUsageListItem::updateData  )  [virtual]
 

Update this item's data completely. Triggered by QY2ListView::updateAllItemData().

Reimplemented from QY2ListViewItem.

Reimplemented from QY2ListViewItem.

void QY2DiskUsageListItem::updateStatus  )  [virtual]
 

Update this item's status ( here: the numeric fields ). Triggered by QY2ListView::updateAllItemStates().

Reimplemented from QY2ListViewItem.

Reimplemented from QY2ListViewItem.

int QY2DiskUsageListItem::usedPercent  )  const [virtual]
 

The currently used percentage ( 0..100 ) of this partition.

Derived classes can choose reimpmenent this if it is less expensive than calculating this value each time from usedSize() and totalSize() which is the default implementation.

virtual FSize QY2DiskUsageListItem::usedSize  )  const [pure virtual]
 

The currently used size of this partition.

Derived classes need to implement this method.

Implemented in YQPkgDiskUsageListItem.

int QY2DiskUsageListItem::usedSizeCol  )  const [inline]
 


Member Data Documentation

QY2DiskUsageList* QY2DiskUsageListItem::_diskUsageList [protected]
 


The documentation for this class was generated from the following files:
Generated on Wed Nov 12 06:11:16 2008 for yast2-qt by  doxygen 1.3.9.1