mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
File - Import: Add "Import Pressure Depth Data"
* #9944 Add "Import Pressure Depth Data" to import menu Remove obsolete *InMenuFeatures and set all actions in menu to enabled when the signal aboutToShow() is triggered. This is useful for menus where no selection/context is available. * Use RiaApplication::enableDevelopmentFeatures() to control visibility
This commit is contained in:
parent
07a4c13dd4
commit
74fa621332
@ -19,9 +19,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCaseFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCasesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataInMenuFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedFmuDataFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedFmuDataInMenuFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportGeneralDataFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFeatureImpl.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.h
|
||||
@ -110,9 +108,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCasesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataInMenuFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedFmuDataFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedFmuDataInMenuFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportGeneralDataFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFeatureImpl.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.cpp
|
||||
|
@ -1,62 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicImportObservedDataInMenuFeature.h"
|
||||
|
||||
#include "RicImportObservedDataFeature.h"
|
||||
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryObservedDataFile.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportObservedDataInMenuFeature, "RicImportObservedDataInMenuFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicImportObservedDataInMenuFeature::RicImportObservedDataInMenuFeature()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportObservedDataInMenuFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedDataInMenuFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicImportObservedDataFeature::selectObservedDataFileInDialog();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedDataInMenuFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/ObservedDataFile16x16.png" ) );
|
||||
actionToSetup->setText( "Import Observed Data" );
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicImportObservedDataInMenuFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicImportObservedDataInMenuFeature();
|
||||
|
||||
private:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -1,62 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicImportObservedFmuDataInMenuFeature.h"
|
||||
|
||||
#include "RicImportObservedFmuDataFeature.h"
|
||||
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryObservedDataFile.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportObservedFmuDataInMenuFeature, "RicImportObservedFmuDataInMenuFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicImportObservedFmuDataInMenuFeature::RicImportObservedFmuDataInMenuFeature()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportObservedFmuDataInMenuFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedFmuDataInMenuFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicImportObservedFmuDataFeature::selectObservedDataPathInDialog();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedFmuDataInMenuFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/ObservedDataFile16x16.png" ) );
|
||||
actionToSetup->setText( "Import Observed FMU Data" );
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor 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"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicImportObservedFmuDataInMenuFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicImportObservedFmuDataInMenuFeature();
|
||||
|
||||
private:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -64,6 +64,7 @@
|
||||
#include "RiuResultInfoPanel.h"
|
||||
#include "RiuResultQwtPlot.h"
|
||||
#include "RiuToolTipMenu.h"
|
||||
#include "RiuTools.h"
|
||||
#include "RiuTreeViewEventFilter.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
@ -475,11 +476,14 @@ void RiuMainWindow::createMenus()
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicImportWellMeasurementsFeature" ) );
|
||||
|
||||
importMenu->addSeparator();
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataInMenuFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataInMenuFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportPressureDepthDataFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportFormationNamesFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportSurfacesFeature" ) );
|
||||
|
||||
RiuTools::enableAllActionsOnShow( this, importMenu );
|
||||
|
||||
QMenu* exportMenu = fileMenu->addMenu( "&Export" );
|
||||
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToFileFeature" ) );
|
||||
exportMenu->addAction( m_snapshotAllViewsToFile );
|
||||
|
@ -751,10 +751,11 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
QAction* exportLayoutAction = m_windowMenu->addAction( "Export Layout to Clipboard" );
|
||||
connect( exportLayoutAction, SIGNAL( triggered() ), this, SLOT( exportDockLayout() ) );
|
||||
#endif
|
||||
if ( RiaApplication::enableDevelopmentFeatures() )
|
||||
{
|
||||
QAction* exportLayoutAction = m_windowMenu->addAction( "Export Layout to Clipboard" );
|
||||
connect( exportLayoutAction, SIGNAL( triggered() ), this, SLOT( exportDockLayout() ) );
|
||||
}
|
||||
|
||||
m_windowMenu->addSeparator();
|
||||
QAction* cascadeWindowsAction = new QAction( "Cascade Windows", this );
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "RiuMessagePanel.h"
|
||||
#include "RiuMultiPlotPage.h"
|
||||
#include "RiuToolTipMenu.h"
|
||||
#include "RiuTools.h"
|
||||
#include "RiuTreeViewEventFilter.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
|
||||
@ -335,10 +336,13 @@ void RiuPlotMainWindow::createMenus()
|
||||
importWellMenu->addAction( cmdFeatureMgr->action( "RicImportEnsembleWellLogsFeature" ) );
|
||||
|
||||
importMenu->addSeparator();
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataInMenuFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataInMenuFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportPressureDepthDataFeature" ) );
|
||||
importMenu->addAction( cmdFeatureMgr->action( "RicImportFormationNamesFeature" ) );
|
||||
|
||||
RiuTools::enableAllActionsOnShow( this, importMenu );
|
||||
|
||||
QMenu* exportMenu = fileMenu->addMenu( "&Export" );
|
||||
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToFileFeature" ) );
|
||||
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToPdfFeature" ) );
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#include "RiuTools.h"
|
||||
|
||||
#include "QMenu"
|
||||
#include "QObject"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -27,3 +30,18 @@ Qt::WindowFlags RiuTools::defaultDialogFlags()
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// When a cafCmdFeature is used to create an action, the enable state is controlled by cafCmdFeature::isCommandEnabled(). If an action is
|
||||
/// used in menus with no selection/context available, the enable state can be forced on before the menu is displayed.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuTools::enableAllActionsOnShow( QObject* object, QMenu* menu )
|
||||
{
|
||||
if ( object && menu )
|
||||
{
|
||||
object->connect( menu, &QMenu::aboutToShow, [menu]() {
|
||||
for ( auto act : menu->actions() )
|
||||
act->setEnabled( true );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,11 @@
|
||||
|
||||
#include "qnamespace.h"
|
||||
|
||||
class QMenu;
|
||||
class QObject;
|
||||
|
||||
namespace RiuTools
|
||||
{
|
||||
Qt::WindowFlags defaultDialogFlags();
|
||||
void applyGuiTheme();
|
||||
void enableAllActionsOnShow( QObject* object, QMenu* menu );
|
||||
} // end namespace RiuTools
|
||||
|
Loading…
Reference in New Issue
Block a user