2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 enGits GmbH +
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 #ifndef FILETEMPLATE_H
24 #define FILETEMPLATE_H
31 #include <QApplication>
32 #include <QStringList>
33 #include <QVBoxLayout>
34 #include <QHBoxLayout>
37 int fileTemplateTest( int argc
, char ** argv
);
38 int fileTemplateTest();
40 ///\todo Improve class structure
48 QString m_DefaultValueEgc
;
49 QString m_DefaultValueOpenFOAM
;
53 QString
getDefaultValue();
60 QVector
<TemplateLine
> m_Lines
;
66 int processTemplate();
67 QString
getContents();
68 void getValuesFromEgc();
72 FileTemplate( QString filename
, QString section
);
74 QVector
<TemplateLine
> getLines();
75 void setLines( QVector
<TemplateLine
> lines
);
78 int open( QString filename
, QString section
);
80 int exportToOpenFOAM( QString filename
);
83 class TemplateFormLayout
: public QFormLayout
88 QVector
<FileTemplate
> m_FileTemplate
;
90 QVector
<QComboBox
*> m_ComboBoxVector
;
91 QVector
<QStringList
> m_ComboboxValues
;
92 QVector
<QLineEdit
*> m_IntLineEditVector
;
93 QVector
<QLineEdit
*> m_DoubleLineEditVector
;
94 QVector
<QLineEdit
*> m_TextLineEditVector
;
95 QVector
<QCheckBox
*> m_CheckBoxVector
;
96 QVector
< QPair
<QString
, QString
> > m_CheckBoxValues
;
97 QVector
<QSpinBox
*> m_SpinBoxVector
;
98 QVector
<QDoubleSpinBox
*> m_DoubleSpinBoxVector
;
101 TemplateFormLayout( QVector
<QString
> filename
, QString section
, char *name
= 0, QWidget
*parent
= 0 );
103 void addComboBox( TemplateLine line
);
104 void addIntLineEdit( TemplateLine line
);
105 void addDoubleLineEdit( TemplateLine line
);
106 void addTextLineEdit( TemplateLine line
);
107 void addCheckBox( TemplateLine line
);
108 void addSpinBox( TemplateLine line
);
109 void addDoubleSpinBox( TemplateLine line
);
111 QString
readComboBox( int idx
);
112 QString
readIntLineEdit( int idx
);
113 QString
readDoubleLineEdit( int idx
);
114 QString
readTextLineEdit( int idx
);
115 QString
readCheckBox( int idx
);
116 QString
readSpinBox( int idx
);
117 QString
readDoubleSpinBox( int idx
);
123 class TemplateDialog
: public QDialog
128 TemplateDialog( QVector
<QString
> files
, QString section
, QWidget
*parent
= 0 );
130 QVector
<QFileInfo
> m_FileInfo
;
131 QVector
<TemplateFormLayout
*> m_TemplateFormLayoutVector
;