From 75140c2406deb9f533f932502f19f97a890fc35b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 9 Oct 2019 15:21:51 +0200 Subject: [PATCH] #4765 Summary : Support command line snapshots without a project file Use current working directory as base, and create a sub folder named "snapshots". Export snapshots from the application into this folder. --- .../Application/RiaGuiApplication.cpp | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/ApplicationCode/Application/RiaGuiApplication.cpp b/ApplicationCode/Application/RiaGuiApplication.cpp index 8444127568..53dd4bec41 100644 --- a/ApplicationCode/Application/RiaGuiApplication.cpp +++ b/ApplicationCode/Application/RiaGuiApplication.cpp @@ -821,36 +821,33 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr } } - if ( project() != nullptr && !project()->fileName().isEmpty() ) + QString exportFolder = QDir::currentPath() + "/snapshots"; + + if ( snapshotViews ) { - if ( snapshotViews ) + RiuMainWindow* mainWnd = RiuMainWindow::instance(); + CVF_ASSERT( mainWnd ); + mainWnd->hideAllDockWidgets(); + + RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( exportFolder ); + + mainWnd->loadWinGeoAndDockToolBarLayout(); + } + + if ( snapshotPlots ) + { + if ( mainPlotWindow() ) { - RiuMainWindow* mainWnd = RiuMainWindow::instance(); - CVF_ASSERT( mainWnd ); - mainWnd->hideAllDockWidgets(); + mainPlotWindow()->hideAllDockWidgets(); - // 2016-11-09 : Location of snapshot folder was previously located in 'snapshot' folder - // relative to current working folder. Now harmonized to behave as RiuMainWindow::slotSnapshotAllViewsToFile() - QString absolutePathToSnapshotDir = createAbsolutePathFromProjectRelativePath( "snapshots" ); - RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( absolutePathToSnapshotDir ); + RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( exportFolder ); - mainWnd->loadWinGeoAndDockToolBarLayout(); - } - - if ( snapshotPlots ) - { - if ( mainPlotWindow() ) - { - mainPlotWindow()->hideAllDockWidgets(); - - // Will be saved relative to current directory - RicSnapshotAllPlotsToFileFeature::saveAllPlots(); - - mainPlotWindow()->loadWinGeoAndDockToolBarLayout(); - } + mainPlotWindow()->loadWinGeoAndDockToolBarLayout(); } } + closeProject(); + return EXIT_COMPLETED; }