QtPdCom  1.5.2
Message.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * Copyright (C) 2009-2023 Florian Pose <fp@igh.de>
4 *
5 * This file is part of the QtPdCom library.
6 *
7 * The QtPdCom library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * The QtPdCom library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ****************************************************************************/
21
22#ifndef QTPDCOM_MESSAGE_H
23#define QTPDCOM_MESSAGE_H
24
25#include "Export.h"
26
27#include <QObject>
28
29#include <memory>
30
31namespace QtPdCom {
32
33/****************************************************************************/
34
38 public QObject
39{
40 Q_OBJECT
41
42 friend class MessageModel;
43
44 public:
56
57 Message(QObject *parent = nullptr);
58 ~Message();
59
60 bool isActive() const;
61 double getTime() const;
62 Type getType() const;
63 const QString &getPath() const;
64 int getIndex() const;
65 QString getText(const QString & = QString()) const;
66 QString getDescription(const QString & = QString()) const;
67 QString getTimeString() const;
68
71 struct Exception {
74 Exception(const QString &msg): msg(msg) {}
75 QString msg;
76 };
77
78 signals:
80
81 private:
82 class Q_DECL_HIDDEN Impl;
83 std::unique_ptr<Impl> impl;
84};
85
86/****************************************************************************/
87
88} // namespace
89
90Q_DECLARE_METATYPE(const QtPdCom::Message*)
91
92#endif
#define QTPDCOM_PUBLIC
Definition Export.h:30
Definition MessageImpl.h:40
Process message.
Definition Message.h:39
Message(QObject *parent=nullptr)
Constructor.
Definition Message.cpp:35
const QString & getPath() const
Definition Message.cpp:87
friend class MessageModel
Definition Message.h:42
QString getTimeString() const
Returns the message time as a string.
Definition Message.cpp:139
Type
Message type.
Definition Message.h:47
@ Warning
Warning, that does not influence the process flow.
Definition Message.h:49
@ Error
Error, that influences the process flow.
Definition Message.h:51
@ Critical
Critical error, that makes the process unable to run.
Definition Message.h:52
@ Information
Non-critical information.
Definition Message.h:48
QString getText(const QString &=QString()) const
Definition Message.cpp:107
QString getDescription(const QString &=QString()) const
Definition Message.cpp:130
std::unique_ptr< Impl > impl
Definition Message.h:83
int getIndex() const
Definition Message.cpp:96
double getTime() const
Definition Message.cpp:64
Type getType() const
Definition Message.cpp:78
bool isActive() const
Definition Message.cpp:55
Definition BroadcastModel.h:32
QString msg
Exception message.
Definition Message.h:75
Exception(const QString &msg)
Constructor.
Definition Message.h:74