StatusWidget.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_STATUS_WIDGET_H
00020 #define RQT_MULTIPLOT_STATUS_WIDGET_H
00021 
00022 #include <QGridLayout>
00023 #include <QImage>
00024 #include <QLabel>
00025 #include <QList>
00026 #include <QMap>
00027 #include <QPixmap>
00028 #include <QTimer>
00029 #include <QWidget>
00030 
00031 namespace rqt_multiplot {
00032   class StatusWidget :
00033     public QWidget {
00034   Q_OBJECT
00035   public:
00036     enum Role {
00037       Okay,
00038       Error,
00039       Busy
00040     };
00041 
00042     StatusWidget(QWidget* parent = 0, Role role = Okay);
00043     virtual ~StatusWidget();
00044 
00045     void setIcon(Role role, const QPixmap& icon);
00046     const QPixmap& getIcon(Role role) const;
00047     void setFrames(Role role, const QPixmap& frames, size_t numFrames,
00048       double frameRate = 10.0);
00049     void setFrames(Role role, const QList<QPixmap>& frameList, double
00050       frameRate = 10.0);
00051     const QList<QPixmap>& getFrames(Role role) const;
00052     void setFrameRate(Role role, double frameRate);
00053     double getFrameRate(Role role) const;
00054     void setCurrentRole(Role role, const QString& toolTip = QString());
00055     Role getCurrentRole() const;
00056 
00057     void pushCurrentRole();
00058     bool popCurrentRole();
00059 
00060   signals:
00061     void currentRoleChanged(Role role);
00062 
00063   private:
00064     QGridLayout* layout_;
00065     QLabel* labelIcon_;
00066     QTimer* timer_;
00067 
00068     QMap<Role, QList<QPixmap> > frames_;
00069     QMap<Role, double> frameRates_;
00070     QList<Role> roleStack_;
00071     QList<QString> toolTipStack_;
00072 
00073     Role currentRole_;
00074     size_t currentFrame_;
00075 
00076     void start();
00077     void step();
00078     void stop();
00079 
00080   private slots:
00081     void timerTimeout();
00082   };
00083 };
00084 
00085 #endif


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Thu Jun 6 2019 21:49:11