diff --git a/ApplicationCode/Application/RiaSummaryCurveDefinition.cpp b/ApplicationCode/Application/RiaSummaryCurveDefinition.cpp index c5bc01f19d..d6027a2d76 100644 --- a/ApplicationCode/Application/RiaSummaryCurveDefinition.cpp +++ b/ApplicationCode/Application/RiaSummaryCurveDefinition.cpp @@ -77,6 +77,32 @@ const std::vector& RiaSummaryCurveDefinition::timeSteps(const RiaSummary return reader->timeSteps(curveDefinition.summaryAddress()); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaSummaryCurveDefinition::curveDefinitionText() const +{ + return RiaSummaryCurveDefinition::curveDefinitionText(summaryCase(), summaryAddress()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaSummaryCurveDefinition::curveDefinitionText(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress) +{ + QString txt; + + if (summaryCase) + { + txt += summaryCase->caseName(); + txt += ", "; + } + + txt += QString::fromStdString(summaryAddress.uiText()); + + return txt; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/RiaSummaryCurveDefinition.h b/ApplicationCode/Application/RiaSummaryCurveDefinition.h index 542506f7ec..a70978bd54 100644 --- a/ApplicationCode/Application/RiaSummaryCurveDefinition.h +++ b/ApplicationCode/Application/RiaSummaryCurveDefinition.h @@ -20,6 +20,8 @@ #include "RifEclipseSummaryAddress.h" +#include + #include #include @@ -42,6 +44,11 @@ public: static void resultValues(const RiaSummaryCurveDefinition& curveDefinition, std::vector* values); static const std::vector& timeSteps(const RiaSummaryCurveDefinition& curveDefinition); + QString curveDefinitionText() const; + +private: + static QString curveDefinitionText(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress); + private: std::pair m_curveDefinition; }; diff --git a/ApplicationCode/ProjectDataModel/RimSummaryCalculationVariable.cpp b/ApplicationCode/ProjectDataModel/RimSummaryCalculationVariable.cpp index 974e8fadad..448f7569fc 100644 --- a/ApplicationCode/ProjectDataModel/RimSummaryCalculationVariable.cpp +++ b/ApplicationCode/ProjectDataModel/RimSummaryCalculationVariable.cpp @@ -91,6 +91,7 @@ void RimSummaryCalculationVariable::fieldChangedByUi(const caf::PdmFieldHandle* dlg.summaryAddressSelection()->setSelectedCurveDefinitions(sumCasePairs); dlg.summaryAddressSelection()->updateConnectedEditors(); + dlg.updateLabel(); } if (dlg.exec() == QDialog::Accepted) diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp index 737536c1f2..a9489d046c 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp @@ -18,10 +18,15 @@ #include "RiuSummaryCurveDefSelectionDialog.h" +#include "RiaSummaryCurveDefinition.h" + +#include "RiuSummaryCurveDefSelection.h" #include "RiuSummaryCurveDefSelectionEditor.h" -#include +#include #include +#include +#include //-------------------------------------------------------------------------------------------------- /// @@ -39,11 +44,22 @@ RiuSummaryCurveDefSelectionDialog::RiuSummaryCurveDefSelectionDialog(QWidget* pa setWindowTitle("Summary Address Selection"); resize(1200, 800); + m_label = new QLabel("", this); + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - mainLayout->addWidget(buttonBox); + QHBoxLayout* labelLayout = new QHBoxLayout(this); + labelLayout->addStretch(1); + labelLayout->addWidget(m_label); + labelLayout->addWidget(buttonBox); + + mainLayout->addLayout(labelLayout); + + m_addrSelWidget->summaryAddressSelection()->setFieldChangedHandler([this]() { this->updateLabel(); }); + + updateLabel(); } //-------------------------------------------------------------------------------------------------- @@ -61,3 +77,26 @@ RiuSummaryCurveDefSelection* RiuSummaryCurveDefSelectionDialog::summaryAddressSe return m_addrSelWidget->summaryAddressSelection(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryCurveDefSelectionDialog::updateLabel() +{ + QString curveAddressText; + std::vector sumCasePairs = this->summaryAddressSelection()->selectedCurveDefinitions(); + if (sumCasePairs.size() == 1) + { + curveAddressText = sumCasePairs.front().curveDefinitionText(); + } + + if (curveAddressText.isEmpty()) + { + curveAddressText = ""; + } + + QString txt = "Selected Address : "; + txt += curveAddressText; + + m_label->setText(txt); +} + diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.h b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.h index b412114962..ba1124f6d7 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.h +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.h @@ -21,6 +21,8 @@ #include #include +class QLabel; + class RiuSummaryCurveDefSelectionEditor; class RiuSummaryCurveDefSelection; @@ -36,6 +38,10 @@ public: RiuSummaryCurveDefSelection* summaryAddressSelection() const; + void updateLabel(); + private: std::unique_ptr m_addrSelWidget; + + QLabel* m_label; };