2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008,2009 Oliver Gloth +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "iooperation.h"
24 #include "guimainwindow.h"
26 #include <QFileDialog>
28 void IOOperation::setFormat(QString format
)
33 void IOOperation::setExtension(QString extension
)
35 extension_txt
= extension
;
38 void IOOperation::readInputFileName()
40 filename
= QFileDialog::getOpenFileName(NULL
,"read file",GuiMainWindow::getCwd(),format_txt
);
41 if (!filename
.isNull()) {
42 GuiMainWindow::setCwd(QFileInfo(filename
).absolutePath());
49 void IOOperation::readOutputFileName()
51 filename
= QFileDialog::getSaveFileName(NULL
,"write file",GuiMainWindow::getCwd(),format_txt
);
52 if (!filename
.isNull()) {
53 GuiMainWindow::setCwd(QFileInfo(filename
).absolutePath());
54 if (filename
.right(4) != extension_txt
.toLower()) {
55 if (filename
.right(4) != extension_txt
.toUpper()) {
56 filename
+= extension_txt
.toLower();
65 void IOOperation::readOutputDirectory()
67 filename
= QFileDialog::getExistingDirectory(NULL
, "write OpenFOAM mesh",GuiMainWindow::getCwd());
68 if (!filename
.isNull()) {
69 GuiMainWindow::setCwd(QFileInfo(filename
).absolutePath());
76 bool IOOperation::isValid()
81 char* IOOperation::getCFileName()
83 return filename
.toAscii().data();
86 QString
IOOperation::getFileName()