-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathventanaplanificador.cpp
71 lines (62 loc) · 1.97 KB
/
ventanaplanificador.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
#include "ventanaplanificador.h"
#include "ui_ventanaplanificador.h"
VentanaPlanificador::VentanaPlanificador(QWidget *parent, ListaGalletas* pLista, Empacadora* pEmpacadora,
AlmacenTerminal* pAlmacen) :
QWidget(parent),
ui(new Ui::VentanaPlanificador)
{
ui->setupUi(this);
listaGalletas = pLista;
empacadora = pEmpacadora;
almacen = pAlmacen;
actualizarVentana();
}
VentanaPlanificador::~VentanaPlanificador()
{
delete ui;
}
void VentanaPlanificador::resetearVentana(){
ui->agregar->setEnabled(true);
ui->barraProbabilidades->setValue(0);
ui->aceptar->setEnabled(false);
ui->cuadroLista->setText("");
ui->valorTotal->setText("0");
}
void VentanaPlanificador::on_agregar_clicked()
{
ventanaPaquete = new VentanaPaquete(NULL, listaGalletas);
connect(ventanaPaquete, SIGNAL(actualizarPlanificador()), this, SLOT(actualizarVentana()));
ventanaPaquete->show();
}
void VentanaPlanificador::actualizarVentana(){
ui->barraProbabilidades->setValue(listaGalletas->contarProbabilidades());
ui->cuadroLista->setText(listaGalletas->imprimirLista());
ui->valorTotal->setText(QString::number(listaGalletas->contarTotalRequerido()));
}
void VentanaPlanificador::on_cancelar_clicked()
{
on_limpiar_clicked();
this->close();
}
void VentanaPlanificador::on_barraProbabilidades_valueChanged(int value)
{
if(value == 100){
ui->aceptar->setEnabled(true);
ui->agregar->setEnabled(false);
}
}
void VentanaPlanificador::on_limpiar_clicked()
{
listaGalletas->primerEmpaque = NULL;
ui->aceptar->setEnabled(false);
ui->agregar->setEnabled(true);
actualizarVentana();
}
void VentanaPlanificador::on_aceptar_clicked()
{
empacadora->listaRangos = listaGalletas->construirRangos();
empacadora->monticulosEmpacadora = listaGalletas->generarMonticulos();
almacen->depositos = listaGalletas->generarMonticulos();
emit inicializarCarritos();
this->close();
}