File indexing completed on 2024-05-05 04:47:19
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Pino Toscano <pino@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef ANIMATEDWIDGET_H 0018 #define ANIMATEDWIDGET_H 0019 0020 #include <qbasictimer.h> 0021 #include <qpixmap.h> 0022 #include <qwidget.h> 0023 0024 class AnimatedWidget : public QWidget 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 explicit AnimatedWidget( const QString& iconName, QWidget *parent = nullptr ); 0030 ~AnimatedWidget() override; 0031 0032 public Q_SLOTS: 0033 void start(); 0034 void stop(); 0035 0036 protected: 0037 void paintEvent( QPaintEvent *event ) override; 0038 void resizeEvent( QResizeEvent *event ) override; 0039 void timerEvent( QTimerEvent *event ) override; 0040 0041 private: 0042 void load(); 0043 0044 QString m_icon; 0045 QPixmap m_pixmap; 0046 int m_frames; 0047 int m_currentFrame; 0048 int m_size; 0049 QBasicTimer m_timer; 0050 }; 0051 0052 #endif