Sayonara Player
ImageButton.h
1 #ifndef IMAGEBUTTON_H
2 #define IMAGEBUTTON_H
3 
4 #include <QPushButton>
5 #include "Utils/Pimpl.h"
6 
7 class QPixmap;
8 
9 namespace Gui
10 {
12  public QObject
13  {
14  Q_OBJECT
15  PIMPL(ByteArrayConverter)
16 
17  signals:
18  void sigFinished();
19 
20  public:
21  ByteArrayConverter(const QByteArray& data, const QString& mime);
23 
24  QPixmap pixmap() const;
25 
26  public slots:
27  void start();
28  };
29 
30 
31  class ImageButton : public QPushButton
32  {
33  Q_OBJECT
34  PIMPL(ImageButton)
35 
36  signals:
37  void sigPixmapChanged();
38  void sigTriggered();
39 
40  public:
41  explicit ImageButton(QWidget* parent=nullptr);
42  ~ImageButton() override;
43 
44  QPixmap pixmap() const;
45  int verticalPadding() const;
46 
47  void setFadingEnabled(bool b);
48 
49 
50  public slots:
51  void showDefaultPixmap();
52 
53  void setPixmap(const QPixmap& pm);
54  void setPixmapPath(const QString& path);
55 
61  void setCoverData(const QByteArray& data, const QString& mimetype);
62 
63  private slots:
64  void timerTimedOut();
65  void byteconverterFinished();
66 
67  private:
68  using QPushButton::setIcon;
69  using QPushButton::icon;
70 
71  protected:
72  void paintEvent(QPaintEvent* e) override;
73  void resizeEvent(QResizeEvent* e) override;
74  void mouseMoveEvent(QMouseEvent* e) override;
75  void mouseReleaseEvent(QMouseEvent* event) override;
76  };
77 }
78 
79 #endif // IMAGEBUTTON_H
Gui::ByteArrayConverter
Definition: ImageButton.h:13
Gui::Util::icon
QIcon icon(const QString &iconName, IconTheme themeName)
fetch a icon from resources
Gui::ImageButton
Definition: ImageButton.h:32
Gui::ImageButton::setCoverData
void setCoverData(const QByteArray &data, const QString &mimetype)
Sets the raw data parsed out of the audio file.