-
Notifications
You must be signed in to change notification settings - Fork 0
/
QtGeneticAlgorithm.cpp
54 lines (45 loc) · 1.36 KB
/
QtGeneticAlgorithm.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
/**
* QtGeneticAlgorithm.cpp
*
* Created on: Aug 9, 2011
* Author: Jeroen Vlek
* Email: [email protected]
* Website: www.perceptivebits.com
* License: Free Beer (Feel free to use it in every
* way possible and if you like it, make
* sure to give me credit and buy me a drink
* if we ever meet ;) )
*/
#include "QtGeneticAlgorithm.h"
#include <iostream>
QtGeneticAlgorithm::QtGeneticAlgorithm(QtEvoPic& gui) : GeneticAlgorithm(gui),
m_turnOn(false)
{
connect(gui.ui.toggleEvolutionButton, SIGNAL(clicked()), this, SLOT(toggle()));
connect(gui.ui.mutationIntervalSlider, SIGNAL(valueChanged(int)), this, SLOT(setMutationInterval(int)) );
connect(gui.ui.moreButton, SIGNAL(clicked()), this, SLOT(incrementDisplaySize()));
connect(gui.ui.lessButton, SIGNAL(clicked()), this, SLOT(decrementDisplaySize()));
}
QtGeneticAlgorithm::~QtGeneticAlgorithm()
{
}
void QtGeneticAlgorithm::toggle()
{
m_turnOn = !m_turnOn;
if(m_turnOn) {
GeneticAlgorithm::start();
}
else {
GeneticAlgorithm::stop();
}
}
void QtGeneticAlgorithm::incrementDisplaySize() {
unsigned int displaySize = Config::GetDisplaySize();
displaySize++;
Config::SetDisplaySize(displaySize);
}
void QtGeneticAlgorithm::decrementDisplaySize() {
unsigned int displaySize = Config::GetDisplaySize();
displaySize--;
Config::SetDisplaySize(displaySize);
}