ViewSolutions 1.0.100.30ae2aa
View solutions of qml for quasarapp projects
Loading...
Searching...
No Matches
ViewSolutions::NotificationService Class Reference

The NotificationService class. This class used for working with notify. More...

#include <notificationservice.h>

Inheritance diagram for ViewSolutions::NotificationService:
Inheritance graph
Collaboration diagram for ViewSolutions::NotificationService:
Collaboration graph

Signals

void notifyChanged ()
 notifyChanged This signal emited whet the notificator (Ths object) received a new notification message.
void questionChanged ()
 questionChanged This signal emited whet the notificator (Ths object) received a new question message.
void questionCompleted (bool accepted, int questionCode)
 questionCompleted This signal emited when youser clcik any buttons on question popup.
void historyListChanged ()
 historyListChanged This signal is emitted when the notification history list was changed.
void sigShowHistory ()
 sigShowHistory This signal is emitted when the notification history view should be shown (see showHistory).
void countNotificationsChanged ()
 countNotificationsChanged This signal is emitted when the count of history notifications was changed.

Public Member Functions

NotificationData notify () const
 Notify This method return data of the last notify message.
NotificationData question () const
 question This method return data of the last question.
void setNotify (const NotificationData &notify)
 setNotify This method add new notification message of application.
int setQuestion (const Listner &listner, const NotificationData &question)
 setQuestion This method sets information of the users question.
Q_INVOKABLE void questionComplete (bool accepted, int code=0)
 questionComplete This method is main responce method of the users questions.
Q_INVOKABLE void setNotify (const QString &title="", const QString &text="", const QString &img="", int type=NotificationData::Normal)
 setNotify This method set new notify message for user. When notify changed on main application windows shows notify message.
Q_INVOKABLE int setQuestion (QObject *listnerObject, const QString &listnerMethod, const QString &title="", const QString &text="", const QString &img="", int code=0)
 setQuestion This method set new question for user. When question changed on main application windows shows question.
int setQuestion (const Listner &listner, const QString &title="", const QString &text="", const QString &img="", int code=0)
 setQuestion This method set new question for user. When question changed on main application windows shows question.
QObject * history () const
 history - This method used for return notify history model.
Q_INVOKABLE void showHistory ()
 showHistory - This method used for emit signal by which show notification menu.
Q_INVOKABLE int notificationsCount () const
 notificationsCount - This method used for return count of history notifications.
 ~NotificationService ()
QString modelId () const override
 modelId returns text model id. override this method to provide access to model in qml or other models.
Public Member Functions inherited from ViewSolutions::iModel
 iModel ()=default
virtual ~iModel ()=default
const QWeakPointer< ModelStorage > & storage () const
 storage returns storage object. this method return context of the model's storage.
QQmlEngine * engine () const
 engine returns qml engine.

Static Public Member Functions

static NotificationService * getService ()
 getService This method return instance to notify service.

Properties

NotificationData notify
NotificationData question
QObject * history
int notificationsCount

Additional Inherited Members

Protected Member Functions inherited from ViewSolutions::iModel
virtual void initStorage (const QWeakPointer< ModelStorage > &newStorage)
 initStorage This method is called by storage object after adding model to storage.

Detailed Description

The NotificationService class. This class used for working with notify.

This service displays notifications and questions on the main application window and stores all sent notifications in a history model (see HistoryNotificationsModel).

The service is a singleton - use the getService method to access it.

Example:

// Show a notification:
// Ask a question and wait for the user answer:
[](bool accept) {
if (accept)
qDebug() << "User accepted";
},
"Are you sure?");
void setNotify(const NotificationData &notify)
setNotify This method add new notification message of application.
int setQuestion(const Listner &listner, const NotificationData &question)
setQuestion This method sets information of the users question.
static NotificationService * getService()
getService This method return instance to notify service.

In QML the service is used by the NotificationServiceView component, it must be exposed as the notificationService context property:

