QtPdCom  1.0.0
MessageImpl.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * Copyright (C) 2009-2022 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 PD_MESSAGE_IMPL
23#define PD_MESSAGE_IMPL
24
25#include "Message.h"
26#include "MessageModelImpl.h"
27#include "ScalarVariable.h"
28
29#include <pdcom5/MessageManagerBase.h>
30
31#include <QObject>
32#include <QDomElement>
33#include <QMap>
34
35/****************************************************************************/
36
37namespace QtPdCom {
38
40 public QObject
41{
42 Q_OBJECT
43
44 friend class Message;
45 friend class MessageModel;
46
47 public:
48 Impl(Message *);
49 ~Impl();
50
51 static QString pathFromPlainXmlElement(QDomElement,
52 const QString & = QString());
53 static int indexFromPlainXmlElement(QDomElement);
54
55 void fromPlainXmlElement(QDomElement, const QString & = QString());
56 void fromPdComMessage(const PdCom::Message &);
57
58 static QString timeString(quint64);
59
60 private:
61 Message * const parent;
62
64 QString path;
65 int index;
66 typedef QMap<QString, QString> TranslationMap;
72
73 void loadTranslations(QDomElement, TranslationMap &);
74
75 static Message::Type typeFromString(const QString &);
76
77 private slots:
78 void valueChanged();
79};
80
81} // namespace
82
83#endif
84
85/****************************************************************************/
List of Messages.
Definition: MessageModel.h:44
Definition: MessageImpl.h:41
QMap< QString, QString > TranslationMap
Definition: MessageImpl.h:66
TranslationMap description
Description of the message.
Definition: MessageImpl.h:68
Message *const parent
Definition: MessageImpl.h:61
static int indexFromPlainXmlElement(QDomElement)
Get the index.
Definition: MessageImpl.cpp:70
void loadTranslations(QDomElement, TranslationMap &)
Processes a TextNode XML element.
Definition: MessageImpl.cpp:187
void fromPlainXmlElement(QDomElement, const QString &=QString())
Constructor with XML element.
Definition: MessageImpl.cpp:91
~Impl()
Destructor.
Definition: MessageImpl.cpp:46
static Message::Type typeFromString(const QString &)
Converts a message type string to the appropriate Type.
Definition: MessageImpl.cpp:215
MessageModel::Impl::MessageItem * currentItem
Definition: MessageImpl.h:71
Type type
Message type.
Definition: MessageImpl.h:63
TranslationMap text
Text of the message.
Definition: MessageImpl.h:67
void fromPdComMessage(const PdCom::Message &)
Constructor with PdCom5 message.
Definition: MessageImpl.cpp:126
QString path
Path of the process variable.
Definition: MessageImpl.h:64
int index
Definition: MessageImpl.h:65
DoubleVariable variable
Definition: MessageImpl.h:70
void valueChanged()
Variable value changed.
Definition: MessageImpl.cpp:237
static QString timeString(quint64)
Returns the message time as a string.
Definition: MessageImpl.cpp:169
static QString pathFromPlainXmlElement(QDomElement, const QString &=QString())
Get the path.
Definition: MessageImpl.cpp:54
Process message.
Definition: Message.h:39
Type
Message type.
Definition: Message.h:47
Definition: Message.h:31
Definition: MessageItem.h:38