mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2026-07-14 22:55:32 +08:00
Replace QString with const QString&
This commit is contained in:
@@ -14,7 +14,7 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent)
|
||||
connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead);
|
||||
}
|
||||
|
||||
void PM3Process::connectPM3(const QString path, const QString port)
|
||||
void PM3Process::connectPM3(const QString& path, const QString& port)
|
||||
{
|
||||
QString result;
|
||||
Util::ClientType clientType = Util::CLIENTTYPE_OFFICIAL;
|
||||
@@ -93,7 +93,6 @@ void PM3Process::testThread()
|
||||
qDebug() << "PM3:" << QThread::currentThread();
|
||||
}
|
||||
|
||||
|
||||
qint64 PM3Process::write(QString data)
|
||||
{
|
||||
return QProcess::write(data.toLatin1());
|
||||
|
||||
+4
-4
@@ -21,8 +21,8 @@ public:
|
||||
void testThread();
|
||||
|
||||
public slots:
|
||||
void connectPM3(const QString path, const QString port);
|
||||
void setSerialListener(const QString &name, bool state);
|
||||
void connectPM3(const QString& path, const QString& port);
|
||||
void setSerialListener(const QString& name, bool state);
|
||||
qint64 write(QString data);
|
||||
private slots:
|
||||
void onTimeout();
|
||||
@@ -34,8 +34,8 @@ private:
|
||||
QTimer* serialListener;
|
||||
QSerialPortInfo* portInfo;
|
||||
signals:
|
||||
void PM3StatedChanged(bool st, QString info = "");
|
||||
void newOutput(QString output);
|
||||
void PM3StatedChanged(bool st, const QString& info = "");
|
||||
void newOutput(const QString& output);
|
||||
void changeClientType(Util::ClientType);
|
||||
};
|
||||
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ Util::Util(QObject *parent) : QObject(parent)
|
||||
qRegisterMetaType<Util::ClientType>("Util::ClientType");
|
||||
}
|
||||
|
||||
void Util::processOutput(QString output)
|
||||
void Util::processOutput(const QString& output)
|
||||
{
|
||||
// qDebug() << "Util::processOutput:" << output;
|
||||
if(isRequiringOutput)
|
||||
@@ -20,14 +20,14 @@ void Util::processOutput(QString output)
|
||||
emit refreshOutput(output);
|
||||
}
|
||||
|
||||
void Util::execCMD(QString cmd)
|
||||
void Util::execCMD(const QString& cmd)
|
||||
{
|
||||
qDebug() << cmd;
|
||||
if(isRunning)
|
||||
emit write(cmd + "\r\n");
|
||||
}
|
||||
|
||||
QString Util::execCMDWithOutput(QString cmd, ReturnTrigger trigger)
|
||||
QString Util::execCMDWithOutput(const QString& cmd, ReturnTrigger trigger)
|
||||
{
|
||||
bool isResultFound = false;
|
||||
QRegularExpression re;
|
||||
|
||||
+6
-6
@@ -30,12 +30,12 @@ public:
|
||||
waitTime = time;
|
||||
expectedOutputs = QStringList();
|
||||
}
|
||||
ReturnTrigger(QStringList outputs)
|
||||
ReturnTrigger(const QStringList& outputs)
|
||||
{
|
||||
waitTime = 10000;
|
||||
expectedOutputs = outputs;
|
||||
}
|
||||
ReturnTrigger(unsigned long time, QStringList outputs)
|
||||
ReturnTrigger(unsigned long time, const QStringList& outputs)
|
||||
{
|
||||
waitTime = time;
|
||||
expectedOutputs = outputs;
|
||||
@@ -46,12 +46,12 @@ public:
|
||||
|
||||
explicit Util(QObject *parent = nullptr);
|
||||
|
||||
void execCMD(QString cmd);
|
||||
QString execCMDWithOutput(QString cmd, ReturnTrigger trigger = 10000);
|
||||
void execCMD(const QString& cmd);
|
||||
QString execCMDWithOutput(const QString& cmd, ReturnTrigger trigger = 10000);
|
||||
void delay(unsigned int msec);
|
||||
ClientType getClientType();
|
||||
public slots:
|
||||
void processOutput(QString output);
|
||||
void processOutput(const QString& output);
|
||||
void setClientType(Util::ClientType clientType);
|
||||
void setRunningState(bool st);
|
||||
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
ClientType clientType;
|
||||
signals:
|
||||
void refreshOutput(const QString& output);
|
||||
void write(QString data);
|
||||
void write(QString data); // connected to PM3Process::write(QString data);
|
||||
};
|
||||
|
||||
#endif // UTIL_H
|
||||
|
||||
Reference in New Issue
Block a user