diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2017-09-27 19:35:33 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2017-10-12 08:45:22 +0000 |
commit | 27c0dc578676e7951b92da1f282ac0177edbe9b3 (patch) | |
tree | 94fc4941df8d60a5303b150337f1136dd81a0e74 /examples | |
parent | 42b0324d3c37d9bde5e06e183ec770c7556341c2 (diff) | |
download | qtserialport-27c0dc578676e7951b92da1f282ac0177edbe9b3.tar.gz |
Revamp the Console Enumerator Examplev5.10.0-beta2
* Update includes to common style.
* Split very long lines.
* Remove QT_USE_NAMESPACE macro.
* Remove QObject::tr() calls.
Task-number: QTBUG-60652
Change-Id: I76105da84b8b89e76b723208600604bca6edd8a5
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/serialport/cenumerator/main.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/examples/serialport/cenumerator/main.cpp b/examples/serialport/cenumerator/main.cpp index f805021..af6d7e4 100644 --- a/examples/serialport/cenumerator/main.cpp +++ b/examples/serialport/cenumerator/main.cpp @@ -48,21 +48,19 @@ ** ****************************************************************************/ -#include <QTextStream> #include <QCoreApplication> -#include <QtSerialPort/QSerialPortInfo> - -QT_USE_NAMESPACE +#include <QSerialPortInfo> +#include <QTextStream> int main(int argc, char *argv[]) { - QCoreApplication a(argc, argv); + QCoreApplication coreApplication(argc, argv); QTextStream out(stdout); const auto serialPortInfos = QSerialPortInfo::availablePorts(); - out << QObject::tr("Total number of ports available: ") << serialPortInfos.count() << endl; + out << "Total number of ports available: " << serialPortInfos.count() << endl; - const QString blankString = QObject::tr("N/A"); + const QString blankString = "N/A"; QString description; QString manufacturer; QString serialNumber; @@ -72,14 +70,18 @@ int main(int argc, char *argv[]) manufacturer = serialPortInfo.manufacturer(); serialNumber = serialPortInfo.serialNumber(); out << endl - << QObject::tr("Port: ") << serialPortInfo.portName() << endl - << QObject::tr("Location: ") << serialPortInfo.systemLocation() << endl - << QObject::tr("Description: ") << (!description.isEmpty() ? description : blankString) << endl - << QObject::tr("Manufacturer: ") << (!manufacturer.isEmpty() ? manufacturer : blankString) << endl - << QObject::tr("Serial number: ") << (!serialNumber.isEmpty() ? serialNumber : blankString) << endl - << QObject::tr("Vendor Identifier: ") << (serialPortInfo.hasVendorIdentifier() ? QByteArray::number(serialPortInfo.vendorIdentifier(), 16) : blankString) << endl - << QObject::tr("Product Identifier: ") << (serialPortInfo.hasProductIdentifier() ? QByteArray::number(serialPortInfo.productIdentifier(), 16) : blankString) << endl - << QObject::tr("Busy: ") << (serialPortInfo.isBusy() ? QObject::tr("Yes") : QObject::tr("No")) << endl; + << "Port: " << serialPortInfo.portName() << endl + << "Location: " << serialPortInfo.systemLocation() << endl + << "Description: " << (!description.isEmpty() ? description : blankString) << endl + << "Manufacturer: " << (!manufacturer.isEmpty() ? manufacturer : blankString) << endl + << "Serial number: " << (!serialNumber.isEmpty() ? serialNumber : blankString) << endl + << "Vendor Identifier: " << (serialPortInfo.hasVendorIdentifier() + ? QByteArray::number(serialPortInfo.vendorIdentifier(), 16) + : blankString) << endl + << "Product Identifier: " << (serialPortInfo.hasProductIdentifier() + ? QByteArray::number(serialPortInfo.productIdentifier(), 16) + : blankString) << endl + << "Busy: " << (serialPortInfo.isBusy() ? "Yes" : "No") << endl; } return 0; |