2 #include "ui_qpidcommportselector.h"
8 #include "qextserialenumerator.h"
16 connect(
ui->m_PortType, SIGNAL(currentIndexChanged(
int)),
ui->m_PortTypePages, SLOT(setCurrentIndex(
int)));
28 ui->m_PortType->clear();
31 ui->m_SerialPortBaud->clear();
32 ui->m_SerialPortBaud->addItems(
m_CommPort->commPortBaudRates());
34 ui->m_SerialPortDataBits->clear();
35 ui->m_SerialPortDataBits->addItems(
m_CommPort->commPortDataBits());
37 ui->m_SerialPortFlowControl->clear();
38 ui->m_SerialPortFlowControl->addItems(
m_CommPort->commPortFlowControls());
40 ui->m_SerialPortParity->clear();
41 ui->m_SerialPortParity->addItems(
m_CommPort->commPortParitys());
43 ui->m_SerialPortStopBits->clear();
44 ui->m_SerialPortStopBits->addItems(
m_CommPort->commPortStopBits());
46 connect(
ui->m_PortType, SIGNAL(currentIndexChanged(
int)),
this, SLOT(
onPortTypeChanged(
int)));
50 QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
52 QString portName =
m_CommPort->get_SerialPortName();
54 for (
int i=0; i<ports.count(); i++) {
55 QextPortInfo port = ports.value(i);
57 QString aPortName = port.portName;
59 ui->m_SerialPortName->addItem(aPortName);
61 if (portName == aPortName) {
62 ui->m_SerialPortName->setCurrentIndex(i);
66 ui->m_SerialPortBaud->setCurrentIndex(
m_CommPort->get_SerialPortBaud());
67 ui->m_SerialPortDataBits->setCurrentIndex(
m_CommPort->get_SerialPortBits());
68 ui->m_SerialPortFlowControl->setCurrentIndex(
m_CommPort->get_SerialPortFlowControl());
69 ui->m_SerialPortParity->setCurrentIndex(
m_CommPort->get_SerialPortParity());
70 ui->m_SerialPortStopBits->setCurrentIndex(
m_CommPort->get_SerialPortStopBits());
72 ui->m_SocketHostAddress->setText(
m_CommPort->get_SocketHostAddress());
73 ui->m_SocketPortNumber->setValue(
m_CommPort->get_SocketPortNumber());
75 ui->m_EpicsPVName->setText(
m_CommPort->get_EpicsPVName());
80 ui->m_PortType->setCurrentIndex(newType);
81 ui->m_SerialPortName->setEnabled(
false);
82 ui->m_SocketHostAddress->setEnabled(
false);
83 ui->m_SocketPortNumber->setEnabled(
false);
84 ui->m_EpicsPVName->setEnabled(
false);
85 ui->m_SerialPortNameLabel->setEnabled(
false);
86 ui->m_SocketHostAddressLabel->setEnabled(
false);
87 ui->m_SocketPortNumberLabel->setEnabled(
false);
88 ui->m_EpicsPVNameLabel->setEnabled(
false);
95 ui->m_SerialPortName->setEnabled(
true);
96 ui->m_SerialPortNameLabel->setEnabled(
true);
100 ui->m_SocketHostAddress->setEnabled(
true);
101 ui->m_SocketPortNumber->setEnabled(
true);
102 ui->m_SocketHostAddressLabel->setEnabled(
true);
103 ui->m_SocketPortNumberLabel->setEnabled(
true);
107 ui->m_EpicsPVName->setEnabled(
true);
108 ui->m_EpicsPVNameLabel->setEnabled(
true);
117 m_CommPort->set_CommPortType(
ui->m_PortType->currentIndex());
119 m_CommPort->set_SerialPortName(
ui->m_SerialPortName->currentText());
121 m_CommPort->set_SocketHostAddress(
ui->m_SocketHostAddress->text());
122 m_CommPort->set_SocketPortNumber(
ui->m_SocketPortNumber->value());
125 m_CommPort->set_SerialPortBaud(
ui->m_SerialPortBaud->currentIndex());
126 m_CommPort->set_SerialPortBits(
ui->m_SerialPortDataBits->currentIndex());
127 m_CommPort->set_SerialPortFlowControl(
ui->m_SerialPortFlowControl->currentIndex());
128 m_CommPort->set_SerialPortParity(
ui->m_SerialPortParity->currentIndex());
129 m_CommPort->set_SerialPortStopBits(
ui->m_SerialPortStopBits->currentIndex());
QPidCommPortPtr m_CommPort
QPidCommPortSelector(QWidget *parent=0)
void onPortTypeChanged(int newType)
Ui::QPidCommPortSelector * ui
void setCommPort(QPidCommPortPtr port)
QSharedPointer< QPidCommPort > QPidCommPortPtr