QtPdCom  1.5.2
MessageModelImpl.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 QTPDCOM_MESSAGE_MODEL_IMPL
23#define QTPDCOM_MESSAGE_MODEL_IMPL
24
25#include "MessageModel.h"
26#include "MessageManager.h"
27
28#include <pdcom5/MessageManagerBase.h>
29
30#include <QObject>
31#include <QSet>
32
33/****************************************************************************/
34
35namespace QtPdCom {
36
37class Process;
38
39/****************************************************************************/
40
41class MessageModel::Impl: public QObject
42{
43 Q_OBJECT
44
45 friend class MessageModel;
46 friend class Message;
47
48 public:
50 ~Impl();
51
52 struct MessageItem;
53
54 void insertItem(MessageItem *);
55 void addProcessMessage(const PdCom::Message &);
56 void
57 addHistoricMessage(const PdCom::Message &, const PdCom::Message &);
58
59 static QString wrapText(const QString &, unsigned int = 78);
60
61 private:
63
64 // Map of message[path][index]
65 typedef QHash<int, Message *> MessageHash;
66 typedef QMap<QString, MessageHash> MessageMap;
68
69 typedef QList<MessageItem *> MessageItemList;
71
72 typedef QHash<Message::Type, QIcon> IconHash;
76
78 typedef QHash<Message::Type, QString> IconPathHash;
81
83 QString lang;
87 uint32_t historicSeqNo;
88
90 void getHistoryMessage();
91
93 void announce();
94
95 bool (*lessThan)(const MessageItem *, const MessageItem *);
96
98 QList<PdCom::Message> resetMessagesList;
99
100 Process *process = nullptr;
101
102 private slots:
103 void stateChanged();
104 void processMessage(PdCom::Message message);
105 void getMessageReply(PdCom::Message message);
106 void activeMessagesReply(std::vector<PdCom::Message>);
107 void processReset();
109};
110
111/****************************************************************************/
112
113} // namespace QtPdCom
114
115#endif
116
117/****************************************************************************/
Definition MessageModelImpl.h:42
Definition MessageManager.h:69
void reloadActiveMessages()
Definition MessageModelImpl.cpp:540
QString lang
Definition MessageModelImpl.h:83
QHash< Message::Type, QIcon > IconHash
Icon hash type.
Definition MessageModelImpl.h:72
friend class MessageModel
Definition MessageModelImpl.h:45
void getHistoryMessage()
Spin up a FutureWatcher and connect its signals.
Definition MessageModelImpl.cpp:249
MessageManager * messageManager
Definition MessageModelImpl.h:84
void announce()
Announce next best message as current message.
Definition MessageModelImpl.cpp:276
QHash< Message::Type, QString > IconPathHash
Icon hash type (with path).
Definition MessageModelImpl.h:78
void addHistoricMessage(const PdCom::Message &, const PdCom::Message &)
Called from the PdCom interface, if a historic message appears via getMessageReply().
Definition MessageModelImpl.cpp:197
QMap< QString, MessageHash > MessageMap
Definition MessageModelImpl.h:66
friend class Message
Definition MessageModelImpl.h:46
static QString wrapText(const QString &, unsigned int=78)
Returns a wrapped version of a string.
Definition MessageModelImpl.cpp:222
void insertItem(MessageItem *)
Insert a message item.
Definition MessageModelImpl.cpp:58
int rowLimit
Definition MessageModelImpl.h:85
void processMessage(PdCom::Message message)
Definition MessageModelImpl.cpp:386
IconHash iconHash
Icons for message types.
Definition MessageModelImpl.h:74
MessageModel *const parent
Definition MessageModelImpl.h:62
QList< PdCom::Message > resetMessagesList
list of history messages that were reset
Definition MessageModelImpl.h:98
void getMessageReply(PdCom::Message message)
Definition MessageModelImpl.cpp:402
bool canFetchMore
Definition MessageModelImpl.h:86
~Impl()
Destructor.
Definition MessageModelImpl.cpp:51
IconPathHash iconPathHash
Icons for message types (with path).
Definition MessageModelImpl.h:80
void stateChanged()
Reacts on process values changes of all messages to watch.
Definition MessageModelImpl.cpp:330
void activeMessagesReply(std::vector< PdCom::Message >)
Definition MessageModelImpl.cpp:466
void addProcessMessage(const PdCom::Message &)
Called from the PdCom interface, if a new message appears via processMessage() or in context of activ...
Definition MessageModelImpl.cpp:113
MessageItem * announcedMessageItem
Recently announced message.
Definition MessageModelImpl.h:82
void processReset()
Definition MessageModelImpl.cpp:505
MessageMap messageMap
Definition MessageModelImpl.h:67
uint32_t historicSeqNo
Definition MessageModelImpl.h:87
MessageItemList messageItemList
Definition MessageModelImpl.h:70
bool(* lessThan)(const MessageItem *, const MessageItem *)
Definition MessageModelImpl.h:95
Process * process
Definition MessageModelImpl.h:100
QHash< int, Message * > MessageHash
Definition MessageModelImpl.h:65
QList< MessageItem * > MessageItemList
Definition MessageModelImpl.h:69
friend class Message::Impl
Definition MessageModel.h:65
PdCom::Process implementation for Qt.
Definition Process.h:72
Definition BroadcastModel.h:32
Definition MessageItem.h:38