Gazebo Gui

API Reference

9.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 GZ_GUI_PLUGINS_TOPICECHO_HH_
19#define GZ_GUI_PLUGINS_TOPICECHO_HH_
20
21#ifdef _MSC_VER
22#pragma warning(push)
23#pragma warning(disable: 4251)
24#endif
25#include <google/protobuf/message.h>
26#ifdef _MSC_VER
27#pragma warning(pop)
28#endif
29
30#ifndef _WIN32
31# define TopicEcho_EXPORTS_API __attribute__ ((visibility ("default")))
32#else
33# if (defined(TopicEcho_EXPORTS))
34# define TopicEcho_EXPORTS_API __declspec(dllexport)
35# else
36# define TopicEcho_EXPORTS_API __declspec(dllimport)
37# endif
38#endif
39
40#include <memory>
41
42#include "gz/gui/Plugin.hh"
43#include <gz/utils/ImplPtr.hh>
44
45namespace gz::gui::plugins
46{
51 class TopicEcho_EXPORTS_API TopicEcho : public Plugin
52 {
53 Q_OBJECT
54
56 Q_PROPERTY(
57 QString topic
58 READ Topic
59 WRITE SetTopic
60 NOTIFY TopicChanged
61 )
62
63
64 Q_PROPERTY(
65 bool paused
66 READ Paused
67 WRITE SetPaused
68 NOTIFY PausedChanged
69 )
70
72 public: TopicEcho();
73
75 public: ~TopicEcho() override;
76
77 // Documentation inherited
78 public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
79
83 public: Q_INVOKABLE QString Topic() const;
84
88 public: Q_INVOKABLE void SetTopic(const QString &_topic);
89
91 signals: void TopicChanged();
92
93 public slots: void OnBuffer(const unsigned int _steps);
94
97 public: Q_INVOKABLE bool Paused() const;
98
101 public: Q_INVOKABLE void SetPaused(const bool &_paused);
102
104 signals: void PausedChanged();
105
108 signals: void AddMsg(QString _msg);
109
112 private: void OnMessage(const google::protobuf::Message &_msg);
113
115 private: void Stop();
116
118 public slots: void OnEcho(const bool _checked);
119
122 private slots: void OnAddMsg(QString _msg);
123
126 private: GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
127 };
128} // namespace gz::gui::plugins
129
130#endif // GZ_GUI_PLUGINS_TOPICECHO_HH_