diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-17 21:07:35 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-23 18:49:12 +0000 |
commit | 5eab68bbee6c9633f0702c87c05e119ec4d910e0 (patch) | |
tree | 6c22d32d45ef32b20a65206dd01591618330f12b | |
parent | 7bebdb472a396bad05c9448e7b5d86fceb0fbe33 (diff) |
QProcess: mark obsolete functions as deprecated
QProcess::finished(int)/readChannelMode()/setReadChannelMode() are
obsolete but were not marked as deprecated.
Explicit mark them as deprecated so they can be removed with Qt6.
Change-Id: Iedbfd80a3c987f35caf93181e9277913a18961d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r-- | src/corelib/io/qprocess.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qprocess.h | 7 | ||||
-rw-r--r-- | tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 18 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp | 2 |
4 files changed, 25 insertions, 12 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index e1f4a3a311..83849980ae 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -813,6 +813,7 @@ void QProcessPrivate::Channel::clear() \a newState argument is the state QProcess changed to. */ +#if QT_DEPRECATED_SINCE(5, 13) /*! \fn void QProcess::finished(int exitCode) \obsolete @@ -820,6 +821,7 @@ void QProcessPrivate::Channel::clear() Use finished(int exitCode, QProcess::ExitStatus status) instead. */ +#endif /*! \fn void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus) @@ -1172,7 +1174,9 @@ bool QProcessPrivate::_q_processDied() //emit q->standardOutputClosed(); //emit q->standardErrorClosed(); +#if QT_DEPRECATED_SINCE(5, 13) emit q->finished(exitCode); +#endif emit q->finished(exitCode, exitStatus); } #if defined QPROCESS_DEBUG @@ -1264,6 +1268,7 @@ QProcess::~QProcess() d->cleanup(); } +#if QT_DEPRECATED_SINCE(5, 13) /*! \obsolete Returns the read channel mode of the QProcess. This function is @@ -1287,6 +1292,7 @@ void QProcess::setReadChannelMode(ProcessChannelMode mode) { setProcessChannelMode(mode); } +#endif /*! \since 4.2 @@ -2473,7 +2479,7 @@ QProcess::ExitStatus QProcess::exitStatus() const int QProcess::execute(const QString &program, const QStringList &arguments) { QProcess process; - process.setReadChannelMode(ForwardedChannels); + process.setProcessChannelMode(ForwardedChannels); process.start(program, arguments); if (!process.waitForFinished(-1) || process.error() == FailedToStart) return -2; @@ -2496,7 +2502,7 @@ int QProcess::execute(const QString &program, const QStringList &arguments) int QProcess::execute(const QString &command) { QProcess process; - process.setReadChannelMode(ForwardedChannels); + process.setProcessChannelMode(ForwardedChannels); process.start(command); if (!process.waitForFinished(-1) || process.error() == FailedToStart) return -2; diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index 5e022e3a52..42cf769698 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -172,8 +172,12 @@ public: QStringList arguments() const; void setArguments(const QStringList & arguments); +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X("Use QProcess::processChannelMode() instead") ProcessChannelMode readChannelMode() const; + QT_DEPRECATED_X("Use QProcess::setProcessChannelMode() instead") void setReadChannelMode(ProcessChannelMode mode); +#endif ProcessChannelMode processChannelMode() const; void setProcessChannelMode(ProcessChannelMode mode); InputChannelMode inputChannelMode() const; @@ -269,7 +273,10 @@ public Q_SLOTS: Q_SIGNALS: void started(QPrivateSignal); +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X("Use QProcess::finished(int, QProcess::ExitStatus) instead") void finished(int exitCode); // ### Qt 6: merge the two signals with a default value +#endif void finished(int exitCode, QProcess::ExitStatus exitStatus); #if QT_DEPRECATED_SINCE(5,6) void error(QProcess::ProcessError error); diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e0aa577154..c51994c1c1 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -185,12 +185,12 @@ void tst_QProcess::getSetCheck() { QProcess obj1; // ProcessChannelMode QProcess::readChannelMode() - // void QProcess::setReadChannelMode(ProcessChannelMode) - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels)); + // void QProcess::setProcessChannelMode(ProcessChannelMode) + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::SeparateChannels), obj1.readChannelMode()); - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels)); + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::MergedChannels), obj1.readChannelMode()); - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels)); + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::ForwardedChannels), obj1.readChannelMode()); // ProcessChannel QProcess::readChannel() @@ -913,7 +913,7 @@ public: switch (n) { case 0: - setReadChannelMode(QProcess::MergedChannels); + setProcessChannelMode(QProcess::MergedChannels); connect(this, &QIODevice::readyRead, this, &SoftExitProcess::terminateSlot); break; case 1: @@ -929,7 +929,7 @@ public: this, &SoftExitProcess::terminateSlot); break; case 4: - setReadChannelMode(QProcess::MergedChannels); + setProcessChannelMode(QProcess::MergedChannels); connect(this, SIGNAL(channelReadyRead(int)), this, SLOT(terminateSlot())); break; default: @@ -1025,7 +1025,7 @@ void tst_QProcess::softExitInSlots() void tst_QProcess::mergedChannels() { QProcess process; - process.setReadChannelMode(QProcess::MergedChannels); + process.setProcessChannelMode(QProcess::MergedChannels); QCOMPARE(process.readChannelMode(), QProcess::MergedChannels); process.start("testProcessEcho2/testProcessEcho2"); @@ -1951,7 +1951,7 @@ void tst_QProcess::setStandardOutputFile() // run the process QProcess process; - process.setReadChannelMode(channelMode); + process.setProcessChannelMode(channelMode); if (channelToTest == QProcess::StandardOutput) process.setStandardOutputFile(file.fileName(), mode); else @@ -2037,7 +2037,7 @@ void tst_QProcess::setStandardOutputProcess() QFETCH(bool, merged); QFETCH(bool, waitForBytesWritten); - source.setReadChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels); + source.setProcessChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels); source.setStandardOutputProcess(&sink); source.start("testProcessEcho2/testProcessEcho2"); diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 993ebbaac6..bff9f7d0e0 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -215,7 +215,7 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt { #if QT_CONFIG(process) QProcess process; - process.setReadChannelMode(QProcess::ForwardedChannels); + process.setProcessChannelMode(QProcess::ForwardedChannels); process.start(program, arguments); if (!process.waitForStarted()) { *errorMessage = "Unable to start '" + program.toLocal8Bit() + " ': " |