Exemplo n.º 1
0
QT_USE_NAMESPACE

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    serial = new QSerialPort(this);
    OpenStatus = false;
    intValidator = new QIntValidator(0, 4000000, this);
    fileLocation = "../";
    binLoadCnt = 1;
    usart_temp = 0;

    ui->baundRateBox->setInsertPolicy (QComboBox::NoInsert);
    ui->tabWidget->setCurrentIndex(2);
    ui->loadButton->setEnabled(false);
    ui->viewButton->setEnabled(false);

    connect(ui->baundRateBox, SIGNAL(currentIndexChanged(int)),
             this, SLOT(checkCustomBaudRate(int)));

    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));

    connect(this, SIGNAL(transmitData(int)), this, SLOT(transmitDataFun(int)));
    connect(this, SIGNAL(binFileOpenFailed()), this, SLOT(on_fileButton_clicked()));

    fillPortsInfo();
    fillPortsCom();
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
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();

}
Exemplo n.º 4
0
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();
}
Exemplo n.º 5
0
SettingsDialog::SettingsDialog(QWidget *parent) :
    QDialog(parent)
{
    setWindowTitle(tr("Settings"));

    m_intValidator = new QIntValidator(0, 4000000, this);

    createUI();
    fillPortsParameters();
    fillPortsInfo();
    updateSettings();
}
Exemplo n.º 6
0
/*!
 * \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);
}
TerminalConsole::TerminalConsole(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TerminalConsole),
    m_consoleMode(APM)
{
    ui->setupUi(this);

    // create the cosole and add it to the centralwidget
    m_console = new Console;
    m_console->setEnabled(false);

    m_statusBar = new QStatusBar;

    QLayout* layout = ui->terminalGroupBox->layout();
    layout->addWidget(m_console);
    layout->addWidget(m_statusBar);

    m_serial = new QSerialPort(this);
    m_settingsDialog = new SettingsDialog;

    ui->connectButton->setEnabled(true);
    ui->disconnectButton->setEnabled(false);
    ui->settingsButton->setEnabled(true);


    addBaudComboBoxConfig();
    fillPortsInfo(*ui->linkComboBox);

    loadSettings();

    if (m_settings.name == "") {
        setLink(ui->linkComboBox->currentIndex());
    } else {
        ui->linkComboBox->setCurrentIndex(0);
    }

    addConsoleModesComboBoxConfig();

    initConnections();
}
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);
}
Exemplo n.º 9
0
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();
}
Exemplo n.º 10
0
/*!
 * \brief SerialPortUi::on_searchButton_clicked
 */
void SerialPortUi::on_searchButton_clicked()
{
    fillPortsInfo();
    ui->serialPortInfoListBox->showPopup();
}