/
main.cpp
28 lines (25 loc) · 1.46 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "model/model.h"
#include "view/mainwindow.h"
#include "controller/controller.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Model model;
model.population = 0;
MainWindow view(&model);
Controller controller(&model);
qRegisterMetaType<vectorSquares>("vectorSquares");
qRegisterMetaType<vectorPairs>("vectorPairs");
QObject::connect(&controller, SIGNAL(stepSimulationStarted()), &view, SIGNAL(activateStepButtons()));
QObject::connect(&controller, SIGNAL(continousSimulationStarted()), &view, SIGNAL(activateContinousButtons()));
QObject::connect(&controller, SIGNAL(simulationReseted()), &view, SIGNAL(simulationReseted()));
QObject::connect(&controller, SIGNAL(drawFitnessGraph(double,double,double,int)), &view, SLOT(drawFitnessGraph(double,double,double,int)));
QObject::connect(&controller, SIGNAL(drawNumberOfIndivuals(vectorPairs,int)), &view, SLOT(drawNumberOfIndivuals(vectorPairs,int)));
QObject::connect(&controller, SIGNAL(updateBest(vectorSquares)), &view, SIGNAL(updateBest(vectorSquares)));
QObject::connect(&view, SIGNAL(startStepSimulation(Settings)), &controller, SLOT(beginStepSimulation(Settings)));
QObject::connect(&view, SIGNAL(startContinousSimulation(Settings)), &controller, SLOT(beginContinousSimulation(Settings)));
QObject::connect(&view, SIGNAL(resetSimulation()), &controller, SLOT(simulationReset()));
view.show();
return a.exec();
}