#4852 Command Line : Add snapshotexportfolder

This commit is contained in:
Magne Sjaastad
2019-10-11 12:35:41 +02:00
parent 225893dcda
commit 0e2cee7295
2 changed files with 27 additions and 5 deletions

View File

@@ -683,6 +683,13 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
} }
} }
QString snapshotFolderFromCommandLine;
if ( cvf::Option o = progOpt->option( "snapshotfolder" ) )
{
CVF_ASSERT( o.valueCount() == 1 );
snapshotFolderFromCommandLine = cvfqt::Utils::toQString( o.value( 0 ) );
}
if ( cvf::Option o = progOpt->option( "summaryplot" ) ) if ( cvf::Option o = progOpt->option( "summaryplot" ) )
{ {
RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( cvfqt::Utils::toQStringList( o.values() ) ); RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( cvfqt::Utils::toQStringList( o.values() ) );
@@ -846,7 +853,16 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
} }
} }
QString exportFolder = QDir::currentPath() + "/snapshots"; QString snapshotFolder;
if ( snapshotFolderFromCommandLine.isEmpty() )
{
snapshotFolder = QDir::currentPath() + "/snapshots";
}
else
{
snapshotFolder = snapshotFolderFromCommandLine;
}
if ( snapshotPlots ) if ( snapshotPlots )
{ {
@@ -863,7 +879,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
processEvents(); processEvents();
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( exportFolder ); RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( snapshotFolder );
} }
} }
@@ -880,7 +896,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
processEvents(); processEvents();
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( exportFolder ); RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( snapshotFolder );
} }
auto mainPlotWnd = mainPlotWindow(); auto mainPlotWnd = mainPlotWindow();
@@ -891,9 +907,11 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout(); RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout();
closeProject(); /*
closeProject();
return EXIT_COMPLETED; return EXIT_COMPLETED;
*/
} }
if ( cvf::Option o = progOpt->option( "commandFile" ) ) if ( cvf::Option o = progOpt->option( "commandFile" ) )

View File

@@ -104,6 +104,10 @@ bool RiaArgumentParser::parseArguments( cvf::ProgramOptions* progOpt )
"<width> <height>", "<width> <height>",
"Set size of exported snapshot images.", "Set size of exported snapshot images.",
cvf::ProgramOptions::MULTI_VALUE ); cvf::ProgramOptions::MULTI_VALUE );
progOpt->registerOption( "snapshotfolder",
"<folder>",
"Set the destination folder for exported snapshot images.\n",
cvf::ProgramOptions::SINGLE_VALUE );
progOpt->registerOption( "savesnapshots", progOpt->registerOption( "savesnapshots",
"all|views|plots", "all|views|plots",
"Save snapshot of all views or plots to project file location sub folder 'snapshots'. " "Save snapshot of all views or plots to project file location sub folder 'snapshots'. "