1 #include <visp3/ustk_gui/usUltrasonixClientWidget.h>
3 #if defined(USTK_HAVE_VTK_QT) && defined(VISP_HAVE_MODULE_USTK_GRABBER)
5 usUltrasonixClientWidget::usUltrasonixClientWidget()
7 serverIpAdressLabel =
new QLabel(QString(
"Server ip: "),
this);
8 probeSelectionLabel =
new QLabel(QString(
"Probe (on top slot) : "),
this);
10 connectPushButton =
new QPushButton(QString(
"Connect to server"),
this);
11 initPushButton =
new QPushButton(QString(
"Init acquisition"),
this);
13 center3Dprobe =
new QPushButton(QString(
"Center 3D probe motor"),
this);
14 startPushButton =
new QPushButton(QString(
"Start Acquisition"),
this);
15 stopPushButton =
new QPushButton(QString(
"Stop Acquisition"),
this);
17 ipTextEdit =
new QLineEdit(QString(
"192.168.100.2"),
this);
18 probeSelectComboBox =
new QComboBox(
this);
19 probeSelectComboBox->addItem(QString(
"4DC7 (3D)"));
20 probeSelectComboBox->addItem(QString(
"C5-2 (2D)"));
23 QString ipRange =
"(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])";
24 QRegExp ipRegex(
"^" + ipRange +
"\\." + ipRange +
"\\." + ipRange +
"\\." + ipRange +
"$");
25 ipValidator =
new QRegExpValidator(ipRegex,
this);
26 ipTextEdit->setValidator(ipValidator);
29 Layout =
new QGridLayout;
30 Layout->addWidget(serverIpAdressLabel, 0, 0, Qt::AlignRight);
31 Layout->addWidget(connectPushButton, 1, 0, 1, 2, Qt::AlignCenter);
32 Layout->addWidget(probeSelectionLabel, 2, 0, Qt::AlignRight);
33 Layout->addWidget(initPushButton, 3, 0, 3, 2, Qt::AlignCenter);
34 Layout->addWidget(center3Dprobe, 4, 0, 4, 2, Qt::AlignCenter);
35 Layout->addWidget(startPushButton, 5, 0, 5, 2, Qt::AlignCenter);
36 Layout->addWidget(stopPushButton, 6, 0, 6, 2, Qt::AlignCenter);
38 Layout->addWidget(ipTextEdit, 0, 1, Qt::AlignLeft);
39 Layout->addWidget(probeSelectComboBox, 2, 1, Qt::AlignLeft);
41 this->setLayout(Layout);
43 connect(connectPushButton, SIGNAL(clicked()),
this, SLOT(connectToServerSlot()));
44 connect(initPushButton, SIGNAL(clicked()),
this, SLOT(initAcquisitionSlot()));
46 connect(center3Dprobe, SIGNAL(clicked()),
this, SIGNAL(center3DProbeMotor()));
48 connect(startPushButton, SIGNAL(clicked()),
this, SIGNAL(runAcquisition()));
49 connect(stopPushButton, SIGNAL(clicked()),
this, SIGNAL(stopAcquisition()));
52 usUltrasonixClientWidget::~usUltrasonixClientWidget()
54 delete serverIpAdressLabel;
55 delete probeSelectionLabel;
56 delete connectPushButton;
57 delete initPushButton;
58 delete startPushButton;
60 delete stopPushButton;
62 delete probeSelectComboBox;
66 void usUltrasonixClientWidget::initAcquisitionSlot()
68 initHeader.slotId = 0;
69 initHeader.imagingMode = 0;
71 if (probeSelectComboBox->currentIndex() == 0) {
72 initHeader.probeId = 15;
73 emit(initAcquisition(initHeader));
74 }
else if (probeSelectComboBox->currentIndex() == 1) {
75 initHeader.probeId = 10;
76 emit(initAcquisition(initHeader));
79 msgBox.setText(
"Wrong probe selection !");
84 void usUltrasonixClientWidget::connectToServerSlot()
86 hostAddress.setAddress(ipTextEdit->text());
87 emit(connectToServer(hostAddress));