[education/rkward] rkward: Remove deprecate QTime::elapsed()

Thomas Friedrichsmeier null at kde.org
Wed Mar 30 21:48:39 BST 2022


Git commit cdda04f4be2eaaaaa1cd5b5f7ab3e29e32f55f10 by Thomas Friedrichsmeier.
Committed on 30/03/2022 at 20:48.
Pushed by tfry into branch 'master'.

Remove deprecate QTime::elapsed()

M  +5    -5    rkward/agents/rkprintagent.cpp
M  +4    -4    rkward/plugin/rkcomponentmap.cpp
M  +4    -4    rkward/rbackend/rkfrontendtransmitter.cpp
M  +4    -3    rkward/rbackend/rkrinterface.cpp

https://invent.kde.org/education/rkward/commit/cdda04f4be2eaaaaa1cd5b5f7ab3e29e32f55f10

diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index 41f6e4d4..c6021440 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -19,7 +19,7 @@
 
 #include <QFile>
 #include <QTimer>
-#include <QDateTime>
+#include <QElapsedTimer>
 
 #include <krun.h>
 #include <kservice.h>
@@ -87,10 +87,10 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 	agent->provider = provider;
 
 	// very hacky heuristic to try to find out, whether the print action is synchronous or asynchronous. If the latter, delete after half an hour. If the former delete after printing.
-	QTime ts;
-	ts.start ();
-	printaction->trigger ();
-	if (ts.elapsed () < 5000) {
+	QElapsedTimer ts;
+	ts.start();
+	printaction->trigger();
+	if (ts.elapsed() < 5000) {
 		QTimer::singleShot (1800000, agent, SLOT (deleteLater()));
 	} else {
 		agent->deleteLater ();
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index ad674e9b..73a80f07 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -19,7 +19,7 @@
 
 #include <qfileinfo.h>
 #include <qdir.h>
-#include <QTime>
+#include <QElapsedTimer>
 #include <QObjectCleanupHandler>
 #include <QSet>
 #include <QGuiApplication>
@@ -499,10 +499,10 @@ bool RKComponentMap::invokeComponent (const QString &component_id, const QString
 	// if the plugin takes longer than 5 seconds to settle, than that really is sort of buggy...
 	const int max_wait = 5000;
 
-	QTime t;
-	t.start ();
+	QElapsedTimer t;
+	t.start();
 	RKComponentBase::ComponentStatus status;
-	while ((!chandler.isEmpty ()) && ((status = component->recursiveStatus ()) == RKComponentBase::Processing) && (t.elapsed () < max_wait)) {
+	while ((!chandler.isEmpty()) && ((status = component->recursiveStatus()) == RKComponentBase::Processing) && (t.elapsed() < max_wait)) {
 		QCoreApplication::processEvents (QEventLoop::ExcludeUserInputEvents, (max_wait / 2));
 	}
 	if (chandler.isEmpty ()) status = RKComponentBase::Dead;
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index 98d0b431..c26c03b8 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -32,7 +32,7 @@
 #include <QLocalSocket>
 #include <QDir>
 #include <QStandardPaths>
-#include <QTime>
+#include <QElapsedTimer>
 
 #include "../version.h"
 #include "../debug.h"
@@ -164,9 +164,9 @@ void RKFrontendTransmitter::waitForCanReadLine (QIODevice* con, int msecs) {
 
 	// NOTE: On Qt5+Windows, readyReady may actually come in char by char, so calling waitForReadyRead() does not guarantee we will
 	//       see the full line, at all. But also, of course, we want to put some cap on trying. Using a time threshold for this.
-	QTime time;
-	time.start ();
-	while ((!con->canReadLine ()) && (time.elapsed () < msecs)) con->waitForReadyRead (500);
+	QElapsedTimer time;
+	time.start();
+	while ((!con->canReadLine()) && (time.elapsed() < msecs)) con->waitForReadyRead(500);
 }
 
 void RKFrontendTransmitter::connectAndEnterLoop () {
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index 052c2f86..cb28b92d 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -63,6 +63,7 @@
 #include <QFileDialog>
 #include <QApplication>
 #include <QPushButton>
+#include <QElapsedTimer>
 
 // flush new pieces of output after this period of time:
 #define FLUSH_INTERVAL 100
@@ -256,9 +257,9 @@ void RInterface::doNextCommand (RCommand *command) {
 	// importantly, this point is not reached for the fake startup command
 
 	if (RK_Debug::RK_Debug_CommandStep) {
-		QTime t;
-		t.start ();
-		while (t.elapsed () < RK_Debug::RK_Debug_CommandStep) {}
+		QElapsedTimer t;
+		t.start();
+		while (t.elapsed() < RK_Debug::RK_Debug_CommandStep) {}
 	}
 
 	flushOutput (true);


More information about the rkward-tracker mailing list