-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNotificationWidget.cpp
More file actions
40 lines (32 loc) · 985 Bytes
/
NotificationWidget.cpp
File metadata and controls
40 lines (32 loc) · 985 Bytes
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
#include "../NotificationWidget.h"
namespace BioTracker {
namespace Gui {
NotificationWidget::NotificationWidget(QWidget *parent,
Core::BioTrackerApp &facade)
: QWidget(parent)
, m_ui(parent)
, m_facade(facade) {
}
void NotificationWidget::initConnects() {
}
void NotificationWidget::notify(const std::string &message,
const Core::MessageType type) {
std::stringstream ss;
switch (type) {
case Core::MessageType::FILE_OPEN:
ss << "<span style='color:#4c4cc9;'>" << message << "</span>";
break;
case Core::MessageType::NOTIFICATION:
ss << "<span>" << message << "</span>";
break;
case Core::MessageType::FAIL:
ss << "<span style='color:red; font-weight:bold;'>" << message << "</span>";
break;
default:
assert(false);
}
ss << "<br>";
m_ui.edit_notification->insertHtml(QString(ss.str().c_str()));
}
}
}