InsertModelWidget.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 #ifndef GAZEBO_GUI_INSERTMODELWIDGET_HH_
18 #define GAZEBO_GUI_INSERTMODELWIDGET_HH_
19 
20 
21 #include <string>
22 #include <map>
23 #include <vector>
24 #include <boost/filesystem.hpp>
25 
26 #include "gazebo/common/Event.hh"
27 #include "gazebo/gui/qt.h"
28 #include "gazebo/util/system.hh"
29 
30 class QTreeWidget;
31 class QTreeWidgetItem;
32 class QPushButton;
33 
34 namespace gazebo
35 {
36  namespace common
37  {
38  // Forward declaration.
39  class FuelModelDatabase;
40  }
41  namespace gui
42  {
43  // Forward declaration.
44  class InsertModelWidgetPrivate;
45 
46  class GZ_GUI_VISIBLE InsertModelWidget : public QWidget
47  {
48  Q_OBJECT
49 
51  public: explicit InsertModelWidget(QWidget *_parent = 0);
52 
54  public: virtual ~InsertModelWidget();
55 
57  public: bool LocalPathInFileWidget(const std::string &_path);
58 
62  private: void OnModels(
63  const std::map<std::string, std::string> &_models);
64 
68  private: void OnModelUpdateRequest(const std::string &_localPath);
69 
73  signals: void UpdateFuel(const std::string &_server);
74 
76  private slots: void OnModelSelection(QTreeWidgetItem *item, int column);
77 
80  private slots: void Update();
81 
85  private slots: void OnUpdateFuel(const std::string &_server);
86 
89  private slots: void OnDirectoryChanged(const QString &_path);
90 
92  private slots: void HandleButton();
93 
97  private: static bool IsPathAccessible
98  (const boost::filesystem::path &_path);
99 
101  private: void UpdateAllLocalPaths();
102 
105  private: void UpdateLocalPath(const std::string &_path);
106 
109  private: void InitializeFuelServers();
110 
113  private: void PopulateFuelServers();
114 
116  private: std::vector<event::ConnectionPtr> connections;
117 
119  private: InsertModelWidgetPrivate *dataPtr;
120  };
121  }
122 }
123 #endif
Definition: InsertModelWidget.hh:46