blob: c49466d0a91a4c714fd236efa374638e78b406e5 [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
swissChili4b3105a2022-02-22 16:34:39 -080056void Cell::setCode(QString code)
57{
58 _code = code;
59 emit codeChanged(code);
60}
61
62void Cell::setResult(QString result)
63{
64 _result = result;
65 emit resultChanged(result);
66}
swissChilid85daa92022-02-24 15:29:02 -080067
68void Cell::setStatus(int status)
69{
70 _status = status;
71 emit statusChanged(status);
72}
73
74Cell *Cell::cellFromUuid(QUuid uuid)
75{
76 if (_cellUuids.contains(uuid))
77 return _cellUuids[uuid];
78 else
79 return nullptr;
80}