#include "mainwindow.h" #include "MessageBox.hpp" #include #include #include #include #include void MainWindow::showSoundInError(const QString& errorMsg) { if (m_splash && m_splash->isVisible ()) m_splash->hide (); MessageBox::critical_message (this, tr ("Error in Sound Input"), errorMsg); } void MainWindow::showSoundOutError(const QString& errorMsg) { noteTxStopReason (TxEvidence::TxStopReason::Error); if (m_jttyTxLifecycle.active () || !m_jttyTransmitQueue.empty ()) { stopTx (); m_jttyQueueNotice = errorMsg; updateJttySendButton (); } if (m_splash && m_splash->isVisible ()) m_splash->hide (); MessageBox::critical_message (this, tr ("Error in Sound Output"), errorMsg); } void MainWindow::showStatusMessage(const QString& statusMsg) { statusBar()->showMessage(statusMsg, 5000); } bool MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::ExitStatus status) { if (m_valid && (exit_code || QProcess::NormalExit != status)) { QStringList arguments; for (auto argument: process->arguments ()) { if (argument.contains (' ')) argument = '"' + argument + '"'; arguments << argument; } if (m_splash && m_splash->isVisible ()) m_splash->hide (); MessageBox::critical_message (this, tr ("Subprocess Error") , tr ("Subprocess failed with exit code %1") .arg (exit_code) , tr ("Running: %1\n%2") .arg (process->program () + ' ' + arguments.join (' ')) .arg (QString {process->readAllStandardError()})); return true; } return false; } void MainWindow::subProcessError (QProcess * process, QProcess::ProcessError) { if (m_valid) { QStringList arguments; for (auto argument: process->arguments ()) { if (argument.contains (' ')) argument = '"' + argument + '"'; arguments << argument; } if (m_splash && m_splash->isVisible ()) m_splash->hide (); MessageBox::critical_message (this, tr ("Subprocess error") , tr ("Running: %1\n%2") .arg (process->program () + ' ' + arguments.join (' ')) .arg (process->errorString ())); m_valid = false; // ensures exit if still constructing QTimer::singleShot (0, this, SLOT (close ())); } }