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>
33 #include <QFormLayout>
38 #include <QDoubleValidator>
39 #include <QDoubleSpinBox>
42 int fileTemplateTest( int argc
, char ** argv
);
43 int fileTemplateTest();
45 ///\todo Improve class structure
54 QString m_DefaultValueEgc
;
55 QString m_DefaultValueOutput
;
62 QString
getDefaultValue();
70 QVector
<TemplateLine
> m_Lines
;
76 int processTemplate();
77 QString
getContents();
78 void getValuesFromEgc();
82 FileTemplate( QString filename
, QString section
);
84 QVector
<TemplateLine
> getLines();
85 void setLines( QVector
<TemplateLine
> lines
);
88 int open( QString filename
, QString section
);
90 int exportToOpenFOAM( QString filename
);
93 class TemplateFormLayout
: public QFormLayout
98 QVector
<FileTemplate
> m_FileTemplate
;
100 QVector
<QComboBox
*> m_ComboBoxVector
;
101 QVector
<QStringList
> m_ComboboxValues
;
102 QVector
<QLineEdit
*> m_IntLineEditVector
;
103 QVector
<QLineEdit
*> m_DoubleLineEditVector
;
104 QVector
<QLineEdit
*> m_TextLineEditVector
;
105 QVector
<QCheckBox
*> m_CheckBoxVector
;
106 QVector
< QPair
<QString
, QString
> > m_CheckBoxValues
;
107 QVector
<QSpinBox
*> m_SpinBoxVector
;
108 QVector
<QDoubleSpinBox
*> m_DoubleSpinBoxVector
;
111 TemplateFormLayout( QVector
<QString
> filename
, QString section
, char *name
= 0, QWidget
*parent
= 0 );
113 void addComboBox( TemplateLine line
);
114 void addIntLineEdit( TemplateLine line
);
115 void addDoubleLineEdit( TemplateLine line
);
116 void addTextLineEdit( TemplateLine line
);
117 void addCheckBox( TemplateLine line
);
118 void addSpinBox( TemplateLine line
);
119 void addDoubleSpinBox( TemplateLine line
);
121 QString
readComboBox( int idx
);
122 QString
readIntLineEdit( int idx
);
123 QString
readDoubleLineEdit( int idx
);
124 QString
readTextLineEdit( int idx
);
125 QString
readCheckBox( int idx
);
126 QString
readSpinBox( int idx
);
127 QString
readDoubleSpinBox( int idx
);
133 class TemplateDialog
: public QDialog
138 TemplateDialog( QVector
<QString
> files
, QString section
, QWidget
*parent
= 0 );
140 QVector
<QFileInfo
> m_FileInfo
;
141 QVector
<TemplateFormLayout
*> m_TemplateFormLayoutVector
;