2 KSysGuard, the KDE System Guard
4 Copyright (c) 2006 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include <QtCore/QAbstractTableModel>
26 #include <QtCore/QList>
27 #include <QtGui/QColor>
29 class SensorModelEntry
32 typedef QList
<SensorModelEntry
> List
;
37 void setHostName( const QString
&hostName
);
38 QString
hostName() const;
40 void setSensorName( const QString
&sensorName
);
41 QString
sensorName() const;
43 void setLabel( const QString
&label
);
44 QString
label() const;
46 void setUnit( const QString
&unit
);
49 void setStatus( const QString
&status
);
50 QString
status() const;
52 void setColor( const QColor
&color
);
65 class SensorModel
: public QAbstractTableModel
69 SensorModel( QObject
*parent
= 0 );
71 void setSensors( const SensorModelEntry::List
&sensors
);
72 SensorModelEntry::List
sensors() const;
74 void setSensor( const SensorModelEntry
&sensor
, const QModelIndex
&index
);
75 void removeSensor( const QModelIndex
&index
);
76 SensorModelEntry
sensor( const QModelIndex
&index
) const;
78 void moveDownSensor(const QModelIndex
&index
);
79 void moveUpSensor(const QModelIndex
&index
);
80 void setHasLabel( bool hasLabel
);
82 virtual int columnCount( const QModelIndex
&parent
= QModelIndex() ) const;
83 virtual int rowCount( const QModelIndex
&parent
= QModelIndex() ) const;
84 virtual QVariant
data( const QModelIndex
&index
, int role
= Qt::DisplayRole
) const;
85 virtual QVariant
headerData( int section
, Qt::Orientation orientation
, int role
= Qt::DisplayRole
) const;
86 QList
<int> order() const;
87 QList
<int> deleted() const;
92 SensorModelEntry::List mSensors
;
95 /** The numbers of the sensors to be deleted.*/