-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
executable file
·78 lines (60 loc) · 1.8 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <QApplication>
#include <QCoreApplication>
#include <QTime>
#include <QDesktopWidget>
#include <QSettings>
#include <QUuid>
#include <QHash>
#include "Settings.h"
#include "Evolution.h"
#include "h_Simulation.h"
#include "Condor.h"
#include "w_MainWindow.h"
void condorMode(Settings* s);
int main(int argc, char **argv)
{
QSettings qSettings("./results/config.ini", QSettings::IniFormat);
Settings* s = new Settings(&qSettings);
switch(s->appMode)
{
case 0:
{
///////////////////////////////////////////////////////
// Graphical Mode
///////////////////////////////////////////////////////
QApplication app(argc, argv);
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
w_MainWindow fenetre(s);
// Move it to the center of the screen
// QRect screenGeometry = QApplication::desktop()->screenGeometry();
// int x = (screenGeometry.width()-fenetre.width()) / 6;
// int y = (screenGeometry.height()-fenetre.height()) / 6;
// fenetre.move(x, y);
// fenetre.show();
fenetre.showMaximized();
app.exec();
break;
}
case 1:
{
///////////////////////////////////////////////////////
// Condor Mode
///////////////////////////////////////////////////////
QCoreApplication app(argc, argv);
// To give unique filenames to Condor files
QUuid randd = QUuid::createUuid();
int a = qHash(randd.toString());
if(argc > 1)
qsrand(a + atoi(argv[1])*1000 + 1);
else
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
Condor cond(s);
cond.launchTest();
break;
}
}
// Update .ini file
s->writeSettingsToFile(&qSettings);
delete s;
return 0;
}