MessageFieldWidget.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (C) 2015 by Ralf Kaestner                                        *
00003  * ralf.kaestner@gmail.com                                                    *
00004  *                                                                            *
00005  * This program is free software; you can redistribute it and/or modify       *
00006  * it under the terms of the Lesser GNU General Public License as published by*
00007  * the Free Software Foundation; either version 3 of the License, or          *
00008  * (at your option) any later version.                                        *
00009  *                                                                            *
00010  * This program is distributed in the hope that it will be useful,            *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               *
00013  * Lesser GNU General Public License for more details.                        *
00014  *                                                                            *
00015  * You should have received a copy of the Lesser GNU General Public License   *
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.       *
00017  ******************************************************************************/
00018 
00019 #ifndef RQT_MULTIPLOT_MESSAGE_FIELD_WIDGET_H
00020 #define RQT_MULTIPLOT_MESSAGE_FIELD_WIDGET_H
00021 
00022 #include <QGridLayout>
00023 #include <QTimer>
00024 #include <QWidget>
00025 
00026 #include <rqt_multiplot/MessageDefinitionLoader.h>
00027 #include <rqt_multiplot/MessageFieldLineEdit.h>
00028 #include <rqt_multiplot/MessageFieldTreeWidget.h>
00029 #include <rqt_multiplot/MessageSubscriberRegistry.h>
00030 
00031 namespace Ui {
00032   class MessageFieldWidget;
00033 };
00034 
00035 namespace rqt_multiplot {
00036   class MessageFieldWidget :
00037     public QWidget {
00038   Q_OBJECT
00039   public:
00040     MessageFieldWidget(QWidget* parent = 0);
00041     virtual ~MessageFieldWidget();
00042   
00043     QString getCurrentMessageType() const;
00044     variant_topic_tools::MessageDataType getCurrentMessageDataType() const;
00045     void setCurrentField(const QString& field);
00046     QString getCurrentField() const;
00047     variant_topic_tools::DataType getCurrentFieldDataType() const;
00048     bool isLoading() const;
00049     bool isConnecting() const;
00050     bool isCurrentFieldDefined() const;
00051     
00052     void loadFields(const QString& type);
00053     void connectTopic(const QString& topic, double timeout = 0.0);
00054     
00055   signals:
00056     void loadingStarted();
00057     void loadingFinished();
00058     void loadingFailed(const QString& error);
00059     
00060     void connecting(const QString& topic);
00061     void connected(const QString& topic);
00062     void connectionTimeout(const QString& topic, double timeout);
00063     
00064     void currentFieldChanged(const QString& field);
00065     
00066   private:
00067     Ui::MessageFieldWidget* ui_;
00068     
00069     QString currentField_;
00070     
00071     MessageDefinitionLoader* loader_;
00072     bool isLoading_;
00073     
00074     MessageSubscriberRegistry* registry_;
00075     bool isConnecting_;
00076     QString subscribedTopic_;
00077     QTimer* connectionTimer_;
00078     
00079     void disconnect();
00080     
00081   private slots:
00082     void loaderLoadingStarted();
00083     void loaderLoadingFinished();
00084     void loaderLoadingFailed(const QString& error);
00085     
00086     void subscriberMessageReceived(const QString& topic, const Message&
00087       message);
00088     
00089     void connectionTimerTimeout();
00090     
00091     void lineEditCurrentFieldChanged(const QString& field);
00092     void treeWidgetCurrentFieldChanged(const QString& field);
00093   };
00094 };
00095 
00096 #endif


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Tue May 9 2017 02:16:02