1 /****************************************************************************************
2 * Copyright (c) 2009 Thomas Luebking <thomas.luebking@web.de>                          *
3 *                                                                                      *
4 * This program is free software; you can redistribute it and/or modify it under        *
5 * the terms of the GNU General Public License as published by the Free Software        *
6 * Foundation; either version 2 of the License, or (at your option) any later           *
7 * version.                                                                             *
8 *                                                                                      *
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
11 * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
12 *                                                                                      *
13 * You should have received a copy of the GNU General Public License along with         *
14 * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
15 ****************************************************************************************/
16 
17 #ifndef PLAYPAUSEBUTTON_H
18 #define PLAYPAUSEBUTTON_H
19 
20 #include "IconButton.h"
21 
22 #include <QImage>
23 
24 class PlayPauseButton : public IconButton
25 {
26     Q_OBJECT
27 
28 public:
29     explicit PlayPauseButton( QWidget *parent = nullptr );
playing()30     inline bool playing() const { return m_isPlaying; }
31     void setPlaying( bool playing );
32 
33 Q_SIGNALS:
34     void toggled(bool playing);
35 
36 protected:
37     void enterEvent( QEvent * ) override;
38     void leaveEvent( QEvent * ) override;
39     void mousePressEvent( QMouseEvent * ) override;
40     void reloadContent( const QSize &sz ) override;
41 
42 private Q_SLOTS:
43     void toggle();
44 
45 private:
46     bool m_isPlaying;
47     struct
48     {
49         QImage play[2], pause[2];
50     } m_icon;
51 };
52 
53 
54 #endif  // end include guard
55