TextOutDisplay.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  TalkingHead - A talking head for robots
00003  *  Copyright (C) 2012 AG Aktives Sehen <agas@uni-koblenz.de>
00004  *                     Universitaet Koblenz-Landau
00005  *
00006  *  This program is free software: you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation, either version 3 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014  *  Library General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Library General Public
00017  *  License along with this library; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00019  *  MA 02110-1301  USA or see <http://www.gnu.org/licenses/>.
00020  *******************************************************************************/
00021 
00022 #ifndef TALKING_HEAD_INCLUDE_TEXTOUTDISPLAY_H_
00023 #define TALKING_HEAD_INCLUDE_TEXTOUTDISPLAY_H_
00024 
00025 #include <QWidget>
00026 
00027 #include <ros/callback_queue.h>
00028 #include <ros/ros.h>
00029 #include <std_msgs/String.h>
00030 
00031 #include <string>
00032 #include <vector>
00033 
00034 class QLabel;
00035 
00041 class TextOutDisplay : public QWidget
00042 {
00043 
00044   Q_OBJECT
00045 
00046   public:
00047 
00049     TextOutDisplay( int min_height = 0, int font_size=15, bool user_input = false, QWidget* parent = 0 );
00050 
00052     ~TextOutDisplay();
00053 
00055     void subscribeWithNodeHandle( ros::NodeHandle node_handle );
00056 
00057     void callbackText( const std_msgs::String::ConstPtr& msg );
00058 
00059     void callbackTalkingFinished( const std_msgs::String::ConstPtr& msg );
00060 
00061   public slots:
00062 
00064     void setText( std::string text );
00065 
00066     void clearText();
00067 
00068   private:
00069 
00070     std::string                 text_;
00071 
00072     QLabel                      *text_out_label_;
00073     QFont                       font_;
00074 
00075     QTimer                      *reset_timer_;
00076 
00077     std::vector<std::string>    smileys_;
00078 
00079     bool                        user_input_;
00080 
00082     ros::Subscriber             text_out_subscriber_;
00083     ros::Subscriber             user_input_subscriber_;
00084     ros::Subscriber             talking_finished_subscriber_;
00085 
00086     ros::CallbackQueue          callback_queue_;
00087 
00088 
00090     std::string trimSpaces( std::string text );
00091 
00093     std::string clearSmileys( std::string text );
00094 
00096     std::string prepareText( std::string text );
00097 };
00098 
00099 #endif // TALKING_HEAD_INCLUDE_TEXTOUTDISPLAY_H_


robot_face
Author(s): AGAS, Julian Giesen, David Gossow
autogenerated on Mon Jan 6 2014 11:41:09