mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2939 ProgressInfo: Reintroduce process envents, to update the progress dialog durig processing on linux/mac.
Introduced isActive and used this info to block sheduled redraw/display model regen when progress bar is active, to avoid unintended recursive behaviour resulting in crashes.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <QTreeView>
|
||||
|
||||
#include <set>
|
||||
#include "cafProgressState.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -100,6 +101,12 @@ void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAnd
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType()
|
||||
{
|
||||
if ( caf::ProgressState::isActive() )
|
||||
{
|
||||
startTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
std::set<RimEclipseCase*> uniqueCases(m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end());
|
||||
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <set>
|
||||
#include "cafProgressState.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -59,16 +60,24 @@ void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resV
|
||||
{
|
||||
m_resViewsToUpdate.push_back(resViewToUpdate);
|
||||
|
||||
startTimer(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaViewRedrawScheduler::startTimer(int msecs)
|
||||
{
|
||||
if (!m_resViewUpdateTimer)
|
||||
{
|
||||
m_resViewUpdateTimer = new QTimer(this);
|
||||
connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateScheduledDisplayModels()));
|
||||
connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateAndRedrawScheduledViewsWhenReady()));
|
||||
}
|
||||
|
||||
if (!m_resViewUpdateTimer->isActive())
|
||||
{
|
||||
m_resViewUpdateTimer->setSingleShot(true);
|
||||
m_resViewUpdateTimer->start(0);
|
||||
m_resViewUpdateTimer->start(msecs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +85,7 @@ void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resV
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaViewRedrawScheduler::slotUpdateScheduledDisplayModels()
|
||||
void RiaViewRedrawScheduler::updateAndRedrawScheduledViews()
|
||||
{
|
||||
// Compress to remove duplicates
|
||||
// and update dependent views after independent views
|
||||
@@ -113,6 +122,20 @@ void RiaViewRedrawScheduler::slotUpdateScheduledDisplayModels()
|
||||
m_resViewsToUpdate.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaViewRedrawScheduler::slotUpdateAndRedrawScheduledViewsWhenReady()
|
||||
{
|
||||
if ( caf::ProgressState::isActive() )
|
||||
{
|
||||
startTimer(100);
|
||||
return;
|
||||
}
|
||||
|
||||
updateAndRedrawScheduledViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -33,11 +33,14 @@ public:
|
||||
static RiaViewRedrawScheduler* instance();
|
||||
void scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate);
|
||||
void clearViewsScheduledForUpdate();
|
||||
void updateAndRedrawScheduledViews();
|
||||
|
||||
public slots:
|
||||
void slotUpdateScheduledDisplayModels();
|
||||
private slots:
|
||||
void slotUpdateAndRedrawScheduledViewsWhenReady();
|
||||
|
||||
private:
|
||||
void startTimer(int msecs);
|
||||
|
||||
RiaViewRedrawScheduler() : m_resViewUpdateTimer(nullptr) {}
|
||||
~RiaViewRedrawScheduler();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user