MNE-CPP  beta 1.0
sensormodel.h
1 #ifndef SENSORMODEL_H
2 #define SENSORMODEL_H
3 
4 #include <QAbstractTableModel>
5 #include <QDebug>
6 
7 
9 
10 #include "sensorlayout.h"
11 #include "sensorgroup.h"
12 
13 
14 //*************************************************************************************************************
15 //=============================================================================================================
16 // DEFINE NAMESPACE XDISPLIB
17 //=============================================================================================================
18 
19 namespace XDISPLIB
20 {
21 
22 
23 //*************************************************************************************************************
24 //=============================================================================================================
25 // FORWARD DECLARATIONS
26 //=============================================================================================================
27 
28 class SensorItem;
29 
30 
31 //=============================================================================================================
37 class SensorModel : public QAbstractTableModel
38 {
39  Q_OBJECT
40 public:
41  //=========================================================================================================
47  SensorModel(QObject *parent = 0);
48 
49  //=========================================================================================================
56  SensorModel(QIODevice* device, QObject *parent = 0);
57 
58  //=========================================================================================================
66  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
67 
68  //=========================================================================================================
76  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
77 
78  //=========================================================================================================
88  inline QVariant data(int row, int column, int role = Qt::DisplayRole) const;
89 
90  //=========================================================================================================
99  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
100 
101  //=========================================================================================================
107  inline const QList<SensorLayout>& getSensorLayouts() const;
108 
109  //=========================================================================================================
115  inline qint32 getNumLayouts() const;
116 
117  //=========================================================================================================
123  inline qint32 getCurrentLayout() const;
124 
125  //=========================================================================================================
131  inline const QMap<QString, qint32>& getNameIdMap() const;
132 
133  //=========================================================================================================
139  void applySensorGroup(int id);
140 
141  //=========================================================================================================
147  void setCurrentLayout(int id);
148 
149  //=========================================================================================================
155  inline const QList<SensorGroup>& getSensorGroups() const;
156 
157  //=========================================================================================================
163  void mapChannelInfo(const QList<XMEASLIB::RealTimeSampleArrayChInfo>& chInfoList);
164 
165  //=========================================================================================================
171  void updateChannelState(SensorItem* item);
172 
173  //=========================================================================================================
179  void silentUpdateSelection(const QList<qint32>& selection);
180 
181 signals:
182  //=========================================================================================================
188  void newSelection(QList<qint32> selection);
189 
190  //=========================================================================================================
194  void newLayout();
195 
196 private:
197  //=========================================================================================================
201  void createSelection();
202 
203  //=========================================================================================================
209  bool read(QIODevice* device);
210 
211  qint32 m_iCurrentLayoutId;
212  QList<SensorLayout> m_qListSensorLayouts;
213  QList<SensorGroup> m_qListSensorGroups;
215  QMap<qint32, bool> m_qMapSelection;
216  QMap<QString, qint32> m_qMapNameId;
217 };
218 
219 
220 //*************************************************************************************************************
221 //=============================================================================================================
222 // INLINE DEFINITIONS
223 //=============================================================================================================
224 
225 inline QVariant SensorModel::data(int row, int column, int role) const
226 {
227  return data(index(row, column), role);
228 }
229 
230 
231 //*************************************************************************************************************
232 
233 inline const QList<SensorLayout>& SensorModel::getSensorLayouts() const
234 {
235  return m_qListSensorLayouts;
236 }
237 
238 
239 //*************************************************************************************************************
240 
241 inline qint32 SensorModel::getNumLayouts() const
242 {
243  return m_qListSensorLayouts.size();
244 }
245 
246 
247 //*************************************************************************************************************
248 
249 inline const QList<SensorGroup>& SensorModel::getSensorGroups() const
250 {
251  return m_qListSensorGroups;
252 }
253 
254 
255 //*************************************************************************************************************
256 
257 inline qint32 SensorModel::getCurrentLayout() const
258 {
259  return m_iCurrentLayoutId;
260 }
261 
262 
263 //*************************************************************************************************************
264 
265 inline const QMap<QString, qint32>& SensorModel::getNameIdMap() const
266 {
267  return m_qMapNameId;
268 }
269 
270 } // NAMESPACE
271 
272 #endif // SENSORMODEL_H
qint32 getCurrentLayout() const
Definition: sensormodel.h:257
void applySensorGroup(int id)
QVariant data(int row, int column, int role=Qt::DisplayRole) const
Definition: sensormodel.h:225
void newSelection(QList< qint32 > selection)
const QList< SensorGroup > & getSensorGroups() const
Definition: sensormodel.h:249
The SensorModel class implements a table model which holds the sensor model properties.
Definition: sensormodel.h:37
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: sensormodel.cpp:95
const QList< SensorLayout > & getSensorLayouts() const
Definition: sensormodel.h:233
Declaration of the SensorGroup Class.
const QMap< QString, qint32 > & getNameIdMap() const
Definition: sensormodel.h:265
Contains the declaration of the RealTimeSampleArrayChInfo class.
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
void mapChannelInfo(const QList< XMEASLIB::RealTimeSampleArrayChInfo > &chInfoList)
void silentUpdateSelection(const QList< qint32 > &selection)
Declaration of the SensorLayout Class.
void setCurrentLayout(int id)
SensorModel(QObject *parent=0)
Definition: sensormodel.cpp:66
qint32 getNumLayouts() const
Definition: sensormodel.h:241
The SensorItem class represents a channel item, plottet at the graphics scene.
Definition: sensoritem.h:64
void updateChannelState(SensorItem *item)