Path: blob/devel/ElmerGUI/Application/src/dynamiceditor.h
3203 views
/*****************************************************************************1* *2* Elmer, A Finite Element Software for Multiphysical Problems *3* *4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *5* *6* This program is free software; you can redistribute it and/or *7* modify it under the terms of the GNU General Public License *8* as published by the Free Software Foundation; either version 2 *9* of the License, or (at your option) any later version. *10* *11* This program is distributed in the hope that it will be useful, *12* but WITHOUT ANY WARRANTY; without even the implied warranty of *13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *14* GNU General Public License for more details. *15* *16* You should have received a copy of the GNU General Public License *17* along with this program (in file fem/GPL-2); if not, write to the *18* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *19* Boston, MA 02110-1301, USA. *20* *21*****************************************************************************/2223/*****************************************************************************24* *25* ElmerGUI dynamiceditor *26* *27*****************************************************************************28* *29* Authors: Mikko Lyly, Juha Ruokolainen and Peter Råback *30* Email: [email protected] *31* Web: http://www.csc.fi/elmer *32* Address: CSC - IT Center for Science Ltd. *33* Keilaranta 14 *34* 02101 Espoo, Finland *35* *36* Original Date: 15 Mar 2008 *37* *38*****************************************************************************/3940#ifndef DYNAMICEDITOR_H41#define DYNAMICEDITOR_H4243enum BodyTypes {44BODY_MATERIAL,45BODY_INITIAL,46BODY_FORCE,47BODY_EQUATION48};4950enum MatTypes {51MAT_APPLY,52MAT_OK,53MAT_NEW,54MAT_DELETE55};5657// #ifndef WITH_QT558#include <QWidget>59#include <QtGui>60#include <QIcon>61#include <QDomDocument>62#include <QLayout>63// #else64// #include <QtGui>65// #include <QIcon>66// #include <QDomDocument>67// #include <QLayout>68// #endif6970#if WITH_QT5 || WITH_QT671#include <QtWidgets>72#endif7374class QTabWidget;75class QPushButton;7677class hash_entry_t78{79public:80QWidget *widget,*label;81QDomElement elem;82};8384class DynLineEdit : public QWidget85{86Q_OBJECT8788public:89DynLineEdit(QWidget *parent=0);90~DynLineEdit();91QString name;92QLineEdit *lineEdit;9394private:95QTextEdit *textEdit;96QLabel *label;97QFrame *frame;98QLayout *layout;99QPushButton *closeButton;100101private slots:102void editSlot();103void lineEditClose();104};105106class DynamicEditor : public QWidget107{108Q_OBJECT109110public:111DynamicEditor(QWidget *parent = 0);112~DynamicEditor();113114QSize minimumSizeHint() const;115QSize sizeHint() const;116117void setupTabs(QDomDocument *doc, const QString &Section, int ID);118119QTabWidget *tabWidget;120QLineEdit *nameEdit;121int tabs;122123QGroupBox *spareBox;124QScrollArea *spareScroll;125126QPushButton *whatsThisButton;127QPushButton *okButton;128QPushButton *newButton;129QPushButton *applyButton;130QPushButton *spareButton;131QPushButton *discardButton;132133QAction *menuAction; // action for menu item134int ID; // id in propertyarray135136bool touched;137138QHash<QString, hash_entry_t> hash;139140void dumpHash(QDomDocument*, QDomElement*);141void populateHash(QDomElement*);142143signals:144void dynamicEditorReady(int, int);145void dynamicEditorSpareButtonClicked(int, int);146147private slots:148void whatsThisButtonClicked();149void okButtonClicked();150void newButtonClicked();151void applyButtonClicked();152void discardButtonClicked();153void spareButtonClicked();154void lSlot(int);155void comboSlot(QString);156void textChangedSlot(QString);157158private:159hash_entry_t h;160161QIcon newIcon;162QIcon addIcon;163QIcon okIcon;164QIcon removeIcon;165166QDomElement root;167QDomElement all_stuff;168QDomElement element;169QDomElement name;170QDomElement section;171QDomElement param;172};173174#endif // DYNAMICEDITOR_H175176177