mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#882 RiaApplication : Renamed to lastUsedDialogDirectory and added currentProjectPath. Use project path as fallback path for LAS export
This commit is contained in:
@@ -61,14 +61,14 @@ bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
|
||||
void RicAddEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the directory to next time
|
||||
defaultDir = QFileInfo(fileNames.last()).absolutePath();
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", defaultDir);
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", defaultDir);
|
||||
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection();
|
||||
if (inputPropertyCollection)
|
||||
|
||||
@@ -59,14 +59,14 @@ bool RicAddOpmInputPropertyFeature::isCommandEnabled()
|
||||
void RicAddOpmInputPropertyFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the directory to next time
|
||||
defaultDir = QFileInfo(fileNames.last()).absolutePath();
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", defaultDir);
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", defaultDir);
|
||||
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection();
|
||||
if (inputPropertyCollection)
|
||||
|
||||
@@ -50,11 +50,15 @@ void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
|
||||
std::vector<RimWellLogCurve*> curves = selectedWellLogPlotCurves();
|
||||
if (curves.size() == 0) return;
|
||||
|
||||
QString defaultDir = RiaApplication::instance()->defaultFileDialogDirectory("WELL_LOGS_DIR");
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("WELL_LOGS_DIR", projectFolder);
|
||||
|
||||
RicExportToLasFileResampleUi featureUi;
|
||||
featureUi.exportFolder = defaultDir;
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Export Curve Data to LAS file(s)", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
propertyDialog.resize(QSize(350, 200));
|
||||
|
||||
if (propertyDialog.exec() == QDialog::Accepted &&
|
||||
!featureUi.exportFolder().isEmpty())
|
||||
@@ -69,7 +73,7 @@ void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
|
||||
lasExporter.writeToFolder(featureUi.exportFolder());
|
||||
|
||||
// Remember the path to next time
|
||||
RiaApplication::instance()->setDefaultFileDialogDirectory("WELL_LOGS_DIR", featureUi.exportFolder());
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory("WELL_LOGS_DIR", featureUi.exportFolder());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ void RicImportEclipseCaseFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QString defaultDir = app->defaultFileDialogDirectory("BINARY_GRID");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Eclipse File", defaultDir, "Eclipse Grid Files (*.GRID *.EGRID)");
|
||||
if (fileNames.size()) defaultDir = QFileInfo(fileNames.last()).absolutePath();
|
||||
app->setDefaultFileDialogDirectory("BINARY_GRID", defaultDir);
|
||||
app->setLastUsedDialogDirectory("BINARY_GRID", defaultDir);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < fileNames.size(); i++)
|
||||
|
||||
@@ -43,13 +43,13 @@ bool RicImportFormationNamesFeature::isCommandEnabled()
|
||||
void RicImportFormationNamesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("BINARY_GRID");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Formation Names", defaultDir, "Formation Names description File (*.lyr);;All Files (*.*)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("BINARY_GRID", QFileInfo(fileNames.last()).absolutePath());
|
||||
app->setLastUsedDialogDirectory("BINARY_GRID", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
// Find or create the FomationNamesCollection
|
||||
|
||||
|
||||
@@ -44,13 +44,13 @@ bool RicImportInputEclipseCaseFeature::isCommandEnabled()
|
||||
void RicImportInputEclipseCaseFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Eclipse Input Files", defaultDir, "Eclipse Input Files and Input Properties Eclipse Input Files (*.GRDECL);;All Files (*.*)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
app->openInputEclipseCaseFromFileNames(fileNames);
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ bool RicImportInputEclipseCaseOpmFeature::isCommandEnabled()
|
||||
void RicImportInputEclipseCaseOpmFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||
QString fileName = QFileDialog::getOpenFileName(RiuMainWindow::instance(), "Import Eclipse Input file", defaultDir, "Eclipse Input Files (*.GRDECL);;All Files (*.*)");
|
||||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("INPUT_FILES", QFileInfo(fileName).absolutePath());
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileName).absolutePath());
|
||||
|
||||
RimProject* proj = app->project();
|
||||
RimEclipseCaseCollection* analysisModels = proj->activeOilField() ? proj->activeOilField()->analysisModels() : NULL;
|
||||
|
||||
@@ -84,17 +84,10 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
|
||||
if (!inputReservoir) return;
|
||||
|
||||
{
|
||||
QString projectFolder;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString projectFileName = app->currentProjectFileName();
|
||||
if (!projectFileName.isEmpty())
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
if (projectFolder.isEmpty())
|
||||
{
|
||||
QFileInfo fi(projectFileName);
|
||||
projectFolder = fi.absolutePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
projectFolder = inputReservoir->locationOnDisc();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,16 +77,9 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
|
||||
RimBinaryExportSettings exportSettings;
|
||||
exportSettings.eclipseKeyword = m_cellColors->resultVariable();
|
||||
{
|
||||
QString projectFolder;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString projectFileName = app->currentProjectFileName();
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
QFileInfo fi(projectFileName);
|
||||
projectFolder = fi.absolutePath();
|
||||
}
|
||||
else
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
if (projectFolder.isEmpty())
|
||||
{
|
||||
projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc();
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ void RicWellLogsImportFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
// Open dialog box to select well path files
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("WELL_LOGS_DIR");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("WELL_LOGS_DIR");
|
||||
QStringList wellLogFilePaths = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Well Logs", defaultDir, "Well Logs (*.las);;All Files (*.*)");
|
||||
|
||||
if (wellLogFilePaths.size() < 1) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("WELL_LOGS_DIR", QFileInfo(wellLogFilePaths.last()).absolutePath());
|
||||
app->setLastUsedDialogDirectory("WELL_LOGS_DIR", QFileInfo(wellLogFilePaths.last()).absolutePath());
|
||||
|
||||
app->addWellLogsToModel(wellLogFilePaths);
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ void RicWellPathsImportFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
// Open dialog box to select well path files
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("WELLPATH_DIR");
|
||||
QString defaultDir = app->lastUsedDialogDirectory("WELLPATH_DIR");
|
||||
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Well Paths", defaultDir, "Well Paths (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)");
|
||||
|
||||
if (wellPathFilePaths.size() < 1) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
|
||||
app->setLastUsedDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
|
||||
|
||||
app->addWellPathsToModel(wellPathFilePaths);
|
||||
if (app->project())
|
||||
|
||||
Reference in New Issue
Block a user