ViewSolutions
1.0.100.30ae2aa
View solutions of qml for quasarapp projects
Toggle main menu visibility
Loading...
Searching...
No Matches
notificationdata.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018-2025 QuasarApp.
3
* Distributed under the GPLv3 software license, see the accompanying
4
* Everyone is permitted to copy and distribute verbatim copies
5
* of this license document, but changing it is not allowed.
6
*/
7
8
#include "
notificationdata.h
"
9
namespace
ViewSolutions
{
10
11
NotificationData::NotificationData
(
const
QString &
title
,
12
const
QString &
text
,
13
const
QString &
img
,
int
type
) {
14
15
_text =
text
;
16
_title =
title
;
17
_img =
img
;
18
_type =
type
;
19
}
20
21
QString
NotificationData::text
()
const
{
22
return
_text;
23
}
24
25
QString
NotificationData::img
()
const
{
26
const
QString imageSrc =
imgSrc
();
27
if
(imageSrc.size())
28
return
imageSrc;
29
30
return
this->getDefaultImage(_type);
31
}
32
33
QString
NotificationData::imgSrc
()
const
{
34
return
_img;
35
}
36
37
QString
NotificationData::title
()
const
{
38
return
_title;
39
}
40
41
bool
NotificationData::operator ==
(
const
NotificationData
&righ) {
42
return
_title == righ._title &&
43
_text == righ._text &&
44
_img == righ._img &&
45
_type == righ._type;
46
}
47
48
bool
NotificationData::operator !=
(
const
NotificationData
&righ) {
49
return
!
operator==
(righ);
50
}
51
52
QString NotificationData::getDefaultImage(
const
int
code)
const
{
53
54
const
auto
notificationType =
static_cast<
NotificationData::Type
>
(code);
55
56
switch
(notificationType) {
57
case
NotificationData::Type::Normal
:
58
return
"qrc:/icons/info"
;
59
case
NotificationData::Type::Warning
:
60
return
"qrc:/icons/warning"
;
61
case
NotificationData::Type::Error
:
62
return
"qrc:/icons/error"
;
63
default
:
64
return
""
;
65
}
66
}
67
68
int
NotificationData::type
()
const
{
69
return
_type;
70
}
71
72
bool
NotificationData::isValid
()
const
{
73
return
_text.size() || _title.size() || _img.size();
74
}
75
76
void
NotificationData::setCode
(
int
code) {
77
_type = code;
78
}
79
}
ViewSolutions::NotificationData::title
Q_INVOKABLE QString title() const
title This method return title of a question/notification object.
Definition
notificationdata.cpp:37
ViewSolutions::NotificationData::NotificationData
NotificationData(const QString &title="", const QString &text="", const QString &img="", int type=Type::Normal)
NotificationData creates a new notification data object.
Definition
notificationdata.cpp:11
ViewSolutions::NotificationData::img
Q_INVOKABLE QString img() const
img This method return url to image of a question/notification object if url is empty then return def...
Definition
notificationdata.cpp:25
ViewSolutions::NotificationData::imgSrc
QString imgSrc() const
imgSrc This method return url to image of a question/notification object.
Definition
notificationdata.cpp:33
ViewSolutions::NotificationData::Type
Type
The Type enum This enum contatins all available types of the notification messages.
Definition
notificationdata.h:36
ViewSolutions::NotificationData::Error
@ Error
This is critical error notifications.
Definition
notificationdata.h:42
ViewSolutions::NotificationData::Warning
@ Warning
This is warning notification.
Definition
notificationdata.h:40
ViewSolutions::NotificationData::Normal
@ Normal
This is message for general notification.
Definition
notificationdata.h:38
ViewSolutions::NotificationData::text
Q_INVOKABLE QString text() const
text This method return main text message of a question/notification object.
Definition
notificationdata.cpp:21
ViewSolutions::NotificationData::setCode
void setCode(int code)
setCode This method sets new code of the question.
Definition
notificationdata.cpp:76
ViewSolutions::NotificationData::operator==
bool operator==(const NotificationData &righ)
Definition
notificationdata.cpp:41
ViewSolutions::NotificationData::isValid
Q_INVOKABLE bool isValid() const
isValid This method return true if this object is valid.
Definition
notificationdata.cpp:72
ViewSolutions::NotificationData::type
Q_INVOKABLE int type() const
type This method return type of the notification message or code of the question.
Definition
notificationdata.cpp:68
ViewSolutions::NotificationData::operator!=
bool operator!=(const NotificationData &righ)
Definition
notificationdata.cpp:48
ViewSolutions
The ViewSolutions namespace.
Definition
avatargenerator.cpp:14
notificationdata.h
ViewSolutions
src
notificationdata.cpp
Generated by
1.18.0