Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef MAPVIZ_SELECT_TOPIC_DIALOG_H_
00030 #define MAPVIZ_SELECT_TOPIC_DIALOG_H_
00031
00032 #include <set>
00033 #include <string>
00034 #include <vector>
00035
00036 #include <QDialog>
00037
00038 #include <ros/master.h>
00039
00040 QT_BEGIN_NAMESPACE
00041 class QLineEdit;
00042 class QListWidget;
00043 class QPushButton;
00044 QT_END_NAMESPACE
00045
00046 namespace mapviz
00047 {
00053 class SelectTopicDialog : public QDialog
00054 {
00055 Q_OBJECT;
00056
00057 public:
00067 static ros::master::TopicInfo selectTopic(
00068 const std::string &datatype,
00069 QWidget *parent=0);
00070
00079 static ros::master::TopicInfo selectTopic(
00080 const std::string &datatype1,
00081 const std::string &datatype2,
00082 QWidget *parent=0);
00083
00091 static ros::master::TopicInfo selectTopic(
00092 const std::vector<std::string> &datatypes,
00093 QWidget *parent=0);
00094
00103 static std::vector<ros::master::TopicInfo> selectTopics(
00104 const std::string &datatype,
00105 QWidget *parent=0);
00106
00115 static std::vector<ros::master::TopicInfo> selectTopics(
00116 const std::string &datatype1,
00117 const std::string &datatype2,
00118 QWidget *parent=0);
00119
00126 static std::vector<ros::master::TopicInfo> selectTopics(
00127 const std::vector<std::string> &datatypes,
00128 QWidget *parent=0);
00129
00133 SelectTopicDialog(QWidget *parent=0);
00134
00139 void allowMultipleTopics(bool allow);
00140
00146 void setDatatypeFilter(const std::vector<std::string> &datatypes);
00147
00154 ros::master::TopicInfo selectedTopic() const;
00159 std::vector<ros::master::TopicInfo> selectedTopics() const;
00160
00161 private:
00162 void timerEvent(QTimerEvent *);
00163 void closeEvent(QCloseEvent *);
00164
00165 std::vector<ros::master::TopicInfo> filterTopics(
00166 const std::vector<ros::master::TopicInfo> &) const;
00167
00168 private Q_SLOTS:
00169 void fetchTopics();
00170 void updateDisplayedTopics();
00171
00172 private:
00173 std::set<std::string> allowed_datatypes_;
00174 std::vector<ros::master::TopicInfo> known_topics_;
00175 std::vector<ros::master::TopicInfo> displayed_topics_;
00176 int fetch_topics_timer_id_;
00177
00178 QPushButton *ok_button_;
00179 QPushButton *cancel_button_;
00180 QListWidget *list_widget_;
00181 QLineEdit *name_filter_;
00182 };
00183 }
00184 #endif // MAPVIZ_SELECT_TOPIC_DIALOG_H_