diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-09-16 15:29:27 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-09-16 15:29:27 +0200 |
commit | ef8ed357881b212e2debe2ccf975996bca2331c2 (patch) | |
tree | 67cb9ee9821bd1fb9b9813b038ffbc06a7847ddd /src | |
parent | b111a3a6fb4b6c2892fe3b1c9cdf72d8e8f9ea8d (diff) | |
parent | f1761c1236edce428278f7a9e8aa1091097eaa57 (diff) | |
download | qtserialport-ef8ed357881b212e2debe2ccf975996bca2331c2.tar.gz |
Merge remote-tracking branch 'origin/5.3' into 5.4
Conflicts:
.qmake.conf
Change-Id: I5887622f233275703cca8cc2a5db4aaaccc72d97
Diffstat (limited to 'src')
-rw-r--r-- | src/serialport/qserialport.cpp | 9 | ||||
-rw-r--r-- | src/serialport/qserialport.h | 3 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 19 | ||||
-rw-r--r-- | src/serialport/qserialport_win_p.h | 2 |
4 files changed, 19 insertions, 14 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 2e1bac5..297bf62 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -71,7 +71,9 @@ QSerialPortPrivateData::QSerialPortPrivateData(QSerialPort *q) , policy(QSerialPort::IgnorePolicy) , dataTerminalReady(false) , requestToSend(false) +#if QT_DEPRECATED_SINCE(5,3) , settingsRestoredOnClose(true) +#endif , q_ptr(q) { } @@ -572,6 +574,7 @@ void QSerialPort::close() The default state of the QSerialPort class is to restore the settings. */ +#if QT_DEPRECATED_SINCE(5,3) void QSerialPort::setSettingsRestoredOnClose(bool restore) { Q_D(QSerialPort); @@ -587,9 +590,10 @@ bool QSerialPort::settingsRestoredOnClose() const Q_D(const QSerialPort); return d->settingsRestoredOnClose; } - +#endif // QT_DEPRECATED_SINCE(5,3) /*! \fn void QSerialPort::settingsRestoredOnCloseChanged(bool restore) + \obsolete This signal is emitted after the flag which specifies to restore the previous settings while closing the serial port has been changed. The new @@ -1069,6 +1073,7 @@ bool QSerialPort::atEnd() const with the kernel and hardware. Hence, the two scenarios cannot be completely compared to each other. */ +#if QT_DEPRECATED_SINCE(5, 2) bool QSerialPort::setDataErrorPolicy(DataErrorPolicy policy) { Q_D(QSerialPort); @@ -1093,7 +1098,7 @@ QSerialPort::DataErrorPolicy QSerialPort::dataErrorPolicy() const Q_D(const QSerialPort); return d->policy; } - +#endif // QT_DEPRECATED_SINCE(5, 2) /*! \fn void QSerialPort::dataErrorPolicyChanged(DataErrorPolicy policy) \obsolete diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h index f114fd4..a8f9a05 100644 --- a/src/serialport/qserialport.h +++ b/src/serialport/qserialport.h @@ -255,9 +255,7 @@ Q_SIGNALS: void parityChanged(QSerialPort::Parity parity); void stopBitsChanged(QSerialPort::StopBits stopBits); void flowControlChanged(QSerialPort::FlowControl flowControl); -#if QT_DEPRECATED_SINCE(5, 2) void dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy); -#endif void dataTerminalReadyChanged(bool set); void requestToSendChanged(bool set); void error(QSerialPort::SerialPortError serialPortError); @@ -279,6 +277,7 @@ private: Q_PRIVATE_SLOT(d_func(), bool _q_completeAsyncCommunication()) Q_PRIVATE_SLOT(d_func(), bool _q_completeAsyncRead()) Q_PRIVATE_SLOT(d_func(), bool _q_completeAsyncWrite()) + Q_PRIVATE_SLOT(d_func(), bool _q_startAsyncWrite()) #endif }; diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 9daa728..32b8d0a 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -251,7 +251,7 @@ bool QSerialPortPrivate::setRequestToSend(bool set) bool QSerialPortPrivate::flush() { - return startAsyncWrite(); + return _q_startAsyncWrite(); } bool QSerialPortPrivate::clear(QSerialPort::Directions directions) @@ -305,7 +305,7 @@ void QSerialPortPrivate::startWriting() if (!writeStarted) { if (!startAsyncWriteTimer) { startAsyncWriteTimer = new QTimer(q); - q->connect(startAsyncWriteTimer, SIGNAL(timeout()), q, SLOT(_q_completeAsyncWrite())); + q->connect(startAsyncWriteTimer, SIGNAL(timeout()), q, SLOT(_q_startAsyncWrite())); startAsyncWriteTimer->setSingleShot(true); } startAsyncWriteTimer->start(0); @@ -319,7 +319,7 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) QElapsedTimer stopWatch; stopWatch.start(); - if (!writeStarted && !startAsyncWrite()) + if (!writeStarted && !_q_startAsyncWrite()) return false; const qint64 initialReadBufferSize = readBuffer.size(); @@ -373,7 +373,7 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) QElapsedTimer stopWatch; stopWatch.start(); - if (!writeStarted && !startAsyncWrite()) + if (!writeStarted && !_q_startAsyncWrite()) return false; forever { @@ -535,17 +535,18 @@ bool QSerialPortPrivate::_q_completeAsyncWrite() Q_Q(QSerialPort); if (writeStarted) { - writeStarted = false; const qint64 bytesTransferred = handleOverlappedResult(QSerialPort::Output, writeCompletionOverlapped); - if (bytesTransferred == qint64(-1)) + if (bytesTransferred == qint64(-1)) { + writeStarted = false; return false; - if (bytesTransferred > 0) { + } else if (bytesTransferred > 0) { writeBuffer.free(bytesTransferred); emit q->bytesWritten(bytesTransferred); } + writeStarted = false; } - return startAsyncWrite(); + return _q_startAsyncWrite(); } bool QSerialPortPrivate::startAsyncCommunication() @@ -597,7 +598,7 @@ bool QSerialPortPrivate::startAsyncRead() return true; } -bool QSerialPortPrivate::startAsyncWrite() +bool QSerialPortPrivate::_q_startAsyncWrite() { Q_Q(QSerialPort); diff --git a/src/serialport/qserialport_win_p.h b/src/serialport/qserialport_win_p.h index 7ec7a2e..93f8591 100644 --- a/src/serialport/qserialport_win_p.h +++ b/src/serialport/qserialport_win_p.h @@ -100,7 +100,7 @@ public: bool startAsyncCommunication(); bool startAsyncRead(); - bool startAsyncWrite(); + bool _q_startAsyncWrite(); bool emulateErrorPolicy(); void emitReadyRead(); |