libyui-qt
Loading...
Searching...
No Matches
QY2DiskUsageList.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 This library is free software; you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) version 3.0 of the License. This library
7 is distributed in the hope that it will be useful, but WITHOUT ANY
8 WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 License for more details. You should have received a copy of the GNU
11 Lesser General Public License along with this library; if not, write
12 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13 Floor, Boston, MA 02110-1301 USA
14*/
15
16
17/*-/
18
19 File: QY2DiskUsageList.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23 This is a pure Qt widget - it can be used independently of YaST2.
24
25/-*/
26
27
28#ifndef QY2DiskUsageList_h
29#define QY2DiskUsageList_h
30
31#include <QColor>
32#include <yui/FSize.h>
33
34#include "QY2ListView.h"
35
36
38
39
44{
45 Q_OBJECT
46
47public:
48
55 QY2DiskUsageList( QWidget * parent, bool addStdColumns = true );
56
60 virtual ~QY2DiskUsageList();
61
62
63 // Column numbers
64
65 int nameCol() const { return _nameCol; }
66 int percentageBarCol() const { return _percentageBarCol; }
67 int freeSizeCol() const { return _freeSizeCol; }
68 int totalSizeCol() const { return _totalSizeCol; }
69
70
71 virtual void drawRow ( QPainter * painter,
72 const QStyleOptionViewItem & option,
73 const QModelIndex & index ) const;
74
75 // Reimplemented to make this public for use in the QItemDelegate
76 QTreeWidgetItem * itemFromIndex ( const QModelIndex & index ) const
77 { return QY2ListView::itemFromIndex(index); }
78
79protected:
80
81 int _nameCol;
82 int _percentageBarCol;
83 int _freeSizeCol;
84 int _totalSizeCol;
85};
86
87
88
96{
97protected:
107
111 virtual ~QY2DiskUsageListItem();
112
113
114public:
115
122 virtual FSize usedSize() const = 0;
123
129 virtual FSize totalSize() const = 0;
130
138 virtual FSize freeSize() const;
139
147 virtual int usedPercent() const;
148
156 virtual QString name() const = 0;
157
164 virtual QString deviceName() const { return ""; }
165
166
173 virtual void updateStatus();
174
181 virtual void updateData();
182
187 void setText( int column, const QString & text )
188 { QTreeWidgetItem::setText( column, text ); }
189
193 void setText( int column, const FSize & size );
194
199 virtual bool operator< ( const QTreeWidgetItem & other ) const;
200
201 // Columns
202
203 int nameCol() const { return _diskUsageList->nameCol(); }
204 int percentageBarCol() const { return _diskUsageList->percentageBarCol(); }
205 int freeSizeCol() const { return _diskUsageList->freeSizeCol(); }
206 int totalSizeCol() const { return _diskUsageList->totalSizeCol(); }
207
208
209protected:
210
215 void init( bool allFields );
216
217 public:
225 void paintPercentageBar( QPainter * painter,
226 QStyleOptionViewItem option,
227 const QColor & fillColor);
228
229protected:
230
231
232 //
233 // Data members
234 //
235
236 QY2DiskUsageList * _diskUsageList;
237};
238
239
240
241
242#endif // ifndef QY2DiskUsageList_h
Definition QY2DiskUsageList.h:96
void init(bool allFields)
Definition QY2DiskUsageList.cc:242
QY2DiskUsageListItem(QY2DiskUsageList *parent)
Definition QY2DiskUsageList.cc:228
virtual bool operator<(const QTreeWidgetItem &other) const
Definition QY2DiskUsageList.cc:307
virtual FSize freeSize() const
Definition QY2DiskUsageList.cc:270
virtual QString name() const =0
virtual void updateData()
Definition QY2DiskUsageList.cc:296
virtual QString deviceName() const
Definition QY2DiskUsageList.h:164
void paintPercentageBar(QPainter *painter, QStyleOptionViewItem option, const QColor &fillColor)
Definition QY2DiskUsageList.cc:337
virtual ~QY2DiskUsageListItem()
Definition QY2DiskUsageList.cc:235
virtual FSize totalSize() const =0
void setText(int column, const QString &text)
Definition QY2DiskUsageList.h:187
virtual void updateStatus()
Definition QY2DiskUsageList.cc:289
virtual FSize usedSize() const =0
virtual int usedPercent() const
Definition QY2DiskUsageList.cc:277
Definition QY2DiskUsageList.h:44
virtual ~QY2DiskUsageList()
Definition QY2DiskUsageList.cc:210
QY2DiskUsageList(QWidget *parent, bool addStdColumns=true)
Definition QY2DiskUsageList.cc:170
Definition QY2ListView.h:234
Enhanced QTreeWidget.
Definition QY2ListView.h:48