HAL
latch_wizardpage.cpp
Go to the documentation of this file.
4 
5 namespace hal
6 {
8  {
9  setTitle("Latch");
10  setSubTitle("Enter parameters for latch component");
11  mLayout = new QGridLayout(this);
12 
13  mDataIn = new QLineEdit(this);
14  mEnableOn = new QLineEdit(this);
15  mAReset = new QLineEdit(this);
16  mASet = new QLineEdit(this);
17  mIntState = new QLineEdit(this);
18  mNegIntState = new QLineEdit(this);
19 
20  mLabDataIn = new QLabel("Data input function: ", this);
21  mLabEnableOn = new QLabel("Enable behaviour function: ", this);
22  mLabAReset = new QLabel("Asynchronous reset: ", this);
23  mLabASet = new QLabel("Asynchronous set: ", this);
24  mLabIntState = new QLabel("Set+Reset -> internal state: ", this);
25  mLabNegIntState = new QLabel("Set+Reset -> neg. int. state:", this);
26 
27  mLayout->addWidget(mLabDataIn, 0, 0);
28  mLayout->addWidget(mDataIn, 0, 1);
29  mLayout->addWidget(mLabEnableOn, 1, 0);
30  mLayout->addWidget(mEnableOn, 1, 1);
31  mLayout->addWidget(mLabAReset, 2, 0);
32  mLayout->addWidget(mAReset, 2, 1);
33  mLayout->addWidget(mLabASet, 3, 0);
34  mLayout->addWidget(mASet, 3, 1);
35  mLayout->addWidget(mLabIntState, 4, 0);
36  mLayout->addWidget(mIntState, 4, 1);
37  mLayout->addWidget(mLabNegIntState, 5, 0);
38  mLayout->addWidget(mNegIntState, 5, 1);
39 
40  mAReset->setDisabled(true);
41  mASet->setDisabled(true);
42 
43  setLayout(mLayout);
44 
51  }
52 
55  {
57 
58  if(latch != nullptr)
59  {
60  mEnableOn->setText(QString::fromStdString(latch->get_enable_function().to_string()));
61  mDataIn->setText(QString::fromStdString(latch->get_data_in_function().to_string()));
62 
63  if (latch->get_async_reset_function().is_empty()) mAReset->setText("N/A");
64  else {
65  mAReset->setDisabled(false);
66  mAReset->setText(QString::fromStdString(latch->get_async_reset_function().to_string()));
67  }
68  if (latch->get_async_set_function().is_empty()) mASet->setText("N/A");
69  else {
70  mASet->setDisabled(false);
71  mASet->setText(QString::fromStdString(latch->get_async_set_function().to_string()));
72  }
73 
74  auto [stateBeh,negStateBeh] = latch->get_async_set_reset_behavior();
75  if (stateBeh == AsyncSetResetBehavior::undef) mIntState->setText("undefined");
76  else mIntState->setText(QString::fromStdString(enum_to_string<AsyncSetResetBehavior>(stateBeh)));
77 
78  if (negStateBeh == AsyncSetResetBehavior::undef) mNegIntState->setText("undefined");
79  else mNegIntState->setText(QString::fromStdString(enum_to_string<AsyncSetResetBehavior>(negStateBeh)));
80  }
81  }
82 
83  }
84 }
bool has_component_of_type(const GateTypeComponent::ComponentType type) const
Definition: gate_type.cpp:54
T * get_component_as(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const
Definition: gate_type.h:89
static bool is_class_of(const GateTypeComponent *component)
void setData(GateType *gate)
LatchWizardPage(QWidget *parent=nullptr)
void addWidget(QWidget *widget, int row, int column, Qt::Alignment alignment)
void setText(const QString &)
void textChanged(const QString &text)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString fromStdString(const std::string &str)
void setDisabled(bool disable)
void setLayout(QLayout *layout)
void completeChanged()
void setSubTitle(const QString &subTitle)
void setTitle(const QString &title)