diff --git a/src/GProgressDialog.cpp b/src/GProgressDialog.cpp index 75762a16b..c0bd10951 100644 --- a/src/GProgressDialog.cpp +++ b/src/GProgressDialog.cpp @@ -18,16 +18,16 @@ #include "GProgressDialog.h" -GProgressDialog::GProgressDialog(QString title, int min, int max, QWidget *parent) : +GProgressDialog::GProgressDialog(QString title, int min, int max, bool modal, QWidget *parent) : // sheet on mac and no window manager chrome - QDialog(parent, Qt::Sheet | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint), + QDialog(modal ? parent : NULL, Qt::Sheet | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint), // defaults title(title), min(min), max(max) { // only block mainwindow - setWindowModality(Qt::WindowModal); // only block mainwindow + if (modal) setWindowModality(Qt::WindowModal); // only block mainwindow // zap me when closed and make me see through setAttribute(Qt::WA_DeleteOnClose, true); diff --git a/src/GProgressDialog.h b/src/GProgressDialog.h index 6de412aaf..458abad55 100644 --- a/src/GProgressDialog.h +++ b/src/GProgressDialog.h @@ -35,7 +35,7 @@ class GProgressDialog : public QDialog public: // no frame, translucent, no button, no parent - always modal with chrome heading - GProgressDialog(QString title, int min, int max, QWidget *parent = NULL); + GProgressDialog(QString title, int min, int max, bool modal, QWidget *parent = NULL); // set value, which in turn repaints the progress at the bottom void setValue(int x); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index cbe00af7b..a19e67cf8 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -109,6 +109,7 @@ MainWindow::MainWindow(const QDir &home) *--------------------------------------------------------------------*/ setAttribute(Qt::WA_DeleteOnClose); mainwindows.append(this); // add us to the list of open windows + init = false; #ifdef Q_OS_MAC head = NULL; // early resize event causes a crash #endif @@ -713,6 +714,8 @@ MainWindow::MainWindow(const QDir &home) // catch config changes connect(context, SIGNAL(configChanged()), this, SLOT(configChanged())); configChanged(); + + init = true; } /*---------------------------------------------------------------------- diff --git a/src/MainWindow.h b/src/MainWindow.h index ddf8350a3..3341c8465 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -66,6 +66,7 @@ class MainWindow : public QMainWindow ~MainWindow(); // temp to zap db - will move to tab // void byebye() { close(); } // go bye bye for a restart + bool init; // if constructor has completed set to true protected: diff --git a/src/MetricAggregator.cpp b/src/MetricAggregator.cpp index cc23b75c9..8d10946f5 100644 --- a/src/MetricAggregator.cpp +++ b/src/MetricAggregator.cpp @@ -165,7 +165,7 @@ void MetricAggregator::refreshMetrics(QDateTime forceAfterThisDate) // create the dialog if we need to show progress for long running uodate long elapsedtime = elapsed.elapsed(); if ((!forceAfterThisDate.isNull() || first || elapsedtime > 6000) && bar == NULL) { - bar = new GProgressDialog(title, 0, filenames.count()); // not owned by mainwindow + bar = new GProgressDialog(title, 0, filenames.count(), context->mainWindow->init, context->mainWindow); bar->show(); // lets hide until elapsed time is > 6 seconds // lets make sure it goes to the center! @@ -516,7 +516,8 @@ MetricAggregator::refreshCPModelMetrics(bool bg) // progress for the model parameters GProgressDialog *bar = NULL; if (!bg) { - bar = new GProgressDialog(tr("Update Model Estimates"), 1, (lastYear*12 + lastMonth) - (year*12 + month)); + bar = new GProgressDialog(tr("Update Model Estimates"), 1, (lastYear*12 + lastMonth) - (year*12 + month), + context->mainWindow->init, context->mainWindow); bar->setValue(1); bar->show(); // lets hide until elapsed time is > 6 seconds QApplication::processEvents();