libyui-qt  2.49.2
QY2DiskUsageListItem Class Referenceabstract

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

#include <QY2DiskUsageList.h>

Inheritance diagram for QY2DiskUsageListItem:
Collaboration diagram for QY2DiskUsageListItem:

Public Member Functions

virtual FSize usedSize () const =0
 The currently used size of this partition. More...
 
virtual FSize totalSize () const =0
 The total size of this partition. More...
 
virtual FSize freeSize () const
 The current free size of this partition. More...
 
virtual int usedPercent () const
 The currently used percentage ( 0..100 ) of this partition. More...
 
virtual QString name () const =0
 The name to display for this partition. More...
 
virtual QString deviceName () const
 The device name of this partition. More...
 
virtual void updateStatus ()
 Update this item's status ( here: the numeric fields ). More...
 
virtual void updateData ()
 Update this item's data completely. More...
 
void setText (int column, const QString &text)
 Re-declare ordinary setText() method so the compiler doesn't get confused which one to use.
 
void setText (int column, const FSize &size)
 Set a column text via FSize.
 
virtual bool operator< (const QTreeWidgetItem &other) const
 Comparison function used for sorting the list. More...
 
int nameCol () const
 
int percentageBarCol () const
 
int usedSizeCol () const
 
int freeSizeCol () const
 
int totalSizeCol () const
 
int deviceNameCol () const
 
void paintPercentageBar (QPainter *painter, QStyleOptionViewItem option, const QColor &fillColor)
 Paint a percentage bar into a QListViewItem cell. More...
 
- Public Member Functions inherited from QY2ListViewItem
 QY2ListViewItem (QY2ListView *parentListView, const QString &text=QString::null)
 Constructor for toplevel items.
 
 QY2ListViewItem (QTreeWidgetItem *parentItem, const QString &text=QString::null)
 Constructor for deeper level items.
 
virtual ~QY2ListViewItem ()
 Destructor.
 
int serial () const
 Return this item's serial number. More...
 
virtual QString toolTip (int column)
 Returns a tool tip text for a specific column of this item. More...
 

Protected Member Functions

 QY2DiskUsageListItem (QY2DiskUsageList *parent)
 Constructor. More...
 
virtual ~QY2DiskUsageListItem ()
 Destructor.
 
void init (bool allFields)
 ( Re- ) initialize fields - all displayed fields ( if 'allFields' is 'true' ) or only the varying fields ( used, free, percentage ).
 

Protected Attributes

QY2DiskUsageList_diskUsageList
 
- Protected Attributes inherited from QY2ListViewItem
int _serial
 
QColor _textColor
 
QColor _backgroundColor
 

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.

Definition at line 96 of file QY2DiskUsageList.h.

Constructor & Destructor Documentation

◆ QY2DiskUsageListItem()

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.

Definition at line 219 of file QY2DiskUsageList.cc.

Member Function Documentation

◆ deviceName()

virtual QString QY2DiskUsageListItem::deviceName ( ) const
inlinevirtual

The device name of this partition.

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

Definition at line 166 of file QY2DiskUsageList.h.

◆ freeSize()

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.

Definition at line 269 of file QY2DiskUsageList.cc.

Here is the call graph for this function:

◆ name()

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.

◆ operator<()

bool QY2DiskUsageListItem::operator< ( const QTreeWidgetItem &  otherListViewItem) const
virtual

Comparison function used for sorting the list.

Reimplemented from QTreeWidgetItem

Reimplemented from QY2ListViewItem.

Definition at line 309 of file QY2DiskUsageList.cc.

Here is the call graph for this function:

◆ paintPercentageBar()

void QY2DiskUsageListItem::paintPercentageBar ( QPainter *  painter,
QStyleOptionViewItem  option,
const QColor &  fillColor 
)

Paint a percentage bar into a QListViewItem cell.

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

'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.

Definition at line 342 of file QY2DiskUsageList.cc.

Here is the call graph for this function:

◆ totalSize()

virtual FSize QY2DiskUsageListItem::totalSize ( ) const
pure virtual

The total size of this partition.

Derived classes need to implement this method.

◆ updateData()

void QY2DiskUsageListItem::updateData ( )
virtual

Update this item's data completely.

Triggered by QY2ListView::updateAllItemData().

Reimplemented from QY2ListViewItem.

Reimplemented from QY2ListViewItem.

Definition at line 295 of file QY2DiskUsageList.cc.

Here is the call graph for this function:

◆ updateStatus()

void QY2DiskUsageListItem::updateStatus ( )
virtual

Update this item's status ( here: the numeric fields ).

Triggered by QY2ListView::updateAllItemStates().

Reimplemented from QY2ListViewItem.

Reimplemented from QY2ListViewItem.

Definition at line 288 of file QY2DiskUsageList.cc.

Here is the call graph for this function:

◆ usedPercent()

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.

Definition at line 276 of file QY2DiskUsageList.cc.

Here is the call graph for this function:

◆ usedSize()

virtual FSize QY2DiskUsageListItem::usedSize ( ) const
pure virtual

The currently used size of this partition.

Derived classes need to implement this method.


The documentation for this class was generated from the following files: