#1018 : Snapshot : Added table editor to export dialog

This commit is contained in:
Magne Sjaastad 2016-12-09 11:11:16 +01:00
parent 242dbd3693
commit 331456e619
9 changed files with 249 additions and 17 deletions

View File

@ -35,6 +35,8 @@ ${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h
${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.h
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
@ -72,6 +74,7 @@ ${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.cpp
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp

View File

@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// 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.
//
// 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.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicExportMultipleSnapshotsFeature.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RiuExportMultipleSnapshotsWidget.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicExportMultipleSnapshotsFeature, "RicExportMultipleSnapshotsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportMultipleSnapshotsFeature::isCommandEnabled()
{
RimProject* proj = RiaApplication::instance()->project();
return proj;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportMultipleSnapshotsFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();
if (proj)
{
RiuExportMultipleSnapshotsWidget dlg(nullptr, proj);
dlg.exec();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportMultipleSnapshotsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export Multiple Snapshots ...");
//actionToSetup->setIcon(QIcon(":/Save.png"));
}

View File

@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// 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.
//
// 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.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicExportMultipleSnapshotsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -18,23 +18,6 @@
#include "RimMultiSnapshotDefinition.h"
/*
#include "RifJsonEncodeDecode.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "RivWellPathPartMgr.h"
#include "RiuMainWindow.h"
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include <QDateTime>
*/
CAF_PDM_SOURCE_INIT(RimMultiSnapshotDefinition, "MultiSnapshotDefinition");
@ -46,6 +29,10 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
//CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.png", "", "");
CAF_PDM_InitObject("MultiSnapshotDefinition", "", "", "");
CAF_PDM_InitFieldNoDefault(&caseObject, "Case", "Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&viewObject, "View", "View", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
}

View File

@ -38,6 +38,7 @@
#include "RimGridSummaryCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimMultiSnapshotDefinition.h"
#include "RimOilField.h"
#include "RimScriptCollection.h"
#include "RimSummaryCaseCollection.h"
@ -98,6 +99,8 @@ RimProject::RimProject(void)
CAF_PDM_InitFieldNoDefault(&commandObjects, "CommandObjects", "CommandObjects", "", "", "");
//wellPathImport.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&multiSnapshotDefinitions, "MultiSnapshotDefinitions", "MultiSnapshotDefinitions", "", "", "");
CAF_PDM_InitFieldNoDefault(&mainWindowTreeViewState, "TreeViewState", "", "", "", "");
mainWindowTreeViewState.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&mainWindowCurrentModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "");

View File

@ -38,6 +38,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellLogPlot.h
${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.h
${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.h
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.h
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -74,6 +75,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellLogPlot.cpp
${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.cpp
${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.cpp
)
list(APPEND CODE_HEADER_FILES
@ -99,6 +101,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.h
${CEE_CURRENT_LIST_DIR}RiuRecentFileActionProvider.h
${CEE_CURRENT_LIST_DIR}RiuSummaryQwtPlot.h
${CEE_CURRENT_LIST_DIR}RiuQwtScalePicker.h
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
)
list(APPEND QT_UI_FILES

View File

@ -0,0 +1,91 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// 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.
//
// 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.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuExportMultipleSnapshotsWidget.h"
#include "RimProject.h"
#include "cafCmdFeatureManager.h"
#include "cafPdmUiTableView.h"
#include "cafSelectionManager.h"
#include <QAbstractItemView>
#include <QBoxLayout>
#include <QDialogButtonBox>
#include <QMenu>
#include <QTableView>
#include <QWidget>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* parent, RimProject* project)
: m_rimProject(project),
QDialog(parent)
{
setWindowTitle("Export Multiple Snapshots");
QVBoxLayout* dialogLayout = new QVBoxLayout;
setLayout(dialogLayout);
m_pdmTableView = new caf::PdmUiTableView(this);
m_pdmTableView->tableView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pdmTableView->tableView()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_pdmTableView->tableView(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint)));
m_pdmTableView->setListField(&(project->multiSnapshotDefinitions()));
caf::SelectionManager::instance()->setActiveChildArrayFieldHandle(&(project->multiSnapshotDefinitions()));
dialogLayout->addWidget(m_pdmTableView);
// Buttons
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
dialogLayout->addWidget(buttonBox);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuExportMultipleSnapshotsWidget::~RiuExportMultipleSnapshotsWidget()
{
caf::SelectionManager::instance()->setActiveChildArrayFieldHandle(nullptr);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuExportMultipleSnapshotsWidget::customMenuRequested(QPoint pos)
{
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
QMenu menu;
menu.addAction(commandManager->action("PdmListField_AddItem", "Add new row"));
// Qt doc: QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport().
QPoint globalPos = m_pdmTableView->tableView()->viewport()->mapToGlobal(pos);
menu.exec(globalPos);
}

View File

@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// 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.
//
// 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.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QDialog>
class RimProject;
namespace caf {
class PdmUiTableView;
}
class QWidget;
class RiuExportMultipleSnapshotsWidget : public QDialog
{
Q_OBJECT
public:
RiuExportMultipleSnapshotsWidget(QWidget* parent, RimProject* project);
~RiuExportMultipleSnapshotsWidget();
private slots:
void customMenuRequested(QPoint pos);
private:
RimProject* m_rimProject;
caf::PdmUiTableView* m_pdmTableView;
};

View File

@ -331,6 +331,7 @@ void RiuMainWindow::createMenus()
QMenu* exportMenu = fileMenu->addMenu("&Export");
exportMenu->addAction(cmdFeatureMgr->action("RicSnapshotViewToFileFeature"));
exportMenu->addAction(m_snapshotAllViewsToFile);
exportMenu->addAction(cmdFeatureMgr->action("RicExportMultipleSnapshotsFeature"));
fileMenu->addSeparator();
fileMenu->addAction(cmdFeatureMgr->action("RicSaveProjectFeature"));