1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef FILETEMPLATE_H
22 #define FILETEMPLATE_H
29 #include <QApplication>
30 #include <QStringList>
31 #include <QVBoxLayout>
32 #include <QHBoxLayout>
35 int fileTemplateTest( int argc
, char ** argv
);
36 int fileTemplateTest();
38 ///\todo Improve class structure
46 QString m_DefaultValueEgc
;
47 QString m_DefaultValueOpenFOAM
;
51 QString
getDefaultValue();
58 QVector
<TemplateLine
> m_Lines
;
64 int processTemplate();
65 QString
getContents();
66 void getValuesFromEgc();
70 FileTemplate( QString filename
, QString section
);
72 QVector
<TemplateLine
> getLines();
73 void setLines( QVector
<TemplateLine
> lines
);
76 int open( QString filename
, QString section
);
78 int exportToOpenFOAM( QString filename
);
81 class TemplateFormLayout
: public QFormLayout
86 QVector
<FileTemplate
> m_FileTemplate
;
88 QVector
<QComboBox
*> m_ComboBoxVector
;
89 QVector
<QStringList
> m_ComboboxValues
;
90 QVector
<QLineEdit
*> m_IntLineEditVector
;
91 QVector
<QLineEdit
*> m_DoubleLineEditVector
;
92 QVector
<QLineEdit
*> m_TextLineEditVector
;
93 QVector
<QCheckBox
*> m_CheckBoxVector
;
94 QVector
< QPair
<QString
, QString
> > m_CheckBoxValues
;
95 QVector
<QSpinBox
*> m_SpinBoxVector
;
96 QVector
<QDoubleSpinBox
*> m_DoubleSpinBoxVector
;
99 TemplateFormLayout( QVector
<QString
> filename
, QString section
, char *name
= 0, QWidget
*parent
= 0 );
101 void addComboBox( TemplateLine line
);
102 void addIntLineEdit( TemplateLine line
);
103 void addDoubleLineEdit( TemplateLine line
);
104 void addTextLineEdit( TemplateLine line
);
105 void addCheckBox( TemplateLine line
);
106 void addSpinBox( TemplateLine line
);
107 void addDoubleSpinBox( TemplateLine line
);
109 QString
readComboBox( int idx
);
110 QString
readIntLineEdit( int idx
);
111 QString
readDoubleLineEdit( int idx
);
112 QString
readTextLineEdit( int idx
);
113 QString
readCheckBox( int idx
);
114 QString
readSpinBox( int idx
);
115 QString
readDoubleSpinBox( int idx
);
121 class TemplateDialog
: public QDialog
126 TemplateDialog( QVector
<QString
> files
, QString section
, QWidget
*parent
= 0 );
128 QVector
<QFileInfo
> m_FileInfo
;
129 QVector
<TemplateFormLayout
*> m_TemplateFormLayoutVector
;