From a695f12a573ad66963b332539af53ded4ef03378 Mon Sep 17 00:00:00 2001 From: Karsten Rink <karsten.rink@ufz.de> Date: Wed, 5 Feb 2014 15:07:20 +0100 Subject: [PATCH] created data explorer settings dialog and added management for converter and gmsh paths --- Gui/DataView/CMakeLists.txt | 3 + Gui/DataView/DataExplorerSettings.ui | 222 ++++++++++++++++++++ Gui/DataView/DataExplorerSettingsDialog.cpp | 69 ++++++ Gui/DataView/DataExplorerSettingsDialog.h | 46 ++++ Gui/mainwindow.cpp | 7 + Gui/mainwindow.h | 1 + Gui/mainwindow.ui | 23 ++ 7 files changed, 371 insertions(+) create mode 100644 Gui/DataView/DataExplorerSettings.ui create mode 100644 Gui/DataView/DataExplorerSettingsDialog.cpp create mode 100644 Gui/DataView/DataExplorerSettingsDialog.h diff --git a/Gui/DataView/CMakeLists.txt b/Gui/DataView/CMakeLists.txt index ef6cceea2e9..5c5317567a6 100644 --- a/Gui/DataView/CMakeLists.txt +++ b/Gui/DataView/CMakeLists.txt @@ -4,6 +4,7 @@ set( SOURCES ColorTableView.cpp CondFromRasterDialog.cpp ConditionWriterDialog.cpp + DataExplorerSettingsDialog.cpp DirectConditionGenerator.cpp ElementTreeModel.cpp ElementTreeView.cpp @@ -49,6 +50,7 @@ set( MOC_HEADERS ColorTableView.h CondFromRasterDialog.h ConditionWriterDialog.h + DataExplorerSettingsDialog.h ElementTreeModel.h ElementTreeView.h FEMConditionSetupDialog.h @@ -102,6 +104,7 @@ set( HEADERS set( UIS CondFromRaster.ui ConditionWriter.ui + DataExplorerSettings.ui FEMConditionSetup.ui GeoOnMeshMapping.ui GeoTabWidgetBase.ui diff --git a/Gui/DataView/DataExplorerSettings.ui b/Gui/DataView/DataExplorerSettings.ui new file mode 100644 index 00000000000..67703a7a356 --- /dev/null +++ b/Gui/DataView/DataExplorerSettings.ui @@ -0,0 +1,222 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DataExplorerSettings</class> + <widget class="QDialog" name="DataExplorerSettings"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>408</width> + <height>255</height> + </rect> + </property> + <property name="windowTitle"> + <string>OGS Data Explorer Settings</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="fcExplLabel"> + <property name="text"> + <string>Path to OGS File Converter:</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="gmshExplLabel"> + <property name="text"> + <string>Path to GMSH:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="gmshPathEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="gmshLabel"> + <property name="text"> + <string>GMSH:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="fcPathEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="fcLabel"> + <property name="text"> + <string>File Converter:</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QPushButton" name="gmshPathButton"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="6" column="1" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="fcPathButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="5" column="0" colspan="3"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Data View Tabs:</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QCheckBox" name="checkBox"> + <property name="text"> + <string>Geometry</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="checkBox_4"> + <property name="text"> + <string>Modelling</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="checkBox_3"> + <property name="text"> + <string>Meshes</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="checkBox_2"> + <property name="text"> + <string>Stations</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="checkBox_5"> + <property name="text"> + <string>Visualization</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="4" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <tabstops> + <tabstop>fcPathButton</tabstop> + <tabstop>gmshPathButton</tabstop> + <tabstop>checkBox</tabstop> + <tabstop>checkBox_2</tabstop> + <tabstop>checkBox_3</tabstop> + <tabstop>checkBox_4</tabstop> + <tabstop>checkBox_5</tabstop> + <tabstop>buttonBox</tabstop> + <tabstop>fcPathEdit</tabstop> + <tabstop>gmshPathEdit</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>DataExplorerSettings</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>DataExplorerSettings</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/Gui/DataView/DataExplorerSettingsDialog.cpp b/Gui/DataView/DataExplorerSettingsDialog.cpp new file mode 100644 index 00000000000..7bf9aa55c76 --- /dev/null +++ b/Gui/DataView/DataExplorerSettingsDialog.cpp @@ -0,0 +1,69 @@ +/** + * \file DataExplorerSettingsDialog.cpp + * \author Karsten Rink + * \date 2014-02-05 + * \brief Implementation of the DataExplorerSettingsDialog class. + * + * \copyright + * Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "DataExplorerSettingsDialog.h" + +#include <QFileDialog> +#include <QSettings> + +// ThirdParty/logog +#include "logog/include/logog.hpp" + +#include "OGSError.h" + + +DataExplorerSettingsDialog::DataExplorerSettingsDialog(QDialog* parent) : QDialog(parent) +{ + setupUi(this); + + QSettings settings("UFZ", "OpenGeoSys"); + this->fcPathEdit->setText(settings.value("DataExplorerConverterPath").toString()); + this->gmshPathEdit->setText(settings.value("DataExplorerGMSHPath").toString()); +} + +DataExplorerSettingsDialog::~DataExplorerSettingsDialog() +{ +} + +void DataExplorerSettingsDialog::on_fcPathButton_clicked() +{ + QSettings settings("UFZ", "OpenGeoSys"); + QString file_name = QFileDialog::getOpenFileName(this, "Select path for OGS File Converter...", + settings.value("DataExplorerConverterPath").toString(), + "OGSFileConverter.exe;;"); + + if (!file_name.isEmpty()) + this->fcPathEdit->setText(file_name); +} + +void DataExplorerSettingsDialog::on_gmshPathButton_clicked() +{ + QSettings settings("UFZ", "OpenGeoSys"); + QString file_name = QFileDialog::getOpenFileName(this, "Select path for GMSH...", + settings.value("DataExplorerGMSHPath").toString(), + "gmsh*;;"); + + if (!file_name.isEmpty()) + this->gmshPathEdit->setText(file_name); +} + +void DataExplorerSettingsDialog::accept() +{ + QSettings settings("UFZ", "OpenGeoSys"); + settings.setValue("DataExplorerConverterPath", this->fcPathEdit->text()); + settings.setValue("DataExplorerGMSHPath", this->gmshPathEdit->text()); + this->done(QDialog::Accepted); +} + + diff --git a/Gui/DataView/DataExplorerSettingsDialog.h b/Gui/DataView/DataExplorerSettingsDialog.h new file mode 100644 index 00000000000..1086fba20c4 --- /dev/null +++ b/Gui/DataView/DataExplorerSettingsDialog.h @@ -0,0 +1,46 @@ +/** + * \file DataExplorerSettingsDialog.h + * \author Karsten Rink + * \date 2014-02-05 + * \brief Definition of the DataExplorerSettingsDialog class. + * + * \copyright + * Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#ifndef DATAEXPLORERSETTINGSDIALOG_H +#define DATAEXPLORERSETTINGSDIALOG_H + +#include "ui_DataExplorerSettings.h" +#include <QDialog> + +/** + * \brief A dialog window for managing general Data Explorer settings + */ +class DataExplorerSettingsDialog : public QDialog, private Ui_DataExplorerSettings +{ + Q_OBJECT + +public: + DataExplorerSettingsDialog(QDialog* parent = 0); + ~DataExplorerSettingsDialog(void); + + +private slots: + void on_fcPathButton_clicked(); + + void on_gmshPathButton_clicked(); + + /// Instructions if the OK-Button has been pressed. + void accept(); + + /// Instructions if the Cancel-Button has been pressed. + void reject() { this->done(QDialog::Rejected); }; + +}; + +#endif //DATAEXPLORERSETTINGSDIALOG_H diff --git a/Gui/mainwindow.cpp b/Gui/mainwindow.cpp index b1d34068341..10df1b1c2ba 100644 --- a/Gui/mainwindow.cpp +++ b/Gui/mainwindow.cpp @@ -31,6 +31,7 @@ //dialogs #include "CondFromRasterDialog.h" #include "ConditionWriterDialog.h" +#include "DataExplorerSettingsDialog.h" #include "DiagramPrefsDialog.h" #include "FEMConditionSetupDialog.h" //TODO6 #include "OGSFileConverter.h" @@ -1263,6 +1264,12 @@ void MainWindow::showVisalizationPrefsDialog() _visPrefsDialog->show(); } +void MainWindow::showDataExplorerSettingsDialog() +{ + DataExplorerSettingsDialog dlg; + dlg.exec(); +} + void MainWindow::FEMTestStart() { } diff --git a/Gui/mainwindow.h b/Gui/mainwindow.h index 2add408b4c3..55552e99595 100644 --- a/Gui/mainwindow.h +++ b/Gui/mainwindow.h @@ -85,6 +85,7 @@ protected slots: void showConditionWriterDialog(); /// Call dialog for creating or modifying FEM conditions. void showCondSetupDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, std::size_t id, bool on_points = false); + void showDataExplorerSettingsDialog(); /// Allows setting the name for a geometric object void showGeoNameDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, std::size_t id); /// Removal of mesh elements based on a number of criteria. diff --git a/Gui/mainwindow.ui b/Gui/mainwindow.ui index 2bfe455ace3..295efc2d5cd 100644 --- a/Gui/mainwindow.ui +++ b/Gui/mainwindow.ui @@ -117,6 +117,7 @@ <property name="title"> <string>Settings</string> </property> + <addaction name="actionData_Explorer_Settings"/> <addaction name="action_VisualisationSettings"/> <addaction name="action_TrackingSettings"/> </widget> @@ -418,6 +419,11 @@ <string>Remove Mesh Elements...</string> </property> </action> + <action name="actionData_Explorer_Settings"> + <property name="text"> + <string>Data Explorer Settings...</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <customwidgets> @@ -668,6 +674,22 @@ </hint> </hints> </connection> + <connection> + <sender>actionData_Explorer_Settings</sender> + <signal>triggered()</signal> + <receiver>MainWindowClass</receiver> + <slot>showDataExplorerSettingsDialog()</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> @@ -683,5 +705,6 @@ <slot>showMergeGeometriesDialog()</slot> <slot>showMeshElementRemovalDialog()</slot> <slot>callFileConverter()</slot> + <slot>showDataExplorerSettingsDialog()</slot> </slots> </ui> -- GitLab