RestUiWidget.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2015 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 _GAZEBO_RESTUI_WIDGET_HH_
19 #define _GAZEBO_RESTUI_WIDGET_HH_
20 
21 #include <string>
22 #include <list>
23 
24 // See: https://bugreports.qt-project.org/browse/QTBUG-22829
25 #ifndef Q_MOC_RUN
26 # include <gazebo/gazebo.hh>
27 #endif
28 #include <gazebo/util/system.hh>
29 #include "RestUiLoginDialog.hh"
30 #include "RestUiLogoutDialog.hh"
31 
32 namespace gazebo
33 {
36  class GAZEBO_VISIBLE RestUiWidget : public QWidget
37  {
38  Q_OBJECT
39 
46  public: RestUiWidget(QWidget *_parent,
47  QAction &_login,
48  QAction &_logout,
49  const std::string &_menuTitle,
50  const std::string &_loginTitle,
51  const std::string &_urlLabel,
52  const std::string &_defautlUrl);
53 
55  public: virtual ~RestUiWidget() = default;
56 
58  public slots: void Login();
59 
61  public slots: void Logout();
62 
65  public: void Update();
66 
69  private: void OnResponse(ConstRestErrorPtr &_msg);
70 
72  private: QAction &loginMenuAction;
73 
75  private: QAction &logoutMenuAction;
76 
78  private: std::string title;
79 
81  private: gazebo::transport::NodePtr node;
82 
84  private: gui::RestUiLogoutDialog logoutDialog;
85 
87  private: gui::RestUiLoginDialog loginDialog;
88 
90  private: gazebo::transport::PublisherPtr loginPub;
91 
93  private: gazebo::transport::PublisherPtr logoutPub;
94 
96  private: gazebo::transport::SubscriberPtr errorSub;
97 
100  private: std::list<boost::shared_ptr<const gazebo::msgs::RestError>>
101  msgRespQ;
102  };
103 }
104 
105 #endif
Provides a means to login to a webservice.
Definition: RestUiLoginDialog.hh:34
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
Provides a means to logout from a webservice.
Definition: RestUiLogoutDialog.hh:31
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
REST user interface widget.
Definition: RestUiWidget.hh:36
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66