mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-13 17:02:13 -05:00
Added command line parameter to save snapshots for all views. Closes down the application after writing images to file.
p4#: 20390
This commit is contained in:
1 parent
24e2c3dcbb
commit
4f44afdac1
1 file changed
+27
-2
@@ -607,6 +607,7 @@ bool RIApplication::parseArguments()
|
|||||||
bool isParsingCaseNames = false;
|
bool isParsingCaseNames = false;
|
||||||
bool isParsingStartDir = false;
|
bool isParsingStartDir = false;
|
||||||
bool showHelp = false;
|
bool showHelp = false;
|
||||||
|
bool isSaveSnapshotsForAllViews = false;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 1; i < arguments.size(); i++)
|
for (i = 1; i < arguments.size(); i++)
|
||||||
@@ -649,6 +650,12 @@ bool RIApplication::parseArguments()
|
|||||||
|
|
||||||
foundKnownOption = true;
|
foundKnownOption = true;
|
||||||
}
|
}
|
||||||
|
else if (arg.toLower() == "-savesnapshots")
|
||||||
|
{
|
||||||
|
isSaveSnapshotsForAllViews = true;
|
||||||
|
|
||||||
|
foundKnownOption = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!foundKnownOption)
|
if (!foundKnownOption)
|
||||||
{
|
{
|
||||||
@@ -682,7 +689,10 @@ bool RIApplication::parseArguments()
|
|||||||
"-case <casename> Open Eclipse case <casename>\n"
|
"-case <casename> Open Eclipse case <casename>\n"
|
||||||
" (do not include .GRID/.EGRID)\n"
|
" (do not include .GRID/.EGRID)\n"
|
||||||
"-startdir The default directory for open/save commands\n"
|
"-startdir The default directory for open/save commands\n"
|
||||||
|
"\n"
|
||||||
|
"-savesnapshots Save snapshot of all views to 'snapshots' folder in project file folder\n"
|
||||||
|
" Application closes after snapshots are written to file\n"
|
||||||
|
"\n"
|
||||||
"-help \n"
|
"-help \n"
|
||||||
"-? Displays help text\n"
|
"-? Displays help text\n"
|
||||||
"-----------------------------------------------------------------";
|
"-----------------------------------------------------------------";
|
||||||
@@ -725,6 +735,14 @@ bool RIApplication::parseArguments()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_project.notNull() && !m_project->fileName().isEmpty() && isSaveSnapshotsForAllViews)
|
||||||
|
{
|
||||||
|
saveSnapshotForAllViews();
|
||||||
|
|
||||||
|
// Returning false will exit the application
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -982,7 +1000,14 @@ void RIApplication::saveSnapshotAs(const QString& fileName)
|
|||||||
if (m_activeReservoirView && m_activeReservoirView->viewer())
|
if (m_activeReservoirView && m_activeReservoirView->viewer())
|
||||||
{
|
{
|
||||||
QImage image = m_activeReservoirView->viewer()->grabFrameBuffer();
|
QImage image = m_activeReservoirView->viewer()->grabFrameBuffer();
|
||||||
image.save(fileName);
|
if (image.save(fileName))
|
||||||
|
{
|
||||||
|
qDebug() << "Saved snapshot image to " << fileName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "Error when trying to save snapshot image to " << fileName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user