This repository was archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusermsgentry.h
More file actions
138 lines (104 loc) · 2.5 KB
/
usermsgentry.h
File metadata and controls
138 lines (104 loc) · 2.5 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/**
* @file usermsgentry.h
* @brief Declarations for UserMsgEntry class
* @author Nicu Tofan <nicu.tofan@gmail.com>
* @copyright Copyright 2014 piles contributors. All rights reserved.
* This file is released under the
* [MIT License](http://opensource.org/licenses/mit-license.html)
*/
#ifndef GUARD_USERMSGENTRY_H_INCLUDE
#define GUARD_USERMSGENTRY_H_INCLUDE
#include <usermsg/usermsg-config.h>
#include <QString>
#include <QDateTime>
//! user messages mediator
class USERMSG_EXPORT UserMsgEntry {
public:
//! kind of the message
enum Type {
UTERROR = 0,
UTWARNING,
UTINFO,
UTDBG_ERROR,
UTDBG_WARNING,
UTDBG_INFO
};
private:
QString message_; /**< the message */
QDateTime moment_; /**< the time when this occured */
Type type_; /**< the kind */
public:
//! Default constructor.
UserMsgEntry ();
//! Copy constructor.
UserMsgEntry (
const UserMsgEntry & other);
//! Constructor. Sets the message and type.
UserMsgEntry (
Type ty,
const QString & message);
//! Destructor.
virtual ~UserMsgEntry();
//! Get the message.
const QString &
message () const {
return message_;
}
//! Set the message.
void
setMessage (
const QString & value) {
message_ = value;
}
//! Get the moment.
const QDateTime &
moment () const {
return moment_;
}
//! Set the moment.
void
setMoment (
const QDateTime & value) {
moment_ = value;
}
//! Tell if the type is visible or not.
bool
isEnabled () const;
//! Get the type.
Type
type () const {
return type_;
}
//! Set the type.
void
setType (
Type value) {
type_= value;
}
//! Get the name of the type in all-lower-case
QString
typeName () const {
return typeName (type_);
}
//! get the name of the type with first letter in words capitalized
QString
typeNameCap () const {
return typeNameCap (type_);
}
public:
//! Get the name of the type in all-lower-case
static QString
typeName (
Type value);
//! get the name of the type with first letter in words capitalized
static QString
typeNameCap (
Type value);
//! Tell if the type is visible or not.
static bool
isEnabled (
Type value);
protected:
private:
};
#endif // GUARD_USERMSGENTRY_H_INCLUDE