From e0ff7d78775a005210db8d2395ca7deaa50370af Mon Sep 17 00:00:00 2001
From: Karsten Rink <karsten.rink@ufz.de>
Date: Fri, 30 Nov 2012 14:59:17 +0100
Subject: [PATCH] added licensing information to gui

---
 Gui/DataView/CMakeLists.txt                |  3 +
 Gui/DataView/License.ui                    | 61 ++++++++++++++++++++
 Gui/DataView/LicenseDialog.cpp             | 65 ++++++++++++++++++++++
 Gui/DataView/LicenseDialog.h               | 37 ++++++++++++
 Gui/VtkAct/VtkCustomInteractorStyle.cpp    | 23 +++++++-
 Gui/VtkVis/VtkCompositeSelectionFilter.cpp | 12 ++--
 Gui/mainwindow.cpp                         |  9 ++-
 Gui/mainwindow.h                           |  1 +
 Gui/mainwindow.ui                          | 23 ++++++++
 LICENSE.txt                                |  4 +-
 ThirdParty/quickcheck                      |  2 +-
 11 files changed, 230 insertions(+), 10 deletions(-)
 create mode 100644 Gui/DataView/License.ui
 create mode 100644 Gui/DataView/LicenseDialog.cpp
 create mode 100644 Gui/DataView/LicenseDialog.h

