mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added dialog for configuration and execution of regression test from
Debug->Regression Test Dialog Generalized read/write of pdm object fields using QSettings
This commit is contained in:
@@ -123,7 +123,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
//cvf::Trace::enable(false);
|
||||
|
||||
m_preferences = new RiaPreferences;
|
||||
readPreferences();
|
||||
readFieldsFromApplicationStore(m_preferences);
|
||||
applyPreferences();
|
||||
|
||||
if (useShaders())
|
||||
@@ -287,7 +287,7 @@ bool RiaApplication::loadProject(const QString& projectFileName)
|
||||
// VL check regarding specific order mentioned in comment above...
|
||||
|
||||
m_preferences->lastUsedProjectFileName = projectFileName;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
@@ -472,7 +472,7 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
|
||||
m_project->writeFile();
|
||||
|
||||
m_preferences->lastUsedProjectFileName = fileName;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -695,7 +695,7 @@ void RiaApplication::setActiveReservoirView(RimReservoirView* rv)
|
||||
void RiaApplication::setUseShaders(bool enable)
|
||||
{
|
||||
m_preferences->useShaders = enable;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -727,7 +727,7 @@ RiaApplication::RINavigationPolicy RiaApplication::navigationPolicy() const
|
||||
void RiaApplication::setShowPerformanceInfo(bool enable)
|
||||
{
|
||||
m_preferences->showHud = enable;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
}
|
||||
|
||||
|
||||
@@ -870,15 +870,7 @@ bool RiaApplication::parseArguments()
|
||||
|
||||
if (isRunRegressionTest)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if (mainWnd)
|
||||
{
|
||||
mainWnd->hideAllDockWindows();
|
||||
|
||||
runRegressionTest(regressionTestPath);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
executeRegressionTests(regressionTestPath);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1080,12 +1072,12 @@ bool RiaApplication::launchProcessForMultipleCases(const QString& program, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read fields of a Pdm object using QSettings
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::readPreferences()
|
||||
void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object)
|
||||
{
|
||||
QSettings settings;
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
|
||||
m_preferences->fields(fields);
|
||||
object->fields(fields);
|
||||
size_t i;
|
||||
for (i = 0; i < fields.size(); i++)
|
||||
{
|
||||
@@ -1102,12 +1094,14 @@ void RiaApplication::readPreferences()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Write fields of a Pdm object using QSettings
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::writePreferences()
|
||||
void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object)
|
||||
{
|
||||
CVF_ASSERT(object);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
m_preferences->fields(fields);
|
||||
object->fields(fields);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < fields.size(); i++)
|
||||
@@ -1769,3 +1763,20 @@ void RiaApplication::executeCommandObjects()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if (mainWnd)
|
||||
{
|
||||
mainWnd->hideAllDockWindows();
|
||||
|
||||
runRegressionTest(regressionTestPath);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,8 @@ public:
|
||||
|
||||
bool parseArguments();
|
||||
|
||||
void executeRegressionTests(const QString& regressionTestPath);
|
||||
|
||||
void setActiveReservoirView(RimReservoirView*);
|
||||
RimReservoirView* activeReservoirView();
|
||||
const RimReservoirView* activeReservoirView() const;
|
||||
@@ -124,8 +126,8 @@ public:
|
||||
void terminateProcess();
|
||||
|
||||
RiaPreferences* preferences();
|
||||
void readPreferences();
|
||||
void writePreferences();
|
||||
void readFieldsFromApplicationStore(caf::PdmObject* object);
|
||||
void writeFieldsToApplicationStore(const caf::PdmObject* object);
|
||||
void applyPreferences();
|
||||
|
||||
cvf::Font* standardFont();
|
||||
|
||||
60
ApplicationCode/Application/RiaRegressionTest.cpp
Normal file
60
ApplicationCode/Application/RiaRegressionTest.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaRegressionTest.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRegressionTest::RiaRegressionTest(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Application Working Folder", "", "", "");
|
||||
applicationWorkingFolder.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
|
||||
regressionTestFolder.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRegressionTest::~RiaRegressionTest(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &applicationWorkingFolder || field == ®ressionTestFolder)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
43
ApplicationCode/Application/RiaRegressionTest.h
Normal file
43
ApplicationCode/Application/RiaRegressionTest.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
class RiaRegressionTest : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RiaRegressionTest(void);
|
||||
virtual ~RiaRegressionTest(void);
|
||||
|
||||
public:
|
||||
caf::PdmField<QString> applicationWorkingFolder;
|
||||
caf::PdmField<QString> regressionTestFolder;
|
||||
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user