Make it possible to store project file without global path section

If you have a project file with an alias section, this project is not possible to open in previous versions. Add a menu entry in the Testing menu to allow storage without alias.
This commit is contained in:
Magne Sjaastad 2020-01-03 12:16:52 +01:00
parent 5df7700a75
commit 576dfa80ac
4 changed files with 93 additions and 0 deletions

View File

@ -19,6 +19,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowMemoryCleanupDialogFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDefaultDockConfigEclipseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDefaultDockConfigGeoMechFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportObjectAndFieldKeywordsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectNoGlobalPathsFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -41,6 +42,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowMemoryCleanupDialogFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDefaultDockConfigEclipseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDefaultDockConfigGeoMechFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportObjectAndFieldKeywordsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectNoGlobalPathsFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicSaveProjectNoGlobalPathsFeature.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include <QAction>
#include <QDir>
CAF_CMD_SOURCE_INIT( RicSaveProjectNoGlobalPathsFeature, "RicSaveProjectNoGlobalPathsFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSaveProjectNoGlobalPathsFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSaveProjectNoGlobalPathsFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RiaApplication::instance()->project();
if ( proj )
{
proj->writeFile();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSaveProjectNoGlobalPathsFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Save Project (No Global Paths)" );
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 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"
//==================================================================================================
///
//==================================================================================================
class RicSaveProjectNoGlobalPathsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -523,6 +523,8 @@ void RiuMainWindow::createMenus()
testMenu->addAction( cmdFeatureMgr->action( "RicLaunchUnitTestsFeature" ) );
testMenu->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) );
testMenu->addAction( cmdFeatureMgr->action( "RicExportObjectAndFieldKeywordsFeature" ) );
testMenu->addAction( cmdFeatureMgr->action( "RicSaveProjectNoGlobalPathsFeature" ) );
testMenu->addSeparator();
testMenu->addAction( cmdFeatureMgr->action( "RicHoloLensExportToFolderFeature" ) );