qpidctrl  0.7.1
qptc10devicedialog.cpp
Go to the documentation of this file.
1 #include "qptc10devicedialog.h"
2 #include "ui_qptc10devicedialog.h"
3 #include "qptc10device.h"
4 #include "qextserialenumerator.h"
5 #include "qpiddebug.h"
6 
8  QDialog(),
9  ui(new Ui::QPTC10DeviceDialog),
10  m_Device(device)
11 {
12  ui->setupUi(this);
13 
15 
16  if (dev) {
17  ui->m_PidDeviceSettings->setDevice(dev);
18 
19  dev->updateChannelList();
20 
21  ui->m_InputChannel->addItems(dev->get_InputChannels());
22  ui->m_OutputChannel->addItems(dev->get_OutputChannels());
23  ui->m_InputChannel->setCurrentIndex(dev->get_InputChannel());
24  ui->m_OutputChannel->setCurrentIndex(dev->get_OutputChannel());
25  }
26 
27  connect(ui->m_CommandEntry, SIGNAL(activated(QString)), this, SLOT(commandEntered()));
28 }
29 
31 {
32  delete ui;
33 }
34 
36 {
38 
39  if (dev) {
40  if (qcepDebug(DEBUG_PTC10)) {
41  dev->printMessage("QPTC10DeviceDialog::accept");
42  }
43 
44  ui->m_PidDeviceSettings->accept();
45 
46  dev->set_InputChannel(ui->m_InputChannel->currentIndex());
47  dev->set_OutputChannel(ui->m_OutputChannel->currentIndex());
48  }
49 
50  QDialog::accept();
51 }
52 
54 {
55  QString cmd = ui->m_CommandEntry->currentText();
56 
57  ui->m_Messages->append(cmd);
58 
60 
61  if (dev) {
62  dev->sendCommand(cmd);
63  }
64 }
QPTC10DeviceDialog(QPTC10DeviceWPtr device)
QWeakPointer< QPTC10Device > QPTC10DeviceWPtr
Ui::QPTC10DeviceDialog * ui
QPTC10DeviceWPtr m_Device
QSharedPointer< QPTC10Device > QPTC10DevicePtr