From 0bd5074ae1879c336a1a59d3429616a3c8104ba1 Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Sun, 30 Mar 2014 12:13:48 +0100 Subject: Remove the noisy comments from the terminal example If anything, this should be made clear in a different way, like proper variable names, inline convenience functions for naming, example documentation extension, and so on. This is also consistent with the other examples not using "water can" comments. However, these comments mostly add noise to the code without much benefit as far as I can tell. Change-Id: I9c4121d91ca2671d44c08cf986232422f136a785 Reviewed-by: Sergey Belyashov --- examples/serialport/terminal/console.cpp | 1 - examples/serialport/terminal/settingsdialog.cpp | 14 -------------- 2 files changed, 15 deletions(-) (limited to 'examples') diff --git a/examples/serialport/terminal/console.cpp b/examples/serialport/terminal/console.cpp index 7f3f891e..327e4819 100644 --- a/examples/serialport/terminal/console.cpp +++ b/examples/serialport/terminal/console.cpp @@ -79,7 +79,6 @@ void Console::keyPressEvent(QKeyEvent *e) case Qt::Key_Right: case Qt::Key_Up: case Qt::Key_Down: - // skip processing break; default: if (localEchoEnabled) diff --git a/examples/serialport/terminal/settingsdialog.cpp b/examples/serialport/terminal/settingsdialog.cpp index 923f0004..7b278bbd 100644 --- a/examples/serialport/terminal/settingsdialog.cpp +++ b/examples/serialport/terminal/settingsdialog.cpp @@ -113,36 +113,30 @@ void SettingsDialog::checkCustomBaudRatePolicy(int idx) void SettingsDialog::fillPortsParameters() { - // fill baud rate (is not the entire list of available values, - // desired values??, add your independently) ui->baudRateBox->addItem(QStringLiteral("9600"), QSerialPort::Baud9600); ui->baudRateBox->addItem(QStringLiteral("19200"), QSerialPort::Baud19200); ui->baudRateBox->addItem(QStringLiteral("38400"), QSerialPort::Baud38400); ui->baudRateBox->addItem(QStringLiteral("115200"), QSerialPort::Baud115200); ui->baudRateBox->addItem(QStringLiteral("Custom")); - // fill data bits ui->dataBitsBox->addItem(QStringLiteral("5"), QSerialPort::Data5); ui->dataBitsBox->addItem(QStringLiteral("6"), QSerialPort::Data6); ui->dataBitsBox->addItem(QStringLiteral("7"), QSerialPort::Data7); ui->dataBitsBox->addItem(QStringLiteral("8"), QSerialPort::Data8); ui->dataBitsBox->setCurrentIndex(3); - // fill parity ui->parityBox->addItem(QStringLiteral("None"), QSerialPort::NoParity); ui->parityBox->addItem(QStringLiteral("Even"), QSerialPort::EvenParity); ui->parityBox->addItem(QStringLiteral("Odd"), QSerialPort::OddParity); ui->parityBox->addItem(QStringLiteral("Mark"), QSerialPort::MarkParity); ui->parityBox->addItem(QStringLiteral("Space"), QSerialPort::SpaceParity); - // fill stop bits ui->stopBitsBox->addItem(QStringLiteral("1"), QSerialPort::OneStop); #ifdef Q_OS_WIN ui->stopBitsBox->addItem(QStringLiteral("1.5"), QSerialPort::OneAndHalfStop); #endif ui->stopBitsBox->addItem(QStringLiteral("2"), QSerialPort::TwoStop); - // fill flow control ui->flowControlBox->addItem(QStringLiteral("None"), QSerialPort::NoFlowControl); ui->flowControlBox->addItem(QStringLiteral("RTS/CTS"), QSerialPort::HardwareControl); ui->flowControlBox->addItem(QStringLiteral("XON/XOFF"), QSerialPort::SoftwareControl); @@ -173,37 +167,29 @@ void SettingsDialog::updateSettings() { currentSettings.name = ui->serialPortInfoListBox->currentText(); - // Baud Rate if (ui->baudRateBox->currentIndex() == 4) { - // custom baud rate currentSettings.baudRate = ui->baudRateBox->currentText().toInt(); } else { - // standard baud rate currentSettings.baudRate = static_cast( ui->baudRateBox->itemData(ui->baudRateBox->currentIndex()).toInt()); } currentSettings.stringBaudRate = QString::number(currentSettings.baudRate); - // Data bits currentSettings.dataBits = static_cast( ui->dataBitsBox->itemData(ui->dataBitsBox->currentIndex()).toInt()); currentSettings.stringDataBits = ui->dataBitsBox->currentText(); - // Parity currentSettings.parity = static_cast( ui->parityBox->itemData(ui->parityBox->currentIndex()).toInt()); currentSettings.stringParity = ui->parityBox->currentText(); - // Stop bits currentSettings.stopBits = static_cast( ui->stopBitsBox->itemData(ui->stopBitsBox->currentIndex()).toInt()); currentSettings.stringStopBits = ui->stopBitsBox->currentText(); - // Flow control currentSettings.flowControl = static_cast( ui->flowControlBox->itemData(ui->flowControlBox->currentIndex()).toInt()); currentSettings.stringFlowControl = ui->flowControlBox->currentText(); - // Additional options currentSettings.localEchoEnabled = ui->localEchoCheckBox->isChecked(); } -- cgit v1.2.3