BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MessageService.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/utils/MessageService.h
6 //! @brief Defines MessageService class
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_COREGUI_UTILS_MESSAGESERVICE_H
16 #define BORNAGAIN_GUI_COREGUI_UTILS_MESSAGESERVICE_H
17 
18 #include <QMap>
19 #include <QStringList>
20 
21 class MessageContainer;
22 class QObject;
23 class GUIMessage;
24 
25 //! @class MessageService
26 //! @brief The service to collect messages from different senders.
27 
29 public:
30  virtual ~MessageService();
31 
32  void clear();
33 
34  void send_message(QObject* sender, const QString& message_type, const QString& description);
35  void send_error(QObject* sender, const QString& description);
36  void send_warning(QObject* sender, const QString& description);
37 
38  const QList<GUIMessage*> messages() const;
39 
40  QStringList senderList() const;
41 
42  int messageCount(const QObject* sender, const QString& message_type = "") const;
43  int warningCount(const QObject* sender = 0) const;
44  int errorCount(const QObject* sender = 0) const;
45 
46  QStringList errorDescriptionList(const QObject* sender = 0) const;
47 
48 private:
49  QList<GUIMessage*> m_messages;
50 };
51 
52 #endif // BORNAGAIN_GUI_COREGUI_UTILS_MESSAGESERVICE_H
The service to collect messages from different senders.
void send_error(QObject *sender, const QString &description)
int messageCount(const QObject *sender, const QString &message_type="") const
Reports number of messages of given type reported by the sender.
void send_warning(QObject *sender, const QString &description)
virtual ~MessageService()
QList< GUIMessage * > m_messages
int errorCount(const QObject *sender=0) const
Returns number of errors for given sender.
int warningCount(const QObject *sender=0) const
Returns number of warnings for given sender.
QStringList errorDescriptionList(const QObject *sender=0) const
Returns multi-line string representing error messages of given sender.
void send_message(QObject *sender, const QString &message_type, const QString &description)
const QList< GUIMessage * > messages() const
QStringList senderList() const