blob: bf87abb7447d4e7ea1ef72162e1f170a7c49a703 [file] [log] [blame]
swissChili4b3105a2022-02-22 16:34:39 -08001#include "Cell.h"
2
swissChilid85daa92022-02-24 15:29:02 -08003QHash<QUuid, Cell *> Cell::_cellUuids = QHash<QUuid, Cell*>();
4
5Cell::~Cell()
6{
7 _cellUuids.remove(_uuid);
8}
9
swissChili4b3105a2022-02-22 16:34:39 -080010Cell::Cell(QObject *parent) : QObject(parent)
11{
swissChilid85daa92022-02-24 15:29:02 -080012 _cellUuids[_uuid] = this;
swissChili4b3105a2022-02-22 16:34:39 -080013}
14
15Cell::Cell(const Cell &copy, QObject *parent)
16 : Cell(parent)
17{
18 *this = copy;
19}
20
21Cell::Cell(QString code, QString result, QObject *parent)
22 : Cell(parent)
23{
24 setCode(code);
25 setResult(result);
26}
27
28Cell &Cell::operator =(const Cell &copy)
29{
30 setCode(copy.code());
31 setResult(copy.result());
32
33 return *this;
34}
35
36QString Cell::code() const
37{
38 return _code;
39}
40
41QString Cell::result() const
42{
43 return _result;
44}
45
swissChilid85daa92022-02-24 15:29:02 -080046QUuid Cell::uuid() const
47{
48 return _uuid;
49}
50
51int Cell::status() const
52{
53 return _status;
54}
55
swissChiliece1ac82022-02-25 11:20:42 -080056int Cell::resultType() const
57{
58 return _resultType;
59}
60
swissChili4b3105a2022-02-22 16:34:39 -080061void Cell::setCode(QString code)
62{
63 _code = code;
64 emit codeChanged(code);
65}
66
67void Cell::setResult(QString result)
68{
69 _result = result;
70 emit resultChanged(result);
71}
swissChilid85daa92022-02-24 15:29:02 -080072
73void Cell::setStatus(int status)
74{
75 _status = status;
76 emit statusChanged(status);
77}
78
swissChiliece1ac82022-02-25 11:20:42 -080079void Cell::setResultType(int resultType)
80{
81 _resultType = resultType;
82 emit resultTypeChanged(resultType);
83}
84
swissChilid85daa92022-02-24 15:29:02 -080085Cell *Cell::cellFromUuid(QUuid uuid)
86{
87 if (_cellUuids.contains(uuid))
88 return _cellUuids[uuid];
89 else
90 return nullptr;
91}