engine.rootContext()->setContextProperty("notificationService",
QQmlEngine * engine() const
engine returns qml engine.
Definition imodel.cpp:19
import ViewSolutions
Item {
ViewSolutions.NotificationServiceView {}
}

Definition at line 63 of file notificationservice.h.

Constructor & Destructor Documentation

◆ ~NotificationService()

ViewSolutions::NotificationService::~NotificationService ( )

Definition at line 23 of file notificationservice.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ countNotificationsChanged

void ViewSolutions::NotificationService::countNotificationsChanged ( )
signal

countNotificationsChanged This signal is emitted when the count of history notifications was changed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getService()

NotificationService * ViewSolutions::NotificationService::getService ( )
static

getService This method return instance to notify service.

Returns
pointer to the notification service.

Definition at line 107 of file notificationservice.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ history()

QObject * ViewSolutions::NotificationService::history ( ) const

history - This method used for return notify history model.

Returns
history model of all notify.

Definition at line 112 of file notificationservice.cpp.

◆ historyListChanged

void ViewSolutions::NotificationService::historyListChanged ( )
signal

historyListChanged This signal is emitted when the notification history list was changed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ modelId()

QString ViewSolutions::NotificationService::modelId ( ) const
overridevirtual

modelId returns text model id. override this method to provide access to model in qml or other models.

Returns
model id.

Implements ViewSolutions::iModel.

Definition at line 125 of file notificationservice.cpp.

◆ notificationsCount()

int ViewSolutions::NotificationService::notificationsCount ( ) const

notificationsCount - This method used for return count of history notifications.

Returns
count of history notifications.

Definition at line 120 of file notificationservice.cpp.

◆ notify()

NotificationData ViewSolutions::NotificationService::notify ( ) const

Notify This method return data of the last notify message.

Returns
return data of the last notify message.

Definition at line 27 of file notificationservice.cpp.

◆ notifyChanged

void ViewSolutions::NotificationService::notifyChanged ( )
signal

notifyChanged This signal emited whet the notificator (Ths object) received a new notification message.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ question()

NotificationData ViewSolutions::NotificationService::question ( ) const

question This method return data of the last question.

Returns
question data.

Definition at line 31 of file notificationservice.cpp.

◆ questionChanged

void ViewSolutions::NotificationService::questionChanged ( )
signal

questionChanged This signal emited whet the notificator (Ths object) received a new question message.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ questionComplete()

void ViewSolutions::NotificationService::questionComplete ( bool accepted,
int code = 0 )

questionComplete This method is main responce method of the users questions.

Parameters
acceptedare boolean option. Set this option to true if user click on accept button.
codeare automaticly generated code fo the question.

Definition at line 56 of file notificationservice.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ questionCompleted

void ViewSolutions::NotificationService::questionCompleted ( bool accepted,
int questionCode )
signal

questionCompleted This signal emited when youser clcik any buttons on question popup.

Parameters
acceptedare bool option with "true" value if the yesr click to accept button.
questionCodeare automaticly generated code of the question. For more information about code option see the setQuestion method.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNotify() [1/2]

void ViewSolutions::NotificationService::setNotify ( const NotificationData & notify)

setNotify This method add new notification message of application.

Parameters
notifyare message data.

Definition at line 35 of file notificationservice.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNotify() [2/2]

void ViewSolutions::NotificationService::setNotify ( const QString & title = "",
const QString & text = "",
const QString & img = "",
int type = NotificationData::Normal )

setNotify This method set new notify message for user. When notify changed on main application windows shows notify message.

Parameters
titleare title of a notify window.
textare text value of a notify window.
imgare url to image of a notify window.
typeare code of a notification type. For more information about notification type see the NotificationData enum.

Definition at line 67 of file notificationservice.cpp.

Here is the call graph for this function:

◆ setQuestion() [1/3]

int ViewSolutions::NotificationService::setQuestion ( const Listner & listner,
const NotificationData & question )

setQuestion This method sets information of the users question.

Parameters
listnerThis is listner lyambda function.
questionare data of the question.
Returns
return question code. You must be save this code for check ansver of your qestion.

Definition at line 44 of file notificationservice.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuestion() [2/3]

int ViewSolutions::NotificationService::setQuestion ( const Listner & listner,
const QString & title = "",
const QString & text = "",
const QString & img = "",
int code = 0 )

setQuestion This method set new question for user. When question changed on main application windows shows question.

Parameters
listnerThis is listner lyambda function.
titleare title of a question window.
textare text value of a question window.
imgare url to image of a queston window.
codeare code of question. This code must be sendet to the questionComplete method after buttons clik.

Definition at line 97 of file notificationservice.cpp.

Here is the call graph for this function:

◆ setQuestion() [3/3]

int ViewSolutions::NotificationService::setQuestion ( QObject * listnerObject,
const QString & listnerMethod,
const QString & title = "",
const QString & text = "",
const QString & img = "",
int code = 0 )

setQuestion This method set new question for user. When question changed on main application windows shows question.

Parameters
listnerObjectThis is qml object with listner function.
listnerMethodThis is listner method name. Method signature : void(bool)
titleare title of a question window.
textare text value of a question window.
imgare url to image of a queston window.
codeare code of question. This code must be sendet to the questionComplete method after buttons clik.

Definition at line 76 of file notificationservice.cpp.

Here is the call graph for this function:

◆ showHistory()

void ViewSolutions::NotificationService::showHistory ( )

showHistory - This method used for emit signal by which show notification menu.

Definition at line 116 of file notificationservice.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigShowHistory

void ViewSolutions::NotificationService::sigShowHistory ( )
signal

sigShowHistory This signal is emitted when the notification history view should be shown (see showHistory).

Here is the call graph for this function:
Here is the caller graph for this function:

Property Documentation

◆ history

QObject* ViewSolutions::NotificationService::history
read

Definition at line 70 of file notificationservice.h.

◆ notificationsCount

int ViewSolutions::NotificationService::notificationsCount
read

Definition at line 72 of file notificationservice.h.

◆ notify

NotificationData ViewSolutions::NotificationService::notify
read

Definition at line 67 of file notificationservice.h.

◆ question

NotificationData ViewSolutions::NotificationService::question
read

Definition at line 68 of file notificationservice.h.


The documentation for this class was generated from the following files: