Ignition Gui

API Reference

5.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  bool paused
60  READ Paused
61  WRITE SetPaused
62  NOTIFY PausedChanged
63  )
64 
66  public: TopicEcho();
67 
69  public: virtual ~TopicEcho();
70 
71  // Documentation inherited
72  public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem);
73 
77  public: Q_INVOKABLE QString Topic() const;
78 
82  public: Q_INVOKABLE void SetTopic(const QString &_topic);
83 
85  signals: void TopicChanged();
86 
87  public slots: void OnBuffer(const unsigned int _steps);
88 
91  public: Q_INVOKABLE bool Paused() const;
92 
95  public: Q_INVOKABLE void SetPaused(const bool &_paused);
96 
98  signals: void PausedChanged();
99 
102  signals: void AddMsg(QString _msg);
103 
106  private: void OnMessage(const google::protobuf::Message &_msg);
107 
109  private: void Stop();
110 
112  public slots: void OnEcho(const bool _checked);
113 
116  private slots: void OnAddMsg(QString _msg);
117 
120  private: std::unique_ptr<TopicEchoPrivate> dataPtr;
121  };
122 }
123 }
124 }
125 
126 #endif
QString topic
Topic.
Definition: TopicEcho.hh:55
Q_INVOKABLE bool Paused() const
Get whether it is paused.
STL namespace.
Definition: Application.hh:35
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54
Q_INVOKABLE void SetPaused(const bool &_paused)
Set whether to be paused.
bool paused
Paused.
Definition: TopicEcho.hh:63
void OnEcho(const bool _checked)
Callback when echo button is pressed.
Plotting Topic to handle published topics & their registered fields.
Definition: PlottingInterface.hh:95
void AddMsg(QString _msg)
Signal to add a message to the GUI list.
void OnBuffer(const unsigned int _steps)
Definition: Application.hh:40
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;.