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