-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.h
83 lines (77 loc) · 3.36 KB
/
models.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef MODELS_H
#define MODELS_H
#include <vector>
#include <QSize>
#include <QAbstractTableModel>
#include <JPetData/Detectors.h>
#include <JPetData/Frames.h>
#include <JPetData/HVconfig.h>
#include <JPetData/HVSetter.h>
class ConfigsModel : public QAbstractTableModel{
Q_OBJECT
public:
ConfigsModel(const std::shared_ptr<DataAccess::IDataSource> src,const size_t setup_id);
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
const JPetSetup::HVconfig& GetItem(const size_t index)const;
void AddItem(const QString name);
void Delete(const size_t index);
private:
size_t f_setup_id;
JPetSetup::HVconfigTable f_table;
std::vector<JPetSetup::HVconfig> f_cache;
};
class SetupsModel : public QAbstractTableModel{
Q_OBJECT
public:
SetupsModel(const JPetSetup::Frame&frame);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
const JPetSetup::Setup& GetItem(const size_t index)const;
const JPetSetup::HighVoltage& GetHVItem(const size_t index)const;
private:
DataAccess::DataTableInterface<JPetSetup::Setup> f_table;
JPetSetup::HighVoltageTable f_hv_table;
std::vector<JPetSetup::Setup> f_cache;
std::vector<JPetSetup::HighVoltage> f_cache_hv;
};
class FramesModel : public QAbstractTableModel{
Q_OBJECT
public:
FramesModel(const std::shared_ptr<DataAccess::IDataSource> src);
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
const JPetSetup::Frame& GetItem(const size_t index)const;
std::shared_ptr<SetupsModel> SetupModel(const int index)const;
private:
JPetSetup::Frames f_table;
std::vector<JPetSetup::Frame> f_cache;
std::vector<std::shared_ptr<SetupsModel>> f_setup_cache;
};
class HVTableModel : public QAbstractTableModel{
Q_OBJECT
public:
HVTableModel(const JPetSetup::HVconfig&config,
const JPetSetup::Setup&setup,
const JPetSetup::Frame&frame,
const JPetSetup::HighVoltage&hvoltage,
const std::shared_ptr<DataAccess::IDataSource> src,
const std::shared_ptr<HVAdjust::IHVSetter>
);
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex & index) const ;
HVAdjust::HVTable&Data();
private:
HVAdjust::HVTable f_hvtable;
};
#endif // MODELS_H