Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/Application/src/generalsetup.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 generalsetup *
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 "generalsetup.h"
44
#include <QWhatsThis>
45
46
using namespace std;
47
48
GeneralSetup::GeneralSetup(QWidget *parent)
49
: QDialog(parent)
50
{
51
ui.setupUi(this);
52
53
connect(ui.acceptButton, SIGNAL(clicked()),
54
this, SLOT(acceptButtonClicked()));
55
56
setWindowIcon(QIcon(":/icons/Mesh3D.png"));
57
58
// Set minimum height for free text editors:
59
QTextEdit *te = ui.headerFreeTextEdit;
60
QFont currentFont = te->currentFont();
61
QFontMetrics fontMetrics(currentFont);
62
int fontHeight = fontMetrics.height();
63
64
ui.headerFreeTextEdit->setMinimumHeight(3*fontHeight);
65
ui.simulationFreeTextEdit->setMinimumHeight(3*fontHeight);
66
ui.constantsFreeTextEdit->setMinimumHeight(3*fontHeight);
67
68
ui.acceptButton->setIcon(QIcon::fromTheme("dialog-accept"));
69
70
whatsThisButton = new QPushButton(tr("Whatis"));
71
whatsThisButton->setIcon(QIcon::fromTheme("text-questionmark"));
72
connect(whatsThisButton, SIGNAL(clicked()), this, SLOT(whatsThisButtonClicked()));
73
whatsThisButton->setWhatsThis("Press this button, then click the widget to be explained.");
74
ui.buttonLayout->addWidget(whatsThisButton);
75
}
76
77
GeneralSetup::~GeneralSetup()
78
{
79
}
80
81
void GeneralSetup::acceptButtonClicked()
82
{
83
this->close();
84
}
85
86
void GeneralSetup::appendToProject(QDomDocument *projectDoc, QDomElement *item)
87
{
88
projectIO.parentWidget = this;
89
projectIO.appendToProject(projectDoc, item);
90
}
91
92
void GeneralSetup::readFromProject(QDomDocument *projectDoc, QDomElement *item)
93
{
94
projectIO.parentWidget = this;
95
projectIO.readFromProject(projectDoc, item);
96
}
97
98
void GeneralSetup::whatsThisButtonClicked()
99
{
100
QWhatsThis::enterWhatsThisMode();
101
}
102