mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add ProgressInfoBlocker and add to unit tests
This commit is contained in:
@@ -348,18 +348,6 @@ namespace caf {
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
static bool isUpdatePossible()
|
||||
{
|
||||
if (!qApp) return false;
|
||||
|
||||
if (!progressDialog()) return false;
|
||||
|
||||
return progressDialog()->thread() == QThread::currentThread();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -440,6 +428,23 @@ namespace caf {
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// \class caf::ProgressInfoBlocker
|
||||
///
|
||||
/// Used to disable progress info on a temporary basis
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
ProgressInfoBlocker::ProgressInfoBlocker()
|
||||
{
|
||||
ProgressInfoStatic::s_disabled = true;
|
||||
}
|
||||
|
||||
ProgressInfoBlocker::~ProgressInfoBlocker()
|
||||
{
|
||||
ProgressInfoStatic::s_disabled = false;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -449,6 +454,7 @@ namespace caf {
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
bool ProgressInfoStatic::s_disabled = false;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -491,7 +497,6 @@ namespace caf {
|
||||
//if (progressDialog()) progressDialog()->repaint();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -636,4 +641,19 @@ namespace caf {
|
||||
//if (progressDialog()) progressDialog()->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool ProgressInfoStatic::isUpdatePossible()
|
||||
{
|
||||
if (s_disabled) return false;
|
||||
|
||||
if (!qApp) return false;
|
||||
|
||||
if (!progressDialog()) return false;
|
||||
|
||||
return progressDialog()->thread() == QThread::currentThread();
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
Reference in New Issue
Block a user