mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 16:32:12 -05:00
#3725 exportSnapshots : Add optional prefix
This commit is contained in:
1 parent
651084420c
commit
8a3907e531
6 files changed
+23
-11
No files matched your search
@@ -31,16 +31,17 @@
|
|||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RicfExportSnapshots, "exportSnapshots");
|
CAF_PDM_SOURCE_INIT(RicfExportSnapshots, "exportSnapshots");
|
||||||
|
|
||||||
namespace caf {
|
namespace caf
|
||||||
template<>
|
{
|
||||||
void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
|
template<>
|
||||||
{
|
void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
|
||||||
|
{
|
||||||
addItem(RicfExportSnapshots::ALL, "ALL", "All");
|
addItem(RicfExportSnapshots::ALL, "ALL", "All");
|
||||||
addItem(RicfExportSnapshots::VIEWS, "VIEWS", "Views");
|
addItem(RicfExportSnapshots::VIEWS, "VIEWS", "Views");
|
||||||
addItem(RicfExportSnapshots::PLOTS, "PLOTS", "Plots");
|
addItem(RicfExportSnapshots::PLOTS, "PLOTS", "Plots");
|
||||||
setDefault(RicfExportSnapshots::ALL);
|
setDefault(RicfExportSnapshots::ALL);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace caf
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -48,6 +49,7 @@ namespace caf {
|
|||||||
RicfExportSnapshots::RicfExportSnapshots()
|
RicfExportSnapshots::RicfExportSnapshots()
|
||||||
{
|
{
|
||||||
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
|
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
|
||||||
|
RICF_InitField(&m_prefix, "prefix", QString(), "Prefix", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -67,11 +69,11 @@ void RicfExportSnapshots::execute()
|
|||||||
}
|
}
|
||||||
if (m_type == RicfExportSnapshots::VIEWS || m_type == RicfExportSnapshots::ALL)
|
if (m_type == RicfExportSnapshots::VIEWS || m_type == RicfExportSnapshots::ALL)
|
||||||
{
|
{
|
||||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
|
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir, m_prefix);
|
||||||
}
|
}
|
||||||
if (m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL)
|
if (m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL)
|
||||||
{
|
{
|
||||||
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(absolutePathToSnapshotDir);
|
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(absolutePathToSnapshotDir, m_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||||
|
|||||||
@@ -48,4 +48,5 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<SnapshotsTypeEnum> m_type;
|
caf::PdmField<SnapshotsTypeEnum> m_type;
|
||||||
|
caf::PdmField<QString> m_prefix;
|
||||||
};
|
};
|
||||||
@@ -68,7 +68,7 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(QString snapshotFolderName)
|
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(const QString& snapshotFolderName, const QString& prefix)
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
|
||||||
@@ -91,6 +91,11 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(QStrin
|
|||||||
if (viewWindow->isMdiWindow() && viewWindow->viewWidget())
|
if (viewWindow->isMdiWindow() && viewWindow->viewWidget())
|
||||||
{
|
{
|
||||||
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName(viewWindow);
|
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName(viewWindow);
|
||||||
|
if (!prefix.isEmpty())
|
||||||
|
{
|
||||||
|
fileName = prefix + fileName;
|
||||||
|
}
|
||||||
|
|
||||||
fileName.replace(" ", "_");
|
fileName.replace(" ", "_");
|
||||||
|
|
||||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class RicSnapshotAllPlotsToFileFeature : public caf::CmdFeature
|
|||||||
public:
|
public:
|
||||||
static void saveAllPlots();
|
static void saveAllPlots();
|
||||||
|
|
||||||
static void exportSnapshotOfAllPlotsIntoFolder(QString snapshotFolderName);
|
static void exportSnapshotOfAllPlotsIntoFolder(const QString& snapshotFolderName, const QString& prefix = "");
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overrides
|
// Overrides
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void RicSnapshotAllViewsToFileFeature::saveAllViews()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(QString snapshotFolderName)
|
void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(const QString& snapshotFolderName, const QString& prefix)
|
||||||
{
|
{
|
||||||
RimProject* project = RiaApplication::instance()->project();
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
|
|
||||||
@@ -114,6 +114,10 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(QStrin
|
|||||||
viewer->repaint();
|
viewer->repaint();
|
||||||
|
|
||||||
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName(riv);
|
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName(riv);
|
||||||
|
if (!prefix.isEmpty())
|
||||||
|
{
|
||||||
|
fileName = prefix + fileName;
|
||||||
|
}
|
||||||
|
|
||||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class RicSnapshotAllViewsToFileFeature : public caf::CmdFeature
|
|||||||
public:
|
public:
|
||||||
static void saveAllViews();
|
static void saveAllViews();
|
||||||
|
|
||||||
static void exportSnapshotOfAllViewsIntoFolder(QString snapshotFolderName);
|
static void exportSnapshotOfAllViewsIntoFolder(const QString& snapshotFolderName, const QString& prefix = "");
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overrides
|
// Overrides
|
||||||
|
|||||||
Reference in new issue
Block a user