diff --git a/Gui/DataView/CMakeLists.txt b/Gui/DataView/CMakeLists.txt
index 2b1f32a08fa..ff3f6228152 100644
--- a/Gui/DataView/CMakeLists.txt
+++ b/Gui/DataView/CMakeLists.txt
@@ -13,6 +13,7 @@ set( SOURCES
 	GeoTreeModel.cpp
 	GeoTreeView.cpp
 	GMSHPrefsDialog.cpp
+	LicenseDialog.cpp
 	LinearEditDialog.cpp
 	LineEditDialog.cpp
 	ListPropertiesDialog.cpp
@@ -49,6 +50,7 @@ set( MOC_HEADERS
 	GeoTreeModel.h
 	GeoTreeView.h
 	GMSHPrefsDialog.h
+	LicenseDialog.h
 	LinearEditDialog.h
 	LineEditDialog.h
 	ListPropertiesDialog.h
@@ -91,6 +93,7 @@ set( UIS
 	FEMConditionSetup.ui
 	GeoTabWidgetBase.ui
 	GMSHPrefs.ui
+	License.ui
 	LinearEdit.ui
 	LineEdit.ui
 	ModellingTabWidgetBase.ui
diff --git a/Gui/DataView/License.ui b/Gui/DataView/License.ui
new file mode 100644
index 00000000000..1520119967d
--- /dev/null
+++ b/Gui/DataView/License.ui
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>License</class>
+ <widget class="QDialog" name="License">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>610</width>
+    <height>421</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>OpenGeoSys Software License</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTextBrowser" name="licenseTextBrowser"/>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okPushButton">
+       <property name="text">
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Gui/DataView/LicenseDialog.cpp b/Gui/DataView/LicenseDialog.cpp
new file mode 100644
index 00000000000..352c3d63880
--- /dev/null
+++ b/Gui/DataView/LicenseDialog.cpp
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.net)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/LICENSE.txt
+ *
+ * \file LicenseDialog.cpp
+ *
+ * Created on 2012-11-30 by Karsten Rink
+ */
+
+#include "LicenseDialog.h"
+#include <QTextStream>
+
+LicenseDialog::LicenseDialog(QDialog* parent) : QDialog(parent)
+{
+	setupUi(this);
+	this->licenseTextBrowser->setOpenExternalLinks(true);
+	this->setText();
+}
+
+void LicenseDialog::setText()
+{
+	QString text;
+	QTextStream stream(&text);
+	stream << "<p>Copyright (c) 2012, OpenGeoSys Community "
+		   << "(<a href='http://www.opengeosys.org'>http://www.opengeosys.org</a>)<br />"
+		   << "All rights reserved.</p>"
+		   << "<p>Redistribution and use in source and binary forms, with or without"
+		   << "modification, are permitted provided that the following conditions are met:"
+		   << "<ol>"
+		   << "<li>Redistributions of source code must retain the above copyright"
+   		   << "notice, this list of conditions and the following disclaimer.</li>"
+   		   << "<li>Redistributions in binary form must reproduce the above copyright"
+   		   << "notice, this list of conditions and the following disclaimer in the"
+   		   << "documentation and/or other materials provided with the distribution.</li>"
+   		   << "<li>All advertising materials mentioning features or use of this software"
+   		   << "must display the following acknowledgement:" << "<br />"
+   		   << "'This product includes software developed by the OpenGeoSys Community.'</li>"
+   		   << "<li>Neither the name of the OpenGeoSys Community nor the"
+   		   << "names of its contributors may be used to endorse or promote products"
+   		   << "derived from this software without specific prior written permission.</li>"
+   		   << "<li>Attribute the OpenGeoSys Community, preferably citing an appropriate"
+   		   << "paper listed on the OpenGeoSys Community homepage:"
+   		   << "<a href='http://www.opengeosys.org/papers'>http://www.opengeosys.org/papers</a></li>"
+		   << "</ol></p>"
+   		   << "<p>THIS SOFTWARE IS PROVIDED BY THE OpenGeoSys Community ''AS IS'' AND ANY"
+   		   << "EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED"
+   		   << "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE"
+   		   << "DISCLAIMED. IN NO EVENT SHALL THE OpenGeoSys Community BE LIABLE FOR ANY"
+   		   << "DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES"
+   		   << "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;"
+   		   << "LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND"
+   		   << "ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT"
+   		   << "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS"
+   		   << "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>";
+
+	this->licenseTextBrowser->setHtml(*(stream.string()));
+}
+
+void LicenseDialog::on_okPushButton_pressed()
+{
+	this->done(QDialog::Accepted);
+}
+
diff --git a/Gui/DataView/LicenseDialog.h b/Gui/DataView/LicenseDialog.h
new file mode 100644
index 00000000000..ae63fac3cd7
--- /dev/null
+++ b/Gui/DataView/LicenseDialog.h
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.net)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/LICENSE.txt
+ *
+ * \file LicenseDialog.h
+ *
+ * Created on 2012-11-30 by Karsten Rink
+ */
+
+#ifndef LICENSEDIALOG_H
+#define LICENSEDIALOG_H
+
+#include "ui_License.h"
+#include <QDialog>
+
+/**
+ * \brief A dialog window displaying the OGS license information
+ */
+class LicenseDialog : public QDialog, private Ui_License
+{
+	Q_OBJECT
+
+public:
+	LicenseDialog(QDialog* parent = 0);
+	~LicenseDialog() {};
+
+private:
+	void setText();
+
+private slots:
+	void on_okPushButton_pressed();
+
+};
+
+#endif //LICENSEDIALOG_H
diff --git a/Gui/VtkAct/VtkCustomInteractorStyle.cpp b/Gui/VtkAct/VtkCustomInteractorStyle.cpp
index 3f6372661fc..99526e87207 100644
--- a/Gui/VtkAct/VtkCustomInteractorStyle.cpp
+++ b/Gui/VtkAct/VtkCustomInteractorStyle.cpp
@@ -15,6 +15,7 @@
 #include <vtkActor.h>
 #include <vtkAlgorithmOutput.h>
 #include <vtkCamera.h>
+#include <vtkCellData.h>
 #include <vtkCellPicker.h>
 #include <vtkDataSetMapper.h>
 #include <vtkExtractSelection.h>
@@ -181,7 +182,27 @@ void VtkCustomInteractorStyle::OnLeftButtonDown()
 			VtkMeshSource* source = dynamic_cast<VtkMeshSource*>(data_set);
 			if (source)
 				emit elementPicked(source->GetMesh(), picker->GetCellId());
-
+/* test for picking on selection filters
+			else
+			{
+			
+				vtkAlgorithm* data_set = picker->GetActor()->GetMapper()->GetInputConnection(0,0)->GetProducer()
+					                                                    ->GetInputConnection(0,0)->GetProducer()
+																		->GetInputConnection(0,0)->GetProducer()
+																		->GetInputConnection(0,0)->GetProducer()
+																		->GetInputConnection(0,0)->GetProducer()
+																		->GetInputConnection(0,0)->GetProducer();
+				VtkMeshSource* source = dynamic_cast<VtkMeshSource*>(data_set);
+				if (source)
+				{
+					vtkUnstructuredGridAlgorithm* data_set = vtkUnstructuredGridAlgorithm::SafeDownCast(picker->GetActor()->GetMapper()->GetInputConnection(0,0)->GetProducer());
+					vtkUnstructuredGrid* grid = vtkUnstructuredGrid::SafeDownCast(data_set->GetOutputDataObject(0));
+					vtkDataArray* scalar_array = grid->GetCellData()->GetArray("vtkIdFilter_Ids");
+					double test = scalar_array->GetTuple1(picker->GetCellId());
+					emit elementPicked(source->GetMesh(), test);
+				}
+			}
+*/
 			selectedMapper->SetInputConnection(selected->GetProducerPort());
 
 			this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->
diff --git a/Gui/VtkVis/VtkCompositeSelectionFilter.cpp b/Gui/VtkVis/VtkCompositeSelectionFilter.cpp
index 6cbf8ab17c3..07fc1affcbd 100644
--- a/Gui/VtkVis/VtkCompositeSelectionFilter.cpp
+++ b/Gui/VtkVis/VtkCompositeSelectionFilter.cpp
@@ -39,14 +39,16 @@ void VtkCompositeSelectionFilter::init()
 	selFilter->SetInputConnection(_inputAlgorithm->GetOutputPort());
 	selFilter->SetSelectionArray(_selection, thresholdLower, thresholdUpper);
 	selFilter->Update();
-/*
+
 	vtkIdFilter* idFilter = vtkIdFilter::New();
 		idFilter->SetInputConnection(selFilter->GetOutputPort());
-		idFilter->SetPointIds(0);
-		idFilter->SetCellIds(1);
-*/
+		idFilter->PointIdsOn();
+		idFilter->CellIdsOn();
+		idFilter->FieldDataOn();
+		idFilter->Update();
+
 	vtkThreshold* threshold = vtkThreshold::New();
-	threshold->SetInputConnection(selFilter->GetOutputPort());
+	threshold->SetInputConnection(idFilter->GetOutputPort());
 	threshold->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_CELLS, filter_name);
 	threshold->SetSelectedComponent(0);
 	threshold->ThresholdBetween(thresholdLower, thresholdUpper);
