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
00030 #ifndef RVIZ_ADD_DISPLAY_DIALOG_H
00031 #define RVIZ_ADD_DISPLAY_DIALOG_H
00032
00033 #include <QDialog>
00034 #include <QTreeWidget>
00035 #include <QComboBox>
00036
00037 #include <boost/shared_ptr.hpp>
00038
00039 #include "rviz/factory.h"
00040
00041 class QTextBrowser;
00042 class QLineEdit;
00043 class QDialogButtonBox;
00044 class QLabel;
00045 class QCheckBox;
00046
00047 namespace rviz
00048 {
00049
00050 class DisplayFactory;
00051 class Display;
00052
00056 struct SelectionData {
00057 QString whats_this;
00058 QString lookup_name;
00059 QString display_name;
00060 QString topic;
00061 QString datatype;
00062 };
00063
00064 class AddDisplayDialog : public QDialog
00065 {
00066 Q_OBJECT
00067 public:
00083 AddDisplayDialog( DisplayFactory* factory,
00084 const QString& object_type,
00085 const QStringList& disallowed_display_names,
00086 const QStringList& disallowed_class_lookup_names,
00087 QString* lookup_name_output,
00088 QString* display_name_output = 0,
00089 QString* topic_output = 0,
00090 QString* datatype_output = 0,
00091 QWidget* parent = 0 );
00092
00093 virtual QSize sizeHint () const;
00094
00095 public Q_SLOTS:
00096 virtual void accept();
00097
00098 private Q_SLOTS:
00099 void onDisplaySelected( SelectionData *data);
00100 void onTopicSelected( SelectionData *data );
00101 void onTabChanged( int index );
00102 void onNameChanged();
00103
00104 private:
00106 void fillTree( QTreeWidget* tree );
00107
00110 bool isValid();
00111
00114 void setError( const QString& error_text );
00115
00117 void updateDisplay();
00118
00119 Factory* factory_;
00120 const QStringList& disallowed_display_names_;
00121 const QStringList& disallowed_class_lookup_names_;
00122
00123 QString* lookup_name_output_;
00124 QString* display_name_output_;
00125 QString* topic_output_;
00126 QString* datatype_output_;
00127
00129 QTabWidget *tab_widget_;
00131 int topic_tab_;
00133 int display_tab_;
00135 SelectionData display_data_;
00137 SelectionData topic_data_;
00138
00140 QTextBrowser* description_;
00141
00142 QLineEdit* name_editor_;
00143
00145 QDialogButtonBox* button_box_;
00146
00149 QString lookup_name_;
00150 };
00151
00152
00154 class DisplayTypeTree : public QTreeWidget {
00155 Q_OBJECT
00156 public:
00157 DisplayTypeTree();
00158
00159 void fillTree(Factory *factory);
00160
00161 Q_SIGNALS:
00162 void itemChanged( SelectionData *selection );
00163
00164 private Q_SLOTS:
00165 void onCurrentItemChanged(QTreeWidgetItem *curr, QTreeWidgetItem *prev);
00166 };
00167
00169 class TopicDisplayWidget : public QWidget {
00170 Q_OBJECT
00171 public:
00172 TopicDisplayWidget();
00173 void fill(DisplayFactory *factory);
00174
00175 Q_SIGNALS:
00176 void itemChanged( SelectionData *selection );
00177 void itemActivated( QTreeWidgetItem *item, int column );
00178
00179 private Q_SLOTS:
00180 void stateChanged(int state);
00181 void onCurrentItemChanged( QTreeWidgetItem *curr );
00182 void onComboBoxClicked( QTreeWidgetItem *curr );
00183
00184 private:
00185 void findPlugins( DisplayFactory* );
00186
00192 QTreeWidgetItem* insertItem ( const QString &topic, bool disabled );
00193
00194 QTreeWidget *tree_;
00195 QCheckBox *enable_hidden_box_;
00196
00197
00198
00199 QMap<QString, QString > datatype_plugins_;
00200 };
00201
00207 class EmbeddableComboBox : public QComboBox
00208 {
00209 Q_OBJECT
00210 public:
00211 EmbeddableComboBox(QTreeWidgetItem *parent, int col)
00212 : parent_( parent ), column_(col)
00213 {
00214 connect(this, SIGNAL( activated( int )), this, SLOT( onActivated( int )));
00215 }
00216
00217 Q_SIGNALS:
00218 void itemClicked( QTreeWidgetItem *item, int column );
00219
00220 private Q_SLOTS:
00221 void onActivated( int index )
00222 {
00223 Q_EMIT itemClicked( parent_, column_ );
00224 }
00225
00226 private:
00227 QTreeWidgetItem *parent_;
00228 int column_;
00229 };
00230
00231 }
00232
00233 #endif // RVIZ_ADD_DISPLAY_DIALOG_H