-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnotificationsmanager.h
More file actions
95 lines (85 loc) · 2.21 KB
/
notificationsmanager.h
File metadata and controls
95 lines (85 loc) · 2.21 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef NOTIFICATIONSMANAGER_H
#define NOTIFICATIONSMANAGER_H
#include "notifydelegate.h"
#include "psynclib.h"
#include <QObject>
#include <QStandardItemModel>
#include <QTableView>
#include <QHeaderView>
#include <QLayout>
#include <QMainWindow>
#include <QLabel>
#include <QPaintEvent>
class PCloudApp;
class NotificationsManager;
class NotificationsWidget : public QWidget
{
Q_OBJECT
public:
explicit NotificationsWidget(NotificationsManager *mngr, int height, QWidget *parent = 0);
protected:
virtual bool eventFilter(QObject *watched, QEvent *event);
private:
NotificationsManager *mngrParent;
};
class CntrWidget : public QWidget //the orange icon counter
{
Q_OBJECT
public:
explicit CntrWidget(QFont fontVal, QWidget *parent = 0);
void setNumNew(int newValue);
protected:
virtual void paintEvent(QPaintEvent *event);
private:
int numNew, radius;
QFont cntrFont;
};
struct actionsManager
{
quint8 actionId;
psync_notification_action_t actionData;
actionsManager()
{
actionId = PNOTIFICATION_ACTION_NONE;
}
actionsManager(quint8 id, psync_notification_action_t data)
{
actionId = id;
actionData = data;
}
};
class NotificationsManager : public QObject
{
Q_OBJECT
public:
explicit NotificationsManager(PCloudApp *a, QObject *parent = 0);
bool updateFlag;
void init();
void clear();
void markRead();
private:
quint8 numRead, dtFontSize;
PCloudApp* app;
actionsManager* actnsMngrArr;
NotifyDelegate *notifyDelegate;
QString textHtmlBeginStr,textHtmlEndStr, dtHtmlBeginStr, dtHtmlEndStr, fldrIconPath;
QLabel *noNtfctnsLabel;
CntrWidget *cntrWid;
QTableView* table;
bool hasTableScrollBar, initRefresh;
NotificationsWidget *notifywin;
QVBoxLayout *layout;
QHBoxLayout *hlayout;
QStandardItemModel *notificationsModel;
quint32 lastNtfctId;
void setTableProps();
void loadModel(psync_notification_list_t* notifications);
void clearModel();
void resetNums();
public slots:
void showNotificationsWin();
void updateNotfctnsModel(int newcnt);
private slots:
void actionExecSlot(const QModelIndex &index);
};
#endif // NOTIFICATIONSMANAGER_H