qpidctrl  0.7.1
Public Slots | Public Member Functions | Private Attributes | List of all members
QPidCommPortSelector Class Reference

#include <qpidcommportselector.h>

Inheritance diagram for QPidCommPortSelector:
Inheritance graph

Public Slots

void onPortTypeChanged (int newType)
 
void accept ()
 

Public Member Functions

 QPidCommPortSelector (QWidget *parent=0)
 
 ~QPidCommPortSelector ()
 
void setCommPort (QPidCommPortPtr port)
 

Private Attributes

Ui::QPidCommPortSelector * ui
 
QPidCommPortPtr m_CommPort
 

Detailed Description

Definition at line 12 of file qpidcommportselector.h.

Constructor & Destructor Documentation

QPidCommPortSelector::QPidCommPortSelector ( QWidget *  parent = 0)
explicit

Definition at line 10 of file qpidcommportselector.cpp.

References ui.

10  :
11  QWidget(parent),
12  ui(new Ui::QPidCommPortSelector)
13 {
14  ui->setupUi(this);
15 
16  connect(ui->m_PortType, SIGNAL(currentIndexChanged(int)), ui->m_PortTypePages, SLOT(setCurrentIndex(int)));
17 }
Ui::QPidCommPortSelector * ui
QPidCommPortSelector::~QPidCommPortSelector ( )

Definition at line 19 of file qpidcommportselector.cpp.

References ui.

20 {
21  delete ui;
22 }
Ui::QPidCommPortSelector * ui

Member Function Documentation

void QPidCommPortSelector::accept ( )
slot

Definition at line 114 of file qpidcommportselector.cpp.

References m_CommPort, and ui.

115 {
116  if (m_CommPort) {
117  m_CommPort->set_CommPortType(ui->m_PortType->currentIndex());
118 
119  m_CommPort->set_SerialPortName(ui->m_SerialPortName->currentText());
120 
121  m_CommPort->set_SocketHostAddress(ui->m_SocketHostAddress->text());
122  m_CommPort->set_SocketPortNumber(ui->m_SocketPortNumber->value());
123 
124  m_CommPort->set_EpicsPVName(ui->m_EpicsPVName->text());
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());
130  }
131 }
QPidCommPortPtr m_CommPort
Ui::QPidCommPortSelector * ui
void QPidCommPortSelector::onPortTypeChanged ( int  newType)
slot

Definition at line 78 of file qpidcommportselector.cpp.

References QPidCommPort::EpicsPV, QPidCommPort::LocalSerialPort, QPidCommPort::NetworkSocket, QPidCommPort::NoPort, and ui.

Referenced by setCommPort().

79 {
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);
89 
90  switch (newType) {
92  break;
93 
95  ui->m_SerialPortName->setEnabled(true);
96  ui->m_SerialPortNameLabel->setEnabled(true);
97  break;
98 
100  ui->m_SocketHostAddress->setEnabled(true);
101  ui->m_SocketPortNumber->setEnabled(true);
102  ui->m_SocketHostAddressLabel->setEnabled(true);
103  ui->m_SocketPortNumberLabel->setEnabled(true);
104  break;
105 
107  ui->m_EpicsPVName->setEnabled(true);
108  ui->m_EpicsPVNameLabel->setEnabled(true);
109  break;
110 
111  }
112 }
Ui::QPidCommPortSelector * ui
void QPidCommPortSelector::setCommPort ( QPidCommPortPtr  port)

Definition at line 24 of file qpidcommportselector.cpp.

References m_CommPort, onPortTypeChanged(), and ui.

25 {
26  m_CommPort = port;
27 
28  ui->m_PortType->clear();
29  ui->m_PortType->addItems(m_CommPort->commPortTypes());
30 
31  ui->m_SerialPortBaud->clear();
32  ui->m_SerialPortBaud->addItems(m_CommPort->commPortBaudRates());
33 
34  ui->m_SerialPortDataBits->clear();
35  ui->m_SerialPortDataBits->addItems(m_CommPort->commPortDataBits());
36 
37  ui->m_SerialPortFlowControl->clear();
38  ui->m_SerialPortFlowControl->addItems(m_CommPort->commPortFlowControls());
39 
40  ui->m_SerialPortParity->clear();
41  ui->m_SerialPortParity->addItems(m_CommPort->commPortParitys());
42 
43  ui->m_SerialPortStopBits->clear();
44  ui->m_SerialPortStopBits->addItems(m_CommPort->commPortStopBits());
45 
46  connect(ui->m_PortType, SIGNAL(currentIndexChanged(int)), this, SLOT(onPortTypeChanged(int)));
47 
48  onPortTypeChanged(m_CommPort->get_CommPortType());
49 
50  QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
51 
52  QString portName = m_CommPort->get_SerialPortName();
53 
54  for (int i=0; i<ports.count(); i++) {
55  QextPortInfo port = ports.value(i);
56 
57  QString aPortName = port.portName;
58 
59  ui->m_SerialPortName->addItem(aPortName);
60 
61  if (portName == aPortName) {
62  ui->m_SerialPortName->setCurrentIndex(i);
63  }
64  }
65 
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());
71 
72  ui->m_SocketHostAddress->setText(m_CommPort->get_SocketHostAddress());
73  ui->m_SocketPortNumber->setValue(m_CommPort->get_SocketPortNumber());
74 
75  ui->m_EpicsPVName->setText(m_CommPort->get_EpicsPVName());
76 }
QPidCommPortPtr m_CommPort
void onPortTypeChanged(int newType)
Ui::QPidCommPortSelector * ui

Member Data Documentation

QPidCommPortPtr QPidCommPortSelector::m_CommPort
private

Definition at line 28 of file qpidcommportselector.h.

Referenced by accept(), and setCommPort().

Ui::QPidCommPortSelector* QPidCommPortSelector::ui
private

The documentation for this class was generated from the following files: