BornAgain  1.19.79
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/Util/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_UTIL_MESSAGESERVICE_H
16 #define BORNAGAIN_GUI_UTIL_MESSAGESERVICE_H
17 
18 #include <QList>
19 #include <QPair>
20 #include <QString>
21 
22 class QObject;
23 
24 //! @class MessageService
25 //! @brief The service to collect messages from different senders.
26 
28 public:
29  void addError(QObject* sender, const QString& description);
30  void addWarning(QObject* sender, const QString& description);
31 
32  QStringList errors(bool includeSenders = false) const;
33  QStringList warnings(bool includeSenders = false) const;
34 
35 private:
36  using Messages = QList<QPair<QString, QString>>; // pair of sender & description
37 
38  QStringList descriptions(const Messages& messages, bool includeSenders) const;
39 
42 };
43 
44 #endif // BORNAGAIN_GUI_UTIL_MESSAGESERVICE_H
The service to collect messages from different senders.
QStringList descriptions(const Messages &messages, bool includeSenders) const
QList< QPair< QString, QString > > Messages
QStringList errors(bool includeSenders=false) const
QStringList warnings(bool includeSenders=false) const
void addWarning(QObject *sender, const QString &description)
void addError(QObject *sender, const QString &description)
Messages m_warnings
Messages m_errors