AlarmTreeWidget.h 1.5 KB
Newer Older
Giacomo Strangolino's avatar
Giacomo Strangolino committed
1
2
3
4
5
6
7
8
#ifndef ALARM_TREE_WIDGET_H
#define ALARM_TREE_WIDGET_H

#include "filter.h"
#include <QTreeWidget>
#include <vector>
#include <iostream>

9
10
class CuData;
class AlarmTreeWidgetItem;
Giacomo Strangolino's avatar
Giacomo Strangolino committed
11
12
13
14
15
16
17

using namespace std;

class AlarmTreeWidget : public QTreeWidget
{
    Q_OBJECT
public:
18
19
20
    enum Type {AlarmType, InternalErrorTyp };
    enum columns { DATET, MICROSEC, ALARM, STATUS, ACK, COUNT, LEVEL, SILENCED, DEVICE, MESSAGE };

Giacomo Strangolino's avatar
Giacomo Strangolino committed
21
22
    AlarmTreeWidget(QWidget *parent);
    void applyFilter(AlarmFilter f);
23
    void setType(Type t);
Giacomo Strangolino's avatar
Giacomo Strangolino committed
24
    void removeFilter();
25
    int findPos(time_t ts, const QString& pri, const QString &status);
26
27
28
29

public slots:
    void refresh(const CuData &v);

Giacomo Strangolino's avatar
Giacomo Strangolino committed
30
31
32
33
34
35
protected slots:
    void slotItemEntered(QTreeWidgetItem*,int);
    void openUrl();


signals:
36
    void newAlarmDetected();
Giacomo Strangolino's avatar
Giacomo Strangolino committed
37
38
39
40
41
42
43
44
45
46
47
    void message(const QString& msg);
    void mouseOverItem(bool);
    void silence();
    void ack();

protected:
    void showEvent(QShowEvent *e);
    void mouseMoveEvent(QMouseEvent *event);
    void contextMenuEvent(QContextMenuEvent *);

private:
48
    int m_pri_to_int(const QString& pri) const;
49
    int m_status_to_int(const QString& stat);
50
    void m_remove_stale_items(const QSet<QString> stale_names);
51
    void m_insert_item(const QString &src, const QStringList &list, int index);
52
    QString m_gen_error_item(const CuData& da) const;
53

Giacomo Strangolino's avatar
Giacomo Strangolino committed
54
    bool _filter_enabled;
55
56
    QHash<QString, AlarmTreeWidgetItem*> mItemHash;
    QHash<QString, QSet<QString> >mSrcAlarmHash;
57
    QSet<QString> m_dev_err;
Giacomo Strangolino's avatar
Giacomo Strangolino committed
58

59
    Type m_type;
Giacomo Strangolino's avatar
Giacomo Strangolino committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
};



















#endif