mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Create a simpler task system for handling sub tasks in progress dialog.
* Remove incrementProgressAndUpdateNextStep() method
This commit is contained in:
parent
674758fbf6
commit
749e19a879
@ -102,29 +102,42 @@ void RicNewWellBoreStabilityPlotFeature::onActionTriggered(bool isChecked)
|
||||
if (!geoMechView) return;
|
||||
|
||||
caf::ProgressInfo progInfo(100, "Creating Well Bore Stability Plot");
|
||||
progInfo.setProgressDescription("Creating plot and formation track");
|
||||
progInfo.setNextProgressIncrement(2);
|
||||
|
||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(false, "Well Bore Stability");
|
||||
|
||||
QString plotName("Well Bore Stability");
|
||||
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(false, plotName);
|
||||
createFormationTrack(plot, wellPath, geoMechCase);
|
||||
progInfo.incrementProgressAndUpdateNextStep(3, "Creating well design track");
|
||||
createCasingShoeTrack(plot, wellPath, geoMechCase);
|
||||
progInfo.incrementProgressAndUpdateNextStep(75, "Creating stability curves track");
|
||||
createStabilityCurvesTrack(plot, wellPath, geoMechView);
|
||||
progInfo.incrementProgressAndUpdateNextStep(15, "Creating angles track");
|
||||
createAnglesTrack(plot, wellPath, geoMechView);
|
||||
progInfo.incrementProgressAndUpdateNextStep(5, "Updating all tracks");
|
||||
plot->enableAllAutoNameTags(true);
|
||||
plot->setPlotTitleVisible(true);
|
||||
plot->setTrackLegendsVisible(true);
|
||||
plot->setTrackLegendsHorizontal(true);
|
||||
plot->setDepthType(RimWellLogPlot::TRUE_VERTICAL_DEPTH);
|
||||
plot->setDepthAutoZoom(true);
|
||||
{
|
||||
auto task = progInfo.task("Creating formation track", 2);
|
||||
createFormationTrack(plot, wellPath, geoMechCase);
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task("Creating well design track", 3);
|
||||
createCasingShoeTrack(plot, wellPath, geoMechCase);
|
||||
}
|
||||
|
||||
RicNewWellLogPlotFeatureImpl::updateAfterCreation(plot);
|
||||
progInfo.incrementProgress();
|
||||
{
|
||||
auto task = progInfo.task("Creating stability curves track", 75);
|
||||
createStabilityCurvesTrack(plot, wellPath, geoMechView);
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task("Creating angles track", 15);
|
||||
createAnglesTrack(plot, wellPath, geoMechView);
|
||||
}
|
||||
|
||||
{
|
||||
auto task = progInfo.task("Updating all tracks", 5);
|
||||
|
||||
plot->enableAllAutoNameTags(true);
|
||||
plot->setPlotTitleVisible(true);
|
||||
plot->setTrackLegendsVisible(true);
|
||||
plot->setTrackLegendsHorizontal(true);
|
||||
plot->setDepthType(RimWellLogPlot::TRUE_VERTICAL_DEPTH);
|
||||
plot->setDepthAutoZoom(true);
|
||||
|
||||
RicNewWellLogPlotFeatureImpl::updateAfterCreation(plot);
|
||||
}
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(plot);
|
||||
|
||||
|
@ -50,6 +50,18 @@
|
||||
|
||||
namespace caf {
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ProgressTask::ProgressTask(ProgressInfo& parentTask)
|
||||
: m_parentTask(parentTask)
|
||||
{
|
||||
}
|
||||
ProgressTask::~ProgressTask()
|
||||
{
|
||||
m_parentTask.incrementProgress();
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// \class caf::ProgressInfo
|
||||
@ -152,16 +164,6 @@ namespace caf {
|
||||
ProgressInfoStatic::incrementProgress();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Convenience method for incrementing progress and setting step size and description for next step
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void ProgressInfo::incrementProgressAndUpdateNextStep(size_t nextStepSize, const QString& nextDescription)
|
||||
{
|
||||
incrementProgress();
|
||||
setNextProgressIncrement(nextStepSize);
|
||||
setProgressDescription(nextDescription);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// To make a certain operation span more of the progress bar than one tick,
|
||||
/// set the number of progress ticks that you want it to use before calling it.
|
||||
@ -176,15 +178,18 @@ namespace caf {
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void ProgressInfo::setNextProgressIncrement(size_t nextStepSize)
|
||||
{
|
||||
ProgressInfoStatic::setNextProgressIncrement(nextStepSize);
|
||||
ProgressInfoStatic::setNextProgressIncrement(nextStepSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::ProgressTask ProgressInfo::task(const QString& description, int stepSize)
|
||||
{
|
||||
setProgressDescription(description);
|
||||
setNextProgressIncrement(stepSize);
|
||||
return caf::ProgressTask(*this);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -631,6 +636,4 @@ namespace caf {
|
||||
//if (progressDialog()) progressDialog()->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace caf
|
||||
|
@ -43,6 +43,17 @@ class QString;
|
||||
|
||||
namespace caf {
|
||||
|
||||
class ProgressInfo;
|
||||
|
||||
class ProgressTask
|
||||
{
|
||||
public:
|
||||
ProgressTask(ProgressInfo& parentTask);
|
||||
~ProgressTask();
|
||||
private:
|
||||
ProgressInfo& m_parentTask;
|
||||
};
|
||||
|
||||
class ProgressInfo
|
||||
{
|
||||
public:
|
||||
@ -52,9 +63,10 @@ public:
|
||||
void setProgressDescription(const QString& description);
|
||||
void setProgress(size_t progressValue);
|
||||
void incrementProgress();
|
||||
void incrementProgressAndUpdateNextStep(size_t nextStepSize, const QString& nextDescription);
|
||||
void setNextProgressIncrement(size_t nextStepSize);
|
||||
|
||||
ProgressTask task(const QString& description, int stepSize);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user