Skip to content

Commit

Permalink
Merge pull request #97 from OPM/dev
Browse files Browse the repository at this point in the history
Update to 0.9.30
  • Loading branch information
magnesj committed Oct 9, 2013
2 parents 921048b + f2451a2 commit f12b04d
Show file tree
Hide file tree
Showing 1,027 changed files with 30,397 additions and 18,736 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ CTest*.cmake

# Target program
/ApplicationCode/ResInsight
/.project
46 changes: 32 additions & 14 deletions ApplicationCode/Adm/ResInsightLicenseText.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2012 Ceetron AS
//
// This library 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.
//
// This library 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.
//
// Copyright (C) 2011-2013 Ceetron AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
108 changes: 78 additions & 30 deletions ApplicationCode/Application/RiaApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -143,12 +143,12 @@ RiaApplication::RiaApplication(int& argc, char** argv)
m_socketServer = new RiaSocketServer( this);
m_workerProcess = NULL;


m_startupDefaultDirectory = QDir::homePath();

#ifdef WIN32
//m_startupDefaultDirectory += "/My Documents/";
m_startupDefaultDirectory = QDir::homePath();
#else
m_startupDefaultDirectory = QDir::currentPath();
#endif

setDefaultFileDialogDirectory("MULTICASEIMPORT", "/");

// The creation of a font is time consuming, so make sure you really need your own font
Expand Down Expand Up @@ -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++)
{
Expand Down Expand Up @@ -444,9 +444,9 @@ bool RiaApplication::saveProjectPromptForFileName()
startPath = app->defaultFileDialogDirectory("BINARY_GRID");
}

startPath += "/ResInsightProject.rip";
startPath += "/ResInsightProject.rsp";

QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save File"), startPath, tr("Project Files (*.rip *.xml)"));
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save File"), startPath, tr("Project Files (*.rsp);;All files(*.*)"));
if (fileName.isEmpty())
{
return false;
Expand All @@ -472,7 +472,7 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
m_project->writeFile();

m_preferences->lastUsedProjectFileName = fileName;
writePreferences();
writeFieldsToApplicationStore(m_preferences);

return true;
}
Expand Down Expand Up @@ -597,13 +597,12 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::openInputEclipseCase(const QString& caseName, const QStringList& caseFileNames)
bool RiaApplication::openInputEclipseCaseFromFileNames(const QStringList& fileNames)
{
RimInputCase* rimInputReservoir = new RimInputCase();
m_project->assignCaseIdToCase(rimInputReservoir);

rimInputReservoir->caseUserDescription = caseName;
rimInputReservoir->openDataFileSet(caseFileNames);
rimInputReservoir->openDataFileSet(fileNames);

RimAnalysisModels* analysisModels = m_project->activeOilField() ? m_project->activeOilField()->analysisModels() : NULL;
if (analysisModels == NULL) return false;
Expand Down Expand Up @@ -662,7 +661,7 @@ void RiaApplication::createLargeResultsMockModel()
//--------------------------------------------------------------------------------------------------
void RiaApplication::createInputMockModel()
{
openInputEclipseCase("Input Mock Debug Model Simple", QStringList("Input Mock Debug Model Simple"));
openInputEclipseCaseFromFileNames(QStringList("Input Mock Debug Model Simple"));
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -695,7 +694,7 @@ void RiaApplication::setActiveReservoirView(RimReservoirView* rv)
void RiaApplication::setUseShaders(bool enable)
{
m_preferences->useShaders = enable;
writePreferences();
writeFieldsToApplicationStore(m_preferences);
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -727,7 +726,7 @@ RiaApplication::RINavigationPolicy RiaApplication::navigationPolicy() const
void RiaApplication::setShowPerformanceInfo(bool enable)
{
m_preferences->showHud = enable;
writePreferences();
writeFieldsToApplicationStore(m_preferences);
}


Expand Down Expand Up @@ -870,15 +869,7 @@ bool RiaApplication::parseArguments()

if (isRunRegressionTest)
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (mainWnd)
{
mainWnd->hideAllDockWindows();

runRegressionTest(regressionTestPath);

mainWnd->loadWinGeoAndDockToolBarLayout();
}
executeRegressionTests(regressionTestPath);

return false;
}
Expand Down Expand Up @@ -1028,7 +1019,7 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar

// Set the LD_LIBRARY_PATH to make the octave plugins find the embedded Qt

QProcessEnvironment penv = m_workerProcess->processEnvironment();
QProcessEnvironment penv = QProcessEnvironment::systemEnvironment();
QString ldPath = penv.value("LD_LIBRARY_PATH", "");

if (ldPath == "") ldPath = QApplication::applicationDirPath();
Expand Down Expand Up @@ -1080,12 +1071,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++)
{
Expand All @@ -1102,12 +1093,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++)
Expand Down Expand Up @@ -1384,7 +1377,11 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
imageCompareReporter.addImageDirectoryComparisonSet(testFolderName.toStdString(), reportBaseFolderName.toStdString(), reportGeneratedFolderName.toStdString(), reportDiffFolderName.toStdString());
}

