From 024c0eb616327b65bc60e1c4e817eebd95fe7a13 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sat, 4 Oct 2014 14:45:09 +0000 Subject: [PATCH] Do one automatic retry on CAT errors To allow for intermittant CAT failures one retry before bringing up a message box should allow many setups to be more reliable. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4473 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 0c563527e..e279d78ea 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2866,23 +2866,34 @@ void MainWindow::handle_transceiver_failure (QString reason) void MainWindow::rigFailure (QString const& reason, QString const& detail) { - m_rigErrorMessageBox.setText (reason); - m_rigErrorMessageBox.setDetailedText (detail); - - // don't call slot functions directly to avoid recursion - switch (m_rigErrorMessageBox.exec ()) + static bool first_error {true}; + if (first_error) { - case QMessageBox::Ok: - QTimer::singleShot (0, this, SLOT (on_actionSettings_triggered ())); - break; - - case QMessageBox::Retry: + // one automatic retry QTimer::singleShot (0, this, SLOT (rigOpen ())); - break; + first_error = false; + } + else + { + m_rigErrorMessageBox.setText (reason); + m_rigErrorMessageBox.setDetailedText (detail); - case QMessageBox::Cancel: - QTimer::singleShot (0, this, SLOT (close ())); - break; + // don't call slot functions directly to avoid recursion + switch (m_rigErrorMessageBox.exec ()) + { + case QMessageBox::Ok: + QTimer::singleShot (0, this, SLOT (on_actionSettings_triggered ())); + break; + + case QMessageBox::Retry: + QTimer::singleShot (0, this, SLOT (rigOpen ())); + break; + + case QMessageBox::Cancel: + QTimer::singleShot (0, this, SLOT (close ())); + break; + } + first_error = true; // reset } }