Go to the documentation of this file.00001 #ifndef _RQT_MRTA_STATUS_WIDGET_H_
00002 #define _RQT_MRTA_STATUS_WIDGET_H_
00003
00004 #include <QGridLayout>
00005 #include <QImage>
00006 #include <QLabel>
00007 #include <QList>
00008 #include <QMap>
00009 #include <QPixmap>
00010 #include <QTimer>
00011 #include <QWidget>
00012
00013 namespace rqt_mrta
00014 {
00015 class StatusWidget : public QWidget
00016 {
00017 Q_OBJECT
00018 public:
00019 enum Role
00020 {
00021 None,
00022 Okay,
00023 Warn,
00024 Error,
00025 Busy,
00026 Green,
00027 Yellow,
00028 Red,
00029 Blue,
00030 Gray
00031 };
00032 StatusWidget(QWidget* parent = NULL, Role role = None);
00033 virtual ~StatusWidget();
00034 void setIcon(Role role, const QPixmap& icon);
00035 const QPixmap& getIcon(Role role) const;
00036 void setFrames(Role role, const QPixmap& frames, size_t num_frames,
00037 double frame_fate = 10.0);
00038 void setFrames(Role role, const QList<QPixmap>& frame_list,
00039 double frame_rate = 10.0);
00040 const QList<QPixmap>& getFrames(Role role) const;
00041 void setFrameRate(Role role, double frame_rate);
00042 double getFrameRate(Role role) const;
00043 void setCurrentRole(Role role, const QString& tool_tip = QString());
00044 Role getCurrentRole() const;
00045 void pushCurrentRole();
00046 bool popCurrentRole();
00047
00048 signals:
00049 void currentRoleChanged(Role role);
00050
00051 private:
00052 QGridLayout* layout_;
00053 QLabel* label_icon_;
00054 QTimer* timer_;
00055 QMap<Role, QList<QPixmap>> frames_;
00056 QMap<Role, double> frame_rates_;
00057 QList<Role> role_stack_;
00058 QList<QString> tool_tip_stack_;
00059 Role current_role_;
00060 size_t current_frame_;
00061 void start();
00062 void step();
00063 void stop();
00064
00065 private slots:
00066 void timerTimeout();
00067 };
00068 }
00069
00070 #endif //_RQT_MRTA_STATUS_WIDGET_H_