Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Utils
Widgets
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
27
class
QPixmap;
28
29
namespace
Gui
30
{
31
class
ByteArrayConverter :
32
public
QObject
33
{
34
Q_OBJECT
35
PIMPL(ByteArrayConverter)
36
37
signals:
38
void
sigFinished();
39
40
public
:
41
ByteArrayConverter(
const
QByteArray& data,
const
QString& mime);
42
~ByteArrayConverter()
override
;
43
44
[[nodiscard]] QPixmap pixmap()
const
;
45
46
public
slots:
// NOLINT(*-redundant-access-specifiers)
47
void
start();
48
};
49
50
class
ImageButton :
51
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
[[nodiscard]] QPixmap pixmap()
const
;
65
[[nodiscard]]
int
verticalPadding()
const
;
66
[[nodiscard]]
int
horizontalPadding()
const
;
67
void
setFadingEnabled(
bool
b);
68
69
public
slots:
// NOLINT(*-redundant-access-specifiers)
70
void
showDefaultPixmap();
71
void
setPixmap(
const
QPixmap& pm);
72
void
setPixmapPath(
const
QString& path);
73
void
setCoverData(
const
QByteArray& data,
const
QString& mimetype);
74
75
protected
:
76
void
paintEvent(QPaintEvent* e)
override
;
77
void
resizeEvent(QResizeEvent* e)
override
;
78
void
mouseMoveEvent(QMouseEvent* e)
override
;
79
void
mouseReleaseEvent(QMouseEvent* event)
override
;
80
81
private
:
82
using
QPushButton::setIcon;
83
using
QPushButton::icon;
84
85
private
slots:
// NOLINT(*-redundant-access-specifiers)
86
void
timerTimedOut();
87
void
byteconverterFinished();
88
};
89
}
90
91
#endif
// IMAGEBUTTON_H
Generated on
for Sayonara Player by
1.17.0