feat: install only not wait

This commit is contained in:
Barry 2022-06-15 07:48:09 +08:00
commit 0af13110eb
2 changed files with 7 additions and 3 deletions

View file

@ -59,10 +59,10 @@ void AudioOutput::stop()
void AudioOutput::installonly(const QString &serial, int port) void AudioOutput::installonly(const QString &serial, int port)
{ {
runSndcpyProcess(serial, port); runSndcpyProcess(serial, port, false);
} }
bool AudioOutput::runSndcpyProcess(const QString &serial, int port) bool AudioOutput::runSndcpyProcess(const QString &serial, int port, bool wait)
{ {
if (QProcess::NotRunning != m_sndcpy.state()) { if (QProcess::NotRunning != m_sndcpy.state()) {
m_sndcpy.kill(); m_sndcpy.kill();
@ -81,6 +81,10 @@ bool AudioOutput::runSndcpyProcess(const QString &serial, int port)
m_sndcpy.start("bash", params); m_sndcpy.start("bash", params);
#endif #endif
if (!wait) {
return true;
}
if (!m_sndcpy.waitForStarted()) { if (!m_sndcpy.waitForStarted()) {
qWarning() << "AudioOutput::start sndcpy.bat failed"; qWarning() << "AudioOutput::start sndcpy.bat failed";
return false; return false;

View file

@ -20,7 +20,7 @@ public:
void installonly(const QString& serial, int port); void installonly(const QString& serial, int port);
private: private:
bool runSndcpyProcess(const QString& serial, int port); bool runSndcpyProcess(const QString& serial, int port, bool wait = true);
void startAudioOutput(); void startAudioOutput();
void stopAudioOutput(); void stopAudioOutput();
void startRecvData(int port); void startRecvData(int port);