diff --git a/Gui/mainwindow.cpp b/Gui/mainwindow.cpp
index c87fc83b18c..6e49cc4a86a 100644
--- a/Gui/mainwindow.cpp
+++ b/Gui/mainwindow.cpp
@@ -29,6 +29,7 @@
 #include "FEMConditionSetupDialog.h"
 //TODO6 #include "OGSFileConverter.h"
 #include "GMSHPrefsDialog.h"
+#include "LicenseDialog.h"
 #include "LineEditDialog.h"
 #include "ListPropertiesDialog.h"
 #include "MshQualitySelectionDialog.h"
@@ -697,6 +698,12 @@ void MainWindow::writeSettings()
 	settings.setValue("windowState", saveState());
 }
 
+void MainWindow::showLicense()
+{
+	LicenseDialog dlg;
+	dlg.exec();
+}
+
 void MainWindow::about()
 {
 	QString ogsVersion = QString(OGS_VERSION_AND_PERSONS);
@@ -716,7 +723,7 @@ void MainWindow::about()
 	about.append(QString("Git branch: %1\n").arg(gitBranch.mid(2)));
 #endif // GIT_BRANCH_INFO
 #endif // OGS_BUILD_INFO
-	QMessageBox::about(this, "About OpenGeoSys-5", about);
+	QMessageBox::about(this, "About OpenGeoSys 6", about);
 }
 
 QMenu* MainWindow::createImportFilesMenu()
diff --git a/Gui/mainwindow.h b/Gui/mainwindow.h
index da76cb9083f..fb03dc7e4fa 100644
--- a/Gui/mainwindow.h
+++ b/Gui/mainwindow.h
@@ -86,6 +86,7 @@ protected slots:
 	/// Calls the diagram prefs dialog from the station list (i.e. for a specific station).
 	void showDiagramPrefsDialog(QModelIndex &index);
 	//TODO6 void showFileConverterDialog();
+	void showLicense();
 	void showLineEditDialog(const std::string &geoName);
 	void showGMSHPrefsDialog();
 	void showMshQualitySelectionDialog(VtkMeshSource* mshSource);
diff --git a/Gui/mainwindow.ui b/Gui/mainwindow.ui
index f965c4eb1e3..28b69705f4b 100644
--- a/Gui/mainwindow.ui
+++ b/Gui/mainwindow.ui
@@ -133,6 +133,7 @@
     <property name="title">
      <string>Help</string>
     </property>
+    <addaction name="actionLicense"/>
     <addaction name="actionAbout"/>
    </widget>
    <addaction name="menu_File"/>
@@ -400,6 +401,11 @@
     <string>File Converter...</string>
    </property>
   </action>
+  <action name="actionLicense">
+   <property name="text">
+    <string>License</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <customwidgets>
@@ -586,6 +592,22 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>actionLicense</sender>
+   <signal>triggered()</signal>
+   <receiver>MainWindowClass</receiver>
+   <slot>showLicense()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>400</x>
+     <y>372</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>open()</slot>
@@ -597,5 +619,6 @@
   <slot>FEMTestStart()</slot>
   <slot>showDiagramPrefsDialog()</slot>
   <slot>about()</slot>
+  <slot>showLicense()</slot>
  </slots>
 </ui>
diff --git a/LICENSE.txt b/LICENSE.txt
index 0a4e4efbbc0..6fd53153405 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.com)
+Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.org)
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -16,7 +16,7 @@ modification, are permitted provided that the following conditions are met:
    derived from this software without specific prior written permission.
 5. Attribute the OpenGeoSys Community, preferably citing an appropriate
    paper listed on the OpenGeoSys Community homepage:
-   http://www.opengeosys.com/papers
+   http://www.opengeosys.org/papers
 
 THIS SOFTWARE IS PROVIDED BY THE OpenGeoSys Community ''AS IS'' AND ANY
 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
diff --git a/ThirdParty/quickcheck b/ThirdParty/quickcheck
index ffe048be480..8822bc07dc9 160000
--- a/ThirdParty/quickcheck
+++ b/ThirdParty/quickcheck
@@ -1 +1 @@
-Subproject commit ffe048be480061f3472d8e7fdb79b54c4b073cce
+Subproject commit 8822bc07dc9557797f5ee9920b64fc34793feb01
-- 
GitLab