imageCompareReporter.generateHTMLReport(testDir.filePath(RegTestNames::reportFileName).toStdString());
QString htmlReportFileName = testDir.filePath(RegTestNames::reportFileName);
imageCompareReporter.generateHTMLReport(htmlReportFileName.toStdString());

// Open HTML report
QDesktopServices::openUrl(htmlReportFileName);

// Generate diff images
this->preferences()->resetToDefaults();
Expand All @@ -1403,6 +1400,8 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
}
m_commandQueueLock.unlock();

regressionTestSetFixedSizeForAllViews();

saveSnapshotForAllViews(generatedFolderName);

QDir baseDir(testCaseFolder.filePath(baseFolderName));
Expand Down Expand Up @@ -1769,3 +1768,52 @@ void RiaApplication::executeCommandObjects()
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (mainWnd)
{
mainWnd->hideAllDockWindows();

mainWnd->setDefaultWindowSize();
runRegressionTest(regressionTestPath);

mainWnd->loadWinGeoAndDockToolBarLayout();
}
}


//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::regressionTestSetFixedSizeForAllViews()
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!mainWnd) return;

if (m_project.isNull()) return;

std::vector<RimCase*> projectCases;
m_project->allCases(projectCases);

for (size_t i = 0; i < projectCases.size(); i++)
{
RimCase* ri = projectCases[i];
if (!ri) continue;

for (size_t j = 0; j < ri->reservoirViews().size(); j++)
{
RimReservoirView* riv = ri->reservoirViews()[j];

if (riv && riv->viewer())
{
// This size is set to match the regression test reference images
riv->viewer()->setFixedSize(1000, 745);
}
}
}
}

9 changes: 6 additions & 3 deletions ApplicationCode/Application/RiaApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class RiaApplication : public QApplication

bool parseArguments();

void executeRegressionTests(const QString& regressionTestPath);

void setActiveReservoirView(RimReservoirView*);
RimReservoirView* activeReservoirView();
const RimReservoirView* activeReservoirView() const;
Expand All @@ -86,7 +88,7 @@ class RiaApplication : public QApplication
bool openEclipseCaseFromFile(const QString& fileName);
bool openEclipseCase(const QString& caseName, const QString& caseFileName);
bool addEclipseCases(const QStringList& fileNames);
bool openInputEclipseCase(const QString& caseName, const QStringList& caseFileNames);
bool openInputEclipseCaseFromFileNames(const QStringList& fileNames);

bool loadLastUsedProject();
QString currentProjectFileName() const;
Expand All @@ -103,6 +105,7 @@ class RiaApplication : public QApplication
void saveSnapshotForAllViews(const QString& snapshotFolderName);
void runRegressionTest(const QString& testRootPath);
void updateRegressionTest(const QString& testRootPath );
void regressionTestSetFixedSizeForAllViews();

void processNonGuiEvents();

Expand All @@ -124,8 +127,8 @@ class RiaApplication : public QApplication
void terminateProcess();

RiaPreferences* preferences();
void readPreferences();
void writePreferences();
void readFieldsFromApplicationStore(caf::PdmObject* object);
void writeFieldsToApplicationStore(const caf::PdmObject* object);
void applyPreferences();

cvf::Font* standardFont();
Expand Down
Loading

0 comments on commit f12b04d

Please sign in to comment.