limited volume meshing to boundary layer only
[engrid-github.git] / src / libengrid / filetemplate.h
blob4d9cc931ce8807a229b2915a99b903df380cc6c2
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
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. +
11 // + +
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. +
16 // + +
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/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef FILETEMPLATE_H
22 #define FILETEMPLATE_H
24 #include <QString>
25 #include <QVector>
26 #include <QFileInfo>
27 #include <QDialog>
28 #include <QtGui>
29 #include <QApplication>
30 #include <QStringList>
31 #include <QVBoxLayout>
32 #include <QHBoxLayout>
33 #include <QFormLayout>
34 #include <QPair>
35 #include <QComboBox>
36 #include <QLineEdit>
37 #include <QCheckBox>
38 #include <QDoubleValidator>
39 #include <QDoubleSpinBox>
40 #include <QSpinBox>
42 int fileTemplateTest( int argc, char ** argv );
43 int fileTemplateTest();
45 ///\todo Improve class structure
47 class TemplateLine
49 public:
51 QString m_Type;
52 QString m_Name;
53 QString m_Options;
54 QString m_DefaultValueEgc;
55 QString m_DefaultValueOutput;
56 int m_Position;
59 public:
61 void print();
62 QString getDefaultValue();
66 class FileTemplate
68 public:
69 QFileInfo m_FileInfo;
70 QVector <TemplateLine> m_Lines;
71 QString m_InText;
72 QString m_OutText;
73 QString m_Section;
75 private:
76 int processTemplate();
77 QString getContents();
78 void getValuesFromEgc();
80 public:
81 FileTemplate();
82 FileTemplate( QString filename, QString section );
83 void print();
84 QVector <TemplateLine> getLines();
85 void setLines( QVector <TemplateLine> lines );
87 public:
88 int open( QString filename, QString section );
89 int saveEgc();
90 int exportToOpenFOAM( QString filename );
93 class TemplateFormLayout : public QFormLayout
95 Q_OBJECT;
97 private:
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;
110 public:
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 );
129 public:
130 void saveEgc();
133 class TemplateDialog : public QDialog
135 Q_OBJECT;
137 public:
138 TemplateDialog( QVector <QString> files, QString section, QWidget *parent = 0 );
139 private:
140 QVector <QFileInfo> m_FileInfo;
141 QVector <TemplateFormLayout*> m_TemplateFormLayoutVector;
142 private slots:
143 void saveEgc();
146 #endif