diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index 7d7d2a237c..adc2244d98 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -36,6 +36,8 @@ ${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h ${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.h +${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.h + # General delete of any object in a child array field @@ -79,6 +81,8 @@ ${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.cpp +${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.cpp + # General delete of any object in a child array field ${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp diff --git a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp index e75cfe9311..1bcc963e9f 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesWellSegmentsFeature.cpp @@ -21,6 +21,8 @@ #include "RiaApplication.h" #include "RiaLogging.h" +#include "RicExportFeatureImpl.h" + #include "RimProject.h" #include "RimFishboneWellPathCollection.h" #include "RimFishbonesCollection.h" @@ -77,6 +79,8 @@ void RicExportFishbonesWellSegmentsFeature::onActionTriggered(bool isChecked) exportSettings.folder = defaultDir; caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Well Segments", ""); + RicExportFeatureImpl::configureForExport(&propertyDialog); + if (propertyDialog.exec() == QDialog::Accepted) { RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.folder).absolutePath()); diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index e67958c099..455243f1c9 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -21,40 +21,41 @@ #include "RiaApplication.h" #include "RiaLogging.h" -#include "RimProject.h" -#include "RimWellPath.h" -#include "RimWellPathCollection.h" -#include "RimFishbonesMultipleSubs.h" -#include "RimFishbonesCollection.h" +#include "RicExportCompletionDataSettingsUi.h" +#include "RicExportFeatureImpl.h" +#include "RicFishbonesTransmissibilityCalculationFeatureImp.h" + +#include "RigActiveCellInfo.h" +#include "RigEclipseCaseData.h" +#include "RigMainGrid.h" +#include "RigResultAccessorFactory.h" +#include "RigTransmissibilityEquations.h" +#include "RigWellLogExtractionTools.h" +#include "RigWellPath.h" +#include "RigWellPathIntersectionTools.h" + #include "RimFishboneWellPath.h" #include "RimFishboneWellPathCollection.h" -#include "RimPerforationInterval.h" +#include "RimFishbonesCollection.h" +#include "RimFishbonesMultipleSubs.h" #include "RimPerforationCollection.h" +#include "RimPerforationInterval.h" +#include "RimProject.h" #include "RimReservoirCellResultsStorage.h" +#include "RimWellPath.h" +#include "RimWellPathCollection.h" #include "RimWellPathCompletions.h" -#include "RicExportCompletionDataSettingsUi.h" - #include "RiuMainWindow.h" -#include "RigWellLogExtractionTools.h" -#include "RigWellPathIntersectionTools.h" -#include "RigEclipseCaseData.h" -#include "RigMainGrid.h" -#include "RigWellPath.h" -#include "RigResultAccessorFactory.h" -#include "RigTransmissibilityEquations.h" - -#include "cafSelectionManager.h" #include "cafPdmUiPropertyViewDialog.h" +#include "cafSelectionManager.h" #include "cvfPlane.h" #include #include #include -#include "RicFishbonesTransmissibilityCalculationFeatureImp.h" -#include "RigActiveCellInfo.h" CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature"); @@ -98,6 +99,8 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked) exportSettings.folder = defaultDir; caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Completion Data", ""); + RicExportFeatureImpl::configureForExport(&propertyDialog); + if (propertyDialog.exec() == QDialog::Accepted) { RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", exportSettings.folder); diff --git a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp index ac8a2ec421..02a866115a 100644 --- a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp +++ b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp @@ -19,22 +19,25 @@ #include "RicSaveEclipseInputPropertyFeature.h" -#include "RimEclipseInputProperty.h" -#include "RimEclipseInputPropertyCollection.h" -#include "RimExportInputPropertySettings.h" -#include "RimEclipseInputCase.h" +#include "RiaApplication.h" + +#include "RicExportFeatureImpl.h" #include "RifEclipseInputFileTools.h" -#include "RiaApplication.h" +#include "RimEclipseInputCase.h" +#include "RimEclipseInputProperty.h" +#include "RimEclipseInputPropertyCollection.h" +#include "RimExportInputPropertySettings.h" + #include "RiuMainWindow.h" -#include "cafSelectionManager.h" #include "cafPdmUiPropertyViewDialog.h" +#include "cafSelectionManager.h" #include -#include #include +#include CAF_CMD_SOURCE_INIT(RicSaveEclipseInputPropertyFeature, "RicSaveEclipseInputPropertyFeature"); @@ -99,6 +102,8 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked) } caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Eclipse Property to Text File", ""); + RicExportFeatureImpl::configureForExport(&propertyDialog); + if (propertyDialog.exec() == QDialog::Accepted) { bool isOk = RifEclipseInputFileTools::writePropertyToTextFile(exportSettings.fileName, inputReservoir->eclipseCaseData(), 0, inputProperty->resultName, exportSettings.eclipseKeyword); diff --git a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp index b28c89474f..b9ffe7fb15 100644 --- a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp +++ b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp @@ -19,25 +19,27 @@ #include "RicSaveEclipseResultAsInputPropertyExec.h" -#include "RimEclipseCellColors.h" -#include "RimBinaryExportSettings.h" -#include "RimEclipseView.h" -#include "RimEclipseCase.h" +#include "RiaApplication.h" -#include "RigCaseCellResultsData.h" +#include "RicExportFeatureImpl.h" #include "RifEclipseInputFileTools.h" #include "RifReaderInterface.h" -#include "RiaApplication.h" +#include "RigCaseCellResultsData.h" + +#include "RimBinaryExportSettings.h" +#include "RimEclipseCase.h" +#include "RimEclipseCellColors.h" +#include "RimEclipseView.h" + #include "RiuMainWindow.h" #include "cafPdmUiPropertyViewDialog.h" - -#include -#include #include "cafUtils.h" +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -90,6 +92,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo() } caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Binary Eclipse Data to Text File", ""); + RicExportFeatureImpl::configureForExport(&propertyDialog); if (propertyDialog.exec() == QDialog::Accepted) { diff --git a/ApplicationCode/Commands/RicExportFeatureImpl.cpp b/ApplicationCode/Commands/RicExportFeatureImpl.cpp new file mode 100644 index 0000000000..df05e5fd89 --- /dev/null +++ b/ApplicationCode/Commands/RicExportFeatureImpl.cpp @@ -0,0 +1,37 @@ +#include "QDialogButtonBox" +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicExportFeatureImpl.h" + +#include "cafPdmUiPropertyViewDialog.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportFeatureImpl::configureForExport(caf::PdmUiPropertyViewDialog* propertyViewDialog) +{ + QDialogButtonBox* dialogButtonBox = propertyViewDialog->dialogButtonBox(); + + dialogButtonBox->clear(); + + dialogButtonBox->addButton("Export", QDialogButtonBox::AcceptRole); + dialogButtonBox->addButton("Cancel", QDialogButtonBox::RejectRole); +} diff --git a/ApplicationCode/Commands/RicExportFeatureImpl.h b/ApplicationCode/Commands/RicExportFeatureImpl.h new file mode 100644 index 0000000000..9288cb72ea --- /dev/null +++ b/ApplicationCode/Commands/RicExportFeatureImpl.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +namespace caf { + class PdmUiPropertyViewDialog; +} + +//================================================================================================== +/// +//================================================================================================== +class RicExportFeatureImpl +{ +public: + static void configureForExport(caf::PdmUiPropertyViewDialog* propertyViewDialog); +}; diff --git a/ApplicationCode/Commands/RicExportToLasFileFeature.cpp b/ApplicationCode/Commands/RicExportToLasFileFeature.cpp index 2ea0a32da8..ab2fbdf89f 100644 --- a/ApplicationCode/Commands/RicExportToLasFileFeature.cpp +++ b/ApplicationCode/Commands/RicExportToLasFileFeature.cpp @@ -19,6 +19,7 @@ #include "RicExportToLasFileFeature.h" +#include "RicExportFeatureImpl.h" #include "RicExportToLasFileResampleUi.h" #include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" @@ -78,6 +79,7 @@ void RicExportToLasFileFeature::onActionTriggered(bool isChecked) } caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Export Curve Data to LAS file(s)", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + RicExportFeatureImpl::configureForExport(&propertyDialog); propertyDialog.resize(QSize(400, 200)); if (propertyDialog.exec() == QDialog::Accepted && diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.cpp index e53998a216..c4a9d96217 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.cpp @@ -52,7 +52,9 @@ namespace caf //-------------------------------------------------------------------------------------------------- PdmUiPropertyViewDialog::PdmUiPropertyViewDialog(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName) { - initialize(parent, object, windowTitle, uiConfigName, QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + + initialize(parent, object, windowTitle, uiConfigName); } //-------------------------------------------------------------------------------------------------- @@ -61,7 +63,9 @@ PdmUiPropertyViewDialog::PdmUiPropertyViewDialog(QWidget* parent, PdmObject* obj PdmUiPropertyViewDialog::PdmUiPropertyViewDialog(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons) { - initialize(parent, object, windowTitle, uiConfigName, standardButtons); + m_buttonBox = new QDialogButtonBox(standardButtons); + + initialize(parent, object, windowTitle, uiConfigName); } //-------------------------------------------------------------------------------------------------- @@ -75,20 +79,28 @@ PdmUiPropertyViewDialog::~PdmUiPropertyViewDialog() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiPropertyViewDialog::initialize(QWidget* parent, PdmObject* object, const QString& windowTitle, - const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons) +QDialogButtonBox* PdmUiPropertyViewDialog::dialogButtonBox() { - m_pdmObject = object; - m_windowTitle = windowTitle; - m_uiConfigName = uiConfigName; - - setupUi(standardButtons); + return m_buttonBox; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiPropertyViewDialog::setupUi(const QDialogButtonBox::StandardButtons& standardButtons) +void PdmUiPropertyViewDialog::initialize(QWidget* parent, PdmObject* object, const QString& windowTitle, + const QString& uiConfigName) +{ + m_pdmObject = object; + m_windowTitle = windowTitle; + m_uiConfigName = uiConfigName; + + setupUi(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiPropertyViewDialog::setupUi() { setWindowTitle(m_windowTitle); @@ -102,11 +114,12 @@ void PdmUiPropertyViewDialog::setupUi(const QDialogButtonBox::StandardButtons& s m_pdmUiPropertyView->showProperties(m_pdmObject); // Buttons - QDialogButtonBox* buttonBox = new QDialogButtonBox(standardButtons); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + //CAF_ASSERT(m_buttonBox->buttons().size() > 0); - dialogLayout->addWidget(buttonBox); + connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + + dialogLayout->addWidget(m_buttonBox); } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.h index 3cdf73787e..9108406dbc 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyViewDialog.h @@ -54,15 +54,18 @@ public: PdmUiPropertyViewDialog(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons); ~PdmUiPropertyViewDialog(); + QDialogButtonBox* dialogButtonBox(); + private: - void initialize(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName, const QDialogButtonBox::StandardButtons& standardButtons); - void setupUi(const QDialogButtonBox::StandardButtons& standardButtons); + void initialize(QWidget* parent, PdmObject* object, const QString& windowTitle, const QString& uiConfigName); + void setupUi(); private: QString m_windowTitle; QString m_uiConfigName; PdmObject* m_pdmObject; PdmUiPropertyView* m_pdmUiPropertyView; + QDialogButtonBox* m_buttonBox; }; } // End of namespace caf