ifw-fcf  2.0.0
device.h
Go to the documentation of this file.
1 
9 #ifndef DEVICE_WDG_H
10 #define DEVICE_WDG_H
11 
12 #include <rad/smAdapter.hpp>
14 #include <fcf/gui/wdglib/spinner.h>
15 
16 #include <QWidget>
17 #include <QtWidgets/QLabel>
18 #include <QObject>
19 
20 class QGroupBox;
21 class QLabel;
22 class QTextEdit;
23 class QLineEdit;
24 class QPushButton;
25 class QCheckBox;
26 class QComboBox;
27 class QListWidget;
28 
29 struct CommonUi {
30 public:
31 
32  explicit CommonUi() :
33  m_spinner(nullptr) {};
34 
35  void SetName(QLabel* name) {
36  m_name = name;
37  }
38 
39  QLabel* GetName() {
40  return m_name;
41  }
42 
43  void SetEnable(QCheckBox* enable) {
44  m_enable = enable;
45  }
46 
47  QCheckBox* GetEnable() {
48  return m_enable;
49  }
50 
51  void SetSpinner(Spinner* spinner) {
52  m_spinner = spinner;
53  }
54 
56  return m_spinner;
57  }
58 
59  void SetState(QLabel* state) {
60  m_state = state;
61  }
62 
63  QLabel* GetState() {
64  return m_state;
65  }
66 
67  void SetSubstate(QLabel* substate) {
68  m_substate = substate;
69  }
70 
71  QLabel* GetSubstate() {
72  return m_substate;
73  }
74 
75  void SetSim(QLabel* sim) {
76  m_sim = sim;
77  }
78 
79  QLabel* GetSim() {
80  return m_sim;
81  }
82 
83  void SetLocal(QLabel* local) {
84  m_local = local;
85  }
86 
87  QLabel* GetLocal() {
88  return m_local;
89  }
90 
91 
92  void SetFrame(QFrame* frame) {
93  m_frame = frame;
94  }
95 
96  QFrame* GetFrame() {
97  return m_frame;
98  }
99 
100 private:
101  QLabel* m_name;
102  QCheckBox* m_enable;
103  Spinner* m_spinner;
104  QLabel* m_state;
105  QLabel* m_substate;
106  QLabel* m_sim;
107  QLabel* m_local;
108  QFrame* m_frame;
109 
110 };
111 
112 class DeviceWdg : public AbstractDevice {
113  Q_OBJECT
114 public:
115  explicit DeviceWdg(QWidget *parent,
116  const std::string& name,
117  const std::string& ps_endpoint,
118  const int& cmd_timeout);
119  virtual ~DeviceWdg();
120  std::string GetName();
121  void Select();
122  void Deselect();
123  bool IsSelected();
124  virtual void Stop();
125  virtual void GetDbAttributes(std::string server_id, std::vector<std::string>& vector);
126  virtual void UpdateData(QList<QVariant>& data_list);
127  virtual void SetEnable(bool flag);
128 
129 protected:
130  void SetupCommonUi();
131  bool IsSimulated();
132 
133 signals:
134  void TriggerSetup(QString);
135 
136 public slots:
137  void SetActive(int index);
138  void UpdateState(int state);
139  bool UpdateSubstate(int substate);
140  void UpdateSpinner(int substate);
141  void UpdateErrorMsg(std::string msg);
142  void HandleSetupButton();
143 
144 
145 protected:
147  std::string m_name;
148  std::string m_ps_endpoint;
152 
153 };
154 
155 #endif // DEVICE_WDG_H
DeviceWdg::UpdateState
void UpdateState(int state)
Definition: device.cpp:136
CommonUi::GetSpinner
Spinner * GetSpinner()
Definition: device.h:55
DeviceWdg::m_cmd_timeout
int m_cmd_timeout
Definition: device.h:149
DeviceWdg::SetActive
void SetActive(int index)
Definition: device.cpp:74
CommonUi::CommonUi
CommonUi()
Definition: device.h:32
DeviceWdg::Stop
virtual void Stop()
Definition: device.cpp:155
DeviceWdg::SetEnable
virtual void SetEnable(bool flag)
Definition: device.cpp:223
CommonUi::GetEnable
QCheckBox * GetEnable()
Definition: device.h:47
CommonUi::GetName
QLabel * GetName()
Definition: device.h:39
AbstractDevice
Definition: abstractDevice.h:21
spinner.h
DeviceWdg::IsSimulated
bool IsSimulated()
Definition: device.cpp:265
DeviceWdg::GetName
std::string GetName()
Definition: device.cpp:57
DeviceWdg::m_ps_endpoint
std::string m_ps_endpoint
Definition: device.h:148
Spinner
Definition: spinner.h:29
DeviceWdg::m_ui
CommonUi m_ui
Definition: device.h:151
CommonUi::GetFrame
QFrame * GetFrame()
Definition: device.h:96
DeviceWdg::SetupCommonUi
void SetupCommonUi()
Definition: device.cpp:38
CommonUi::GetSim
QLabel * GetSim()
Definition: device.h:79
fcfclib.shell_commander.enable
def enable(supif, arg)
Definition: shell_commander.py:34
DeviceWdg::Select
void Select()
Definition: device.cpp:61
CommonUi::GetLocal
QLabel * GetLocal()
Definition: device.h:87
CommonUi::SetEnable
void SetEnable(QCheckBox *enable)
Definition: device.h:43
CommonUi::SetLocal
void SetLocal(QLabel *local)
Definition: device.h:83
DeviceWdg::HandleSetupButton
void HandleSetupButton()
Definition: device.cpp:160
abstractDevice.h
WDGLIB AbstractDevice class declaration file.
DeviceWdg::m_name
std::string m_name
Definition: device.h:147
DeviceWdg::UpdateData
virtual void UpdateData(QList< QVariant > &data_list)
Definition: device.cpp:190
CommonUi::SetSpinner
void SetSpinner(Spinner *spinner)
Definition: device.h:51
DeviceWdg::UpdateSubstate
bool UpdateSubstate(int substate)
Definition: device.cpp:79
CommonUi::GetSubstate
QLabel * GetSubstate()
Definition: device.h:71
CommonUi::GetState
QLabel * GetState()
Definition: device.h:63
CommonUi::SetSim
void SetSim(QLabel *sim)
Definition: device.h:75
CommonUi::SetSubstate
void SetSubstate(QLabel *substate)
Definition: device.h:67
DeviceWdg::Deselect
void Deselect()
Definition: device.cpp:65
CommonUi::SetName
void SetName(QLabel *name)
Definition: device.h:35
CommonUi::SetState
void SetState(QLabel *state)
Definition: device.h:59
DeviceWdg::m_spinner_timer
QTimer * m_spinner_timer
Definition: device.h:146
DeviceWdg::GetDbAttributes
virtual void GetDbAttributes(std::string server_id, std::vector< std::string > &vector)
Definition: device.cpp:165
DeviceWdg::DeviceWdg
DeviceWdg(QWidget *parent, const std::string &name, const std::string &ps_endpoint, const int &cmd_timeout)
Definition: device.cpp:23
DeviceWdg::m_simulated
bool m_simulated
Definition: device.h:150
DeviceWdg::~DeviceWdg
virtual ~DeviceWdg()
Definition: device.cpp:34
DeviceWdg::IsSelected
bool IsSelected()
Definition: device.cpp:69
DeviceWdg::UpdateSpinner
void UpdateSpinner(int substate)
Definition: device.cpp:112
CommonUi::SetFrame
void SetFrame(QFrame *frame)
Definition: device.h:92
DeviceWdg::TriggerSetup
void TriggerSetup(QString)
CommonUi
Definition: device.h:29
DeviceWdg::UpdateErrorMsg
void UpdateErrorMsg(std::string msg)
Definition: device.cpp:151
DeviceWdg
Definition: device.h:112