From 78c7501680f29b5a920c3886fa1768cfadf68531 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sun, 15 Feb 2015 00:48:38 +0000 Subject: [PATCH] Add a progress dialog to show that FFT optimization is doing something git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4965 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 36 +++++++++++++++++++++++++++++++++++- mainwindow.h | 3 +++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 32bece4ef..bef5b4fdb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "revision_utils.hpp" #include "soundout.h" @@ -101,10 +102,18 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme m_transmitting {false}, m_tune {false}, m_lastMonitoredFrequency {default_frequency}, - m_toneSpacing {0.} + m_toneSpacing {0.}, + m_firstDecode {0}, + m_optimizingProgress {"Optimizing decoder FFTs for your CPU.\n" + "Please be patient,\n" + "this may take a few minutes", QString {}, 0, 1, this} { ui->setupUi(this); + m_optimizingProgress.setWindowModality (Qt::WindowModal); + m_optimizingProgress.setAutoReset (false); + m_optimizingProgress.setMinimumDuration (15000); // only show after 15s delay + // Closedown. connect (ui->actionExit, &QAction::triggered, this, &QMainWindow::close); @@ -1466,6 +1475,31 @@ void MainWindow::on_EraseButton_clicked() //Erase void MainWindow::decodeBusy(bool b) //decodeBusy() { + bool showProgress = false; + if (b && m_firstDecode < 65 && ("JT65" == m_mode || "JT9+JT65" == m_mode)) + { + m_firstDecode += 65; + if ("JT9+JT65" == m_mode) m_firstDecode = 65 + 9; + showProgress = true; + } + if (b && m_firstDecode != 9 && m_firstDecode != 65 + 9 && ("JT9" == m_mode || "JT9W-1" == m_mode)) + { + m_firstDecode += 9; + showProgress = true; + } + if (showProgress) + { + // this sequence is needed to create an indeterminate progress + // bar + m_optimizingProgress.setRange (0, 1); + m_optimizingProgress.setValue (0); + m_optimizingProgress.setRange (0, 0); + } + if (!b) + { + m_optimizingProgress.reset (); + } + m_decoderBusy=b; ui->DecodeButton->setEnabled(!b); ui->actionOpen->setEnabled(!b); diff --git a/mainwindow.h b/mainwindow.h index f5f0b793a..685d62c77 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "soundin.h" #include "AudioDevice.hpp" @@ -366,6 +367,8 @@ private: bool m_tune; Frequency m_lastMonitoredFrequency; double m_toneSpacing; + int m_firstDecode; + QProgressDialog m_optimizingProgress; //---------------------------------------------------- private functions void readSettings();