Sayonara Player
Loading...
Searching...
No Matches
ImageButton.h
1/* ImageButton.h
2 *
3 * Copyright (C) 2011-2024 Michael Lugmair
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef IMAGEBUTTON_H
22#define IMAGEBUTTON_H
23
24#include <QPushButton>
25#include "Utils/Pimpl.h"
26
27class QPixmap;
28
29namespace Gui
30{
32 public QObject
33 {
34 Q_OBJECT
36
37 signals:
38 void sigFinished();
39
40 public:
41 ByteArrayConverter(const QByteArray& data, const QString& mime);
43
44 QPixmap pixmap() const;
45
46 public slots:
47 void start();
48 };
49
50
51 class ImageButton : public QPushButton
52 {
53 Q_OBJECT
54 PIMPL(ImageButton)
55
56 signals:
57 void sigPixmapChanged();
58 void sigTriggered();
59
60 public:
61 explicit ImageButton(QWidget* parent=nullptr);
62 ~ImageButton() override;
63
64 QPixmap pixmap() const;
65 int verticalPadding() const;
66 void setFadingEnabled(bool b);
67
68 public slots:
69 void showDefaultPixmap();
70 void setPixmap(const QPixmap& pm);
71 void setPixmapPath(const QString& path);
72 void setCoverData(const QByteArray& data, const QString& mimetype);
73
74 private slots:
75 void timerTimedOut();
76 void byteconverterFinished();
77
78 private:
79 using QPushButton::setIcon;
80 using QPushButton::icon;
81
82 protected:
83 void paintEvent(QPaintEvent* e) override;
84 void resizeEvent(QResizeEvent* e) override;
85 void mouseMoveEvent(QMouseEvent* e) override;
86 void mouseReleaseEvent(QMouseEvent* event) override;
87 };
88}
89
90#endif // IMAGEBUTTON_H
Definition ImageButton.h:33
Definition ImageButton.h:52