2017-07-27 03:12:57 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2018-11-21 03:26:46 -06:00
|
|
|
//
|
2017-07-27 03:12:57 -05:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2018-11-21 03:26:46 -06:00
|
|
|
//
|
2017-07-27 03:12:57 -05:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2018-11-21 03:26:46 -06:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-07-27 03:12:57 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicfExportSnapshots.h"
|
|
|
|
|
|
|
|
#include "RicfCommandFileExecutor.h"
|
|
|
|
|
2017-08-03 09:22:02 -05:00
|
|
|
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
|
2017-08-04 04:25:17 -05:00
|
|
|
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
2017-07-27 03:12:57 -05:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RiuMainWindow.h"
|
|
|
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RicfExportSnapshots, "exportSnapshots");
|
|
|
|
|
2018-11-21 03:26:46 -06:00
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
template<>
|
|
|
|
void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
|
|
|
|
{
|
|
|
|
addItem(RicfExportSnapshots::ALL, "ALL", "All");
|
|
|
|
addItem(RicfExportSnapshots::VIEWS, "VIEWS", "Views");
|
|
|
|
addItem(RicfExportSnapshots::PLOTS, "PLOTS", "Plots");
|
|
|
|
setDefault(RicfExportSnapshots::ALL);
|
2017-07-27 03:12:57 -05:00
|
|
|
}
|
2018-11-21 03:26:46 -06:00
|
|
|
} // namespace caf
|
2017-07-27 03:12:57 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-21 03:26:46 -06:00
|
|
|
///
|
2017-07-27 03:12:57 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RicfExportSnapshots::RicfExportSnapshots()
|
|
|
|
{
|
2018-11-21 03:26:46 -06:00
|
|
|
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
|
|
|
|
RICF_InitField(&m_prefix, "prefix", QString(), "Prefix", "", "", "");
|
2017-07-27 03:12:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-21 03:26:46 -06:00
|
|
|
///
|
2017-07-27 03:12:57 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicfExportSnapshots::execute()
|
|
|
|
{
|
|
|
|
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
|
|
|
CVF_ASSERT(mainWnd);
|
|
|
|
mainWnd->hideAllDockWindows();
|
2017-08-30 08:29:27 -05:00
|
|
|
RiaApplication::instance()->processEvents();
|
2017-07-27 03:12:57 -05:00
|
|
|
|
|
|
|
QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS);
|
|
|
|
if (absolutePathToSnapshotDir.isNull())
|
|
|
|
{
|
|
|
|
absolutePathToSnapshotDir = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("snapshots");
|
|
|
|
}
|
|
|
|
if (m_type == RicfExportSnapshots::VIEWS || m_type == RicfExportSnapshots::ALL)
|
|
|
|
{
|
2018-11-21 03:26:46 -06:00
|
|
|
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir, m_prefix);
|
2017-07-27 03:12:57 -05:00
|
|
|
}
|
|
|
|
if (m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL)
|
|
|
|
{
|
2018-11-21 03:26:46 -06:00
|
|
|
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(absolutePathToSnapshotDir, m_prefix);
|
2017-07-27 03:12:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mainWnd->loadWinGeoAndDockToolBarLayout();
|
2017-08-30 08:29:27 -05:00
|
|
|
RiaApplication::instance()->processEvents();
|
2017-07-27 03:12:57 -05:00
|
|
|
}
|