ViewSolutions
1.0.100.30ae2aa
View solutions of qml for quasarapp projects
Toggle main menu visibility
Loading...
Searching...
No Matches
notificationservice.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018-2024 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
#ifndef NOTIFICATIONSERVICE_H
9
#define NOTIFICATIONSERVICE_H
10
11
#include "
imodel.h
"
12
#include "
notificationdata.h
"
13
#include "
historynotificationsmodel.h
"
14
15
#include <QHash>
16
#include <QObject>
17
#include <QQmlEngine>
18
19
namespace
ViewSolutions
{
20
24
using
Listner
= std::function<void(
bool
accept)>;
25
63
class
VIEWSOLUTION_EXPORT
NotificationService:
public
QObject,
public
iModel
64
{
65
Q_OBJECT
66
67
Q_PROPERTY(
NotificationData
notify
READ
notify
NOTIFY
notifyChanged
)
68
Q_PROPERTY(
NotificationData
question
READ
question
NOTIFY
questionChanged
)
69
70
Q_PROPERTY(QObject*
history
READ
history
NOTIFY
notifyChanged
)
71
72
Q_PROPERTY(
int
notificationsCount
READ
notificationsCount
NOTIFY
countNotificationsChanged
)
73
74
public:
79
NotificationData
notify
() const;
80
85
NotificationData
question
() const;
86
91
void
setNotify
(const
NotificationData
&
notify
);
92
99
int
setQuestion
(const
Listner
&listner, const
NotificationData
&
question
);
100
106
Q_INVOKABLE
void
questionComplete
(
bool
accepted,
int
code = 0);
107
115
Q_INVOKABLE
void
setNotify
(const QString& title =
""
,
116
const QString& text =
""
,
117
const QString& img =
""
,
118
int
type =
NotificationData
::Normal);
119
129
Q_INVOKABLE
int
setQuestion
(QObject *listnerObject,
130
const QString &listnerMethod,
131
const QString& title =
""
,
132
const QString& text =
""
,
133
const QString& img =
""
,
134
int
code = 0);
135
144
int
setQuestion
(const
Listner
&listner,
145
const QString& title =
""
,
146
const QString& text =
""
,
147
const QString& img =
""
,
148
int
code = 0);
149
154
static NotificationService*
getService
();
155
160
QObject*
history
() const;
161
165
166
Q_INVOKABLE
void
showHistory
();
167
172
Q_INVOKABLE
int
notificationsCount
() const;
173
174
~NotificationService();
175
176
// iModel interface
177
public:
178
QString
modelId
() const override;
179
180
signals:
184
void
notifyChanged
();
185
189
void
questionChanged
();
190
197
void
questionCompleted
(
bool
accepted,
int
questionCode);
198
203
void
historyListChanged
();
204
209
void
sigShowHistory
();
210
215
void
countNotificationsChanged
();
216
217
private:
218
219
explicit NotificationService(QObject *ptr =
nullptr
);
220
221
222
QHash<
int
,
Listner
> _listners;
223
NotificationData
_question;
224
NotificationData
_notify;
225
HistoryNotificationsModel
* _history =
nullptr
;
226
227
228
};
229
}
230
231
#endif
// NOTIFICATIONSERVICE_H
ViewSolutions::HistoryNotificationsModel
The HistoryNotificationsModel class stores the history of all sent notification messages.
Definition
historynotificationsmodel.h:39
ViewSolutions::NotificationData
The NotificationData class view data for NotificationServiceView. This class contains a structure wit...
Definition
notificationdata.h:28
ViewSolutions::NotificationService::notifyChanged
void notifyChanged()
notifyChanged This signal emited whet the notificator (Ths object) received a new notification messag...
ViewSolutions::NotificationService::setNotify
void setNotify(const NotificationData ¬ify)
setNotify This method add new notification message of application.
Definition
notificationservice.cpp:35
ViewSolutions::NotificationService::sigShowHistory
void sigShowHistory()
sigShowHistory This signal is emitted when the notification history view should be shown (see showHis...
ViewSolutions::NotificationService::questionChanged
void questionChanged()
questionChanged This signal emited whet the notificator (Ths object) received a new question message.
ViewSolutions::NotificationService::notificationsCount
int notificationsCount
Definition
notificationservice.h:72
ViewSolutions::NotificationService::countNotificationsChanged
void countNotificationsChanged()
countNotificationsChanged This signal is emitted when the count of history notifications was changed.
ViewSolutions::NotificationService::question
NotificationData question
Definition
notificationservice.h:68
ViewSolutions::NotificationService::setQuestion
int setQuestion(const Listner &listner, const NotificationData &question)
setQuestion This method sets information of the users question.
Definition
notificationservice.cpp:44
ViewSolutions::NotificationService::questionComplete
Q_INVOKABLE void questionComplete(bool accepted, int code=0)
questionComplete This method is main responce method of the users questions.
Definition
notificationservice.cpp:56
ViewSolutions::NotificationService::notify
NotificationData notify
Definition
notificationservice.h:67
ViewSolutions::NotificationService::history
QObject * history
Definition
notificationservice.h:70
ViewSolutions::NotificationService::showHistory
Q_INVOKABLE void showHistory()
showHistory - This method used for emit signal by which show notification menu.
Definition
notificationservice.cpp:116
ViewSolutions::NotificationService::questionCompleted
void questionCompleted(bool accepted, int questionCode)
questionCompleted This signal emited when youser clcik any buttons on question popup.
ViewSolutions::NotificationService::getService
static NotificationService * getService()
getService This method return instance to notify service.
Definition
notificationservice.cpp:107
ViewSolutions::NotificationService::historyListChanged
void historyListChanged()
historyListChanged This signal is emitted when the notification history list was changed.
ViewSolutions::NotificationService::modelId
QString modelId() const override
modelId returns text model id. override this method to provide access to model in qml or other models...
Definition
notificationservice.cpp:125
ViewSolutions::iModel::iModel
iModel()=default
historynotificationsmodel.h
imodel.h
ViewSolutions
The ViewSolutions namespace.
Definition
avatargenerator.cpp:14
ViewSolutions::Listner
std::function< void(bool accept)> Listner
Listner This is listner lyambda function of user ansver. This function has next signature: void(bool ...
Definition
notificationservice.h:24
notificationdata.h
VIEWSOLUTION_EXPORT
#define VIEWSOLUTION_EXPORT
VIEWSOLUTION_EXPORT marks a symbol as part of the public ViewSolutions API.
Definition
viewsolutions_global.h:33
ViewSolutions
src
notificationservice.h
Generated by
1.18.0