~ubuntu-branches/ubuntu/lucid/kdebase/lucid

« back to all changes in this revision

Viewing changes to apps/kinfocenter/memory/chartWidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Ana Beatriz Guerrero Lopez
  • Date: 2009-04-05 05:22:13 UTC
  • mfrom: (0.4.2 experimental) (0.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 235.
  • Revision ID: james.westby@ubuntu.com-20090405052213-39thr4l6p2ss07uj
Tags: 4:4.2.2-1
* New upstream release:
  - khtml fixes. (Closes: #290285, #359680)
  - Default konsole sessions can be deleted. (Closes: #286342)
  - Tag widget uses standard application palette. (Closes: #444800)
  - ... and surely many more but we have lost track...

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 ***************************************************************************/
 
10
 
 
11
#ifndef CHART_WIDGET_H
 
12
#define CHART_WIDGET_H
 
13
 
 
14
#include <QWidget>
 
15
#include <QFrame>
 
16
#include <QString>
 
17
#include <QColor>
 
18
#include <QList>
 
19
 
 
20
class QLabel;
 
21
class QWidget;
 
22
 
 
23
#include "base.h"
 
24
 
 
25
class Chart : public QWidget {
 
26
public:
 
27
        Chart(QWidget* parent = NULL);
 
28
        
 
29
        void setMemoryInfos(t_memsize* memoryInfos);
 
30
        void setFreeMemoryLabel(QLabel* freeMemoryLabel);
 
31
        
 
32
        static QString formattedUnit(t_memsize value);
 
33
        
 
34
protected:
 
35
        
 
36
        bool drawChart(t_memsize total, const QList<t_memsize>& used, const QList<QColor>& colors, const QList<QString>& texts);
 
37
        
 
38
        t_memsize* memoryInfos;
 
39
        
 
40
        QLabel* freeMemoryLabel;
 
41
        
 
42
};
 
43
 
 
44
class ChartWidget : public QWidget {
 
45
public:
 
46
 
 
47
        /**
 
48
         * Initialize the list view item and task.
 
49
         */
 
50
        ChartWidget(const QString& title, const QString& hint, Chart* chartImplementation, QWidget* parent = NULL);
 
51
        
 
52
        void setMemoryInfos(t_memsize* memoryInfos);
 
53
        void refresh();
 
54
        
 
55
private:
 
56
        
 
57
        QLabel* titleLabel;
 
58
        
 
59
        Chart* chart;
 
60
        
 
61
        QLabel* freeMemoryLabel;
 
62
        
 
63
};
 
64
 
 
65
#endif // CHART_WIDGET_H