diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2015-07-08 18:26:08 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2015-07-09 14:14:48 +0000 |
commit | a2758cf594dd08a21037873f64f72166a353aa29 (patch) | |
tree | 784f662913f439570e0ea74bc4e6e88322f8e6dc /src/serialport/qserialport.cpp | |
parent | 8919ea86c80001be7e826f5363f1b7548c7a8091 (diff) | |
download | qtserialport-a2758cf594dd08a21037873f64f72166a353aa29.tar.gz |
Give custom descriptions to errors which had none before
Change-Id: Ic083cbd58e4e775ede0cdf610f61407003834207
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/serialport/qserialport.cpp')
-rw-r--r-- | src/serialport/qserialport.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index b6c4252..b56b3da 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -521,14 +521,14 @@ bool QSerialPort::open(OpenMode mode) Q_D(QSerialPort); if (isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::OpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::OpenError, tr("Device is already open"))); return false; } // Define while not supported modes. static const OpenMode unsupportedModes = Append | Truncate | Text | Unbuffered; if ((mode & unsupportedModes) || mode == NotOpen) { - d->setError(QSerialPortErrorInfo(QSerialPort::UnsupportedOperationError)); + d->setError(QSerialPortErrorInfo(QSerialPort::UnsupportedOperationError, tr("Unsupported open mode"))); return false; } @@ -561,7 +561,7 @@ void QSerialPort::close() { Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); return; } @@ -871,7 +871,7 @@ bool QSerialPort::setDataTerminalReady(bool set) Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return false; } @@ -918,7 +918,7 @@ bool QSerialPort::setRequestToSend(bool set) Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return false; } @@ -968,7 +968,7 @@ QSerialPort::PinoutSignals QSerialPort::pinoutSignals() Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return QSerialPort::NoSignal; } @@ -998,7 +998,7 @@ bool QSerialPort::flush() Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return false; } @@ -1020,7 +1020,7 @@ bool QSerialPort::clear(Directions directions) Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return false; } @@ -1082,7 +1082,7 @@ bool QSerialPort::setDataErrorPolicy(DataErrorPolicy policy) Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return false; } @@ -1304,7 +1304,7 @@ bool QSerialPort::sendBreak(int duration) Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return false; } @@ -1333,7 +1333,7 @@ bool QSerialPort::setBreakEnabled(bool set) Q_D(QSerialPort); if (!isOpen()) { - d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError)); + d->setError(QSerialPortErrorInfo(QSerialPort::NotOpenError, tr("Device is not open"))); qWarning("%s: device not open", Q_FUNC_INFO); return false; } |