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
This commit is contained in:
Bill Somerville 2015-02-15 00:48:38 +00:00
parent 71a2f501eb
commit 78c7501680
2 changed files with 38 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#include <QDir> #include <QDir>
#include <QDebug> #include <QDebug>
#include <QtConcurrent/QtConcurrentRun> #include <QtConcurrent/QtConcurrentRun>
#include <QProgressDialog>
#include "revision_utils.hpp" #include "revision_utils.hpp"
#include "soundout.h" #include "soundout.h"
@ -101,10 +102,18 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
m_transmitting {false}, m_transmitting {false},
m_tune {false}, m_tune {false},
m_lastMonitoredFrequency {default_frequency}, 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); ui->setupUi(this);
m_optimizingProgress.setWindowModality (Qt::WindowModal);
m_optimizingProgress.setAutoReset (false);
m_optimizingProgress.setMinimumDuration (15000); // only show after 15s delay
// Closedown. // Closedown.
connect (ui->actionExit, &QAction::triggered, this, &QMainWindow::close); connect (ui->actionExit, &QAction::triggered, this, &QMainWindow::close);
@ -1466,6 +1475,31 @@ void MainWindow::on_EraseButton_clicked() //Erase
void MainWindow::decodeBusy(bool b) //decodeBusy() 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; m_decoderBusy=b;
ui->DecodeButton->setEnabled(!b); ui->DecodeButton->setEnabled(!b);
ui->actionOpen->setEnabled(!b); ui->actionOpen->setEnabled(!b);

View File

@ -13,6 +13,7 @@
#include <QAudioDeviceInfo> #include <QAudioDeviceInfo>
#include <QScopedPointer> #include <QScopedPointer>
#include <QDir> #include <QDir>
#include <QProgressDialog>
#include "soundin.h" #include "soundin.h"
#include "AudioDevice.hpp" #include "AudioDevice.hpp"
@ -366,6 +367,8 @@ private:
bool m_tune; bool m_tune;
Frequency m_lastMonitoredFrequency; Frequency m_lastMonitoredFrequency;
double m_toneSpacing; double m_toneSpacing;
int m_firstDecode;
QProgressDialog m_optimizingProgress;
//---------------------------------------------------- private functions //---------------------------------------------------- private functions
void readSettings(); void readSettings();