mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -22,22 +22,21 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFormationNamesCollection, "FormationNamesCollectionObject");
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFormationNamesCollection, "FormationNamesCollectionObject" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFormationNamesCollection::RimFormationNamesCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Formations", ":/FormationCollection16x16.png", "", "");
|
||||
CAF_PDM_InitObject( "Formations", ":/FormationCollection16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_formationNamesList, "FormationNamesList", "Formations", "", "", "");
|
||||
m_formationNamesList.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault( &m_formationNamesList, "FormationNamesList", "Formations", "", "", "" );
|
||||
m_formationNamesList.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFormationNamesCollection::~RimFormationNamesCollection()
|
||||
{
|
||||
@@ -45,72 +44,71 @@ RimFormationNamesCollection::~RimFormationNamesCollection()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFormationNamesCollection::readAllFormationNames()
|
||||
{
|
||||
for(RimFormationNames* fmNames: m_formationNamesList)
|
||||
for ( RimFormationNames* fmNames : m_formationNamesList )
|
||||
{
|
||||
fmNames->readFormationNamesFile(nullptr);
|
||||
fmNames->readFormationNamesFile( nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFormationNames* RimFormationNamesCollection::importFiles(const QStringList& fileNames)
|
||||
RimFormationNames* RimFormationNamesCollection::importFiles( const QStringList& fileNames )
|
||||
{
|
||||
QStringList newFileNames;
|
||||
QStringList newFileNames;
|
||||
std::vector<RimFormationNames*> formNamesObjsToReload;
|
||||
size_t formationListBeforeImportCount = m_formationNamesList.size();
|
||||
|
||||
for(const QString& newFileName : fileNames)
|
||||
size_t formationListBeforeImportCount = m_formationNamesList.size();
|
||||
|
||||
for ( const QString& newFileName : fileNames )
|
||||
{
|
||||
bool isFound = false;
|
||||
for(RimFormationNames* fmNames: m_formationNamesList)
|
||||
for ( RimFormationNames* fmNames : m_formationNamesList )
|
||||
{
|
||||
if(fmNames->fileName() == newFileName)
|
||||
if ( fmNames->fileName() == newFileName )
|
||||
{
|
||||
formNamesObjsToReload.push_back(fmNames);
|
||||
formNamesObjsToReload.push_back( fmNames );
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isFound)
|
||||
if ( !isFound )
|
||||
{
|
||||
newFileNames.push_back(newFileName);
|
||||
newFileNames.push_back( newFileName );
|
||||
}
|
||||
}
|
||||
|
||||
for(const QString& newFileName : newFileNames)
|
||||
for ( const QString& newFileName : newFileNames )
|
||||
{
|
||||
RimFormationNames* newFNs = new RimFormationNames;
|
||||
newFNs->setFileName(newFileName);
|
||||
m_formationNamesList.push_back(newFNs);
|
||||
formNamesObjsToReload.push_back(newFNs);
|
||||
newFNs->setFileName( newFileName );
|
||||
m_formationNamesList.push_back( newFNs );
|
||||
formNamesObjsToReload.push_back( newFNs );
|
||||
}
|
||||
|
||||
QString totalErrorMessage;
|
||||
|
||||
for (RimFormationNames* fmNames: formNamesObjsToReload)
|
||||
for ( RimFormationNames* fmNames : formNamesObjsToReload )
|
||||
{
|
||||
QString errormessage;
|
||||
|
||||
fmNames->readFormationNamesFile(&errormessage);
|
||||
if (!errormessage.isEmpty())
|
||||
fmNames->readFormationNamesFile( &errormessage );
|
||||
if ( !errormessage.isEmpty() )
|
||||
{
|
||||
totalErrorMessage += "\nError in: " + fmNames->fileName()
|
||||
+ "\n\t" + errormessage;
|
||||
totalErrorMessage += "\nError in: " + fmNames->fileName() + "\n\t" + errormessage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!totalErrorMessage.isEmpty())
|
||||
if ( !totalErrorMessage.isEmpty() )
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Import Formation Names", totalErrorMessage);
|
||||
QMessageBox::warning( nullptr, "Import Formation Names", totalErrorMessage );
|
||||
}
|
||||
|
||||
if (m_formationNamesList.size() > formationListBeforeImportCount)
|
||||
if ( m_formationNamesList.size() > formationListBeforeImportCount )
|
||||
{
|
||||
return m_formationNamesList[m_formationNamesList.size() - 1];
|
||||
}
|
||||
@@ -118,16 +116,16 @@ RimFormationNames* RimFormationNamesCollection::importFiles(const QStringList& f
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFormationNamesCollection::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||
void RimFormationNamesCollection::updateFilePathsFromProjectPath( const QString& newProjectPath,
|
||||
const QString& oldProjectPath )
|
||||
{
|
||||
for(RimFormationNames* fmNames: m_formationNamesList)
|
||||
for ( RimFormationNames* fmNames : m_formationNamesList )
|
||||
{
|
||||
fmNames->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
fmNames->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user