mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 07:56:08 -06:00
Whitespace
This commit is contained in:
parent
4ba6e6959b
commit
f7be3c4bf2
@ -3,17 +3,17 @@
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -31,16 +31,16 @@
|
||||
CAF_PDM_SOURCE_INIT(RimScriptCollection, "ScriptLocation");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimScriptCollection::RimScriptCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("ScriptLocation", ":/Folder.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&directory, "ScriptDirectory", "Dir", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&calcScripts, "CalcScripts", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&directory, "ScriptDirectory", "Dir", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&calcScripts, "CalcScripts", "", "", "", "");
|
||||
calcScripts.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&subDirectories, "SubDirectories", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&subDirectories, "SubDirectories", "", "", "", "");
|
||||
subDirectories.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_searchSubFolders, "SearchSubFolders", false, "Add Subfolders", "", "", "");
|
||||
@ -49,16 +49,16 @@ RimScriptCollection::RimScriptCollection()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimScriptCollection::~RimScriptCollection()
|
||||
{
|
||||
calcScripts.deleteAllChildObjects();
|
||||
subDirectories.deleteAllChildObjects();
|
||||
calcScripts.deleteAllChildObjects();
|
||||
subDirectories.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimScriptCollection::readContentFromDisc()
|
||||
{
|
||||
@ -81,19 +81,19 @@ void RimScriptCollection::readContentFromDisc()
|
||||
|
||||
// Build a list of all scripts in the specified directory
|
||||
{
|
||||
QString filter = "*.m";
|
||||
QString filter = "*.m";
|
||||
QStringList fileList = caf::Utils::getFilesInDirectory(directory, filter, true);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < fileList.size(); i++)
|
||||
{
|
||||
QString fileName = fileList.at(i);
|
||||
const QString& fileName = fileList.at(i);
|
||||
|
||||
if (caf::Utils::fileExists(fileName))
|
||||
{
|
||||
RimCalcScript* calcScript = new RimCalcScript;
|
||||
calcScript->absolutePath = fileName;
|
||||
|
||||
calcScript->absolutePath = fileName;
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
calcScript->setUiName(fi.baseName());
|
||||
|
||||
@ -106,7 +106,7 @@ void RimScriptCollection::readContentFromDisc()
|
||||
|
||||
if (m_searchSubFolders())
|
||||
{
|
||||
QDir dir(directory);
|
||||
QDir dir(directory);
|
||||
QFileInfoList fileInfoList = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable);
|
||||
|
||||
QListIterator<QFileInfo> it(fileInfoList);
|
||||
@ -115,10 +115,10 @@ void RimScriptCollection::readContentFromDisc()
|
||||
QFileInfo fi = it.next();
|
||||
|
||||
RimScriptCollection* scriptLocation = new RimScriptCollection;
|
||||
scriptLocation->directory = fi.absoluteFilePath();
|
||||
scriptLocation->directory = fi.absoluteFilePath();
|
||||
scriptLocation->setUiName(fi.baseName());
|
||||
scriptLocation->readContentFromDisc();
|
||||
|
||||
|
||||
subDirectories.push_back(scriptLocation);
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ void RimScriptCollection::pathsAndSubPaths(QStringList& pathList)
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i= 0; i < this->subDirectories.size(); ++i)
|
||||
for (size_t i = 0; i < this->subDirectories.size(); ++i)
|
||||
{
|
||||
if (this->subDirectories[i])
|
||||
{
|
||||
@ -150,7 +150,7 @@ void RimScriptCollection::pathsAndSubPaths(QStringList& pathList)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimScriptCollection * RimScriptCollection::findScriptCollection(const QString& path)
|
||||
RimScriptCollection* RimScriptCollection::findScriptCollection(const QString& path)
|
||||
{
|
||||
if (!this->directory().isEmpty())
|
||||
{
|
||||
@ -161,9 +161,9 @@ RimScriptCollection * RimScriptCollection::findScriptCollection(const QString& p
|
||||
|
||||
for (size_t i = 0; i < this->subDirectories.size(); ++i)
|
||||
{
|
||||
RimScriptCollection* foundColl = nullptr;
|
||||
if (this->subDirectories[i]) foundColl = this->subDirectories[i]->findScriptCollection(path);
|
||||
if (foundColl) return foundColl;
|
||||
RimScriptCollection* foundColl = nullptr;
|
||||
if (this->subDirectories[i]) foundColl = this->subDirectories[i]->findScriptCollection(path);
|
||||
if (foundColl) return foundColl;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -172,7 +172,9 @@ RimScriptCollection * RimScriptCollection::findScriptCollection(const QString& p
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimScriptCollection::fieldChangedByUi(const caf::PdmFieldHandle *changedField, const QVariant &oldValue, const QVariant &newValue)
|
||||
void RimScriptCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (&directory == changedField)
|
||||
{
|
||||
@ -187,9 +189,11 @@ void RimScriptCollection::fieldChangedByUi(const caf::PdmFieldHandle *changedFie
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimScriptCollection::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
void RimScriptCollection::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &directory)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user