added -pg flag
[engrid.git] / iooperation.cpp
blob92f824f5566340dfb54dfde9c8ed35a51bc506d0
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
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. +
12 // + +
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. +
17 // + +
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/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "iooperation.h"
24 #include "guimainwindow.h"
26 #include <QFileDialog>
28 void IOOperation::setFormat(QString format)
30 format_txt = 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());
43 valid = true;
44 } else {
45 valid = false;
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();
59 valid = true;
60 } else {
61 valid = false;
65 void IOOperation::readOutputDirectory()
67 filename = QFileDialog::getExistingDirectory(NULL, "write OpenFOAM mesh",GuiMainWindow::getCwd());
68 if (!filename.isNull()) {
69 GuiMainWindow::setCwd(QFileInfo(filename).absolutePath());
70 valid = true;
71 } else {
72 valid = false;
76 bool IOOperation::isValid()
78 return valid;
81 char* IOOperation::getCFileName()
83 return filename.toAscii().data();
86 QString IOOperation::getFileName()
88 return filename;