Add feedback of failing to start the client

plus, make setRequiringOutput() matched in PM3Process::connectPM3()
master
wh201906 2 years ago
parent ef9972d24a
commit da2f6ead6e
No known key found for this signature in database

@ -13,6 +13,8 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent)
connect(serialListener, &QTimer::timeout, this, &PM3Process::onTimeout); connect(serialListener, &QTimer::timeout, this, &PM3Process::onTimeout);
connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead); connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead);
portInfo = nullptr; portInfo = nullptr;
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
} }
void PM3Process::connectPM3(const QString& path, const QStringList args) void PM3Process::connectPM3(const QString& path, const QStringList args)
@ -61,6 +63,8 @@ void PM3Process::connectPM3(const QString& path, const QStringList args)
else else
kill(); kill();
} }
setRequiringOutput(false);
} }
void PM3Process::reconnectPM3() void PM3Process::reconnectPM3()

@ -195,6 +195,14 @@ void MainWindow::on_PM3_connectButton_clicked()
envSetProcess.kill(); envSetProcess.kill();
} }
void MainWindow::onPM3ErrorOccurred(QProcess::ProcessError error)
{
qDebug() << "PM3 Error:" << error << pm3->errorString();
if(error == QProcess::FailedToStart)
QMessageBox::information(this, tr("Info"), tr("Failed to start the client"));
}
void MainWindow::onPM3StateChanged(bool st, const QString& info) void MainWindow::onPM3StateChanged(bool st, const QString& info)
{ {
pm3state = st; pm3state = st;
@ -1093,6 +1101,7 @@ void MainWindow::signalInit()
connect(this, &MainWindow::reconnectPM3, pm3, &PM3Process::reconnectPM3); connect(this, &MainWindow::reconnectPM3, pm3, &PM3Process::reconnectPM3);
connect(pm3, &PM3Process::PM3StatedChanged, this, &MainWindow::onPM3StateChanged); connect(pm3, &PM3Process::PM3StatedChanged, this, &MainWindow::onPM3StateChanged);
connect(pm3, &PM3Process::PM3StatedChanged, util, &Util::setRunningState); connect(pm3, &PM3Process::PM3StatedChanged, util, &Util::setRunningState);
connect(pm3, &PM3Process::errorOccurred, this, &MainWindow::onPM3ErrorOccurred);
connect(this, &MainWindow::killPM3, pm3, &PM3Process::killPM3); connect(this, &MainWindow::killPM3, pm3, &PM3Process::killPM3);
connect(this, &MainWindow::setProcEnv, pm3, &PM3Process::setProcEnv); connect(this, &MainWindow::setProcEnv, pm3, &PM3Process::setProcEnv);
connect(this, &MainWindow::setWorkingDir, pm3, &PM3Process::setWorkingDir); connect(this, &MainWindow::setWorkingDir, pm3, &PM3Process::setWorkingDir);

@ -60,6 +60,7 @@ public slots:
void MF_onMFCardTypeChanged(int id, bool st); void MF_onMFCardTypeChanged(int id, bool st);
void on_Raw_keyPressed(QObject *obj_addr, QEvent &event); void on_Raw_keyPressed(QObject *obj_addr, QEvent &event);
void on_MF_keyWidget_resized(QObject *obj_addr, QEvent &event); void on_MF_keyWidget_resized(QObject *obj_addr, QEvent &event);
void onPM3ErrorOccurred(QProcess::ProcessError error);
private slots: private slots:
void on_PM3_connectButton_clicked(); void on_PM3_connectButton_clicked();

Loading…
Cancel
Save