add more spacing
[personal-kdebase.git] / apps / kinfocenter / memory / chartWidget.h
blob9297a52c716eeaa846352d7cb16062a3cc879fde
1 /***************************************************************************
2 * -------------------------------------------------------------------- *
3 * Copyright (C) 2008, Nicolas Ternisien <nicolas.ternisien@gmail.com> *
4 * -------------------------------------------------------------------- *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
11 #ifndef CHART_WIDGET_H
12 #define CHART_WIDGET_H
14 #include <QWidget>
15 #include <QFrame>
16 #include <QString>
17 #include <QColor>
18 #include <QList>
20 class QLabel;
21 class QWidget;
23 #include "base.h"
25 class Chart : public QWidget {
26 public:
27 Chart(QWidget* parent = NULL);
29 void setMemoryInfos(t_memsize* memoryInfos);
30 void setFreeMemoryLabel(QLabel* freeMemoryLabel);
32 static QString formattedUnit(t_memsize value);
34 protected:
36 bool drawChart(t_memsize total, const QList<t_memsize>& used, const QList<QColor>& colors, const QList<QString>& texts);
38 t_memsize* memoryInfos;
40 QLabel* freeMemoryLabel;
44 class ChartWidget : public QWidget {
45 public:
47 /**
48 * Initialize the list view item and task.
50 ChartWidget(const QString& title, const QString& hint, Chart* chartImplementation, QWidget* parent = NULL);
52 void setMemoryInfos(t_memsize* memoryInfos);
53 void refresh();
55 private:
57 QLabel* titleLabel;
59 Chart* chart;
61 QLabel* freeMemoryLabel;
65 #endif // CHART_WIDGET_H