1 /***********************************************************************************
2 * System Monitor: Plasmoid and data engines to monitor CPU/Memory/Swap Usage.
3 * Copyright (C) 2008 Matthew Dawson
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 ***********************************************************************************/
21 #ifndef SYSTEM_MONITOR_H
22 #define SYSTEM_MONITOR_H
24 #include <Plasma/Applet>
26 #include <Plasma/DataEngine>
28 #include "ui_coloursConfig.h"
29 #include "ui_generalConfig.h"
34 class QStyleOptionGraphicsItem
;
36 class systemMonitor
: public Plasma::Applet
{
40 systemMonitor(QObject
*parent
, const QVariantList
&args
);
43 void constraintsEvent(Plasma::Constraints constraints
);
45 void paintInterface(QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, const QRect
& contentsRect
);
49 void dataUpdated(const QString
& source
, const Plasma::DataEngine::Data
&data
);
53 void paintCPUUsage(QPainter
*p
, const QStyleOptionGraphicsItem
*option
, const QRect
& contentsRect
);
54 void paintSwapUsage(QPainter
*p
, const QStyleOptionGraphicsItem
*option
, const QRect
& contentsRect
);
55 void paintRAMUsage(QPainter
*p
, const QStyleOptionGraphicsItem
*option
, const QRect
& contentsRect
);
56 void paintFrontGlass(QPainter
*p
, const QStyleOptionGraphicsItem
*option
, const QRect
& contentsRect
);
59 void createConfigurationInterface(KConfigDialog
*parent
);
61 double m_user
, m_sys
, m_nice
, m_idle
, m_disk
;
62 double m_ramfree
, m_ramused
, m_rambuffers
, m_ramcached
;
63 double m_swapfree
, m_swapused
;
65 Ui::generalConfig uiGeneral
;
66 Ui::coloursConfig uiColours
;
70 QColor m_cpuUserColour
;
71 QColor m_cpuNiceColour
;
72 QColor m_cpuDiskColour
;
73 QColor m_cpuSysColour
;
74 QColor m_ramCachedColour
;
75 QColor m_ramBuffersColour
;
76 QColor m_ramUsedColour
;
77 QColor m_swapUsedColour
;
80 K_EXPORT_PLASMA_APPLET(system_monitor
, systemMonitor
)