From 0634e530b6549b1d907b50fcf2a8f3bf114e535e Mon Sep 17 00:00:00 2001 From: wh201906 Date: Sun, 4 Jun 2023 00:57:09 +0800 Subject: [PATCH] Use QString::contains() --- src/common/pm3process.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/pm3process.cpp b/src/common/pm3process.cpp index d73fac3..76c13b8 100644 --- a/src/common/pm3process.cpp +++ b/src/common/pm3process.cpp @@ -35,7 +35,7 @@ void PM3Process::connectPM3(const QString& path, const QStringList args) waitForReadyRead(10000); setRequiringOutput(false); result = *requiredOutput; - if(result.indexOf("[=]") != -1) + if(result.contains("[=]")) { clientType = Util::CLIENTTYPE_ICEMAN; setRequiringOutput(true); @@ -44,7 +44,7 @@ void PM3Process::connectPM3(const QString& path, const QStringList args) { waitForReadyRead(200); result += *requiredOutput; - if(result.indexOf("os: ") != -1) + if(result.contains("os: ")) break; } setRequiringOutput(false); @@ -53,7 +53,7 @@ void PM3Process::connectPM3(const QString& path, const QStringList args) { clientType = Util::CLIENTTYPE_OFFICIAL; } - if(result.indexOf("os: ") != -1) // make sure the PM3 is connected + if(result.contains("os: ")) // make sure the PM3 is connected { emit changeClientType(clientType); result = result.mid(result.indexOf("os: "));