labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

MQTTTopic.h
Go to the documentation of this file.
1 /***************************************************************************
2 File : MQTTTopic.h
3 Project : LabPlot
4 Description : Represents a topic of a MQTTSubscription
5 --------------------------------------------------------------------
6 Copyright : (C) 2018 Kovacs Ferencz (kferike98@gmail.com)
7 
8 ***************************************************************************/
9 
10 /***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 * This program is distributed in the hope that it will be useful, *
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20 * GNU General Public License for more details. *
21 * *
22 * You should have received a copy of the GNU General Public License *
23 * along with this program; if not, write to the Free Software *
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
25 * Boston, MA 02110-1301 USA *
26 * *
27 ***************************************************************************/
28 
29 #ifndef MQTTTOPIC_H
30 #define MQTTTOPIC_H
31 
33 
34 class MQTTSubscription;
35 class MQTTClient;
36 
37 class AsciiFilter;
38 
39 class MQTTTopic : public Spreadsheet {
40  Q_OBJECT
41 
42 public:
43  MQTTTopic(const QString& name, MQTTSubscription* subscription, bool loading = false);
44  ~MQTTTopic() override;
45 
46  void setFilter(AsciiFilter*);
47  AsciiFilter* filter() const;
48 
49  QIcon icon() const override;
50  QMenu* createContextMenu() override;
51  QWidget* view() const override;
52 
53  QString topicName() const;
54  MQTTClient* mqttClient() const;
55  void newMessage(const QString&);
56 
57  void save(QXmlStreamWriter*) const override;
58  bool load(XmlStreamReader*, bool preview) override;
59 
60 private:
61  void initActions();
62 
63  QString m_topicName;
67  QAction* m_plotDataAction;
68 
69 public slots:
70  void read();
71 
72 private slots:
73  void plotData();
74 
75 signals:
76  void readOccured();
77 };
78 
79 #endif // MQTTTOPIC_H
QString name() const
Manages the import/export of data organized as columns (vectors) from/to an ASCII-file.
Definition: AsciiFilter.h:42
The MQTT Client connects to the broker set in ImportFileWidget. It manages the MQTTSubscriptions,...
Definition: MQTTClient.h:48
Represents a subscription made in a MQTTClient object. It plays a role in managing MQTTTopic objects ...
Represents a topic of a subscription made in MQTTClient.
Definition: MQTTTopic.h:39
MQTTClient * m_MQTTClient
Definition: MQTTTopic.h:64
QString m_topicName
Definition: MQTTTopic.h:63
void plotData()
Plots the data stored in MQTTTopic.
Definition: MQTTTopic.cpp:178
bool load(XmlStreamReader *, bool preview) override
Definition: MQTTTopic.cpp:228
QString topicName() const
Returns the name of the MQTTTopic.
Definition: MQTTTopic.cpp:152
void readOccured()
AsciiFilter * filter() const
Returns the MQTTTopic's filter.
Definition: MQTTTopic.cpp:106
MQTTTopic(const QString &name, MQTTSubscription *subscription, bool loading=false)
Definition: MQTTTopic.cpp:47
void initActions()
Initializes the actions of MQTTTopic.
Definition: MQTTTopic.cpp:159
QIcon icon() const override
Returns the MQTTTopic's icon.
Definition: MQTTTopic.cpp:113
void setFilter(AsciiFilter *)
Sets the MQTTTopic's filter The ownership of the filter is passed to MQTTTopic.
Definition: MQTTTopic.cpp:98
void newMessage(const QString &)
Adds a message received by the topic to the message puffer.
Definition: MQTTTopic.cpp:145
QAction * m_plotDataAction
Definition: MQTTTopic.h:67
MQTTClient * mqttClient() const
Returns the MQTTClient the topic belongs to.
Definition: MQTTTopic.cpp:167
~MQTTTopic() override
Definition: MQTTTopic.cpp:87
void save(QXmlStreamWriter *) const override
Definition: MQTTTopic.cpp:200
QVector< QString > m_messagePuffer
Definition: MQTTTopic.h:66
AsciiFilter * m_filter
Definition: MQTTTopic.h:65
void read()
Reads every message from the message puffer.
Definition: MQTTTopic.cpp:186
QMenu * createContextMenu() override
Adds an action to the MQTTTopic's context menu in the project explorer.
Definition: MQTTTopic.cpp:120
QWidget * view() const override
Construct a primary view on me.
Definition: MQTTTopic.cpp:136
Aspect providing a spreadsheet table with column logic.
Definition: Spreadsheet.h:40
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...