System: Created a general basename cleanup function, and applied that when creating filenames from userdescription etc. Related to #1054 preparations

This commit is contained in:
Jacob Støren
2017-01-04 10:45:04 +01:00
parent 6d498cce98
commit 03cf09d90a
7 changed files with 44 additions and 23 deletions

View File

@@ -30,6 +30,7 @@
#include "RigMainGrid.h"
#include "RigCaseData.h"
#include "QMessageBox"
#include "cafUtils.h"
CAF_CMD_SOURCE_INIT(RicExportFaultsFeature, "RicExportFaultsFeature");
@@ -79,7 +80,7 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
if ( faultName == RimDefines::undefinedGridFaultWithInactiveName() ) faultName = "UNDEF_IA";
QString baseFilename = "Fault_" + faultName + "_" + caseName;
baseFilename.replace(" ", "_");
baseFilename = caf::Utils::makeValidFileBasename(baseFilename);
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl";

View File

@@ -214,6 +214,7 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* ri
QString resName = resultName(rimView);
QString viewCaseResultString = rimCase->caseUserDescription() + "_" + rimView->name() + "_" + resName;
viewCaseResultString = caf::Utils::makeValidFileBasename(viewCaseResultString);
for (int i = msd->timeStepStart(); i <= msd->timeStepEnd(); i++)
{
@@ -235,7 +236,6 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* ri
if (msd->sliceDirection == RimMultiSnapshotDefinition::NO_RANGEFILTER)
{
QString fileName = viewCaseResultString + "_" + timeStepString;
fileName.replace(" ", "-");
QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png");
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView);
@@ -252,7 +252,6 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* ri
{
QString rangeFilterString = msd->sliceDirection().text() + "-" + QString::number(i);
QString fileName = viewCaseResultString + "_" + timeStepString + "_" + rangeFilterString;
fileName.replace(" ", "-");
rangeFilter->setDefaultValues();
if (msd->sliceDirection == RimMultiSnapshotDefinition::RANGEFILTER_I)
@@ -293,7 +292,7 @@ QString RicExportMultipleSnapshotsFeature::resultName(RimView* rimView)
if (dynamic_cast<RimEclipseView*>(rimView))
{
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(rimView);
return eclView->cellResult()->resultVariable();
}
else if (dynamic_cast<RimGeoMechView*>(rimView))

View File

@@ -208,7 +208,7 @@ void RicSnapshotAllPlotsToFileFeature::createSnapshotOfAllPlotsInFolder(QString
if (wellLogPlot && wellLogPlot->viewWidget())
{
QString fileName = wellLogPlot->description();
fileName.replace(" ", "_");
fileName = caf::Utils::makeValidFileBasename(fileName);
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
@@ -226,7 +226,7 @@ void RicSnapshotAllPlotsToFileFeature::createSnapshotOfAllPlotsInFolder(QString
if (summaryPlot && summaryPlot->viewWidget())
{
QString fileName = summaryPlot->description();
fileName.replace(" ", "_");
fileName = caf::Utils::makeValidFileBasename(fileName);
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");