From bb7400cd1219b8e85db358b0b3ed7601a44cdc63 Mon Sep 17 00:00:00 2001 From: Karsten Rink <karsten.rink@ufz.de> Date: Mon, 6 Oct 2014 11:07:26 +0200 Subject: [PATCH] replaced external call to file converter with instance of transferred dlg --- Applications/DataExplorer/DataExplorer.cmake | 7 +++++++ Applications/DataExplorer/mainwindow.cpp | 22 +++++++------------- Applications/DataExplorer/mainwindow.h | 4 ++-- Applications/DataExplorer/mainwindow.ui | 4 ++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake index 8aba2441034..445a66bb48f 100644 --- a/Applications/DataExplorer/DataExplorer.cmake +++ b/Applications/DataExplorer/DataExplorer.cmake @@ -1,11 +1,15 @@ # Source files SET( SOURCES mainwindow.cpp + ${CMAKE_SOURCE_DIR}/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp + ${CMAKE_SOURCE_DIR}/Applications/Utils/OGSFileConverter/FileListDialog.cpp ) # Moc Header files SET( MOC_HEADERS mainwindow.h + ${CMAKE_SOURCE_DIR}/Applications/Utils/OGSFileConverter/OGSFileConverter.h + ${CMAKE_SOURCE_DIR}/Applications/Utils/OGSFileConverter/FileListDialog.h ) # Header files @@ -16,6 +20,8 @@ SET( HEADERS # UI files SET( UIS mainwindow.ui + ${CMAKE_SOURCE_DIR}/Applications/Utils/OGSFileConverter/OGSFileConverter.ui + ${CMAKE_SOURCE_DIR}/Applications/Utils/OGSFileConverter/FileList.ui ) @@ -44,6 +50,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/DataView/DiagramView ${CMAKE_CURRENT_BINARY_DIR}/VtkVis ${CMAKE_CURRENT_BINARY_DIR}/VtkAct + ${CMAKE_CURRENT_BINARY_DIR}/Applications/Utils/OGSFileConverter ${CMAKE_CURRENT_SOURCE_DIR}/Base ${CMAKE_CURRENT_SOURCE_DIR}/DataView ${CMAKE_CURRENT_SOURCE_DIR}/DataView/StratView diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index 28c14ea7cec..b1d03b794e0 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -95,6 +95,8 @@ #include <vtkRenderer.h> #include <vtkVRMLExporter.h> +#include "Applications/Utils/OGSFileConverter/OGSFileConverter.h" + #ifdef VTKOSGCONVERTER_FOUND #include "vtkOsgConverter.h" #include <OpenSG/OSGCoredNodePtr.h> @@ -893,22 +895,12 @@ void MainWindow::exportBoreholesToGMS(std::string listName, std::string fileName } -void MainWindow::callFileConverter() const +void MainWindow::showFileConverter() const { - if (system(NULL) != 0) // command processor available - { - QSettings settings; - QString converter_path = settings.value("DataExplorerConverterPath").toString(); -#if _WIN32 - converter_path = QString("\"").append(converter_path).append("\""); -#endif - if (!converter_path.isEmpty()) - system(converter_path.toAscii()); - else - OGSError::box("Location of OGS File Converter not specified", "Error"); - } - else - OGSError::box("Error executing OGSFileConverter - no command processor available", "Error"); + OGSFileConverter* dlg = new OGSFileConverter(); + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->show(); + dlg->raise(); } void MainWindow::callGMSH(std::vector<std::string> & selectedGeometries, diff --git a/Applications/DataExplorer/mainwindow.h b/Applications/DataExplorer/mainwindow.h index 0d5704832d3..7b43ea47815 100644 --- a/Applications/DataExplorer/mainwindow.h +++ b/Applications/DataExplorer/mainwindow.h @@ -57,8 +57,6 @@ protected slots: void open(int i = 0); /// Function calls for saving files. void save(); - /// Calls the OGSFileConverter as an external tool - void callFileConverter() const; /// Function calls for generating GMSH files from the GUI void callGMSH(std::vector<std::string> & selectedGeometries, unsigned param1, @@ -85,6 +83,8 @@ protected slots: void showDiagramPrefsDialog(); /// Calls the diagram prefs dialog from the station list (i.e. for a specific station). void showDiagramPrefsDialog(QModelIndex &index); + /// Calls the OGSFileConverter as an external tool + void showFileConverter() const; //TODO6 void showFileConverterDialog(); void showLicense(); void showLineEditDialog(const std::string &geoName); diff --git a/Applications/DataExplorer/mainwindow.ui b/Applications/DataExplorer/mainwindow.ui index a68296411a9..d3db0e16a73 100644 --- a/Applications/DataExplorer/mainwindow.ui +++ b/Applications/DataExplorer/mainwindow.ui @@ -643,7 +643,7 @@ <sender>actionFile_Converter</sender> <signal>triggered()</signal> <receiver>MainWindowClass</receiver> - <slot>callFileConverter()</slot> + <slot>showFileConverter()</slot> <hints> <hint type="sourcelabel"> <x>-1</x> @@ -700,7 +700,7 @@ <slot>showLicense()</slot> <slot>showMergeGeometriesDialog()</slot> <slot>showMeshElementRemovalDialog()</slot> - <slot>callFileConverter()</slot> + <slot>showFileConverter()</slot> <slot>showDataExplorerSettingsDialog()</slot> <slot>showMeshAnalysisDialog()</slot> </slots> -- GitLab