-
Notifications
You must be signed in to change notification settings - Fork 0
/
controles.cpp
61 lines (49 loc) · 1.23 KB
/
controles.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
#include "controles.h"
#include "ui_controles.h"
//------------------------------- Constructeur ---------------------------------
Controles::Controles(int iInitLargeur, int iInitIteration, QWidget *parent) :
QWidget(parent, Qt::Tool),
ui(new Ui::Controles),
lectureEnCours(false)
{
ui->setupUi(this);
ui->largeurSlider->setValue(iInitLargeur);
ui->iterationSlider->setValue(iInitIteration);
updateButtonText(false);
}
//------------------------------- Destructeur ----------------------------------
Controles::~Controles()
{
delete ui;
}
//--------------------------------- Méthodes -----------------------------------
void Controles::updateButtonText(bool actif)
{
if(actif)
ui->button->setText("Pause");
else
ui->button->setText("Démarrer");
}
//---------------------------------- Slots -------------------------------------
void Controles::on_button_clicked()
{
lectureEnCours = !lectureEnCours;
updateButtonText(lectureEnCours);
ui->largeurSlider->setEnabled(!lectureEnCours);
if(lectureEnCours)
{
emit lecture();
}
else
{
emit pause();
}
}
void Controles::on_iterationSlider_valueChanged(int value)
{
emit iterationMax(value);
}
void Controles::on_largeurSlider_valueChanged(int value)
{
emit largeur(value);
}