fixed edge display for volume cells
[engrid-github.git] / src / libengrid / filetemplate.h
blob2c59003534328cf83a41db505b2f386fec39ad68
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 <QPair>
35 int fileTemplateTest( int argc, char ** argv );
36 int fileTemplateTest();
38 ///\todo Improve class structure
40 class TemplateLine
42 public:
43 QString m_Type;
44 QString m_Name;
45 QString m_Options;
46 QString m_DefaultValueEgc;
47 QString m_DefaultValueOpenFOAM;
48 int m_Position;
49 public:
50 void print();
51 QString getDefaultValue();
54 class FileTemplate
56 public:
57 QFileInfo m_FileInfo;
58 QVector <TemplateLine> m_Lines;
59 QString m_InText;
60 QString m_OutText;
61 QString m_Section;
63 private:
64 int processTemplate();
65 QString getContents();
66 void getValuesFromEgc();
68 public:
69 FileTemplate();
70 FileTemplate( QString filename, QString section );
71 void print();
72 QVector <TemplateLine> getLines();
73 void setLines( QVector <TemplateLine> lines );
75 public:
76 int open( QString filename, QString section );
77 int saveEgc();
78 int exportToOpenFOAM( QString filename );
81 class TemplateFormLayout : public QFormLayout
83 Q_OBJECT;
85 private:
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;
98 public:
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 );
117 public:
118 void saveEgc();
121 class TemplateDialog : public QDialog
123 Q_OBJECT;
125 public:
126 TemplateDialog( QVector <QString> files, QString section, QWidget *parent = 0 );
127 private:
128 QVector <QFileInfo> m_FileInfo;
129 QVector <TemplateFormLayout*> m_TemplateFormLayoutVector;
130 private slots:
131 void saveEgc();
134 #endif