-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.cpp
47 lines (38 loc) · 987 Bytes
/
window.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
#include "window.h"
Window::Window(Order orderType, Queue& queue, QMutex* mutex, QLabel* customerLabel, QLabel* windowLabel)
: orderType(orderType), queue(queue), mutex(mutex), customerLabel(customerLabel), windowLabel(windowLabel), disabled(false)
{
ID = nextID++;
}
void start_serving();
void stop_serving();
void Window::run()
{
running = true;
while (running && !disabled)
{
if (!queue.getCustomer(orderType)) continue;
emit this->customerVisibleChanged(true, customerLabel);
QThread::msleep(orderType.getDuration() * 1000); // Konwersja z sekund na milisekundy
emit this->customerVisibleChanged(false, customerLabel);
}
}
void Window::disable()
{
disabled = true;
}
void Window::stop_serving()
{
running = false;
}
Order Window::get_order() const
{
return orderType;
}
int Window::getID() const {
return ID;
}
QLabel* Window::getWindowLabel() const {
return windowLabel;
}
int Window::nextID = 1;