#3911 Ensemble import : Remember separate file path for ensemble

This commit is contained in:
Magne Sjaastad 2018-12-20 08:50:21 +01:00
parent bc86158ff6
commit f7a7a943d7
4 changed files with 11 additions and 7 deletions

View File

@ -63,7 +63,8 @@ bool RicImportEnsembleFeature::isCommandEnabled()
void RicImportEnsembleFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Ensemble");
QString pathCacheName = "ENSEMBLE_FILES";
QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Ensemble", pathCacheName);
if (fileNames.isEmpty()) return;

View File

@ -70,7 +70,8 @@ bool RicImportSummaryCasesFeature::isCommandEnabled()
void RicImportSummaryCasesFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QStringList fileNames = runRecursiveSummaryCaseFileSearchDialog("Import Summary Cases");
QString pathCacheName = "INPUT_FILES";
QStringList fileNames = runRecursiveSummaryCaseFileSearchDialog("Import Summary Cases", pathCacheName);
std::vector<RimSummaryCase*> cases;
if (!fileNames.isEmpty()) createSummaryCasesFromFiles(fileNames, &cases);
@ -217,10 +218,11 @@ void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant(const std::vector<R
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle)
QStringList RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle,
const QString& pathCacheName)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
QString defaultDir = app->lastUsedDialogDirectory(pathCacheName);
RicFileHierarchyDialogResult result = RicFileHierarchyDialog::runRecursiveSearchDialog(nullptr,
dialogTitle,
@ -236,7 +238,7 @@ QStringList RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialo
if (!result.ok) return QStringList();
// Remember the path to next time
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(result.rootDir).absoluteFilePath());
app->setLastUsedDialogDirectory(pathCacheName, QFileInfo(result.rootDir).absoluteFilePath());
return result.files;
}

View File

@ -43,7 +43,7 @@ public:
static void addSummaryCases(const std::vector<RimSummaryCase*> cases);
static void addCasesToGroupIfRelevant(const std::vector<RimSummaryCase*> cases);
static QStringList runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle);
static QStringList runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle, const QString& pathCacheName);
protected:
// Overrides

View File

@ -61,7 +61,8 @@ bool RicImportSummaryGroupFeature::isCommandEnabled()
void RicImportSummaryGroupFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Summary Case Group");
QString pathCacheName = "INPUT_FILES";
QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Summary Case Group", pathCacheName);
if (fileNames.isEmpty()) return;