AutoSettingsDialog::AutoSettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AutoSettingsDialog) { ui->setupUi(this); MaxComPortNameList = 0; intValidator = new QIntValidator(0, 4000000, this); ui->baudRateBox->setInsertPolicy(QComboBox::NoInsert); connect(ui->serialPortInfoListBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showPortInfo(int))); connect(ui->baudRateBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCustomBaudRatePolicy(int))); connect(ui->COMCheckBox,SIGNAL(stateChanged (int)), this, SLOT(checkboxstatuschanged(int))); connect(ui->BaudrateCheckBox,SIGNAL(stateChanged (int)), this, SLOT(checkboxstatuschanged(int))); connect(ui->ParityCheckBox,SIGNAL(stateChanged (int)), this, SLOT(checkboxstatuschanged(int))); connect(ui->StopCheckBox,SIGNAL(stateChanged (int)), this, SLOT(checkboxstatuschanged(int))); connect(ui->FlowCheckBox,SIGNAL(stateChanged (int)), this, SLOT(checkboxstatuschanged(int))); connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(ClickedAutoConnect())); checkboxstatuschanged(0); fillPortsParameters(); fillPortsInfo(); updateSettings(); }
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { ui->setupUi(this); intValidator = new QIntValidator(0, 4000000, this); ui->baudRateBox->setInsertPolicy(QComboBox::NoInsert); connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(apply())); connect(ui->applyButton_2, SIGNAL(clicked()), this, SLOT(apply())); connect(ui->serialPortInfoListBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showPortInfo(int))); connect(ui->baudRateBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCustomBaudRatePolicy(int))); connect(ui->serialPortInfoListBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCustomDevicePathPolicy(int))); fillPortsParameters(); fillPortsInfo(); updateSettings(); }
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent) { setWindowTitle(tr("Settings")); m_intValidator = new QIntValidator(0, 4000000, this); createUI(); fillPortsParameters(); fillPortsInfo(); updateSettings(); }
/*! * \brief SerialPortUi::initUI */ void SerialPortUi::initUI() { intValidator = new QIntValidator(0, 4000000, this); ui->baudRateBox->setInsertPolicy(QComboBox::NoInsert); connect(ui->serialPortInfoListBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showPortInfo(int))); connect(ui->baudRateBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCustomBaudRatePolicy(int))); connect(ui->serialPortInfoListBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCustomDevicePathPolicy(int))); fillPortsParameters(); fillPortsInfo(); QSettings settings(QDir::currentPath() + "/SuperConsole.ini", QSettings::IniFormat); settings.beginGroup("SerialPortUi"); currentSettings.name = settings.value("SerialPortname", "").toString(); currentSettings.baudRate = static_cast<QSerialPort::BaudRate>(settings.value("SerialPortBaudRate", QSerialPort::Baud9600).toInt()); currentSettings.dataBits = static_cast<QSerialPort::DataBits>(settings.value("SerialPortDataBits", QSerialPort::Data8).toInt()); currentSettings.parity = static_cast<QSerialPort::Parity>(settings.value("SerialPortParity", QSerialPort::NoParity).toInt()); currentSettings.stopBits = static_cast<QSerialPort::StopBits>(settings.value("SerialPortStopBits", QSerialPort::OneStop).toInt()); currentSettings.flowControl = static_cast<QSerialPort::FlowControl>(settings.value("SerialPortFlowControl", QSerialPort::NoFlowControl).toInt()); currentSettings.stringBaudRate = settings.value("SerialPortBaudRateString", "9600").toString(); currentSettings.stringDataBits = settings.value("SerialPortDataBitsString", "8").toString(); currentSettings.stringParity = settings.value("SerialPortParityString", "None").toString(); currentSettings.stringStopBits = settings.value("SerialPortStopBitsString", "1").toString(); currentSettings.stringFlowControl = settings.value("SerialPortFlowControlString", "None").toString(); settings.endGroup(); ui->serialPortInfoListBox->setCurrentText(currentSettings.name); ui->baudRateBox->setCurrentText(currentSettings.stringBaudRate); ui->dataBitsBox->setCurrentText(currentSettings.stringDataBits); ui->parityBox->setCurrentText(currentSettings.stringParity); ui->stopBitsBox->setCurrentText(currentSettings.stringStopBits); ui->flowControlBox->setCurrentText(currentSettings.stringFlowControl); updateSettings(); updateSettings(); ui->Button_Close->setEnabled(false); ui->pushButton_Send->setEnabled(false); ui->textBrowser->document ()->setMaximumBlockCount (50); }
QT_USE_NAMESPACE PortSettingsWindow::PortSettingsWindow(QWidget *parent) : QDialog(parent), ui(new Ui::PortSettingsWindow) { ui->setupUi(this); intValidator = new QIntValidator(0,40000000,this); //ograniczy zakres możliwych do wprowadzenia prędkośći ui->comboBox_baudRate->setInsertPolicy(QComboBox::NoInsert); connect(ui->pushButton_apply,SIGNAL(clicked()),this,SLOT(apply())); connect(ui->comboBox_Port,SIGNAL(currentIndexChanged(int)),this,SLOT(showPortInfo(int))); connect(ui->comboBox_baudRate,SIGNAL(currentIndexChanged(int)),this,SLOT(checkCustomBaudRatePolicy(int))); connect(ui->pushButton_refresh,SIGNAL(clicked()),this,SLOT(fillPortsInfo())); fillPortsParameters(); fillPortsInfo(); updateSettings(); }
SerialSettingDialog::SerialSettingDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SerialSettingDialog) { ui->setupUi(this); setWindowTitle("Configure Serial Port"); serial = new QSerialPort(this); intValidator = new QIntValidator(0, 4000000, this); ui->BaudRate_Box->setInsertPolicy(QComboBox::NoInsert); initConnections(); fillPortsInfo(); fillPortsParameters(); updateSettings(); console = new SerialConsole; console->setEnabled(false); ui->horizontalLayout->addWidget(console); }
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { ui->setupUi(this); intValidator = new QIntValidator(0, 4000000, this); ui->baudRateBox->setInsertPolicy(QComboBox::NoInsert); connect(ui->applyButton, &QPushButton::clicked, this, &SettingsDialog::apply); connect(ui->serialPortInfoListBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDialog::showPortInfo); connect(ui->baudRateBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDialog::checkCustomBaudRatePolicy); connect(ui->serialPortInfoListBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDialog::checkCustomDevicePathPolicy); fillPortsParameters(); fillPortsInfo(); updateSettings(); }