Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/Application/src/bodypropertyeditor.cpp
3203 views
1
/*****************************************************************************
2
* *
3
* Elmer, A Finite Element Software for Multiphysical Problems *
4
* *
5
* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *
6
* *
7
* This program is free software; you can redistribute it and/or *
8
* modify it under the terms of the GNU General Public License *
9
* as published by the Free Software Foundation; either version 2 *
10
* of the License, or (at your option) any later version. *
11
* *
12
* This program 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 this program (in file fem/GPL-2); if not, write to the *
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
20
* Boston, MA 02110-1301, USA. *
21
* *
22
*****************************************************************************/
23
24
/*****************************************************************************
25
* *
26
* ElmerGUI bodypropertyeditor *
27
* *
28
*****************************************************************************
29
* *
30
* Authors: Mikko Lyly, Juha Ruokolainen and Peter R�back *
31
* Email: [email protected] *
32
* Web: http://www.csc.fi/elmer *
33
* Address: CSC - IT Center for Science Ltd. *
34
* Keilaranta 14 *
35
* 02101 Espoo, Finland *
36
* *
37
* Original Date: 15 Mar 2008 *
38
* *
39
*****************************************************************************/
40
41
#include <QtGui>
42
#include <iostream>
43
#include "mainwindow.h"
44
#include "bodypropertyeditor.h"
45
46
using namespace std;
47
48
BodyPropertyEditor::BodyPropertyEditor(QWidget *parent)
49
: QDialog(parent)
50
{
51
ui.setupUi(this);
52
53
touched = false;
54
55
material = NULL;
56
initial = NULL;
57
force = NULL;
58
equation = NULL;
59
60
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applySlot()));
61
62
connect(ui.discardButton, SIGNAL(clicked()), this, SLOT(discardSlot()));
63
64
connect(ui.materialCombo, SIGNAL(currentTextChanged(const QString)), this,
65
SLOT(materialComboChanged(QString)));
66
67
connect(ui.initialConditionCombo, SIGNAL(currentTextChanged(const QString)), this,
68
SLOT(initialComboChanged(QString)));
69
70
connect(ui.bodyForceCombo, SIGNAL(currentTextChanged(const QString)), this,
71
SLOT(forceComboChanged(QString)));
72
73
connect(ui.equationCombo, SIGNAL(currentTextChanged(const QString)), this,
74
SLOT(equationComboChanged(QString)));
75
76
ui.applyButton->setIcon(QIcon::fromTheme("list-add"));
77
ui.discardButton->setIcon(QIcon::fromTheme("dialog-error-round"));
78
}
79
80
BodyPropertyEditor::~BodyPropertyEditor()
81
{
82
}
83
84
void BodyPropertyEditor::applySlot()
85
{
86
touched = true;
87
this->close();
88
}
89
90
void BodyPropertyEditor::discardSlot()
91
{
92
touched = false;
93
this->close();
94
}
95
96
void BodyPropertyEditor::materialComboChanged(QString text)
97
{
98
emit( BodyMaterialComboChanged(this,text) );
99
}
100
101
void BodyPropertyEditor::initialComboChanged(QString text)
102
{
103
emit( BodyInitialComboChanged(this,text) );
104
}
105
106
void BodyPropertyEditor::forceComboChanged(QString text)
107
{
108
emit( BodyForceComboChanged(this,text) );
109
}
110
111
void BodyPropertyEditor::equationComboChanged(QString text)
112
{
113
emit( BodyEquationComboChanged(this,text) );
114
}
115
116
void BodyPropertyEditor::appendToProject(QDomDocument *projectDoc, QDomElement *item)
117
{
118
projectIO.parentWidget = this;
119
projectIO.appendToProject(projectDoc, item);
120
}
121
122
void BodyPropertyEditor::readFromProject(QDomDocument *projectDoc, QDomElement *item)
123
{
124
projectIO.parentWidget = this;
125
projectIO.readFromProject(projectDoc, item);
126
}
127
128