-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhistoryitem.h
63 lines (47 loc) · 1.49 KB
/
historyitem.h
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
#ifndef HISTORYITEM_H
#define HISTORYITEM_H
#include <QVariant>
#include <QIcon>
#include "grblinstruction.h"
class HistoryItem{
public:
enum ItemStatus{None, Running, Ok, Error, Cancelled, Reset, Alarm};
explicit HistoryItem(const GrblInstruction &instruction, HistoryItem *parent = nullptr);
explicit HistoryItem(const QString &text = QStringLiteral(""), HistoryItem *parent = nullptr);
~HistoryItem();
ItemStatus status() const;
GrblInstruction *instruction() const;
bool hasInstruction(void);
void setCancelled();
void setOk();
void setError();
void setReset();
void setAlarm();
void addChild(HistoryItem *child);
void deleteFirstChild();
QList<HistoryItem *> childList();
HistoryItem *lastChild();
//Find item corresponding to instruction
HistoryItem* searchItemMatchingInstruction(const GrblInstruction &instructionToLocate);
//Model View related
int childCount() const;
int columnCount() const;
QVariant data(int role) const;
int row() const;
HistoryItem *parentItem();
private:
ItemStatus m_status;
GrblInstruction *m_instruction;
QString m_text;
QList<HistoryItem*> m_childItems;
HistoryItem* m_parentItem;
static QIcon s_iconRunning;
static QIcon s_iconOk;
static QIcon s_iconError;
static QIcon s_iconCancelled;
static QIcon s_iconAlarm;
static QIcon s_iconReset;
static bool iconsInitialized;
static void initializeIcons();
};
#endif // HISTORYITEM_H