Ignition Gui

API Reference

1.0.0
TopicEcho.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef IGNITION_GUI_PLUGINS_TOPICECHO_HH_
19 #define IGNITION_GUI_PLUGINS_TOPICECHO_HH_
20 
21 #ifdef _MSC_VER
22 #pragma warning(push, 0)
23 #endif
24 #include <google/protobuf/message.h>
25 #ifdef _MSC_VER
26 #pragma warning(pop)
27 #endif
28 
29 #include <memory>
30 
31 #include "ignition/gui/Plugin.hh"
32 
33 namespace ignition
34 {
35 namespace gui
36 {
37 namespace plugins
38 {
39  class TopicEchoPrivate;
40 
45  class TopicEcho : public Plugin
46  {
47  Q_OBJECT
48 
50  Q_PROPERTY(
52  READ Topic
53  WRITE SetTopic
54  NOTIFY TopicChanged
55  )
56 
57 
58  Q_PROPERTY(
59  int buffer
60  READ Buffer
61  WRITE SetBuffer
62  NOTIFY BufferChanged
63  )
64 
66  Q_PROPERTY(
67  bool paused
68  READ Paused
69  WRITE SetPaused
70  NOTIFY PausedChanged
71  )
72 
74  public: TopicEcho();
75 
77  public: virtual ~TopicEcho();
78 
79  // Documentation inherited
80  public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem);
81 
85  public: Q_INVOKABLE QString Topic() const;
86 
90  public: Q_INVOKABLE void SetTopic(const QString &_topic);
91 
93  signals: void TopicChanged();
94 
97  public: Q_INVOKABLE int Buffer() const;
98 
101  public: Q_INVOKABLE void SetBuffer(const int &_buffer);
102 
104  signals: void BufferChanged();
105 
108  public: Q_INVOKABLE bool Paused() const;
109 
112  public: Q_INVOKABLE void SetPaused(const bool &_paused);
113 
115  signals: void PausedChanged();
116 
119  signals: void AddMsg(QString _msg);
120 
123  private: void OnMessage(const google::protobuf::Message &_msg);
124 
126  private: void Stop();
127 
129  public slots: void OnEcho(const bool _checked);
130 
133  private slots: void OnAddMsg(QString _msg);
134 
137  private: std::unique_ptr<TopicEchoPrivate> dataPtr;
138  };
139 }
140 }
141 }
142 
143 #endif
QString topic
Topic.
Definition: TopicEcho.hh:55
Q_INVOKABLE bool Paused() const
Get whether it is paused.
STL namespace.
Definition: Application.hh:28
Base class for Ignition GUI plugins.
Definition: Plugin.hh:47
Q_INVOKABLE int Buffer() const
Get the number of messages to be buffered.
Q_INVOKABLE void SetPaused(const bool &_paused)
Set whether to be paused.
bool paused
Paused.
Definition: TopicEcho.hh:71
void OnEcho(const bool _checked)
Callback when echo button is pressed.
Q_INVOKABLE QString Topic() const
Get the topic as a string, for example &#39;/echo&#39;.
Q_INVOKABLE void SetBuffer(const int &_buffer)
Set the number of messages to be buffered.
void AddMsg(QString _msg)
Signal to add a message to the GUI list.
int buffer
Buffer size.
Definition: TopicEcho.hh:63
Definition: Application.hh:33
virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem)
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
Q_INVOKABLE void SetTopic(const QString &_topic)
Set the topic from a string, for example &#39;/echo&#39;.