tychoGUI  1.0
 All Data Structures Namespaces Files Functions Variables
mainwindow.cpp
Go to the documentation of this file.
1 #include "mainwindow.h"
2 #include "ui_mainwindow.h"
3 #include "help1.h"
4 #include "local_simulation.h"
5 #include "configure_path.h"
6 
7 
8 #include <QFileDialog>
9 #include <QFile>
10 #include <QTextStream>
11 #include <QString>
12 #include <QScrollArea>
13 #include <iostream>
14 
18 MainWindow::MainWindow(QWidget *parent) :
19  QMainWindow(parent),
20  ui(new Ui::MainWindow)
21 {
22  ui->setupUi(this);
23 
24  //scrollbars
25  QScrollArea *const scroll(new QScrollArea);
26  scroll->setWidget(ui->frame);
27  setCentralWidget(scroll);
28 
29 
30  //menus
31  connect(ui->actionQuit_2, SIGNAL(triggered()), this, SLOT(quit()));
32  connect(ui->actionOpen_2, SIGNAL(triggered()), this, SLOT(openfile()));
33  connect(ui->actionSave_Parameterfile, SIGNAL(triggered()), this, SLOT(savefile()));
34  connect(ui->actionLocal_Simulation, SIGNAL(triggered()), this, SLOT(open_local_simulation()));
35  connect(ui->actionReset, SIGNAL(triggered()), this, SLOT(reset_gui()));
36  connect(ui->actionTycho_GUI, SIGNAL(triggered()), this, SLOT(open_about()));
37  connect(ui->actionConfigure_Path, SIGNAL(triggered()), this, SLOT(open_configure_path()));
38 
39 
40  //helpbuttons
41  connect(ui->help_1, SIGNAL(clicked()), this, SLOT(open_help1()));
42  connect(ui->help_2, SIGNAL(clicked()), this, SLOT(open_help2()));
43  connect(ui->help_3, SIGNAL(clicked()), this, SLOT(open_help3()));
44  connect(ui->help_4, SIGNAL(clicked()), this, SLOT(open_help4()));
45  connect(ui->help_5, SIGNAL(clicked()), this, SLOT(open_help5()));
46  connect(ui->help_6, SIGNAL(clicked()), this, SLOT(open_help6()));
47  connect(ui->help_7, SIGNAL(clicked()), this, SLOT(open_help7()));
48  connect(ui->help_8, SIGNAL(clicked()), this, SLOT(open_help8()));
49 
50 
51  //for the IC files and the output directory
53  connect(ui->ic_density, SIGNAL(clicked()), this, SLOT(ic_density()));
54  connect(ui->ic_temperatur, SIGNAL(clicked()), this, SLOT(ic_temperature()));
55  connect(ui->ic_velocity, SIGNAL(clicked()), this, SLOT(ic_velocity()));
56  connect(ui->ic_wind, SIGNAL(clicked()), this, SLOT(ic_wind()));
57  connect(ui->ic_obstacle, SIGNAL(clicked()), this, SLOT(ic_obstacle()));
58  connect(ui->ic_marker, SIGNAL(clicked()), this, SLOT(ic_marker()));
59  connect(ui->ic_soundemitter, SIGNAL(clicked()), this, SLOT(ic_soundemitter()));
60  connect(ui->output_path, SIGNAL(clicked()), this, SLOT(output_path()));
61 
62  //the save, open and reset button on the mainwindow
63  connect(ui->save, SIGNAL(clicked()), this, SLOT(savefile()));
64  connect(ui->open, SIGNAL(clicked()), this, SLOT(openfile()));
65  connect(ui->reset, SIGNAL(clicked()), this, SLOT(reset_gui()));
66 
67  //section to prevent wrong usage
68  ic_logic();
69  connect(ui->initial_conditions, SIGNAL(currentIndexChanged(int)), this, SLOT(ic_logic()));
70 
71  //the inflow settings are disabled by default
72  ui->inflow_velocity->setDisabled(true);
73  ui->inflow_density->setDisabled(true);
74  ui->inflow_temperature->setDisabled(true);
75  ui->wind_boundary_0->setDisabled(true);
76  ui->wind_boundary_1->setDisabled(true);
77  connect(ui->bound_down,SIGNAL(currentIndexChanged(int)), this, SLOT(boundary_logic()));
78  connect(ui->bound_up,SIGNAL(currentIndexChanged(int)), this, SLOT(boundary_logic()));
79  connect(ui->bound_left,SIGNAL(currentIndexChanged(int)), this, SLOT(boundary_logic()));
80  connect(ui->bound_right,SIGNAL(currentIndexChanged(int)), this, SLOT(boundary_logic()));
81  connect(ui->bound_front,SIGNAL(currentIndexChanged(int)), this, SLOT(boundary_logic()));
82  connect(ui->bound_back,SIGNAL(currentIndexChanged(int)), this, SLOT(boundary_logic()));
83 
84  //dimension_logic
86  connect(ui->dimension,SIGNAL(currentIndexChanged(int)), this, SLOT(dimension_logic()));
87 
88  //gravity_logic
89  gravity_logic();
90  connect(ui->gravity_on, SIGNAL(clicked()), this, SLOT(gravity_logic()));
91  connect(ui->gravity_off, SIGNAL(clicked()), this, SLOT(gravity_logic()));
92 
93  //windemitter_logic
95  connect(ui->wind_emitter_on, SIGNAL(clicked()), this, SLOT(windemitter_logic()));
96  connect(ui->wind_emitter_off, SIGNAL(clicked()), this, SLOT(windemitter_logic()));
97 
98  //obstacle_logic
100  connect(ui->obstacle_on, SIGNAL(clicked()), this, SLOT(obstacle_logic()));
101  connect(ui->obstacle_off, SIGNAL(clicked()), this, SLOT(obstacle_logic()));
102 
103  //marker_logic
104  marker_logic();
105  connect(ui->marker_field_on, SIGNAL(clicked()), this, SLOT(marker_logic()));
106  connect(ui->marker_field_off, SIGNAL(clicked()), this, SLOT(marker_logic()));
107 
108  //soundemitter
110  connect(ui->Soundemitter_on, SIGNAL(clicked()), this, SLOT(soundemitter_logic()));
111  connect(ui->Soundemitter_off, SIGNAL(clicked()), this, SLOT(soundemitter_logic()));
112 
113  //soundemitter_part2
115  connect(ui->one_pulse_on, SIGNAL(clicked()), this, SLOT(soundemitter_logic_part2()));
116  connect(ui->one_pulse_off, SIGNAL(clicked()), this, SLOT(soundemitter_logic_part2()));
117 
118  //Aufloesung
119  x_res = 0;
120  y_res = 0;
121  z_res = 0;
122 
124 }
125 
127 {
128  delete ui;
129 }
130 
132 {
133 
134  qApp->exit();
135 }
136 
141 
143  mylocal_simulation->show();
144 }
145 
150 
151  myhelp1 = new help1;
152  myhelp1->show();
153 
154 }
155 
160 
161  myhelp2 = new help2;
162  myhelp2->show();
163 
164 }
165 
170 
171  myhelp3 = new help3;
172  myhelp3->show();
173 
174 }
175 
180 
181  myhelp4 = new help4;
182  myhelp4->show();
183 
184 }
185 
190 
191  myhelp5 = new help5;
192  myhelp5->show();
193 
194 }
195 
200 
201  myhelp6 = new help6;
202  myhelp6->show();
203 
204 }
205 
210 
211  myhelp7 = new help7;
212  myhelp7->show();
213 
214 }
215 
220 
221  myhelp8 = new help8;
222  myhelp8->show();
223 
224 }
225 
230 
231  myabout = new about;
232  myabout->show();
233 
234 }
235 
236 
241 
243  myconfigure_path->show();
244 
245 }